(self["webpackChunkbrowser_extension"] = self["webpackChunkbrowser_extension"] || []).push([[535],{

/***/ 34418:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".copy-to-clipboard-wrapper {\n    position: relative;\n}\n\n.copy-to-clipboard {\n    cursor: pointer;\n}\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 68771:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".text-collapser {\n    padding: 12px 38px 12px 32px;\n    word-break: break-all;\n}\n\n    .text-collapser__copy-to-clipboard-wrapper {\n        display: inline;\n    }\n\n    .text-collapser__copy-to-clipboard {\n        display: inline;\n        vertical-align: middle;\n    }\n\n    .text-collapser__text {\n        display: inline-block;\n        vertical-align: middle;\n        width: auto;\n    }\n\n    .text-collapser__text-short {\n            overflow: hidden;\n            text-overflow: ellipsis;\n            display: -webkit-box;\n            -webkit-line-clamp: 3;\n            -webkit-box-orient: vertical;\n        }\n\n    .text-collapser__text-full {\n            overflow: visible;\n            text-overflow: initial;\n        }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 65426:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".popover {\n    display: inline-block;\n}\n\n    .popover--coming-soon {\n        cursor: help;\n        display: flex;\n    }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 70540:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".tooltip {\n    white-space: nowrap;\n    visibility: hidden;\n    opacity: 0;\n    padding: 8px 16px;\n    color: var(--text-main-text-main-default);\n    background-color: var(--fills-menus-dropdown-menu-background-default);\n    font-size: 12px;\n    line-height: 130%;\n    box-shadow: 4px 4px 8px 0px var(--shadow-0-1);\n    border-radius: 4px;\n}\n\n    .tooltip--fixed-width {\n        white-space: break-spaces;\n        width: -moz-max-content;\n        width: max-content;\n        max-width: 188px;\n    }\n\n    .tooltip--on {\n        visibility: visible;\n        opacity: 1;\n    }\n\n    .tooltip--off {\n        visibility: hidden;\n        opacity: 0;\n    }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 66481:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".button {\n    cursor: pointer;\n    text-decoration: none;\n    text-align: center;\n    display: inline-block;\n    border: 0;\n    background-color: transparent;\n    padding: 0;\n    overflow: hidden;\n    white-space: nowrap;\n    text-overflow: ellipsis;\n}\n\n    .button--l {\n        font-size: 16px;\n        font-weight: 600;\n        line-height: 24px;\n        padding: 16px;\n        border-radius: 8px;\n        max-height: 56px;\n    }\n\n    @media (max-width: 640px) {\n\n    .button--l {\n            max-width: 100%\n    }\n        }\n\n    .button:disabled {\n        opacity: 0.5;\n        cursor: default;\n        /*\n         * Do not add \"pointer-events: none;\" to disabled buttons,\n         * otherwise button title will not be displayed on hover\n         * if button text is too long\n         */\n    }\n\n    .button--green-bg {\n        color: var(--text-buttons-primary-default);\n        background-color: var(--fills-buttons-main-button-default);\n        transition: 0.3s ease background-color;\n    }\n\n    .button--green-bg:hover {\n            background-color: var(--fills-buttons-main-button-hovered);\n        }\n\n    .button--green-bg:hover:disabled {\n                background-color: var(--fills-buttons-main-button-default);\n            }\n\n    .button--red-bg {\n        color: var(--text-buttons-primary-default);\n        background-color: var(--fills-buttons-danger-button-default);\n        transition: 0.3s ease background-color;\n    }\n\n    .button--red-bg:hover {\n            background-color: var(--fills-buttons-danger-button-hovered);\n        }\n\n    .button--transparent {\n        box-shadow: 0 0 0 1px var(--stroke-buttons-secondary-default);\n        color: var(--text-main-text-main-default);\n        background-color: transparent;\n        transition: var(--t3) box-shadow, var(--t3) color;\n    }\n\n    .button--transparent:hover {\n            box-shadow: 0 0 0 1px var(--gray-50);\n            color: var(--gray-50);\n        }\n\n    .button--transparent:hover:disabled {\n                box-shadow: 0 0 0 1px var(--stroke-buttons-secondary-default);\n                color: var(--text-main-text-main-default);\n            }\n\n    .button--link {\n        overflow: visible;\n        font-size: inherit;\n        line-height: inherit;\n    }\n\n    .button--link--green {\n            color: var(--text-links-link-default);\n        }\n\n    .button--link--green:hover {\n                color: var(--text-links-link-hovered);\n            }\n\n    .button--link--red {\n            color: var(--text-links-error-link-default);\n        }\n\n    .button--link--red:hover {\n                color: var(--text-links-error-link-hovered);\n            }\n\n    .button--link--underlined {\n            text-decoration: underline;\n        }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 39735:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, "@font-face {\n    font-family: 'Roboto Flex';\n    src: url('../../../../assets/fonts/Roboto-Flex-Regular.woff2') format('woff2 supports variations'),\n       url('../../../../assets/fonts/Roboto-Flex-Regular.woff2') format('woff2-variations');\n    font-weight: 100 1000;\n    font-stretch: 25% 151%;\n}\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 74027:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, "/* 'display' property for 'icon' class should be set in specific page style files */\n    .icon--24 {\n        width: 24px;\n        height: 24px;\n    }\n    .icon--18 {\n        width: 18px;\n        height: 18px;\n    }\n    .icon--logo {\n        width: 107px;\n        height: 24px;\n        color: var(--fills-logo-key-color-default);\n    }\n    .icon--select {\n        width: 14px;\n        height: 8px;\n    }\n    @media (max-width: 640px) {\n    .icon--select {\n            width: 10px;\n            height: 6px\n    }\n        }\n    .icon--gray-default {\n        color: var(--stroke-icons-gray-icons-default);\n    }\n    .icon--green-default {\n        color: var(--stroke-icons-product-icon-default);\n    }\n    .icon--red-default {\n        color: var(--stroke-icons-error-icon-default);\n    }\n    .icon--loading {\n        pointer-events: none;\n        animation: loader-spin 1s infinite linear;\n        animation-fill-mode: forwards;\n    }\n    @keyframes loader-spin {\n        from {\n            -webkit-transform: rotate(0deg);\n        }\n        to {\n            -webkit-transform: rotate(360deg);\n        }\n    }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 81987:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ":root {\n    /*GRAYSCALE*/\n    --gray100: #f3f3f3;\n    --gray300: #d8d8d8;\n    --gray700: #888888;\n    --gray900: #4d4d4d;\n    --grayDark: #2a2a2a;\n    --black: #131313;\n    /*BRAND*/\n    --green400: #67b279;\n    /*ADDITIONAL*/\n    --outline: #005ecc;\n    /*EDITOR*/\n    --green-editor: #338033;\n    --yellow-editor500: #ffff00;\n    --blue-selection: rgb(181, 213, 255);\n    /* - dark mode*/\n    --cyan-editor: #4093d6;\n    --yellow-editor: #dbdb84;\n    --pink-editor: #c46cbd;\n    --orange-editor: #cf8263;\n    /* - light mode*/\n    --blue-editor: #4141e2;\n    --brown-editor: #795e26;\n    --purple-editor: #9e45b4;\n    --red-editor: #a31515;\n    /*FILTERING-LOG*/\n    --green-row: #dcffe5;\n    --green-row-hover: #c3ffd1;\n    --green-row-active: #a9ffbe;\n\n    /* NEW VARS */\n\n    /* Base colors: */\n\n    /* Context colors: */\n\n    /* vars that DO NOT change depand on the mode — same for light and dark mode: */\n}\n    /*FILTERING-LOG-DARK*/\n    @media (color-index: 48) {:root {\n        --green-row: #2c4332;\n        --green-row-hover: #3d6246;\n        --green-row-active: #457250;\n        --blue-selection: #556a86;\n        --outline: #99c9ff\n}\n    }\n    @media (color: 48842621) {:root {\n        --green-row: #2c4332;\n        --green-row-hover: #3d6246;\n        --green-row-active: #457250;\n        --blue-selection: #556a86;\n        --outline: #99c9ff\n}\n    }\n    @media (prefers-color-scheme: dark) {:root {\n        --green-row: #2c4332;\n        --green-row-hover: #3d6246;\n        --green-row-active: #457250;\n        --blue-selection: #556a86;\n        --outline: #99c9ff\n}\n    }\n    :root {\n\n    --gray05: rgba(239, 239, 239, 0.5);\n    --gray-base: var(--gray900);\n    --gray88: var(--gray700);\n    --t3: 0.3s ease;\n    --overlay-gray: rgba(137, 137, 137, 0.5);\n    --light-shadow: rgba(0, 0, 0, 0.05);\n    --sidebar-transition: 0.3s ease;\n    --z-idx5: 5;\n    --z-idx6: 6;\n    --z-idx7: 7;\n    --z-idx8: 8;\n    --z-idx10-options-notifications: 10;\n\n    --shadow-0-1: rgba(0, 0, 0, 0.1);\n\n    --product-primary-0: #f7fbf8;\n    --product-primary-10: #d9ecde;\n    --product-primary-20: #bedfc6;\n    --product-primary-30: #a2d0ad;\n    --product-primary-40: #84c193;\n    --product-primary-50: #67b279;\n    --product-primary-60: #5b9f6b;\n    --product-primary-70: #4e8c5d;\n    --product-primary-80: #42794f;\n    --product-primary-90: #366642;\n    --product-primary-100: #22482c;\n    --product-tertiary-50: #646fb8;\n    --gray-0: #ffffff;\n    --gray-10: #f6f6f6;\n    --gray-20: #e4e4e4;\n    --gray-30: #d2d2d2;\n    --gray-40: #c0c0c0;\n    --gray-50: #a4a4a4;\n    --gray-60: #7f7f7f;\n    --gray-70: #5b5b5b;\n    --gray-80: #3d3d3d;\n    --gray-90: #1f1f1f;\n    --gray-100: #000000;\n    --red-0: #fcece6;\n    --red-10: #f6c2b1;\n    --red-20: #f2a288;\n    --red-30: #ef9071;\n    --red-40: #ec7b55;\n    --red-50: #e9653a;\n    --red-60: #e75727;\n    --red-70: #dc4918;\n    --red-80: #bc3f15;\n    --red-90: #a13612;\n    --red-100: #77280d;\n    --orange-0: #fdf9f2;\n    --orange-10: #f5e2c1;\n    --orange-20: #eecb92;\n    --orange-30: #e5b460;\n    --orange-40: #de9e33;\n    --orange-50: #d58500;\n    --orange-60: #c77901;\n    --orange-70: #b76c01;\n    --orange-80: #a85f01;\n    --orange-90: #985201;\n    --orange-100: #803d00;\n    --fills-buttons-danger-button-default: var(--red-50);\n    --fills-buttons-danger-button-hovered: var(--red-60);\n    --fills-buttons-danger-button-pressed: var(--red-70);\n    --fills-buttons-main-button-default: var(--product-primary-50);\n    --fills-buttons-main-button-hovered: var(--product-primary-60);\n    --fills-buttons-main-button-pressed: var(--product-primary-70);\n    --fills-logo-white-color-default: var(--gray-0);\n    --fills-snacks-mobile-snacks-default: var(--gray-100);\n    --stroke-dividers-item-divider-green-default: var(--product-primary-50);\n    --stroke-dividers-item-divider-orange-default: var(--orange-50);\n    --stroke-buttons-secondary-green-default: var(--product-primary-50);\n    --stroke-buttons-secondary-red-default: var(--red-50);\n    --stroke-icons-attention-icon-default: var(--orange-50);\n    --stroke-icons-black-icons-disabled: var(--gray-50);\n    --stroke-icons-error-icon-default: var(--red-50);\n    --stroke-icons-error-icon-hovered: var(--red-60);\n    --stroke-icons-error-icon-pressed: var(--red-70);\n    --stroke-icons-product-icon-default: var(--product-primary-50);\n    --stroke-icons-product-icon-hovered: var(--product-primary-60);\n    --stroke-icons-product-icon-pressed: var(--product-primary-70);\n    --stroke-inputs-error-input-stroke-default: var(--red-50);\n    --stroke-inputs-active-input-stroke-default: var(--gray-50);\n    --text-buttons-primary-default: var(--gray-0);\n    --text-buttons-secondary-green-default: var(--product-primary-50);\n    --text-buttons-secondary-red-default: var(--red-50);\n    --text-links-attention-link-default: var(--orange-50);\n    --text-links-error-link-default: var(--red-50);\n    --text-links-error-link-hovered: var(--red-60);\n    --text-links-link-default: var(--product-primary-50);\n    --text-links-link-hovered: var(--product-primary-60);\n    --product-tertiary-icon-default: var(--product-tertiary-50);\n    --fills-backgrounds-cards-background-default: var(--gray-0);\n    --fills-backgrounds-page-background-default: var(--gray-0);\n    --fills-backgrounds-page-background-hovered: var(--gray-10);\n    --fills-backgrounds-page-background-pressed: var(--gray-20);\n    --fills-backgrounds-page-background-additional-default: var(--gray-10);\n    --fills-backgrounds-page-background-additional-hovered: var(--gray-20);\n    --fills-backgrounds-recent-activity-request-allowlisted-default: var(--product-primary-10);\n    --fills-backgrounds-recent-activity-request-allowlisted-hovered: var(--product-primary-20);\n    --fills-backgrounds-recent-activity-request-allowlisted-pressed: var(--product-primary-30);\n    --fills-backgrounds-recent-activity-request-blocked-default: var(--red-10);\n    --fills-backgrounds-recent-activity-request-blocked-hovered: var(--red-20);\n    --fills-backgrounds-recent-activity-request-blocked-pressed: var(--red-30);\n    --fills-backgrounds-recent-activity-request-changed-default: var(--orange-10);\n    --fills-backgrounds-recent-activity-request-changed-hovered: var(--orange-20);\n    --fills-backgrounds-recent-activity-request-changed-pressed: var(--orange-30);\n    --fills-buttons-main-button-default-inactive: var(--gray-50);\n    --fills-inputs-input-background-default: var(--gray-10);\n    --fills-inputs-input-background-disabled: var(--gray-10);\n    --fills-loaders-background-default: var(--gray-20);\n    --fills-logo-key-color-default: var(--gray-90);\n    --fills-menus-dropdown-menu-background-default: var(--gray-0);\n    --fills-menus-dropdown-menu-background-hovered: var(--gray-10);\n    --fills-menus-dropdown-menu-background-pressed: var(--gray-20);\n    --stroke-buttons-secondary-default: var(--gray-80);\n    --stroke-dividers-item-divider-default: var(--gray-30);\n    --stroke-icons-gray-icons-default: var(--gray-60);\n    --stroke-inputs-inactive-input-stroke-disabled: var(--gray-20);\n    --stroke-inputs-inactive-input-stroke-default: var(--gray-30);\n    --text-description-description-default: var(--gray-60);\n    --text-lables-labels-default: var(--gray-70);\n    --text-main-text-main-default: var(--gray-80);\n    --text-placeholder-placeholder-disabled: var(--gray-40)\n}\n    /* vars that change depand on the mode: */\n    @media (color-index: 48) {:root {\n        --fills-backgrounds-cards-background-default: var(--gray-80);\n        --fills-backgrounds-page-background-default: var(--gray-90);\n        --fills-backgrounds-page-background-hovered: var(--gray-80);\n        --fills-backgrounds-page-background-pressed: var(--gray-70);\n        --fills-backgrounds-page-background-additional-default: var(--gray-80);\n        --fills-backgrounds-page-background-additional-hovered: var(--gray-70);\n        --fills-backgrounds-recent-activity-request-allowlisted-default: var(--product-primary-90);\n        --fills-backgrounds-recent-activity-request-allowlisted-hovered: var(--product-primary-80);\n        --fills-backgrounds-recent-activity-request-allowlisted-pressed: var(--product-primary-70);\n        --fills-backgrounds-recent-activity-request-blocked-default: var(--red-100);\n        --fills-backgrounds-recent-activity-request-blocked-hovered: var(--red-90);\n        --fills-backgrounds-recent-activity-request-blocked-pressed: var(--red-80);\n        --fills-backgrounds-recent-activity-request-changed-default: var(--orange-100);\n        --fills-backgrounds-recent-activity-request-changed-hovered: var(--orange-90);\n        --fills-backgrounds-recent-activity-request-changed-pressed: var(--orange-80);\n        --fills-buttons-main-button-default-inactive: var(--gray-60);\n        --fills-inputs-input-background-default: var(--gray-80);\n        --fills-inputs-input-background-disabled: var(--gray-80);\n        --fills-loaders-background-default: var(--gray-70);\n        --fills-logo-key-color-default: var(--gray-10);\n        --fills-menus-dropdown-menu-background-default: var(--gray-80);\n        --fills-menus-dropdown-menu-background-hovered: var(--gray-70);\n        --fills-menus-dropdown-menu-background-pressed: var(--gray-60);\n        --stroke-buttons-secondary-default: var(--gray-20);\n        --stroke-dividers-item-divider-default: var(--gray-70);\n        --stroke-icons-gray-icons-default: var(--gray-40);\n        --stroke-inputs-inactive-input-stroke-disabled: var(--gray-80);\n        --stroke-inputs-inactive-input-stroke-default: var(--gray-70);\n        --text-description-description-default: var(--gray-40);\n        --text-lables-labels-default: var(--gray-30);\n        --text-main-text-main-default: var(--gray-20);\n        --text-placeholder-placeholder-disabled: var(--gray-60)\n}\n    }\n    @media (color: 48842621) {:root {\n        --fills-backgrounds-cards-background-default: var(--gray-80);\n        --fills-backgrounds-page-background-default: var(--gray-90);\n        --fills-backgrounds-page-background-hovered: var(--gray-80);\n        --fills-backgrounds-page-background-pressed: var(--gray-70);\n        --fills-backgrounds-page-background-additional-default: var(--gray-80);\n        --fills-backgrounds-page-background-additional-hovered: var(--gray-70);\n        --fills-backgrounds-recent-activity-request-allowlisted-default: var(--product-primary-90);\n        --fills-backgrounds-recent-activity-request-allowlisted-hovered: var(--product-primary-80);\n        --fills-backgrounds-recent-activity-request-allowlisted-pressed: var(--product-primary-70);\n        --fills-backgrounds-recent-activity-request-blocked-default: var(--red-100);\n        --fills-backgrounds-recent-activity-request-blocked-hovered: var(--red-90);\n        --fills-backgrounds-recent-activity-request-blocked-pressed: var(--red-80);\n        --fills-backgrounds-recent-activity-request-changed-default: var(--orange-100);\n        --fills-backgrounds-recent-activity-request-changed-hovered: var(--orange-90);\n        --fills-backgrounds-recent-activity-request-changed-pressed: var(--orange-80);\n        --fills-buttons-main-button-default-inactive: var(--gray-60);\n        --fills-inputs-input-background-default: var(--gray-80);\n        --fills-inputs-input-background-disabled: var(--gray-80);\n        --fills-loaders-background-default: var(--gray-70);\n        --fills-logo-key-color-default: var(--gray-10);\n        --fills-menus-dropdown-menu-background-default: var(--gray-80);\n        --fills-menus-dropdown-menu-background-hovered: var(--gray-70);\n        --fills-menus-dropdown-menu-background-pressed: var(--gray-60);\n        --stroke-buttons-secondary-default: var(--gray-20);\n        --stroke-dividers-item-divider-default: var(--gray-70);\n        --stroke-icons-gray-icons-default: var(--gray-40);\n        --stroke-inputs-inactive-input-stroke-disabled: var(--gray-80);\n        --stroke-inputs-inactive-input-stroke-default: var(--gray-70);\n        --text-description-description-default: var(--gray-40);\n        --text-lables-labels-default: var(--gray-30);\n        --text-main-text-main-default: var(--gray-20);\n        --text-placeholder-placeholder-disabled: var(--gray-60)\n}\n    }\n    @media (prefers-color-scheme: dark) {:root {\n        --fills-backgrounds-cards-background-default: var(--gray-80);\n        --fills-backgrounds-page-background-default: var(--gray-90);\n        --fills-backgrounds-page-background-hovered: var(--gray-80);\n        --fills-backgrounds-page-background-pressed: var(--gray-70);\n        --fills-backgrounds-page-background-additional-default: var(--gray-80);\n        --fills-backgrounds-page-background-additional-hovered: var(--gray-70);\n        --fills-backgrounds-recent-activity-request-allowlisted-default: var(--product-primary-90);\n        --fills-backgrounds-recent-activity-request-allowlisted-hovered: var(--product-primary-80);\n        --fills-backgrounds-recent-activity-request-allowlisted-pressed: var(--product-primary-70);\n        --fills-backgrounds-recent-activity-request-blocked-default: var(--red-100);\n        --fills-backgrounds-recent-activity-request-blocked-hovered: var(--red-90);\n        --fills-backgrounds-recent-activity-request-blocked-pressed: var(--red-80);\n        --fills-backgrounds-recent-activity-request-changed-default: var(--orange-100);\n        --fills-backgrounds-recent-activity-request-changed-hovered: var(--orange-90);\n        --fills-backgrounds-recent-activity-request-changed-pressed: var(--orange-80);\n        --fills-buttons-main-button-default-inactive: var(--gray-60);\n        --fills-inputs-input-background-default: var(--gray-80);\n        --fills-inputs-input-background-disabled: var(--gray-80);\n        --fills-loaders-background-default: var(--gray-70);\n        --fills-logo-key-color-default: var(--gray-10);\n        --fills-menus-dropdown-menu-background-default: var(--gray-80);\n        --fills-menus-dropdown-menu-background-hovered: var(--gray-70);\n        --fills-menus-dropdown-menu-background-pressed: var(--gray-60);\n        --stroke-buttons-secondary-default: var(--gray-20);\n        --stroke-dividers-item-divider-default: var(--gray-70);\n        --stroke-icons-gray-icons-default: var(--gray-40);\n        --stroke-inputs-inactive-input-stroke-disabled: var(--gray-80);\n        --stroke-inputs-inactive-input-stroke-default: var(--gray-70);\n        --text-description-description-default: var(--gray-40);\n        --text-lables-labels-default: var(--gray-30);\n        --text-main-text-main-default: var(--gray-20);\n        --text-placeholder-placeholder-disabled: var(--gray-60)\n}\n    }\n\n.dark-mode {\n    --green-row: #2c4332;\n    --green-row-hover: #3d6246;\n    --green-row-active: #457250;\n    --blue-selection: #556a86;\n    --outline: #99c9ff;\n\n    --fills-backgrounds-cards-background-default: var(--gray-80);\n    --fills-backgrounds-page-background-default: var(--gray-90);\n    --fills-backgrounds-page-background-hovered: var(--gray-80);\n    --fills-backgrounds-page-background-pressed: var(--gray-70);\n    --fills-backgrounds-page-background-additional-default: var(--gray-80);\n    --fills-backgrounds-page-background-additional-hovered: var(--gray-70);\n    --fills-backgrounds-recent-activity-request-allowlisted-default: var(--product-primary-90);\n    --fills-backgrounds-recent-activity-request-allowlisted-hovered: var(--product-primary-80);\n    --fills-backgrounds-recent-activity-request-allowlisted-pressed: var(--product-primary-70);\n    --fills-backgrounds-recent-activity-request-blocked-default: var(--red-100);\n    --fills-backgrounds-recent-activity-request-blocked-hovered: var(--red-90);\n    --fills-backgrounds-recent-activity-request-blocked-pressed: var(--red-80);\n    --fills-backgrounds-recent-activity-request-changed-default: var(--orange-100);\n    --fills-backgrounds-recent-activity-request-changed-hovered: var(--orange-90);\n    --fills-backgrounds-recent-activity-request-changed-pressed: var(--orange-80);\n    --fills-buttons-main-button-default-inactive: var(--gray-60);\n    --fills-inputs-input-background-default: var(--gray-80);\n    --fills-inputs-input-background-disabled: var(--gray-80);\n    --fills-loaders-background-default: var(--gray-70);\n    --fills-logo-key-color-default: var(--gray-10);\n    --fills-menus-dropdown-menu-background-default: var(--gray-80);\n    --fills-menus-dropdown-menu-background-hovered: var(--gray-70);\n    --fills-menus-dropdown-menu-background-pressed: var(--gray-60);\n    --stroke-buttons-secondary-default: var(--gray-20);\n    --stroke-dividers-item-divider-default: var(--gray-70);\n    --stroke-icons-gray-icons-default: var(--gray-40);\n    --stroke-inputs-inactive-input-stroke-disabled: var(--gray-80);\n    --stroke-inputs-inactive-input-stroke-default: var(--gray-70);\n    --text-description-description-default: var(--gray-40);\n    --text-lables-labels-default: var(--gray-30);\n    --text-main-text-main-default: var(--gray-20);\n    --text-placeholder-placeholder-disabled: var(--gray-60);\n}\n\n.light-mode {\n    --green-row: #dcffe5;\n    --green-row-hover: #c3ffd1;\n    --green-row-active: #a9ffbe;\n    --blue-selection: rgb(181, 213, 255);\n    --outline: #005ecc;\n\n    --fills-backgrounds-cards-background-default: var(--gray-0);\n    --fills-backgrounds-page-background-default: var(--gray-0);\n    --fills-backgrounds-page-background-hovered: var(--gray-10);\n    --fills-backgrounds-page-background-pressed: var(--gray-20);\n    --fills-backgrounds-page-background-additional-default: var(--gray-10);\n    --fills-backgrounds-page-background-additional-hovered: var(--gray-20);\n    --fills-backgrounds-recent-activity-request-allowlisted-default: var(--product-primary-10);\n    --fills-backgrounds-recent-activity-request-allowlisted-hovered: var(--product-primary-20);\n    --fills-backgrounds-recent-activity-request-allowlisted-pressed: var(--product-primary-30);\n    --fills-backgrounds-recent-activity-request-blocked-default: var(--red-10);\n    --fills-backgrounds-recent-activity-request-blocked-hovered: var(--red-20);\n    --fills-backgrounds-recent-activity-request-blocked-pressed: var(--red-30);\n    --fills-backgrounds-recent-activity-request-changed-default: var(--orange-10);\n    --fills-backgrounds-recent-activity-request-changed-hovered: var(--orange-20);\n    --fills-backgrounds-recent-activity-request-changed-pressed: var(--orange-30);\n    --fills-buttons-main-button-default-inactive: var(--gray-50);\n    --fills-inputs-input-background-default: var(--gray-10);\n    --fills-inputs-input-background-disabled: var(--gray-10);\n    --fills-loaders-background-default: var(--gray-20);\n    --fills-logo-key-color-default: var(--gray-90);\n    --fills-menus-dropdown-menu-background-default: var(--gray-0);\n    --fills-menus-dropdown-menu-background-hovered: var(--gray-10);\n    --fills-menus-dropdown-menu-background-pressed: var(--gray-20);\n    --stroke-buttons-secondary-default: var(--gray-80);\n    --stroke-dividers-item-divider-default: var(--gray-30);\n    --stroke-icons-gray-icons-default: var(--gray-60);\n    --stroke-inputs-inactive-input-stroke-disabled: var(--gray-20);\n    --stroke-inputs-inactive-input-stroke-default: var(--gray-30);\n    --text-description-description-default: var(--gray-60);\n    --text-lables-labels-default: var(--gray-70);\n    --text-main-text-main-default: var(--gray-80);\n    --text-placeholder-placeholder-disabled: var(--gray-40);\n}\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 45649:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".actions {\n    padding: 16px 16px 8px;\n    position: relative;\n    z-index: 10;\n    display: inline-flex;\n    align-items: center;\n    width: 100%;\n}\n\n    @media (max-width: 640px) {.actions {\n        flex-wrap: wrap\n}\n    }\n\n    .actions__col {\n        display: inline-flex;\n        align-items: center;\n        flex-shrink: 1;\n    }\n\n    .actions__tab-selector {\n        width: 400px;\n    }\n\n    @media (max-width: 640px) {\n\n    .actions__tab-selector {\n            width: 330px\n    }\n        }\n\n    .actions__buttons {\n        min-width: 154px;\n        height: 24px;\n        padding: 8px 24px 8px 8px;\n    }\n\n    .actions__search {\n        width: 330px;\n    }\n\n    @media (min-width: 640px) {\n\n    .actions__search {\n            width: calc(100% - 427px)\n    }\n        }\n\n    @media (min-width: 820px) {\n\n    .actions__search {\n            width: calc(100% - 527px)\n    }\n        }\n\n    @media (min-width: 1024px) {\n\n    .actions__search {\n            width: calc(100% - 617px)\n    }\n        }\n\n    @media (max-width: 1200px) {.actions {\n        transform: translateY(0)\n}\n    }\n\n    .actions__action {\n        max-height: 24px;\n        margin: 8px;\n        display: inline-block;\n        vertical-align: middle;\n        white-space: nowrap;\n    }\n\n    .actions__action > .checkbox-label {\n            margin-bottom: 0;\n        }\n\n    .actions__refresh {\n        border: 0;\n        padding: 0;\n        max-height: 24px;\n        cursor: pointer;\n        background-color: transparent;\n        display: flex;\n        align-items: center;\n    }\n\n    .actions__refresh--icon {\n            color: var(--stroke-icons-product-icon-default);\n        }\n\n    .actions__refresh--text {\n            font-size: 14px;\n            line-height: 18px;\n            font-weight: 400;\n            margin-left: 8px;\n            color: var(--text-main-text-main-default);\n        }\n\n    .actions__clear {\n        cursor: pointer;\n        border: 0;\n        padding: 0;\n        font-size: 14px;\n        font-weight: 400;\n        background-color: transparent;\n        display: flex;\n        align-items: center;\n    }\n\n    .actions__preserve {\n        font-size: 15px;\n    }\n\n    @media (max-width: 640px) {\n\n    .actions__preserve {\n            width: 100%\n    }\n        }\n\n.record {\n    position: relative;\n    box-sizing: border-box;\n    color: var(--stroke-icons-gray-icons-default);\n}\n\n.record.active {\n        color: var(--stroke-icons-error-icon-default);\n    }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 18118:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".filtering-log {\n    display: flex;\n    max-width: 100%;\n    height: 100%;\n    overflow: hidden;\n    -webkit-user-select: none;\n       -moz-user-select: none;\n            user-select: none;\n    color: var(--text-main-text-main-default);\n}\n\n    .filtering-log * {\n        box-sizing: border-box;\n    }\n\n    .filtering-log__inner {\n        table-layout: fixed;\n        width: 100%;\n        height: 100%;\n    }\n\n    .filtering-log__inner .thead {\n            min-width: 100%;\n            position: sticky;\n            z-index: 2;\n            background-color: var(--fills-backgrounds-page-background-default);\n            border-bottom: 1px solid var(--stroke-dividers-item-divider-default);\n        }\n\n    .filtering-log__inner .thead .th {\n            background-color: var(--fills-backgrounds-page-background-default);\n            border-bottom: 1px solid var(--stroke-dividers-item-divider-default);\n        }\n\n    .filtering-log__inner .tbody {\n            z-index: 1;\n        }\n\n    .filtering-log__inner .tr--tbody {\n            border: 0;\n            border-bottom: 1px solid var(--stroke-dividers-item-divider-default);\n            background-color: transparent;\n            text-align: left;\n            padding: 0;\n            width: 100%;\n\n            /* stealth exceptions */\n        }\n\n    .filtering-log__inner .tr--tbody:focus {\n                z-index: 1;\n            }\n\n    .filtering-log__inner .tr--tbody:hover {\n                cursor: pointer;\n                background: var(--fills-backgrounds-page-background-hovered);\n            }\n\n    .filtering-log__inner .tr--tbody:active {\n                background: var(--fills-backgrounds-page-background-pressed);\n            }\n\n    /* blocked */\n\n    .filtering-log__inner .tr--tbody.red {\n                background-color: var(--fills-backgrounds-recent-activity-request-blocked-default);\n            }\n\n    .filtering-log__inner .tr--tbody.red:hover {\n                    background-color: var(--fills-backgrounds-recent-activity-request-blocked-hovered);\n                }\n\n    .filtering-log__inner .tr--tbody.red:active {\n                    background-color: var(--fills-backgrounds-recent-activity-request-blocked-pressed);\n                }\n\n    /* TODO: style as allowlist (check comments in the design) */\n\n    .filtering-log__inner .tr--tbody.green {\n                background-color: var(--green-row);\n            }\n\n    .filtering-log__inner .tr--tbody.green:hover {\n                    background-color: var(--green-row-hover);\n                }\n\n    .filtering-log__inner .tr--tbody.green:active {\n                    background-color: var(--green-row-active);\n                }\n\n    /* allowlist (non-stealth) exceptions */\n\n    .filtering-log__inner .tr--tbody.light-green {\n                background-color: var(--fills-backgrounds-recent-activity-request-allowlisted-default);\n            }\n\n    .filtering-log__inner .tr--tbody.light-green:hover {\n                    background-color: var(--fills-backgrounds-recent-activity-request-allowlisted-hovered);\n                }\n\n    .filtering-log__inner .tr--tbody.light-green:active {\n                    background-color: var(--fills-backgrounds-recent-activity-request-allowlisted-pressed);\n                }\n\n    /* mofidied */\n\n    .filtering-log__inner .tr--tbody.yellow {\n                background-color: var(--fills-backgrounds-recent-activity-request-changed-default);\n            }\n\n    .filtering-log__inner .tr--tbody.yellow:hover {\n                    background-color: var(--fills-backgrounds-recent-activity-request-changed-hovered);\n                }\n\n    .filtering-log__inner .tr--tbody.yellow:active {\n                    background-color: var(--fills-backgrounds-recent-activity-request-changed-pressed);\n                }\n\n    .filtering-log__inner .tr--active, .filtering-log__inner .tr--active:hover {\n            background: var(--fills-backgrounds-page-background-pressed);\n        }\n\n    .filtering-log__inner .tr--active.red, .filtering-log__inner .tr--active.red:hover, .filtering-log__inner .tr--active:hover.red, .filtering-log__inner .tr--active:hover.red:hover {\n                background-color: var(--fills-backgrounds-recent-activity-request-blocked-pressed);\n            }\n\n    .filtering-log__inner .tr--active.green, .filtering-log__inner .tr--active.green:hover, .filtering-log__inner .tr--active:hover.green, .filtering-log__inner .tr--active:hover.green:hover {\n                background-color: var(--green-row-active);\n            }\n\n    .filtering-log__inner .tr--active.light-green, .filtering-log__inner .tr--active.light-green:hover, .filtering-log__inner .tr--active:hover.light-green, .filtering-log__inner .tr--active:hover.light-green:hover {\n                background-color: var(--fills-backgrounds-recent-activity-request-allowlisted-pressed);\n            }\n\n    .filtering-log__inner .tr--active.yellow, .filtering-log__inner .tr--active.yellow:hover, .filtering-log__inner .tr--active:hover.yellow, .filtering-log__inner .tr--active:hover.yellow:hover {\n                background-color: var(--fills-backgrounds-recent-activity-request-changed-pressed);\n            }\n\n    .filtering-log__inner .thead .tr {\n            border-top: 0;\n        }\n\n    .filtering-log__inner .list {\n            width: 100vw;\n            z-index: 1;\n            scrollbar-width: thin;\n            scrollbar-color: var(--stroke-inputs-inactive-input-stroke-default) var(--fills-backgrounds-page-background-default);\n        }\n\n    .filtering-log__inner .th {\n            text-align: left;\n            padding: 7px 10px;\n            font-size: 14px;\n            position: relative;\n        }\n\n    .filtering-log__inner .th:first-child {\n                width: 40%;\n            }\n\n    @media (max-width: 640px) {\n\n    .filtering-log__inner .th:first-child {\n                    padding-left: 16px\n            }\n                }\n\n    .filtering-log__inner .th:nth-child(2) {\n                width: 10%;\n            }\n\n    .filtering-log__inner .th:last-child:after {\n                    display: none;\n                }\n\n    .filtering-log__inner .td {\n            white-space: nowrap;\n            text-overflow: ellipsis;\n            overflow: hidden;\n            padding: 8px 10px;\n            color: var(--text-main-text-main-default);\n            font-size: 14px;\n        }\n\n    @media (max-width: 640px) {\n\n    .filtering-log__inner .td:first-child {\n                    padding-left: 16px\n            }\n                }\n\n    .filtering-log__empty {\n        width: 100vw;\n        height: 100%;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n        /* do not remove \"position\" and \"z-index\" */\n        /* due to AG-10446 */\n        position: relative;\n        z-index: 9;\n    }\n\n    .filtering-log__empty-in {\n        width: 340px;\n        display: flex;\n        flex-direction: column;\n        color: var(--text-description-description-default);\n    }\n\n    .filtering-log__empty-img {\n        width: 64px;\n        height: 64px;\n        margin: 0 auto;\n    }\n\n    .filtering-log__desc {\n        text-align: center;\n        font-size: 16px;\n        line-height: 21px;\n    }\n\n    .filtering-log__th {\n        line-height: 30px;\n    }\n\n    .filtering-log .table .tr {\n            height: 30px;\n            display: flex;\n            flex-wrap: nowrap;\n            width: auto!important;\n            min-width: 100%;\n        }\n\n    .filtering-log .table .resizer {\n            display: inline-block;\n            background: transparent;\n            width: 20px;\n            height: 100%;\n            position: absolute;\n            right: 0;\n            top: 0;\n            z-index: 1;\n            /* prevents from scrolling while dragging on touch devices */\n            touch-action: none;\n        }\n\n    .filtering-log .table .resizer:after {\n                content: \"\";\n                display: block;\n                position: absolute;\n                top: calc(50% - 10px);\n                right: 50%;\n                width: 1px;\n                height: 20px;\n                background-color: var(--stroke-dividers-item-divider-default);\n            }\n\n    .filtering-log .table .th, .filtering-log .table .td {\n            flex-shrink: 0;\n            height: 30px;\n            display: inline-block;\n            width: 20%;\n            text-overflow: ellipsis;\n            white-space: nowrap;\n            overflow: hidden;\n        }\n\n    .filtering-log .table .th {\n            padding: 7px 10px;\n            font-weight: 450;\n        }\n\n    .filtering-log .table .td {\n            padding: 0 10px;\n            line-height: 30px;\n        }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 15278:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".events-types__content {\n        white-space: nowrap;\n    }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 40204:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".miscellaneous-filters {\n    margin-left: auto;\n    display: flex;\n    position: relative;\n}\n\n    .miscellaneous-filters__section {\n        white-space: nowrap;\n        border-right: 1px solid var(--stroke-dividers-item-divider-default);\n        margin-right: 8px;\n    }\n\n    .miscellaneous-filters__filters {\n        display: flex;\n        width: auto;\n        min-width: 160px;\n        position: static;\n        z-index: 2;\n        right: 30px;\n        top: 10px;\n        font-size: 13px;\n    }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 35356:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".tab-selector {\n    position: relative;\n    width: 100%;\n}\n\n    .tab-selector__result {\n        display: flex;\n        flex-direction: column;\n        position: absolute;\n        z-index: 21;\n        top: 100%;\n        max-height: 288px;\n        overflow-y: auto;\n        box-shadow: 8px 8px 24px 0px var(--shadow-0-1);\n        border-radius: 8px;\n        width: 400px;\n        scrollbar-width: thin;\n    }\n\n    @media (max-width: 640px) {\n\n    .tab-selector__result {\n            width: 330px\n    }\n        }\n\n    .tab-selector__result-item {\n        cursor: pointer;\n        padding: 8px 16px;\n        border: 0;\n        background-color: var(--fills-menus-dropdown-menu-background-default);\n        height: 40px;\n        max-width: 100%;\n        display: flex;\n        flex-direction: row;\n        align-items: center;\n        justify-content: space-between;\n    }\n\n    .tab-selector__result-item--text {\n            font-size: 14px;\n            line-height: 24px;\n            font-weight: 400;\n            white-space: nowrap;\n            overflow: hidden;\n            text-overflow: ellipsis;\n        }\n\n    .tab-selector__result-item--text--active {\n                font-weight: 600;\n                padding-right: 16px;\n            }\n\n    .tab-selector__result-item:hover {\n            background-color: var(--fills-menus-dropdown-menu-background-hovered);\n        }\n\n    .tab-selector__result-item:active {\n            background-color: var(--fills-menus-dropdown-menu-background-pressed);\n        }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 84603:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".filters {\n    display: flex;\n    flex-wrap: wrap;\n}\n\n    .filters__tab-selector {\n        padding: 16px;\n        box-sizing: border-box;\n        width: 360px;\n    }\n\n    @media (max-width: 640px) {\n\n    .filters__tab-selector {\n            padding-bottom: 12px\n    }\n        }\n\n    @media (max-width: 1200px) {\n\n    .filters__tab-selector {\n            width: 55%\n    }\n        }\n\n    @media (max-width: 640px) {\n\n    .filters__tab-selector {\n            width: 100%\n    }\n        }\n\n    .filters__events-search {\n        padding: 16px;\n        box-sizing: border-box;\n        width: 400px;\n    }\n\n    @media (max-width: 640px) {\n\n    .filters__events-search {\n            padding-top: 12px\n    }\n        }\n\n    @media (max-width: 1579px) {\n\n    .filters__events-search {\n            width: 45%\n    }\n        }\n\n    @media (max-width: 640px) {\n\n    .filters__events-search {\n            width: 100%\n    }\n        }\n\n    .filters__events-tags {\n        overflow-x: hidden;\n        position: relative;\n        padding: 0 24px;\n    }\n\n    @media (max-width: 640px) {\n\n    .filters__events-tags {\n            padding: 0 20px\n    }\n        }\n\n    .filters__arrow {\n        width: 24px;\n        height: 24px;\n        position: absolute;\n        top: -4px;\n        color: var(--gray700);\n        background-color: transparent;\n        border: 0;\n        padding: 0;\n        cursor: pointer;\n    }\n\n    .filters__arrow__icon {\n            width: 24px;\n            height: 24px;\n        }\n\n    .filters__arrow--left {\n            top: 6px;\n            left: -2px;\n        }\n\n    @media (min-width: 640px) {\n\n    .filters__arrow--left {\n                left: 0\n        }\n            }\n\n    .filters__arrow--right {\n            top: 6px;\n            right: -2px;\n            transform: rotate(180deg);\n        }\n\n    @media (min-width: 640px) {\n\n    .filters__arrow--right {\n                right: 0\n        }\n            }\n\n    .filters__events-filters {\n        scroll-behavior: smooth;\n        display: flex;\n        overflow-x: auto;\n        padding: 8px 0;\n        -ms-overflow-style: none;\n        scrollbar-width: none;\n    }\n\n    .filters__events-filters::-webkit-scrollbar {\n            display: none;\n        }\n\n    @media (min-width: 1350px) {\n\n    .filters__events-filters .filters__arrow {\n                display: none\n        }\n            }\n\n    .filters__miscellaneous-filters {\n        margin: 4px 20px 0 auto;\n        font-size: 13px;\n    }\n\n    @media (max-width: 640px) {\n\n    .filters__miscellaneous-filters {\n            margin: 4px 8px 0 auto\n    }\n        }\n\n    .filters__nav {\n        display: flex;\n        flex-wrap: wrap;\n        width: 100%;\n        align-items: center;\n    }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 35460:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".radio-button-label,\n.checkbox-label {\n    white-space: nowrap;\n    word-break: inherit;\n}\n\n.radio-button {\n    min-width: 17px;\n    align-self: flex-start;\n}\n\n.request-modal__rule-text {\n        font-size: 16px;\n        border-radius: 4px;\n        padding: 8px;\n        border: 1px solid var(--stroke-inputs-active-input-stroke-default);\n        background-color: var(--fills-inputs-input-background-default);\n        resize: vertical;\n    }\n\n.request-modal__view {\n        scrollbar-width: none;\n    }\n\n.request-modal__view::-webkit-scrollbar {\n            display: none;\n        }\n\n.patterns,\n.options {\n    font-size: 16px;\n    word-break: break-all;\n}\n\n.patterns > .request-info__key, .options > .request-info__key {\n        margin-bottom: 16px;\n    }\n\n.patterns__content > .radio-button-label,.options__content > .radio-button-label{\n            margin-bottom: 22px;\n        }\n\n.patterns__content > .radio-button-label:only-child, .options__content > .radio-button-label:only-child {\n                margin-bottom: 0;\n            }\n\n@media (min-width: 640px) {\n                .patterns__content > .radio-button-label:last-child, .options__content > .radio-button-label:last-child {\n                    margin-bottom: 0;\n                }\n            }\n\n.patterns__content > .checkbox-label:not(:only-child), .options__content > .checkbox-label:not(:only-child) {\n            margin-bottom: 16px;\n        }\n\n.patterns__content > .checkbox-label:not(:only-child):only-child, .options__content > .checkbox-label:not(:only-child):only-child {\n                margin-bottom: 0;\n            }\n\n@media (min-width: 640px) {\n                .patterns__content > .checkbox-label:not(:only-child):last-child, .options__content > .checkbox-label:not(:only-child):last-child {\n                    margin-bottom: 0;\n                }\n            }\n\n.request-info.patterns {\n    word-break: break-all;\n}\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 25234:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".request-image {\n    margin: 12px 32px 0;\n    max-width: calc(100% - 64px);\n}\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 53396:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".request-info {\n    padding: 8px 16px;\n    word-break: break-all;\n    display: flex;\n    justify-content: space-between;\n}\n\n    .request-info__main {\n        display: flex;\n        flex-direction: column;\n        width: 100%;\n    }\n\n    .request-info__details {\n        margin-left: 16px;\n        height: -moz-fit-content;\n        height: fit-content;\n        cursor: help;\n    }\n\n    .request-info__key {\n        color: var(--text-lables-labels-default);\n        margin-bottom: 2px;\n        font-size: 14px;\n        line-height: 22px;\n        font-weight: 600;\n    }\n\n    .request-info__value {\n        color: var(--text-main-text-main-default);\n        line-height: 18px;\n        white-space: pre-wrap;\n        display: flex;\n        flex-direction: column;\n        align-items: flex-start;\n        justify-content: space-between;\n    }\n\n    .request-info__value .text {\n            display: inline;\n        }\n\n    .request-info__value.scrollable {\n            overflow-x: scroll;\n        }\n\n    .request-info__value pre {\n            margin: 0;\n        }\n\n    .request-info__error {\n        color: var(--text-description-description-default);\n        line-height: 19px;\n        margin-top: 4px;\n        white-space: pre-wrap;\n    }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 29889:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".request-modal {\n    --title-height: 92px;\n\n    position: fixed;\n    z-index: 11;\n    right: 0;\n    top: 0;\n    bottom: 0;\n    left: auto;\n    color: var(--text-main-text-main-default);\n    font-size: 14px;\n    box-sizing: border-box;\n    width: 460px;\n    max-width: 100%;\n    box-shadow: -8px 8px 24px 0px var(--shadow-0-1);\n    overflow: auto;\n    max-height: 100%;\n    background-color: var(--fills-backgrounds-cards-background-default);\n    display: flex;\n    flex-direction: column;\n}\n\n    @media (max-width: 640px) {.request-modal {\n        width: 100%\n}\n    }\n\n    .request-modal__content {\n        padding: 0 16px;\n        flex: 1;\n        overflow-x: hidden;\n        overflow-y: auto;\n        scrollbar-width: thin;\n        scrollbar-color: var(--stroke-inputs-inactive-input-stroke-default) var(--fills-backgrounds-cards-background-default);\n\n        background:\n            /* shadow cover top */\n            linear-gradient(\n                var(--fills-backgrounds-cards-background-default) 50%,\n                rgba(255, 255, 255, 0)\n            ) center top,\n\n            /* shadow cover bottom */\n            linear-gradient(\n                rgba(255, 255, 255, 0),\n                var(--fills-backgrounds-cards-background-default) 50%\n            ) center bottom,\n\n            /* shadow top */\n            linear-gradient(\n                rgba(0, 0, 0, 0.1),\n                rgba(0, 0, 0, 0)\n            ) center top,\n\n            /* shadow bottom */\n            linear-gradient(\n                rgba(0, 0, 0, 0),\n                rgba(0, 0, 0, 0.1)\n            ) center bottom;\n\n        background-repeat: no-repeat;\n        background-size: 100% 24px, 100% 24px, 100% 16px, 100% 16px;\n        background-attachment: local, local, scroll, scroll;\n    }\n\n    @media (max-width: 640px) {\n\n    .request-modal__content {\n            padding: 0\n    }\n        }\n\n    .request-modal__overlay {\n        position: static;\n    }\n\n    .request-modal__title {\n        display: flex;\n        align-items: center;\n        padding: 32px 32px 16px;\n        background-color: var(--fills-backgrounds-cards-background-default);\n    }\n\n    @media (max-width: 640px) {\n\n    .request-modal__title {\n            padding: 24px 16px 16px\n    }\n        }\n\n    .request-modal__title_fixed {\n            z-index: 1;\n        }\n\n    .request-modal__header {\n        font-size: 24px;\n        line-height: 29px;\n        font-weight: 700;\n        letter-spacing: 0;\n        text-align: center;\n        margin: 0 8px;\n    }\n\n    .request-modal__navigation {\n        background-color: transparent;\n        color: var(--text-main-text-main-default);\n        border: none;\n        background-position: center;\n        background-repeat: no-repeat;\n        padding: 0;\n        background-size: 12px;\n        display: flex;\n    }\n\n    .request-modal__navigation:hover {\n            cursor: pointer;\n        }\n\n    .request-modal__controls {\n        margin-top: auto;\n        padding: 0 16px 16px;\n        justify-content: space-between;\n    }\n\n    .request-modal__controls_fixed {\n            z-index: 1;\n        }\n\n    .request-modal__button {\n        min-width: 182px;\n        max-width: 42%;\n    }\n\n    @media (min-width: 641px) {\n\n    .request-modal__button {\n            margin: 16px\n    }\n        }\n\n    @media (max-width: 640px) {\n\n    .request-modal__button {\n            width: 100%;\n            margin: 16px 0 8px 0\n    }\n        }\n\n    .request-modal__url-button {\n        display: inline-block;\n        margin-top: 8px;\n        margin-right: 16px;\n        font-size: 14px;\n        line-height: 18px;\n    }\n\n    .request-modal__text-actions {\n        display: flex;\n    }\n\n    .request-modal__dragbar {\n        position: absolute;\n        height: 100%;\n        box-sizing: border-box;\n        cursor: col-resize;\n        border: 1px solid transparent;\n    }\n\n    .request-modal__text {\n        padding: 8px;\n        margin: 0 16px;\n        border: 1px solid var(--stroke-inputs-active-input-stroke-default);\n        border-radius: 4px;\n        height: calc(100vh - 225px);\n        overflow-y: scroll;\n    }\n\n    .request-modal__text pre {\n            margin: 0;\n        }\n\n    .request-modal__text code {\n            word-break: break-all;\n            white-space: break-spaces;\n        }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 98697:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".request-preview {\n    flex-grow: 1;\n}\n\n    .request-preview__status {\n        height: 100%;\n        width: 100%;\n        display: flex;\n        flex-direction: column;\n        justify-content: center;\n        align-items: center;\n    }\n\n    .request-preview__text {\n        font-size: 16px;\n    }\n\n    .request-preview__button {\n        margin: 16px 0;\n    }\n\n    @media (max-width: 640px) {\n\n    .request-preview__button {\n            width: calc(100% - 48px)\n    }\n        }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 41019:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".search {\n    display: flex;\n    align-items: center;\n    position: relative;\n    z-index: 20;\n    width: 100%;\n    background-color: var(--fills-inputs-input-background-disabled);\n    border: 1px solid var(--stroke-inputs-inactive-input-stroke-default);\n    border-radius: 8px;\n}\n\n    @media (max-width: 640px) {.search {\n        margin-right: 0\n}\n    }\n\n    .search input {\n        border: none;\n        width: 100%;\n        height: 40px;\n        padding: 0 24px 0 56px;\n        background: none;\n        text-overflow: ellipsis;\n        color: var(--text-main-text-main-default);\n        font-size: 14px;\n        line-height: 18px;\n    }\n\n    .search input:placeholder {\n            opacity: 1;\n            color: var(--text-placeholder-placeholder-default);\n        }\n\n    .search__input {\n        border-radius: 8px;\n    }\n\n    .search__input:focus {\n            outline: none;\n        }\n\n    .search__clear {\n        border: none;\n        background-color: transparent;\n        cursor: pointer;\n        position: absolute;\n        left: 16px;\n        max-height: 24px;\n    }\n\n    .search__ico {\n        position: absolute;\n        left: 16px;\n        top: calc(50% - 12px);\n    }\n\n    .search__arrow-up {\n        transform: rotate(180deg);\n    }\n\n    .search__btn {\n        cursor: pointer;\n        background-color: transparent;\n        border: 0;\n        padding: 0;\n    }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 26869:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".status-wrapper {\n    overflow: hidden;\n}\n\n.status {\n    display: inline-flex;\n    white-space: nowrap;\n}\n\n.status__item {\n        display: flex;\n        align-items: center;\n        margin-right: 8px;\n    }\n\n.status__item--red {\n            color: var(--text-links-error-link-default);\n        }\n\n.status__item--gray {\n            color: var(--stroke-icons-gray-icons-default);\n        }\n\n.status__item--green {\n            color: var(--stroke-icons-product-icon-default);\n        }\n\n.status__item--orange {\n            color: var(--orange-50);\n        }\n\n.status__item_width60 {\n            width: 60px;\n        }\n\n.status__item_centered {\n            min-width: 30px;\n            justify-content: center;\n        }\n\n.status__item:last-child {\n            margin-right: 0;\n        }\n\n.status__item > div {\n            cursor: default;\n        }\n\n.status__label {\n        margin-right: 6px;\n    }\n\n.status__icon {\n        width: 16px;\n        height: 16px;\n    }\n\n.status__icon--wrapper {\n            display: flex;\n        }\n\n.status__badge {\n        padding: 2px 8px;\n        display: flex;\n        justify-content: center;\n        align-items: center;\n        font-size: 12px;\n        line-height: 14px;\n        border-radius: 16px;\n        max-height: 20px;\n    }\n\n.status__badge--green {\n            color: var(--text-buttons-primary-default);\n            background-color: var(--fills-buttons-main-button-default);\n            border: 1px solid var(--fills-buttons-main-button-default);\n        }\n\n.status__badge--gray {\n            color: var(--text-buttons-primary-default);\n            background-color: var(--fills-buttons-main-button-default-inactive);\n            border: 1px solid var(--fills-buttons-main-button-default-inactive);\n        }\n\n.status__badge--orange {\n            color: var(--text-buttons-primary-default);\n            background-color: var(--orange-50);\n            border: 1px solid var(--orange-50);\n        }\n\n.status__badge--transparent {\n            color: var(--text-description-description-default);\n            border: 1px solid var(--stroke-icons-gray-icons-default);\n        }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 34433:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ":root {\n    color-scheme: light dark;\n}\n\nhtml,\nbody,\n#root {\n    height: 100%;\n}\n\n#root {\n    display: flex;\n    flex-direction: column;\n}\n\n*::-webkit-scrollbar {\n    width: 12px;\n}\n\n*::-webkit-scrollbar-track {\n    background: var(--gray100);\n}\n\n@media (color-index: 48) {\n\n*::-webkit-scrollbar-track {\n        background: var(--grayDark)\n}\n    }\n\n@media (color: 48842621) {\n\n*::-webkit-scrollbar-track {\n        background: var(--grayDark)\n}\n    }\n\n@media (prefers-color-scheme: dark) {\n\n*::-webkit-scrollbar-track {\n        background: var(--grayDark)\n}\n    }\n\n*::-webkit-scrollbar-thumb {\n    background-color: var(--gray300);\n    border-radius: 20px;\n    border: 3px solid var(--gray100);\n}\n\n@media (color-index: 48) {\n\n*::-webkit-scrollbar-thumb {\n        background-color: var(--gray700);\n        border: 3px solid var(--grayDark)\n}\n    }\n\n@media (color: 48842621) {\n\n*::-webkit-scrollbar-thumb {\n        background-color: var(--gray700);\n        border: 3px solid var(--grayDark)\n}\n    }\n\n@media (prefers-color-scheme: dark) {\n\n*::-webkit-scrollbar-thumb {\n        background-color: var(--gray700);\n        border: 3px solid var(--grayDark)\n}\n    }\n\n*::-webkit-scrollbar-corner {\n    background: var(--gray100);\n}\n\n@media (color-index: 48) {\n\n*::-webkit-scrollbar-corner {\n        background: var(--grayDark)\n}\n    }\n\n@media (color: 48842621) {\n\n*::-webkit-scrollbar-corner {\n        background: var(--grayDark)\n}\n    }\n\n@media (prefers-color-scheme: dark) {\n\n*::-webkit-scrollbar-corner {\n        background: var(--grayDark)\n}\n    }\n\nbody {\n    margin: 0;\n    font-family: 'Roboto Flex', 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Ubuntu, Arial, sans-serif;\n    font-optical-sizing: none;\n    color: var(--text-main-text-main-default);\n    background-color: var(--fills-backgrounds-page-background-default);\n}\n\n@media (min-width: 640px) {\n\nbody {\n        overflow: hidden;\n        position: fixed;\n        width: 100%\n}\n    }\n\nbody.col-resize * {\n        cursor: col-resize;\n        -webkit-user-select: none;\n           -moz-user-select: none;\n                user-select: none;\n    }\n\na.focus-visible {\n        outline: 2px solid var(--outline);\n    }\n\na:focus-visible {\n        outline: 2px solid var(--outline);\n    }\n\nbutton,\ninput,\ntextarea,\nselect {\n    font-family: inherit;\n}\n\nbutton.focus-visible, input.focus-visible, textarea.focus-visible, select.focus-visible {\n        outline: 2px solid var(--outline);\n    }\n\nbutton:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {\n        outline: 2px solid var(--outline);\n    }\n\n.icon {\n    flex-shrink: 0;\n}\n\n/* custom checkbox */\n.checkbox-wrapper {\n    display: flex;\n    justify-content: flex-start;\n    align-items: center;\n    padding: 8px 0;\n}\n\n.checkbox-label {\n    position: relative;\n    cursor: pointer;\n    display: flex;\n    align-items: center;\n}\n\n.checkbox-label .custom-checkbox {\n        min-width: 16px;\n        width: 16px;\n        height: 16px;\n        background-color: transparent;\n        border: 2px solid var(--stroke-icons-gray-icons-default);\n        border-radius: 2px;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n    }\n\n.checkbox-label .custom-checkbox .icon {\n            display: none;\n        }\n\n.checkbox-label__desc {\n        margin-left: 10px;\n        white-space: nowrap;\n    }\n\n.checkbox-input {\n    position: absolute;\n    clip: rect(1px, 1px, 1px, 1px);\n    top: 0;\n    left: 0;\n}\n\n.checkbox-input.focus-visible + .checkbox-label {\n        outline: 2px solid var(--outline);\n    }\n\n.checkbox-input:focus-visible + .checkbox-label {\n        outline: 2px solid var(--outline);\n    }\n\n.checkbox-input:checked + .checkbox-label .custom-checkbox {\n        background-color: var(--green400);\n        border-color: var(--green400);\n    }\n\n.checkbox-input:checked + .checkbox-label .custom-checkbox .icon {\n            display: block;\n        }\n\n.checkbox-input:disabled {\n        pointer-events: none;\n    }\n\n.checkbox-input:disabled + .checkbox-label .custom-checkbox {\n        cursor: default;\n        opacity: 0.5;\n    }\n\n/* custom radio-button */\n.radio-button-wrapper {\n    display: flex;\n    justify-content: flex-start;\n    align-items: center;\n    padding: 8px 0;\n}\n\n.radio-button-label {\n    cursor: pointer;\n    display: flex;\n    align-items: center;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.radio-button-label .radio-button {\n        width: 18px;\n        height: 18px;\n        position: relative;\n        background-color: transparent;\n        border: 2px solid var(--stroke-icons-gray-icons-default);\n        border-radius: 17px;\n        flex-shrink: 0;\n    }\n\n.radio-button-input {\n    position: absolute;\n    clip-path: circle(1px at 0 0);\n}\n\n.radio-button-input.focus-visible + .radio-button-label {\n        outline: 2px solid var(--outline);\n    }\n\n.radio-button-input:focus-visible + .radio-button-label {\n        outline: 2px solid var(--outline);\n    }\n\n.radio-button-input:checked + .radio-button-label .radio-button {\n        border: 2px solid var(--stroke-icons-product-icon-default);\n    }\n\n.radio-button-input:checked + .radio-button-label .radio-button:after {\n            content: \"\";\n            position: absolute;\n            left: calc(50% - 6px);\n            top: calc(50% - 6px);\n            width: 12px;\n            height: 12px;\n            border-radius: 100%;\n            background-color: var(--stroke-icons-product-icon-default);\n        }\n\n.radio-button-input:disabled {\n        pointer-events: none;\n    }\n\n.radio-button-input:disabled + .radio-button-label .radio-button {\n        cursor: default;\n        opacity: 0.5;\n    }\n\n.radio-button-desc {\n    margin-left: 10px;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.light-mode {\n    color-scheme: light;\n}\n\n.light-mode *::-webkit-scrollbar-track {\n        background: var(--gray100);\n    }\n\n.light-mode *::-webkit-scrollbar-thumb {\n        background-color: var(--gray300);\n        border-radius: 20px;\n        border: 3px solid var(--gray100);\n    }\n\n.light-mode *::-webkit-scrollbar-corner {\n        background: var(--gray100);\n    }\n\n.dark-mode {\n    color-scheme: dark;\n}\n\n.dark-mode *::-webkit-scrollbar-track {\n        background: var(--grayDark);\n    }\n\n.dark-mode *::-webkit-scrollbar-thumb {\n        background-color: var(--gray700);\n        border-radius: 20px;\n        border: 3px solid var(--grayDark);\n    }\n\n.dark-mode *::-webkit-scrollbar-corner {\n        background: var(--grayDark);\n    }\n\nspan.red-dot {\n    color: var(--text-links-error-link-default);\n    margin-right: 4px;\n}\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 45827:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_3_use_1_node_modules_pnpm_postcss_loader_6_1_1_postcss_8_4_12_webpack_5_79_0_node_modules_postcss_loader_dist_cjs_js_common_styles_fonts_pcss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(39735);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_3_use_1_node_modules_pnpm_postcss_loader_6_1_1_postcss_8_4_12_webpack_5_79_0_node_modules_postcss_loader_dist_cjs_js_common_styles_vars_pcss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(81987);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_3_use_1_node_modules_pnpm_postcss_loader_6_1_1_postcss_8_4_12_webpack_5_79_0_node_modules_postcss_loader_dist_cjs_js_common_styles_icons_pcss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(74027);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_3_use_1_node_modules_pnpm_postcss_loader_6_1_1_postcss_8_4_12_webpack_5_79_0_node_modules_postcss_loader_dist_cjs_js_common_styles_buttons_pcss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(66481);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_3_use_1_node_modules_pnpm_postcss_loader_6_1_1_postcss_8_4_12_webpack_5_79_0_node_modules_postcss_loader_dist_cjs_js_tag_pcss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(165);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_3_use_1_node_modules_pnpm_postcss_loader_6_1_1_postcss_8_4_12_webpack_5_79_0_node_modules_postcss_loader_dist_cjs_js_common_pcss__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(34433);
// Imports








var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
___CSS_LOADER_EXPORT___.i(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_3_use_1_node_modules_pnpm_postcss_loader_6_1_1_postcss_8_4_12_webpack_5_79_0_node_modules_postcss_loader_dist_cjs_js_common_styles_fonts_pcss__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z);
___CSS_LOADER_EXPORT___.i(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_3_use_1_node_modules_pnpm_postcss_loader_6_1_1_postcss_8_4_12_webpack_5_79_0_node_modules_postcss_loader_dist_cjs_js_common_styles_vars_pcss__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z);
___CSS_LOADER_EXPORT___.i(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_3_use_1_node_modules_pnpm_postcss_loader_6_1_1_postcss_8_4_12_webpack_5_79_0_node_modules_postcss_loader_dist_cjs_js_common_styles_icons_pcss__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z);
___CSS_LOADER_EXPORT___.i(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_3_use_1_node_modules_pnpm_postcss_loader_6_1_1_postcss_8_4_12_webpack_5_79_0_node_modules_postcss_loader_dist_cjs_js_common_styles_buttons_pcss__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z);
___CSS_LOADER_EXPORT___.i(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_3_use_1_node_modules_pnpm_postcss_loader_6_1_1_postcss_8_4_12_webpack_5_79_0_node_modules_postcss_loader_dist_cjs_js_tag_pcss__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z);
___CSS_LOADER_EXPORT___.i(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_3_use_1_node_modules_pnpm_postcss_loader_6_1_1_postcss_8_4_12_webpack_5_79_0_node_modules_postcss_loader_dist_cjs_js_common_pcss__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z);
// Module
___CSS_LOADER_EXPORT___.push([module.id, "\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 165:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52229);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26226);
/* harmony import */ var _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports


var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_pnpm_css_loader_6_7_3_webpack_5_79_0_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ".tag {\n    cursor: pointer;\n    text-decoration: none;\n    text-align: center;\n    display: inline-block;\n    padding: 2px 8px;\n    line-height: 14px;\n    font-size: 12px;\n    border-radius: 16px;\n    background-color: transparent;\n    margin-right: 8px;\n    max-height: 20px;\n}\n\n    .tag.focus-visible {\n        outline: 0;\n        border: 1px solid var(--outline);\n        box-shadow: inset 0 0 0 1px var(--outline);\n    }\n\n    .tag:focus-visible {\n        outline: 0;\n        border: 1px solid var(--outline);\n        box-shadow: inset 0 0 0 1px var(--outline);\n    }\n\n    .tag--regular {\n        border: 1px solid var(--stroke-icons-gray-icons-default);\n        color: var(--text-description-description-default);\n    }\n\n    .tag--regular.active {\n            border: 1px solid var(--fills-buttons-main-button-default-inactive);\n            background-color: var(--fills-buttons-main-button-default-inactive);\n            color: var(--text-buttons-primary-default);\n        }\n\n    .tag--party,\n    .tag--user_filter {\n        border: 1px solid var(--product-tertiary-icon-default);\n        color: var(--product-tertiary-icon-default);\n    }\n\n    .tag--party.active, .tag--user_filter.active {\n            border: 1px solid var(--product-tertiary-icon-default);\n            background-color: var(--product-tertiary-icon-default);\n            color: var(--text-buttons-primary-default);\n        }\n\n    .tag--allowlisted {\n        border: 1px solid var(--stroke-buttons-secondary-green-default);\n        color: var(--text-buttons-secondary-green-default);\n    }\n\n    .tag--allowlisted.active {\n            border: 1px solid var(--stroke-buttons-secondary-green-default);\n            background-color: var(--stroke-buttons-secondary-green-default);\n            color: var(--text-buttons-primary-default);\n        }\n\n    .tag--blocked {\n        border: 1px solid var(--stroke-buttons-secondary-red-default);\n        color: var(--text-buttons-secondary-red-default);\n    }\n\n    .tag--blocked.active {\n            border: 1px solid var(--stroke-buttons-secondary-red-default);\n            background-color: var(--stroke-buttons-secondary-red-default);\n            color: var(--text-buttons-primary-default);\n        }\n\n    .tag--modified {\n        border: 1px solid var(--stroke-dividers-item-divider-orange-default);\n        color: var(--text-links-attention-link-default);\n    }\n\n    .tag--modified.active {\n            border: 1px solid var(--stroke-dividers-item-divider-orange-default);\n            background-color: var(--stroke-dividers-item-divider-orange-default);\n            color: var(--text-buttons-primary-default);\n        }\n\n    .tag--other {\n        margin-right: 0;\n    }\n\n    .tag--third_party--info {\n            cursor: default;\n        }\n", ""]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);


/***/ }),

/***/ 26462:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Iu": () => (/* binding */ translate)
/* harmony export */ });
/* unused harmony exports Translator, validator */
function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }

  return obj;
}

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

function _defineProperties(target, props) {
  for (var i = 0; i < props.length; i++) {
    var descriptor = props[i];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor) descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}

function _createClass(Constructor, protoProps, staticProps) {
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  if (staticProps) _defineProperties(Constructor, staticProps);
  return Constructor;
}

function _arrayLikeToArray(arr, len) {
  if (len == null || len > arr.length) len = arr.length;

  for (var i = 0, arr2 = new Array(len); i < len; i++) {
    arr2[i] = arr[i];
  }

  return arr2;
}

function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}

function _iterableToArray(iter) {
  if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
}

function _unsupportedIterableToArray(o, minLen) {
  if (!o) return;
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  var n = Object.prototype.toString.call(o).slice(8, -1);
  if (n === "Object" && o.constructor) n = o.constructor.name;
  if (n === "Map" || n === "Set") return Array.from(o);
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _toConsumableArray(arr) {
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}

var NODE_TYPES;

(function (NODE_TYPES) {
  NODE_TYPES["PLACEHOLDER"] = "placeholder";
  NODE_TYPES["TEXT"] = "text";
  NODE_TYPES["TAG"] = "tag";
  NODE_TYPES["VOID_TAG"] = "void_tag";
})(NODE_TYPES || (NODE_TYPES = {}));

var isTextNode = function isTextNode(node) {
  return node.type === NODE_TYPES.TEXT;
};
var isTagNode = function isTagNode(node) {
  return node.type === NODE_TYPES.TAG;
};
var isPlaceholderNode = function isPlaceholderNode(node) {
  return node.type === NODE_TYPES.PLACEHOLDER;
};
var isVoidTagNode = function isVoidTagNode(node) {
  return node.type === NODE_TYPES.VOID_TAG;
};
var placeholderNode = function placeholderNode(value) {
  return {
    type: NODE_TYPES.PLACEHOLDER,
    value: value
  };
};
var textNode = function textNode(str) {
  return {
    type: NODE_TYPES.TEXT,
    value: str
  };
};
var tagNode = function tagNode(tagName, children) {
  var value = tagName.trim();
  return {
    type: NODE_TYPES.TAG,
    value: value,
    children: children
  };
};
var voidTagNode = function voidTagNode(tagName) {
  var value = tagName.trim();
  return {
    type: NODE_TYPES.VOID_TAG,
    value: value
  };
};
/**
 * Checks if target is node
 * @param target
 */

var isNode = function isNode(target) {
  if (typeof target === 'string') {
    return false;
  }

  return !!target.type;
};

var STATE;

(function (STATE) {
  /**
   * Parser function switches to the text state when parses simple text,
   * or content between open and close tags
   */
  STATE["TEXT"] = "text";
  /**
   * Parser function switches to the tag state when meets open tag brace ("<"), and switches back,
   * when meets closing tag brace (">")
   */

  STATE["TAG"] = "tag";
  /**
   * Parser function switches to the placeholder state when meets in the text
   * open placeholders brace ("{") and switches back to the text state,
   * when meets close placeholder brace ("}")
   */

  STATE["PLACEHOLDER"] = "placeholder";
})(STATE || (STATE = {}));

var CONTROL_CHARS = {
  TAG_OPEN_BRACE: '<',
  TAG_CLOSE_BRACE: '>',
  CLOSING_TAG_MARK: '/',
  PLACEHOLDER_MARK: '%'
};
/**
 * Checks if text length is enough to create text node
 * If text node created, then if stack is not empty it is pushed into stack,
 * otherwise into result
 * @param context
 */

var createTextNodeIfPossible = function createTextNodeIfPossible(context) {
  var text = context.text;

  if (text.length > 0) {
    var node = textNode(text);

    if (context.stack.length > 0) {
      context.stack.push(node);
    } else {
      context.result.push(node);
    }
  }

  context.text = '';
};
/**
 * Checks if lastFromStack tag has any attributes
 * @param lastFromStack
 */


var hasAttributes = function hasAttributes(lastFromStack) {
  // e.g. "a class" or "a href='#'"
  var tagStrParts = lastFromStack.split(' ');
  return tagStrParts.length > 1;
};
/**
 * Handles text state
 */


var textStateHandler = function textStateHandler(context) {
  var currChar = context.currChar,
      currIdx = context.currIdx; // switches to the tag state

  if (currChar === CONTROL_CHARS.TAG_OPEN_BRACE) {
    context.lastTextStateChangeIdx = currIdx;
    return STATE.TAG;
  } // switches to the placeholder state


  if (currChar === CONTROL_CHARS.PLACEHOLDER_MARK) {
    context.lastTextStateChangeIdx = currIdx;
    return STATE.PLACEHOLDER;
  } // remains in the text state


  context.text += currChar;
  return STATE.TEXT;
};
/**
 * Handles placeholder state
 * @param context
 */


var placeholderStateHandler = function placeholderStateHandler(context) {
  var currChar = context.currChar,
      currIdx = context.currIdx,
      lastTextStateChangeIdx = context.lastTextStateChangeIdx,
      placeholder = context.placeholder,
      stack = context.stack,
      result = context.result,
      str = context.str;

  if (currChar === CONTROL_CHARS.PLACEHOLDER_MARK) {
    // if distance between current index and last state change equal to 1,
    // it means that placeholder mark was escaped by itself e.g. "%%",
    // so we return to the text state
    if (currIdx - lastTextStateChangeIdx === 1) {
      context.text += str.substring(lastTextStateChangeIdx, currIdx);
      return STATE.TEXT;
    }

    createTextNodeIfPossible(context);
    var node = placeholderNode(placeholder); // push node to the appropriate stack

    if (stack.length > 0) {
      stack.push(node);
    } else {
      result.push(node);
    }

    context.placeholder = '';
    return STATE.TEXT;
  }

  context.placeholder += currChar;
  return STATE.PLACEHOLDER;
};
/**
 * Switches current state to the tag state and returns tag state handler
 */


var tagStateHandler = function tagStateHandler(context) {
  var currChar = context.currChar,
      text = context.text,
      stack = context.stack,
      result = context.result,
      lastTextStateChangeIdx = context.lastTextStateChangeIdx,
      currIdx = context.currIdx,
      str = context.str;
  var tag = context.tag; // if found tag end ">"

  if (currChar === CONTROL_CHARS.TAG_CLOSE_BRACE) {
    // if the tag is close tag e.g. </a>
    if (tag.indexOf(CONTROL_CHARS.CLOSING_TAG_MARK) === 0) {
      // remove slash from tag
      tag = tag.substring(1);
      var children = [];

      if (text.length > 0) {
        children.push(textNode(text));
        context.text = '';
      }

      var pairTagFound = false; // looking for the pair to the close tag

      while (!pairTagFound && stack.length > 0) {
        var lastFromStack = stack.pop(); // if tag from stack equal to close tag

        if (lastFromStack === tag) {
          // create tag node
          var node = tagNode(tag, children); // and add it to the appropriate stack

          if (stack.length > 0) {
            stack.push(node);
          } else {
            result.push(node);
          }

          children = [];
          pairTagFound = true;
        } else if (isNode(lastFromStack)) {
          // add nodes between close tag and open tag to the children
          children.unshift(lastFromStack);
        } else {
          if (typeof lastFromStack === 'string' && hasAttributes(lastFromStack)) {
            throw new Error("Tags in string should not have attributes: ".concat(str));
          } else {
            throw new Error("String has unbalanced tags: ".concat(str));
          }
        }

        if (stack.length === 0 && children.length > 0) {
          throw new Error("String has unbalanced tags: ".concat(str));
        }
      }

      context.tag = '';
      return STATE.TEXT;
    } // if the tag is void tag e.g. <img/>


    if (tag.lastIndexOf(CONTROL_CHARS.CLOSING_TAG_MARK) === tag.length - 1) {
      tag = tag.substring(0, tag.length - 1);
      createTextNodeIfPossible(context);

      var _node = voidTagNode(tag); // add node to the appropriate stack


      if (stack.length > 0) {
        stack.push(_node);
      } else {
        result.push(_node);
      }

      context.tag = '';
      return STATE.TEXT;
    }

    createTextNodeIfPossible(context);
    stack.push(tag);
    context.tag = '';
    return STATE.TEXT;
  } // If we meet open tag "<" it means that we wrongly moved into tag state


  if (currChar === CONTROL_CHARS.TAG_OPEN_BRACE) {
    context.text += str.substring(lastTextStateChangeIdx, currIdx);
    context.lastTextStateChangeIdx = currIdx;
    context.tag = '';
    return STATE.TAG;
  }

  context.tag += currChar;
  return STATE.TAG;
};
/**
 * Parses string into AST (abstract syntax tree) and returns it
 * e.g.
 * parse("String to <a>translate</a>") ->
 * ```
 *      [
 *           { type: 'text', value: 'String to ' },
 *           { type: 'tag', value: 'a', children: [{ type: 'text', value: 'translate' }] }
 *      ];
 * ```
 * Empty string is parsed into empty AST (abstract syntax tree): "[]"
 * If founds unbalanced tags, it throws error about it
 *
 * @param {string} str - message in simplified ICU like syntax without plural support
 */


var parser = function parser() {
  var _STATE_HANDLERS;

  var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  var context = {
    /**
     * Stack is used to keep and search nested tag nodes
     */
    stack: [],

    /**
     * Result is stack where function allocates nodes
     */
    result: [],

    /**
     * Current char index
     */
    currIdx: 0,

    /**
     * Saves index of the last state change from the text state,
     * used to restore parsed text if we moved into other state wrongly
     */
    lastTextStateChangeIdx: 0,

    /**
     * Accumulated tag value
     */
    tag: '',

    /**
     * Accumulated text value
     */
    text: '',

    /**
     * Accumulated placeholder value
     */
    placeholder: '',

    /**
     * Parsed string
     */
    str: str
  };
  var STATE_HANDLERS = (_STATE_HANDLERS = {}, _defineProperty(_STATE_HANDLERS, STATE.TEXT, textStateHandler), _defineProperty(_STATE_HANDLERS, STATE.PLACEHOLDER, placeholderStateHandler), _defineProperty(_STATE_HANDLERS, STATE.TAG, tagStateHandler), _STATE_HANDLERS); // Start from text state

  var currentState = STATE.TEXT;

  while (context.currIdx < str.length) {
    context.currChar = str[context.currIdx];
    var currentStateHandler = STATE_HANDLERS[currentState];
    currentState = currentStateHandler(context);
    context.currIdx += 1;
  }

  var result = context.result,
      text = context.text,
      stack = context.stack,
      lastTextStateChangeIdx = context.lastTextStateChangeIdx; // Means that tag or placeholder nodes were not closed, so we consider them as text

  if (currentState !== STATE.TEXT) {
    var restText = str.substring(lastTextStateChangeIdx);

    if ((restText + text).length > 0) {
      result.push(textNode(text + restText));
    }
  } else {
    // eslint-disable-next-line no-lonely-if
    if (text.length > 0) {
      result.push(textNode(text));
    }
  }

  if (stack.length > 0) {
    throw new Error("String has unbalanced tags: ".concat(context.str));
  }

  return result;
};

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/**
 * Helper functions used by default to assemble strings from tag nodes
 * @param tagName
 * @param children
 */

var createStringElement = function createStringElement(tagName, children) {
  if (children) {
    return "<".concat(tagName, ">").concat(children, "</").concat(tagName, ">");
  }

  return "<".concat(tagName, "/>");
};
/**
 * Creates map with default values for tag converters
 */


var createDefaultValues = function createDefaultValues() {
  return {
    p: function p(children) {
      return createStringElement('p', children);
    },
    b: function b(children) {
      return createStringElement('b', children);
    },
    strong: function strong(children) {
      return createStringElement('strong', children);
    },
    tt: function tt(children) {
      return createStringElement('tt', children);
    },
    s: function s(children) {
      return createStringElement('s', children);
    },
    i: function i(children) {
      return createStringElement('i', children);
    }
  };
};
/**
 * This function accepts an AST (abstract syntax tree) which is a result
 * of the parser function call, and converts tree nodes into array of strings replacing node
 * values with provided values.
 * Values is a map with functions or strings, where each key is related to placeholder value
 * or tag value
 * e.g.
 * string "text <tag>tag text</tag> %placeholder%" is parsed into next AST
 *
 *      [
 *          { type: 'text', value: 'text ' },
 *          {
 *              type: 'tag',
 *              value: 'tag',
 *              children: [{ type: 'text', value: 'tag text' }],
 *          },
 *          { type: 'text', value: ' ' },
 *          { type: 'placeholder', value: 'placeholder' }
 *      ];
 *
 * this AST after format and next values
 *
 *      {
 *          // here used template strings, but it can be react components as well
 *          tag: (chunks) => `<b>${chunks}</b>`,
 *          placeholder: 'placeholder text'
 *      }
 *
 * will return next array
 *
 * [ 'text ', '<b>tag text</b>', ' ', 'placeholder text' ]
 *
 * as you can see, <tag> was replaced by <b>, and placeholder was replaced by placeholder text
 *
 * @param ast - AST (abstract syntax tree)
 * @param values
 */


var format = function format() {
  var ast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var result = [];

  var tmplValues = _objectSpread(_objectSpread({}, createDefaultValues()), values);

  var i = 0;

  while (i < ast.length) {
    var currentNode = ast[i]; // if current node is text node, there is nothing to change, append value to the result

    if (isTextNode(currentNode)) {
      result.push(currentNode.value);
    } else if (isTagNode(currentNode)) {
      var children = _toConsumableArray(format(currentNode.children, tmplValues));

      var value = tmplValues[currentNode.value];

      if (value) {
        // TODO consider using strong typing
        if (typeof value === 'function') {
          result.push(value(children.join('')));
        } else {
          result.push(value);
        }
      } else {
        throw new Error("Value ".concat(currentNode.value, " wasn't provided"));
      }
    } else if (isVoidTagNode(currentNode)) {
      var _value = tmplValues[currentNode.value]; // TODO consider using strong typing

      if (_value && typeof _value === 'string') {
        result.push(_value);
      } else {
        throw new Error("Value ".concat(currentNode.value, " wasn't provided"));
      }
    } else if (isPlaceholderNode(currentNode)) {
      var _value2 = tmplValues[currentNode.value]; // TODO consider using strong typing

      if (_value2 && typeof _value2 === 'string') {
        result.push(_value2);
      } else {
        throw new Error("Value ".concat(currentNode.value, " wasn't provided"));
      }
    }

    i += 1;
  }

  return result;
};
/**
 * Function gets AST (abstract syntax tree) or string and formats messages,
 * replacing values accordingly
 * e.g.
 *      const message = formatter('<a>some text</a>', {
 *          a: (chunks) => `<a href="#">${chunks}</a>`,
 *      });
 *      console.log(message); // ['<a href="#">some text</a>']
 * @param message
 * @param [values]
 */


var formatter = function formatter(message, values) {
  var ast = parser(message);
  var preparedValues = {}; // convert values to strings if not a function

  if (values) {
    Object.keys(values).forEach(function (key) {
      var value = values[key]; // TODO consider using strong typing

      if (typeof value === 'function') {
        preparedValues[key] = value;
      } else {
        preparedValues[key] = String(value);
      }
    });
  }

  return format(ast, preparedValues);
};

var _pluralFormsCount;

var AvailableLocales;

(function (AvailableLocales) {
  AvailableLocales["az"] = "az";
  AvailableLocales["bo"] = "bo";
  AvailableLocales["dz"] = "dz";
  AvailableLocales["id"] = "id";
  AvailableLocales["ja"] = "ja";
  AvailableLocales["jv"] = "jv";
  AvailableLocales["ka"] = "ka";
  AvailableLocales["km"] = "km";
  AvailableLocales["kn"] = "kn";
  AvailableLocales["ko"] = "ko";
  AvailableLocales["ms"] = "ms";
  AvailableLocales["th"] = "th";
  AvailableLocales["tr"] = "tr";
  AvailableLocales["vi"] = "vi";
  AvailableLocales["zh"] = "zh";
  AvailableLocales["zh_cn"] = "zh_cn";
  AvailableLocales["zh_tw"] = "zh_tw";
  AvailableLocales["af"] = "af";
  AvailableLocales["bn"] = "bn";
  AvailableLocales["bg"] = "bg";
  AvailableLocales["ca"] = "ca";
  AvailableLocales["da"] = "da";
  AvailableLocales["de"] = "de";
  AvailableLocales["el"] = "el";
  AvailableLocales["en"] = "en";
  AvailableLocales["eo"] = "eo";
  AvailableLocales["es"] = "es";
  AvailableLocales["et"] = "et";
  AvailableLocales["eu"] = "eu";
  AvailableLocales["fa"] = "fa";
  AvailableLocales["fi"] = "fi";
  AvailableLocales["fo"] = "fo";
  AvailableLocales["fur"] = "fur";
  AvailableLocales["fy"] = "fy";
  AvailableLocales["gl"] = "gl";
  AvailableLocales["gu"] = "gu";
  AvailableLocales["ha"] = "ha";
  AvailableLocales["he"] = "he";
  AvailableLocales["hu"] = "hu";
  AvailableLocales["is"] = "is";
  AvailableLocales["it"] = "it";
  AvailableLocales["ku"] = "ku";
  AvailableLocales["lb"] = "lb";
  AvailableLocales["ml"] = "ml";
  AvailableLocales["mn"] = "mn";
  AvailableLocales["mr"] = "mr";
  AvailableLocales["nah"] = "nah";
  AvailableLocales["nb"] = "nb";
  AvailableLocales["ne"] = "ne";
  AvailableLocales["nl"] = "nl";
  AvailableLocales["nn"] = "nn";
  AvailableLocales["no"] = "no";
  AvailableLocales["oc"] = "oc";
  AvailableLocales["om"] = "om";
  AvailableLocales["or"] = "or";
  AvailableLocales["pa"] = "pa";
  AvailableLocales["pap"] = "pap";
  AvailableLocales["ps"] = "ps";
  AvailableLocales["pt"] = "pt";
  AvailableLocales["pt_pt"] = "pt_pt";
  AvailableLocales["pt_br"] = "pt_br";
  AvailableLocales["so"] = "so";
  AvailableLocales["sq"] = "sq";
  AvailableLocales["sv"] = "sv";
  AvailableLocales["sw"] = "sw";
  AvailableLocales["ta"] = "ta";
  AvailableLocales["te"] = "te";
  AvailableLocales["tk"] = "tk";
  AvailableLocales["ur"] = "ur";
  AvailableLocales["zu"] = "zu";
  AvailableLocales["am"] = "am";
  AvailableLocales["bh"] = "bh";
  AvailableLocales["fil"] = "fil";
  AvailableLocales["fr"] = "fr";
  AvailableLocales["gun"] = "gun";
  AvailableLocales["hi"] = "hi";
  AvailableLocales["hy"] = "hy";
  AvailableLocales["ln"] = "ln";
  AvailableLocales["mg"] = "mg";
  AvailableLocales["nso"] = "nso";
  AvailableLocales["xbr"] = "xbr";
  AvailableLocales["ti"] = "ti";
  AvailableLocales["wa"] = "wa";
  AvailableLocales["be"] = "be";
  AvailableLocales["bs"] = "bs";
  AvailableLocales["hr"] = "hr";
  AvailableLocales["ru"] = "ru";
  AvailableLocales["sr"] = "sr";
  AvailableLocales["uk"] = "uk";
  AvailableLocales["cs"] = "cs";
  AvailableLocales["sk"] = "sk";
  AvailableLocales["ga"] = "ga";
  AvailableLocales["lt"] = "lt";
  AvailableLocales["sl"] = "sl";
  AvailableLocales["mk"] = "mk";
  AvailableLocales["mt"] = "mt";
  AvailableLocales["lv"] = "lv";
  AvailableLocales["pl"] = "pl";
  AvailableLocales["cy"] = "cy";
  AvailableLocales["ro"] = "ro";
  AvailableLocales["ar"] = "ar";
  AvailableLocales["sr_latn"] = "sr_latn";
})(AvailableLocales || (AvailableLocales = {}));

var getPluralFormId = function getPluralFormId(locale, number) {
  var _supportedForms;

  if (number === 0) {
    return 0;
  }

  var slavNum = number % 10 === 1 && number % 100 !== 11 ? 1 : number % 10 >= 2 && number % 10 <= 4 && (number % 100 < 10 || number % 100 >= 20) ? 2 : 3;
  var supportedForms = (_supportedForms = {}, _defineProperty(_supportedForms, AvailableLocales.az, 1), _defineProperty(_supportedForms, AvailableLocales.bo, 1), _defineProperty(_supportedForms, AvailableLocales.dz, 1), _defineProperty(_supportedForms, AvailableLocales.id, 1), _defineProperty(_supportedForms, AvailableLocales.ja, 1), _defineProperty(_supportedForms, AvailableLocales.jv, 1), _defineProperty(_supportedForms, AvailableLocales.ka, 1), _defineProperty(_supportedForms, AvailableLocales.km, 1), _defineProperty(_supportedForms, AvailableLocales.kn, 1), _defineProperty(_supportedForms, AvailableLocales.ko, 1), _defineProperty(_supportedForms, AvailableLocales.ms, 1), _defineProperty(_supportedForms, AvailableLocales.th, 1), _defineProperty(_supportedForms, AvailableLocales.tr, 1), _defineProperty(_supportedForms, AvailableLocales.vi, 1), _defineProperty(_supportedForms, AvailableLocales.zh, 1), _defineProperty(_supportedForms, AvailableLocales.zh_tw, 1), _defineProperty(_supportedForms, AvailableLocales.zh_cn, 1), _defineProperty(_supportedForms, AvailableLocales.af, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.bn, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.bg, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.ca, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.da, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.de, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.el, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.en, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.eo, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.es, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.et, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.eu, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.fa, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.fi, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.fo, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.fur, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.fy, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.gl, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.gu, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.ha, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.he, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.hu, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.is, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.it, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.ku, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.lb, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.ml, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.mn, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.mr, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.nah, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.nb, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.ne, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.nl, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.nn, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.no, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.oc, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.om, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.or, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.pa, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.pap, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.ps, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.pt, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.pt_pt, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.pt_br, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.so, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.sq, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.sv, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.sw, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.ta, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.te, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.tk, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.ur, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.zu, number === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.am, number === 0 || number === 1 ? 0 : 1), _defineProperty(_supportedForms, AvailableLocales.bh, number === 0 || number === 1 ? 0 : 1), _defineProperty(_supportedForms, AvailableLocales.fil, number === 0 || number === 1 ? 0 : 1), _defineProperty(_supportedForms, AvailableLocales.fr, number === 0 || number >= 2 ? 2 : 1), _defineProperty(_supportedForms, AvailableLocales.gun, number === 0 || number === 1 ? 0 : 1), _defineProperty(_supportedForms, AvailableLocales.hi, number === 0 || number === 1 ? 0 : 1), _defineProperty(_supportedForms, AvailableLocales.hy, number === 0 || number === 1 ? 0 : 1), _defineProperty(_supportedForms, AvailableLocales.ln, number === 0 || number === 1 ? 0 : 1), _defineProperty(_supportedForms, AvailableLocales.mg, number === 0 || number === 1 ? 0 : 1), _defineProperty(_supportedForms, AvailableLocales.nso, number === 0 || number === 1 ? 0 : 1), _defineProperty(_supportedForms, AvailableLocales.xbr, number === 0 || number === 1 ? 0 : 1), _defineProperty(_supportedForms, AvailableLocales.ti, number === 0 || number === 1 ? 0 : 1), _defineProperty(_supportedForms, AvailableLocales.wa, number === 0 || number === 1 ? 0 : 1), _defineProperty(_supportedForms, AvailableLocales.be, slavNum), _defineProperty(_supportedForms, AvailableLocales.bs, slavNum), _defineProperty(_supportedForms, AvailableLocales.hr, slavNum), _defineProperty(_supportedForms, AvailableLocales.ru, slavNum), _defineProperty(_supportedForms, AvailableLocales.sr, slavNum), _defineProperty(_supportedForms, AvailableLocales.sr_latn, slavNum), _defineProperty(_supportedForms, AvailableLocales.uk, slavNum), _defineProperty(_supportedForms, AvailableLocales.cs, number === 1 ? 1 : number >= 2 && number <= 4 ? 2 : 3), _defineProperty(_supportedForms, AvailableLocales.sk, number === 1 ? 1 : number >= 2 && number <= 4 ? 2 : 3), _defineProperty(_supportedForms, AvailableLocales.ga, number === 1 ? 1 : number === 2 ? 2 : 3), _defineProperty(_supportedForms, AvailableLocales.lt, number % 10 === 1 && number % 100 !== 11 ? 1 : number % 10 >= 2 && (number % 100 < 10 || number % 100 >= 20) ? 2 : 3), _defineProperty(_supportedForms, AvailableLocales.sl, number % 100 === 1 ? 1 : number % 100 === 2 ? 2 : number % 100 === 3 || number % 100 === 4 ? 3 : 4), _defineProperty(_supportedForms, AvailableLocales.mk, number % 10 === 1 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.mt, number === 1 ? 1 : number === 0 || number % 100 > 1 && number % 100 < 11 ? 2 : number % 100 > 10 && number % 100 < 20 ? 3 : 4), _defineProperty(_supportedForms, AvailableLocales.lv, number === 0 ? 0 : number % 10 === 1 && number % 100 !== 11 ? 1 : 2), _defineProperty(_supportedForms, AvailableLocales.pl, number === 1 ? 1 : number % 10 >= 2 && number % 10 <= 4 && (number % 100 < 12 || number % 100 > 14) ? 2 : 3), _defineProperty(_supportedForms, AvailableLocales.cy, number === 1 ? 0 : number === 2 ? 1 : number === 8 || number === 11 ? 2 : 3), _defineProperty(_supportedForms, AvailableLocales.ro, number === 1 ? 1 : number === 1 || number % 100 > 0 && number % 100 < 20 ? 2 : 3), _defineProperty(_supportedForms, AvailableLocales.ar, number === 0 ? 0 : number === 1 ? 1 : number === 2 ? 2 : number % 100 >= 3 && number % 100 <= 10 ? 3 : number % 100 >= 11 && number % 100 <= 99 ? 4 : 5), _supportedForms);
  return supportedForms[locale];
};

var pluralFormsCount = (_pluralFormsCount = {}, _defineProperty(_pluralFormsCount, AvailableLocales.az, 2), _defineProperty(_pluralFormsCount, AvailableLocales.bo, 2), _defineProperty(_pluralFormsCount, AvailableLocales.dz, 2), _defineProperty(_pluralFormsCount, AvailableLocales.id, 2), _defineProperty(_pluralFormsCount, AvailableLocales.ja, 2), _defineProperty(_pluralFormsCount, AvailableLocales.jv, 2), _defineProperty(_pluralFormsCount, AvailableLocales.ka, 2), _defineProperty(_pluralFormsCount, AvailableLocales.km, 2), _defineProperty(_pluralFormsCount, AvailableLocales.kn, 2), _defineProperty(_pluralFormsCount, AvailableLocales.ko, 2), _defineProperty(_pluralFormsCount, AvailableLocales.ms, 2), _defineProperty(_pluralFormsCount, AvailableLocales.th, 2), _defineProperty(_pluralFormsCount, AvailableLocales.tr, 2), _defineProperty(_pluralFormsCount, AvailableLocales.vi, 2), _defineProperty(_pluralFormsCount, AvailableLocales.zh, 2), _defineProperty(_pluralFormsCount, AvailableLocales.zh_cn, 2), _defineProperty(_pluralFormsCount, AvailableLocales.zh_tw, 2), _defineProperty(_pluralFormsCount, AvailableLocales.af, 3), _defineProperty(_pluralFormsCount, AvailableLocales.bn, 3), _defineProperty(_pluralFormsCount, AvailableLocales.bg, 3), _defineProperty(_pluralFormsCount, AvailableLocales.ca, 3), _defineProperty(_pluralFormsCount, AvailableLocales.da, 3), _defineProperty(_pluralFormsCount, AvailableLocales.de, 3), _defineProperty(_pluralFormsCount, AvailableLocales.el, 3), _defineProperty(_pluralFormsCount, AvailableLocales.en, 3), _defineProperty(_pluralFormsCount, AvailableLocales.eo, 3), _defineProperty(_pluralFormsCount, AvailableLocales.es, 3), _defineProperty(_pluralFormsCount, AvailableLocales.et, 3), _defineProperty(_pluralFormsCount, AvailableLocales.eu, 3), _defineProperty(_pluralFormsCount, AvailableLocales.fa, 3), _defineProperty(_pluralFormsCount, AvailableLocales.fi, 3), _defineProperty(_pluralFormsCount, AvailableLocales.fo, 3), _defineProperty(_pluralFormsCount, AvailableLocales.fur, 3), _defineProperty(_pluralFormsCount, AvailableLocales.fy, 3), _defineProperty(_pluralFormsCount, AvailableLocales.gl, 3), _defineProperty(_pluralFormsCount, AvailableLocales.gu, 3), _defineProperty(_pluralFormsCount, AvailableLocales.ha, 3), _defineProperty(_pluralFormsCount, AvailableLocales.he, 3), _defineProperty(_pluralFormsCount, AvailableLocales.hu, 3), _defineProperty(_pluralFormsCount, AvailableLocales.is, 3), _defineProperty(_pluralFormsCount, AvailableLocales.it, 3), _defineProperty(_pluralFormsCount, AvailableLocales.ku, 3), _defineProperty(_pluralFormsCount, AvailableLocales.lb, 3), _defineProperty(_pluralFormsCount, AvailableLocales.ml, 3), _defineProperty(_pluralFormsCount, AvailableLocales.mn, 3), _defineProperty(_pluralFormsCount, AvailableLocales.mr, 3), _defineProperty(_pluralFormsCount, AvailableLocales.nah, 3), _defineProperty(_pluralFormsCount, AvailableLocales.nb, 3), _defineProperty(_pluralFormsCount, AvailableLocales.ne, 3), _defineProperty(_pluralFormsCount, AvailableLocales.nl, 3), _defineProperty(_pluralFormsCount, AvailableLocales.nn, 3), _defineProperty(_pluralFormsCount, AvailableLocales.no, 3), _defineProperty(_pluralFormsCount, AvailableLocales.oc, 3), _defineProperty(_pluralFormsCount, AvailableLocales.om, 3), _defineProperty(_pluralFormsCount, AvailableLocales.or, 3), _defineProperty(_pluralFormsCount, AvailableLocales.pa, 3), _defineProperty(_pluralFormsCount, AvailableLocales.pap, 3), _defineProperty(_pluralFormsCount, AvailableLocales.ps, 3), _defineProperty(_pluralFormsCount, AvailableLocales.pt, 3), _defineProperty(_pluralFormsCount, AvailableLocales.pt_pt, 3), _defineProperty(_pluralFormsCount, AvailableLocales.pt_br, 3), _defineProperty(_pluralFormsCount, AvailableLocales.so, 3), _defineProperty(_pluralFormsCount, AvailableLocales.sq, 3), _defineProperty(_pluralFormsCount, AvailableLocales.sv, 3), _defineProperty(_pluralFormsCount, AvailableLocales.sw, 3), _defineProperty(_pluralFormsCount, AvailableLocales.ta, 3), _defineProperty(_pluralFormsCount, AvailableLocales.te, 3), _defineProperty(_pluralFormsCount, AvailableLocales.tk, 3), _defineProperty(_pluralFormsCount, AvailableLocales.ur, 3), _defineProperty(_pluralFormsCount, AvailableLocales.zu, 3), _defineProperty(_pluralFormsCount, AvailableLocales.am, 2), _defineProperty(_pluralFormsCount, AvailableLocales.bh, 2), _defineProperty(_pluralFormsCount, AvailableLocales.fil, 2), _defineProperty(_pluralFormsCount, AvailableLocales.fr, 3), _defineProperty(_pluralFormsCount, AvailableLocales.gun, 2), _defineProperty(_pluralFormsCount, AvailableLocales.hi, 2), _defineProperty(_pluralFormsCount, AvailableLocales.hy, 2), _defineProperty(_pluralFormsCount, AvailableLocales.ln, 2), _defineProperty(_pluralFormsCount, AvailableLocales.mg, 2), _defineProperty(_pluralFormsCount, AvailableLocales.nso, 2), _defineProperty(_pluralFormsCount, AvailableLocales.xbr, 2), _defineProperty(_pluralFormsCount, AvailableLocales.ti, 2), _defineProperty(_pluralFormsCount, AvailableLocales.wa, 2), _defineProperty(_pluralFormsCount, AvailableLocales.be, 4), _defineProperty(_pluralFormsCount, AvailableLocales.bs, 4), _defineProperty(_pluralFormsCount, AvailableLocales.hr, 4), _defineProperty(_pluralFormsCount, AvailableLocales.ru, 4), _defineProperty(_pluralFormsCount, AvailableLocales.sr, 4), _defineProperty(_pluralFormsCount, AvailableLocales.sr_latn, 4), _defineProperty(_pluralFormsCount, AvailableLocales.uk, 4), _defineProperty(_pluralFormsCount, AvailableLocales.cs, 4), _defineProperty(_pluralFormsCount, AvailableLocales.sk, 4), _defineProperty(_pluralFormsCount, AvailableLocales.ga, 4), _defineProperty(_pluralFormsCount, AvailableLocales.lt, 4), _defineProperty(_pluralFormsCount, AvailableLocales.sl, 5), _defineProperty(_pluralFormsCount, AvailableLocales.mk, 3), _defineProperty(_pluralFormsCount, AvailableLocales.mt, 5), _defineProperty(_pluralFormsCount, AvailableLocales.lv, 3), _defineProperty(_pluralFormsCount, AvailableLocales.pl, 4), _defineProperty(_pluralFormsCount, AvailableLocales.cy, 4), _defineProperty(_pluralFormsCount, AvailableLocales.ro, 4), _defineProperty(_pluralFormsCount, AvailableLocales.ar, 6), _pluralFormsCount);
var PLURAL_STRING_DELIMITER = '|';
/**
 * Returns string plural forms which are separated by `|`.
 *
 * @param str Message.
 *
 * @returns Array of plural forms.
 */

var getForms = function getForms(str) {
  return str.split(PLURAL_STRING_DELIMITER);
};
/**
 * Checks whether the string has correct number of plural forms.
 *
 * @param str Translated string.
 * @param locale Locale.
 * @param key Optional, base key.
 *
 * @throws Error if the number of plural forms is incorrect.
 */

var checkForms = function checkForms(str, locale, key) {
  var givenCount = getForms(str).length;
  var requiredCount = pluralFormsCount[locale];

  if (givenCount !== requiredCount) {
    var prefix = typeof key !== 'undefined' ? "Invalid plural string \"".concat(key, "\" for locale '").concat(locale, "'") : "Invalid plural string for locale '".concat(locale, "'");
    throw new Error("".concat(prefix, ": required ").concat(requiredCount, ", given ").concat(givenCount, " in string \"").concat(str, "\""));
  }
};
/**
 * Checks whether plural forms are present in base string
 * by checking the presence of the vertical bar `|`.
 *
 * @param baseStr Base string.
 *
 * @returns True if `baseStr` contains `|`, false otherwise.
 */


var hasPluralForm = function hasPluralForm(baseStr) {
  return baseStr.includes(PLURAL_STRING_DELIMITER);
};
/**
 * Checks if plural forms are valid.
 *
 * @param targetStr Translated message with plural forms.
 * @param locale Locale.
 * @param key Optional, message key, used for clearer log message.
 *
 * @returns True if plural forms are valid, false otherwise.
 */

var isPluralFormValid = function isPluralFormValid(targetStr, locale, key) {
  try {
    checkForms(targetStr, locale, key);
    return true;
  } catch (error) {
    return false;
  }
};
/**
 * Returns plural form corresponding to number
 * @param str
 * @param number
 * @param locale - current locale
 * @param key - message key
 */

var getForm = function getForm(str, number, locale, key) {
  checkForms(str, locale, key);
  var forms = getForms(str);
  var currentForm = getPluralFormId(locale, number);
  return forms[currentForm].trim();
};

function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

var defaultMessageConstructor = function defaultMessageConstructor(formatted) {
  return formatted.join('');
};

var Translator = /*#__PURE__*/function () {
  function Translator(i18n, // eslint-disable-next-line @typescript-eslint/no-explicit-any
  messageConstructor, values) {
    _classCallCheck(this, Translator);

    this.i18n = i18n;
    this.messageConstructor = messageConstructor || defaultMessageConstructor;
    this.values = values || {};
  }
  /**
   * Retrieves message and translates it, substituting parameters where necessary
   * @param key - translation message key
   * @param params - values used to substitute placeholders and tags
   */


  _createClass(Translator, [{
    key: "getMessage",
    value: function getMessage(key) {
      var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var message = this.i18n.getMessage(key);

      if (!message) {
        message = this.i18n.getBaseMessage(key);

        if (!message) {
          throw new Error("Was unable to find message for key: \"".concat(key, "\""));
        }
      }

      var formatted = formatter(message, _objectSpread$1(_objectSpread$1({}, this.values), params));
      return this.messageConstructor(formatted);
    }
    /**
     * Retrieves correct plural form and translates it
     * @param key - translation message key
     * @param number - plural form number
     * @param params - values used to substitute placeholders or tags if necessary,
     * if params has "count" property it will be overridden by number (plural form number)
     */

  }, {
    key: "getPlural",
    value: function getPlural(key, number) {
      var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      var message = this.i18n.getMessage(key);
      var language = this.i18n.getUILanguage();

      if (!message) {
        message = this.i18n.getBaseMessage(key);

        if (!message) {
          throw new Error("Was unable to find message for key: \"".concat(key, "\""));
        }

        language = this.i18n.getBaseUILanguage();
      }

      var form = getForm(message, number, language, key);
      var formatted = formatter(form, _objectSpread$1(_objectSpread$1(_objectSpread$1({}, this.values), params), {}, {
        count: number
      }));
      return this.messageConstructor(formatted);
    }
  }]);

  return Translator;
}();

function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/**
 * Creates translation function for strings used in the React components
 * We do not import React directly, because translator module can be used
 * in the modules without React too
 *
 * e.g.
 * const translateReact = createReactTranslator(getMessage, React);
 * in locales folder you should have messages.json file
 * ```
 * message:
 *     "popup_auth_agreement_consent": {
 *          "message": "You agree to our <eula>EULA</eula>",
 *      },
 * ```
 *
 * this message can be retrieved and translated into react components next way:
 *
 * const component = translateReact('popup_auth_agreement_consent', {
 *          eula: (chunks) => (
 *              <button
 *                  className="auth__privacy-link"
 *                  onClick={handleEulaClick}
 *              >
 *                  {chunks}
 *              </button>
 *          ),
 *       });
 *
 * Note how functions in the values argument can be used with handlers
 *
 * @param i18n - object with methods which get translated message by key and return current locale
 * @param React - instance of react library
 */

var createReactTranslator = function createReactTranslator(i18n, react, defaults) {
  /**
   * Helps to build nodes without values
   *
   * @param tagName
   * @param children
   */
  var createReactElement = function createReactElement(tagName, children) {
    if (children) {
      return react.createElement(tagName, null, react.Children.toArray(children));
    }

    return react.createElement(tagName, null);
  };
  /**
   * Function creates default values to be used if user didn't provide function values for tags
   */


  var createDefaultValues = function createDefaultValues() {
    // eslint-disable-next-line @typescript-eslint/ban-types
    var externalDefaults = {};

    if (defaults) {
      defaults.tags.forEach(function (t) {
        externalDefaults[t.key] = function (children) {
          return createReactElement(t.createdTag, children);
        };
      });
    }

    if (defaults !== null && defaults !== void 0 && defaults.override) {
      return externalDefaults;
    }

    return _objectSpread$2({
      p: function p(children) {
        return createReactElement('p', children);
      },
      b: function b(children) {
        return createReactElement('b', children);
      },
      strong: function strong(children) {
        return createReactElement('strong', children);
      },
      tt: function tt(children) {
        return createReactElement('tt', children);
      },
      s: function s(children) {
        return createReactElement('s', children);
      },
      i: function i(children) {
        return createReactElement('i', children);
      }
    }, externalDefaults);
  };

  var reactMessageConstructor = function reactMessageConstructor(formatted) {
    var reactChildren = react.Children.toArray(formatted); // if there is only strings in the array we join them

    if (reactChildren.every(function (child) {
      return typeof child === 'string';
    })) {
      return reactChildren.join('');
    }

    return reactChildren;
  };

  var defaultValues = createDefaultValues();
  return new Translator(i18n, reactMessageConstructor, defaultValues);
};

var r,
    f;

function A(n, l) {
  return l = l || [], null == n || "boolean" == typeof n || (Array.isArray(n) ? n.some(function (n) {
    A(n, l);
  }) : l.push(n)), l;
}

r = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, f = 0;

function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/**
 * Creates translation function for strings used in the Preact components
 * We do not import Preact directly, because translator module can be used
 * in the modules without Preact too
 *
 * e.g.
 * const translatePreact = createPreactTranslator(getMessage, Preact);
 * in locales folder you should have messages.json file
 * ```
 * message:
 *     "popup_auth_agreement_consent": {
 *          "message": "You agree to our <eula>EULA</eula>",
 *      },
 * ```
 *
 * this message can be retrieved and translated into preact components next way:
 *
 * const component = translatePreact('popup_auth_agreement_consent', {
 *          eula: (chunks) => (
 *              <button
 *                  className="auth__privacy-link"
 *                  onClick={handleEulaClick}
 *              >
 *                  {chunks}
 *              </button>
 *          ),
 *       });
 *
 * Note how functions in the values argument can be used with handlers
 *
 * @param i18n - object with methods which get translated message by key and return current locale
 * @param Preact - instance of preact library
 */

var createPreactTranslator = function createPreactTranslator(i18n, preact, defaults) {
  /**
   * Helps to build nodes without values
   *
   * @param tagName
   * @param children
   */
  var createPreactElement = function createPreactElement(tagName, children) {
    if (children) {
      return preact.createElement(tagName, null, A(children));
    }

    return preact.createElement(tagName, null);
  };
  /**
   * Function creates default values to be used if user didn't provide function values for tags
   */


  var createDefaultValues = function createDefaultValues() {
    // eslint-disable-next-line @typescript-eslint/ban-types
    var externalDefaults = {};

    if (defaults) {
      defaults.tags.forEach(function (t) {
        externalDefaults[t.key] = function (children) {
          return createPreactElement(t.createdTag, children);
        };
      });
    }

    if (defaults !== null && defaults !== void 0 && defaults.override) {
      return externalDefaults;
    }

    return _objectSpread$3({
      p: function p(children) {
        return createPreactElement('p', children);
      },
      b: function b(children) {
        return createPreactElement('b', children);
      },
      strong: function strong(children) {
        return createPreactElement('strong', children);
      },
      tt: function tt(children) {
        return createPreactElement('tt', children);
      },
      s: function s(children) {
        return createPreactElement('s', children);
      },
      i: function i(children) {
        return createPreactElement('i', children);
      }
    }, externalDefaults);
  };

  var preactMessageConstructor = function preactMessageConstructor(formatted) {
    var preactChildren = A(formatted); // if there is only strings in the array we join them

    if (preactChildren.every(function (child) {
      return typeof child === 'string';
    })) {
      return preactChildren.join('');
    }

    return preactChildren;
  };

  var defaultValues = createDefaultValues();
  return new Translator(i18n, preactMessageConstructor, defaultValues);
};

/**
 * Creates translator instance strings, by default for simple strings
 * @param i18n - function which returns translated message by key
 * @param messageConstructor - function that will collect messages
 * @param values - map with default values for tag converters
 */

var createTranslator = function createTranslator(i18n, messageConstructor, values) {
  return new Translator(i18n, messageConstructor, values);
};

var translate = {
  createTranslator: createTranslator,
  createReactTranslator: createReactTranslator,
  createPreactTranslator: createPreactTranslator
};

function _typeof(obj) {
  "@babel/helpers - typeof";

  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof = function _typeof(obj) {
      return typeof obj;
    };
  } else {
    _typeof = function _typeof(obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };
  }

  return _typeof(obj);
}

/**
 * Compares two AST (abstract syntax tree) structures,
 * view tests for examples
 * @param baseAst
 * @param targetAst
 */

var areAstStructuresSame = function areAstStructuresSame(baseAst, targetAst) {
  var textNodeFilter = function textNodeFilter(node) {
    return !isTextNode(node);
  };

  var filteredBaseAst = baseAst.filter(textNodeFilter);
  var filteredTargetAst = targetAst.filter(textNodeFilter); // if AST structures have different lengths, they are not equal

  if (filteredBaseAst.length !== filteredTargetAst.length) {
    return false;
  }

  var _loop = function _loop(i) {
    var baseNode = filteredBaseAst[i];
    var targetNode = filteredTargetAst.find(function (node) {
      return node.type === baseNode.type && node.value === baseNode.value;
    });

    if (!targetNode) {
      return {
        v: false
      };
    }

    if (targetNode.children && baseNode.children) {
      var areChildrenSame = areAstStructuresSame(baseNode.children, targetNode.children);

      if (!areChildrenSame) {
        return {
          v: false
        };
      }
    }
  };

  for (var i = 0; i < filteredBaseAst.length; i += 1) {
    var _ret = _loop(i);

    if (_typeof(_ret) === "object") return _ret.v;
  }

  return true;
};
/**
 * Validates translation against base string by AST (abstract syntax tree) structure.
 *
 * @param baseMessage Base message.
 * @param translatedMessage Translated message.
 * @param locale Locale of `translatedMessage`.
 *
 * @returns True if translated message is valid, false otherwise:
 * - if base message has no plural forms, it will return true if AST structures are same;
 * - if base message has plural forms, first of all
 *   the function checks if the number of plural forms is correct for the `locale`,
 *   and then it validates AST plural forms structures for base and translated messages.
 *
 * @throws Error for invalid tags in base or translated messages,
 * or if translated message has invalid plural forms.
 */


var isTranslationValid = function isTranslationValid(baseMessage, translatedMessage, locale) {
  if (hasPluralForm(baseMessage)) {
    var isPluralFormsValid = isPluralFormValid(translatedMessage, locale);

    if (!isPluralFormsValid) {
      throw new Error('Invalid plural forms');
    }

    var baseForms = getForms(baseMessage);
    var translatedForms = getForms(translatedMessage); // check a zero form structures of base and translated messages

    if (!isTranslationValid(baseForms[0], translatedForms[0], locale)) {
      return false;
    } // and check other forms structures of translated messages against the first form of base message


    for (var i = 1; i < translatedForms.length; i += 1) {
      if (!isTranslationValid(baseForms[1], translatedForms[i], locale)) {
        return false;
      }
    } // if no errors, return true after all checks


    return true;
  }

  var baseMessageAst = parser(baseMessage);
  var translatedMessageAst = parser(translatedMessage);
  return areAstStructuresSame(baseMessageAst, translatedMessageAst);
};
var validator = {
  isTranslationValid: isTranslationValid,
  isPluralFormValid: isPluralFormValid
};




/***/ }),

/***/ 62256:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Zk": () => (/* binding */ StealthActions),
/* harmony export */   "zc": () => (/* binding */ ContentType)
/* harmony export */ });
/* unused harmony exports BACKGROUND_TAB_ID, EXTENDED_CSS_VERSION, EmptyOrNegativeNumberOfRulesError, EmptyResourcesError, EventChannel, FilteringEventType, InvalidDeclarativeRuleError, LF, MAIN_FRAME_ID, MESSAGE_HANDLER_NAME, MaxScannedRulesError, MessageType, NegativeNumberOfRegexpRulesError, RULE_SET_NAME_PREFIX, ResourcesPathError, TSWEBEXTENSION_VERSION, TabContext, TooManyRegexpRulesError, TooManyRulesError, TsWebExtension, USER_FILTER_ID, UnavailableFilterSourceError, UnavailableRuleSetSourceError, UnsupportedModifierError, UnsupportedRegexpError, companiesDbService, defaultFilteringLog, getDomain, isExtensionUrl, isHttpOrWsRequest, isHttpRequest, tabsApi */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(44945);
/* harmony import */ var tldts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(48514);
/* harmony import */ var _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(37302);
/* harmony import */ var webextension_polyfill__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(70914);
/* harmony import */ var webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(webextension_polyfill__WEBPACK_IMPORTED_MODULE_2__);
/* module decorator */ module = __webpack_require__.hmd(module);







function getDefaultExportFromCjs$1 (x) {
	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}

const debug$1 = (
  typeof process === 'object' &&
  process.env &&
  process.env.NODE_DEBUG &&
  /\bsemver\b/i.test(process.env.NODE_DEBUG)
) ? (...args) => console.error('SEMVER', ...args)
  : () => {};
var debug_1 = debug$1;

const SEMVER_SPEC_VERSION = '2.0.0';
const MAX_LENGTH$1 = 256;
const MAX_SAFE_INTEGER$3 = Number.MAX_SAFE_INTEGER ||
 9007199254740991;
const MAX_SAFE_COMPONENT_LENGTH = 16;
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
const RELEASE_TYPES = [
  'major',
  'premajor',
  'minor',
  'preminor',
  'patch',
  'prepatch',
  'prerelease',
];
var constants = {
  MAX_LENGTH: MAX_LENGTH$1,
  MAX_SAFE_COMPONENT_LENGTH,
  MAX_SAFE_BUILD_LENGTH,
  MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$3,
  RELEASE_TYPES,
  SEMVER_SPEC_VERSION,
  FLAG_INCLUDE_PRERELEASE: 0b001,
  FLAG_LOOSE: 0b010,
};

var re$2 = {exports: {}};

(function (module, exports) {
	const {
	  MAX_SAFE_COMPONENT_LENGTH,
	  MAX_SAFE_BUILD_LENGTH,
	  MAX_LENGTH,
	} = constants;
	const debug = debug_1;
	exports = module.exports = {};
	const re = exports.re = [];
	const safeRe = exports.safeRe = [];
	const src = exports.src = [];
	const t = exports.t = {};
	let R = 0;
	const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
	const safeRegexReplacements = [
	  ['\\s', 1],
	  ['\\d', MAX_LENGTH],
	  [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
	];
	const makeSafeRegex = (value) => {
	  for (const [token, max] of safeRegexReplacements) {
	    value = value
	      .split(`${token}*`).join(`${token}{0,${max}}`)
	      .split(`${token}+`).join(`${token}{1,${max}}`);
	  }
	  return value
	};
	const createToken = (name, value, isGlobal) => {
	  const safe = makeSafeRegex(value);
	  const index = R++;
	  debug(name, index, value);
	  t[name] = index;
	  src[index] = value;
	  re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
	  safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
	};
	createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
	createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
	createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
	createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
	                   `(${src[t.NUMERICIDENTIFIER]})\\.` +
	                   `(${src[t.NUMERICIDENTIFIER]})`);
	createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
	                        `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
	                        `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
	createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
	}|${src[t.NONNUMERICIDENTIFIER]})`);
	createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
	}|${src[t.NONNUMERICIDENTIFIER]})`);
	createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
	}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
	createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
	}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
	createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
	createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
	}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
	createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
	}${src[t.PRERELEASE]}?${
	  src[t.BUILD]}?`);
	createToken('FULL', `^${src[t.FULLPLAIN]}$`);
	createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
	}${src[t.PRERELEASELOOSE]}?${
	  src[t.BUILD]}?`);
	createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
	createToken('GTLT', '((?:<|>)?=?)');
	createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
	createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
	createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
	                   `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
	                   `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
	                   `(?:${src[t.PRERELEASE]})?${
	                     src[t.BUILD]}?` +
	                   `)?)?`);
	createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
	                        `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
	                        `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
	                        `(?:${src[t.PRERELEASELOOSE]})?${
	                          src[t.BUILD]}?` +
	                        `)?)?`);
	createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
	createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
	createToken('COERCEPLAIN', `${'(^|[^\\d])' +
	              '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
	              `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
	              `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
	createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
	createToken('COERCEFULL', src[t.COERCEPLAIN] +
	              `(?:${src[t.PRERELEASE]})?` +
	              `(?:${src[t.BUILD]})?` +
	              `(?:$|[^\\d])`);
	createToken('COERCERTL', src[t.COERCE], true);
	createToken('COERCERTLFULL', src[t.COERCEFULL], true);
	createToken('LONETILDE', '(?:~>?)');
	createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
	exports.tildeTrimReplace = '$1~';
	createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
	createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
	createToken('LONECARET', '(?:\\^)');
	createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
	exports.caretTrimReplace = '$1^';
	createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
	createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
	createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
	createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
	createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
	}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
	exports.comparatorTrimReplace = '$1$2$3';
	createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
	                   `\\s+-\\s+` +
	                   `(${src[t.XRANGEPLAIN]})` +
	                   `\\s*$`);
	createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
	                        `\\s+-\\s+` +
	                        `(${src[t.XRANGEPLAINLOOSE]})` +
	                        `\\s*$`);
	createToken('STAR', '(<|>)?=?\\s*\\*');
	createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
	createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$'); 
} (re$2, re$2.exports));

var reExports = re$2.exports;

const looseOption = Object.freeze({ loose: true });
const emptyOpts = Object.freeze({ });
const parseOptions$1 = options => {
  if (!options) {
    return emptyOpts
  }
  if (typeof options !== 'object') {
    return looseOption
  }
  return options
};
var parseOptions_1 = parseOptions$1;

const numeric = /^[0-9]+$/;
const compareIdentifiers$1 = (a, b) => {
  const anum = numeric.test(a);
  const bnum = numeric.test(b);
  if (anum && bnum) {
    a = +a;
    b = +b;
  }
  return a === b ? 0
    : (anum && !bnum) ? -1
    : (bnum && !anum) ? 1
    : a < b ? -1
    : 1
};
const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
var identifiers = {
  compareIdentifiers: compareIdentifiers$1,
  rcompareIdentifiers,
};

const debug = debug_1;
const { MAX_LENGTH, MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$2 } = constants;
const { safeRe: re$1, t: t$1 } = reExports;
const parseOptions = parseOptions_1;
const { compareIdentifiers } = identifiers;
let SemVer$2 = class SemVer {
  constructor (version, options) {
    options = parseOptions(options);
    if (version instanceof SemVer) {
      if (version.loose === !!options.loose &&
          version.includePrerelease === !!options.includePrerelease) {
        return version
      } else {
        version = version.version;
      }
    } else if (typeof version !== 'string') {
      throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
    }
    if (version.length > MAX_LENGTH) {
      throw new TypeError(
        `version is longer than ${MAX_LENGTH} characters`
      )
    }
    debug('SemVer', version, options);
    this.options = options;
    this.loose = !!options.loose;
    this.includePrerelease = !!options.includePrerelease;
    const m = version.trim().match(options.loose ? re$1[t$1.LOOSE] : re$1[t$1.FULL]);
    if (!m) {
      throw new TypeError(`Invalid Version: ${version}`)
    }
    this.raw = version;
    this.major = +m[1];
    this.minor = +m[2];
    this.patch = +m[3];
    if (this.major > MAX_SAFE_INTEGER$2 || this.major < 0) {
      throw new TypeError('Invalid major version')
    }
    if (this.minor > MAX_SAFE_INTEGER$2 || this.minor < 0) {
      throw new TypeError('Invalid minor version')
    }
    if (this.patch > MAX_SAFE_INTEGER$2 || this.patch < 0) {
      throw new TypeError('Invalid patch version')
    }
    if (!m[4]) {
      this.prerelease = [];
    } else {
      this.prerelease = m[4].split('.').map((id) => {
        if (/^[0-9]+$/.test(id)) {
          const num = +id;
          if (num >= 0 && num < MAX_SAFE_INTEGER$2) {
            return num
          }
        }
        return id
      });
    }
    this.build = m[5] ? m[5].split('.') : [];
    this.format();
  }
  format () {
    this.version = `${this.major}.${this.minor}.${this.patch}`;
    if (this.prerelease.length) {
      this.version += `-${this.prerelease.join('.')}`;
    }
    return this.version
  }
  toString () {
    return this.version
  }
  compare (other) {
    debug('SemVer.compare', this.version, this.options, other);
    if (!(other instanceof SemVer)) {
      if (typeof other === 'string' && other === this.version) {
        return 0
      }
      other = new SemVer(other, this.options);
    }
    if (other.version === this.version) {
      return 0
    }
    return this.compareMain(other) || this.comparePre(other)
  }
  compareMain (other) {
    if (!(other instanceof SemVer)) {
      other = new SemVer(other, this.options);
    }
    return (
      compareIdentifiers(this.major, other.major) ||
      compareIdentifiers(this.minor, other.minor) ||
      compareIdentifiers(this.patch, other.patch)
    )
  }
  comparePre (other) {
    if (!(other instanceof SemVer)) {
      other = new SemVer(other, this.options);
    }
    if (this.prerelease.length && !other.prerelease.length) {
      return -1
    } else if (!this.prerelease.length && other.prerelease.length) {
      return 1
    } else if (!this.prerelease.length && !other.prerelease.length) {
      return 0
    }
    let i = 0;
    do {
      const a = this.prerelease[i];
      const b = other.prerelease[i];
      debug('prerelease compare', i, a, b);
      if (a === undefined && b === undefined) {
        return 0
      } else if (b === undefined) {
        return 1
      } else if (a === undefined) {
        return -1
      } else if (a === b) {
        continue
      } else {
        return compareIdentifiers(a, b)
      }
    } while (++i)
  }
  compareBuild (other) {
    if (!(other instanceof SemVer)) {
      other = new SemVer(other, this.options);
    }
    let i = 0;
    do {
      const a = this.build[i];
      const b = other.build[i];
      debug('prerelease compare', i, a, b);
      if (a === undefined && b === undefined) {
        return 0
      } else if (b === undefined) {
        return 1
      } else if (a === undefined) {
        return -1
      } else if (a === b) {
        continue
      } else {
        return compareIdentifiers(a, b)
      }
    } while (++i)
  }
  inc (release, identifier, identifierBase) {
    switch (release) {
      case 'premajor':
        this.prerelease.length = 0;
        this.patch = 0;
        this.minor = 0;
        this.major++;
        this.inc('pre', identifier, identifierBase);
        break
      case 'preminor':
        this.prerelease.length = 0;
        this.patch = 0;
        this.minor++;
        this.inc('pre', identifier, identifierBase);
        break
      case 'prepatch':
        this.prerelease.length = 0;
        this.inc('patch', identifier, identifierBase);
        this.inc('pre', identifier, identifierBase);
        break
      case 'prerelease':
        if (this.prerelease.length === 0) {
          this.inc('patch', identifier, identifierBase);
        }
        this.inc('pre', identifier, identifierBase);
        break
      case 'major':
        if (
          this.minor !== 0 ||
          this.patch !== 0 ||
          this.prerelease.length === 0
        ) {
          this.major++;
        }
        this.minor = 0;
        this.patch = 0;
        this.prerelease = [];
        break
      case 'minor':
        if (this.patch !== 0 || this.prerelease.length === 0) {
          this.minor++;
        }
        this.patch = 0;
        this.prerelease = [];
        break
      case 'patch':
        if (this.prerelease.length === 0) {
          this.patch++;
        }
        this.prerelease = [];
        break
      case 'pre': {
        const base = Number(identifierBase) ? 1 : 0;
        if (!identifier && identifierBase === false) {
          throw new Error('invalid increment argument: identifier is empty')
        }
        if (this.prerelease.length === 0) {
          this.prerelease = [base];
        } else {
          let i = this.prerelease.length;
          while (--i >= 0) {
            if (typeof this.prerelease[i] === 'number') {
              this.prerelease[i]++;
              i = -2;
            }
          }
          if (i === -1) {
            if (identifier === this.prerelease.join('.') && identifierBase === false) {
              throw new Error('invalid increment argument: identifier already exists')
            }
            this.prerelease.push(base);
          }
        }
        if (identifier) {
          let prerelease = [identifier, base];
          if (identifierBase === false) {
            prerelease = [identifier];
          }
          if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
            if (isNaN(this.prerelease[1])) {
              this.prerelease = prerelease;
            }
          } else {
            this.prerelease = prerelease;
          }
        }
        break
      }
      default:
        throw new Error(`invalid increment argument: ${release}`)
    }
    this.raw = this.format();
    if (this.build.length) {
      this.raw += `+${this.build.join('.')}`;
    }
    return this
  }
};
var semver = SemVer$2;

const SemVer$1 = semver;
const parse$4 = (version, options, throwErrors = false) => {
  if (version instanceof SemVer$1) {
    return version
  }
  try {
    return new SemVer$1(version, options)
  } catch (er) {
    if (!throwErrors) {
      return null
    }
    throw er
  }
};
var parse_1 = parse$4;

const parse$3 = parse_1;
const valid = (version, options) => {
  const v = parse$3(version, options);
  return v ? v.version : null
};
var valid_1 = valid;

var valid$1 = /*@__PURE__*/getDefaultExportFromCjs$1(valid_1);

const SemVer = semver;
const parse$2 = parse_1;
const { safeRe: re, t } = reExports;
const coerce = (version, options) => {
  if (version instanceof SemVer) {
    return version
  }
  if (typeof version === 'number') {
    version = String(version);
  }
  if (typeof version !== 'string') {
    return null
  }
  options = options || {};
  let match = null;
  if (!options.rtl) {
    match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
  } else {
    const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
    let next;
    while ((next = coerceRtlRegex.exec(version)) &&
        (!match || match.index + match[0].length !== version.length)
    ) {
      if (!match ||
            next.index + next[0].length !== match.index + match[0].length) {
        match = next;
      }
      coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
    }
    coerceRtlRegex.lastIndex = -1;
  }
  if (match === null) {
    return null
  }
  const major = match[2];
  const minor = match[3] || '0';
  const patch = match[4] || '0';
  const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '';
  const build = options.includePrerelease && match[6] ? `+${match[6]}` : '';
  return parse$2(`${major}.${minor}.${patch}${prerelease}${build}`, options)
};
var coerce_1 = coerce;

var coerce$1 = /*@__PURE__*/getDefaultExportFromCjs$1(coerce_1);

var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
var unicode = {
	Space_Separator: Space_Separator,
	ID_Start: ID_Start,
	ID_Continue: ID_Continue
};
var util = {
    isSpaceSeparator (c) {
        return typeof c === 'string' && unicode.Space_Separator.test(c)
    },
    isIdStartChar (c) {
        return typeof c === 'string' && (
            (c >= 'a' && c <= 'z') ||
        (c >= 'A' && c <= 'Z') ||
        (c === '$') || (c === '_') ||
        unicode.ID_Start.test(c)
        )
    },
    isIdContinueChar (c) {
        return typeof c === 'string' && (
            (c >= 'a' && c <= 'z') ||
        (c >= 'A' && c <= 'Z') ||
        (c >= '0' && c <= '9') ||
        (c === '$') || (c === '_') ||
        (c === '\u200C') || (c === '\u200D') ||
        unicode.ID_Continue.test(c)
        )
    },
    isDigit (c) {
        return typeof c === 'string' && /[0-9]/.test(c)
    },
    isHexDigit (c) {
        return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
    },
};
let source;
let parseState;
let stack;
let pos;
let line;
let column;
let token;
let key;
let root$2;
var parse$1 = function parse (text, reviver) {
    source = String(text);
    parseState = 'start';
    stack = [];
    pos = 0;
    line = 1;
    column = 0;
    token = undefined;
    key = undefined;
    root$2 = undefined;
    do {
        token = lex();
        parseStates[parseState]();
    } while (token.type !== 'eof')
    if (typeof reviver === 'function') {
        return internalize({'': root$2}, '', reviver)
    }
    return root$2
};
function internalize (holder, name, reviver) {
    const value = holder[name];
    if (value != null && typeof value === 'object') {
        if (Array.isArray(value)) {
            for (let i = 0; i < value.length; i++) {
                const key = String(i);
                const replacement = internalize(value, key, reviver);
                if (replacement === undefined) {
                    delete value[key];
                } else {
                    Object.defineProperty(value, key, {
                        value: replacement,
                        writable: true,
                        enumerable: true,
                        configurable: true,
                    });
                }
            }
        } else {
            for (const key in value) {
                const replacement = internalize(value, key, reviver);
                if (replacement === undefined) {
                    delete value[key];
                } else {
                    Object.defineProperty(value, key, {
                        value: replacement,
                        writable: true,
                        enumerable: true,
                        configurable: true,
                    });
                }
            }
        }
    }
    return reviver.call(holder, name, value)
}
let lexState;
let buffer;
let doubleQuote;
let sign;
let c;
function lex () {
    lexState = 'default';
    buffer = '';
    doubleQuote = false;
    sign = 1;
    for (;;) {
        c = peek();
        const token = lexStates[lexState]();
        if (token) {
            return token
        }
    }
}
function peek () {
    if (source[pos]) {
        return String.fromCodePoint(source.codePointAt(pos))
    }
}
function read () {
    const c = peek();
    if (c === '\n') {
        line++;
        column = 0;
    } else if (c) {
        column += c.length;
    } else {
        column++;
    }
    if (c) {
        pos += c.length;
    }
    return c
}
const lexStates = {
    default () {
        switch (c) {
        case '\t':
        case '\v':
        case '\f':
        case ' ':
        case '\u00A0':
        case '\uFEFF':
        case '\n':
        case '\r':
        case '\u2028':
        case '\u2029':
            read();
            return
        case '/':
            read();
            lexState = 'comment';
            return
        case undefined:
            read();
            return newToken('eof')
        }
        if (util.isSpaceSeparator(c)) {
            read();
            return
        }
        return lexStates[parseState]()
    },
    comment () {
        switch (c) {
        case '*':
            read();
            lexState = 'multiLineComment';
            return
        case '/':
            read();
            lexState = 'singleLineComment';
            return
        }
        throw invalidChar(read())
    },
    multiLineComment () {
        switch (c) {
        case '*':
            read();
            lexState = 'multiLineCommentAsterisk';
            return
        case undefined:
            throw invalidChar(read())
        }
        read();
    },
    multiLineCommentAsterisk () {
        switch (c) {
        case '*':
            read();
            return
        case '/':
            read();
            lexState = 'default';
            return
        case undefined:
            throw invalidChar(read())
        }
        read();
        lexState = 'multiLineComment';
    },
    singleLineComment () {
        switch (c) {
        case '\n':
        case '\r':
        case '\u2028':
        case '\u2029':
            read();
            lexState = 'default';
            return
        case undefined:
            read();
            return newToken('eof')
        }
        read();
    },
    value () {
        switch (c) {
        case '{':
        case '[':
            return newToken('punctuator', read())
        case 'n':
            read();
            literal('ull');
            return newToken('null', null)
        case 't':
            read();
            literal('rue');
            return newToken('boolean', true)
        case 'f':
            read();
            literal('alse');
            return newToken('boolean', false)
        case '-':
        case '+':
            if (read() === '-') {
                sign = -1;
            }
            lexState = 'sign';
            return
        case '.':
            buffer = read();
            lexState = 'decimalPointLeading';
            return
        case '0':
            buffer = read();
            lexState = 'zero';
            return
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
        case '8':
        case '9':
            buffer = read();
            lexState = 'decimalInteger';
            return
        case 'I':
            read();
            literal('nfinity');
            return newToken('numeric', Infinity)
        case 'N':
            read();
            literal('aN');
            return newToken('numeric', NaN)
        case '"':
        case "'":
            doubleQuote = (read() === '"');
            buffer = '';
            lexState = 'string';
            return
        }
        throw invalidChar(read())
    },
    identifierNameStartEscape () {
        if (c !== 'u') {
            throw invalidChar(read())
        }
        read();
        const u = unicodeEscape();
        switch (u) {
        case '$':
        case '_':
            break
        default:
            if (!util.isIdStartChar(u)) {
                throw invalidIdentifier()
            }
            break
        }
        buffer += u;
        lexState = 'identifierName';
    },
    identifierName () {
        switch (c) {
        case '$':
        case '_':
        case '\u200C':
        case '\u200D':
            buffer += read();
            return
        case '\\':
            read();
            lexState = 'identifierNameEscape';
            return
        }
        if (util.isIdContinueChar(c)) {
            buffer += read();
            return
        }
        return newToken('identifier', buffer)
    },
    identifierNameEscape () {
        if (c !== 'u') {
            throw invalidChar(read())
        }
        read();
        const u = unicodeEscape();
        switch (u) {
        case '$':
        case '_':
        case '\u200C':
        case '\u200D':
            break
        default:
            if (!util.isIdContinueChar(u)) {
                throw invalidIdentifier()
            }
            break
        }
        buffer += u;
        lexState = 'identifierName';
    },
    sign () {
        switch (c) {
        case '.':
            buffer = read();
            lexState = 'decimalPointLeading';
            return
        case '0':
            buffer = read();
            lexState = 'zero';
            return
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
        case '8':
        case '9':
            buffer = read();
            lexState = 'decimalInteger';
            return
        case 'I':
            read();
            literal('nfinity');
            return newToken('numeric', sign * Infinity)
        case 'N':
            read();
            literal('aN');
            return newToken('numeric', NaN)
        }
        throw invalidChar(read())
    },
    zero () {
        switch (c) {
        case '.':
            buffer += read();
            lexState = 'decimalPoint';
            return
        case 'e':
        case 'E':
            buffer += read();
            lexState = 'decimalExponent';
            return
        case 'x':
        case 'X':
            buffer += read();
            lexState = 'hexadecimal';
            return
        }
        return newToken('numeric', sign * 0)
    },
    decimalInteger () {
        switch (c) {
        case '.':
            buffer += read();
            lexState = 'decimalPoint';
            return
        case 'e':
        case 'E':
            buffer += read();
            lexState = 'decimalExponent';
            return
        }
        if (util.isDigit(c)) {
            buffer += read();
            return
        }
        return newToken('numeric', sign * Number(buffer))
    },
    decimalPointLeading () {
        if (util.isDigit(c)) {
            buffer += read();
            lexState = 'decimalFraction';
            return
        }
        throw invalidChar(read())
    },
    decimalPoint () {
        switch (c) {
        case 'e':
        case 'E':
            buffer += read();
            lexState = 'decimalExponent';
            return
        }
        if (util.isDigit(c)) {
            buffer += read();
            lexState = 'decimalFraction';
            return
        }
        return newToken('numeric', sign * Number(buffer))
    },
    decimalFraction () {
        switch (c) {
        case 'e':
        case 'E':
            buffer += read();
            lexState = 'decimalExponent';
            return
        }
        if (util.isDigit(c)) {
            buffer += read();
            return
        }
        return newToken('numeric', sign * Number(buffer))
    },
    decimalExponent () {
        switch (c) {
        case '+':
        case '-':
            buffer += read();
            lexState = 'decimalExponentSign';
            return
        }
        if (util.isDigit(c)) {
            buffer += read();
            lexState = 'decimalExponentInteger';
            return
        }
        throw invalidChar(read())
    },
    decimalExponentSign () {
        if (util.isDigit(c)) {
            buffer += read();
            lexState = 'decimalExponentInteger';
            return
        }
        throw invalidChar(read())
    },
    decimalExponentInteger () {
        if (util.isDigit(c)) {
            buffer += read();
            return
        }
        return newToken('numeric', sign * Number(buffer))
    },
    hexadecimal () {
        if (util.isHexDigit(c)) {
            buffer += read();
            lexState = 'hexadecimalInteger';
            return
        }
        throw invalidChar(read())
    },
    hexadecimalInteger () {
        if (util.isHexDigit(c)) {
            buffer += read();
            return
        }
        return newToken('numeric', sign * Number(buffer))
    },
    string () {
        switch (c) {
        case '\\':
            read();
            buffer += escape();
            return
        case '"':
            if (doubleQuote) {
                read();
                return newToken('string', buffer)
            }
            buffer += read();
            return
        case "'":
            if (!doubleQuote) {
                read();
                return newToken('string', buffer)
            }
            buffer += read();
            return
        case '\n':
        case '\r':
            throw invalidChar(read())
        case '\u2028':
        case '\u2029':
            separatorChar(c);
            break
        case undefined:
            throw invalidChar(read())
        }
        buffer += read();
    },
    start () {
        switch (c) {
        case '{':
        case '[':
            return newToken('punctuator', read())
        }
        lexState = 'value';
    },
    beforePropertyName () {
        switch (c) {
        case '$':
        case '_':
            buffer = read();
            lexState = 'identifierName';
            return
        case '\\':
            read();
            lexState = 'identifierNameStartEscape';
            return
        case '}':
            return newToken('punctuator', read())
        case '"':
        case "'":
            doubleQuote = (read() === '"');
            lexState = 'string';
            return
        }
        if (util.isIdStartChar(c)) {
            buffer += read();
            lexState = 'identifierName';
            return
        }
        throw invalidChar(read())
    },
    afterPropertyName () {
        if (c === ':') {
            return newToken('punctuator', read())
        }
        throw invalidChar(read())
    },
    beforePropertyValue () {
        lexState = 'value';
    },
    afterPropertyValue () {
        switch (c) {
        case ',':
        case '}':
            return newToken('punctuator', read())
        }
        throw invalidChar(read())
    },
    beforeArrayValue () {
        if (c === ']') {
            return newToken('punctuator', read())
        }
        lexState = 'value';
    },
    afterArrayValue () {
        switch (c) {
        case ',':
        case ']':
            return newToken('punctuator', read())
        }
        throw invalidChar(read())
    },
    end () {
        throw invalidChar(read())
    },
};
function newToken (type, value) {
    return {
        type,
        value,
        line,
        column,
    }
}
function literal (s) {
    for (const c of s) {
        const p = peek();
        if (p !== c) {
            throw invalidChar(read())
        }
        read();
    }
}
function escape () {
    const c = peek();
    switch (c) {
    case 'b':
        read();
        return '\b'
    case 'f':
        read();
        return '\f'
    case 'n':
        read();
        return '\n'
    case 'r':
        read();
        return '\r'
    case 't':
        read();
        return '\t'
    case 'v':
        read();
        return '\v'
    case '0':
        read();
        if (util.isDigit(peek())) {
            throw invalidChar(read())
        }
        return '\0'
    case 'x':
        read();
        return hexEscape()
    case 'u':
        read();
        return unicodeEscape()
    case '\n':
    case '\u2028':
    case '\u2029':
        read();
        return ''
    case '\r':
        read();
        if (peek() === '\n') {
            read();
        }
        return ''
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
        throw invalidChar(read())
    case undefined:
        throw invalidChar(read())
    }
    return read()
}
function hexEscape () {
    let buffer = '';
    let c = peek();
    if (!util.isHexDigit(c)) {
        throw invalidChar(read())
    }
    buffer += read();
    c = peek();
    if (!util.isHexDigit(c)) {
        throw invalidChar(read())
    }
    buffer += read();
    return String.fromCodePoint(parseInt(buffer, 16))
}
function unicodeEscape () {
    let buffer = '';
    let count = 4;
    while (count-- > 0) {
        const c = peek();
        if (!util.isHexDigit(c)) {
            throw invalidChar(read())
        }
        buffer += read();
    }
    return String.fromCodePoint(parseInt(buffer, 16))
}
const parseStates = {
    start () {
        if (token.type === 'eof') {
            throw invalidEOF()
        }
        push();
    },
    beforePropertyName () {
        switch (token.type) {
        case 'identifier':
        case 'string':
            key = token.value;
            parseState = 'afterPropertyName';
            return
        case 'punctuator':
            pop();
            return
        case 'eof':
            throw invalidEOF()
        }
    },
    afterPropertyName () {
        if (token.type === 'eof') {
            throw invalidEOF()
        }
        parseState = 'beforePropertyValue';
    },
    beforePropertyValue () {
        if (token.type === 'eof') {
            throw invalidEOF()
        }
        push();
    },
    beforeArrayValue () {
        if (token.type === 'eof') {
            throw invalidEOF()
        }
        if (token.type === 'punctuator' && token.value === ']') {
            pop();
            return
        }
        push();
    },
    afterPropertyValue () {
        if (token.type === 'eof') {
            throw invalidEOF()
        }
        switch (token.value) {
        case ',':
            parseState = 'beforePropertyName';
            return
        case '}':
            pop();
        }
    },
    afterArrayValue () {
        if (token.type === 'eof') {
            throw invalidEOF()
        }
        switch (token.value) {
        case ',':
            parseState = 'beforeArrayValue';
            return
        case ']':
            pop();
        }
    },
    end () {
    },
};
function push () {
    let value;
    switch (token.type) {
    case 'punctuator':
        switch (token.value) {
        case '{':
            value = {};
            break
        case '[':
            value = [];
            break
        }
        break
    case 'null':
    case 'boolean':
    case 'numeric':
    case 'string':
        value = token.value;
        break
    }
    if (root$2 === undefined) {
        root$2 = value;
    } else {
        const parent = stack[stack.length - 1];
        if (Array.isArray(parent)) {
            parent.push(value);
        } else {
            Object.defineProperty(parent, key, {
                value,
                writable: true,
                enumerable: true,
                configurable: true,
            });
        }
    }
    if (value !== null && typeof value === 'object') {
        stack.push(value);
        if (Array.isArray(value)) {
            parseState = 'beforeArrayValue';
        } else {
            parseState = 'beforePropertyName';
        }
    } else {
        const current = stack[stack.length - 1];
        if (current == null) {
            parseState = 'end';
        } else if (Array.isArray(current)) {
            parseState = 'afterArrayValue';
        } else {
            parseState = 'afterPropertyValue';
        }
    }
}
function pop () {
    stack.pop();
    const current = stack[stack.length - 1];
    if (current == null) {
        parseState = 'end';
    } else if (Array.isArray(current)) {
        parseState = 'afterArrayValue';
    } else {
        parseState = 'afterPropertyValue';
    }
}
function invalidChar (c) {
    if (c === undefined) {
        return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
    }
    return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
}
function invalidEOF () {
    return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
}
function invalidIdentifier () {
    column -= 5;
    return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`)
}
function separatorChar (c) {
    console.warn(`JSON5: '${formatChar(c)}' in strings is not valid ECMAScript; consider escaping`);
}
function formatChar (c) {
    const replacements = {
        "'": "\\'",
        '"': '\\"',
        '\\': '\\\\',
        '\b': '\\b',
        '\f': '\\f',
        '\n': '\\n',
        '\r': '\\r',
        '\t': '\\t',
        '\v': '\\v',
        '\0': '\\0',
        '\u2028': '\\u2028',
        '\u2029': '\\u2029',
    };
    if (replacements[c]) {
        return replacements[c]
    }
    if (c < ' ') {
        const hexString = c.charCodeAt(0).toString(16);
        return '\\x' + ('00' + hexString).substring(hexString.length)
    }
    return c
}
function syntaxError (message) {
    const err = new SyntaxError(message);
    err.lineNumber = line;
    err.columnNumber = column;
    return err
}
var stringify = function stringify (value, replacer, space) {
    const stack = [];
    let indent = '';
    let propertyList;
    let replacerFunc;
    let gap = '';
    let quote;
    if (
        replacer != null &&
        typeof replacer === 'object' &&
        !Array.isArray(replacer)
    ) {
        space = replacer.space;
        quote = replacer.quote;
        replacer = replacer.replacer;
    }
    if (typeof replacer === 'function') {
        replacerFunc = replacer;
    } else if (Array.isArray(replacer)) {
        propertyList = [];
        for (const v of replacer) {
            let item;
            if (typeof v === 'string') {
                item = v;
            } else if (
                typeof v === 'number' ||
                v instanceof String ||
                v instanceof Number
            ) {
                item = String(v);
            }
            if (item !== undefined && propertyList.indexOf(item) < 0) {
                propertyList.push(item);
            }
        }
    }
    if (space instanceof Number) {
        space = Number(space);
    } else if (space instanceof String) {
        space = String(space);
    }
    if (typeof space === 'number') {
        if (space > 0) {
            space = Math.min(10, Math.floor(space));
            gap = '          '.substr(0, space);
        }
    } else if (typeof space === 'string') {
        gap = space.substr(0, 10);
    }
    return serializeProperty('', {'': value})
    function serializeProperty (key, holder) {
        let value = holder[key];
        if (value != null) {
            if (typeof value.toJSON5 === 'function') {
                value = value.toJSON5(key);
            } else if (typeof value.toJSON === 'function') {
                value = value.toJSON(key);
            }
        }
        if (replacerFunc) {
            value = replacerFunc.call(holder, key, value);
        }
        if (value instanceof Number) {
            value = Number(value);
        } else if (value instanceof String) {
            value = String(value);
        } else if (value instanceof Boolean) {
            value = value.valueOf();
        }
        switch (value) {
        case null: return 'null'
        case true: return 'true'
        case false: return 'false'
        }
        if (typeof value === 'string') {
            return quoteString(value)
        }
        if (typeof value === 'number') {
            return String(value)
        }
        if (typeof value === 'object') {
            return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
        }
        return undefined
    }
    function quoteString (value) {
        const quotes = {
            "'": 0.1,
            '"': 0.2,
        };
        const replacements = {
            "'": "\\'",
            '"': '\\"',
            '\\': '\\\\',
            '\b': '\\b',
            '\f': '\\f',
            '\n': '\\n',
            '\r': '\\r',
            '\t': '\\t',
            '\v': '\\v',
            '\0': '\\0',
            '\u2028': '\\u2028',
            '\u2029': '\\u2029',
        };
        let product = '';
        for (let i = 0; i < value.length; i++) {
            const c = value[i];
            switch (c) {
            case "'":
            case '"':
                quotes[c]++;
                product += c;
                continue
            case '\0':
                if (util.isDigit(value[i + 1])) {
                    product += '\\x00';
                    continue
                }
            }
            if (replacements[c]) {
                product += replacements[c];
                continue
            }
            if (c < ' ') {
                let hexString = c.charCodeAt(0).toString(16);
                product += '\\x' + ('00' + hexString).substring(hexString.length);
                continue
            }
            product += c;
        }
        const quoteChar = quote || Object.keys(quotes).reduce((a, b) => (quotes[a] < quotes[b]) ? a : b);
        product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
        return quoteChar + product + quoteChar
    }
    function serializeObject (value) {
        if (stack.indexOf(value) >= 0) {
            throw TypeError('Converting circular structure to JSON5')
        }
        stack.push(value);
        let stepback = indent;
        indent = indent + gap;
        let keys = propertyList || Object.keys(value);
        let partial = [];
        for (const key of keys) {
            const propertyString = serializeProperty(key, value);
            if (propertyString !== undefined) {
                let member = serializeKey(key) + ':';
                if (gap !== '') {
                    member += ' ';
                }
                member += propertyString;
                partial.push(member);
            }
        }
        let final;
        if (partial.length === 0) {
            final = '{}';
        } else {
            let properties;
            if (gap === '') {
                properties = partial.join(',');
                final = '{' + properties + '}';
            } else {
                let separator = ',\n' + indent;
                properties = partial.join(separator);
                final = '{\n' + indent + properties + ',\n' + stepback + '}';
            }
        }
        stack.pop();
        indent = stepback;
        return final
    }
    function serializeKey (key) {
        if (key.length === 0) {
            return quoteString(key)
        }
        const firstChar = String.fromCodePoint(key.codePointAt(0));
        if (!util.isIdStartChar(firstChar)) {
            return quoteString(key)
        }
        for (let i = firstChar.length; i < key.length; i++) {
            if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
                return quoteString(key)
            }
        }
        return key
    }
    function serializeArray (value) {
        if (stack.indexOf(value) >= 0) {
            throw TypeError('Converting circular structure to JSON5')
        }
        stack.push(value);
        let stepback = indent;
        indent = indent + gap;
        let partial = [];
        for (let i = 0; i < value.length; i++) {
            const propertyString = serializeProperty(String(i), value);
            partial.push((propertyString !== undefined) ? propertyString : 'null');
        }
        let final;
        if (partial.length === 0) {
            final = '[]';
        } else {
            if (gap === '') {
                let properties = partial.join(',');
                final = '[' + properties + ']';
            } else {
                let separator = ',\n' + indent;
                let properties = partial.join(separator);
                final = '[\n' + indent + properties + ',\n' + stepback + ']';
            }
        }
        stack.pop();
        indent = stepback;
        return final
    }
};
const JSON5 = {
    parse: parse$1,
    stringify,
};
var lib = JSON5;

var sprintf = {};

(function (exports) {
	!function() {
	    var re = {
	        not_string: /[^s]/,
	        not_bool: /[^t]/,
	        not_type: /[^T]/,
	        not_primitive: /[^v]/,
	        number: /[diefg]/,
	        numeric_arg: /[bcdiefguxX]/,
	        json: /[j]/,
	        not_json: /[^j]/,
	        text: /^[^\x25]+/,
	        modulo: /^\x25{2}/,
	        placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,
	        key: /^([a-z_][a-z_\d]*)/i,
	        key_access: /^\.([a-z_][a-z_\d]*)/i,
	        index_access: /^\[(\d+)\]/,
	        sign: /^[+-]/
	    };
	    function sprintf(key) {
	        return sprintf_format(sprintf_parse(key), arguments)
	    }
	    function vsprintf(fmt, argv) {
	        return sprintf.apply(null, [fmt].concat(argv || []))
	    }
	    function sprintf_format(parse_tree, argv) {
	        var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign;
	        for (i = 0; i < tree_length; i++) {
	            if (typeof parse_tree[i] === 'string') {
	                output += parse_tree[i];
	            }
	            else if (typeof parse_tree[i] === 'object') {
	                ph = parse_tree[i];
	                if (ph.keys) {
	                    arg = argv[cursor];
	                    for (k = 0; k < ph.keys.length; k++) {
	                        if (arg == undefined) {
	                            throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k-1]))
	                        }
	                        arg = arg[ph.keys[k]];
	                    }
	                }
	                else if (ph.param_no) {
	                    arg = argv[ph.param_no];
	                }
	                else {
	                    arg = argv[cursor++];
	                }
	                if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {
	                    arg = arg();
	                }
	                if (re.numeric_arg.test(ph.type) && (typeof arg !== 'number' && isNaN(arg))) {
	                    throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg))
	                }
	                if (re.number.test(ph.type)) {
	                    is_positive = arg >= 0;
	                }
	                switch (ph.type) {
	                    case 'b':
	                        arg = parseInt(arg, 10).toString(2);
	                        break
	                    case 'c':
	                        arg = String.fromCharCode(parseInt(arg, 10));
	                        break
	                    case 'd':
	                    case 'i':
	                        arg = parseInt(arg, 10);
	                        break
	                    case 'j':
	                        arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0);
	                        break
	                    case 'e':
	                        arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential();
	                        break
	                    case 'f':
	                        arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg);
	                        break
	                    case 'g':
	                        arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg);
	                        break
	                    case 'o':
	                        arg = (parseInt(arg, 10) >>> 0).toString(8);
	                        break
	                    case 's':
	                        arg = String(arg);
	                        arg = (ph.precision ? arg.substring(0, ph.precision) : arg);
	                        break
	                    case 't':
	                        arg = String(!!arg);
	                        arg = (ph.precision ? arg.substring(0, ph.precision) : arg);
	                        break
	                    case 'T':
	                        arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase();
	                        arg = (ph.precision ? arg.substring(0, ph.precision) : arg);
	                        break
	                    case 'u':
	                        arg = parseInt(arg, 10) >>> 0;
	                        break
	                    case 'v':
	                        arg = arg.valueOf();
	                        arg = (ph.precision ? arg.substring(0, ph.precision) : arg);
	                        break
	                    case 'x':
	                        arg = (parseInt(arg, 10) >>> 0).toString(16);
	                        break
	                    case 'X':
	                        arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase();
	                        break
	                }
	                if (re.json.test(ph.type)) {
	                    output += arg;
	                }
	                else {
	                    if (re.number.test(ph.type) && (!is_positive || ph.sign)) {
	                        sign = is_positive ? '+' : '-';
	                        arg = arg.toString().replace(re.sign, '');
	                    }
	                    else {
	                        sign = '';
	                    }
	                    pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' ';
	                    pad_length = ph.width - (sign + arg).length;
	                    pad = ph.width ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '';
	                    output += ph.align ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg);
	                }
	            }
	        }
	        return output
	    }
	    var sprintf_cache = Object.create(null);
	    function sprintf_parse(fmt) {
	        if (sprintf_cache[fmt]) {
	            return sprintf_cache[fmt]
	        }
	        var _fmt = fmt, match, parse_tree = [], arg_names = 0;
	        while (_fmt) {
	            if ((match = re.text.exec(_fmt)) !== null) {
	                parse_tree.push(match[0]);
	            }
	            else if ((match = re.modulo.exec(_fmt)) !== null) {
	                parse_tree.push('%');
	            }
	            else if ((match = re.placeholder.exec(_fmt)) !== null) {
	                if (match[2]) {
	                    arg_names |= 1;
	                    var field_list = [], replacement_field = match[2], field_match = [];
	                    if ((field_match = re.key.exec(replacement_field)) !== null) {
	                        field_list.push(field_match[1]);
	                        while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
	                            if ((field_match = re.key_access.exec(replacement_field)) !== null) {
	                                field_list.push(field_match[1]);
	                            }
	                            else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
	                                field_list.push(field_match[1]);
	                            }
	                            else {
	                                throw new SyntaxError('[sprintf] failed to parse named argument key')
	                            }
	                        }
	                    }
	                    else {
	                        throw new SyntaxError('[sprintf] failed to parse named argument key')
	                    }
	                    match[2] = field_list;
	                }
	                else {
	                    arg_names |= 2;
	                }
	                if (arg_names === 3) {
	                    throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported')
	                }
	                parse_tree.push(
	                    {
	                        placeholder: match[0],
	                        param_no:    match[1],
	                        keys:        match[2],
	                        sign:        match[3],
	                        pad_char:    match[4],
	                        align:       match[5],
	                        width:       match[6],
	                        precision:   match[7],
	                        type:        match[8]
	                    }
	                );
	            }
	            else {
	                throw new SyntaxError('[sprintf] unexpected placeholder')
	            }
	            _fmt = _fmt.substring(match[0].length);
	        }
	        return sprintf_cache[fmt] = parse_tree
	    }
	    {
	        exports['sprintf'] = sprintf;
	        exports['vsprintf'] = vsprintf;
	    }
	    if (typeof window !== 'undefined') {
	        window['sprintf'] = sprintf;
	        window['vsprintf'] = vsprintf;
	    }
	}(); 
} (sprintf));

function isBetween(code, min, max) {
    return code >= min && code <= max;
}
function isGreaterThan(code, min) {
    return code > min;
}
function isGreaterThanOrEqual(code, min) {
    return code >= min;
}
function isDigit(code) {
    return isBetween(code, 48 , 57 );
}
function isHexDigit(code) {
    return isDigit(code)
        || isBetween(code, 65 , 70 )
        || isBetween(code, 97 , 102 );
}
function isUppercaseLetter(code) {
    return isBetween(code, 65 , 90 );
}
function isLowercaseLetter(code) {
    return isBetween(code, 97 , 122 );
}
function isLetter(code) {
    return isUppercaseLetter(code) || isLowercaseLetter(code);
}
function isNonAsciiCodePoint(code) {
    return isGreaterThanOrEqual(code, 128 );
}
function isIdentStartCodePoint(code) {
    return isLetter(code) || isNonAsciiCodePoint(code) || code === 95 ;
}
function isIdentCodePoint(code) {
    return isIdentStartCodePoint(code) || isDigit(code) || code === 45 ;
}
function isNonPrintableCodePoint(code) {
    return isBetween(code, 0 , 8 )
        || code === 11
        || isBetween(code, 14 , 31 )
        || code === 127 ;
}
function isNewline(code) {
    return code === 10  || code === 13  || code === 12 ;
}
function isWhitespace(code) {
    return isNewline(code) || code === 9  || code === 32 ;
}
function isLeadingSurrogate(code) {
    return isBetween(code, 55296 , 56319 );
}
function isTrailingSurrogate(code) {
    return isBetween(code, 56320 , 57343 );
}
function isSurrogate(code) {
    return isLeadingSurrogate(code) || isTrailingSurrogate(code);
}
function isGreaterThanMaxAllowedCodePoint(code) {
    return isGreaterThan(code, 1114111 );
}
function isBOM(code) {
    return code === 65279  || code === 65534 ;
}
const checkForValidEscape = (a, b) => {
    if (a !== 92 ) {
        return false;
    }
    return !isNewline(b);
};
const checkForIdentStart = (a, b, c) => {
    if (a === 45 ) {
        return isIdentStartCodePoint(b) || b === 45  || checkForValidEscape(b, c);
    }
    if (isIdentStartCodePoint(a)) {
        return true;
    }
    if (a === 92 ) {
        return checkForValidEscape(a, b);
    }
    return false;
};
const checkForNumberStart = (a, b, c) => {
    if (a === 43  || a === 45 ) {
        if (isDigit(b)) {
            return true;
        }
        return b === 46  && isDigit(c);
    }
    if (a === 46 ) {
        return isDigit(b);
    }
    return isDigit(a);
};
function getCodePointsArrayHash(arr, start, end) {
    let hash = 5381;
    for (let i = start; i < end; i += 1) {
        hash = hash * 33 ^ (arr[i] | 0x20);
    }
    return hash >>> 0;
}
class TokenizerContext {
    length;
    onToken;
    onError;
    codes;
    cursor;
    customFunctionHandlers;
    constructor(source, onToken, onError, functionHandlers) {
        this.length = source.length;
        this.preprocess(source);
        this.cursor = isBOM(this.codes[0]) ? 1 : 0;
        this.onToken = onToken;
        this.onError = onError;
        if (functionHandlers) {
            this.customFunctionHandlers = new Map();
            for (const [hash, handler] of functionHandlers) {
                this.customFunctionHandlers.set(hash, handler);
            }
        }
    }
    preprocess(source) {
        const len = source.length;
        this.codes = new Int32Array(len + 1);
        for (let i = 0; i < len; i += 1) {
            this.codes[i] = source.charCodeAt(i);
        }
        this.codes[len] = -1 ;
    }
    getFunctionHandler(hash) {
        return this.customFunctionHandlers?.get(hash);
    }
    hasFunctionHandler(hash) {
        return this.customFunctionHandlers?.has(hash) ?? false;
    }
    get offset() {
        return this.cursor;
    }
    get code() {
        return this.codes[this.offset];
    }
    get prevCode() {
        return this.codes[this.offset - 1];
    }
    get nextCode() {
        return this.codes[this.offset + 1];
    }
    getRelativeCode(relativeOffset) {
        return this.codes[this.offset + relativeOffset];
    }
    isEof() {
        return this.offset >= this.length;
    }
    isNextEof() {
        return this.cursor + 1 === this.length;
    }
    isLessThanEqualToEof() {
        return this.offset <= this.length;
    }
    consumeCodePoint(n = 1) {
        this.cursor += n;
    }
    getNextNonWsCode() {
        let i = this.cursor;
        while (i < this.length && isWhitespace(this.codes[i])) {
            i += 1;
        }
        return this.codes[i];
    }
    consumeWhitespace() {
        while (this.code && isWhitespace(this.code)) {
            this.consumeCodePoint();
        }
    }
    consumeSingleWhitespace() {
        if (isWhitespace(this.code)) {
            this.cursor += this.code === 13  && this.nextCode === 10  ? 2 : 1;
        }
    }
    consumeUntilCommentEnd() {
        while (this.cursor < this.length) {
            if (this.code === 42  && this.nextCode === 47 ) {
                this.cursor += 2;
                break;
            }
            this.cursor += 1;
        }
    }
    consumeTrivialToken(tokenType) {
        this.onToken(tokenType, this.cursor, ++this.cursor);
    }
    getHashFrom(start) {
        return getCodePointsArrayHash(this.codes, start, this.cursor);
    }
}
var TokenType$1;
(function (TokenType) {
    TokenType[TokenType["Eof"] = 0] = "Eof";
    TokenType[TokenType["Ident"] = 1] = "Ident";
    TokenType[TokenType["Function"] = 2] = "Function";
    TokenType[TokenType["AtKeyword"] = 3] = "AtKeyword";
    TokenType[TokenType["Hash"] = 4] = "Hash";
    TokenType[TokenType["String"] = 5] = "String";
    TokenType[TokenType["BadString"] = 6] = "BadString";
    TokenType[TokenType["Url"] = 7] = "Url";
    TokenType[TokenType["BadUrl"] = 8] = "BadUrl";
    TokenType[TokenType["Delim"] = 9] = "Delim";
    TokenType[TokenType["Number"] = 10] = "Number";
    TokenType[TokenType["Percentage"] = 11] = "Percentage";
    TokenType[TokenType["Dimension"] = 12] = "Dimension";
    TokenType[TokenType["Whitespace"] = 13] = "Whitespace";
    TokenType[TokenType["Cdo"] = 14] = "Cdo";
    TokenType[TokenType["Cdc"] = 15] = "Cdc";
    TokenType[TokenType["Colon"] = 16] = "Colon";
    TokenType[TokenType["Semicolon"] = 17] = "Semicolon";
    TokenType[TokenType["Comma"] = 18] = "Comma";
    TokenType[TokenType["OpenSquareBracket"] = 19] = "OpenSquareBracket";
    TokenType[TokenType["CloseSquareBracket"] = 20] = "CloseSquareBracket";
    TokenType[TokenType["OpenParenthesis"] = 21] = "OpenParenthesis";
    TokenType[TokenType["CloseParenthesis"] = 22] = "CloseParenthesis";
    TokenType[TokenType["OpenCurlyBracket"] = 23] = "OpenCurlyBracket";
    TokenType[TokenType["CloseCurlyBracket"] = 24] = "CloseCurlyBracket";
    TokenType[TokenType["Comment"] = 25] = "Comment";
})(TokenType$1 || (TokenType$1 = {}));
const UNKNOWN_TOKEN_NAME = 'unknown';
const TOKEN_NAMES = Object.freeze({
    [TokenType$1.Eof]: 'eof',
    [TokenType$1.Ident]: 'ident',
    [TokenType$1.Function]: 'function',
    [TokenType$1.AtKeyword]: 'at-keyword',
    [TokenType$1.Hash]: 'hash',
    [TokenType$1.String]: 'string',
    [TokenType$1.BadString]: 'bad-string',
    [TokenType$1.Url]: 'url',
    [TokenType$1.BadUrl]: 'bad-url',
    [TokenType$1.Delim]: 'delim',
    [TokenType$1.Number]: 'number',
    [TokenType$1.Percentage]: 'percentage',
    [TokenType$1.Dimension]: 'dimension',
    [TokenType$1.Whitespace]: 'whitespace',
    [TokenType$1.Cdo]: 'CDO',
    [TokenType$1.Cdc]: 'CDC',
    [TokenType$1.Colon]: 'colon',
    [TokenType$1.Semicolon]: 'semicolon',
    [TokenType$1.Comma]: 'comma',
    [TokenType$1.OpenSquareBracket]: '[',
    [TokenType$1.CloseSquareBracket]: ']',
    [TokenType$1.OpenParenthesis]: '(',
    [TokenType$1.CloseParenthesis]: ')',
    [TokenType$1.OpenCurlyBracket]: '{',
    [TokenType$1.CloseCurlyBracket]: '}',
    [TokenType$1.Comment]: 'comment',
});
const getBaseTokenName = (type) => {
    return TOKEN_NAMES[type] ?? UNKNOWN_TOKEN_NAME;
};
const getFormattedTokenName = (type) => {
    return `<${getBaseTokenName(type)}-token>`;
};
const MAX_HEX_DIGITS = 6;
const consumeEscapedCodePoint = (context) => {
    context.consumeCodePoint();
    if (isHexDigit(context.code)) {
        let consumedHexDigits = 0;
        while (isHexDigit(context.code) && consumedHexDigits <= MAX_HEX_DIGITS) {
            context.consumeCodePoint();
            consumedHexDigits += 1;
        }
        context.consumeSingleWhitespace();
    }
    if (context.isEof()) {
        context.onError("Unexpected end of file while parsing escaped code point." , context.offset, context.offset);
    }
};
const consumeIndentSequence = (context) => {
    while (!context.isEof()) {
        if (isIdentCodePoint(context.code)) {
            context.consumeCodePoint();
            continue;
        }
        if (checkForValidEscape(context.code, context.nextCode)) {
            context.consumeCodePoint();
            consumeEscapedCodePoint(context);
            continue;
        }
        return;
    }
};
function consumeBadUrlRemnants(context) {
    for (; !context.isEof(); context.consumeCodePoint()) {
        if (context.code === 41 ) {
            context.consumeCodePoint();
            return;
        }
        if (checkForValidEscape(context.getRelativeCode(1), context.getRelativeCode(2))) {
            context.consumeCodePoint();
            consumeEscapedCodePoint(context);
            continue;
        }
    }
}
function consumeBadUrlToken(context, start) {
    consumeBadUrlRemnants(context);
    context.onToken(TokenType$1.BadUrl, start, context.offset);
}
const consumeUrlToken = (context, start) => {
    while (isWhitespace(context.code)) {
        context.consumeCodePoint();
    }
    while (context.offset <= context.length) {
        if (context.code === 41 ) {
            context.consumeCodePoint();
            context.onToken(TokenType$1.Url, start, context.offset);
            return;
        }
        if (context.isEof()) {
            context.onToken(TokenType$1.Url, start, context.offset);
            context.onError("Unexpected end of file while parsing URL." , start, context.offset);
            return;
        }
        if (isWhitespace(context.code)) {
            while (isWhitespace(context.code)) {
                context.consumeCodePoint();
            }
            if (context.code === 41  || context.isEof()) {
                context.consumeCodePoint();
                context.onToken(TokenType$1.Url, start, context.offset);
                context.onError("Unexpected end of file while parsing URL." , start, context.offset);
                return;
            }
            context.onError("Unexpected character in URL." , start, context.offset);
            consumeBadUrlToken(context, start);
            return;
        }
        if (context.code === 34
            || context.code === 39
            || context.code === 40
            || isNonPrintableCodePoint(context.code)) {
            context.onError("Unexpected character in URL." , start, context.offset);
            consumeBadUrlToken(context, start);
            return;
        }
        if (context.code === 92 ) {
            if (checkForValidEscape(context.code, context.nextCode)) {
                context.consumeCodePoint();
                consumeEscapedCodePoint(context);
                continue;
            }
            context.onError("Unexpected character in URL." , start, context.offset);
            consumeBadUrlToken(context, start);
            return;
        }
        context.consumeCodePoint();
    }
};
const URL_FUNCTION_HASH = 193422222;
const consumeIdentLikeToken = (context) => {
    const start = context.offset;
    consumeIndentSequence(context);
    if (context.code === 40 ) {
        const fnHash = context.getHashFrom(start);
        context.consumeCodePoint();
        if (fnHash === URL_FUNCTION_HASH) {
            const nextNonWsCode = context.getNextNonWsCode();
            if (nextNonWsCode === 34  || nextNonWsCode === 39 ) {
                context.onToken(TokenType$1.Function, start, context.offset);
                return;
            }
            consumeUrlToken(context, start);
            return;
        }
        if (context.hasFunctionHandler(fnHash)) {
            context.onToken(TokenType$1.Function, start, context.offset);
            context.getFunctionHandler(fnHash)(context);
            return;
        }
        context.onToken(TokenType$1.Function, start, context.offset);
        return;
    }
    context.onToken(TokenType$1.Ident, start, context.offset);
};
const consumeNumber = (context) => {
    if (context.code === 43  || context.code === 45 ) {
        context.consumeCodePoint();
    }
    while (isDigit(context.code)) {
        context.consumeCodePoint();
    }
    if (context.code === 46  && isDigit(context.nextCode)) {
        context.consumeCodePoint(2);
        while (isDigit(context.code)) {
            context.consumeCodePoint();
        }
    }
    if ((context.code === 69  || context.code === 101 )) {
        if ((context.nextCode === 45  || context.nextCode === 43 )
            && isDigit(context.getRelativeCode(2))) {
            context.consumeCodePoint(3);
            while (isDigit(context.code)) {
                context.consumeCodePoint();
            }
        }
        else if (isDigit(context.nextCode)) {
            context.consumeCodePoint(2);
            while (isDigit(context.code)) {
                context.consumeCodePoint();
            }
        }
    }
};
const consumeNumericToken = (context) => {
    const start = context.offset;
    consumeNumber(context);
    if (checkForIdentStart(context.code, context.nextCode, context.getRelativeCode(2))) {
        consumeIndentSequence(context);
        context.onToken(TokenType$1.Dimension, start, context.offset);
        return;
    }
    if (context.code === 37 ) {
        context.consumeCodePoint();
        context.onToken(TokenType$1.Percentage, start, context.offset);
        return;
    }
    context.onToken(TokenType$1.Number, start, context.offset);
};
const consumeStringToken = (context) => {
    const endingCodePoint = context.code;
    const start = context.offset;
    context.consumeCodePoint();
    while (context.isLessThanEqualToEof()) {
        switch (context.code) {
            case endingCodePoint:
                context.consumeCodePoint();
                context.onToken(TokenType$1.String, start, context.offset);
                return;
            case -1 :
                context.onToken(TokenType$1.String, start, context.offset);
                context.onError("Unexpected end of file while parsing string token." , start, context.offset);
                return;
            case 13 :
            case 10 :
            case 12 :
                if (context.code === 13  && context.nextCode === 10 ) {
                    context.consumeCodePoint(1);
                }
                context.consumeCodePoint(1);
                context.onToken(TokenType$1.BadString, start, context.offset);
                context.onError("Unexpected newline while parsing string token." , start, context.offset);
                return;
            case 92 :
                if (context.isNextEof()) {
                    context.consumeCodePoint();
                    context.onToken(TokenType$1.String, start, context.offset);
                    context.onError("Unexpected end of file while parsing string token." , start, context.offset);
                    return;
                }
                if (isNewline(context.nextCode)) {
                    context.consumeCodePoint(2);
                    break;
                }
                if (checkForValidEscape(context.code, context.nextCode)) {
                    context.consumeCodePoint();
                    consumeEscapedCodePoint(context);
                }
                break;
            default:
                context.consumeCodePoint();
        }
    }
};
const consumeWhitespaceToken = (context) => {
    const start = context.offset;
    context.consumeWhitespace();
    context.onToken(TokenType$1.Whitespace, start, context.offset);
};
const tokenize = (source, onToken, onError = () => { }, functionHandlers) => {
    const context = new TokenizerContext(source, onToken, onError, functionHandlers);
    while (!context.isEof()) {
        switch (context.code) {
            case 9 :
            case 32 :
            case 10 :
            case 12 :
            case 13 :
                consumeWhitespaceToken(context);
                break;
            case 48 :
            case 49 :
            case 50 :
            case 51 :
            case 52 :
            case 53 :
            case 54 :
            case 55 :
            case 56 :
            case 57 :
                consumeNumericToken(context);
                break;
            case 40 :
                context.consumeTrivialToken(TokenType$1.OpenParenthesis);
                break;
            case 41 :
                context.consumeTrivialToken(TokenType$1.CloseParenthesis);
                break;
            case 44 :
                context.consumeTrivialToken(TokenType$1.Comma);
                break;
            case 58 :
                context.consumeTrivialToken(TokenType$1.Colon);
                break;
            case 59 :
                context.consumeTrivialToken(TokenType$1.Semicolon);
                break;
            case 91 :
                context.consumeTrivialToken(TokenType$1.OpenSquareBracket);
                break;
            case 93 :
                context.consumeTrivialToken(TokenType$1.CloseSquareBracket);
                break;
            case 123 :
                context.consumeTrivialToken(TokenType$1.OpenCurlyBracket);
                break;
            case 125 :
                context.consumeTrivialToken(TokenType$1.CloseCurlyBracket);
                break;
            case 39 :
            case 34 :
                consumeStringToken(context);
                break;
            case 35 :
                if (isIdentCodePoint(context.getRelativeCode(1))
                    || checkForValidEscape(context.getRelativeCode(1), context.getRelativeCode(2))) {
                    const start = context.offset;
                    context.consumeCodePoint();
                    consumeIndentSequence(context);
                    context.onToken(TokenType$1.Hash, start, context.offset);
                    break;
                }
                context.consumeTrivialToken(TokenType$1.Delim);
                break;
            case 43 :
                if (checkForNumberStart(context.code, context.getRelativeCode(1), context.getRelativeCode(2))) {
                    consumeNumericToken(context);
                    break;
                }
                context.consumeTrivialToken(TokenType$1.Delim);
                break;
            case 45 :
                if (checkForNumberStart(context.code, context.getRelativeCode(1), context.getRelativeCode(2))) {
                    consumeNumericToken(context);
                    break;
                }
                if (context.getRelativeCode(1) === 45
                    && context.getRelativeCode(2) === 62 ) {
                    context.consumeCodePoint(3);
                    context.onToken(TokenType$1.Cdc, context.offset - 3, context.offset);
                    break;
                }
                if (checkForIdentStart(context.code, context.getRelativeCode(1), context.getRelativeCode(2))) {
                    consumeIdentLikeToken(context);
                    break;
                }
                context.consumeTrivialToken(TokenType$1.Delim);
                break;
            case 46 :
                if (checkForNumberStart(context.code, context.getRelativeCode(1), context.getRelativeCode(2))) {
                    consumeNumericToken(context);
                    break;
                }
                context.consumeTrivialToken(TokenType$1.Delim);
                break;
            case 60 :
                if (context.getRelativeCode(1) === 33
                    && context.getRelativeCode(2) === 45
                    && context.getRelativeCode(3) === 45 ) {
                    context.consumeCodePoint(4);
                    context.onToken(TokenType$1.Cdo, context.offset - 4, context.offset);
                    break;
                }
                context.consumeTrivialToken(TokenType$1.Delim);
                break;
            case 64 :
                if (checkForIdentStart(context.getRelativeCode(1), context.getRelativeCode(2), context.getRelativeCode(3))) {
                    const start = context.offset;
                    context.consumeCodePoint();
                    consumeIndentSequence(context);
                    context.onToken(TokenType$1.AtKeyword, start, context.offset);
                    break;
                }
                context.consumeTrivialToken(TokenType$1.Delim);
                break;
            case 92 :
                if (checkForValidEscape(context.code, context.getRelativeCode(1))) {
                    consumeIdentLikeToken(context);
                    break;
                }
                context.consumeTrivialToken(TokenType$1.Delim);
                context.onError("Invalid escape sequence." , context.offset - 1, context.offset);
                break;
            case 47 :
                if (context.getRelativeCode(1) === 42 ) {
                    const start = context.offset;
                    context.consumeCodePoint(2);
                    context.consumeUntilCommentEnd();
                    if (context.isEof()) {
                        context.onError("Unterminated comment." , start, context.length - 2);
                    }
                    context.onToken(TokenType$1.Comment, start, context.offset);
                    break;
                }
                context.consumeTrivialToken(TokenType$1.Delim);
                break;
            default:
                if (isIdentStartCodePoint(context.code)) {
                    consumeIdentLikeToken(context);
                    break;
                }
                context.consumeTrivialToken(TokenType$1.Delim);
        }
    }
};
const handleRegularExtendedCssPseudo = (context) => {
    const start = context.offset;
    context.consumeWhitespace();
    if (context.code === 39  || context.code === 34 ) {
        if (context.offset > start) {
            context.onToken(TokenType$1.Whitespace, start, context.offset);
        }
        return;
    }
    let balance = 1;
    for (let i = start; i < context.offset; i += 1) {
        context.onToken(TokenType$1.Delim, i, i + 1);
    }
    while (!context.isEof()) {
        if (context.code === 40  && context.prevCode !== 92 ) {
            balance += 1;
        }
        else if (context.code === 41  && context.prevCode !== 92 ) {
            balance -= 1;
            if (balance === 0) {
                break;
            }
        }
        context.consumeTrivialToken(TokenType$1.Delim);
    }
};
const handleXpathExtendedCssPseudo = (context) => {
    const start = context.offset;
    context.consumeWhitespace();
    if (context.code === 39  || context.code === 34 ) {
        if (context.offset > start) {
            context.onToken(TokenType$1.Whitespace, start, context.offset);
        }
        return;
    }
    let balance = 1;
    for (let i = start; i < context.offset; i += 1) {
        context.onToken(TokenType$1.Delim, i, i + 1);
    }
    let inString = false;
    while (!context.isEof()) {
        if (context.code === 34  && context.prevCode !== 92 ) {
            inString = !inString;
        }
        if (!inString) {
            if (context.code === 40  && context.prevCode !== 92 ) {
                balance += 1;
            }
            else if (context.code === 41  && context.prevCode !== 92 ) {
                balance -= 1;
                if (balance === 0) {
                    break;
                }
            }
        }
        context.consumeTrivialToken(TokenType$1.Delim);
    }
};
function mergeMaps(map1, map2) {
    const result = new Map();
    for (const [key, value] of map1) {
        result.set(key, value);
    }
    for (const [key, value] of map2) {
        result.set(key, value);
    }
    return result;
}
const ABP_CONTAINS_HASH = 1989084725;
const CONTAINS_HASH = 2399470598;
const HAS_TEXT_HASH = 1221663855;
const MATCHES_CSS_HASH = 102304302;
const MATCHES_CSS_AFTER_HASH = 2923888231;
const MATCHES_CSS_BEFORE_HASH = 1739713050;
const MATCHES_PROPERTY_HASH = 1860790666;
const MATCHES_ATTR_HASH = 3376104318;
const XPATH_HASH = 196571984;
const EXT_CSS_PSEUDO_HANDLERS = new Map([
    [ABP_CONTAINS_HASH, handleRegularExtendedCssPseudo],
    [CONTAINS_HASH, handleRegularExtendedCssPseudo],
    [HAS_TEXT_HASH, handleRegularExtendedCssPseudo],
    [MATCHES_CSS_HASH, handleRegularExtendedCssPseudo],
    [MATCHES_CSS_AFTER_HASH, handleRegularExtendedCssPseudo],
    [MATCHES_CSS_BEFORE_HASH, handleRegularExtendedCssPseudo],
    [MATCHES_PROPERTY_HASH, handleRegularExtendedCssPseudo],
    [MATCHES_ATTR_HASH, handleRegularExtendedCssPseudo],
    [XPATH_HASH, handleXpathExtendedCssPseudo],
]);
function tokenizeExtended(source, onToken, onError = () => { }, functionHandlers = new Map()) {
    tokenize(source, onToken, onError,
    functionHandlers.size > 0
        ? mergeMaps(EXT_CSS_PSEUDO_HANDLERS, functionHandlers)
        : EXT_CSS_PSEUDO_HANDLERS);
}
const EMPTY_STRING$1 = '';
const decodeIdent = (ident) => {
    const decodedIdent = [];
    for (let i = 0; i < ident.length; i += 1) {
        const codePoint = ident.charCodeAt(i);
        if (codePoint === 92 ) {
            if (isHexDigit(ident.charCodeAt(i + 1))) {
                let n = 0;
                let j = 0;
                while (j < MAX_HEX_DIGITS && isHexDigit(ident.charCodeAt(i + j + 1))) {
                    n = n * 16 + parseInt(ident[i + j + 1], 16);
                    j += 1;
                }
                decodedIdent.push(
                String.fromCodePoint(n === 0 || isSurrogate(n) || isGreaterThanMaxAllowedCodePoint(n)
                    ? 65533
                    : n));
                i += j;
                const nextCodePoint = ident.charCodeAt(i + 1);
                if (isWhitespace(nextCodePoint)) {
                    i += 1;
                    if (nextCodePoint === 13  && ident.charCodeAt(i + 1) === 10 ) {
                        i += 1;
                    }
                }
            }
        }
        else {
            decodedIdent.push(ident[i]);
        }
    }
    return decodedIdent.join(EMPTY_STRING$1);
};

const word$1 = '[a-fA-F\\d:]';
const b = options => options && options.includeBoundaries ?
	`(?:(?<=\\s|^)(?=${word$1})|(?<=${word$1})(?=\\s|$))` :
	'';
const v4$2 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}';
const v6seg = '[a-fA-F\\d]{1,4}';
const v6$2 = `
(?:
(?:${v6seg}:){7}(?:${v6seg}|:)|                                    // 1:2:3:4:5:6:7::  1:2:3:4:5:6:7:8
(?:${v6seg}:){6}(?:${v4$2}|:${v6seg}|:)|                             // 1:2:3:4:5:6::    1:2:3:4:5:6::8   1:2:3:4:5:6::8  1:2:3:4:5:6::1.2.3.4
(?:${v6seg}:){5}(?::${v4$2}|(?::${v6seg}){1,2}|:)|                   // 1:2:3:4:5::      1:2:3:4:5::7:8   1:2:3:4:5::8    1:2:3:4:5::7:1.2.3.4
(?:${v6seg}:){4}(?:(?::${v6seg}){0,1}:${v4$2}|(?::${v6seg}){1,3}|:)| // 1:2:3:4::        1:2:3:4::6:7:8   1:2:3:4::8      1:2:3:4::6:7:1.2.3.4
(?:${v6seg}:){3}(?:(?::${v6seg}){0,2}:${v4$2}|(?::${v6seg}){1,4}|:)| // 1:2:3::          1:2:3::5:6:7:8   1:2:3::8        1:2:3::5:6:7:1.2.3.4
(?:${v6seg}:){2}(?:(?::${v6seg}){0,3}:${v4$2}|(?::${v6seg}){1,5}|:)| // 1:2::            1:2::4:5:6:7:8   1:2::8          1:2::4:5:6:7:1.2.3.4
(?:${v6seg}:){1}(?:(?::${v6seg}){0,4}:${v4$2}|(?::${v6seg}){1,6}|:)| // 1::              1::3:4:5:6:7:8   1::8            1::3:4:5:6:7:1.2.3.4
(?::(?:(?::${v6seg}){0,5}:${v4$2}|(?::${v6seg}){1,7}|:))             // ::2:3:4:5:6:7:8  ::2:3:4:5:6:7:8  ::8             ::1.2.3.4
)(?:%[0-9a-zA-Z]{1,})?                                             // %eth0            %1
`.replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim();
const v46Exact$1 = new RegExp(`(?:^${v4$2}$)|(?:^${v6$2}$)`);
const v4exact$3 = new RegExp(`^${v4$2}$`);
const v6exact$3 = new RegExp(`^${v6$2}$`);
const ip = options => options && options.exact ?
	v46Exact$1 :
	new RegExp(`(?:${b(options)}${v4$2}${b(options)})|(?:${b(options)}${v6$2}${b(options)})`, 'g');
ip.v4 = options => options && options.exact ? v4exact$3 : new RegExp(`${b(options)}${v4$2}${b(options)}`, 'g');
ip.v6 = options => options && options.exact ? v6exact$3 : new RegExp(`${b(options)}${v6$2}${b(options)}`, 'g');
var ipRegex$3 = ip;

const ipRegex$2 = ipRegex$3;
const isIp = string => ipRegex$2({exact: true}).test(string);
isIp.v4 = string => ipRegex$2.v4({exact: true}).test(string);
isIp.v6 = string => ipRegex$2.v6({exact: true}).test(string);
isIp.version = string => isIp(string) ? (isIp.v4(string) ? 4 : 6) : undefined;
var isIp_1 = isIp;

var isIp$1 = /*@__PURE__*/getDefaultExportFromCjs$1(isIp_1);

const REGEX_DATA = 'xregexp';
const features = {
    astral: false,
    namespacing: true
};
const fixed = {};
let regexCache = {};
let patternCache = {};
const tokens = [];
const defaultScope = 'default';
const classScope = 'class';
const nativeTokens = {
    'default': /\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|\(\?(?:[:=!]|<[=!])|[?*+]\?|{\d+(?:,\d*)?}\??|[\s\S]/,
    'class': /\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|[\s\S]/
};
const replacementToken = /\$(?:\{([^\}]+)\}|<([^>]+)>|(\d\d?|[\s\S]?))/g;
const correctExecNpcg = /()??/.exec('')[1] === undefined;
const hasFlagsProp = /x/.flags !== undefined;
function hasNativeFlag(flag) {
    let isSupported = true;
    try {
        new RegExp('', flag);
        if (flag === 'y') {
            const gy = (() => 'gy')();
            const incompleteY = '.a'.replace(new RegExp('a', gy), '.') === '..';
            if (incompleteY) {
                isSupported = false;
            }
        }
    } catch (exception) {
        isSupported = false;
    }
    return isSupported;
}
const hasNativeD = hasNativeFlag('d');
const hasNativeS = hasNativeFlag('s');
const hasNativeU = hasNativeFlag('u');
const hasNativeY = hasNativeFlag('y');
const registeredFlags = {
    d: hasNativeD,
    g: true,
    i: true,
    m: true,
    s: hasNativeS,
    u: hasNativeU,
    y: hasNativeY
};
const nonnativeFlags = hasNativeS ? /[^dgimsuy]+/g : /[^dgimuy]+/g;
function augment(regex, captureNames, xSource, xFlags, isInternalOnly) {
    regex[REGEX_DATA] = {
        captureNames
    };
    if (isInternalOnly) {
        return regex;
    }
    if (regex.__proto__) {
        regex.__proto__ = XRegExp.prototype;
    } else {
        for (const p in XRegExp.prototype) {
            regex[p] = XRegExp.prototype[p];
        }
    }
    regex[REGEX_DATA].source = xSource;
    regex[REGEX_DATA].flags = xFlags ? xFlags.split('').sort().join('') : xFlags;
    return regex;
}
function clipDuplicates(str) {
    return str.replace(/([\s\S])(?=[\s\S]*\1)/g, '');
}
function copyRegex(regex, options) {
    if (!XRegExp.isRegExp(regex)) {
        throw new TypeError('Type RegExp expected');
    }
    const xData = regex[REGEX_DATA] || {};
    let flags = getNativeFlags(regex);
    let flagsToAdd = '';
    let flagsToRemove = '';
    let xregexpSource = null;
    let xregexpFlags = null;
    options = options || {};
    if (options.removeG) {flagsToRemove += 'g';}
    if (options.removeY) {flagsToRemove += 'y';}
    if (flagsToRemove) {
        flags = flags.replace(new RegExp(`[${flagsToRemove}]+`, 'g'), '');
    }
    if (options.addG) {flagsToAdd += 'g';}
    if (options.addY) {flagsToAdd += 'y';}
    if (flagsToAdd) {
        flags = clipDuplicates(flags + flagsToAdd);
    }
    if (!options.isInternalOnly) {
        if (xData.source !== undefined) {
            xregexpSource = xData.source;
        }
        if (xData.flags != null) {
            xregexpFlags = flagsToAdd ? clipDuplicates(xData.flags + flagsToAdd) : xData.flags;
        }
    }
    regex = augment(
        new RegExp(options.source || regex.source, flags),
        hasNamedCapture(regex) ? xData.captureNames.slice(0) : null,
        xregexpSource,
        xregexpFlags,
        options.isInternalOnly
    );
    return regex;
}
function dec(hex) {
    return parseInt(hex, 16);
}
function getContextualTokenSeparator(match, scope, flags) {
    const matchEndPos = match.index + match[0].length;
    const precedingChar = match.input[match.index - 1];
    const followingChar = match.input[matchEndPos];
    if (
        /^[()|]$/.test(precedingChar) ||
        /^[()|]$/.test(followingChar) ||
        match.index === 0 ||
        matchEndPos === match.input.length ||
        /\(\?(?:[:=!]|<[=!])$/.test(match.input.substring(match.index - 4, match.index)) ||
        isQuantifierNext(match.input, matchEndPos, flags)
    ) {
        return '';
    }
    return '(?:)';
}
function getNativeFlags(regex) {
    return hasFlagsProp ?
        regex.flags :
        /\/([a-z]*)$/i.exec(RegExp.prototype.toString.call(regex))[1];
}
function hasNamedCapture(regex) {
    return !!(regex[REGEX_DATA] && regex[REGEX_DATA].captureNames);
}
function hex(dec) {
    return parseInt(dec, 10).toString(16);
}
function isQuantifierNext(pattern, pos, flags) {
    const inlineCommentPattern = '\\(\\?#[^)]*\\)';
    const lineCommentPattern = '#[^#\\n]*';
    const quantifierPattern = '[?*+]|{\\d+(?:,\\d*)?}';
    const regex = flags.includes('x') ?
        new RegExp(`^(?:\\s|${lineCommentPattern}|${inlineCommentPattern})*(?:${quantifierPattern})`) :
        new RegExp(`^(?:${inlineCommentPattern})*(?:${quantifierPattern})`);
    return regex.test(pattern.slice(pos));
}
function isType(value, type) {
    return Object.prototype.toString.call(value) === `[object ${type}]`;
}
function nullThrows(value) {
    if (value == null) {
        throw new TypeError('Cannot convert null or undefined to object');
    }
    return value;
}
function pad4(str) {
    while (str.length < 4) {
        str = `0${str}`;
    }
    return str;
}
function prepareFlags(pattern, flags) {
    if (clipDuplicates(flags) !== flags) {
        throw new SyntaxError(`Invalid duplicate regex flag ${flags}`);
    }
    pattern = pattern.replace(/^\(\?([\w$]+)\)/, ($0, $1) => {
        if (/[dgy]/.test($1)) {
            throw new SyntaxError(`Cannot use flags dgy in mode modifier ${$0}`);
        }
        flags = clipDuplicates(flags + $1);
        return '';
    });
    for (const flag of flags) {
        if (!registeredFlags[flag]) {
            throw new SyntaxError(`Unknown regex flag ${flag}`);
        }
    }
    return {
        pattern,
        flags
    };
}
function prepareOptions(value) {
    const options = {};
    if (isType(value, 'String')) {
        XRegExp.forEach(value, /[^\s,]+/, (match) => {
            options[match] = true;
        });
        return options;
    }
    return value;
}
function registerFlag(flag) {
    if (!/^[\w$]$/.test(flag)) {
        throw new Error('Flag must be a single character A-Za-z0-9_$');
    }
    registeredFlags[flag] = true;
}
function runTokens(pattern, flags, pos, scope, context) {
    let i = tokens.length;
    const leadChar = pattern[pos];
    let result = null;
    let match;
    let t;
    while (i--) {
        t = tokens[i];
        if (
            (t.leadChar && t.leadChar !== leadChar) ||
            (t.scope !== scope && t.scope !== 'all') ||
            (t.flag && !flags.includes(t.flag))
        ) {
            continue;
        }
        match = XRegExp.exec(pattern, t.regex, pos, 'sticky');
        if (match) {
            result = {
                matchLength: match[0].length,
                output: t.handler.call(context, match, scope, flags),
                reparse: t.reparse
            };
            break;
        }
    }
    return result;
}
function setAstral(on) {
    features.astral = on;
}
function setNamespacing(on) {
    features.namespacing = on;
}
function XRegExp(pattern, flags) {
    if (XRegExp.isRegExp(pattern)) {
        if (flags !== undefined) {
            throw new TypeError('Cannot supply flags when copying a RegExp');
        }
        return copyRegex(pattern);
    }
    pattern = pattern === undefined ? '' : String(pattern);
    flags = flags === undefined ? '' : String(flags);
    if (XRegExp.isInstalled('astral') && !flags.includes('A')) {
        flags += 'A';
    }
    if (!patternCache[pattern]) {
        patternCache[pattern] = {};
    }
    if (!patternCache[pattern][flags]) {
        const context = {
            hasNamedCapture: false,
            captureNames: []
        };
        let scope = defaultScope;
        let output = '';
        let pos = 0;
        let result;
        const applied = prepareFlags(pattern, flags);
        let appliedPattern = applied.pattern;
        const appliedFlags = applied.flags;
        while (pos < appliedPattern.length) {
            do {
                result = runTokens(appliedPattern, appliedFlags, pos, scope, context);
                if (result && result.reparse) {
                    appliedPattern = appliedPattern.slice(0, pos) +
                        result.output +
                        appliedPattern.slice(pos + result.matchLength);
                }
            } while (result && result.reparse);
            if (result) {
                output += result.output;
                pos += (result.matchLength || 1);
            } else {
                const [token] = XRegExp.exec(appliedPattern, nativeTokens[scope], pos, 'sticky');
                output += token;
                pos += token.length;
                if (token === '[' && scope === defaultScope) {
                    scope = classScope;
                } else if (token === ']' && scope === classScope) {
                    scope = defaultScope;
                }
            }
        }
        patternCache[pattern][flags] = {
            pattern: output.replace(/(?:\(\?:\))+/g, '(?:)'),
            flags: appliedFlags.replace(nonnativeFlags, ''),
            captures: context.hasNamedCapture ? context.captureNames : null
        };
    }
    const generated = patternCache[pattern][flags];
    return augment(
        new RegExp(generated.pattern, generated.flags),
        generated.captures,
        pattern,
        flags
    );
}
XRegExp.prototype = new RegExp();
XRegExp.version = '5.1.1';
XRegExp._clipDuplicates = clipDuplicates;
XRegExp._hasNativeFlag = hasNativeFlag;
XRegExp._dec = dec;
XRegExp._hex = hex;
XRegExp._pad4 = pad4;
XRegExp.addToken = (regex, handler, options) => {
    options = options || {};
    let {optionalFlags} = options;
    if (options.flag) {
        registerFlag(options.flag);
    }
    if (optionalFlags) {
        optionalFlags = optionalFlags.split('');
        for (const flag of optionalFlags) {
            registerFlag(flag);
        }
    }
    tokens.push({
        regex: copyRegex(regex, {
            addG: true,
            addY: hasNativeY,
            isInternalOnly: true
        }),
        handler,
        scope: options.scope || defaultScope,
        flag: options.flag,
        reparse: options.reparse,
        leadChar: options.leadChar
    });
    XRegExp.cache.flush('patterns');
};
XRegExp.cache = (pattern, flags) => {
    if (!regexCache[pattern]) {
        regexCache[pattern] = {};
    }
    return regexCache[pattern][flags] || (
        regexCache[pattern][flags] = XRegExp(pattern, flags)
    );
};
XRegExp.cache.flush = (cacheName) => {
    if (cacheName === 'patterns') {
        patternCache = {};
    } else {
        regexCache = {};
    }
};
XRegExp.escape = (str) => String(nullThrows(str)).
    replace(/[\\\[\]{}()*+?.^$|]/g, '\\$&').
    replace(/[\s#\-,]/g, (match) => `\\u${pad4(hex(match.charCodeAt(0)))}`);
XRegExp.exec = (str, regex, pos, sticky) => {
    let cacheKey = 'g';
    let addY = false;
    let fakeY = false;
    let match;
    addY = hasNativeY && !!(sticky || (regex.sticky && sticky !== false));
    if (addY) {
        cacheKey += 'y';
    } else if (sticky) {
        fakeY = true;
        cacheKey += 'FakeY';
    }
    regex[REGEX_DATA] = regex[REGEX_DATA] || {};
    const r2 = regex[REGEX_DATA][cacheKey] || (
        regex[REGEX_DATA][cacheKey] = copyRegex(regex, {
            addG: true,
            addY,
            source: fakeY ? `${regex.source}|()` : undefined,
            removeY: sticky === false,
            isInternalOnly: true
        })
    );
    pos = pos || 0;
    r2.lastIndex = pos;
    match = fixed.exec.call(r2, str);
    if (fakeY && match && match.pop() === '') {
        match = null;
    }
    if (regex.global) {
        regex.lastIndex = match ? r2.lastIndex : 0;
    }
    return match;
};
XRegExp.forEach = (str, regex, callback) => {
    let pos = 0;
    let i = -1;
    let match;
    while ((match = XRegExp.exec(str, regex, pos))) {
        callback(match, ++i, str, regex);
        pos = match.index + (match[0].length || 1);
    }
};
XRegExp.globalize = (regex) => copyRegex(regex, {addG: true});
XRegExp.install = (options) => {
    options = prepareOptions(options);
    if (!features.astral && options.astral) {
        setAstral(true);
    }
    if (!features.namespacing && options.namespacing) {
        setNamespacing(true);
    }
};
XRegExp.isInstalled = (feature) => !!(features[feature]);
XRegExp.isRegExp = (value) => Object.prototype.toString.call(value) === '[object RegExp]';
XRegExp.match = (str, regex, scope) => {
    const global = (regex.global && scope !== 'one') || scope === 'all';
    const cacheKey = ((global ? 'g' : '') + (regex.sticky ? 'y' : '')) || 'noGY';
    regex[REGEX_DATA] = regex[REGEX_DATA] || {};
    const r2 = regex[REGEX_DATA][cacheKey] || (
        regex[REGEX_DATA][cacheKey] = copyRegex(regex, {
            addG: !!global,
            removeG: scope === 'one',
            isInternalOnly: true
        })
    );
    const result = String(nullThrows(str)).match(r2);
    if (regex.global) {
        regex.lastIndex = (
            (scope === 'one' && result) ?
                (result.index + result[0].length) : 0
        );
    }
    return global ? (result || []) : (result && result[0]);
};
XRegExp.matchChain = (str, chain) => (function recurseChain(values, level) {
    const item = chain[level].regex ? chain[level] : {regex: chain[level]};
    const matches = [];
    function addMatch(match) {
        if (item.backref) {
            const ERR_UNDEFINED_GROUP = `Backreference to undefined group: ${item.backref}`;
            const isNamedBackref = isNaN(item.backref);
            if (isNamedBackref && XRegExp.isInstalled('namespacing')) {
                if (!(match.groups && item.backref in match.groups)) {
                    throw new ReferenceError(ERR_UNDEFINED_GROUP);
                }
            } else if (!match.hasOwnProperty(item.backref)) {
                throw new ReferenceError(ERR_UNDEFINED_GROUP);
            }
            const backrefValue = isNamedBackref && XRegExp.isInstalled('namespacing') ?
                match.groups[item.backref] :
                match[item.backref];
            matches.push(backrefValue || '');
        } else {
            matches.push(match[0]);
        }
    }
    for (const value of values) {
        XRegExp.forEach(value, item.regex, addMatch);
    }
    return ((level === chain.length - 1) || !matches.length) ?
        matches :
        recurseChain(matches, level + 1);
}([str], 0));
XRegExp.replace = (str, search, replacement, scope) => {
    const isRegex = XRegExp.isRegExp(search);
    const global = (search.global && scope !== 'one') || scope === 'all';
    const cacheKey = ((global ? 'g' : '') + (search.sticky ? 'y' : '')) || 'noGY';
    let s2 = search;
    if (isRegex) {
        search[REGEX_DATA] = search[REGEX_DATA] || {};
        s2 = search[REGEX_DATA][cacheKey] || (
            search[REGEX_DATA][cacheKey] = copyRegex(search, {
                addG: !!global,
                removeG: scope === 'one',
                isInternalOnly: true
            })
        );
    } else if (global) {
        s2 = new RegExp(XRegExp.escape(String(search)), 'g');
    }
    const result = fixed.replace.call(nullThrows(str), s2, replacement);
    if (isRegex && search.global) {
        search.lastIndex = 0;
    }
    return result;
};
XRegExp.replaceEach = (str, replacements) => {
    for (const r of replacements) {
        str = XRegExp.replace(str, r[0], r[1], r[2]);
    }
    return str;
};
XRegExp.split = (str, separator, limit) => fixed.split.call(nullThrows(str), separator, limit);
XRegExp.test = (str, regex, pos, sticky) => !!XRegExp.exec(str, regex, pos, sticky);
XRegExp.uninstall = (options) => {
    options = prepareOptions(options);
    if (features.astral && options.astral) {
        setAstral(false);
    }
    if (features.namespacing && options.namespacing) {
        setNamespacing(false);
    }
};
XRegExp.union = (patterns, flags, options) => {
    options = options || {};
    const conjunction = options.conjunction || 'or';
    let numCaptures = 0;
    let numPriorCaptures;
    let captureNames;
    function rewrite(match, paren, backref) {
        const name = captureNames[numCaptures - numPriorCaptures];
        if (paren) {
            ++numCaptures;
            if (name) {
                return `(?<${name}>`;
            }
        } else if (backref) {
            return `\\${+backref + numPriorCaptures}`;
        }
        return match;
    }
    if (!(isType(patterns, 'Array') && patterns.length)) {
        throw new TypeError('Must provide a nonempty array of patterns to merge');
    }
    const parts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*\]/g;
    const output = [];
    for (const pattern of patterns) {
        if (XRegExp.isRegExp(pattern)) {
            numPriorCaptures = numCaptures;
            captureNames = (pattern[REGEX_DATA] && pattern[REGEX_DATA].captureNames) || [];
            output.push(XRegExp(pattern.source).source.replace(parts, rewrite));
        } else {
            output.push(XRegExp.escape(pattern));
        }
    }
    const separator = conjunction === 'none' ? '' : '|';
    return XRegExp(output.join(separator), flags);
};
fixed.exec = function(str) {
    const origLastIndex = this.lastIndex;
    const match = RegExp.prototype.exec.apply(this, arguments);
    if (match) {
        if (!correctExecNpcg && match.length > 1 && match.includes('')) {
            const r2 = copyRegex(this, {
                removeG: true,
                isInternalOnly: true
            });
            String(str).slice(match.index).replace(r2, (...args) => {
                const len = args.length;
                for (let i = 1; i < len - 2; ++i) {
                    if (args[i] === undefined) {
                        match[i] = undefined;
                    }
                }
            });
        }
        if (this[REGEX_DATA] && this[REGEX_DATA].captureNames) {
            let groupsObject = match;
            if (XRegExp.isInstalled('namespacing')) {
                match.groups = Object.create(null);
                groupsObject = match.groups;
            }
            for (let i = 1; i < match.length; ++i) {
                const name = this[REGEX_DATA].captureNames[i - 1];
                if (name) {
                    groupsObject[name] = match[i];
                }
            }
        } else if (!match.groups && XRegExp.isInstalled('namespacing')) {
            match.groups = undefined;
        }
        if (this.global && !match[0].length && (this.lastIndex > match.index)) {
            this.lastIndex = match.index;
        }
    }
    if (!this.global) {
        this.lastIndex = origLastIndex;
    }
    return match;
};
fixed.test = function(str) {
    return !!fixed.exec.call(this, str);
};
fixed.match = function(regex) {
    if (!XRegExp.isRegExp(regex)) {
        regex = new RegExp(regex);
    } else if (regex.global) {
        const result = String.prototype.match.apply(this, arguments);
        regex.lastIndex = 0;
        return result;
    }
    return fixed.exec.call(regex, nullThrows(this));
};
fixed.replace = function(search, replacement) {
    const isRegex = XRegExp.isRegExp(search);
    let origLastIndex;
    let captureNames;
    let result;
    if (isRegex) {
        if (search[REGEX_DATA]) {
            ({captureNames} = search[REGEX_DATA]);
        }
        origLastIndex = search.lastIndex;
    } else {
        search += '';
    }
    if (isType(replacement, 'Function')) {
        result = String(this).replace(search, (...args) => {
            if (captureNames) {
                let groupsObject;
                if (XRegExp.isInstalled('namespacing')) {
                    groupsObject = Object.create(null);
                    args.push(groupsObject);
                } else {
                    args[0] = new String(args[0]);
                    [groupsObject] = args;
                }
                for (let i = 0; i < captureNames.length; ++i) {
                    if (captureNames[i]) {
                        groupsObject[captureNames[i]] = args[i + 1];
                    }
                }
            }
            return replacement(...args);
        });
    } else {
        result = String(nullThrows(this)).replace(search, (...args) => {
            return String(replacement).replace(replacementToken, replacer);
            function replacer($0, bracketed, angled, dollarToken) {
                bracketed = bracketed || angled;
                const numNonCaptureArgs = isType(args[args.length - 1], 'Object') ? 4 : 3;
                const numCaptures = args.length - numNonCaptureArgs;
                if (bracketed) {
                    if (/^\d+$/.test(bracketed)) {
                        const n = +bracketed;
                        if (n <= numCaptures) {
                            return args[n] || '';
                        }
                    }
                    const n = captureNames ? captureNames.indexOf(bracketed) : -1;
                    if (n < 0) {
                        throw new SyntaxError(`Backreference to undefined group ${$0}`);
                    }
                    return args[n + 1] || '';
                }
                if (dollarToken === '' || dollarToken === ' ') {
                    throw new SyntaxError(`Invalid token ${$0}`);
                }
                if (dollarToken === '&' || +dollarToken === 0) {
                    return args[0];
                }
                if (dollarToken === '$') {
                    return '$';
                }
                if (dollarToken === '`') {
                    return args[args.length - 1].slice(0, args[args.length - 2]);
                }
                if (dollarToken === "'") {
                    return args[args.length - 1].slice(args[args.length - 2] + args[0].length);
                }
                dollarToken = +dollarToken;
                if (!isNaN(dollarToken)) {
                    if (dollarToken > numCaptures) {
                        throw new SyntaxError(`Backreference to undefined group ${$0}`);
                    }
                    return args[dollarToken] || '';
                }
                throw new SyntaxError(`Invalid token ${$0}`);
            }
        });
    }
    if (isRegex) {
        if (search.global) {
            search.lastIndex = 0;
        } else {
            search.lastIndex = origLastIndex;
        }
    }
    return result;
};
fixed.split = function(separator, limit) {
    if (!XRegExp.isRegExp(separator)) {
        return String.prototype.split.apply(this, arguments);
    }
    const str = String(this);
    const output = [];
    const origLastIndex = separator.lastIndex;
    let lastLastIndex = 0;
    let lastLength;
    limit = (limit === undefined ? -1 : limit) >>> 0;
    XRegExp.forEach(str, separator, (match) => {
        if ((match.index + match[0].length) > lastLastIndex) {
            output.push(str.slice(lastLastIndex, match.index));
            if (match.length > 1 && match.index < str.length) {
                Array.prototype.push.apply(output, match.slice(1));
            }
            lastLength = match[0].length;
            lastLastIndex = match.index + lastLength;
        }
    });
    if (lastLastIndex === str.length) {
        if (!separator.test('') || lastLength) {
            output.push('');
        }
    } else {
        output.push(str.slice(lastLastIndex));
    }
    separator.lastIndex = origLastIndex;
    return output.length > limit ? output.slice(0, limit) : output;
};
XRegExp.addToken(
    /\\([ABCE-RTUVXYZaeg-mopqyz]|c(?![A-Za-z])|u(?![\dA-Fa-f]{4}|{[\dA-Fa-f]+})|x(?![\dA-Fa-f]{2}))/,
    (match, scope) => {
        if (match[1] === 'B' && scope === defaultScope) {
            return match[0];
        }
        throw new SyntaxError(`Invalid escape ${match[0]}`);
    },
    {
        scope: 'all',
        leadChar: '\\'
    }
);
XRegExp.addToken(
    /\\u{([\dA-Fa-f]+)}/,
    (match, scope, flags) => {
        const code = dec(match[1]);
        if (code > 0x10FFFF) {
            throw new SyntaxError(`Invalid Unicode code point ${match[0]}`);
        }
        if (code <= 0xFFFF) {
            return `\\u${pad4(hex(code))}`;
        }
        if (hasNativeU && flags.includes('u')) {
            return match[0];
        }
        throw new SyntaxError('Cannot use Unicode code point above \\u{FFFF} without flag u');
    },
    {
        scope: 'all',
        leadChar: '\\'
    }
);
XRegExp.addToken(
    /\(\?#[^)]*\)/,
    getContextualTokenSeparator,
    {leadChar: '('}
);
XRegExp.addToken(
    /\s+|#[^\n]*\n?/,
    getContextualTokenSeparator,
    {flag: 'x'}
);
if (!hasNativeS) {
    XRegExp.addToken(
        /\./,
        () => '[\\s\\S]',
        {
            flag: 's',
            leadChar: '.'
        }
    );
}
XRegExp.addToken(
    /\\k<([^>]+)>/,
    function(match) {
        const index = isNaN(match[1]) ? (this.captureNames.indexOf(match[1]) + 1) : +match[1];
        const endIndex = match.index + match[0].length;
        if (!index || index > this.captureNames.length) {
            throw new SyntaxError(`Backreference to undefined group ${match[0]}`);
        }
        return `\\${index}${
            endIndex === match.input.length || isNaN(match.input[endIndex]) ?
                '' : '(?:)'
        }`;
    },
    {leadChar: '\\'}
);
XRegExp.addToken(
    /\\(\d+)/,
    function(match, scope) {
        if (
            !(
                scope === defaultScope &&
                /^[1-9]/.test(match[1]) &&
                +match[1] <= this.captureNames.length
            ) &&
            match[1] !== '0'
        ) {
            throw new SyntaxError(`Cannot use octal escape or backreference to undefined group ${match[0]}`);
        }
        return match[0];
    },
    {
        scope: 'all',
        leadChar: '\\'
    }
);
XRegExp.addToken(
    /\(\?P?<([\p{ID_Start}$_][\p{ID_Continue}$_\u200C\u200D]*)>/u,
    function(match) {
        if (!XRegExp.isInstalled('namespacing') && (match[1] === 'length' || match[1] === '__proto__')) {
            throw new SyntaxError(`Cannot use reserved word as capture name ${match[0]}`);
        }
        if (this.captureNames.includes(match[1])) {
            throw new SyntaxError(`Cannot use same name for multiple groups ${match[0]}`);
        }
        this.captureNames.push(match[1]);
        this.hasNamedCapture = true;
        return '(';
    },
    {leadChar: '('}
);
XRegExp.addToken(
    /\((?!\?)/,
    function(match, scope, flags) {
        if (flags.includes('n')) {
            return '(?:';
        }
        this.captureNames.push(null);
        return '(';
    },
    {
        optionalFlags: 'n',
        leadChar: '('
    }
);

var build = (XRegExp) => {
    const REGEX_DATA = 'xregexp';
    const subParts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*\]/g;
    const parts = XRegExp.union([/\({{([\w$]+)}}\)|{{([\w$]+)}}/, subParts], 'g', {
        conjunction: 'or'
    });
    function deanchor(pattern) {
        const leadingAnchor = /^(?:\(\?:\))*\^/;
        const trailingAnchor = /\$(?:\(\?:\))*$/;
        if (
            leadingAnchor.test(pattern) &&
            trailingAnchor.test(pattern) &&
            trailingAnchor.test(pattern.replace(/\\[\s\S]/g, ''))
        ) {
            return pattern.replace(leadingAnchor, '').replace(trailingAnchor, '');
        }
        return pattern;
    }
    function asXRegExp(value, addFlagX) {
        const flags = addFlagX ? 'x' : '';
        return XRegExp.isRegExp(value) ?
            (value[REGEX_DATA] && value[REGEX_DATA].captureNames ?
                value :
                XRegExp(value.source, flags)
            ) :
            XRegExp(value, flags);
    }
    function interpolate(substitution) {
        return substitution instanceof RegExp ? substitution : XRegExp.escape(substitution);
    }
    function reduceToSubpatternsObject(subpatterns, interpolated, subpatternIndex) {
        subpatterns[`subpattern${subpatternIndex}`] = interpolated;
        return subpatterns;
    }
    function embedSubpatternAfter(raw, subpatternIndex, rawLiterals) {
        const hasSubpattern = subpatternIndex < rawLiterals.length - 1;
        return raw + (hasSubpattern ? `{{subpattern${subpatternIndex}}}` : '');
    }
    XRegExp.tag = (flags) => (literals, ...substitutions) => {
        const subpatterns = substitutions.map(interpolate).reduce(reduceToSubpatternsObject, {});
        const pattern = literals.raw.map(embedSubpatternAfter).join('');
        return XRegExp.build(pattern, subpatterns, flags);
    };
    XRegExp.build = (pattern, subs, flags) => {
        flags = flags || '';
        const addFlagX = flags.includes('x');
        const inlineFlags = /^\(\?([\w$]+)\)/.exec(pattern);
        if (inlineFlags) {
            flags = XRegExp._clipDuplicates(flags + inlineFlags[1]);
        }
        const data = {};
        for (const p in subs) {
            if (subs.hasOwnProperty(p)) {
                const sub = asXRegExp(subs[p], addFlagX);
                data[p] = {
                    pattern: deanchor(sub.source),
                    names: sub[REGEX_DATA].captureNames || []
                };
            }
        }
        const patternAsRegex = asXRegExp(pattern, addFlagX);
        let numCaps = 0;
        let numPriorCaps;
        let numOuterCaps = 0;
        const outerCapsMap = [0];
        const outerCapNames = patternAsRegex[REGEX_DATA].captureNames || [];
        const output = patternAsRegex.source.replace(parts, ($0, $1, $2, $3, $4) => {
            const subName = $1 || $2;
            let capName;
            let intro;
            let localCapIndex;
            if (subName) {
                if (!data.hasOwnProperty(subName)) {
                    throw new ReferenceError(`Undefined property ${$0}`);
                }
                if ($1) {
                    capName = outerCapNames[numOuterCaps];
                    outerCapsMap[++numOuterCaps] = ++numCaps;
                    intro = `(?<${capName || subName}>`;
                } else {
                    intro = '(?:';
                }
                numPriorCaps = numCaps;
                const rewrittenSubpattern = data[subName].pattern.replace(subParts, (match, paren, backref) => {
                    if (paren) {
                        capName = data[subName].names[numCaps - numPriorCaps];
                        ++numCaps;
                        if (capName) {
                            return `(?<${capName}>`;
                        }
                    } else if (backref) {
                        localCapIndex = +backref - 1;
                        return data[subName].names[localCapIndex] ?
                            `\\k<${data[subName].names[localCapIndex]}>` :
                            `\\${+backref + numPriorCaps}`;
                    }
                    return match;
                });
                return `${intro}${rewrittenSubpattern})`;
            }
            if ($3) {
                capName = outerCapNames[numOuterCaps];
                outerCapsMap[++numOuterCaps] = ++numCaps;
                if (capName) {
                    return `(?<${capName}>`;
                }
            } else if ($4) {
                localCapIndex = +$4 - 1;
                return outerCapNames[localCapIndex] ?
                    `\\k<${outerCapNames[localCapIndex]}>` :
                    `\\${outerCapsMap[+$4]}`;
            }
            return $0;
        });
        return XRegExp(output, flags);
    };
};

var matchRecursive = (XRegExp) => {
    function row(name, value, start, end) {
        return {
            name,
            value,
            start,
            end
        };
    }
    XRegExp.matchRecursive = (str, left, right, flags, options) => {
        flags = flags || '';
        options = options || {};
        const global = flags.includes('g');
        const sticky = flags.includes('y');
        const basicFlags = flags.replace(/y/g, '');
        left = XRegExp(left, basicFlags);
        right = XRegExp(right, basicFlags);
        let esc;
        let {escapeChar} = options;
        if (escapeChar) {
            if (escapeChar.length > 1) {
                throw new Error('Cannot use more than one escape character');
            }
            escapeChar = XRegExp.escape(escapeChar);
            esc = new RegExp(
                `(?:${escapeChar}[\\S\\s]|(?:(?!${
                    XRegExp.union([left, right], '', {conjunction: 'or'}).source
                })[^${escapeChar}])+)+`,
                flags.replace(XRegExp._hasNativeFlag('s') ? /[^imsu]/g : /[^imu]/g, '')
            );
        }
        let openTokens = 0;
        let delimStart = 0;
        let delimEnd = 0;
        let lastOuterEnd = 0;
        let outerStart;
        let innerStart;
        let leftMatch;
        let rightMatch;
        const vN = options.valueNames;
        const output = [];
        while (true) {
            if (escapeChar) {
                delimEnd += (XRegExp.exec(str, esc, delimEnd, 'sticky') || [''])[0].length;
            }
            leftMatch = XRegExp.exec(str, left, delimEnd);
            rightMatch = XRegExp.exec(str, right, delimEnd);
            if (leftMatch && rightMatch) {
                if (leftMatch.index <= rightMatch.index) {
                    rightMatch = null;
                } else {
                    leftMatch = null;
                }
            }
            if (leftMatch || rightMatch) {
                delimStart = (leftMatch || rightMatch).index;
                delimEnd = delimStart + (leftMatch || rightMatch)[0].length;
            } else if (!openTokens) {
                break;
            }
            if (sticky && !openTokens && delimStart > lastOuterEnd) {
                break;
            }
            if (leftMatch) {
                if (!openTokens) {
                    outerStart = delimStart;
                    innerStart = delimEnd;
                }
                openTokens += 1;
            } else if (rightMatch && openTokens) {
                openTokens -= 1;
                if (!openTokens) {
                    if (vN) {
                        if (vN[0] && outerStart > lastOuterEnd) {
                            output.push(row(vN[0], str.slice(lastOuterEnd, outerStart), lastOuterEnd, outerStart));
                        }
                        if (vN[1]) {
                            output.push(row(vN[1], str.slice(outerStart, innerStart), outerStart, innerStart));
                        }
                        if (vN[2]) {
                            output.push(row(vN[2], str.slice(innerStart, delimStart), innerStart, delimStart));
                        }
                        if (vN[3]) {
                            output.push(row(vN[3], str.slice(delimStart, delimEnd), delimStart, delimEnd));
                        }
                    } else {
                        output.push(str.slice(innerStart, delimStart));
                    }
                    lastOuterEnd = delimEnd;
                    if (!global) {
                        break;
                    }
                }
            } else {
                const unbalanced = options.unbalanced || 'error';
                if (unbalanced === 'skip' || unbalanced === 'skip-lazy') {
                    if (rightMatch) {
                        rightMatch = null;
                    } else {
                        if (unbalanced === 'skip') {
                            const outerStartDelimLength = XRegExp.exec(str, left, outerStart, 'sticky')[0].length;
                            delimEnd = outerStart + (outerStartDelimLength || 1);
                        } else {
                            delimEnd = outerStart + 1;
                        }
                        openTokens = 0;
                    }
                } else if (unbalanced === 'error') {
                    const delimSide = rightMatch ? 'right' : 'left';
                    const errorPos = rightMatch ? delimStart : outerStart;
                    throw new Error(`Unbalanced ${delimSide} delimiter found in string at position ${errorPos}`);
                } else {
                    throw new Error(`Unsupported value for unbalanced: ${unbalanced}`);
                }
            }
            if (delimStart === delimEnd) {
                delimEnd += 1;
            }
        }
        if (global && output.length > 0 && !sticky && vN && vN[0] && str.length > lastOuterEnd) {
            output.push(row(vN[0], str.slice(lastOuterEnd), lastOuterEnd, str.length));
        }
        return output;
    };
};

var unicodeBase = (XRegExp) => {
    const unicode = {};
    const unicodeTypes = {};
    const dec = XRegExp._dec;
    const hex = XRegExp._hex;
    const pad4 = XRegExp._pad4;
    function normalize(name) {
        return name.replace(/[- _]+/g, '').toLowerCase();
    }
    function charCode(chr) {
        const esc = /^\\[xu](.+)/.exec(chr);
        return esc ?
            dec(esc[1]) :
            chr.charCodeAt(chr[0] === '\\' ? 1 : 0);
    }
    function invertBmp(range) {
        let output = '';
        let lastEnd = -1;
        XRegExp.forEach(
            range,
            /(\\x..|\\u....|\\?[\s\S])(?:-(\\x..|\\u....|\\?[\s\S]))?/,
            (m) => {
                const start = charCode(m[1]);
                if (start > (lastEnd + 1)) {
                    output += `\\u${pad4(hex(lastEnd + 1))}`;
                    if (start > (lastEnd + 2)) {
                        output += `-\\u${pad4(hex(start - 1))}`;
                    }
                }
                lastEnd = charCode(m[2] || m[1]);
            }
        );
        if (lastEnd < 0xFFFF) {
            output += `\\u${pad4(hex(lastEnd + 1))}`;
            if (lastEnd < 0xFFFE) {
                output += '-\\uFFFF';
            }
        }
        return output;
    }
    function cacheInvertedBmp(slug) {
        const prop = 'b!';
        return (
            unicode[slug][prop] ||
            (unicode[slug][prop] = invertBmp(unicode[slug].bmp))
        );
    }
    function buildAstral(slug, isNegated) {
        const item = unicode[slug];
        let combined = '';
        if (item.bmp && !item.isBmpLast) {
            combined = `[${item.bmp}]${item.astral ? '|' : ''}`;
        }
        if (item.astral) {
            combined += item.astral;
        }
        if (item.isBmpLast && item.bmp) {
            combined += `${item.astral ? '|' : ''}[${item.bmp}]`;
        }
        return isNegated ?
            `(?:(?!${combined})(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[\0-\uFFFF]))` :
            `(?:${combined})`;
    }
    function cacheAstral(slug, isNegated) {
        const prop = isNegated ? 'a!' : 'a=';
        return (
            unicode[slug][prop] ||
            (unicode[slug][prop] = buildAstral(slug, isNegated))
        );
    }
    XRegExp.addToken(
        /\\([pP])(?:{(\^?)(?:(\w+)=)?([^}]*)}|([A-Za-z]))/,
        (match, scope, flags) => {
            const ERR_DOUBLE_NEG = 'Invalid double negation ';
            const ERR_UNKNOWN_NAME = 'Unknown Unicode token ';
            const ERR_UNKNOWN_REF = 'Unicode token missing data ';
            const ERR_ASTRAL_ONLY = 'Astral mode required for Unicode token ';
            const ERR_ASTRAL_IN_CLASS = 'Astral mode does not support Unicode tokens within character classes';
            const [
                fullToken,
                pPrefix,
                caretNegation,
                typePrefix,
                tokenName,
                tokenSingleCharName
            ] = match;
            let isNegated = pPrefix === 'P' || !!caretNegation;
            const isAstralMode = flags.includes('A');
            let slug = normalize(tokenSingleCharName || tokenName);
            let item = unicode[slug];
            if (pPrefix === 'P' && caretNegation) {
                throw new SyntaxError(ERR_DOUBLE_NEG + fullToken);
            }
            if (!unicode.hasOwnProperty(slug)) {
                throw new SyntaxError(ERR_UNKNOWN_NAME + fullToken);
            }
            if (typePrefix) {
                if (!(unicodeTypes[typePrefix] && unicodeTypes[typePrefix][slug])) {
                    throw new SyntaxError(ERR_UNKNOWN_NAME + fullToken);
                }
            }
            if (item.inverseOf) {
                slug = normalize(item.inverseOf);
                if (!unicode.hasOwnProperty(slug)) {
                    throw new ReferenceError(`${ERR_UNKNOWN_REF + fullToken} -> ${item.inverseOf}`);
                }
                item = unicode[slug];
                isNegated = !isNegated;
            }
            if (!(item.bmp || isAstralMode)) {
                throw new SyntaxError(ERR_ASTRAL_ONLY + fullToken);
            }
            if (isAstralMode) {
                if (scope === 'class') {
                    throw new SyntaxError(ERR_ASTRAL_IN_CLASS);
                }
                return cacheAstral(slug, isNegated);
            }
            return scope === 'class' ?
                (isNegated ? cacheInvertedBmp(slug) : item.bmp) :
                `${(isNegated ? '[^' : '[') + item.bmp}]`;
        },
        {
            scope: 'all',
            optionalFlags: 'A',
            leadChar: '\\'
        }
    );
    XRegExp.addUnicodeData = (data, typePrefix) => {
        const ERR_NO_NAME = 'Unicode token requires name';
        const ERR_NO_DATA = 'Unicode token has no character data ';
        if (typePrefix) {
            unicodeTypes[typePrefix] = {};
        }
        for (const item of data) {
            if (!item.name) {
                throw new Error(ERR_NO_NAME);
            }
            if (!(item.inverseOf || item.bmp || item.astral)) {
                throw new Error(ERR_NO_DATA + item.name);
            }
            const normalizedName = normalize(item.name);
            unicode[normalizedName] = item;
            if (typePrefix) {
                unicodeTypes[typePrefix][normalizedName] = true;
            }
            if (item.alias) {
                const normalizedAlias = normalize(item.alias);
                unicode[normalizedAlias] = item;
                if (typePrefix) {
                    unicodeTypes[typePrefix][normalizedAlias] = true;
                }
            }
        }
        XRegExp.cache.flush('patterns');
    };
    XRegExp._getUnicodeProperty = (name) => {
        const slug = normalize(name);
        return unicode[slug];
    };
};

var categories = [
    {
        'name': 'C',
        'alias': 'Other',
        'isBmpLast': true,
        'bmp': '\0-\x1F\x7F-\x9F\xAD\u0378\u0379\u0380-\u0383\u038B\u038D\u03A2\u0530\u0557\u0558\u058B\u058C\u0590\u05C8-\u05CF\u05EB-\u05EE\u05F5-\u0605\u061C\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB\u07FC\u082E\u082F\u083F\u085C\u085D\u085F\u086B-\u086F\u088F-\u0897\u08E2\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A77-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0BFF\u0C0D\u0C11\u0C29\u0C3A\u0C3B\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C64\u0C65\u0C70-\u0C76\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDC\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D50-\u0D53\u0D64\u0D65\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F6\u13F7\u13FE\u13FF\u169D-\u169F\u16F9-\u16FF\u1716-\u171E\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180E\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE\u1AAF\u1ACF-\u1AFF\u1B4D-\u1B4F\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C89-\u1C8F\u1CBB\u1CBC\u1CC8-\u1CCF\u1CFB-\u1CFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20C1-\u20CF\u20F1-\u20FF\u218C-\u218F\u2427-\u243F\u244B-\u245F\u2B74\u2B75\u2B96\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E5E-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u3130\u318F\u31E4-\u31EF\u321F\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA6F8-\uA6FF\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA82D-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C6-\uA8CD\uA8DA-\uA8DF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB6C-\uAB6F\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC3-\uFBD2\uFD90\uFD91\uFDC8-\uFDCE\uFDD0-\uFDEF\uFE1A-\uFE1F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF',
        'astral': '\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDCFF\uDD03-\uDD06\uDD34-\uDD36\uDD8F\uDD9D-\uDD9F\uDDA1-\uDDCF\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEFC-\uDEFF\uDF24-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDFC4-\uDFC7\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6E\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56\uDC9F-\uDCA6\uDCB0-\uDCDF\uDCF3\uDCF6-\uDCFA\uDD1C-\uDD1E\uDD3A-\uDD3E\uDD40-\uDD7F\uDDB8-\uDDBB\uDDD0\uDDD1\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE49-\uDE4F\uDE59-\uDE5F\uDEA0-\uDEBF\uDEE7-\uDEEA\uDEF7-\uDEFF\uDF36-\uDF38\uDF56\uDF57\uDF73-\uDF77\uDF92-\uDF98\uDF9D-\uDFA8\uDFB0-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCF9\uDD28-\uDD2F\uDD3A-\uDE5F\uDE7F\uDEAA\uDEAE\uDEAF\uDEB2-\uDEFF\uDF28-\uDF2F\uDF5A-\uDF6F\uDF8A-\uDFAF\uDFCC-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC4E-\uDC51\uDC76-\uDC7E\uDCBD\uDCC3-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD48-\uDD4F\uDD77-\uDD7F\uDDE0\uDDF5-\uDDFF\uDE12\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEAA-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC5C\uDC62-\uDC7F\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDDE-\uDDFF\uDE45-\uDE4F\uDE5A-\uDE5F\uDE6D-\uDE7F\uDEBA-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF47-\uDFFF]|\uD806[\uDC3C-\uDC9F\uDCF3-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD47-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE5-\uDDFF\uDE48-\uDE4F\uDEA3-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC46-\uDC4F\uDC6D-\uDC6F\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF9-\uDFAF\uDFB1-\uDFBF\uDFF2-\uDFFE]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F\uDC75-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD832\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF3-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDE6D\uDEBF\uDECA-\uDECF\uDEEE\uDEEF\uDEF6-\uDEFF\uDF46-\uDF4F\uDF5A\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE9B-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A\uDC9B\uDCA0-\uDFFF]|\uD833[\uDC00-\uDEFF\uDF2E\uDF2F\uDF47-\uDF4F\uDFC4-\uDFFF]|\uD834[\uDCF6-\uDCFF\uDD27\uDD28\uDD73-\uDD7A\uDDEB-\uDDFF\uDE46-\uDEDF\uDEF4-\uDEFF\uDF57-\uDF5F\uDF79-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]|\uD836[\uDE8C-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD50-\uDE8F\uDEAF-\uDEBF\uDEFA-\uDEFE\uDF00-\uDFFF]|\uD839[\uDC00-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5\uDCC6\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDD5D\uDD60-\uDFFF]|\uD83B[\uDC00-\uDC70\uDCB5-\uDD00\uDD3E-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDEEF\uDEF2-\uDFFF]|\uD83C[\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCD0\uDCF6-\uDCFF\uDDAE-\uDDE5\uDE03-\uDE0F\uDE3C-\uDE3F\uDE49-\uDE4F\uDE52-\uDE5F\uDE66-\uDEFF]|\uD83D[\uDED8-\uDEDC\uDEED-\uDEEF\uDEFD-\uDEFF\uDF74-\uDF7F\uDFD9-\uDFDF\uDFEC-\uDFEF\uDFF1-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCB2-\uDCFF\uDE54-\uDE5F\uDE6E\uDE6F\uDE75-\uDE77\uDE7D-\uDE7F\uDE87-\uDE8F\uDEAD-\uDEAF\uDEBB-\uDEBF\uDEC6-\uDECF\uDEDA-\uDEDF\uDEE8-\uDEEF\uDEF7-\uDEFF\uDF93\uDFCB-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF39-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]'
    },
    {
        'name': 'Cc',
        'alias': 'Control',
        'bmp': '\0-\x1F\x7F-\x9F'
    },
    {
        'name': 'Cf',
        'alias': 'Format',
        'bmp': '\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB',
        'astral': '\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC38]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]'
    },
    {
        'name': 'Cn',
        'alias': 'Unassigned',
        'bmp': '\u0378\u0379\u0380-\u0383\u038B\u038D\u03A2\u0530\u0557\u0558\u058B\u058C\u0590\u05C8-\u05CF\u05EB-\u05EE\u05F5-\u05FF\u070E\u074B\u074C\u07B2-\u07BF\u07FB\u07FC\u082E\u082F\u083F\u085C\u085D\u085F\u086B-\u086F\u088F\u0892-\u0897\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A77-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0BFF\u0C0D\u0C11\u0C29\u0C3A\u0C3B\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C64\u0C65\u0C70-\u0C76\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDC\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D50-\u0D53\u0D64\u0D65\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F6\u13F7\u13FE\u13FF\u169D-\u169F\u16F9-\u16FF\u1716-\u171E\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE\u1AAF\u1ACF-\u1AFF\u1B4D-\u1B4F\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C89-\u1C8F\u1CBB\u1CBC\u1CC8-\u1CCF\u1CFB-\u1CFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u2065\u2072\u2073\u208F\u209D-\u209F\u20C1-\u20CF\u20F1-\u20FF\u218C-\u218F\u2427-\u243F\u244B-\u245F\u2B74\u2B75\u2B96\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E5E-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u3130\u318F\u31E4-\u31EF\u321F\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA6F8-\uA6FF\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA82D-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C6-\uA8CD\uA8DA-\uA8DF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB6C-\uAB6F\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC3-\uFBD2\uFD90\uFD91\uFDC8-\uFDCE\uFDD0-\uFDEF\uFE1A-\uFE1F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD\uFEFE\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFF8\uFFFE\uFFFF',
        'astral': '\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDCFF\uDD03-\uDD06\uDD34-\uDD36\uDD8F\uDD9D-\uDD9F\uDDA1-\uDDCF\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEFC-\uDEFF\uDF24-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDFC4-\uDFC7\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6E\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56\uDC9F-\uDCA6\uDCB0-\uDCDF\uDCF3\uDCF6-\uDCFA\uDD1C-\uDD1E\uDD3A-\uDD3E\uDD40-\uDD7F\uDDB8-\uDDBB\uDDD0\uDDD1\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE49-\uDE4F\uDE59-\uDE5F\uDEA0-\uDEBF\uDEE7-\uDEEA\uDEF7-\uDEFF\uDF36-\uDF38\uDF56\uDF57\uDF73-\uDF77\uDF92-\uDF98\uDF9D-\uDFA8\uDFB0-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCF9\uDD28-\uDD2F\uDD3A-\uDE5F\uDE7F\uDEAA\uDEAE\uDEAF\uDEB2-\uDEFF\uDF28-\uDF2F\uDF5A-\uDF6F\uDF8A-\uDFAF\uDFCC-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC4E-\uDC51\uDC76-\uDC7E\uDCC3-\uDCCC\uDCCE\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD48-\uDD4F\uDD77-\uDD7F\uDDE0\uDDF5-\uDDFF\uDE12\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEAA-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC5C\uDC62-\uDC7F\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDDE-\uDDFF\uDE45-\uDE4F\uDE5A-\uDE5F\uDE6D-\uDE7F\uDEBA-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF47-\uDFFF]|\uD806[\uDC3C-\uDC9F\uDCF3-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD47-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE5-\uDDFF\uDE48-\uDE4F\uDEA3-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC46-\uDC4F\uDC6D-\uDC6F\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF9-\uDFAF\uDFB1-\uDFBF\uDFF2-\uDFFE]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F\uDC75-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD832\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDB7F][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF3-\uDFFF]|\uD80D[\uDC2F\uDC39-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDE6D\uDEBF\uDECA-\uDECF\uDEEE\uDEEF\uDEF6-\uDEFF\uDF46-\uDF4F\uDF5A\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE9B-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A\uDC9B\uDCA4-\uDFFF]|\uD833[\uDC00-\uDEFF\uDF2E\uDF2F\uDF47-\uDF4F\uDFC4-\uDFFF]|\uD834[\uDCF6-\uDCFF\uDD27\uDD28\uDDEB-\uDDFF\uDE46-\uDEDF\uDEF4-\uDEFF\uDF57-\uDF5F\uDF79-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]|\uD836[\uDE8C-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD50-\uDE8F\uDEAF-\uDEBF\uDEFA-\uDEFE\uDF00-\uDFFF]|\uD839[\uDC00-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5\uDCC6\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDD5D\uDD60-\uDFFF]|\uD83B[\uDC00-\uDC70\uDCB5-\uDD00\uDD3E-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDEEF\uDEF2-\uDFFF]|\uD83C[\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCD0\uDCF6-\uDCFF\uDDAE-\uDDE5\uDE03-\uDE0F\uDE3C-\uDE3F\uDE49-\uDE4F\uDE52-\uDE5F\uDE66-\uDEFF]|\uD83D[\uDED8-\uDEDC\uDEED-\uDEEF\uDEFD-\uDEFF\uDF74-\uDF7F\uDFD9-\uDFDF\uDFEC-\uDFEF\uDFF1-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCB2-\uDCFF\uDE54-\uDE5F\uDE6E\uDE6F\uDE75-\uDE77\uDE7D-\uDE7F\uDE87-\uDE8F\uDEAD-\uDEAF\uDEBB-\uDEBF\uDEC6-\uDECF\uDEDA-\uDEDF\uDEE8-\uDEEF\uDEF7-\uDEFF\uDF93\uDFCB-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF39-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00\uDC02-\uDC1F\uDC80-\uDCFF\uDDF0-\uDFFF]|[\uDBBF\uDBFF][\uDFFE\uDFFF]'
    },
    {
        'name': 'Co',
        'alias': 'Private_Use',
        'bmp': '\uE000-\uF8FF',
        'astral': '[\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uDBBF\uDBFF][\uDC00-\uDFFD]'
    },
    {
        'name': 'Cs',
        'alias': 'Surrogate',
        'bmp': '\uD800-\uDFFF'
    },
    {
        'name': 'L',
        'alias': 'Letter',
        'bmp': 'A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC',
        'astral': '\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]'
    },
    {
        'name': 'LC',
        'alias': 'Cased_Letter',
        'bmp': 'A-Za-z\xB5\xC0-\xD6\xD8-\xF6\xF8-\u01BA\u01BC-\u01BF\u01C4-\u0293\u0295-\u02AF\u0370-\u0373\u0376\u0377\u037B-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0560-\u0588\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FD-\u10FF\u13A0-\u13F5\u13F8-\u13FD\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2134\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C7B\u2C7E-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA640-\uA66D\uA680-\uA69B\uA722-\uA76F\uA771-\uA787\uA78B-\uA78E\uA790-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F5\uA7F6\uA7FA\uAB30-\uAB5A\uAB60-\uAB68\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A\uFF41-\uFF5A',
        'astral': '\uD801[\uDC00-\uDC4F\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC]|\uD803[\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD806[\uDCA0-\uDCDF]|\uD81B[\uDE40-\uDE7F]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF09\uDF0B-\uDF1E]|\uD83A[\uDD00-\uDD43]'
    },
    {
        'name': 'Ll',
        'alias': 'Lowercase_Letter',
        'bmp': 'a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0560-\u0588\u10D0-\u10FA\u10FD-\u10FF\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5F\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7AF\uA7B5\uA7B7\uA7B9\uA7BB\uA7BD\uA7BF\uA7C1\uA7C3\uA7C8\uA7CA\uA7D1\uA7D3\uA7D5\uA7D7\uA7D9\uA7F6\uA7FA\uAB30-\uAB5A\uAB60-\uAB68\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A',
        'astral': '\uD801[\uDC28-\uDC4F\uDCD8-\uDCFB\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC]|\uD803[\uDCC0-\uDCF2]|\uD806[\uDCC0-\uDCDF]|\uD81B[\uDE60-\uDE7F]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD837[\uDF00-\uDF09\uDF0B-\uDF1E]|\uD83A[\uDD22-\uDD43]'
    },
    {
        'name': 'Lm',
        'alias': 'Modifier_Letter',
        'bmp': '\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5\u06E6\u07F4\u07F5\u07FA\u081A\u0824\u0828\u08C9\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA69C\uA69D\uA717-\uA71F\uA770\uA788\uA7F2-\uA7F4\uA7F8\uA7F9\uA9CF\uA9E6\uAA70\uAADD\uAAF3\uAAF4\uAB5C-\uAB5F\uAB69\uFF70\uFF9E\uFF9F',
        'astral': '\uD801[\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD81A[\uDF40-\uDF43]|\uD81B[\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD838[\uDD37-\uDD3D]|\uD83A\uDD4B'
    },
    {
        'name': 'Lo',
        'alias': 'Other_Letter',
        'bmp': '\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05EF-\u05F2\u0620-\u063F\u0641-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C8\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E45\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1100-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A\uA62B\uA66E\uA6A0-\uA6E5\uA78F\uA7F7\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC',
        'astral': '\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC50-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF4A\uDF50]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD837\uDF0A|\uD838[\uDD00-\uDD2C\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]'
    },
    {
        'name': 'Lt',
        'alias': 'Titlecase_Letter',
        'bmp': '\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC'
    },
    {
        'name': 'Lu',
        'alias': 'Uppercase_Letter',
        'bmp': 'A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1C90-\u1CBA\u1CBD-\u1CBF\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2F\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uA7B8\uA7BA\uA7BC\uA7BE\uA7C0\uA7C2\uA7C4-\uA7C7\uA7C9\uA7D0\uA7D6\uA7D8\uA7F5\uFF21-\uFF3A',
        'astral': '\uD801[\uDC00-\uDC27\uDCB0-\uDCD3\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95]|\uD803[\uDC80-\uDCB2]|\uD806[\uDCA0-\uDCBF]|\uD81B[\uDE40-\uDE5F]|\uD835[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA]|\uD83A[\uDD00-\uDD21]'
    },
    {
        'name': 'M',
        'alias': 'Mark',
        'bmp': '\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F',
        'astral': '\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF]'
    },
    {
        'name': 'Mc',
        'alias': 'Spacing_Mark',
        'bmp': '\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E\u094F\u0982\u0983\u09BE-\u09C0\u09C7\u09C8\u09CB\u09CC\u09D7\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB\u0ACC\u0B02\u0B03\u0B3E\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0B57\u0BBE\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD7\u0C01-\u0C03\u0C41-\u0C44\u0C82\u0C83\u0CBE\u0CC0-\u0CC4\u0CC7\u0CC8\u0CCA\u0CCB\u0CD5\u0CD6\u0D02\u0D03\u0D3E-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D57\u0D82\u0D83\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DF2\u0DF3\u0F3E\u0F3F\u0F7F\u102B\u102C\u1031\u1038\u103B\u103C\u1056\u1057\u1062-\u1064\u1067-\u106D\u1083\u1084\u1087-\u108C\u108F\u109A-\u109C\u1715\u1734\u17B6\u17BE-\u17C5\u17C7\u17C8\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1A19\u1A1A\u1A55\u1A57\u1A61\u1A63\u1A64\u1A6D-\u1A72\u1B04\u1B35\u1B3B\u1B3D-\u1B41\u1B43\u1B44\u1B82\u1BA1\u1BA6\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1C24-\u1C2B\u1C34\u1C35\u1CE1\u1CF7\u302E\u302F\uA823\uA824\uA827\uA880\uA881\uA8B4-\uA8C3\uA952\uA953\uA983\uA9B4\uA9B5\uA9BA\uA9BB\uA9BE-\uA9C0\uAA2F\uAA30\uAA33\uAA34\uAA4D\uAA7B\uAA7D\uAAEB\uAAEE\uAAEF\uAAF5\uABE3\uABE4\uABE6\uABE7\uABE9\uABEA\uABEC',
        'astral': '\uD804[\uDC00\uDC02\uDC82\uDCB0-\uDCB2\uDCB7\uDCB8\uDD2C\uDD45\uDD46\uDD82\uDDB3-\uDDB5\uDDBF\uDDC0\uDDCE\uDE2C-\uDE2E\uDE32\uDE33\uDE35\uDEE0-\uDEE2\uDF02\uDF03\uDF3E\uDF3F\uDF41-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63]|\uD805[\uDC35-\uDC37\uDC40\uDC41\uDC45\uDCB0-\uDCB2\uDCB9\uDCBB-\uDCBE\uDCC1\uDDAF-\uDDB1\uDDB8-\uDDBB\uDDBE\uDE30-\uDE32\uDE3B\uDE3C\uDE3E\uDEAC\uDEAE\uDEAF\uDEB6\uDF20\uDF21\uDF26]|\uD806[\uDC2C-\uDC2E\uDC38\uDD30-\uDD35\uDD37\uDD38\uDD3D\uDD40\uDD42\uDDD1-\uDDD3\uDDDC-\uDDDF\uDDE4\uDE39\uDE57\uDE58\uDE97]|\uD807[\uDC2F\uDC3E\uDCA9\uDCB1\uDCB4\uDD8A-\uDD8E\uDD93\uDD94\uDD96\uDEF5\uDEF6]|\uD81B[\uDF51-\uDF87\uDFF0\uDFF1]|\uD834[\uDD65\uDD66\uDD6D-\uDD72]'
    },
    {
        'name': 'Me',
        'alias': 'Enclosing_Mark',
        'bmp': '\u0488\u0489\u1ABE\u20DD-\u20E0\u20E2-\u20E4\uA670-\uA672'
    },
    {
        'name': 'Mn',
        'alias': 'Nonspacing_Mark',
        'bmp': '\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F',
        'astral': '\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF40\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB3-\uDCB8\uDCBA\uDCBF\uDCC0\uDCC2\uDCC3\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF]'
    },
    {
        'name': 'N',
        'alias': 'Number',
        'bmp': '0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19',
        'astral': '\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]'
    },
    {
        'name': 'Nd',
        'alias': 'Decimal_Number',
        'bmp': '0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19',
        'astral': '\uD801[\uDCA0-\uDCA9]|\uD803[\uDD30-\uDD39]|\uD804[\uDC66-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF39]|\uD806[\uDCE0-\uDCE9\uDD50-\uDD59]|\uD807[\uDC50-\uDC59\uDD50-\uDD59\uDDA0-\uDDA9]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD83A[\uDD50-\uDD59]|\uD83E[\uDFF0-\uDFF9]'
    },
    {
        'name': 'Nl',
        'alias': 'Letter_Number',
        'bmp': '\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF',
        'astral': '\uD800[\uDD40-\uDD74\uDF41\uDF4A\uDFD1-\uDFD5]|\uD809[\uDC00-\uDC6E]'
    },
    {
        'name': 'No',
        'alias': 'Other_Number',
        'bmp': '\xB2\xB3\xB9\xBC-\xBE\u09F4-\u09F9\u0B72-\u0B77\u0BF0-\u0BF2\u0C78-\u0C7E\u0D58-\u0D5E\u0D70-\u0D78\u0F2A-\u0F33\u1369-\u137C\u17F0-\u17F9\u19DA\u2070\u2074-\u2079\u2080-\u2089\u2150-\u215F\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA830-\uA835',
        'astral': '\uD800[\uDD07-\uDD33\uDD75-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC65\uDDE1-\uDDF4]|\uD805[\uDF3A\uDF3B]|\uD806[\uDCEA-\uDCF2]|\uD807[\uDC5A-\uDC6C\uDFC0-\uDFD4]|\uD81A[\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD83A[\uDCC7-\uDCCF]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]'
    },
    {
        'name': 'P',
        'alias': 'Punctuation',
        'bmp': '!-#%-\\*,-\\/:;\\?@\\[-\\]_\\{\\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65',
        'astral': '\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]'
    },
    {
        'name': 'Pc',
        'alias': 'Connector_Punctuation',
        'bmp': '_\u203F\u2040\u2054\uFE33\uFE34\uFE4D-\uFE4F\uFF3F'
    },
    {
        'name': 'Pd',
        'alias': 'Dash_Punctuation',
        'bmp': '\\-\u058A\u05BE\u1400\u1806\u2010-\u2015\u2E17\u2E1A\u2E3A\u2E3B\u2E40\u2E5D\u301C\u3030\u30A0\uFE31\uFE32\uFE58\uFE63\uFF0D',
        'astral': '\uD803\uDEAD'
    },
    {
        'name': 'Pe',
        'alias': 'Close_Punctuation',
        'bmp': '\\)\\]\\}\u0F3B\u0F3D\u169C\u2046\u207E\u208E\u2309\u230B\u232A\u2769\u276B\u276D\u276F\u2771\u2773\u2775\u27C6\u27E7\u27E9\u27EB\u27ED\u27EF\u2984\u2986\u2988\u298A\u298C\u298E\u2990\u2992\u2994\u2996\u2998\u29D9\u29DB\u29FD\u2E23\u2E25\u2E27\u2E29\u2E56\u2E58\u2E5A\u2E5C\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u301E\u301F\uFD3E\uFE18\uFE36\uFE38\uFE3A\uFE3C\uFE3E\uFE40\uFE42\uFE44\uFE48\uFE5A\uFE5C\uFE5E\uFF09\uFF3D\uFF5D\uFF60\uFF63'
    },
    {
        'name': 'Pf',
        'alias': 'Final_Punctuation',
        'bmp': '\xBB\u2019\u201D\u203A\u2E03\u2E05\u2E0A\u2E0D\u2E1D\u2E21'
    },
    {
        'name': 'Pi',
        'alias': 'Initial_Punctuation',
        'bmp': '\xAB\u2018\u201B\u201C\u201F\u2039\u2E02\u2E04\u2E09\u2E0C\u2E1C\u2E20'
    },
    {
        'name': 'Po',
        'alias': 'Other_Punctuation',
        'bmp': '!-#%-\'\\*,\\.\\/:;\\?@\\\xA1\xA7\xB6\xB7\xBF\u037E\u0387\u055A-\u055F\u0589\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u166E\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u1805\u1807-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2016\u2017\u2020-\u2027\u2030-\u2038\u203B-\u203E\u2041-\u2043\u2047-\u2051\u2053\u2055-\u205E\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00\u2E01\u2E06-\u2E08\u2E0B\u2E0E-\u2E16\u2E18\u2E19\u2E1B\u2E1E\u2E1F\u2E2A-\u2E2E\u2E30-\u2E39\u2E3C-\u2E3F\u2E41\u2E43-\u2E4F\u2E52-\u2E54\u3001-\u3003\u303D\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFE10-\uFE16\uFE19\uFE30\uFE45\uFE46\uFE49-\uFE4C\uFE50-\uFE52\uFE54-\uFE57\uFE5F-\uFE61\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF07\uFF0A\uFF0C\uFF0E\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3C\uFF61\uFF64\uFF65',
        'astral': '\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]'
    },
    {
        'name': 'Ps',
        'alias': 'Open_Punctuation',
        'bmp': '\\(\\[\\{\u0F3A\u0F3C\u169B\u201A\u201E\u2045\u207D\u208D\u2308\u230A\u2329\u2768\u276A\u276C\u276E\u2770\u2772\u2774\u27C5\u27E6\u27E8\u27EA\u27EC\u27EE\u2983\u2985\u2987\u2989\u298B\u298D\u298F\u2991\u2993\u2995\u2997\u29D8\u29DA\u29FC\u2E22\u2E24\u2E26\u2E28\u2E42\u2E55\u2E57\u2E59\u2E5B\u3008\u300A\u300C\u300E\u3010\u3014\u3016\u3018\u301A\u301D\uFD3F\uFE17\uFE35\uFE37\uFE39\uFE3B\uFE3D\uFE3F\uFE41\uFE43\uFE47\uFE59\uFE5B\uFE5D\uFF08\uFF3B\uFF5B\uFF5F\uFF62'
    },
    {
        'name': 'S',
        'alias': 'Symbol',
        'bmp': '\\$\\+<->\\^`\\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD',
        'astral': '\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDD-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC5\uDED0-\uDED9\uDEE0-\uDEE7\uDEF0-\uDEF6\uDF00-\uDF92\uDF94-\uDFCA]'
    },
    {
        'name': 'Sc',
        'alias': 'Currency_Symbol',
        'bmp': '\\$\xA2-\xA5\u058F\u060B\u07FE\u07FF\u09F2\u09F3\u09FB\u0AF1\u0BF9\u0E3F\u17DB\u20A0-\u20C0\uA838\uFDFC\uFE69\uFF04\uFFE0\uFFE1\uFFE5\uFFE6',
        'astral': '\uD807[\uDFDD-\uDFE0]|\uD838\uDEFF|\uD83B\uDCB0'
    },
    {
        'name': 'Sk',
        'alias': 'Modifier_Symbol',
        'bmp': '\\^`\xA8\xAF\xB4\xB8\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u0888\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u309B\u309C\uA700-\uA716\uA720\uA721\uA789\uA78A\uAB5B\uAB6A\uAB6B\uFBB2-\uFBC2\uFF3E\uFF40\uFFE3',
        'astral': '\uD83C[\uDFFB-\uDFFF]'
    },
    {
        'name': 'Sm',
        'alias': 'Math_Symbol',
        'bmp': '\\+<->\\|~\xAC\xB1\xD7\xF7\u03F6\u0606-\u0608\u2044\u2052\u207A-\u207C\u208A-\u208C\u2118\u2140-\u2144\u214B\u2190-\u2194\u219A\u219B\u21A0\u21A3\u21A6\u21AE\u21CE\u21CF\u21D2\u21D4\u21F4-\u22FF\u2320\u2321\u237C\u239B-\u23B3\u23DC-\u23E1\u25B7\u25C1\u25F8-\u25FF\u266F\u27C0-\u27C4\u27C7-\u27E5\u27F0-\u27FF\u2900-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2AFF\u2B30-\u2B44\u2B47-\u2B4C\uFB29\uFE62\uFE64-\uFE66\uFF0B\uFF1C-\uFF1E\uFF5C\uFF5E\uFFE2\uFFE9-\uFFEC',
        'astral': '\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD83B[\uDEF0\uDEF1]'
    },
    {
        'name': 'So',
        'alias': 'Other_Symbol',
        'bmp': '\xA6\xA9\xAE\xB0\u0482\u058D\u058E\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u09FA\u0B70\u0BF3-\u0BF8\u0BFA\u0C7F\u0D4F\u0D79\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116\u2117\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u214A\u214C\u214D\u214F\u218A\u218B\u2195-\u2199\u219C-\u219F\u21A1\u21A2\u21A4\u21A5\u21A7-\u21AD\u21AF-\u21CD\u21D0\u21D1\u21D3\u21D5-\u21F3\u2300-\u2307\u230C-\u231F\u2322-\u2328\u232B-\u237B\u237D-\u239A\u23B4-\u23DB\u23E2-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u25B6\u25B8-\u25C0\u25C2-\u25F7\u2600-\u266E\u2670-\u2767\u2794-\u27BF\u2800-\u28FF\u2B00-\u2B2F\u2B45\u2B46\u2B4D-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA828-\uA82B\uA836\uA837\uA839\uAA77-\uAA79\uFD40-\uFD4F\uFDCF\uFDFD-\uFDFF\uFFE4\uFFE8\uFFED\uFFEE\uFFFC\uFFFD',
        'astral': '\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFDC\uDFE1-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838\uDD4F|\uD83B[\uDCAC\uDD2E]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFA]|\uD83D[\uDC00-\uDED7\uDEDD-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC5\uDED0-\uDED9\uDEE0-\uDEE7\uDEF0-\uDEF6\uDF00-\uDF92\uDF94-\uDFCA]'
    },
    {
        'name': 'Z',
        'alias': 'Separator',
        'bmp': ' \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000'
    },
    {
        'name': 'Zl',
        'alias': 'Line_Separator',
        'bmp': '\u2028'
    },
    {
        'name': 'Zp',
        'alias': 'Paragraph_Separator',
        'bmp': '\u2029'
    },
    {
        'name': 'Zs',
        'alias': 'Space_Separator',
        'bmp': ' \xA0\u1680\u2000-\u200A\u202F\u205F\u3000'
    }
];

var categories$1 = /*@__PURE__*/getDefaultExportFromCjs$1(categories);

var unicodeCategories = (XRegExp) => {
    if (!XRegExp.addUnicodeData) {
        throw new ReferenceError('Unicode Base must be loaded before Unicode Categories');
    }
    XRegExp.addUnicodeData(categories$1);
};

var properties = [
    {
        'name': 'ASCII',
        'bmp': '\0-\x7F'
    },
    {
        'name': 'Alphabetic',
        'bmp': 'A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0345\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05B0-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0657\u0659-\u065F\u066E-\u06D3\u06D5-\u06DC\u06E1-\u06E8\u06ED-\u06EF\u06FA-\u06FC\u06FF\u0710-\u073F\u074D-\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0817\u081A-\u082C\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u08D4-\u08DF\u08E3-\u08E9\u08F0-\u093B\u093D-\u094C\u094E-\u0950\u0955-\u0963\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C4\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09F0\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B\u0A4C\u0A51\u0A59-\u0A5C\u0A5E\u0A70-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC5\u0AC7-\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0-\u0AE3\u0AF9-\u0AFC\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D-\u0B44\u0B47\u0B48\u0B4B\u0B4C\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4C\u0C55\u0C56\u0C58-\u0C5A\u0C5D\u0C60-\u0C63\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCC\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0-\u0CE3\u0CF1\u0CF2\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E46\u0E4D\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0ECD\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F71-\u0F81\u0F88-\u0F97\u0F99-\u0FBC\u1000-\u1036\u1038\u103B-\u103F\u1050-\u108F\u109A-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1713\u171F-\u1733\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17B3\u17B6-\u17C8\u17D7\u17DC\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u1938\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A1B\u1A20-\u1A5E\u1A61-\u1A74\u1AA7\u1ABF\u1AC0\u1ACC-\u1ACE\u1B00-\u1B33\u1B35-\u1B43\u1B45-\u1B4C\u1B80-\u1BA9\u1BAC-\u1BAF\u1BBA-\u1BE5\u1BE7-\u1BF1\u1C00-\u1C36\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1DE7-\u1DF4\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u24B6-\u24E9\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA674-\uA67B\uA67F-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA805\uA807-\uA827\uA840-\uA873\uA880-\uA8C3\uA8C5\uA8F2-\uA8F7\uA8FB\uA8FD-\uA8FF\uA90A-\uA92A\uA930-\uA952\uA960-\uA97C\uA980-\uA9B2\uA9B4-\uA9BF\uA9CF\uA9E0-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA60-\uAA76\uAA7A-\uAABE\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF5\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC',
        'astral': '\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDE80-\uDEA9\uDEAB\uDEAC\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC45\uDC71-\uDC75\uDC82-\uDCB8\uDCC2\uDCD0-\uDCE8\uDD00-\uDD32\uDD44-\uDD47\uDD50-\uDD72\uDD76\uDD80-\uDDBF\uDDC1-\uDDC4\uDDCE\uDDCF\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE34\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEE8\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D-\uDF44\uDF47\uDF48\uDF4B\uDF4C\uDF50\uDF57\uDF5D-\uDF63]|\uD805[\uDC00-\uDC41\uDC43-\uDC45\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCC1\uDCC4\uDCC5\uDCC7\uDD80-\uDDB5\uDDB8-\uDDBE\uDDD8-\uDDDD\uDE00-\uDE3E\uDE40\uDE44\uDE80-\uDEB5\uDEB8\uDF00-\uDF1A\uDF1D-\uDF2A\uDF40-\uDF46]|\uD806[\uDC00-\uDC38\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B\uDD3C\uDD3F-\uDD42\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDDF\uDDE1\uDDE3\uDDE4\uDE00-\uDE32\uDE35-\uDE3E\uDE50-\uDE97\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC3E\uDC40\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD41\uDD43\uDD46\uDD47\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD96\uDD98\uDEE0-\uDEF6\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF0\uDFF1]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9E]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD47\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD30-\uDD49\uDD50-\uDD69\uDD70-\uDD89]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]'
    },
    {
        'name': 'Any',
        'isBmpLast': true,
        'bmp': '\0-\uFFFF',
        'astral': '[\uD800-\uDBFF][\uDC00-\uDFFF]'
    },
    {
        'name': 'Default_Ignorable_Code_Point',
        'bmp': '\xAD\u034F\u061C\u115F\u1160\u17B4\u17B5\u180B-\u180F\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8',
        'astral': '\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|[\uDB40-\uDB43][\uDC00-\uDFFF]'
    },
    {
        'name': 'Lowercase',
        'bmp': 'a-z\xAA\xB5\xBA\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02B8\u02C0\u02C1\u02E0-\u02E4\u0345\u0371\u0373\u0377\u037A-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0560-\u0588\u10D0-\u10FA\u10FD-\u10FF\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1DBF\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u2071\u207F\u2090-\u209C\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2170-\u217F\u2184\u24D0-\u24E9\u2C30-\u2C5F\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7D\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B-\uA69D\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7AF\uA7B5\uA7B7\uA7B9\uA7BB\uA7BD\uA7BF\uA7C1\uA7C3\uA7C8\uA7CA\uA7D1\uA7D3\uA7D5\uA7D7\uA7D9\uA7F6\uA7F8-\uA7FA\uAB30-\uAB5A\uAB5C-\uAB68\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A',
        'astral': '\uD801[\uDC28-\uDC4F\uDCD8-\uDCFB\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDF80\uDF83-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD803[\uDCC0-\uDCF2]|\uD806[\uDCC0-\uDCDF]|\uD81B[\uDE60-\uDE7F]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD837[\uDF00-\uDF09\uDF0B-\uDF1E]|\uD83A[\uDD22-\uDD43]'
    },
    {
        'name': 'Noncharacter_Code_Point',
        'bmp': '\uFDD0-\uFDEF\uFFFE\uFFFF',
        'astral': '[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]'
    },
    {
        'name': 'Uppercase',
        'bmp': 'A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1C90-\u1CBA\u1CBD-\u1CBF\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2160-\u216F\u2183\u24B6-\u24CF\u2C00-\u2C2F\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uA7B8\uA7BA\uA7BC\uA7BE\uA7C0\uA7C2\uA7C4-\uA7C7\uA7C9\uA7D0\uA7D6\uA7D8\uA7F5\uFF21-\uFF3A',
        'astral': '\uD801[\uDC00-\uDC27\uDCB0-\uDCD3\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95]|\uD803[\uDC80-\uDCB2]|\uD806[\uDCA0-\uDCBF]|\uD81B[\uDE40-\uDE5F]|\uD835[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA]|\uD83A[\uDD00-\uDD21]|\uD83C[\uDD30-\uDD49\uDD50-\uDD69\uDD70-\uDD89]'
    },
    {
        'name': 'White_Space',
        'bmp': '\t-\r \x85\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000'
    }
];

var properties$1 = /*@__PURE__*/getDefaultExportFromCjs$1(properties);

var unicodeProperties = (XRegExp) => {
    if (!XRegExp.addUnicodeData) {
        throw new ReferenceError('Unicode Base must be loaded before Unicode Properties');
    }
    const unicodeData = properties$1;
    unicodeData.push({
        name: 'Assigned',
        inverseOf: 'Cn'
    });
    XRegExp.addUnicodeData(unicodeData);
};

var scripts = [
    {
        'name': 'Adlam',
        'astral': '\uD83A[\uDD00-\uDD4B\uDD50-\uDD59\uDD5E\uDD5F]'
    },
    {
        'name': 'Ahom',
        'astral': '\uD805[\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF46]'
    },
    {
        'name': 'Anatolian_Hieroglyphs',
        'astral': '\uD811[\uDC00-\uDE46]'
    },
    {
        'name': 'Arabic',
        'bmp': '\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u06FF\u0750-\u077F\u0870-\u088E\u0890\u0891\u0898-\u08E1\u08E3-\u08FF\uFB50-\uFBC2\uFBD3-\uFD3D\uFD40-\uFD8F\uFD92-\uFDC7\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC',
        'astral': '\uD803[\uDE60-\uDE7E]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]'
    },
    {
        'name': 'Armenian',
        'bmp': '\u0531-\u0556\u0559-\u058A\u058D-\u058F\uFB13-\uFB17'
    },
    {
        'name': 'Avestan',
        'astral': '\uD802[\uDF00-\uDF35\uDF39-\uDF3F]'
    },
    {
        'name': 'Balinese',
        'bmp': '\u1B00-\u1B4C\u1B50-\u1B7E'
    },
    {
        'name': 'Bamum',
        'bmp': '\uA6A0-\uA6F7',
        'astral': '\uD81A[\uDC00-\uDE38]'
    },
    {
        'name': 'Bassa_Vah',
        'astral': '\uD81A[\uDED0-\uDEED\uDEF0-\uDEF5]'
    },
    {
        'name': 'Batak',
        'bmp': '\u1BC0-\u1BF3\u1BFC-\u1BFF'
    },
    {
        'name': 'Bengali',
        'bmp': '\u0980-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09FE'
    },
    {
        'name': 'Bhaiksuki',
        'astral': '\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC45\uDC50-\uDC6C]'
    },
    {
        'name': 'Bopomofo',
        'bmp': '\u02EA\u02EB\u3105-\u312F\u31A0-\u31BF'
    },
    {
        'name': 'Brahmi',
        'astral': '\uD804[\uDC00-\uDC4D\uDC52-\uDC75\uDC7F]'
    },
    {
        'name': 'Braille',
        'bmp': '\u2800-\u28FF'
    },
    {
        'name': 'Buginese',
        'bmp': '\u1A00-\u1A1B\u1A1E\u1A1F'
    },
    {
        'name': 'Buhid',
        'bmp': '\u1740-\u1753'
    },
    {
        'name': 'Canadian_Aboriginal',
        'bmp': '\u1400-\u167F\u18B0-\u18F5',
        'astral': '\uD806[\uDEB0-\uDEBF]'
    },
    {
        'name': 'Carian',
        'astral': '\uD800[\uDEA0-\uDED0]'
    },
    {
        'name': 'Caucasian_Albanian',
        'astral': '\uD801[\uDD30-\uDD63\uDD6F]'
    },
    {
        'name': 'Chakma',
        'astral': '\uD804[\uDD00-\uDD34\uDD36-\uDD47]'
    },
    {
        'name': 'Cham',
        'bmp': '\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA5C-\uAA5F'
    },
    {
        'name': 'Cherokee',
        'bmp': '\u13A0-\u13F5\u13F8-\u13FD\uAB70-\uABBF'
    },
    {
        'name': 'Chorasmian',
        'astral': '\uD803[\uDFB0-\uDFCB]'
    },
    {
        'name': 'Common',
        'bmp': '\0-@\\[-`\\{-\xA9\xAB-\xB9\xBB-\xBF\xD7\xF7\u02B9-\u02DF\u02E5-\u02E9\u02EC-\u02FF\u0374\u037E\u0385\u0387\u0605\u060C\u061B\u061F\u0640\u06DD\u08E2\u0964\u0965\u0E3F\u0FD5-\u0FD8\u10FB\u16EB-\u16ED\u1735\u1736\u1802\u1803\u1805\u1CD3\u1CE1\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5-\u1CF7\u1CFA\u2000-\u200B\u200E-\u2064\u2066-\u2070\u2074-\u207E\u2080-\u208E\u20A0-\u20C0\u2100-\u2125\u2127-\u2129\u212C-\u2131\u2133-\u214D\u214F-\u215F\u2189-\u218B\u2190-\u2426\u2440-\u244A\u2460-\u27FF\u2900-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2E00-\u2E5D\u2FF0-\u2FFB\u3000-\u3004\u3006\u3008-\u3020\u3030-\u3037\u303C-\u303F\u309B\u309C\u30A0\u30FB\u30FC\u3190-\u319F\u31C0-\u31E3\u3220-\u325F\u327F-\u32CF\u32FF\u3358-\u33FF\u4DC0-\u4DFF\uA700-\uA721\uA788-\uA78A\uA830-\uA839\uA92E\uA9CF\uAB5B\uAB6A\uAB6B\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFEFF\uFF01-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFF70\uFF9E\uFF9F\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFF9-\uFFFD',
        'astral': '\uD800[\uDD00-\uDD02\uDD07-\uDD33\uDD37-\uDD3F\uDD90-\uDD9C\uDDD0-\uDDFC\uDEE1-\uDEFB]|\uD82F[\uDCA0-\uDCA3]|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD66\uDD6A-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDEE0-\uDEF3\uDF00-\uDF56\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDFCB\uDFCE-\uDFFF]|\uD83B[\uDC71-\uDCB4\uDD01-\uDD3D]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD00-\uDDAD\uDDE6-\uDDFF\uDE01\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDD-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC5\uDED0-\uDED9\uDEE0-\uDEE7\uDEF0-\uDEF6\uDF00-\uDF92\uDF94-\uDFCA\uDFF0-\uDFF9]|\uDB40[\uDC01\uDC20-\uDC7F]'
    },
    {
        'name': 'Coptic',
        'bmp': '\u03E2-\u03EF\u2C80-\u2CF3\u2CF9-\u2CFF'
    },
    {
        'name': 'Cuneiform',
        'astral': '\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC70-\uDC74\uDC80-\uDD43]'
    },
    {
        'name': 'Cypriot',
        'astral': '\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F]'
    },
    {
        'name': 'Cypro_Minoan',
        'astral': '\uD80B[\uDF90-\uDFF2]'
    },
    {
        'name': 'Cyrillic',
        'bmp': '\u0400-\u0484\u0487-\u052F\u1C80-\u1C88\u1D2B\u1D78\u2DE0-\u2DFF\uA640-\uA69F\uFE2E\uFE2F'
    },
    {
        'name': 'Deseret',
        'astral': '\uD801[\uDC00-\uDC4F]'
    },
    {
        'name': 'Devanagari',
        'bmp': '\u0900-\u0950\u0955-\u0963\u0966-\u097F\uA8E0-\uA8FF'
    },
    {
        'name': 'Dives_Akuru',
        'astral': '\uD806[\uDD00-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B-\uDD46\uDD50-\uDD59]'
    },
    {
        'name': 'Dogra',
        'astral': '\uD806[\uDC00-\uDC3B]'
    },
    {
        'name': 'Duployan',
        'astral': '\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9C-\uDC9F]'
    },
    {
        'name': 'Egyptian_Hieroglyphs',
        'astral': '\uD80C[\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E\uDC30-\uDC38]'
    },
    {
        'name': 'Elbasan',
        'astral': '\uD801[\uDD00-\uDD27]'
    },
    {
        'name': 'Elymaic',
        'astral': '\uD803[\uDFE0-\uDFF6]'
    },
    {
        'name': 'Ethiopic',
        'bmp': '\u1200-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u137C\u1380-\u1399\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E',
        'astral': '\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]'
    },
    {
        'name': 'Georgian',
        'bmp': '\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u10FF\u1C90-\u1CBA\u1CBD-\u1CBF\u2D00-\u2D25\u2D27\u2D2D'
    },
    {
        'name': 'Glagolitic',
        'bmp': '\u2C00-\u2C5F',
        'astral': '\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]'
    },
    {
        'name': 'Gothic',
        'astral': '\uD800[\uDF30-\uDF4A]'
    },
    {
        'name': 'Grantha',
        'astral': '\uD804[\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]'
    },
    {
        'name': 'Greek',
        'bmp': '\u0370-\u0373\u0375-\u0377\u037A-\u037D\u037F\u0384\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03E1\u03F0-\u03FF\u1D26-\u1D2A\u1D5D-\u1D61\u1D66-\u1D6A\u1DBF\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEF\u1FF2-\u1FF4\u1FF6-\u1FFE\u2126\uAB65',
        'astral': '\uD800[\uDD40-\uDD8E\uDDA0]|\uD834[\uDE00-\uDE45]'
    },
    {
        'name': 'Gujarati',
        'bmp': '\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AF1\u0AF9-\u0AFF'
    },
    {
        'name': 'Gunjala_Gondi',
        'astral': '\uD807[\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9]'
    },
    {
        'name': 'Gurmukhi',
        'bmp': '\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A76'
    },
    {
        'name': 'Han',
        'bmp': '\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u3005\u3007\u3021-\u3029\u3038-\u303B\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFA6D\uFA70-\uFAD9',
        'astral': '\uD81B[\uDFE2\uDFE3\uDFF0\uDFF1]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]'
    },
    {
        'name': 'Hangul',
        'bmp': '\u1100-\u11FF\u302E\u302F\u3131-\u318E\u3200-\u321E\u3260-\u327E\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC'
    },
    {
        'name': 'Hanifi_Rohingya',
        'astral': '\uD803[\uDD00-\uDD27\uDD30-\uDD39]'
    },
    {
        'name': 'Hanunoo',
        'bmp': '\u1720-\u1734'
    },
    {
        'name': 'Hatran',
        'astral': '\uD802[\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDCFF]'
    },
    {
        'name': 'Hebrew',
        'bmp': '\u0591-\u05C7\u05D0-\u05EA\u05EF-\u05F4\uFB1D-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4F'
    },
    {
        'name': 'Hiragana',
        'bmp': '\u3041-\u3096\u309D-\u309F',
        'astral': '\uD82C[\uDC01-\uDD1F\uDD50-\uDD52]|\uD83C\uDE00'
    },
    {
        'name': 'Imperial_Aramaic',
        'astral': '\uD802[\uDC40-\uDC55\uDC57-\uDC5F]'
    },
    {
        'name': 'Inherited',
        'bmp': '\u0300-\u036F\u0485\u0486\u064B-\u0655\u0670\u0951-\u0954\u1AB0-\u1ACE\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u200D\u20D0-\u20F0\u302A-\u302D\u3099\u309A\uFE00-\uFE0F\uFE20-\uFE2D',
        'astral': '\uD800[\uDDFD\uDEE0]|\uD804\uDF3B|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uDB40[\uDD00-\uDDEF]'
    },
    {
        'name': 'Inscriptional_Pahlavi',
        'astral': '\uD802[\uDF60-\uDF72\uDF78-\uDF7F]'
    },
    {
        'name': 'Inscriptional_Parthian',
        'astral': '\uD802[\uDF40-\uDF55\uDF58-\uDF5F]'
    },
    {
        'name': 'Javanese',
        'bmp': '\uA980-\uA9CD\uA9D0-\uA9D9\uA9DE\uA9DF'
    },
    {
        'name': 'Kaithi',
        'astral': '\uD804[\uDC80-\uDCC2\uDCCD]'
    },
    {
        'name': 'Kannada',
        'bmp': '\u0C80-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2'
    },
    {
        'name': 'Katakana',
        'bmp': '\u30A1-\u30FA\u30FD-\u30FF\u31F0-\u31FF\u32D0-\u32FE\u3300-\u3357\uFF66-\uFF6F\uFF71-\uFF9D',
        'astral': '\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00\uDD20-\uDD22\uDD64-\uDD67]'
    },
    {
        'name': 'Kayah_Li',
        'bmp': '\uA900-\uA92D\uA92F'
    },
    {
        'name': 'Kharoshthi',
        'astral': '\uD802[\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F-\uDE48\uDE50-\uDE58]'
    },
    {
        'name': 'Khitan_Small_Script',
        'astral': '\uD81B\uDFE4|\uD822[\uDF00-\uDFFF]|\uD823[\uDC00-\uDCD5]'
    },
    {
        'name': 'Khmer',
        'bmp': '\u1780-\u17DD\u17E0-\u17E9\u17F0-\u17F9\u19E0-\u19FF'
    },
    {
        'name': 'Khojki',
        'astral': '\uD804[\uDE00-\uDE11\uDE13-\uDE3E]'
    },
    {
        'name': 'Khudawadi',
        'astral': '\uD804[\uDEB0-\uDEEA\uDEF0-\uDEF9]'
    },
    {
        'name': 'Lao',
        'bmp': '\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF'
    },
    {
        'name': 'Latin',
        'bmp': 'A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uAB66-\uAB69\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A',
        'astral': '\uD801[\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD837[\uDF00-\uDF1E]'
    },
    {
        'name': 'Lepcha',
        'bmp': '\u1C00-\u1C37\u1C3B-\u1C49\u1C4D-\u1C4F'
    },
    {
        'name': 'Limbu',
        'bmp': '\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1940\u1944-\u194F'
    },
    {
        'name': 'Linear_A',
        'astral': '\uD801[\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]'
    },
    {
        'name': 'Linear_B',
        'astral': '\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA]'
    },
    {
        'name': 'Lisu',
        'bmp': '\uA4D0-\uA4FF',
        'astral': '\uD807\uDFB0'
    },
    {
        'name': 'Lycian',
        'astral': '\uD800[\uDE80-\uDE9C]'
    },
    {
        'name': 'Lydian',
        'astral': '\uD802[\uDD20-\uDD39\uDD3F]'
    },
    {
        'name': 'Mahajani',
        'astral': '\uD804[\uDD50-\uDD76]'
    },
    {
        'name': 'Makasar',
        'astral': '\uD807[\uDEE0-\uDEF8]'
    },
    {
        'name': 'Malayalam',
        'bmp': '\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4F\u0D54-\u0D63\u0D66-\u0D7F'
    },
    {
        'name': 'Mandaic',
        'bmp': '\u0840-\u085B\u085E'
    },
    {
        'name': 'Manichaean',
        'astral': '\uD802[\uDEC0-\uDEE6\uDEEB-\uDEF6]'
    },
    {
        'name': 'Marchen',
        'astral': '\uD807[\uDC70-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]'
    },
    {
        'name': 'Masaram_Gondi',
        'astral': '\uD807[\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]'
    },
    {
        'name': 'Medefaidrin',
        'astral': '\uD81B[\uDE40-\uDE9A]'
    },
    {
        'name': 'Meetei_Mayek',
        'bmp': '\uAAE0-\uAAF6\uABC0-\uABED\uABF0-\uABF9'
    },
    {
        'name': 'Mende_Kikakui',
        'astral': '\uD83A[\uDC00-\uDCC4\uDCC7-\uDCD6]'
    },
    {
        'name': 'Meroitic_Cursive',
        'astral': '\uD802[\uDDA0-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDDFF]'
    },
    {
        'name': 'Meroitic_Hieroglyphs',
        'astral': '\uD802[\uDD80-\uDD9F]'
    },
    {
        'name': 'Miao',
        'astral': '\uD81B[\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F]'
    },
    {
        'name': 'Modi',
        'astral': '\uD805[\uDE00-\uDE44\uDE50-\uDE59]'
    },
    {
        'name': 'Mongolian',
        'bmp': '\u1800\u1801\u1804\u1806-\u1819\u1820-\u1878\u1880-\u18AA',
        'astral': '\uD805[\uDE60-\uDE6C]'
    },
    {
        'name': 'Mro',
        'astral': '\uD81A[\uDE40-\uDE5E\uDE60-\uDE69\uDE6E\uDE6F]'
    },
    {
        'name': 'Multani',
        'astral': '\uD804[\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA9]'
    },
    {
        'name': 'Myanmar',
        'bmp': '\u1000-\u109F\uA9E0-\uA9FE\uAA60-\uAA7F'
    },
    {
        'name': 'Nabataean',
        'astral': '\uD802[\uDC80-\uDC9E\uDCA7-\uDCAF]'
    },
    {
        'name': 'Nandinagari',
        'astral': '\uD806[\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE4]'
    },
    {
        'name': 'New_Tai_Lue',
        'bmp': '\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u19DE\u19DF'
    },
    {
        'name': 'Newa',
        'astral': '\uD805[\uDC00-\uDC5B\uDC5D-\uDC61]'
    },
    {
        'name': 'Nko',
        'bmp': '\u07C0-\u07FA\u07FD-\u07FF'
    },
    {
        'name': 'Nushu',
        'astral': '\uD81B\uDFE1|\uD82C[\uDD70-\uDEFB]'
    },
    {
        'name': 'Nyiakeng_Puachue_Hmong',
        'astral': '\uD838[\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDD4F]'
    },
    {
        'name': 'Ogham',
        'bmp': '\u1680-\u169C'
    },
    {
        'name': 'Ol_Chiki',
        'bmp': '\u1C50-\u1C7F'
    },
    {
        'name': 'Old_Hungarian',
        'astral': '\uD803[\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDCFF]'
    },
    {
        'name': 'Old_Italic',
        'astral': '\uD800[\uDF00-\uDF23\uDF2D-\uDF2F]'
    },
    {
        'name': 'Old_North_Arabian',
        'astral': '\uD802[\uDE80-\uDE9F]'
    },
    {
        'name': 'Old_Permic',
        'astral': '\uD800[\uDF50-\uDF7A]'
    },
    {
        'name': 'Old_Persian',
        'astral': '\uD800[\uDFA0-\uDFC3\uDFC8-\uDFD5]'
    },
    {
        'name': 'Old_Sogdian',
        'astral': '\uD803[\uDF00-\uDF27]'
    },
    {
        'name': 'Old_South_Arabian',
        'astral': '\uD802[\uDE60-\uDE7F]'
    },
    {
        'name': 'Old_Turkic',
        'astral': '\uD803[\uDC00-\uDC48]'
    },
    {
        'name': 'Old_Uyghur',
        'astral': '\uD803[\uDF70-\uDF89]'
    },
    {
        'name': 'Oriya',
        'bmp': '\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B77'
    },
    {
        'name': 'Osage',
        'astral': '\uD801[\uDCB0-\uDCD3\uDCD8-\uDCFB]'
    },
    {
        'name': 'Osmanya',
        'astral': '\uD801[\uDC80-\uDC9D\uDCA0-\uDCA9]'
    },
    {
        'name': 'Pahawh_Hmong',
        'astral': '\uD81A[\uDF00-\uDF45\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]'
    },
    {
        'name': 'Palmyrene',
        'astral': '\uD802[\uDC60-\uDC7F]'
    },
    {
        'name': 'Pau_Cin_Hau',
        'astral': '\uD806[\uDEC0-\uDEF8]'
    },
    {
        'name': 'Phags_Pa',
        'bmp': '\uA840-\uA877'
    },
    {
        'name': 'Phoenician',
        'astral': '\uD802[\uDD00-\uDD1B\uDD1F]'
    },
    {
        'name': 'Psalter_Pahlavi',
        'astral': '\uD802[\uDF80-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]'
    },
    {
        'name': 'Rejang',
        'bmp': '\uA930-\uA953\uA95F'
    },
    {
        'name': 'Runic',
        'bmp': '\u16A0-\u16EA\u16EE-\u16F8'
    },
    {
        'name': 'Samaritan',
        'bmp': '\u0800-\u082D\u0830-\u083E'
    },
    {
        'name': 'Saurashtra',
        'bmp': '\uA880-\uA8C5\uA8CE-\uA8D9'
    },
    {
        'name': 'Sharada',
        'astral': '\uD804[\uDD80-\uDDDF]'
    },
    {
        'name': 'Shavian',
        'astral': '\uD801[\uDC50-\uDC7F]'
    },
    {
        'name': 'Siddham',
        'astral': '\uD805[\uDD80-\uDDB5\uDDB8-\uDDDD]'
    },
    {
        'name': 'SignWriting',
        'astral': '\uD836[\uDC00-\uDE8B\uDE9B-\uDE9F\uDEA1-\uDEAF]'
    },
    {
        'name': 'Sinhala',
        'bmp': '\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4',
        'astral': '\uD804[\uDDE1-\uDDF4]'
    },
    {
        'name': 'Sogdian',
        'astral': '\uD803[\uDF30-\uDF59]'
    },
    {
        'name': 'Sora_Sompeng',
        'astral': '\uD804[\uDCD0-\uDCE8\uDCF0-\uDCF9]'
    },
    {
        'name': 'Soyombo',
        'astral': '\uD806[\uDE50-\uDEA2]'
    },
    {
        'name': 'Sundanese',
        'bmp': '\u1B80-\u1BBF\u1CC0-\u1CC7'
    },
    {
        'name': 'Syloti_Nagri',
        'bmp': '\uA800-\uA82C'
    },
    {
        'name': 'Syriac',
        'bmp': '\u0700-\u070D\u070F-\u074A\u074D-\u074F\u0860-\u086A'
    },
    {
        'name': 'Tagalog',
        'bmp': '\u1700-\u1715\u171F'
    },
    {
        'name': 'Tagbanwa',
        'bmp': '\u1760-\u176C\u176E-\u1770\u1772\u1773'
    },
    {
        'name': 'Tai_Le',
        'bmp': '\u1950-\u196D\u1970-\u1974'
    },
    {
        'name': 'Tai_Tham',
        'bmp': '\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD'
    },
    {
        'name': 'Tai_Viet',
        'bmp': '\uAA80-\uAAC2\uAADB-\uAADF'
    },
    {
        'name': 'Takri',
        'astral': '\uD805[\uDE80-\uDEB9\uDEC0-\uDEC9]'
    },
    {
        'name': 'Tamil',
        'bmp': '\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BFA',
        'astral': '\uD807[\uDFC0-\uDFF1\uDFFF]'
    },
    {
        'name': 'Tangsa',
        'astral': '\uD81A[\uDE70-\uDEBE\uDEC0-\uDEC9]'
    },
    {
        'name': 'Tangut',
        'astral': '\uD81B\uDFE0|[\uD81C-\uD820][\uDC00-\uDFFF]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEFF]|\uD823[\uDD00-\uDD08]'
    },
    {
        'name': 'Telugu',
        'bmp': '\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3C-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C5D\u0C60-\u0C63\u0C66-\u0C6F\u0C77-\u0C7F'
    },
    {
        'name': 'Thaana',
        'bmp': '\u0780-\u07B1'
    },
    {
        'name': 'Thai',
        'bmp': '\u0E01-\u0E3A\u0E40-\u0E5B'
    },
    {
        'name': 'Tibetan',
        'bmp': '\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FD4\u0FD9\u0FDA'
    },
    {
        'name': 'Tifinagh',
        'bmp': '\u2D30-\u2D67\u2D6F\u2D70\u2D7F'
    },
    {
        'name': 'Tirhuta',
        'astral': '\uD805[\uDC80-\uDCC7\uDCD0-\uDCD9]'
    },
    {
        'name': 'Toto',
        'astral': '\uD838[\uDE90-\uDEAE]'
    },
    {
        'name': 'Ugaritic',
        'astral': '\uD800[\uDF80-\uDF9D\uDF9F]'
    },
    {
        'name': 'Vai',
        'bmp': '\uA500-\uA62B'
    },
    {
        'name': 'Vithkuqi',
        'astral': '\uD801[\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC]'
    },
    {
        'name': 'Wancho',
        'astral': '\uD838[\uDEC0-\uDEF9\uDEFF]'
    },
    {
        'name': 'Warang_Citi',
        'astral': '\uD806[\uDCA0-\uDCF2\uDCFF]'
    },
    {
        'name': 'Yezidi',
        'astral': '\uD803[\uDE80-\uDEA9\uDEAB-\uDEAD\uDEB0\uDEB1]'
    },
    {
        'name': 'Yi',
        'bmp': '\uA000-\uA48C\uA490-\uA4C6'
    },
    {
        'name': 'Zanabazar_Square',
        'astral': '\uD806[\uDE00-\uDE47]'
    }
];

var scripts$1 = /*@__PURE__*/getDefaultExportFromCjs$1(scripts);

var unicodeScripts = (XRegExp) => {
    if (!XRegExp.addUnicodeData) {
        throw new ReferenceError('Unicode Base must be loaded before Unicode Scripts');
    }
    XRegExp.addUnicodeData(scripts$1, 'Script');
};

build(XRegExp);
matchRecursive(XRegExp);
unicodeBase(XRegExp);
unicodeCategories(XRegExp);
unicodeProperties(XRegExp);
unicodeScripts(XRegExp);

var toString$1 = Object.prototype.toString;
var kindOf = function kindOf(val) {
  if (val === void 0) return 'undefined';
  if (val === null) return 'null';
  var type = typeof val;
  if (type === 'boolean') return 'boolean';
  if (type === 'string') return 'string';
  if (type === 'number') return 'number';
  if (type === 'symbol') return 'symbol';
  if (type === 'function') {
    return isGeneratorFn(val) ? 'generatorfunction' : 'function';
  }
  if (isArray$2(val)) return 'array';
  if (isBuffer$2(val)) return 'buffer';
  if (isArguments$2(val)) return 'arguments';
  if (isDate(val)) return 'date';
  if (isError(val)) return 'error';
  if (isRegexp(val)) return 'regexp';
  switch (ctorName(val)) {
    case 'Symbol': return 'symbol';
    case 'Promise': return 'promise';
    case 'WeakMap': return 'weakmap';
    case 'WeakSet': return 'weakset';
    case 'Map': return 'map';
    case 'Set': return 'set';
    case 'Int8Array': return 'int8array';
    case 'Uint8Array': return 'uint8array';
    case 'Uint8ClampedArray': return 'uint8clampedarray';
    case 'Int16Array': return 'int16array';
    case 'Uint16Array': return 'uint16array';
    case 'Int32Array': return 'int32array';
    case 'Uint32Array': return 'uint32array';
    case 'Float32Array': return 'float32array';
    case 'Float64Array': return 'float64array';
  }
  if (isGeneratorObj(val)) {
    return 'generator';
  }
  type = toString$1.call(val);
  switch (type) {
    case '[object Object]': return 'object';
    case '[object Map Iterator]': return 'mapiterator';
    case '[object Set Iterator]': return 'setiterator';
    case '[object String Iterator]': return 'stringiterator';
    case '[object Array Iterator]': return 'arrayiterator';
  }
  return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
};
function ctorName(val) {
  return typeof val.constructor === 'function' ? val.constructor.name : null;
}
function isArray$2(val) {
  if (Array.isArray) return Array.isArray(val);
  return val instanceof Array;
}
function isError(val) {
  return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number');
}
function isDate(val) {
  if (val instanceof Date) return true;
  return typeof val.toDateString === 'function'
    && typeof val.getDate === 'function'
    && typeof val.setDate === 'function';
}
function isRegexp(val) {
  if (val instanceof RegExp) return true;
  return typeof val.flags === 'string'
    && typeof val.ignoreCase === 'boolean'
    && typeof val.multiline === 'boolean'
    && typeof val.global === 'boolean';
}
function isGeneratorFn(name, val) {
  return ctorName(name) === 'GeneratorFunction';
}
function isGeneratorObj(val) {
  return typeof val.throw === 'function'
    && typeof val.return === 'function'
    && typeof val.next === 'function';
}
function isArguments$2(val) {
  try {
    if (typeof val.length === 'number' && typeof val.callee === 'function') {
      return true;
    }
  } catch (err) {
    if (err.message.indexOf('callee') !== -1) {
      return true;
    }
  }
  return false;
}
function isBuffer$2(val) {
  if (val.constructor && typeof val.constructor.isBuffer === 'function') {
    return val.constructor.isBuffer(val);
  }
  return false;
}

const valueOf = Symbol.prototype.valueOf;
const typeOf$1 = kindOf;
function clone$2(val, deep) {
  switch (typeOf$1(val)) {
    case 'array':
      return val.slice();
    case 'object':
      return Object.assign({}, val);
    case 'date':
      return new val.constructor(Number(val));
    case 'map':
      return new Map(val);
    case 'set':
      return new Set(val);
    case 'buffer':
      return cloneBuffer$1(val);
    case 'symbol':
      return cloneSymbol(val);
    case 'arraybuffer':
      return cloneArrayBuffer$1(val);
    case 'float32array':
    case 'float64array':
    case 'int16array':
    case 'int32array':
    case 'int8array':
    case 'uint16array':
    case 'uint32array':
    case 'uint8clampedarray':
    case 'uint8array':
      return cloneTypedArray$1(val);
    case 'regexp':
      return cloneRegExp(val);
    case 'error':
      return Object.create(val);
    default: {
      return val;
    }
  }
}
function cloneRegExp(val) {
  const flags = val.flags !== void 0 ? val.flags : (/\w+$/.exec(val) || void 0);
  const re = new val.constructor(val.source, flags);
  re.lastIndex = val.lastIndex;
  return re;
}
function cloneArrayBuffer$1(val) {
  const res = new val.constructor(val.byteLength);
  new Uint8Array(res).set(new Uint8Array(val));
  return res;
}
function cloneTypedArray$1(val, deep) {
  return new val.constructor(val.buffer, val.byteOffset, val.length);
}
function cloneBuffer$1(val) {
  const len = val.length;
  const buf = Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : Buffer.from(len);
  val.copy(buf);
  return buf;
}
function cloneSymbol(val) {
  return valueOf ? Object(valueOf.call(val)) : {};
}
var shallowClone = clone$2;

var isobject = function isObject(val) {
  return val != null && typeof val === 'object' && Array.isArray(val) === false;
};

var isObject$3 = isobject;
function isObjectObject(o) {
  return isObject$3(o) === true
    && Object.prototype.toString.call(o) === '[object Object]';
}
var isPlainObject$2 = function isPlainObject(o) {
  var ctor,prot;
  if (isObjectObject(o) === false) return false;
  ctor = o.constructor;
  if (typeof ctor !== 'function') return false;
  prot = ctor.prototype;
  if (isObjectObject(prot) === false) return false;
  if (prot.hasOwnProperty('isPrototypeOf') === false) {
    return false;
  }
  return true;
};

const clone$1 = shallowClone;
const typeOf = kindOf;
const isPlainObject$1 = isPlainObject$2;
function cloneDeep(val, instanceClone) {
  switch (typeOf(val)) {
    case 'object':
      return cloneObjectDeep(val, instanceClone);
    case 'array':
      return cloneArrayDeep(val, instanceClone);
    default: {
      return clone$1(val);
    }
  }
}
function cloneObjectDeep(val, instanceClone) {
  if (typeof instanceClone === 'function') {
    return instanceClone(val);
  }
  if (instanceClone || isPlainObject$1(val)) {
    const res = new val.constructor();
    for (let key in val) {
      res[key] = cloneDeep(val[key], instanceClone);
    }
    return res;
  }
  return val;
}
function cloneArrayDeep(val, instanceClone) {
  const res = new val.constructor(val.length);
  for (let i = 0; i < val.length; i++) {
    res[i] = cloneDeep(val[i], instanceClone);
  }
  return res;
}
var cloneDeep_1 = cloneDeep;

var cloneDeep$1 = /*@__PURE__*/getDefaultExportFromCjs$1(cloneDeep_1);

var compatibilityTableData$1 = {};

Object.defineProperty(compatibilityTableData$1, '__esModule', { value: true });
var modifiersCompatibilityTableData = {
	shared: [
		{
			shared: [
				{
					name: "all",
					aliases: null,
					description: "$all modifier is made of $document, $popup, and all content-type modifiers combined.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#all-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: true,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "all",
					aliases: null,
					description: "The `all` option is equivalent to specifying all network-based types\n+ `popup`, `document`, `inline-font` and `inline-script`.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#all",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "app",
					aliases: null,
					description: "The `$app` modifier lets you narrow the rule coverage down to a specific application or a list of applications.\nThe modifier's behavior and syntax perfectly match the corresponding basic rules `$app` modifier.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#app-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "pipe_separated_apps"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0
			}
		},
		{
			shared: [
				{
					name: "badfilter",
					aliases: null,
					description: "The rules with the `$badfilter` modifier disable other basic rules to which they refer. It means that\nthe text of the disabled rule should match the text of the `$badfilter` rule (without the `$badfilter` modifier).",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#badfilter-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "badfilter",
					aliases: null,
					description: "The rules with the `$badfilter` modifier disable other basic rules to which they refer. It means that\nthe text of the disabled rule should match the text of the `$badfilter` rule (without the `$badfilter` modifier).",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#badfilter",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "cname",
					aliases: null,
					description: "When used in an exception filter,\nit will bypass blocking CNAME uncloaked requests for the current (specified) document.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#cname",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1024": 0,
				"2048": 0,
				"4096": 0,
				"8192": 0
			}
		},
		{
			shared: [
				{
					name: "content",
					aliases: null,
					description: "Disables HTML filtering and `$replace` rules on the pages that match the rule.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#content-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0
			}
		},
		{
			shared: [
				{
					name: "cookie",
					aliases: null,
					description: "The `$cookie` modifier completely changes rule behavior.\nInstead of blocking a request, this modifier makes us suppress or modify the Cookie and Set-Cookie headers.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#cookie-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "^([^;=\\s]*?)((?:;(maxAge=\\d+;?)?|(sameSite=(lax|none|strict);?)?){1,3})(?<!;)$"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "csp",
					aliases: null,
					description: "This modifier completely changes the rule behavior.\nIf it is applied to a rule, it will not block the matching request.\nThe response headers are going to be modified instead.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#csp-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"important",
						"subdocument",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "csp_value"
				},
				{
					name: "csp",
					aliases: null,
					description: "This modifier completely changes the rule behavior.\nIf it is applied to a rule, it will not block the matching request.\nThe response headers are going to be modified instead.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#csp",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"1p",
						"3p",
						"domain",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "csp_value"
				},
				{
					name: "csp",
					aliases: null,
					description: "This modifier completely changes the rule behavior.\nIf it is applied to a rule, it will not block the matching request.\nThe response headers are going to be modified instead.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#content-security-policies",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"subdocument"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "csp_value"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "denyallow",
					aliases: null,
					description: "The `$denyallow` modifier allows to avoid creating additional rules\nwhen it is needed to disable a certain rule for specific domains.\n`$denyallow` matches only target domains and not referrer domains.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#denyallow-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"to"
					],
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "pipe_separated_denyallow_domains"
				},
				{
					name: "denyallow",
					aliases: null,
					description: "The `$denyallow` modifier allows to avoid creating additional rules\nwhen it is needed to disable a certain rule for specific domains.\n`$denyallow` matches only target domains and not referrer domains.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#denyallow",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"to"
					],
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "pipe_separated_denyallow_domains"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "document",
					aliases: null,
					description: "The rule corresponds to the main frame document requests,\ni.e. HTML documents that are loaded in the browser tab.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#document-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "document",
					aliases: null,
					description: "The rule corresponds to the main frame document requests,\ni.e. HTML documents that are loaded in the browser tab.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#document-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "document",
					aliases: null,
					description: "The rule corresponds to the main frame document requests,\ni.e. HTML documents that are loaded in the browser tab.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#document-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "document",
					aliases: null,
					description: "The rule corresponds to the main frame document requests,\ni.e. HTML documents that are loaded in the browser tab.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#document-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "document",
					aliases: [
						"doc"
					],
					description: "The rule corresponds to the main frame document requests,\ni.e. HTML documents that are loaded in the browser tab.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#document",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "document",
					aliases: null,
					description: "The rule corresponds to the main frame document requests,\ni.e. HTML documents that are loaded in the browser tab.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#allowlist",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"256": 2,
				"512": 3,
				"1024": 4,
				"2048": 4,
				"4096": 4,
				"8192": 4,
				"16384": 5,
				"32768": 5,
				"65536": 5,
				"131072": 5
			}
		},
		{
			shared: [
				{
					name: "domain",
					aliases: [
						"from"
					],
					description: "The `$domain` modifier limits the rule application area to a list of domains and their subdomains.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#domain-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "pipe_separated_domains"
				},
				{
					name: "domain",
					aliases: [
						"from"
					],
					description: "The `$domain` modifier limits the rule application area to a list of domains and their subdomains.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#from",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "pipe_separated_domains"
				},
				{
					name: "domain",
					aliases: null,
					description: "The `$domain` modifier limits the rule application area to a list of domains and their subdomains.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#domain-restrictions",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "pipe_separated_domains"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "elemhide",
					aliases: [
						"ehide"
					],
					description: "Disables any cosmetic rules on the pages matching the rule.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#elemhide-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "elemhide",
					aliases: [
						"ehide"
					],
					description: "Disables any cosmetic rules on the pages matching the rule.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#elemhide-1",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "elemhide",
					aliases: [
						"ehide"
					],
					description: "Disables any cosmetic rules on the pages matching the rule.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "empty",
					aliases: null,
					description: "This modifier is deprecated in favor of the $redirect modifier.\nRules with `$empty` are still supported and being converted into `$redirect=nooptext` now\nbut the support shall be removed in the future.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#empty-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: true,
					deprecationMessage: "Rules with `$empty` are still supported and being converted into `$redirect=nooptext` now\nbut the support shall be removed in the future.",
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "empty",
					aliases: null,
					description: "This modifier is deprecated in favor of the $redirect modifier.\nRules with `$empty` are still supported and being converted into `$redirect=nooptext` now\nbut the support shall be removed in the future.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#empty-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: true,
					deprecationMessage: "Rules with `$empty` are still supported and being converted into `$redirect=nooptext` now\nbut the support shall be removed in the future.",
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "empty",
					aliases: null,
					description: "This modifier is deprecated in favor of the $redirect modifier.\nRules with `$empty` are supported and being converted into `$redirect=nooptext`.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#empty",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"1024": 2,
				"2048": 2,
				"4096": 2,
				"8192": 2
			}
		},
		{
			shared: [
				{
					name: "extension",
					aliases: null,
					description: "Disables all userscripts on the pages matching this rule.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#extension-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"specifichide",
						"generichide",
						"elemhide",
						"genericblock",
						"urlblock",
						"jsinject",
						"content",
						"xmlhttprequest",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0
			}
		},
		{
			shared: [
				{
					name: "first-party",
					aliases: [
						"1p",
						"~third-party"
					],
					description: "A restriction of first-party requests. Equal to `~third-party`.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#third-party-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "first-party",
					aliases: [
						"1p",
						"~third-party"
					],
					description: "A restriction of first-party requests. Equal to `~third-party`.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#1p",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "font",
					aliases: null,
					description: "The rule corresponds to requests for fonts, e.g. `.woff` filename extension.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#font-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "font",
					aliases: null,
					description: "The rule corresponds to requests for fonts, e.g. `.woff` filename extension.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "font",
					aliases: null,
					description: "The rule corresponds to requests for fonts, e.g. `.woff` filename extension.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "genericblock",
					aliases: null,
					description: "Disables generic basic rules on pages that correspond to exception rule.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#genericblock-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"specifichide",
						"generichide",
						"elemhide",
						"extension",
						"jsinject",
						"content",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "genericblock",
					aliases: null,
					description: "Disables generic basic rules on pages that correspond to exception rule.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#genericblock-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"specifichide",
						"generichide",
						"elemhide",
						"jsinject",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "genericblock",
					aliases: null,
					description: "Disables generic basic rules on pages that correspond to exception rule.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#genericblock-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"specifichide",
						"generichide",
						"elemhide",
						"jsinject",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "genericblock",
					aliases: null,
					description: "Disables generic basic rules on pages that correspond to exception rule.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#genericblock-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"specifichide",
						"generichide",
						"elemhide",
						"jsinject",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "genericblock",
					aliases: null,
					description: "Disables generic basic rules on pages that correspond to exception rule.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"256": 2,
				"512": 3,
				"16384": 4,
				"32768": 4,
				"65536": 4,
				"131072": 4
			}
		},
		{
			shared: [
				{
					name: "generichide",
					aliases: [
						"ghide"
					],
					description: "Disables all generic cosmetic rules.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#generichide-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"genericblock",
						"urlblock",
						"extension",
						"jsinject",
						"content",
						"xmlhttprequest",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "generichide",
					aliases: [
						"ghide"
					],
					description: "Disables all generic cosmetic rules.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#generichide",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "generichide",
					aliases: null,
					description: "Disables all generic cosmetic rules.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "header",
					aliases: null,
					description: "The `$header` modifier allows matching the HTTP response\nhaving a specific header with (optionally) a specific value.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#header-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "(?xi)\n  ^\n    # header name\n    [\\w-]+\n    (\n      :\n      # header value: string or regexp\n      (\\w+|\\/.+\\/)\n    )?"
				},
				{
					name: "header",
					aliases: null,
					description: "The `$header` modifier allows matching the HTTP response\nhaving a specific header with (optionally) a specific value.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#header-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "(?xi)\n  ^\n    # header name\n    [\\w-]+\n    (\n      :\n      # header value: string or regexp\n      (\\w+|\\/.+\\/)\n    )?"
				},
				{
					name: "header",
					aliases: null,
					description: "The `$header` modifier allows matching the HTTP response\nhaving a specific header with (optionally) a specific value.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#header",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "(?xi)\n  ^\n    # header name\n    [\\w-]+\n    (\n      :\n      # header value: string or regexp\n      (\\w+|\\/.+\\/)\n    )?"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"1024": 2,
				"2048": 2,
				"4096": 2,
				"8192": 2
			}
		},
		{
			shared: [
				{
					name: "hls",
					aliases: null,
					description: "The `$hls` rules modify the response of a matching request.\nThey are intended as a convenient way to remove segments from HLS playlists (RFC 8216).",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#hls-modifier",
					versionAdded: "CoreLibs 1.10",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"third-party",
						"app",
						"important",
						"match-case",
						"xmlhttprequest"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "(?xi)\n  (\n    # string pattern\n    \\w+\n    # or regexp pattern\n    |\n    # TODO: improve regexp pattern to invalidate unescaped `/`, `$`, and `,`\n    \\/.+\\/\n      # options\n      ([ti]*)?\n  )"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0
			}
		},
		{
			shared: [
				{
					name: "image",
					aliases: null,
					description: "The rule corresponds to images requests.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#image-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "image",
					aliases: null,
					description: "The rule corresponds to images requests.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "image",
					aliases: null,
					description: "The rule corresponds to images requests.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "important",
					aliases: null,
					description: "The `$important` modifier applied to a rule increases its priority\nover any other rule without `$important` modifier. Even over basic exception rules.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#important-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "important",
					aliases: null,
					description: "The `$important` modifier applied to a rule increases its priority\nover any other rule without `$important` modifier. Even over basic exception rules.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#important",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "inline-font",
					aliases: null,
					description: "The `$inline-font` modifier is a sort of a shortcut for $csp modifier with specific value.\nE.g. `||example.org^$inline-font` is converting into:\n```adblock\n||example.org^$csp=font-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:\n```",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#inline-font-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "inline-font",
					aliases: null,
					description: "The `$inline-font` modifier is a sort of a shortcut for $csp modifier with specific value.\nE.g. `||example.org^$inline-font` is converting into:\n```adblock\n||example.org^$csp=font-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:\n```",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#inline-font-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "inline-font",
					aliases: null,
					description: "The `$inline-font` modifier is a sort of a shortcut for $csp modifier with specific value.\nE.g. `||example.org^$inline-font` is converting into:\n```adblock\n||example.org^$csp=font-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:\n```",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#inline-font",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"1024": 2,
				"2048": 2,
				"4096": 2,
				"8192": 2
			}
		},
		{
			shared: [
				{
					name: "inline-script",
					aliases: null,
					description: "The `$inline-script` modifier is a sort of a shortcut for $csp modifier with specific value.\nE.g. `||example.org^$inline-script` is converting into:\n```adblock\n||example.org^$csp=script-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:\n```",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#inline-script-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "inline-script",
					aliases: null,
					description: "The `$inline-script` modifier is a sort of a shortcut for $csp modifier with specific value.\nE.g. `||example.org^$inline-script` is converting into:\n```adblock\n||example.org^$csp=script-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:\n```",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#inline-script-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "inline-script",
					aliases: null,
					description: "The `$inline-script` modifier is a sort of a shortcut for $csp modifier with specific value.\nE.g. `||example.org^$inline-script` is converting into:\n```adblock\n||example.org^$csp=script-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:\n```",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#inline-script",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"1024": 2,
				"2048": 2,
				"4096": 2,
				"8192": 2
			}
		},
		{
			shared: [
				{
					name: "jsinject",
					aliases: null,
					description: "Forbids adding of javascript code to the page.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#jsinject-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"specifichide",
						"generichide",
						"elemhide",
						"genericblock",
						"urlblock",
						"extension",
						"content",
						"xmlhttprequest",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "jsinject",
					aliases: null,
					description: "Forbids adding of javascript code to the page.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#jsinject-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"specifichide",
						"generichide",
						"elemhide",
						"genericblock",
						"urlblock",
						"xmlhttprequest",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "jsinject",
					aliases: null,
					description: "Forbids adding of javascript code to the page.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#jsinject-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"specifichide",
						"generichide",
						"elemhide",
						"genericblock",
						"urlblock",
						"xmlhttprequest",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "jsinject",
					aliases: null,
					description: "Forbids adding of javascript code to the page.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#jsinject-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"specifichide",
						"generichide",
						"elemhide",
						"genericblock",
						"urlblock",
						"xmlhttprequest",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"256": 2,
				"512": 3
			}
		},
		{
			shared: [
				{
					name: "jsonprune",
					aliases: null,
					description: "The `$jsonprune` rules modify the response to a matching request\nby removing JSON items that match a modified JSONPath expression.\nThey do not modify responses which are not valid JSON documents.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#jsonprune-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "(?xi)\n  ^\n    # the expression always starts with a dollar sign (for root)\n    # which should be escaped\n    \\\\\n    \\$\n    \\.?\n    # TODO: improve the expression to invalidate unescaped `$` and `,`\n    .+\n  $"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0
			}
		},
		{
			shared: [
				{
					name: "match-case",
					aliases: null,
					description: "This modifier defines a rule which applies only to addresses that match the case.\nDefault rules are case-insensitive.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#match-case-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "match-case",
					aliases: null,
					description: "This modifier defines a rule which applies only to addresses that match the case.\nDefault rules are case-insensitive.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#match-case",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "match-case",
					aliases: null,
					description: "This modifier defines a rule which applies only to addresses that match the case.\nDefault rules are case-insensitive.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "media",
					aliases: null,
					description: "A restriction of third-party and own requests.\nA third-party request is a request from a different domain.\nFor example, a request to `example.org` from `domain.com` is a third-party request.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#media-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "media",
					aliases: null,
					description: "A restriction of third-party and own requests.\nA third-party request is a request from a different domain.\nFor example, a request to `example.org` from `domain.com` is a third-party request.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "media",
					aliases: null,
					description: "A restriction of third-party and own requests.\nA third-party request is a request from a different domain.\nFor example, a request to `example.org` from `domain.com` is a third-party request.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "method",
					aliases: null,
					description: "This modifier limits the rule scope to requests that use the specified set of HTTP methods.\nNegated methods are allowed.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#method-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "pipe_separated_methods"
				},
				{
					name: "method",
					aliases: null,
					description: "This modifier limits the rule scope to requests that use the specified set of HTTP methods.\nNegated methods are allowed.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#method-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "pipe_separated_methods"
				},
				{
					name: "method",
					aliases: null,
					description: "This modifier limits the rule scope to requests that use the specified set of HTTP methods.\nNegated methods are allowed.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#method",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "pipe_separated_methods"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"1024": 2,
				"2048": 2,
				"4096": 2,
				"8192": 2
			}
		},
		{
			shared: [
				{
					name: "mp4",
					aliases: null,
					description: "As a response to blocked request AdGuard returns a short video placeholder.\nRules with `$mp4` are still supported and being converted into `$redirect=noopmp4-1s` now\nbut the support shall be removed in the future.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#mp4-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: true,
					deprecationMessage: "Rules with `$mp4` are still supported and being converted into `$redirect=noopmp4-1s` now\nbut the support shall be removed in the future.",
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "mp4",
					aliases: null,
					description: "As a response to blocked request AdGuard returns a short video placeholder.\nRules with `$mp4` are still supported and being converted into `$redirect=noopmp4-1s` now\nbut the support shall be removed in the future.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#mp4-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: true,
					deprecationMessage: "Rules with `$mp4` are still supported and being converted into `$redirect=noopmp4-1s` now\nbut the support shall be removed in the future.",
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "mp4",
					aliases: null,
					description: "As a response to blocked request a short video placeholder is returned.\nRules with `$mp4` are supported and being converted into `$redirect=noopmp4-1s`.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#mp4",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"1024": 2,
				"2048": 2,
				"4096": 2,
				"8192": 2
			}
		},
		{
			shared: [
				{
					name: "network",
					aliases: null,
					description: "This is basically a Firewall-kind of rules allowing to fully block\nor unblock access to a specified remote address.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#network-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"app",
						"important"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0
			}
		},
		{
			shared: [
				{
					name: "_",
					aliases: null,
					description: "The noop modifier does nothing and can be used solely to increase rules' readability.\nIt consists of a sequence of underscore characters (_) of any length\nand can appear in a rule as many times as needed.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#noop-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "_",
					aliases: null,
					description: "The noop modifier does nothing and can be used solely to increase rules' readability.\nIt consists of a sequence of underscore characters (_) of any length\nand can appear in a rule as many times as needed.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#noop-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "_",
					aliases: null,
					description: "The noop modifier does nothing and can be used solely to increase rules' readability.\nIt consists of a sequence of underscore characters (_) of any length\nand can appear in a rule as many times as needed.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#noop-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "_",
					aliases: null,
					description: "The noop modifier does nothing and can be used solely to increase rules' readability.\nIt consists of a sequence of underscore characters (_) of any length\nand can appear in a rule as many times as needed.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#noop-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "_",
					aliases: null,
					description: "The noop modifier does nothing and can be used solely to increase rules' readability.\nIt consists of a sequence of underscore characters (_) of any length\nand can appear in a rule as many times as needed.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#_-aka-noop",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"256": 2,
				"512": 3,
				"1024": 4,
				"2048": 4,
				"4096": 4,
				"8192": 4
			}
		},
		{
			shared: [
				{
					name: "object-subrequest",
					aliases: null,
					description: "The `$object-subrequest` modifier is removed and is no longer supported.\nRules with it are considered as invalid.\nThe rule corresponds to requests by browser plugins (it is usually Flash).",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#object-subrequest-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: true,
					removalMessage: "The `$object-subrequest` modifier is removed and is no longer supported.\nRules with it are considered as invalid.",
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0
			}
		},
		{
			shared: [
				{
					name: "object",
					aliases: null,
					description: "The rule corresponds to browser plugins resources, e.g. Java or Flash",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#object-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "object",
					aliases: null,
					description: "The rule corresponds to browser plugins resources, e.g. Java or Flash.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "object",
					aliases: null,
					description: "The rule corresponds to browser plugins resources, e.g. Java or Flash.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "other",
					aliases: null,
					description: "The rule applies to requests for which the type has not been determined\nor does not match the types listed above.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#other-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "other",
					aliases: null,
					description: "The rule applies to requests for which the type has not been determined\nor does not match the types listed above.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "other",
					aliases: null,
					description: "The rule applies to requests for which the type has not been determined\nor does not match the types listed above.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "permissions",
					aliases: null,
					description: "For the requests matching a `$permissions` rule, ad blocker strengthens response's feature policy\nby adding additional feature policy equal to the `$permissions` modifier contents.\n`$permissions` rules are applied independently from any other rule type.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#permissions-modifier",
					versionAdded: "CoreLibs 1.11",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"important",
						"subdocument"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "permissions_value"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0
			}
		},
		{
			shared: [
				{
					name: "ping",
					aliases: null,
					description: "The rule corresponds to requests caused by either navigator.sendBeacon() or the ping attribute on links.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#ping-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "ping",
					aliases: null,
					description: "The rule corresponds to requests caused by either navigator.sendBeacon() or the ping attribute on links.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "ping",
					aliases: null,
					description: "The rule corresponds to requests caused by either navigator.sendBeacon() or the ping attribute on links.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "popunder",
					aliases: null,
					description: "To block \"popunders\" windows/tabs where the original page redirects to an advertisement\nand the desired content loads in the newly created one.\nTo be used in the same manner as the popup filter option, except that it will block popunders.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#popunder",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: true,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1024": 0,
				"2048": 0,
				"4096": 0,
				"8192": 0
			}
		},
		{
			shared: [
				{
					name: "popup",
					aliases: null,
					description: "Pages opened in a new tab or window.\nNote: Filters will not block pop-ups by default, only if the `$popup`  type option is specified.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#popup-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "popup",
					aliases: null,
					description: "Pages opened in a new tab or window.\nNote: Filters will not block pop-ups by default, only if the `$popup`  type option is specified.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "popup",
					aliases: null,
					description: "Pages opened in a new tab or window.\nNote: Filters will not block pop-ups by default, only if the `$popup`  type option is specified.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "redirect-rule",
					aliases: null,
					description: "This is basically an alias to `$redirect`\nsince it has the same \"redirection\" values and the logic is almost similar.\nThe difference is that `$redirect-rule` is applied only in the case\nwhen the target request is blocked by a different basic rule.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#redirect-rule-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"to",
						"third-party",
						"popup",
						"match-case",
						"header",
						"first-party",
						"document",
						"image",
						"stylesheet",
						"script",
						"object",
						"font",
						"media",
						"subdocument",
						"ping",
						"xmlhttprequest",
						"websocket",
						"other",
						"webrtc",
						"important",
						"badfilter",
						"app"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "(?x)\n  ^(\n    1x1-transparent\\.gif|\n    2x2-transparent\\.png|\n    3x2-transparent\\.png|\n    32x32-transparent\\.png|\n    noopframe|\n    noopcss|\n    noopjs|\n    noopjson|\n    nooptext|\n    empty|\n    noopvmap-1\\.0|\n    noopvast-2\\.0|\n    noopvast-3\\.0|\n    noopvast-4\\.0|\n    noopmp3-0\\.1s|\n    noopmp4-1s|\n    amazon-apstag|\n    ati-smarttag|\n    didomi-loader|\n    fingerprintjs2|\n    fingerprintjs3|\n    gemius|\n    google-analytics-ga|\n    google-analytics|\n    google-ima3|\n    googlesyndication-adsbygoogle|\n    googletagservices-gpt|\n    matomo|\n    metrika-yandex-tag|\n    metrika-yandex-watch|\n    naver-wcslog|\n    noeval|\n    pardot-1\\.0|\n    prebid-ads|\n    prebid|\n    prevent-bab|\n    prevent-bab2|\n    prevent-fab-3\\.2\\.0|\n    prevent-popads-net|\n    scorecardresearch-beacon|\n    set-popads-dummy|\n    click2load\\.html|\n  )?$"
				},
				{
					name: "redirect-rule",
					aliases: null,
					description: "This is basically an alias to `$redirect`\nsince it has the same \"redirection\" values and the logic is almost similar.\nThe difference is that `$redirect-rule` is applied only in the case\nwhen the target request is blocked by a different basic rule.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#redirect-rule-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"to",
						"third-party",
						"popup",
						"match-case",
						"header",
						"first-party",
						"document",
						"image",
						"stylesheet",
						"script",
						"object",
						"font",
						"media",
						"subdocument",
						"ping",
						"xmlhttprequest",
						"websocket",
						"other",
						"webrtc",
						"important",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "(?x)\n  ^(\n    1x1-transparent\\.gif|\n    2x2-transparent\\.png|\n    3x2-transparent\\.png|\n    32x32-transparent\\.png|\n    noopframe|\n    noopcss|\n    noopjs|\n    noopjson|\n    nooptext|\n    empty|\n    noopvmap-1\\.0|\n    noopvast-2\\.0|\n    noopvast-3\\.0|\n    noopvast-4\\.0|\n    noopmp3-0\\.1s|\n    noopmp4-1s|\n    amazon-apstag|\n    ati-smarttag|\n    didomi-loader|\n    fingerprintjs2|\n    fingerprintjs3|\n    gemius|\n    google-analytics-ga|\n    google-analytics|\n    google-ima3|\n    googlesyndication-adsbygoogle|\n    googletagservices-gpt|\n    matomo|\n    metrika-yandex-tag|\n    metrika-yandex-watch|\n    naver-wcslog|\n    noeval|\n    pardot-1\\.0|\n    prebid-ads|\n    prebid|\n    prevent-bab|\n    prevent-bab2|\n    prevent-fab-3\\.2\\.0|\n    prevent-popads-net|\n    scorecardresearch-beacon|\n    set-popads-dummy|\n    click2load\\.html|\n  )?$"
				},
				{
					name: "redirect-rule",
					aliases: null,
					description: "This is basically an alias to `$redirect`\nsince it has the same \"redirection\" values and the logic is almost similar.\nThe difference is that `$redirect-rule` is applied only in the case\nwhen the target request is blocked by a different basic rule.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#redirect-rule",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"to",
						"third-party",
						"popup",
						"match-case",
						"header",
						"first-party",
						"document",
						"image",
						"stylesheet",
						"script",
						"object",
						"font",
						"media",
						"subdocument",
						"ping",
						"xmlhttprequest",
						"websocket",
						"other",
						"webrtc",
						"important",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "(?x)\n  ^(\n    1x1\\.gif|\n    2x2\\.png|\n    3x2\\.png|\n    32x32\\.png|\n    noop\\.css|\n    noop\\.html|\n    noopframe|\n    noop\\.js|\n    noop\\.txt|\n    noop-0\\.1s\\.mp3|\n    noop-0\\.5s\\.mp3|\n    noop-1s\\.mp4|\n    none|\n    click2load\\.html|\n    addthis_widget\\.js|\n    amazon_ads\\.js|\n    amazon_apstag\\.js|\n    monkeybroker\\.js|\n    doubleclick_instream_ad_status|\n    google-analytics_ga\\.js|\n    google-analytics_analytics\\.js|\n    google-analytics_inpage_linkid\\.js|\n    google-analytics_cx_api\\.js|\n    google-ima\\.js|\n    googletagservices_gpt\\.js|\n    googletagmanager_gtm\\.js|\n    googlesyndication_adsbygoogle\\.js|\n    scorecardresearch_beacon\\.js|\n    outbrain-widget\\.js|\n    hd-main\\.js\n  )\n  (:[0-9]+)?$"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"1024": 2,
				"2048": 2,
				"4096": 2,
				"8192": 2
			}
		},
		{
			shared: [
				{
					name: "redirect",
					aliases: null,
					description: "Used to redirect web requests to a local \"resource\".",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#redirect-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "(?x)\n  ^(\n    1x1-transparent\\.gif|\n    2x2-transparent\\.png|\n    3x2-transparent\\.png|\n    32x32-transparent\\.png|\n    noopframe|\n    noopcss|\n    noopjs|\n    noopjson|\n    nooptext|\n    empty|\n    noopvmap-1\\.0|\n    noopvast-2\\.0|\n    noopvast-3\\.0|\n    noopvast-4\\.0|\n    noopmp3-0\\.1s|\n    noopmp4-1s|\n    amazon-apstag|\n    ati-smarttag|\n    didomi-loader|\n    fingerprintjs2|\n    fingerprintjs3|\n    gemius|\n    google-analytics-ga|\n    google-analytics|\n    googletagmanager-gtm|\n    google-ima3|\n    googlesyndication-adsbygoogle|\n    googletagservices-gpt|\n    matomo|\n    metrika-yandex-tag|\n    metrika-yandex-watch|\n    naver-wcslog|\n    noeval|\n    pardot-1\\.0|\n    prebid-ads|\n    prebid|\n    prevent-bab|\n    prevent-bab2|\n    prevent-fab-3\\.2\\.0|\n    prevent-popads-net|\n    scorecardresearch-beacon|\n    set-popads-dummy|\n    click2load\\.html\n  )?$"
				},
				{
					name: "redirect",
					aliases: null,
					description: "Used to redirect web requests to a local \"resource\".",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#redirect-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "(?x)\n  ^(\n    1x1-transparent\\.gif|\n    2x2-transparent\\.png|\n    3x2-transparent\\.png|\n    32x32-transparent\\.png|\n    noopframe|\n    noopcss|\n    noopjs|\n    noopjson|\n    nooptext|\n    empty|\n    noopvmap-1\\.0|\n    noopvast-2\\.0|\n    noopvast-3\\.0|\n    noopvast-4\\.0|\n    noopmp3-0\\.1s|\n    noopmp4-1s|\n    amazon-apstag|\n    ati-smarttag|\n    didomi-loader|\n    fingerprintjs2|\n    fingerprintjs3|\n    gemius|\n    google-analytics-ga|\n    google-analytics|\n    googletagmanager-gtm|\n    google-ima3|\n    googlesyndication-adsbygoogle|\n    googletagservices-gpt|\n    matomo|\n    metrika-yandex-tag|\n    metrika-yandex-watch|\n    naver-wcslog|\n    noeval|\n    pardot-1\\.0|\n    prebid-ads|\n    prebid|\n    prevent-bab|\n    prevent-bab2|\n    prevent-fab-3\\.2\\.0|\n    prevent-popads-net|\n    scorecardresearch-beacon|\n    set-popads-dummy|\n    click2load\\.html\n  )?$"
				},
				{
					name: "redirect",
					aliases: null,
					description: "Used to redirect web requests to a local \"resource\".",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#redirect",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "(?x)\n  ^(\n    1x1\\.gif|\n    2x2\\.png|\n    3x2\\.png|\n    32x32\\.png|\n    noop\\.css|\n    noop\\.html|\n    noopframe|\n    noop\\.js|\n    noop\\.txt|\n    noop-0\\.1s\\.mp3|\n    noop-0\\.5s\\.mp3|\n    noop-1s\\.mp4|\n    none|\n    click2load\\.html|\n    addthis_widget\\.js|\n    amazon_ads\\.js|\n    amazon_apstag\\.js|\n    monkeybroker\\.js|\n    doubleclick_instream_ad_status|\n    google-analytics_ga\\.js|\n    google-analytics_analytics\\.js|\n    google-analytics_inpage_linkid\\.js|\n    google-analytics_cx_api\\.js|\n    google-ima\\.js|\n    googletagservices_gpt\\.js|\n    googletagmanager_gtm\\.js|\n    googlesyndication_adsbygoogle\\.js|\n    scorecardresearch_beacon\\.js|\n    outbrain-widget\\.js|\n    hd-main\\.js\n  )\n  (:[0-9]+)?$"
				},
				{
					name: "rewrite",
					aliases: null,
					description: "The `rewrite=` option allows the rewriting of URLs (or redirecting requests) to an internal\nresource in order to deactivate it without causing an error. Indicate the internal resource\nby name and prefix `abp-resource:` in order to be recognized. For example\n`$rewrite=abp-resource:blank-js` sends an empty JavaScript.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "(?x)\n  # ABP resources always starts with the `abp-resource:` prefix\n  ^abp-resource:\n  # Possible resource names\n  (\n    blank-text|\n    blank-css|\n    blank-js|\n    blank-html|\n    blank-mp3|\n    1x1-transparent-gif|\n    2x2-transparent-png|\n    3x2-transparent-png|\n    32x32-transparent-png\n  )$"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"1024": 2,
				"2048": 2,
				"4096": 2,
				"8192": 2,
				"16384": 3,
				"32768": 3,
				"65536": 3,
				"131072": 3
			}
		},
		{
			shared: [
				{
					name: "referrerpolicy",
					aliases: null,
					description: "This modifier allows overriding of a page's referrer policy.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#referrerpolicy-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"document",
						"subdocument"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "referrerpolicy_value"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0
			}
		},
		{
			shared: [
				{
					name: "removeheader",
					aliases: null,
					description: "Rules with the `$removeheader` modifier are intended to remove headers from HTTP requests and responses.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#removeheader-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"third-party",
						"first-party",
						"app",
						"important",
						"match-case",
						"document",
						"image",
						"stylesheet",
						"script",
						"object",
						"font",
						"media",
						"subdocument",
						"ping",
						"xmlhttpreqeust",
						"websocket",
						"other",
						"webrtc"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "(?xi)\n  ^\n    # Value may start with \"request:\"\n    (request:)?\n\n    # Forbidden header names\n    (?!\n      (\n        access-control-allow-origin|\n        access-control-allow-credentials|\n        access-control-allow-headers|\n        access-control-allow-methods|\n        access-control-expose-headers|\n        access-control-max-age|\n        access-control-request-headers|\n        access-control-request-method|\n        origin|\n        timing-allow-origin|\n        allow|\n        cross-origin-embedder-policy|\n        cross-origin-opener-policy|\n        cross-origin-resource-policy|\n        content-security-policy|\n        content-security-policy-report-only|\n        expect-ct|\n        feature-policy|\n        origin-isolation|\n        strict-transport-security|\n        upgrade-insecure-requests|\n        x-content-type-options|\n        x-download-options|\n        x-frame-options|\n        x-permitted-cross-domain-policies|\n        x-powered-by|\n        x-xss-protection|\n        public-key-pins|\n        public-key-pins-report-only|\n        sec-websocket-key|\n        sec-websocket-extensions|\n        sec-websocket-accept|\n        sec-websocket-protocol|\n        sec-websocket-version|\n        p3p|\n        sec-fetch-mode|\n        sec-fetch-dest|\n        sec-fetch-site|\n        sec-fetch-user|\n        referrer-policy|\n        content-type|\n        content-length|\n        accept|\n        accept-encoding|\n        host|\n        connection|\n        transfer-encoding|\n        upgrade\n      )\n    $)\n\n    # Any other header name is allowed, if it matches the following regex\n    [A-z0-9-]+\n  $"
				},
				{
					name: "removeheader",
					aliases: null,
					description: "Rules with the `$removeheader` modifier are intended to remove headers from HTTP requests and responses.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#removeheader-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"third-party",
						"first-party",
						"app",
						"important",
						"match-case",
						"document",
						"image",
						"stylesheet",
						"script",
						"object",
						"font",
						"media",
						"subdocument",
						"ping",
						"xmlhttpreqeust",
						"websocket",
						"other",
						"webrtc"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "(?xi)\n  ^\n    # Value may start with \"request:\"\n    (request:)?\n\n    # Forbidden header names\n    (?!\n      (\n        access-control-allow-origin|\n        access-control-allow-credentials|\n        access-control-allow-headers|\n        access-control-allow-methods|\n        access-control-expose-headers|\n        access-control-max-age|\n        access-control-request-headers|\n        access-control-request-method|\n        origin|\n        timing-allow-origin|\n        allow|\n        cross-origin-embedder-policy|\n        cross-origin-opener-policy|\n        cross-origin-resource-policy|\n        content-security-policy|\n        content-security-policy-report-only|\n        expect-ct|\n        feature-policy|\n        origin-isolation|\n        strict-transport-security|\n        upgrade-insecure-requests|\n        x-content-type-options|\n        x-download-options|\n        x-frame-options|\n        x-permitted-cross-domain-policies|\n        x-powered-by|\n        x-xss-protection|\n        public-key-pins|\n        public-key-pins-report-only|\n        sec-websocket-key|\n        sec-websocket-extensions|\n        sec-websocket-accept|\n        sec-websocket-protocol|\n        sec-websocket-version|\n        p3p|\n        sec-fetch-mode|\n        sec-fetch-dest|\n        sec-fetch-site|\n        sec-fetch-user|\n        referrer-policy|\n        content-type|\n        content-length|\n        accept|\n        accept-encoding|\n        host|\n        connection|\n        transfer-encoding|\n        upgrade\n      )\n    $)\n\n    # Any other header name is allowed, if it matches the following regex\n    [A-z0-9-]+\n  $"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1
			}
		},
		{
			shared: [
				{
					name: "removeparam",
					aliases: null,
					description: "Rules with the `$removeparam` modifier are intended to strip query parameters from requests' URLs.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#removeparam-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "(?xi)\n  (\n    # string pattern\n    \\w+\n    # or regexp pattern\n    |\n    \\/.+\\/\n      # flags\n      ([gimuy]+)?\n  )"
				},
				{
					name: "removeparam",
					aliases: null,
					description: "Rules with the `$removeparam` modifier are intended to strip query parameters from requests' URLs.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#removeparam-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: true,
					valueFormat: "(?xi)\n  (\n    # string pattern\n    \\w+\n    # or regexp pattern\n    |\n    \\/.+\\/\n      # flags\n      ([gimuy]+)?\n  )"
				},
				{
					name: "removeparam",
					aliases: null,
					description: "Rules with the `$removeparam` modifier are intended to strip query parameters from requests' URLs.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#removeparam",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "(?xi)\n  (\n    # string pattern\n    \\w+\n    # or regexp pattern\n    |\n    \\/.+\\/\n      # flags\n      ([gimuy]+)?\n  )"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"1024": 2,
				"2048": 2,
				"4096": 2,
				"8192": 2
			}
		},
		{
			shared: [
				{
					name: "replace",
					aliases: null,
					description: "This modifier completely changes the rule behavior.\nIf it is applied, the rule will not block the request. The response is going to be modified instead.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#replace-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"app",
						"domain",
						"document",
						"subdocument",
						"script",
						"stylesheet",
						"other",
						"xmlhttprequest",
						"first-party",
						"third-party",
						"important",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "(?xi)\n  ^\n    \\/\n      # the regexp to match by\n      (.+)\n    # separator\n    \\/\n      # replacement\n      (.+)?\n    \\/\n      # flags\n      ([gimuy]*)?\n  $"
				},
				{
					name: "replace",
					aliases: null,
					description: "This modifier completely changes the rule behavior.\nIf it is applied, the rule will not block the request. The response is going to be modified instead.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#replace-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"app",
						"domain",
						"document",
						"subdocument",
						"script",
						"stylesheet",
						"other",
						"xmlhttprequest",
						"first-party",
						"third-party",
						"important",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "(?xi)\n  ^\n    \\/\n      # the regexp to match by\n      (.+)\n    # separator\n    \\/\n      # replacement\n      (.+)?\n    \\/\n      # flags\n      ([gimuy]*)?\n  $"
				},
				{
					name: "replace",
					aliases: null,
					description: "This modifier completely changes the rule behavior.\nIf it is applied, the rule will not block the request. The response is going to be modified instead.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#replace",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"app",
						"domain",
						"document",
						"subdocument",
						"script",
						"stylesheet",
						"other",
						"xmlhttprequest",
						"first-party",
						"third-party",
						"important",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "(?xi)\n  ^\n    \\/\n      # the regexp to match by\n      (.+)\n    # separator\n    \\/\n      # replacement\n      (.+)?\n    \\/\n      # flags\n      ([gimuy]*)?\n  $"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"64": 1,
				"8192": 2
			}
		},
		{
			shared: [
				{
					name: "script",
					aliases: null,
					description: "The rule corresponds to script requests, e.g. javascript, vbscript.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#script-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "script",
					aliases: null,
					description: "The rule corresponds to script requests, e.g. javascript, vbscript.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "script",
					aliases: null,
					description: "The rule corresponds to script requests, e.g. javascript, vbscript.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "specifichide",
					aliases: [
						"shide"
					],
					description: "Disables all specific element hiding and CSS rules, but not general ones.\nHas an opposite effect to `$generichide`.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#specifichide-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"genericblock",
						"urlblock",
						"extension",
						"jsinject",
						"content",
						"xmlhttprequest",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "specifichide",
					aliases: [
						"shide"
					],
					description: "Disables all specific element hiding and CSS rules, but not general ones.\nHas an opposite effect to `$generichide`.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#specifichide",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "stealth",
					aliases: null,
					description: "Disables the Stealth Mode module for all corresponding pages and requests.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#stealth-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: true,
					valueFormat: "pipe_separated_stealth_options"
				},
				{
					name: "stealth",
					aliases: null,
					description: "Disables the Stealth Mode module for all corresponding pages and requests.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#stealth-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: true,
					valueFormat: "pipe_separated_stealth_options"
				},
				{
					name: "stealth",
					aliases: null,
					description: "Disables the Stealth Mode module for all corresponding pages and requests.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#stealth-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: true,
					valueFormat: "pipe_separated_stealth_options"
				},
				{
					name: "stealth",
					aliases: null,
					description: "Disables the Stealth Mode module for all corresponding pages and requests.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#stealth-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: true,
					valueFormat: "pipe_separated_stealth_options"
				},
				{
					name: "stealth",
					aliases: null,
					description: "Disables the Stealth Mode module for all corresponding pages and requests.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#stealth-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: true,
					valueFormat: "pipe_separated_stealth_options"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 2,
				"32": 3,
				"64": 4
			}
		},
		{
			shared: [
				{
					name: "strict1p",
					aliases: null,
					description: "This new `strict1p` option can check for strict partyness.\nFor example, a network request qualifies as 1st-party if both the context and the request share the same hostname.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#strict1p",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1024": 0,
				"2048": 0,
				"4096": 0,
				"8192": 0
			}
		},
		{
			shared: [
				{
					name: "strict3p",
					aliases: null,
					description: "This new `strict3p` option can check for strict partyness.\nFor example, a network request qualifies as 3rd-party if the context and the request hostnames are different.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#strict3p",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1024": 0,
				"2048": 0,
				"4096": 0,
				"8192": 0
			}
		},
		{
			shared: [
				{
					name: "stylesheet",
					aliases: null,
					description: "The rule corresponds to CSS files requests.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#stylesheet-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "stylesheet",
					aliases: [
						"css"
					],
					description: "The rule corresponds to CSS files requests.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#css",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "stylesheet",
					aliases: null,
					description: "The rule corresponds to CSS files requests.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "subdocument",
					aliases: null,
					description: "The rule corresponds to requests for built-in pages — HTML tags frame and iframe.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#subdocument-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "subdocument",
					aliases: [
						"frame"
					],
					description: "The rule corresponds to requests for built-in pages — HTML tags frame and iframe.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#frame",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "subdocument",
					aliases: null,
					description: "The rule corresponds to requests for built-in pages — HTML tags frame and iframe.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "third-party",
					aliases: [
						"3p"
					],
					description: "A restriction of third-party and own requests.\nA third-party request is a request from a different domain.\nFor example, a request to `example.org` from `domain.com` is a third-party request.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#third-party-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "3p",
					aliases: [
						"third-party"
					],
					description: "A restriction of third-party and own requests.\nA third-party request is a request from a different domain.\nFor example, a request to `example.org` from `domain.com` is a third-party request.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#3p",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "third-party",
					aliases: null,
					description: "A restriction of third-party and own requests.\nA third-party request is a request from a different domain.\nFor example, a request to `example.org` from `domain.com` is a third-party request.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#party-requests",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "to",
					aliases: null,
					description: "`$to` limits the rule scope to requests made to the specified domains and their subdomains.\nTo add multiple domains to one rule, use the `|` character as a separator.",
					docs: "https://adguard.com/kb/general/ad-filtering/create-own-filters/#to-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"denyallow"
					],
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "pipe_separated_domains"
				},
				{
					name: "to",
					aliases: null,
					description: "`$to` limits the rule scope to requests made to the specified domains and their subdomains.\nTo add multiple domains to one rule, use the `|` character as a separator.",
					docs: "https://adguard.com/kb/general/ad-filtering/create-own-filters/#to-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"denyallow"
					],
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "pipe_separated_domains"
				},
				{
					name: "to",
					aliases: null,
					description: "The main motivation of this option is\nto give static network filtering engine an equivalent of DNR's `requestDomains` and `excludedRequestDomains`.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#to",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"denyallow"
					],
					inverseConflicts: false,
					assignable: true,
					negatable: false,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: "pipe_separated_domains"
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"1024": 2,
				"2048": 2,
				"4096": 2,
				"8192": 2
			}
		},
		{
			shared: [
				{
					name: "urlblock",
					aliases: null,
					description: "Disables blocking of all requests sent from the pages matching the rule.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#urlblock-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: [
						"domain",
						"specifichide",
						"generichide",
						"elemhide",
						"extension",
						"jsinject",
						"content",
						"badfilter"
					],
					inverseConflicts: true,
					assignable: false,
					negatable: false,
					blockOnly: false,
					exceptionOnly: true,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0
			}
		},
		{
			shared: [
				{
					name: "webrtc",
					aliases: null,
					description: "The rule applies only to WebRTC connections.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#webrtc-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: true,
					removalMessage: "This modifier is removed and is no longer supported.\nRules with it are considered as invalid. If you need to suppress WebRTC, consider using\nthe [nowebrtc scriptlet](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#nowebrtc).",
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "webrtc",
					aliases: null,
					description: "The rule applies only to WebRTC connections.",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: true,
					removalMessage: "This modifier is removed and is no longer supported.\nIf you need to suppress WebRTC, consider using\nthe [nowebrtc scriptlet](https://github.com/gorhill/uBlock/wiki/Resources-Library#nowebrtcjs-).",
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "webrtc",
					aliases: null,
					description: "The rule applies only to WebRTC connections.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: "1.13.3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "websocket",
					aliases: null,
					description: "The rule applies only to WebSocket connections.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#websocket-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "websocket",
					aliases: null,
					description: "The rule applies only to WebSocket connections.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#websocket-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "websocket",
					aliases: null,
					description: "The rule applies only to WebSocket connections.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#websocket-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "websocket",
					aliases: null,
					description: "The rule applies only to WebSocket connections.",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#websocket-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "websocket",
					aliases: null,
					description: "The rule applies only to WebSocket connections.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "websocket",
					aliases: null,
					description: "The rule applies only to WebSocket connections.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 1,
				"16": 1,
				"32": 1,
				"64": 1,
				"256": 2,
				"512": 3,
				"1024": 4,
				"2048": 4,
				"4096": 4,
				"8192": 4,
				"16384": 5,
				"32768": 5,
				"65536": 5,
				"131072": 5
			}
		},
		{
			shared: [
				{
					name: "xmlhttprequest",
					aliases: [
						"xhr"
					],
					description: "The rule applies only to ajax requests (requests sent via javascript object XMLHttpRequest).",
					docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#xmlhttprequest-modifier",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "xhr",
					aliases: [
						"xmlhttprequest"
					],
					description: "The rule applies only to ajax requests (requests sent via javascript object XMLHttpRequest).",
					docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#xhr",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				},
				{
					name: "xmlhttprequest",
					aliases: null,
					description: "The rule applies only to ajax requests (requests sent via javascript object XMLHttpRequest).",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					conflicts: null,
					inverseConflicts: false,
					assignable: false,
					negatable: true,
					blockOnly: false,
					exceptionOnly: false,
					valueOptional: false,
					valueFormat: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"128": 0,
				"256": 0,
				"512": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		}
	],
	map: {
		all: 0,
		app: 1,
		badfilter: 2,
		cname: 3,
		content: 4,
		cookie: 5,
		csp: 6,
		denyallow: 7,
		document: 8,
		doc: 8,
		domain: 9,
		from: 9,
		elemhide: 10,
		ehide: 10,
		empty: 11,
		extension: 12,
		"first-party": 13,
		"1p": 13,
		"~third-party": 13,
		font: 14,
		genericblock: 15,
		generichide: 16,
		ghide: 16,
		header: 17,
		hls: 18,
		image: 19,
		important: 20,
		"inline-font": 21,
		"inline-script": 22,
		jsinject: 23,
		jsonprune: 24,
		"match-case": 25,
		media: 26,
		method: 27,
		mp4: 28,
		network: 29,
		_: 30,
		"object-subrequest": 31,
		object: 32,
		other: 33,
		permissions: 34,
		ping: 35,
		popunder: 36,
		popup: 37,
		"redirect-rule": 38,
		redirect: 39,
		rewrite: 39,
		referrerpolicy: 40,
		removeheader: 41,
		removeparam: 42,
		replace: 43,
		script: 44,
		specifichide: 45,
		shide: 45,
		stealth: 46,
		strict1p: 47,
		strict3p: 48,
		stylesheet: 49,
		css: 49,
		subdocument: 50,
		frame: 50,
		"third-party": 51,
		"3p": 51,
		to: 52,
		urlblock: 53,
		webrtc: 54,
		websocket: 55,
		xmlhttprequest: 56,
		xhr: 56
	}
};
var redirectsCompatibilityTableData = {
	shared: [
		{
			shared: [
				{
					name: "1x1-transparent.gif",
					aliases: [
						"1x1.gif",
						"1x1-transparent-gif"
					],
					description: "Redirects to a 1x1 transparent GIF.",
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#1x1-transparent.gif",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "1x1.gif",
					aliases: null,
					description: "Redirects to a 1x1 transparent GIF.",
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#available-empty-redirect-resources",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"image"
					]
				},
				{
					name: "1x1-transparent-gif",
					aliases: null,
					description: "Redirects to a 1x1 transparent GIF.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "2x2-transparent.png",
					aliases: [
						"2x2.png",
						"2x2-transparent-png"
					],
					description: "Redirects to a 2x2 transparent PNG.",
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#2x2-transparent.png",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "2x2.png",
					aliases: null,
					description: "Redirects to a 2x2 transparent PNG.",
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#available-empty-redirect-resources",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"image"
					]
				},
				{
					name: "2x2-transparent-png",
					aliases: null,
					description: "Redirects to a 2x2 transparent PNG.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "32x32-transparent.png",
					aliases: [
						"32x32.png",
						"32x32-transparent-png"
					],
					description: "Redirects to a 32x32 transparent PNG.",
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#32x32-transparent.png",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "32x32.png",
					aliases: null,
					description: "Redirects to a 32x32 transparent PNG.",
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#available-empty-redirect-resources",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"image"
					]
				},
				{
					name: "32x32-transparent-png",
					aliases: null,
					description: "Redirects to a 32x32 transparent PNG.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "3x2-transparent.png",
					aliases: [
						"3x2.png",
						"3x2-transparent-png"
					],
					description: "Redirects to a 3x2 transparent PNG.",
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#3x2-transparent.png",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "3x2.png",
					aliases: null,
					description: "Redirects to a 3x2 transparent PNG.",
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#available-empty-redirect-resources",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"image"
					]
				},
				{
					name: "3x2-transparent-png",
					aliases: null,
					description: "Redirects to a 3x2 transparent PNG.",
					docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "amazon-apstag",
					aliases: [
						"ubo-amazon_apstag.js",
						"amazon_apstag.js"
					],
					description: "Mocks Amazon's apstag.js",
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#amazon-apstag",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "amazon_apstag.js",
					aliases: null,
					description: "Mocks Amazon's apstag.js",
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#amazon_apstagjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "amazon_ads.js",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1024": 0,
				"2048": 0,
				"4096": 0,
				"8192": 0
			}
		},
		{
			shared: [
				{
					name: "ampproject_v0.js",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1024": 0,
				"2048": 0,
				"4096": 0,
				"8192": 0
			}
		},
		{
			shared: [
				{
					name: "ati-smarttag",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "chartbeat.js",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1024": 0,
				"2048": 0,
				"4096": 0,
				"8192": 0
			}
		},
		{
			shared: [
				{
					name: "click2load.html",
					aliases: [
						"click2load.html",
						"ubo-click2load.html"
					],
					description: "Redirects resource and replaces supposed content by decoy frame with button for original content recovering.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: true,
					resourceTypes: [
					]
				},
				{
					name: "click2load.html",
					aliases: null,
					description: "Redirects resource and replaces supposed content by decoy frame with button for original content recovering.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: true,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "didomi-loader",
					aliases: null,
					description: "Mocks Didomi's CMP loader script.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "empty",
					aliases: null,
					description: "Redirects to an empty file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "empty",
					aliases: null,
					description: "Redirects to an empty file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "fingerprintjs2",
					aliases: [
						"fingerprint2.js"
					],
					description: "Mocks FingerprintJS2 script.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "fingerprint2.js",
					aliases: null,
					description: "Mocks FingerprintJS2 script.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "fingerprintjs3",
					aliases: [
						"fingerprint3.js"
					],
					description: "Mocks FingerprintJS v3.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "fingerprint3.js",
					aliases: null,
					description: "Mocks FingerprintJS v3.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "gemius",
					aliases: null,
					description: "Mocks Gemius Analytics.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "google-analytics-ga",
					aliases: [
						"ubo-google-analytics_ga.js",
						"google-analytics_ga.js"
					],
					description: "Mocks old Google Analytics API.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "google-analytics_ga.js",
					aliases: null,
					description: "Mocks old Google Analytics API.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "google-analytics",
					aliases: [
						"ubo-google-analytics_analytics.js",
						"google-analytics_analytics.js",
						"googletagmanager-gtm",
						"ubo-googletagmanager_gtm.js",
						"googletagmanager_gtm.js"
					],
					description: "Mocks Google's Analytics and Tag Manager APIs.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "google-analytics_analytics.js",
					aliases: null,
					description: "Mocks Google's Analytics and Tag Manager APIs.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "google-analytics_cx_api.js",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1024": 0,
				"2048": 0,
				"4096": 0,
				"8192": 0
			}
		},
		{
			shared: [
				{
					name: "google-analytics_inpage_linkid.js",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1024": 0,
				"2048": 0,
				"4096": 0,
				"8192": 0
			}
		},
		{
			shared: [
				{
					name: "google-ima3",
					aliases: [
						"ubo-google-ima.js",
						"google-ima.js"
					],
					description: "Mocks the IMA SDK of Google.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "google-ima.js",
					aliases: null,
					description: "Mocks the IMA SDK of Google.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "googlesyndication-adsbygoogle",
					aliases: [
						"ubo-googlesyndication_adsbygoogle.js",
						"ubo-googlesyndication.com/adsbygoogle.js",
						"googlesyndication_adsbygoogle.js"
					],
					description: "Mocks Google AdSense API.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "googlesyndication_adsbygoogle.js",
					aliases: [
						"googlesyndication.com/adsbygoogle.js"
					],
					description: "Mocks Google AdSense API.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "googletagservices-gpt",
					aliases: [
						"ubo-googletagservices_gpt.js",
						"googletagservices_gpt.js"
					],
					description: "Mocks Google Publisher Tag API.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "googletagservices_gpt.js",
					aliases: null,
					description: "Mocks Google Publisher Tag API.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "hd-main.js",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1024": 0,
				"2048": 0,
				"4096": 0,
				"8192": 0
			}
		},
		{
			shared: [
				{
					name: "matomo",
					aliases: null,
					description: "Mocks the piwik.js file of Matomo (formerly Piwik).",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "metrika-yandex-tag",
					aliases: null,
					description: "Mocks Yandex Metrika API.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "metrika-yandex-watch",
					aliases: null,
					description: "Mocks the old Yandex Metrika API.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "naver-wcslog",
					aliases: null,
					description: "Mocks wcslog.js of Naver Analytics.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "no-protected-audience",
					aliases: null,
					description: "Prevents using the Protected Audience API.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "no-topics",
					aliases: null,
					description: "Prevents using the Topics API.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "noeval",
					aliases: [
						"noeval.js",
						"silent-noeval.js",
						"ubo-noeval.js",
						"ubo-silent-noeval.js",
						"ubo-noeval",
						"ubo-silent-noeval"
					],
					description: "Prevents page to use eval.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "noeval.js",
					aliases: null,
					description: "Prevents page to use eval.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "noop-0.5s.mp3",
					aliases: null,
					description: "Redirects to an empty MP3 file with a duration of 0.5 seconds.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"media"
					]
				}
			],
			map: {
				"1024": 0,
				"2048": 0,
				"4096": 0,
				"8192": 0
			}
		},
		{
			shared: [
				{
					name: "noopcss",
					aliases: [
						"noop.css",
						"blank-css"
					],
					description: "Redirects to an empty CSS file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "noop.css",
					aliases: null,
					description: "Redirects to an empty CSS file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"stylesheet"
					]
				},
				{
					name: "blank-css",
					aliases: null,
					description: "Redirects to an empty CSS file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "noopframe",
					aliases: [
						"noop.html",
						"blank-html"
					],
					description: "Redirects to an empty HTML file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "noop.html",
					aliases: null,
					description: "Redirects to an empty HTML file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"sub_frame"
					]
				},
				{
					name: "blank-html",
					aliases: null,
					description: "Redirects to an empty HTML file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "noopjs",
					aliases: [
						"noop.js",
						"blank-js"
					],
					description: "Redirects to an empty JavaScript file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "noop.js",
					aliases: null,
					description: "Redirects to an empty JavaScript file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				},
				{
					name: "blank-js",
					aliases: null,
					description: "Redirects to an empty JavaScript file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "noopjson",
					aliases: [
						"noop.json"
					],
					description: "Redirects to an empty JSON file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "noop.json",
					aliases: null,
					description: "Redirects to an empty JSON file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "noopmp3-0.1s",
					aliases: [
						"noop-0.1s.mp3",
						"blank-mp3"
					],
					description: "Redirects to an empty MP3 file with a duration of 0.1 seconds.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "noop-0.1s.mp3",
					aliases: null,
					description: "Redirects to an empty MP3 file with a duration of 0.1 seconds.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"media"
					]
				},
				{
					name: "blank-mp3",
					aliases: null,
					description: "Redirects to an empty MP3 file with a duration of 0.1 seconds.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "noopmp4-1s",
					aliases: [
						"noop-1s.mp4",
						"blank-mp4"
					],
					description: "Redirects to an empty MP4 file with a duration of 1 second.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "noop-1s.mp4",
					aliases: null,
					description: "Redirects to an empty MP4 file with a duration of 1 second.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"media"
					]
				},
				{
					name: "blank-mp4",
					aliases: null,
					description: "Redirects to an empty MP4 file with a duration of 1 second.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "nooptext",
					aliases: [
						"noop.txt",
						"blank-text"
					],
					description: "Redirects to an empty text file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "noop.txt",
					aliases: null,
					description: "Redirects to an empty text file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"image",
						"media",
						"sub_frame",
						"stylesheet",
						"script",
						"xmlhttprequest",
						"other"
					]
				},
				{
					name: "blank-text",
					aliases: null,
					description: "Redirects to an empty text file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "noopvast-2.0",
					aliases: null,
					description: "Redirects to an empty VAST 2.0 XML file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "noopvast-3.0",
					aliases: null,
					description: "Redirects to an empty VAST 3.0 XML file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "noopvast-4.0",
					aliases: null,
					description: "Redirects to an empty VAST 4.0 XML file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "noopvmap-1.0",
					aliases: [
						"noop-vmap1.0.xml"
					],
					description: "Redirects to an empty VMAP 1.0 XML file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "noop-vmap1.0.xml",
					aliases: null,
					description: "Redirects to an empty VMAP 1.0 XML file.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"media"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "nowebrtc",
					aliases: [
						"nowebrtc.js",
						"ubo-nowebrtc.js",
						"ubo-nowebrtc"
					],
					description: "Disables WebRTC by overriding `RTCPeerConnection`.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "nowebrtc.js",
					aliases: null,
					description: "Disables WebRTC by overriding `RTCPeerConnection`.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"other"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "outbrain-widget.js",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1024": 0,
				"2048": 0,
				"4096": 0,
				"8192": 0
			}
		},
		{
			shared: [
				{
					name: "pardot-1.0",
					aliases: null,
					description: "Mocks the pd.js file of Salesforce.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "prebid-ads",
					aliases: [
						"prebid-ads.js"
					],
					description: "Mocks prebid-ads.js script.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "prebid-ads.js",
					aliases: null,
					description: "Mocks prebid-ads.js script.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "prebid",
					aliases: null,
					description: "Mocks the prebid.js header bidding suit.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "prevent-bab",
					aliases: [
						"nobab.js"
					],
					description: "Prevents BlockAdblock script from detecting an ad blocker.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "nobab.js",
					aliases: null,
					description: "Prevents BlockAdblock script from detecting an ad blocker.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "prevent-bab2",
					aliases: [
						"nobab2.js"
					],
					description: "Prevents BlockAdblock script from detecting an ad blocker.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "nobab2.js",
					aliases: null,
					description: "Prevents BlockAdblock script from detecting an ad blocker.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "prevent-fab-3.2.0",
					aliases: [
						"nofab.js"
					],
					description: "Mocks FAB script v3.2.0.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "nofab.js",
					aliases: [
						"fuckadblock.js-3.2.0",
						"fuckadblock.js-3.2.0.js"
					],
					description: "Mocks FAB script v3.2.0.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "prevent-popads-net",
					aliases: [
						"popads.js"
					],
					description: "Aborts on property write (PopAds, popns), throws reference error with random id.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "popads.js",
					aliases: null,
					description: "Aborts on property write (PopAds, popns), throws reference error with random id.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "scorecardresearch-beacon",
					aliases: [
						"scorecardresearch_beacon.js"
					],
					description: "Mocks Scorecard Research API.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "scorecardresearch_beacon.js",
					aliases: null,
					description: "Mocks Scorecard Research API.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "set-popads-dummy",
					aliases: [
						"popads-dummy.js"
					],
					description: "Sets static properties PopAds and popns.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
					]
				},
				{
					name: "popads-dummy.js",
					aliases: null,
					description: "Sets static properties PopAds and popns.",
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					isBlocking: false,
					resourceTypes: [
						"script"
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		}
	],
	map: {
		"1x1-transparent.gif": 0,
		"1x1.gif": 0,
		"1x1-transparent-gif": 0,
		"2x2-transparent.png": 1,
		"2x2.png": 1,
		"2x2-transparent-png": 1,
		"32x32-transparent.png": 2,
		"32x32.png": 2,
		"32x32-transparent-png": 2,
		"3x2-transparent.png": 3,
		"3x2.png": 3,
		"3x2-transparent-png": 3,
		"amazon-apstag": 4,
		"ubo-amazon_apstag.js": 4,
		"amazon_apstag.js": 4,
		"amazon_ads.js": 5,
		"ampproject_v0.js": 6,
		"ati-smarttag": 7,
		"chartbeat.js": 8,
		"click2load.html": 9,
		"ubo-click2load.html": 9,
		"didomi-loader": 10,
		empty: 11,
		fingerprintjs2: 12,
		"fingerprint2.js": 12,
		fingerprintjs3: 13,
		"fingerprint3.js": 13,
		gemius: 14,
		"google-analytics-ga": 15,
		"ubo-google-analytics_ga.js": 15,
		"google-analytics_ga.js": 15,
		"google-analytics": 16,
		"ubo-google-analytics_analytics.js": 16,
		"google-analytics_analytics.js": 16,
		"googletagmanager-gtm": 16,
		"ubo-googletagmanager_gtm.js": 16,
		"googletagmanager_gtm.js": 16,
		"google-analytics_cx_api.js": 17,
		"google-analytics_inpage_linkid.js": 18,
		"google-ima3": 19,
		"ubo-google-ima.js": 19,
		"google-ima.js": 19,
		"googlesyndication-adsbygoogle": 20,
		"ubo-googlesyndication_adsbygoogle.js": 20,
		"ubo-googlesyndication.com/adsbygoogle.js": 20,
		"googlesyndication_adsbygoogle.js": 20,
		"googlesyndication.com/adsbygoogle.js": 20,
		"googletagservices-gpt": 21,
		"ubo-googletagservices_gpt.js": 21,
		"googletagservices_gpt.js": 21,
		"hd-main.js": 22,
		matomo: 23,
		"metrika-yandex-tag": 24,
		"metrika-yandex-watch": 25,
		"naver-wcslog": 26,
		"no-protected-audience": 27,
		"no-topics": 28,
		noeval: 29,
		"noeval.js": 29,
		"silent-noeval.js": 29,
		"ubo-noeval.js": 29,
		"ubo-silent-noeval.js": 29,
		"ubo-noeval": 29,
		"ubo-silent-noeval": 29,
		"noop-0.5s.mp3": 30,
		noopcss: 31,
		"noop.css": 31,
		"blank-css": 31,
		noopframe: 32,
		"noop.html": 32,
		"blank-html": 32,
		noopjs: 33,
		"noop.js": 33,
		"blank-js": 33,
		noopjson: 34,
		"noop.json": 34,
		"noopmp3-0.1s": 35,
		"noop-0.1s.mp3": 35,
		"blank-mp3": 35,
		"noopmp4-1s": 36,
		"noop-1s.mp4": 36,
		"blank-mp4": 36,
		nooptext: 37,
		"noop.txt": 37,
		"blank-text": 37,
		"noopvast-2.0": 38,
		"noopvast-3.0": 39,
		"noopvast-4.0": 40,
		"noopvmap-1.0": 41,
		"noop-vmap1.0.xml": 41,
		nowebrtc: 42,
		"nowebrtc.js": 42,
		"ubo-nowebrtc.js": 42,
		"ubo-nowebrtc": 42,
		"outbrain-widget.js": 43,
		"pardot-1.0": 44,
		"prebid-ads": 45,
		"prebid-ads.js": 45,
		prebid: 46,
		"prevent-bab": 47,
		"nobab.js": 47,
		"prevent-bab2": 48,
		"nobab2.js": 48,
		"prevent-fab-3.2.0": 49,
		"nofab.js": 49,
		"fuckadblock.js-3.2.0": 49,
		"fuckadblock.js-3.2.0.js": 49,
		"prevent-popads-net": 50,
		"popads.js": 50,
		"scorecardresearch-beacon": 51,
		"scorecardresearch_beacon.js": 51,
		"set-popads-dummy": 52,
		"popads-dummy.js": 52
	}
};
var scriptletsCompatibilityTableData = {
	shared: [
		{
			shared: [
				{
					name: "abort-current-inline-script",
					aliases: [
						"abort-current-script.js",
						"ubo-abort-current-script.js",
						"acs.js",
						"ubo-acs.js",
						"ubo-abort-current-script",
						"ubo-acs",
						"abort-current-inline-script.js",
						"ubo-abort-current-inline-script.js",
						"acis.js",
						"ubo-acis.js",
						"ubo-abort-current-inline-script",
						"ubo-acis",
						"abp-abort-current-inline-script"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#abort-current-inline-script",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "search",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "abort-current-script.js",
					aliases: [
						"acs.js",
						"abort-current-inline-script.js",
						"acis.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#abort-current-scriptjs-",
					versionAdded: "1.37.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "search",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "abort-current-inline-script",
					aliases: null,
					description: null,
					docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
					versionAdded: "3.4.3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "api",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "search",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "abort-on-property-read",
					aliases: [
						"abort-on-property-read.js",
						"ubo-abort-on-property-read.js",
						"aopr.js",
						"ubo-aopr.js",
						"ubo-abort-on-property-read",
						"ubo-aopr",
						"abp-abort-on-property-read"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#abort-on-property-read",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "abort-on-property-read.js",
					aliases: [
						"aopr.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#abort-on-property-readjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "abort-on-property-read",
					aliases: null,
					description: null,
					docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
					versionAdded: "3.4.1",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "setConfigurable",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "abort-on-property-write",
					aliases: [
						"abort-on-property-write.js",
						"ubo-abort-on-property-write.js",
						"aopw.js",
						"ubo-aopw.js",
						"ubo-abort-on-property-write",
						"ubo-aopw",
						"abp-abort-on-property-write"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#abort-on-property-write",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "abort-on-property-write.js",
					aliases: [
						"aopw.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#abort-on-property-writejs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "abort-on-property-write",
					aliases: null,
					description: null,
					docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
					versionAdded: "3.4.3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "setConfigurable",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "abort-on-stack-trace",
					aliases: [
						"abort-on-stack-trace.js",
						"ubo-abort-on-stack-trace.js",
						"aost.js",
						"ubo-aost.js",
						"ubo-abort-on-stack-trace",
						"ubo-aost",
						"abp-abort-on-stack-trace"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#abort-on-stack-trace",
					versionAdded: "1.5.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "abort-on-stack-trace.js",
					aliases: [
						"aost.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#abort-on-stack-tracejs-",
					versionAdded: "1.29.3rc9",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "adjust-setInterval",
					aliases: [
						"nano-setInterval-booster.js",
						"ubo-nano-setInterval-booster.js",
						"nano-sib.js",
						"ubo-nano-sib.js",
						"adjust-setInterval.js",
						"ubo-adjust-setInterval.js",
						"ubo-nano-setInterval-booster",
						"ubo-nano-sib",
						"ubo-adjust-setInterval"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#adjust-setInterval",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "matchCallback",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "matchDelay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "boost",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "adjust-setInterval.js",
					aliases: [
						"nano-setInterval-booster.js",
						"nano-sib.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#adjust-setIntervaljs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "matchCallback",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "matchDelay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "boost",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "adjust-setTimeout",
					aliases: [
						"adjust-setTimeout.js",
						"ubo-adjust-setTimeout.js",
						"nano-setTimeout-booster.js",
						"ubo-nano-setTimeout-booster.js",
						"nano-stb.js",
						"ubo-nano-stb.js",
						"ubo-adjust-setTimeout",
						"ubo-nano-setTimeout-booster",
						"ubo-nano-stb"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#adjust-setTimeout",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "matchCallback",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "matchDelay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "boost",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "adjust-setTimeout.js",
					aliases: [
						"nano-setTimeout-booster.js",
						"nano-stb.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#adjust-setTimeoutjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "matchCallback",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "matchDelay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "boost",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "amazon-apstag",
					aliases: [
						"ubo-amazon_apstag.js",
						"amazon_apstag.js"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#amazon-apstag",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "call-nothrow",
					aliases: [
						"call-nothrow.js",
						"ubo-call-nothrow.js",
						"ubo-call-nothrow"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#call-nothrow",
					versionAdded: "1.10.1",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "functionName",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "call-nothrow.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#call-nothrowjs-",
					versionAdded: "1.48.1b0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "functionName",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "close-window",
					aliases: [
						"window-close-if.js",
						"ubo-window-close-if.js",
						"ubo-window-close-if",
						"close-window.js",
						"ubo-close-window.js",
						"ubo-close-window"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#close-window",
					versionAdded: "1.5.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "path",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "close-window.js",
					aliases: [
						"window-close-if.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#close-windowjs-",
					versionAdded: "1.39.3b10",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "path",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "debug-current-inline-script",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#debug-current-inline-script",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "search",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "debug-on-property-read",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#debug-on-property-read",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "debug-on-property-write",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#debug-on-property-write",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "didomi-loader",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#didomi-loader",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "dir-string",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#dir-string",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "times",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "disable-newtab-links",
					aliases: [
						"disable-newtab-links.js",
						"ubo-disable-newtab-links.js",
						"ubo-disable-newtab-links"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#disable-newtab-links",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				},
				{
					name: "disable-newtab-links.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#disable-newtab-linksjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "evaldata-prune",
					aliases: [
						"evaldata-prune.js",
						"ubo-evaldata-prune.js",
						"ubo-evaldata-prune"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#evaldata-prune",
					versionAdded: "1.9.37",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToRemove",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "obligatoryProps",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "evaldata-prune.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#evaldata-prunejs-",
					versionAdded: "1.49.3rc15",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToRemove",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "obligatoryProps",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "fingerprintjs2",
					aliases: [
						"ubo-fingerprint2.js",
						"fingerprint2.js"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#fingerprintjs2",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "fingerprintjs3",
					aliases: [
						"ubo-fingerprint3.js",
						"fingerprint3.js"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#fingerprintjs3",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "gemius",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#gemius",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "google-analytics-ga",
					aliases: [
						"ubo-google-analytics_ga.js",
						"google-analytics_ga.js"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#google-analytics-ga",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "google-analytics",
					aliases: [
						"ubo-google-analytics_analytics.js",
						"google-analytics_analytics.js",
						"googletagmanager-gtm",
						"ubo-googletagmanager_gtm.js",
						"googletagmanager_gtm.js"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#google-analytics",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "google-ima3",
					aliases: [
						"ubo-google-ima.js",
						"google-ima.js"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#google-ima3",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "googlesyndication-adsbygoogle",
					aliases: [
						"ubo-googlesyndication_adsbygoogle.js",
						"googlesyndication_adsbygoogle.js"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#googlesyndication-adsbygoogle",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "googletagservices-gpt",
					aliases: [
						"ubo-googletagservices_gpt.js",
						"googletagservices_gpt.js"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#googletagservices-gpt",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "hide-in-shadow-dom",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#hide-in-shadow-dom",
					versionAdded: "1.3.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "selector",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "baseSelector",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "href-sanitizer",
					aliases: [
						"href-sanitizer.js",
						"ubo-href-sanitizer.js",
						"ubo-href-sanitizer"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#href-sanitizer",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "selector",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "attribute",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "href-sanitizer.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#href-sanitizerjs-",
					versionAdded: "1.47.5b4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "selector",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "attribute",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "inject-css-in-shadow-dom",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#inject-css-in-shadow-dom",
					versionAdded: "1.8.2",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "cssRule",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "hostSelector",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "json-prune-fetch-response",
					aliases: [
						"json-prune-fetch-response.js",
						"ubo-json-prune-fetch-response.js",
						"ubo-json-prune-fetch-response"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#json-prune-fetch-response",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToRemove",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "obligatoryProps",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "propsToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "json-prune-fetch-response.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#json-prune-fetch-responsejs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToRemove",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "obligatoryProps",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "propsToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "json-prune-xhr-response",
					aliases: [
						"json-prune-xhr-response.js",
						"ubo-json-prune-xhr-response.js",
						"ubo-json-prune-xhr-response"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#json-prune-xhr-response",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToRemove",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "obligatoryProps",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "propsToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "json-prune-xhr-response.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#json-prune-xhr-responsejs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToRemove",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "obligatoryProps",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "propsToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "json-prune",
					aliases: [
						"json-prune.js",
						"ubo-json-prune.js",
						"ubo-json-prune",
						"abp-json-prune"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#json-prune",
					versionAdded: "1.1.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToRemove",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "obligatoryProps",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "json-prune.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#json-prunejs-",
					versionAdded: "1.23.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToRemove",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "obligatoryProps",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "json-prune",
					aliases: null,
					description: null,
					docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
					versionAdded: "3.9.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "rawPrunePaths",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "rawNeedlePaths",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "log-addEventListener",
					aliases: [
						"addEventListener-logger.js",
						"ubo-addEventListener-logger.js",
						"aell.js",
						"ubo-aell.js",
						"ubo-addEventListener-logger",
						"ubo-aell"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#log-addEventListener",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "log-eval",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#log-eval",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "log-on-stack-trace",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#log-on-stack-trace",
					versionAdded: "1.5.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "log",
					aliases: [
						"abp-log"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#log",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "arguments",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "m3u-prune",
					aliases: [
						"m3u-prune.js",
						"ubo-m3u-prune.js",
						"ubo-m3u-prune"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#m3u-prune",
					versionAdded: "1.9.1",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToRemove",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "urlToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "m3u-prune.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#m3u-prunejs-",
					versionAdded: "1.44.5b6",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToRemove",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "urlToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "matomo",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#matomo",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "metrika-yandex-tag",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#metrika-yandex-tag",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "metrika-yandex-watch",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#metrika-yandex-watch",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "naver-wcslog",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#naver-wcslog",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "no-protected-audience",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#no-protected-audience",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "no-topics",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#no-topics",
					versionAdded: "1.6.18",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "noeval",
					aliases: [
						"noeval.js",
						"silent-noeval.js",
						"ubo-noeval.js",
						"ubo-silent-noeval.js",
						"ubo-noeval",
						"ubo-silent-noeval"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#noeval",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "nowebrtc",
					aliases: [
						"nowebrtc.js",
						"ubo-nowebrtc.js",
						"ubo-nowebrtc"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#nowebrtc",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				},
				{
					name: "nowebrtc.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#nowebrtcjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "pardot-1.0",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#pardot-1.0",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "prebid",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prebid",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "prevent-addEventListener",
					aliases: [
						"addEventListener-defuser.js",
						"ubo-addEventListener-defuser.js",
						"aeld.js",
						"ubo-aeld.js",
						"ubo-addEventListener-defuser",
						"ubo-aeld",
						"abp-prevent-listener"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-addEventListener",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "typeSearch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "listenerSearch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "addEventListener-defuser.js",
					aliases: [
						"aeld.js",
						"prevent-addEventListener.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#addEventListener-defuserjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "typeSearch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "listenerSearch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "prevent-listener",
					aliases: null,
					description: null,
					docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
					versionAdded: "3.11.2",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "type",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "handler",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "selector",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "prevent-adfly",
					aliases: [
						"adfly-defuser.js",
						"ubo-adfly-defuser.js",
						"ubo-adfly-defuser"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-adfly",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "prevent-bab",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-bab",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "prevent-element-src-loading",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-element-src-loading",
					versionAdded: "1.6.2",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "tagName",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "match",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "prevent-eval-if",
					aliases: [
						"noeval-if.js",
						"ubo-noeval-if.js",
						"ubo-noeval-if"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-eval-if",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "search",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "noeval-if.js",
					aliases: [
						"prevent-eval-if.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#noeval-ifjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "search",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "prevent-fab-3.2.0",
					aliases: [
						"nofab.js",
						"ubo-nofab.js",
						"fuckadblock.js-3.2.0",
						"ubo-fuckadblock.js-3.2.0",
						"ubo-nofab"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-fab-3.2.0",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "prevent-fetch",
					aliases: [
						"prevent-fetch.js",
						"no-fetch-if.js",
						"ubo-no-fetch-if.js",
						"ubo-no-fetch-if"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-fetch",
					versionAdded: "1.3.18",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "responseBody",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "responseType",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "prevent-fetch.js",
					aliases: [
						"no-fetch-if.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#prevent-fetchjs-",
					versionAdded: "1.31.3b9",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "responseBody",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "responseType",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "prevent-popads-net",
					aliases: [
						"popads.net.js",
						"ubo-popads.net.js",
						"ubo-popads.net"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-popads-net",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "prevent-refresh",
					aliases: [
						"prevent-refresh.js",
						"refresh-defuser.js",
						"refresh-defuser",
						"ubo-prevent-refresh.js",
						"ubo-prevent-refresh",
						"ubo-refresh-defuser.js",
						"ubo-refresh-defuser"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-refresh",
					versionAdded: "1.6.2",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "delay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "prevent-refresh.js",
					aliases: [
						"refresh-defuser.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#prevent-refreshjs-",
					versionAdded: "1.38.7b3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "delay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "prevent-requestAnimationFrame",
					aliases: [
						"no-requestAnimationFrame-if.js",
						"ubo-no-requestAnimationFrame-if.js",
						"norafif.js",
						"ubo-norafif.js",
						"ubo-no-requestAnimationFrame-if",
						"ubo-norafif"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-requestAnimationFrame",
					versionAdded: "1.1.15",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "search",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "no-requestAnimationFrame-if.js",
					aliases: [
						"norafif.js",
						"prevent-requestAnimationFrame.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#no-requestAnimationFrame-ifjs-",
					versionAdded: "1.27.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "search",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "prevent-setInterval",
					aliases: [
						"no-setInterval-if.js",
						"ubo-no-setInterval-if.js",
						"setInterval-defuser.js",
						"ubo-setInterval-defuser.js",
						"nosiif.js",
						"ubo-nosiif.js",
						"sid.js",
						"ubo-sid.js",
						"ubo-no-setInterval-if",
						"ubo-setInterval-defuser",
						"ubo-nosiif",
						"ubo-sid"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-setInterval",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "matchCallback",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "matchDelay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "no-setInterval-if.js",
					aliases: [
						"nosiif.js",
						"prevent-setInterval.js",
						"setInterval-defuser.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#no-setInterval-ifjs-",
					versionAdded: "1.23.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "matchCallback",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "matchDelay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "prevent-setTimeout",
					aliases: [
						"no-setTimeout-if.js",
						"ubo-no-setTimeout-if.js",
						"nostif.js",
						"ubo-nostif.js",
						"ubo-no-setTimeout-if",
						"ubo-nostif",
						"setTimeout-defuser.js",
						"ubo-setTimeout-defuser.js",
						"ubo-setTimeout-defuser",
						"std.js",
						"ubo-std.js",
						"ubo-std"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-setTimeout",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "matchCallback",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "matchDelay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "no-setTimeout-if.js",
					aliases: [
						"nostif.js",
						"prevent-setTimeout.js",
						"setTimeout-defuser.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#no-setTimeout-ifjs-",
					versionAdded: "1.23.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "matchCallback",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "matchDelay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "prevent-window-open",
					aliases: [
						"window.open-defuser.js",
						"ubo-window.open-defuser.js",
						"ubo-window.open-defuser",
						"nowoif.js",
						"ubo-nowoif.js",
						"ubo-nowoif",
						"no-window-open-if.js",
						"ubo-no-window-open-if.js",
						"ubo-no-window-open-if"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-window-open",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "match",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "delay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "replacement",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "no-window-open-if.js",
					aliases: [
						"nowoif.js",
						"prevent-window-open.js",
						"window.open-defuser.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#no-window-open-ifjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "match",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "delay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "replacement",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "prevent-xhr",
					aliases: [
						"no-xhr-if.js",
						"ubo-no-xhr-if.js",
						"ubo-no-xhr-if"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-xhr",
					versionAdded: "1.5.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "randomize",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "no-xhr-if.js",
					aliases: [
						"prevent-xhr.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#no-xhr-ifjs-",
					versionAdded: "1.38.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "randomize",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "remove-attr",
					aliases: [
						"remove-attr.js",
						"ubo-remove-attr.js",
						"ra.js",
						"ubo-ra.js",
						"ubo-remove-attr",
						"ubo-ra"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#remove-attr",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "attrs",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "selector",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "applying",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "remove-attr.js",
					aliases: [
						"ra.js",
						"ra",
						"remove-attr"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#remove-attrjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "attrs",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "selector",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "applying",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "remove-class",
					aliases: [
						"remove-class.js",
						"ubo-remove-class.js",
						"rc.js",
						"ubo-rc.js",
						"ubo-remove-class",
						"ubo-rc"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#remove-class",
					versionAdded: "1.1.1",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "classes",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "selector",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "applying",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "remove-class.js",
					aliases: [
						"rc.js",
						"rc",
						"remove-class"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#remove-classjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "classes",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "selector",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "applying",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "remove-cookie",
					aliases: [
						"cookie-remover.js",
						"ubo-cookie-remover.js",
						"ubo-cookie-remover",
						"remove-cookie.js",
						"ubo-remove-cookie.js",
						"ubo-remove-cookie",
						"abp-cookie-remover"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#remove-cookie",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "match",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "remove-cookie.js",
					aliases: [
						"cookie-remover.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#remove-cookiejs-",
					versionAdded: "1.28.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "match",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "cookie-remover",
					aliases: null,
					description: null,
					docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
					versionAdded: "3.11.2",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "cookie",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "autoRemoveCookie",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "remove-in-shadow-dom",
					aliases: null,
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#remove-in-shadow-dom",
					versionAdded: "1.3.14",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "selector",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "baseSelector",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "remove-node-text",
					aliases: [
						"remove-node-text.js",
						"ubo-remove-node-text.js",
						"rmnt.js",
						"ubo-rmnt.js",
						"ubo-remove-node-text",
						"ubo-rmnt"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#remove-node-text",
					versionAdded: "1.9.37",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "nodeName",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "textMatch",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "remove-node-text.js",
					aliases: [
						"rmnt.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#remove-node-textjs-",
					versionAdded: "1.49.3rc15",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "nodeName",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "textMatch",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "scorecardresearch-beacon",
					aliases: [
						"ubo-scorecardresearch_beacon.js",
						"scorecardresearch_beacon.js"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#scorecardresearch-beacon",
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "set-attr",
					aliases: [
						"set-attr.js",
						"ubo-set-attr.js",
						"ubo-set-attr"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-attr",
					versionAdded: "1.5.0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "selector",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "attr",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "set-attr.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#set-attrjs-",
					versionAdded: "1.50.1b16",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "selector",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "attr",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "set-constant",
					aliases: [
						"set-constant.js",
						"ubo-set-constant.js",
						"set.js",
						"ubo-set.js",
						"ubo-set-constant",
						"ubo-set"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-constant",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "valueWrapper",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "setProxyTrap",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "set-constant.js",
					aliases: [
						"set.js"
					],
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#set-constantjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "chain",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "rawValue",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "runAt",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "override-property-read",
					aliases: null,
					description: null,
					docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
					versionAdded: "3.9.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "setConfigurable",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1,
				"16384": 2,
				"32768": 2,
				"65536": 2,
				"131072": 2
			}
		},
		{
			shared: [
				{
					name: "set-cookie-reload",
					aliases: [
						"set-cookie-reload.js",
						"ubo-set-cookie-reload.js",
						"ubo-set-cookie-reload"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-cookie-reload",
					versionAdded: "1.3.14",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "name",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "path",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "domain",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "set-cookie-reload.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#set-cookie-reloadjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "name",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "path",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "domain",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "set-cookie",
					aliases: [
						"set-cookie.js",
						"ubo-set-cookie.js",
						"ubo-set-cookie"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-cookie",
					versionAdded: "1.2.3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "name",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "path",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "set-cookie.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#set-cookiejs-",
					versionAdded: "1.50.1b0",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "name",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "path",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "set-local-storage-item",
					aliases: [
						"set-local-storage-item.js",
						"ubo-set-local-storage-item.js",
						"ubo-set-local-storage-item"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-local-storage-item",
					versionAdded: "1.4.3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "key",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "set-local-storage-item.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#set-local-storage-itemjs-",
					versionAdded: "1.50.1b4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "key",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "set-popads-dummy",
					aliases: [
						"popads-dummy.js",
						"ubo-popads-dummy.js",
						"ubo-popads-dummy"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-popads-dummy",
					versionAdded: "1.0.4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "set-session-storage-item",
					aliases: [
						"set-session-storage-item.js",
						"ubo-set-session-storage-item.js",
						"ubo-set-session-storage-item"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-session-storage-item",
					versionAdded: "1.4.3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "key",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "set-session-storage-item.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#set-session-storage-itemjs-",
					versionAdded: "1.50.1b4",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "key",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "spoof-css",
					aliases: [
						"spoof-css.js",
						"ubo-spoof-css.js",
						"ubo-spoof-css"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#spoof-css",
					versionAdded: "1.10.1",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "selectors",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "cssPropertyName",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "cssPropertyValue",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "spoof-css.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#spoof-cssjs-",
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "selectors",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "cssPropertyName",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "cssPropertyValue",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "arguments",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		},
		{
			shared: [
				{
					name: "trusted-click-element",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: "1.7.3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "selectors",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "extraMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "delay",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "trusted-create-element",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: "1.10.1",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "parentSelector",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "tagName",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "attributePairs",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "textContent",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "cleanupDelayMs",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "trusted-dispatch-event",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: null,
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "event",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "target",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "trusted-prune-inbound-object",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: "1.9.91",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "functionName",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "propsToRemove",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "obligatoryProps",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "trusted-replace-fetch-response",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: "1.7.3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "pattern",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "replacement",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "propsToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "trusted-replace-node-text",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: "1.9.37",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "nodeName",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "textMatch",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "pattern",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "replacement",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "trusted-replace-xhr-response",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: "1.7.3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "pattern",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "replacement",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "propsToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "trusted-set-attr",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: "1.10.1",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "selector",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "attr",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "trusted-set-constant",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: "1.8.2",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "property",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "trusted-set-cookie-reload",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: "1.7.10",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "name",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "offsetExpiresSec",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "path",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "domain",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "trusted-set-cookie",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: "1.7.3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "name",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "offsetExpiresSec",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "path",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "domain",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "trusted-set-local-storage-item",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: "1.7.3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "key",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "value",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "trusted-suppress-native-method",
					aliases: null,
					description: null,
					docs: null,
					versionAdded: "1.10.25",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "methodPath",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "signatureStr",
							required: true,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "how",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "stack",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0
			}
		},
		{
			shared: [
				{
					name: "xml-prune",
					aliases: [
						"xml-prune.js",
						"ubo-xml-prune.js",
						"ubo-xml-prune"
					],
					description: null,
					docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#xml-prune",
					versionAdded: "1.7.3",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "optionalProp",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "urlToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				},
				{
					name: "xml-prune.js",
					aliases: null,
					description: null,
					docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#xml-prunejs-",
					versionAdded: "1.49.3rc6",
					versionRemoved: null,
					deprecated: false,
					deprecationMessage: null,
					removed: false,
					removalMessage: null,
					parameters: [
						{
							name: "propsToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "optionalProp",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						},
						{
							name: "urlToMatch",
							required: false,
							description: null,
							pattern: null,
							"default": null,
							debug: false
						}
					]
				}
			],
			map: {
				"1": 0,
				"2": 0,
				"4": 0,
				"8": 0,
				"16": 0,
				"32": 0,
				"64": 0,
				"1024": 1,
				"2048": 1,
				"4096": 1,
				"8192": 1
			}
		}
	],
	map: {
		"abort-current-inline-script": 0,
		"abort-current-script.js": 0,
		"ubo-abort-current-script.js": 0,
		"acs.js": 0,
		"ubo-acs.js": 0,
		"ubo-abort-current-script": 0,
		"ubo-acs": 0,
		"abort-current-inline-script.js": 0,
		"ubo-abort-current-inline-script.js": 0,
		"acis.js": 0,
		"ubo-acis.js": 0,
		"ubo-abort-current-inline-script": 0,
		"ubo-acis": 0,
		"abp-abort-current-inline-script": 0,
		"abort-on-property-read": 1,
		"abort-on-property-read.js": 1,
		"ubo-abort-on-property-read.js": 1,
		"aopr.js": 1,
		"ubo-aopr.js": 1,
		"ubo-abort-on-property-read": 1,
		"ubo-aopr": 1,
		"abp-abort-on-property-read": 1,
		"abort-on-property-write": 2,
		"abort-on-property-write.js": 2,
		"ubo-abort-on-property-write.js": 2,
		"aopw.js": 2,
		"ubo-aopw.js": 2,
		"ubo-abort-on-property-write": 2,
		"ubo-aopw": 2,
		"abp-abort-on-property-write": 2,
		"abort-on-stack-trace": 3,
		"abort-on-stack-trace.js": 3,
		"ubo-abort-on-stack-trace.js": 3,
		"aost.js": 3,
		"ubo-aost.js": 3,
		"ubo-abort-on-stack-trace": 3,
		"ubo-aost": 3,
		"abp-abort-on-stack-trace": 3,
		"adjust-setInterval": 4,
		"nano-setInterval-booster.js": 4,
		"ubo-nano-setInterval-booster.js": 4,
		"nano-sib.js": 4,
		"ubo-nano-sib.js": 4,
		"adjust-setInterval.js": 4,
		"ubo-adjust-setInterval.js": 4,
		"ubo-nano-setInterval-booster": 4,
		"ubo-nano-sib": 4,
		"ubo-adjust-setInterval": 4,
		"adjust-setTimeout": 5,
		"adjust-setTimeout.js": 5,
		"ubo-adjust-setTimeout.js": 5,
		"nano-setTimeout-booster.js": 5,
		"ubo-nano-setTimeout-booster.js": 5,
		"nano-stb.js": 5,
		"ubo-nano-stb.js": 5,
		"ubo-adjust-setTimeout": 5,
		"ubo-nano-setTimeout-booster": 5,
		"ubo-nano-stb": 5,
		"amazon-apstag": 6,
		"ubo-amazon_apstag.js": 6,
		"amazon_apstag.js": 6,
		"call-nothrow": 7,
		"call-nothrow.js": 7,
		"ubo-call-nothrow.js": 7,
		"ubo-call-nothrow": 7,
		"close-window": 8,
		"window-close-if.js": 8,
		"ubo-window-close-if.js": 8,
		"ubo-window-close-if": 8,
		"close-window.js": 8,
		"ubo-close-window.js": 8,
		"ubo-close-window": 8,
		"debug-current-inline-script": 9,
		"debug-on-property-read": 10,
		"debug-on-property-write": 11,
		"didomi-loader": 12,
		"dir-string": 13,
		"disable-newtab-links": 14,
		"disable-newtab-links.js": 14,
		"ubo-disable-newtab-links.js": 14,
		"ubo-disable-newtab-links": 14,
		"evaldata-prune": 15,
		"evaldata-prune.js": 15,
		"ubo-evaldata-prune.js": 15,
		"ubo-evaldata-prune": 15,
		fingerprintjs2: 16,
		"ubo-fingerprint2.js": 16,
		"fingerprint2.js": 16,
		fingerprintjs3: 17,
		"ubo-fingerprint3.js": 17,
		"fingerprint3.js": 17,
		gemius: 18,
		"google-analytics-ga": 19,
		"ubo-google-analytics_ga.js": 19,
		"google-analytics_ga.js": 19,
		"google-analytics": 20,
		"ubo-google-analytics_analytics.js": 20,
		"google-analytics_analytics.js": 20,
		"googletagmanager-gtm": 20,
		"ubo-googletagmanager_gtm.js": 20,
		"googletagmanager_gtm.js": 20,
		"google-ima3": 21,
		"ubo-google-ima.js": 21,
		"google-ima.js": 21,
		"googlesyndication-adsbygoogle": 22,
		"ubo-googlesyndication_adsbygoogle.js": 22,
		"googlesyndication_adsbygoogle.js": 22,
		"googletagservices-gpt": 23,
		"ubo-googletagservices_gpt.js": 23,
		"googletagservices_gpt.js": 23,
		"hide-in-shadow-dom": 24,
		"href-sanitizer": 25,
		"href-sanitizer.js": 25,
		"ubo-href-sanitizer.js": 25,
		"ubo-href-sanitizer": 25,
		"inject-css-in-shadow-dom": 26,
		"json-prune-fetch-response": 27,
		"json-prune-fetch-response.js": 27,
		"ubo-json-prune-fetch-response.js": 27,
		"ubo-json-prune-fetch-response": 27,
		"json-prune-xhr-response": 28,
		"json-prune-xhr-response.js": 28,
		"ubo-json-prune-xhr-response.js": 28,
		"ubo-json-prune-xhr-response": 28,
		"json-prune": 29,
		"json-prune.js": 29,
		"ubo-json-prune.js": 29,
		"ubo-json-prune": 29,
		"abp-json-prune": 29,
		"log-addEventListener": 30,
		"addEventListener-logger.js": 30,
		"ubo-addEventListener-logger.js": 30,
		"aell.js": 30,
		"ubo-aell.js": 30,
		"ubo-addEventListener-logger": 30,
		"ubo-aell": 30,
		"log-eval": 31,
		"log-on-stack-trace": 32,
		log: 33,
		"abp-log": 33,
		"m3u-prune": 34,
		"m3u-prune.js": 34,
		"ubo-m3u-prune.js": 34,
		"ubo-m3u-prune": 34,
		matomo: 35,
		"metrika-yandex-tag": 36,
		"metrika-yandex-watch": 37,
		"naver-wcslog": 38,
		"no-protected-audience": 39,
		"no-topics": 40,
		noeval: 41,
		"noeval.js": 41,
		"silent-noeval.js": 41,
		"ubo-noeval.js": 41,
		"ubo-silent-noeval.js": 41,
		"ubo-noeval": 41,
		"ubo-silent-noeval": 41,
		nowebrtc: 42,
		"nowebrtc.js": 42,
		"ubo-nowebrtc.js": 42,
		"ubo-nowebrtc": 42,
		"pardot-1.0": 43,
		prebid: 44,
		"prevent-addEventListener": 45,
		"addEventListener-defuser.js": 45,
		"ubo-addEventListener-defuser.js": 45,
		"aeld.js": 45,
		"ubo-aeld.js": 45,
		"ubo-addEventListener-defuser": 45,
		"ubo-aeld": 45,
		"abp-prevent-listener": 45,
		"prevent-addEventListener.js": 45,
		"prevent-listener": 45,
		"prevent-adfly": 46,
		"adfly-defuser.js": 46,
		"ubo-adfly-defuser.js": 46,
		"ubo-adfly-defuser": 46,
		"prevent-bab": 47,
		"prevent-element-src-loading": 48,
		"prevent-eval-if": 49,
		"noeval-if.js": 49,
		"ubo-noeval-if.js": 49,
		"ubo-noeval-if": 49,
		"prevent-eval-if.js": 49,
		"prevent-fab-3.2.0": 50,
		"nofab.js": 50,
		"ubo-nofab.js": 50,
		"fuckadblock.js-3.2.0": 50,
		"ubo-fuckadblock.js-3.2.0": 50,
		"ubo-nofab": 50,
		"prevent-fetch": 51,
		"prevent-fetch.js": 51,
		"no-fetch-if.js": 51,
		"ubo-no-fetch-if.js": 51,
		"ubo-no-fetch-if": 51,
		"prevent-popads-net": 52,
		"popads.net.js": 52,
		"ubo-popads.net.js": 52,
		"ubo-popads.net": 52,
		"prevent-refresh": 53,
		"prevent-refresh.js": 53,
		"refresh-defuser.js": 53,
		"refresh-defuser": 53,
		"ubo-prevent-refresh.js": 53,
		"ubo-prevent-refresh": 53,
		"ubo-refresh-defuser.js": 53,
		"ubo-refresh-defuser": 53,
		"prevent-requestAnimationFrame": 54,
		"no-requestAnimationFrame-if.js": 54,
		"ubo-no-requestAnimationFrame-if.js": 54,
		"norafif.js": 54,
		"ubo-norafif.js": 54,
		"ubo-no-requestAnimationFrame-if": 54,
		"ubo-norafif": 54,
		"prevent-requestAnimationFrame.js": 54,
		"prevent-setInterval": 55,
		"no-setInterval-if.js": 55,
		"ubo-no-setInterval-if.js": 55,
		"setInterval-defuser.js": 55,
		"ubo-setInterval-defuser.js": 55,
		"nosiif.js": 55,
		"ubo-nosiif.js": 55,
		"sid.js": 55,
		"ubo-sid.js": 55,
		"ubo-no-setInterval-if": 55,
		"ubo-setInterval-defuser": 55,
		"ubo-nosiif": 55,
		"ubo-sid": 55,
		"prevent-setInterval.js": 55,
		"prevent-setTimeout": 56,
		"no-setTimeout-if.js": 56,
		"ubo-no-setTimeout-if.js": 56,
		"nostif.js": 56,
		"ubo-nostif.js": 56,
		"ubo-no-setTimeout-if": 56,
		"ubo-nostif": 56,
		"setTimeout-defuser.js": 56,
		"ubo-setTimeout-defuser.js": 56,
		"ubo-setTimeout-defuser": 56,
		"std.js": 56,
		"ubo-std.js": 56,
		"ubo-std": 56,
		"prevent-setTimeout.js": 56,
		"prevent-window-open": 57,
		"window.open-defuser.js": 57,
		"ubo-window.open-defuser.js": 57,
		"ubo-window.open-defuser": 57,
		"nowoif.js": 57,
		"ubo-nowoif.js": 57,
		"ubo-nowoif": 57,
		"no-window-open-if.js": 57,
		"ubo-no-window-open-if.js": 57,
		"ubo-no-window-open-if": 57,
		"prevent-window-open.js": 57,
		"prevent-xhr": 58,
		"no-xhr-if.js": 58,
		"ubo-no-xhr-if.js": 58,
		"ubo-no-xhr-if": 58,
		"prevent-xhr.js": 58,
		"remove-attr": 59,
		"remove-attr.js": 59,
		"ubo-remove-attr.js": 59,
		"ra.js": 59,
		"ubo-ra.js": 59,
		"ubo-remove-attr": 59,
		"ubo-ra": 59,
		ra: 59,
		"remove-class": 60,
		"remove-class.js": 60,
		"ubo-remove-class.js": 60,
		"rc.js": 60,
		"ubo-rc.js": 60,
		"ubo-remove-class": 60,
		"ubo-rc": 60,
		rc: 60,
		"remove-cookie": 61,
		"cookie-remover.js": 61,
		"ubo-cookie-remover.js": 61,
		"ubo-cookie-remover": 61,
		"remove-cookie.js": 61,
		"ubo-remove-cookie.js": 61,
		"ubo-remove-cookie": 61,
		"abp-cookie-remover": 61,
		"cookie-remover": 61,
		"remove-in-shadow-dom": 62,
		"remove-node-text": 63,
		"remove-node-text.js": 63,
		"ubo-remove-node-text.js": 63,
		"rmnt.js": 63,
		"ubo-rmnt.js": 63,
		"ubo-remove-node-text": 63,
		"ubo-rmnt": 63,
		"scorecardresearch-beacon": 64,
		"ubo-scorecardresearch_beacon.js": 64,
		"scorecardresearch_beacon.js": 64,
		"set-attr": 65,
		"set-attr.js": 65,
		"ubo-set-attr.js": 65,
		"ubo-set-attr": 65,
		"set-constant": 66,
		"set-constant.js": 66,
		"ubo-set-constant.js": 66,
		"set.js": 66,
		"ubo-set.js": 66,
		"ubo-set-constant": 66,
		"ubo-set": 66,
		"override-property-read": 66,
		"set-cookie-reload": 67,
		"set-cookie-reload.js": 67,
		"ubo-set-cookie-reload.js": 67,
		"ubo-set-cookie-reload": 67,
		"set-cookie": 68,
		"set-cookie.js": 68,
		"ubo-set-cookie.js": 68,
		"ubo-set-cookie": 68,
		"set-local-storage-item": 69,
		"set-local-storage-item.js": 69,
		"ubo-set-local-storage-item.js": 69,
		"ubo-set-local-storage-item": 69,
		"set-popads-dummy": 70,
		"popads-dummy.js": 70,
		"ubo-popads-dummy.js": 70,
		"ubo-popads-dummy": 70,
		"set-session-storage-item": 71,
		"set-session-storage-item.js": 71,
		"ubo-set-session-storage-item.js": 71,
		"ubo-set-session-storage-item": 71,
		"spoof-css": 72,
		"spoof-css.js": 72,
		"ubo-spoof-css.js": 72,
		"ubo-spoof-css": 72,
		"trusted-click-element": 73,
		"trusted-create-element": 74,
		"trusted-dispatch-event": 75,
		"trusted-prune-inbound-object": 76,
		"trusted-replace-fetch-response": 77,
		"trusted-replace-node-text": 78,
		"trusted-replace-xhr-response": 79,
		"trusted-set-attr": 80,
		"trusted-set-constant": 81,
		"trusted-set-cookie-reload": 82,
		"trusted-set-cookie": 83,
		"trusted-set-local-storage-item": 84,
		"trusted-suppress-native-method": 85,
		"xml-prune": 86,
		"xml-prune.js": 86,
		"ubo-xml-prune.js": 86,
		"ubo-xml-prune": 86
	}
};
var compatibilityTableData = {
	modifiersCompatibilityTableData: modifiersCompatibilityTableData,
	redirectsCompatibilityTableData: redirectsCompatibilityTableData,
	scriptletsCompatibilityTableData: scriptletsCompatibilityTableData
};
compatibilityTableData$1.default = compatibilityTableData;
var modifiersCompatibilityTableData_1 = compatibilityTableData$1.modifiersCompatibilityTableData = modifiersCompatibilityTableData;
var redirectsCompatibilityTableData_1 = compatibilityTableData$1.redirectsCompatibilityTableData = redirectsCompatibilityTableData;
var scriptletsCompatibilityTableData_1 = compatibilityTableData$1.scriptletsCompatibilityTableData = scriptletsCompatibilityTableData;

var AdblockSyntax;
(function (AdblockSyntax) {
    AdblockSyntax["Common"] = "Common";
    AdblockSyntax["Abp"] = "AdblockPlus";
    AdblockSyntax["Ubo"] = "UblockOrigin";
    AdblockSyntax["Adg"] = "AdGuard";
})(AdblockSyntax || (AdblockSyntax = {}));
const EMPTY = '';
const SPACE$1 = ' ';
const TAB = '\t';
const COLON = ':';
const COMMA = ',';
const DOT = '.';
const SEMICOLON = ';';
const AMPERSAND = '&';
const ASTERISK = '*';
const AT_SIGN = '@';
const CARET = '^';
const DOLLAR_SIGN = '$';
const EQUALS = '=';
const EXCLAMATION_MARK = '!';
const HASHMARK = '#';
const PIPE = '|';
const PLUS = '+';
const QUESTION_MARK = '?';
const SLASH = '/';
const UNDERSCORE = '_';
const BACKSLASH = '\\';
const ESCAPE_CHARACTER = BACKSLASH;
const CR$1 = '\r';
const FF$1 = '\f';
const LF$2 = '\n';
const CRLF = CR$1 + LF$2;
const BACKTICK_QUOTE = '`';
const DOUBLE_QUOTE = '"';
const SINGLE_QUOTE = '\'';
const OPEN_PARENTHESIS = '(';
const CLOSE_PARENTHESIS = ')';
const OPEN_SQUARE_BRACKET = '[';
const CLOSE_SQUARE_BRACKET = ']';
const OPEN_CURLY_BRACKET = '{';
const CLOSE_CURLY_BRACKET = '}';
const SMALL_LETTER_A = 'a';
const SMALL_LETTER_B = 'b';
const SMALL_LETTER_C = 'c';
const SMALL_LETTER_D = 'd';
const SMALL_LETTER_E = 'e';
const SMALL_LETTER_F = 'f';
const SMALL_LETTER_G = 'g';
const SMALL_LETTER_H = 'h';
const SMALL_LETTER_I = 'i';
const SMALL_LETTER_J = 'j';
const SMALL_LETTER_K = 'k';
const SMALL_LETTER_L = 'l';
const SMALL_LETTER_M = 'm';
const SMALL_LETTER_N = 'n';
const SMALL_LETTER_O = 'o';
const SMALL_LETTER_P = 'p';
const SMALL_LETTER_Q = 'q';
const SMALL_LETTER_R = 'r';
const SMALL_LETTER_S = 's';
const SMALL_LETTER_T = 't';
const SMALL_LETTER_U = 'u';
const SMALL_LETTER_V = 'v';
const SMALL_LETTER_W = 'w';
const SMALL_LETTER_X = 'x';
const SMALL_LETTER_Y = 'y';
const SMALL_LETTER_Z = 'z';
const SMALL_LETTERS = new Set([
    SMALL_LETTER_A,
    SMALL_LETTER_B,
    SMALL_LETTER_C,
    SMALL_LETTER_D,
    SMALL_LETTER_E,
    SMALL_LETTER_F,
    SMALL_LETTER_G,
    SMALL_LETTER_H,
    SMALL_LETTER_I,
    SMALL_LETTER_J,
    SMALL_LETTER_K,
    SMALL_LETTER_L,
    SMALL_LETTER_M,
    SMALL_LETTER_N,
    SMALL_LETTER_O,
    SMALL_LETTER_P,
    SMALL_LETTER_Q,
    SMALL_LETTER_R,
    SMALL_LETTER_S,
    SMALL_LETTER_T,
    SMALL_LETTER_U,
    SMALL_LETTER_V,
    SMALL_LETTER_W,
    SMALL_LETTER_X,
    SMALL_LETTER_Y,
    SMALL_LETTER_Z,
]);
const CAPITAL_LETTER_A = 'A';
const CAPITAL_LETTER_B = 'B';
const CAPITAL_LETTER_C = 'C';
const CAPITAL_LETTER_D = 'D';
const CAPITAL_LETTER_E = 'E';
const CAPITAL_LETTER_F = 'F';
const CAPITAL_LETTER_G = 'G';
const CAPITAL_LETTER_H = 'H';
const CAPITAL_LETTER_I = 'I';
const CAPITAL_LETTER_J = 'J';
const CAPITAL_LETTER_K = 'K';
const CAPITAL_LETTER_L = 'L';
const CAPITAL_LETTER_M = 'M';
const CAPITAL_LETTER_N = 'N';
const CAPITAL_LETTER_O = 'O';
const CAPITAL_LETTER_P = 'P';
const CAPITAL_LETTER_Q = 'Q';
const CAPITAL_LETTER_R = 'R';
const CAPITAL_LETTER_S = 'S';
const CAPITAL_LETTER_T = 'T';
const CAPITAL_LETTER_U = 'U';
const CAPITAL_LETTER_V = 'V';
const CAPITAL_LETTER_W = 'W';
const CAPITAL_LETTER_X = 'X';
const CAPITAL_LETTER_Y = 'Y';
const CAPITAL_LETTER_Z = 'Z';
const CAPITAL_LETTERS = new Set([
    CAPITAL_LETTER_A,
    CAPITAL_LETTER_B,
    CAPITAL_LETTER_C,
    CAPITAL_LETTER_D,
    CAPITAL_LETTER_E,
    CAPITAL_LETTER_F,
    CAPITAL_LETTER_G,
    CAPITAL_LETTER_H,
    CAPITAL_LETTER_I,
    CAPITAL_LETTER_J,
    CAPITAL_LETTER_K,
    CAPITAL_LETTER_L,
    CAPITAL_LETTER_M,
    CAPITAL_LETTER_N,
    CAPITAL_LETTER_O,
    CAPITAL_LETTER_P,
    CAPITAL_LETTER_Q,
    CAPITAL_LETTER_R,
    CAPITAL_LETTER_S,
    CAPITAL_LETTER_T,
    CAPITAL_LETTER_U,
    CAPITAL_LETTER_V,
    CAPITAL_LETTER_W,
    CAPITAL_LETTER_X,
    CAPITAL_LETTER_Y,
    CAPITAL_LETTER_Z,
]);
const NUMBER_0 = '0';
const NUMBER_1 = '1';
const NUMBER_2 = '2';
const NUMBER_3 = '3';
const NUMBER_4 = '4';
const NUMBER_5 = '5';
const NUMBER_6 = '6';
const NUMBER_7 = '7';
const NUMBER_8 = '8';
const NUMBER_9 = '9';
const NUMBERS = new Set([
    NUMBER_0,
    NUMBER_1,
    NUMBER_2,
    NUMBER_3,
    NUMBER_4,
    NUMBER_5,
    NUMBER_6,
    NUMBER_7,
    NUMBER_8,
    NUMBER_9,
]);
const REGEX_MARKER = '/';
const ADG_SCRIPTLET_MASK = '//scriptlet';
const UBO_SCRIPTLET_MASK = '+js';
const UBO_SCRIPTLET_MASK_LEGACY = 'script:inject';
const UBO_HTML_MASK = '^';
const MODIFIERS_SEPARATOR = ',';
const MODIFIER_ASSIGN_OPERATOR = '=';
const NEGATION_MARKER = '~';
const WILDCARD$1 = ASTERISK;
const COMMA_DOMAIN_LIST_SEPARATOR = ',';
const PIPE_MODIFIER_SEPARATOR = '|';
const CSS_MEDIA_MARKER = '@media';
const CSS_NOT_PSEUDO = 'not';
const HINT_MARKER = '!+';
const HINT_MARKER_LEN = HINT_MARKER.length;
const NETWORK_RULE_EXCEPTION_MARKER = '@@';
const NETWORK_RULE_EXCEPTION_MARKER_LEN = NETWORK_RULE_EXCEPTION_MARKER.length;
const NETWORK_RULE_SEPARATOR = '$';
const AGLINT_COMMAND_PREFIX = 'aglint';
const AGLINT_CONFIG_COMMENT_MARKER = '--';
const PREPROCESSOR_MARKER = '!#';
const PREPROCESSOR_MARKER_LEN = PREPROCESSOR_MARKER.length;
const PREPROCESSOR_SEPARATOR = ' ';
const SAFARI_CB_AFFINITY = 'safari_cb_affinity';
const IF = 'if';
const INCLUDE = 'include';
const NULL = 0;
const UINT8_MAX = 255;
const UINT16_MAX = 65535;
const SINGLE_QUOTE_MARKER = "'";
const DOUBLE_QUOTE_MARKER = '"';
class StringUtils {
    static findNextUnescapedCharacter(pattern, searchedCharacter, start = 0, escapeCharacter = ESCAPE_CHARACTER) {
        for (let i = start; i < pattern.length; i += 1) {
            if (pattern[i] === searchedCharacter && pattern[i - 1] !== escapeCharacter) {
                return i;
            }
        }
        return -1;
    }
    static findNextUnescapedCharacterBackwards(pattern, searchedCharacter, start = pattern.length - 1, escapeCharacter = ESCAPE_CHARACTER) {
        for (let i = start; i >= 0; i -= 1) {
            if (pattern[i] === searchedCharacter && pattern[i - 1] !== escapeCharacter) {
                return i;
            }
        }
        return -1;
    }
    static findLastUnescapedCharacter(pattern, searchedCharacter, escapeCharacter = ESCAPE_CHARACTER) {
        for (let i = pattern.length - 1; i >= 0; i -= 1) {
            if (pattern[i] === searchedCharacter && pattern[i - 1] !== escapeCharacter) {
                return i;
            }
        }
        return -1;
    }
    static findNextUnescapedCharacterThatNotFollowedBy(pattern, start, searchedCharacter, notFollowedBy, escapeCharacter = ESCAPE_CHARACTER) {
        for (let i = start; i < pattern.length; i += 1) {
            if (pattern[i] === searchedCharacter
                && pattern[i + 1] !== notFollowedBy
                && pattern[i - 1] !== escapeCharacter) {
                return i;
            }
        }
        return -1;
    }
    static findLastUnescapedCharacterThatNotFollowedBy(pattern, searchedCharacter, notFollowedBy, escapeCharacter = ESCAPE_CHARACTER) {
        for (let i = pattern.length - 1; i >= 0; i -= 1) {
            if (pattern[i] === searchedCharacter
                && pattern[i + 1] !== notFollowedBy
                && pattern[i - 1] !== escapeCharacter) {
                return i;
            }
        }
        return -1;
    }
    static findUnescapedNonStringNonRegexChar(pattern, searchedCharacter, start = 0) {
        let open = null;
        for (let i = start; i < pattern.length; i += 1) {
            if ((pattern[i] === SINGLE_QUOTE_MARKER
                || pattern[i] === DOUBLE_QUOTE_MARKER
                || pattern[i] === REGEX_MARKER)
                && pattern[i - 1] !== ESCAPE_CHARACTER) {
                if (open === pattern[i]) {
                    open = null;
                }
                else if (open === null) {
                    open = pattern[i];
                }
            }
            else if (open === null && pattern[i] === searchedCharacter && pattern[i - 1] !== ESCAPE_CHARACTER) {
                return i;
            }
        }
        return -1;
    }
    static findNextUnquotedUnescapedCharacter(pattern, searchedCharacter, start = 0, escapeCharacter = ESCAPE_CHARACTER) {
        let openQuote = null;
        for (let i = start; i < pattern.length; i += 1) {
            if ((pattern[i] === SINGLE_QUOTE_MARKER || pattern[i] === DOUBLE_QUOTE_MARKER)
                && pattern[i - 1] !== escapeCharacter) {
                if (!openQuote)
                    openQuote = pattern[i];
                else if (openQuote === pattern[i])
                    openQuote = null;
            }
            else if (pattern[i] === searchedCharacter && pattern[i - 1] !== escapeCharacter) {
                if (!openQuote) {
                    return i;
                }
            }
        }
        return -1;
    }
    static findNextNotBracketedUnescapedCharacter(pattern, searchedCharacter, start = 0, escapeCharacter = ESCAPE_CHARACTER, openBracket = '(', closeBracket = ')') {
        if (openBracket === closeBracket) {
            throw new Error('Open and close bracket cannot be the same');
        }
        let depth = 0;
        for (let i = start; i < pattern.length; i += 1) {
            if (pattern[i] === openBracket) {
                depth += 1;
            }
            else if (pattern[i] === closeBracket) {
                depth -= 1;
            }
            else if (depth < 1 && pattern[i] === searchedCharacter && pattern[i - 1] !== escapeCharacter) {
                return i;
            }
        }
        return -1;
    }
    static splitStringByUnquotedUnescapedCharacter(pattern, delimeterCharacter) {
        const parts = [];
        let delimeterIndex = -1;
        do {
            const prevDelimeterIndex = delimeterIndex;
            delimeterIndex = StringUtils.findNextUnquotedUnescapedCharacter(pattern, delimeterCharacter, delimeterIndex + 1);
            if (delimeterIndex !== -1) {
                parts.push(pattern.substring(prevDelimeterIndex + 1, delimeterIndex));
            }
            else {
                parts.push(pattern.substring(prevDelimeterIndex + 1, pattern.length));
            }
        } while (delimeterIndex !== -1);
        return parts;
    }
    static splitStringByUnescapedNonStringNonRegexChar(pattern, delimeterCharacter) {
        const parts = [];
        let delimeterIndex = -1;
        do {
            const prevDelimeterIndex = delimeterIndex;
            delimeterIndex = StringUtils.findUnescapedNonStringNonRegexChar(pattern, delimeterCharacter, delimeterIndex + 1);
            if (delimeterIndex !== -1) {
                parts.push(pattern.substring(prevDelimeterIndex + 1, delimeterIndex));
            }
            else {
                parts.push(pattern.substring(prevDelimeterIndex + 1, pattern.length));
            }
        } while (delimeterIndex !== -1);
        return parts;
    }
    static splitStringByUnescapedCharacter(pattern, delimeterCharacter) {
        const parts = [];
        let delimeterIndex = -1;
        do {
            const prevDelimeterIndex = delimeterIndex;
            delimeterIndex = StringUtils.findNextUnescapedCharacter(pattern, delimeterCharacter, delimeterIndex + 1);
            if (delimeterIndex !== -1) {
                parts.push(pattern.substring(prevDelimeterIndex + 1, delimeterIndex));
            }
            else {
                parts.push(pattern.substring(prevDelimeterIndex + 1, pattern.length));
            }
        } while (delimeterIndex !== -1);
        return parts;
    }
    static isWhitespace(char) {
        return char === SPACE$1 || char === TAB;
    }
    static isDigit(char) {
        return char >= NUMBER_0 && char <= NUMBER_9;
    }
    static isSmallLetter(char) {
        return char >= SMALL_LETTER_A && char <= SMALL_LETTER_Z;
    }
    static isCapitalLetter(char) {
        return char >= CAPITAL_LETTER_A && char <= CAPITAL_LETTER_Z;
    }
    static isLetter(char) {
        return StringUtils.isSmallLetter(char) || StringUtils.isCapitalLetter(char);
    }
    static isAlphaNumeric(char) {
        return StringUtils.isLetter(char) || StringUtils.isDigit(char);
    }
    static findFirstNonWhitespaceCharacter(pattern, start = 0) {
        for (let i = start; i < pattern.length; i += 1) {
            if (!StringUtils.isWhitespace(pattern[i])) {
                return i;
            }
        }
        return -1;
    }
    static findLastNonWhitespaceCharacter(pattern) {
        for (let i = pattern.length - 1; i >= 0; i -= 1) {
            if (!StringUtils.isWhitespace(pattern[i])) {
                return i;
            }
        }
        return -1;
    }
    static findNextWhitespaceCharacter(pattern, start = 0) {
        for (let i = start; i < pattern.length; i += 1) {
            if (StringUtils.isWhitespace(pattern[i])) {
                return i;
            }
        }
        return pattern.length;
    }
    static escapeCharacter(pattern, character, escapeCharacter = ESCAPE_CHARACTER) {
        let result = EMPTY;
        for (let i = 0; i < pattern.length; i += 1) {
            if (pattern[i] === character && pattern[i - 1] !== escapeCharacter) {
                result += escapeCharacter;
            }
            result += pattern[i];
        }
        return result;
    }
    static skipWS(pattern, start = 0) {
        let i = start;
        while (i < pattern.length && StringUtils.isWhitespace(pattern[i])) {
            i += 1;
        }
        return Math.min(i, pattern.length);
    }
    static skipWSBack(pattern, start = pattern.length - 1) {
        let i = start;
        while (i >= 0 && StringUtils.isWhitespace(pattern[i])) {
            i -= 1;
        }
        return Math.max(i, -1);
    }
    static isEOL(char) {
        return char === CR$1 || char === LF$2 || char === FF$1;
    }
    static splitStringByNewLines(input) {
        return input.split(/\r?\n/);
    }
    static splitStringByNewLinesEx(input) {
        const result = [];
        let currentLine = EMPTY;
        let newLineType = null;
        for (let i = 0; i < input.length; i += 1) {
            const char = input[i];
            if (char === CR$1) {
                if (input[i + 1] === LF$2) {
                    newLineType = 'crlf';
                    i += 1;
                }
                else {
                    newLineType = 'cr';
                }
                result.push([currentLine, newLineType]);
                currentLine = EMPTY;
                newLineType = null;
            }
            else if (char === LF$2) {
                newLineType = 'lf';
                result.push([currentLine, newLineType]);
                currentLine = EMPTY;
                newLineType = null;
            }
            else {
                currentLine += char;
            }
        }
        if (result.length === 0 || currentLine !== EMPTY) {
            result.push([currentLine, newLineType]);
        }
        return result;
    }
    static mergeStringByNewLines(input) {
        let result = EMPTY;
        for (let i = 0; i < input.length; i += 1) {
            const [line, newLineType] = input[i];
            result += line;
            if (newLineType !== null) {
                if (newLineType === 'crlf') {
                    result += CRLF;
                }
                else if (newLineType === 'cr') {
                    result += CR$1;
                }
                else {
                    result += LF$2;
                }
            }
        }
        return result;
    }
    static parseNumber(raw) {
        const result = parseInt(raw, 10);
        if (Number.isNaN(result)) {
            throw new Error('Expected a number');
        }
        return result;
    }
    static isString(value) {
        return typeof value === 'string';
    }
    static escapeCharacters(input, characters = new Set()) {
        let result = EMPTY;
        for (let i = 0; i < input.length; i += 1) {
            if (characters.has(input[i])) {
                result += ESCAPE_CHARACTER;
            }
            result += input[i];
        }
        return result;
    }
}
var OperatorValue;
(function (OperatorValue) {
    OperatorValue["Not"] = "!";
    OperatorValue["And"] = "&&";
    OperatorValue["Or"] = "||";
})(OperatorValue || (OperatorValue = {}));
var CommentMarker;
(function (CommentMarker) {
    CommentMarker["Regular"] = "!";
    CommentMarker["Hashmark"] = "#";
})(CommentMarker || (CommentMarker = {}));
var RuleCategory;
(function (RuleCategory) {
    RuleCategory["Empty"] = "Empty";
    RuleCategory["Invalid"] = "Invalid";
    RuleCategory["Comment"] = "Comment";
    RuleCategory["Cosmetic"] = "Cosmetic";
    RuleCategory["Network"] = "Network";
})(RuleCategory || (RuleCategory = {}));
var ListNodeType;
(function (ListNodeType) {
    ListNodeType["Unknown"] = "Unknown";
    ListNodeType["AppList"] = "AppList";
    ListNodeType["DomainList"] = "DomainList";
    ListNodeType["MethodList"] = "MethodList";
    ListNodeType["StealthOptionList"] = "StealthOptionList";
})(ListNodeType || (ListNodeType = {}));
var ListItemNodeType;
(function (ListItemNodeType) {
    ListItemNodeType["Unknown"] = "Unknown";
    ListItemNodeType["App"] = "App";
    ListItemNodeType["Domain"] = "Domain";
    ListItemNodeType["Method"] = "Method";
    ListItemNodeType["StealthOption"] = "StealthOption";
})(ListItemNodeType || (ListItemNodeType = {}));
var CommentRuleType;
(function (CommentRuleType) {
    CommentRuleType["AgentCommentRule"] = "AgentCommentRule";
    CommentRuleType["CommentRule"] = "CommentRule";
    CommentRuleType["ConfigCommentRule"] = "ConfigCommentRule";
    CommentRuleType["HintCommentRule"] = "HintCommentRule";
    CommentRuleType["MetadataCommentRule"] = "MetadataCommentRule";
    CommentRuleType["PreProcessorCommentRule"] = "PreProcessorCommentRule";
})(CommentRuleType || (CommentRuleType = {}));
var CosmeticRuleType;
(function (CosmeticRuleType) {
    CosmeticRuleType["ElementHidingRule"] = "ElementHidingRule";
    CosmeticRuleType["CssInjectionRule"] = "CssInjectionRule";
    CosmeticRuleType["ScriptletInjectionRule"] = "ScriptletInjectionRule";
    CosmeticRuleType["HtmlFilteringRule"] = "HtmlFilteringRule";
    CosmeticRuleType["JsInjectionRule"] = "JsInjectionRule";
})(CosmeticRuleType || (CosmeticRuleType = {}));
var CosmeticRuleSeparator;
(function (CosmeticRuleSeparator) {
    CosmeticRuleSeparator["ElementHiding"] = "##";
    CosmeticRuleSeparator["ElementHidingException"] = "#@#";
    CosmeticRuleSeparator["ExtendedElementHiding"] = "#?#";
    CosmeticRuleSeparator["ExtendedElementHidingException"] = "#@?#";
    CosmeticRuleSeparator["AbpSnippet"] = "#$#";
    CosmeticRuleSeparator["AbpSnippetException"] = "#@$#";
    CosmeticRuleSeparator["AdgCssInjection"] = "#$#";
    CosmeticRuleSeparator["AdgCssInjectionException"] = "#@$#";
    CosmeticRuleSeparator["AdgExtendedCssInjection"] = "#$?#";
    CosmeticRuleSeparator["AdgExtendedCssInjectionException"] = "#@$?#";
    CosmeticRuleSeparator["AdgJsInjection"] = "#%#";
    CosmeticRuleSeparator["AdgJsInjectionException"] = "#@%#";
    CosmeticRuleSeparator["AdgHtmlFiltering"] = "$$";
    CosmeticRuleSeparator["AdgHtmlFilteringException"] = "$@$";
})(CosmeticRuleSeparator || (CosmeticRuleSeparator = {}));
var BinaryTypeMap;
(function (BinaryTypeMap) {
    BinaryTypeMap[BinaryTypeMap["Null"] = 1] = "Null";
    BinaryTypeMap[BinaryTypeMap["Undefined"] = 2] = "Undefined";
    BinaryTypeMap[BinaryTypeMap["Boolean"] = 3] = "Boolean";
    BinaryTypeMap[BinaryTypeMap["Int"] = 4] = "Int";
    BinaryTypeMap[BinaryTypeMap["Float"] = 5] = "Float";
    BinaryTypeMap[BinaryTypeMap["NotANumber"] = 6] = "NotANumber";
    BinaryTypeMap[BinaryTypeMap["String"] = 7] = "String";
    BinaryTypeMap[BinaryTypeMap["FilterListNode"] = 8] = "FilterListNode";
    BinaryTypeMap[BinaryTypeMap["EmptyRule"] = 9] = "EmptyRule";
    BinaryTypeMap[BinaryTypeMap["InvalidRule"] = 10] = "InvalidRule";
    BinaryTypeMap[BinaryTypeMap["CommentRuleNode"] = 11] = "CommentRuleNode";
    BinaryTypeMap[BinaryTypeMap["AgentNode"] = 12] = "AgentNode";
    BinaryTypeMap[BinaryTypeMap["AgentRuleNode"] = 13] = "AgentRuleNode";
    BinaryTypeMap[BinaryTypeMap["HintNode"] = 14] = "HintNode";
    BinaryTypeMap[BinaryTypeMap["HintRuleNode"] = 15] = "HintRuleNode";
    BinaryTypeMap[BinaryTypeMap["MetadataCommentRuleNode"] = 16] = "MetadataCommentRuleNode";
    BinaryTypeMap[BinaryTypeMap["ConfigCommentRuleNode"] = 17] = "ConfigCommentRuleNode";
    BinaryTypeMap[BinaryTypeMap["PreProcessorCommentRuleNode"] = 18] = "PreProcessorCommentRuleNode";
    BinaryTypeMap[BinaryTypeMap["ConfigNode"] = 19] = "ConfigNode";
    BinaryTypeMap[BinaryTypeMap["NetworkRuleNode"] = 20] = "NetworkRuleNode";
    BinaryTypeMap[BinaryTypeMap["HostRuleNode"] = 21] = "HostRuleNode";
    BinaryTypeMap[BinaryTypeMap["ElementHidingRule"] = 22] = "ElementHidingRule";
    BinaryTypeMap[BinaryTypeMap["CssInjectionRule"] = 23] = "CssInjectionRule";
    BinaryTypeMap[BinaryTypeMap["ScriptletInjectionRule"] = 24] = "ScriptletInjectionRule";
    BinaryTypeMap[BinaryTypeMap["JsInjectionRule"] = 25] = "JsInjectionRule";
    BinaryTypeMap[BinaryTypeMap["HtmlFilteringRule"] = 26] = "HtmlFilteringRule";
    BinaryTypeMap[BinaryTypeMap["ScriptletInjectionRuleBodyNode"] = 27] = "ScriptletInjectionRuleBodyNode";
    BinaryTypeMap[BinaryTypeMap["ElementHidingRuleBody"] = 28] = "ElementHidingRuleBody";
    BinaryTypeMap[BinaryTypeMap["CssInjectionRuleBody"] = 29] = "CssInjectionRuleBody";
    BinaryTypeMap[BinaryTypeMap["HtmlFilteringRuleBody"] = 30] = "HtmlFilteringRuleBody";
    BinaryTypeMap[BinaryTypeMap["JsInjectionRuleBody"] = 31] = "JsInjectionRuleBody";
    BinaryTypeMap[BinaryTypeMap["ValueNode"] = 32] = "ValueNode";
    BinaryTypeMap[BinaryTypeMap["RawNode"] = 33] = "RawNode";
    BinaryTypeMap[BinaryTypeMap["ModifierNode"] = 34] = "ModifierNode";
    BinaryTypeMap[BinaryTypeMap["ModifierListNode"] = 35] = "ModifierListNode";
    BinaryTypeMap[BinaryTypeMap["ParameterListNode"] = 36] = "ParameterListNode";
    BinaryTypeMap[BinaryTypeMap["DomainListNode"] = 37] = "DomainListNode";
    BinaryTypeMap[BinaryTypeMap["DomainNode"] = 38] = "DomainNode";
    BinaryTypeMap[BinaryTypeMap["MethodListNode"] = 39] = "MethodListNode";
    BinaryTypeMap[BinaryTypeMap["MethodNode"] = 40] = "MethodNode";
    BinaryTypeMap[BinaryTypeMap["StealthOptionListNode"] = 41] = "StealthOptionListNode";
    BinaryTypeMap[BinaryTypeMap["StealthOptionNode"] = 42] = "StealthOptionNode";
    BinaryTypeMap[BinaryTypeMap["AppListNode"] = 43] = "AppListNode";
    BinaryTypeMap[BinaryTypeMap["AppNode"] = 44] = "AppNode";
    BinaryTypeMap[BinaryTypeMap["HostnameListNode"] = 45] = "HostnameListNode";
    BinaryTypeMap[BinaryTypeMap["InvalidRuleErrorNode"] = 46] = "InvalidRuleErrorNode";
    BinaryTypeMap[BinaryTypeMap["ExpressionVariableNode"] = 47] = "ExpressionVariableNode";
    BinaryTypeMap[BinaryTypeMap["ExpressionOperatorNode"] = 48] = "ExpressionOperatorNode";
    BinaryTypeMap[BinaryTypeMap["ExpressionParenthesisNode"] = 49] = "ExpressionParenthesisNode";
})(BinaryTypeMap || (BinaryTypeMap = {}));
const SYNTAX_SERIALIZATION_MAP = new Map([
    [AdblockSyntax.Common, 0],
    [AdblockSyntax.Abp, 1],
    [AdblockSyntax.Adg, 2],
    [AdblockSyntax.Ubo, 3],
]);
const SYNTAX_DESERIALIZATION_MAP = new Map(Array.from(SYNTAX_SERIALIZATION_MAP, ([key, value]) => [value, key]));
var NetworkRuleType;
(function (NetworkRuleType) {
    NetworkRuleType["NetworkRule"] = "NetworkRule";
    NetworkRuleType["HostRule"] = "HostRule";
})(NetworkRuleType || (NetworkRuleType = {}));
const ERROR_NAME$3 = 'AdblockSyntaxError';
class AdblockSyntaxError extends SyntaxError {
    start;
    end;
    constructor(message, start, end) {
        super(message);
        this.name = ERROR_NAME$3;
        this.start = start;
        this.end = end;
    }
}
const ERROR_NAME$2 = 'NotImplementedError';
const BASE_MESSAGE = 'Not implemented';
class NotImplementedError extends Error {
    constructor(message = undefined) {
        const fullMessage = message
            ? `${BASE_MESSAGE}: ${message}`
            : BASE_MESSAGE;
        super(fullMessage);
        this.name = ERROR_NAME$2;
    }
}
class ParserBase {
    static parse(input, options, baseOffset, ...args) {
        throw new NotImplementedError();
    }
    static generate(node) {
        throw new NotImplementedError();
    }
    static serialize(node, buffer, ...args) {
        throw new NotImplementedError();
    }
    static deserialize(buffer, node, ...args) {
        throw new NotImplementedError();
    }
}
const defaultParserOptions = Object.freeze({
    tolerant: false,
    isLocIncluded: true,
    parseAbpSpecificRules: true,
    parseUboSpecificRules: true,
    includeRaws: true,
    ignoreComments: false,
    parseHostRules: false,
});
const isUndefined = (value) => {
    return typeof value === 'undefined';
};
const isNull = (value) => {
    return value === null;
};
const isString$1 = (value) => {
    return typeof value === 'string';
};
const isArrayOfUint8Arrays = (value) => {
    return Array.isArray(value) && value.every((chunk) => chunk instanceof Uint8Array);
};
var ValueNodeSerializationMap;
(function (ValueNodeSerializationMap) {
    ValueNodeSerializationMap[ValueNodeSerializationMap["Value"] = 1] = "Value";
    ValueNodeSerializationMap[ValueNodeSerializationMap["FrequentValue"] = 2] = "FrequentValue";
    ValueNodeSerializationMap[ValueNodeSerializationMap["Start"] = 3] = "Start";
    ValueNodeSerializationMap[ValueNodeSerializationMap["End"] = 4] = "End";
})(ValueNodeSerializationMap || (ValueNodeSerializationMap = {}));
class ValueParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        const result = {
            type: 'Value',
            value: raw,
        };
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        return result;
    }
    static generate(node) {
        return node.value;
    }
    static serialize(node, buffer, frequentValuesMap, toLower = false) {
        buffer.writeUint8(BinaryTypeMap.ValueNode);
        const frequentValue = frequentValuesMap?.get(toLower ? node.value.toLowerCase() : node.value);
        if (!isUndefined(frequentValue)) {
            buffer.writeUint8(ValueNodeSerializationMap.FrequentValue);
            buffer.writeUint8(frequentValue);
        }
        else {
            buffer.writeUint8(ValueNodeSerializationMap.Value);
            buffer.writeString(node.value);
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(ValueNodeSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(ValueNodeSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node, frequentValuesMap) {
        buffer.assertUint8(BinaryTypeMap.ValueNode);
        node.type = 'Value';
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case ValueNodeSerializationMap.Value:
                    node.value = buffer.readString();
                    break;
                case ValueNodeSerializationMap.FrequentValue:
                    node.value = frequentValuesMap?.get(buffer.readUint8()) ?? EMPTY;
                    break;
                case ValueNodeSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case ValueNodeSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
}
var AgentNodeSerializationMap;
(function (AgentNodeSerializationMap) {
    AgentNodeSerializationMap[AgentNodeSerializationMap["Adblock"] = 1] = "Adblock";
    AgentNodeSerializationMap[AgentNodeSerializationMap["Version"] = 2] = "Version";
    AgentNodeSerializationMap[AgentNodeSerializationMap["Start"] = 3] = "Start";
    AgentNodeSerializationMap[AgentNodeSerializationMap["End"] = 4] = "End";
})(AgentNodeSerializationMap || (AgentNodeSerializationMap = {}));
const ADG_NAME_MARKERS = new Set([
    'adguard',
    'adg',
]);
const UBO_NAME_MARKERS = new Set([
    'ublock',
    'ublock origin',
    'ubo',
]);
const ABP_NAME_MARKERS = new Set([
    'adblock',
    'adblock plus',
    'adblockplus',
    'abp',
]);
const FREQUENT_AGENTS_DESERIALIZATION_MAP = new Map([
    [0, 'AdGuard'],
    [1, 'ADG'],
    [2, 'uBlock Origin'],
    [3, 'uBlock'],
    [4, 'uBO'],
    [5, 'Adblock Plus'],
    [6, 'AdblockPlus'],
    [7, 'ABP'],
    [8, 'AdBlock'],
]);
const FREQUENT_AGENTS_SERIALIZATION_MAP = new Map(Array.from(FREQUENT_AGENTS_DESERIALIZATION_MAP).map(([key, value]) => [value.toLowerCase(), key]));
const getAdblockSyntax = (name) => {
    let syntax = AdblockSyntax.Common;
    const lowerCaseName = name.toLowerCase();
    if (ADG_NAME_MARKERS.has(lowerCaseName)) {
        syntax = AdblockSyntax.Adg;
    }
    else if (UBO_NAME_MARKERS.has(lowerCaseName)) {
        syntax = AdblockSyntax.Ubo;
    }
    else if (ABP_NAME_MARKERS.has(lowerCaseName)) {
        syntax = AdblockSyntax.Abp;
    }
    return syntax;
};
class AgentParser extends ParserBase {
    static isValidVersion(str) {
        return valid$1(coerce$1(str)) !== null;
    }
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        let offset = 0;
        const nameStartIndex = offset;
        let nameEndIndex = offset;
        let name;
        let version;
        let syntax = AdblockSyntax.Common;
        while (offset < raw.length) {
            offset = StringUtils.skipWS(raw, offset);
            const partEnd = StringUtils.findNextWhitespaceCharacter(raw, offset);
            const part = raw.slice(offset, partEnd);
            if (AgentParser.isValidVersion(part)) {
                if (!isUndefined(version)) {
                    throw new AdblockSyntaxError('Duplicated versions are not allowed', baseOffset + offset, baseOffset + partEnd);
                }
                const parsedNamePart = raw.slice(nameStartIndex, nameEndIndex);
                name = ValueParser.parse(parsedNamePart, options, baseOffset + nameStartIndex);
                version = ValueParser.parse(part, options, baseOffset + offset);
                syntax = getAdblockSyntax(parsedNamePart);
            }
            else {
                nameEndIndex = partEnd;
            }
            offset = StringUtils.skipWS(raw, partEnd);
        }
        if (isUndefined(name)) {
            const parsedNamePart = raw.slice(nameStartIndex, nameEndIndex);
            name = ValueParser.parse(parsedNamePart, options, baseOffset + nameStartIndex);
            syntax = getAdblockSyntax(parsedNamePart);
        }
        if (name.value.length === 0) {
            throw new AdblockSyntaxError('Agent name cannot be empty', baseOffset, baseOffset + raw.length);
        }
        const result = {
            type: 'Agent',
            adblock: name,
            syntax,
        };
        if (version) {
            result.version = version;
        }
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        return result;
    }
    static generate(value) {
        let result = EMPTY;
        result += value.adblock.value;
        if (!isUndefined(value.version)) {
            result += SPACE$1;
            result += value.version.value;
        }
        return result;
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.AgentNode);
        buffer.writeUint8(AgentNodeSerializationMap.Adblock);
        ValueParser.serialize(node.adblock, buffer, FREQUENT_AGENTS_SERIALIZATION_MAP, true);
        if (!isUndefined(node.version)) {
            buffer.writeUint8(AgentNodeSerializationMap.Version);
            ValueParser.serialize(node.version, buffer);
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(AgentNodeSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(AgentNodeSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.AgentNode);
        node.type = 'Agent';
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case AgentNodeSerializationMap.Adblock:
                    ValueParser.deserialize(buffer, node.adblock = {}, FREQUENT_AGENTS_DESERIALIZATION_MAP);
                    if (node.adblock) {
                        node.syntax = getAdblockSyntax(node.adblock.value);
                    }
                    break;
                case AgentNodeSerializationMap.Version:
                    ValueParser.deserialize(buffer, node.version = {});
                    break;
                case AgentNodeSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case AgentNodeSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
}
class CosmeticRuleSeparatorUtils {
    static isException(separator) {
        return separator[1] === AT_SIGN;
    }
    static isExtendedCssMarker(separator) {
        return (separator === CosmeticRuleSeparator.ExtendedElementHiding
            || separator === CosmeticRuleSeparator.ExtendedElementHidingException
            || separator === CosmeticRuleSeparator.AdgExtendedCssInjection
            || separator === CosmeticRuleSeparator.AdgExtendedCssInjectionException);
    }
    static find(rule) {
        function createResult(start, separator) {
            return {
                separator,
                start,
                end: start + separator.length,
            };
        }
        for (let i = 0; i < rule.length; i += 1) {
            if (rule[i] === '#') {
                if (rule[i + 1] === '#' && rule[i - 1] !== SPACE$1) {
                    return createResult(i, CosmeticRuleSeparator.ElementHiding);
                }
                if (rule[i + 1] === '?' && rule[i + 2] === '#') {
                    return createResult(i, CosmeticRuleSeparator.ExtendedElementHiding);
                }
                if (rule[i + 1] === '%' && rule[i + 2] === '#') {
                    return createResult(i, CosmeticRuleSeparator.AdgJsInjection);
                }
                if (rule[i + 1] === '$') {
                    if (rule[i + 2] === '#') {
                        return createResult(i, CosmeticRuleSeparator.AdgCssInjection);
                    }
                    if (rule[i + 2] === '?' && rule[i + 3] === '#') {
                        return createResult(i, CosmeticRuleSeparator.AdgExtendedCssInjection);
                    }
                }
                if (rule[i + 1] === '@') {
                    if (rule[i + 2] === '#' && rule[i - 1] !== SPACE$1) {
                        return createResult(i, CosmeticRuleSeparator.ElementHidingException);
                    }
                    if (rule[i + 2] === '?' && rule[i + 3] === '#') {
                        return createResult(i, CosmeticRuleSeparator.ExtendedElementHidingException);
                    }
                    if (rule[i + 2] === '%' && rule[i + 3] === '#') {
                        return createResult(i, CosmeticRuleSeparator.AdgJsInjectionException);
                    }
                    if (rule[i + 2] === '$') {
                        if (rule[i + 3] === '#') {
                            return createResult(i, CosmeticRuleSeparator.AdgCssInjectionException);
                        }
                        if (rule[i + 3] === '?' && rule[i + 4] === '#') {
                            return createResult(i, CosmeticRuleSeparator.AdgExtendedCssInjectionException);
                        }
                    }
                }
            }
            if (rule[i] === '$') {
                if (rule[i + 1] === '$') {
                    return createResult(i, CosmeticRuleSeparator.AdgHtmlFiltering);
                }
                if (rule[i + 1] === '@' && rule[i + 2] === '$') {
                    return createResult(i, CosmeticRuleSeparator.AdgHtmlFilteringException);
                }
            }
        }
        return null;
    }
}
var AgentRuleSerializationMap;
(function (AgentRuleSerializationMap) {
    AgentRuleSerializationMap[AgentRuleSerializationMap["Children"] = 1] = "Children";
    AgentRuleSerializationMap[AgentRuleSerializationMap["Start"] = 2] = "Start";
    AgentRuleSerializationMap[AgentRuleSerializationMap["End"] = 3] = "End";
})(AgentRuleSerializationMap || (AgentRuleSerializationMap = {}));
class AgentCommentRuleParser extends ParserBase {
    static isAgentRule(raw) {
        const rawTrimmed = raw.trim();
        if (rawTrimmed.startsWith(OPEN_SQUARE_BRACKET) && rawTrimmed.endsWith(CLOSE_SQUARE_BRACKET)) {
            return isNull(CosmeticRuleSeparatorUtils.find(rawTrimmed));
        }
        return false;
    }
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        if (!AgentCommentRuleParser.isAgentRule(raw)) {
            return null;
        }
        let offset = 0;
        offset = StringUtils.skipWS(raw, offset);
        offset += 1;
        const closingBracketIndex = StringUtils.skipWSBack(raw, raw.length - 1);
        if (closingBracketIndex === -1 || raw[closingBracketIndex] !== CLOSE_SQUARE_BRACKET) {
            throw new AdblockSyntaxError('Missing closing bracket', offset, offset + raw.length);
        }
        const result = {
            type: CommentRuleType.AgentCommentRule,
            syntax: AdblockSyntax.Common,
            category: RuleCategory.Comment,
            children: [],
        };
        if (options.includeRaws) {
            result.raws = {
                text: raw,
            };
        }
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        while (offset < closingBracketIndex) {
            offset = StringUtils.skipWS(raw, offset);
            let separatorIndex = raw.indexOf(SEMICOLON, offset);
            if (separatorIndex === -1) {
                separatorIndex = closingBracketIndex;
            }
            const agentEndIndex = StringUtils.findLastNonWhitespaceCharacter(raw.slice(offset, separatorIndex)) + offset + 1;
            result.children.push(AgentParser.parse(raw.slice(offset, agentEndIndex), options, baseOffset + offset));
            offset = separatorIndex + 1;
        }
        if (result.children.length === 0) {
            throw new AdblockSyntaxError('Empty agent list', baseOffset, baseOffset + raw.length);
        }
        return result;
    }
    static generate(ast) {
        let result = OPEN_SQUARE_BRACKET;
        result += ast.children
            .map(AgentParser.generate)
            .join(SEMICOLON + SPACE$1);
        result += CLOSE_SQUARE_BRACKET;
        return result;
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.AgentRuleNode);
        const count = node.children.length;
        if (count) {
            buffer.writeUint8(AgentRuleSerializationMap.Children);
            if (count > UINT8_MAX) {
                throw new Error(`Too many children: ${count}, the limit is ${UINT8_MAX}`);
            }
            buffer.writeUint8(count);
            for (let i = 0; i < count; i += 1) {
                AgentParser.serialize(node.children[i], buffer);
            }
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(AgentRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(AgentRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.AgentRuleNode);
        node.type = CommentRuleType.AgentCommentRule;
        node.syntax = AdblockSyntax.Common;
        node.category = RuleCategory.Comment;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case AgentRuleSerializationMap.Children:
                    node.children = new Array(buffer.readUint8());
                    for (let i = 0; i < node.children.length; i += 1) {
                        AgentParser.deserialize(buffer, node.children[i] = {});
                    }
                    break;
                case AgentRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case AgentRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
}
var ParameterListNodeSerializationMap;
(function (ParameterListNodeSerializationMap) {
    ParameterListNodeSerializationMap[ParameterListNodeSerializationMap["Children"] = 1] = "Children";
    ParameterListNodeSerializationMap[ParameterListNodeSerializationMap["Start"] = 2] = "Start";
    ParameterListNodeSerializationMap[ParameterListNodeSerializationMap["End"] = 3] = "End";
})(ParameterListNodeSerializationMap || (ParameterListNodeSerializationMap = {}));
class ParameterListParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0, separator = COMMA) {
        const params = {
            type: 'ParameterList',
            children: [],
        };
        const { length } = raw;
        if (options.isLocIncluded) {
            params.start = baseOffset;
            params.end = baseOffset + length;
        }
        let offset = 0;
        while (offset < length) {
            offset = StringUtils.skipWS(raw, offset);
            if (raw[offset] === separator || offset === length) {
                params.children.push(null);
                offset += 1;
            }
            else {
                const paramStart = offset;
                const nextSeparator = StringUtils.findUnescapedNonStringNonRegexChar(raw, separator, offset);
                const paramEnd = nextSeparator !== -1
                    ? StringUtils.skipWSBack(raw, nextSeparator - 1)
                    : StringUtils.skipWSBack(raw);
                const param = ValueParser.parse(raw.slice(paramStart, paramEnd + 1), options, baseOffset + paramStart);
                params.children.push(param);
                offset = nextSeparator !== -1 ? nextSeparator + 1 : length;
            }
        }
        if (raw[length - 1] === separator) {
            params.children.push(null);
        }
        return params;
    }
    static generate(params, separator = COMMA) {
        const collection = [];
        let i = 0;
        for (; i < params.children.length; i += 1) {
            const param = params.children[i];
            if (param === null) {
                collection.push(EMPTY);
            }
            else {
                collection.push(ValueParser.generate(param));
            }
        }
        const result = collection.join(separator === SPACE$1 ? separator : `${separator}${SPACE$1}`);
        return result;
    }
    static serialize(node, buffer, frequentValuesMap, toLower = false) {
        buffer.writeUint8(BinaryTypeMap.ParameterListNode);
        const count = node.children.length;
        buffer.writeUint8(ParameterListNodeSerializationMap.Children);
        buffer.writeUint32(count);
        for (let i = 0; i < count; i += 1) {
            const child = node.children[i];
            if (isNull(child)) {
                buffer.writeUint8(BinaryTypeMap.Null);
                continue;
            }
            ValueParser.serialize(child, buffer, frequentValuesMap, toLower);
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(ParameterListNodeSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(ParameterListNodeSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node, frequentValuesMap) {
        buffer.assertUint8(BinaryTypeMap.ParameterListNode);
        node.type = 'ParameterList';
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case ParameterListNodeSerializationMap.Children:
                    node.children = new Array(buffer.readUint32());
                    for (let i = 0; i < node.children.length; i += 1) {
                        switch (buffer.peekUint8()) {
                            case BinaryTypeMap.Null:
                                buffer.readUint8();
                                node.children[i] = null;
                                break;
                            case BinaryTypeMap.ValueNode:
                                ValueParser.deserialize(buffer, node.children[i] = {}, frequentValuesMap);
                                break;
                            default:
                                throw new Error(`Invalid child type: ${buffer.peekUint8()}`);
                        }
                    }
                    break;
                case ParameterListNodeSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case ParameterListNodeSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
}
var ConfigCommentRuleSerializationMap;
(function (ConfigCommentRuleSerializationMap) {
    ConfigCommentRuleSerializationMap[ConfigCommentRuleSerializationMap["Marker"] = 1] = "Marker";
    ConfigCommentRuleSerializationMap[ConfigCommentRuleSerializationMap["Command"] = 2] = "Command";
    ConfigCommentRuleSerializationMap[ConfigCommentRuleSerializationMap["Params"] = 3] = "Params";
    ConfigCommentRuleSerializationMap[ConfigCommentRuleSerializationMap["Comment"] = 4] = "Comment";
    ConfigCommentRuleSerializationMap[ConfigCommentRuleSerializationMap["Start"] = 5] = "Start";
    ConfigCommentRuleSerializationMap[ConfigCommentRuleSerializationMap["End"] = 6] = "End";
})(ConfigCommentRuleSerializationMap || (ConfigCommentRuleSerializationMap = {}));
var ConfigNodeSerializationMap;
(function (ConfigNodeSerializationMap) {
    ConfigNodeSerializationMap[ConfigNodeSerializationMap["Value"] = 1] = "Value";
    ConfigNodeSerializationMap[ConfigNodeSerializationMap["Start"] = 2] = "Start";
    ConfigNodeSerializationMap[ConfigNodeSerializationMap["End"] = 3] = "End";
})(ConfigNodeSerializationMap || (ConfigNodeSerializationMap = {}));
const FREQUENT_COMMANDS_SERIALIZATION_MAP = new Map([
    ['aglint', 0],
    ['aglint-disable', 1],
    ['aglint-enable', 2],
    ['aglint-disable-next-line', 3],
    ['aglint-enable-next-line', 4],
]);
const FREQUENT_COMMANDS_DESERIALIZATION_MAP = new Map(Array.from(FREQUENT_COMMANDS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
class ConfigCommentRuleParser extends ParserBase {
    static isConfigComment(raw) {
        const trimmed = raw.trim();
        if (trimmed[0] === CommentMarker.Regular || trimmed[0] === CommentMarker.Hashmark) {
            const text = raw.slice(1).trim();
            return ((text[0] === 'a' || text[0] === 'A')
                && (text[1] === 'g' || text[1] === 'G')
                && (text[2] === 'l' || text[2] === 'L')
                && (text[3] === 'i' || text[3] === 'I')
                && (text[4] === 'n' || text[4] === 'N')
                && (text[5] === 't' || text[5] === 'T'));
        }
        return false;
    }
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        if (!ConfigCommentRuleParser.isConfigComment(raw)) {
            return null;
        }
        let offset = 0;
        offset = StringUtils.skipWS(raw, offset);
        const marker = ValueParser.parse(raw[offset], options, baseOffset + offset);
        offset += 1;
        offset = StringUtils.skipWS(raw, offset);
        const commandStart = offset;
        offset = StringUtils.findNextWhitespaceCharacter(raw, offset);
        const command = ValueParser.parse(raw.slice(commandStart, offset), options, baseOffset + commandStart);
        offset = StringUtils.skipWS(raw, offset);
        const commentStart = raw.indexOf(AGLINT_CONFIG_COMMENT_MARKER, offset);
        const commentEnd = commentStart !== -1 ? StringUtils.skipWSBack(raw) + 1 : -1;
        let comment;
        if (commentStart !== -1) {
            comment = ValueParser.parse(raw.slice(commentStart, commentEnd), options, baseOffset + commentStart);
        }
        const paramsStart = offset;
        const paramsEnd = commentStart !== -1
            ? StringUtils.skipWSBack(raw, commentStart - 1) + 1
            : StringUtils.skipWSBack(raw) + 1;
        let params;
        if (command.value === AGLINT_COMMAND_PREFIX) {
            params = {
                type: 'ConfigNode',
                value: lib.parse(`{${raw.slice(paramsStart, paramsEnd)}}`),
            };
            if (options.isLocIncluded) {
                params.start = paramsStart;
                params.end = paramsEnd;
            }
            if (Object.keys(params.value).length === 0) {
                throw new Error('Empty AGLint config');
            }
        }
        else if (paramsStart < paramsEnd) {
            params = ParameterListParser.parse(raw.slice(paramsStart, paramsEnd), options, baseOffset + paramsStart, COMMA);
        }
        const result = {
            type: CommentRuleType.ConfigCommentRule,
            category: RuleCategory.Comment,
            syntax: AdblockSyntax.Common,
            marker,
            command,
            params,
            comment,
        };
        if (options.includeRaws) {
            result.raws = {
                text: raw,
            };
        }
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        return result;
    }
    static generate(node) {
        let result = EMPTY;
        result += node.marker.value;
        result += SPACE$1;
        result += node.command.value;
        if (node.params) {
            result += SPACE$1;
            if (node.params.type === 'ParameterList') {
                result += ParameterListParser.generate(node.params, COMMA);
            }
            else {
                result += JSON.stringify(node.params.value).slice(1, -1).trim();
            }
        }
        if (node.comment) {
            result += SPACE$1;
            result += node.comment.value;
        }
        return result;
    }
    static serializeConfigNode(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.ConfigNode);
        buffer.writeUint8(ConfigNodeSerializationMap.Value);
        buffer.writeString(JSON.stringify(node.value));
        if (!isUndefined(node.start)) {
            buffer.writeUint8(ConfigNodeSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(ConfigNodeSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserializeConfigNode(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.ConfigNode);
        node.type = 'ConfigNode';
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case ConfigNodeSerializationMap.Value:
                    node.value = JSON.parse(buffer.readString());
                    break;
                case ConfigNodeSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case ConfigNodeSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}.`);
            }
            prop = buffer.readUint8();
        }
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.ConfigCommentRuleNode);
        buffer.writeUint8(ConfigCommentRuleSerializationMap.Marker);
        ValueParser.serialize(node.marker, buffer);
        buffer.writeUint8(ConfigCommentRuleSerializationMap.Command);
        ValueParser.serialize(node.command, buffer, FREQUENT_COMMANDS_SERIALIZATION_MAP, true);
        if (!isUndefined(node.params)) {
            buffer.writeUint8(ConfigCommentRuleSerializationMap.Params);
            if (node.params.type === 'ParameterList') {
                ParameterListParser.serialize(node.params, buffer);
            }
            else {
                ConfigCommentRuleParser.serializeConfigNode(node.params, buffer);
            }
        }
        if (!isUndefined(node.comment)) {
            buffer.writeUint8(ConfigCommentRuleSerializationMap.Comment);
            ValueParser.serialize(node.comment, buffer);
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(ConfigCommentRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(ConfigCommentRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.ConfigCommentRuleNode);
        node.type = CommentRuleType.ConfigCommentRule;
        node.category = RuleCategory.Comment;
        node.syntax = AdblockSyntax.Common;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case ConfigCommentRuleSerializationMap.Marker:
                    ValueParser.deserialize(buffer, node.marker = {});
                    break;
                case ConfigCommentRuleSerializationMap.Command:
                    ValueParser.deserialize(buffer, node.command = {}, FREQUENT_COMMANDS_DESERIALIZATION_MAP);
                    break;
                case ConfigCommentRuleSerializationMap.Params:
                    if (buffer.peekUint8() === BinaryTypeMap.ConfigNode) {
                        ConfigCommentRuleParser.deserializeConfigNode(buffer, node.params = {});
                    }
                    else {
                        ParameterListParser.deserialize(buffer, node.params = {});
                    }
                    break;
                case ConfigCommentRuleSerializationMap.Comment:
                    ValueParser.deserialize(buffer, node.comment = {});
                    break;
                case ConfigCommentRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case ConfigCommentRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
}
var HintNodeSerializationMap;
(function (HintNodeSerializationMap) {
    HintNodeSerializationMap[HintNodeSerializationMap["Name"] = 1] = "Name";
    HintNodeSerializationMap[HintNodeSerializationMap["Params"] = 2] = "Params";
    HintNodeSerializationMap[HintNodeSerializationMap["Start"] = 3] = "Start";
    HintNodeSerializationMap[HintNodeSerializationMap["End"] = 4] = "End";
})(HintNodeSerializationMap || (HintNodeSerializationMap = {}));
const FREQUENT_HINTS_SERIALIZATION_MAP = new Map([
    ['NOT_OPTIMIZED', 0],
    ['PLATFORM', 1],
    ['NOT_PLATFORM', 2],
]);
const FREQUENT_HINTS_DESERIALIZATION_MAP = new Map(Array.from(FREQUENT_HINTS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
const FREQUENT_PLATFORMS_SERIALIZATION_MAP = new Map([
    ['windows', 0],
    ['mac', 1],
    ['android', 2],
    ['ios', 3],
    ['ext_chromium', 4],
    ['ext_ff', 5],
    ['ext_edge', 6],
    ['ext_opera', 7],
    ['ext_safari', 8],
    ['ext_android_cb', 9],
    ['ext_ublock', 10],
]);
const FREQUENT_PLATFORMS_DESERIALIZATION_MAP = new Map(Array.from(FREQUENT_PLATFORMS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
class HintParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        let offset = 0;
        offset = StringUtils.skipWS(raw);
        const nameStartIndex = offset;
        for (; offset < raw.length; offset += 1) {
            const char = raw[offset];
            if (char === OPEN_PARENTHESIS || char === SPACE$1) {
                break;
            }
            if (!StringUtils.isAlphaNumeric(char) && char !== UNDERSCORE) {
                throw new AdblockSyntaxError(`Invalid character "${char}" in hint name: "${char}"`, baseOffset + nameStartIndex, baseOffset + offset);
            }
        }
        const nameEndIndex = offset;
        const name = raw.slice(nameStartIndex, nameEndIndex);
        if (name === EMPTY) {
            throw new AdblockSyntaxError('Empty hint name', baseOffset, baseOffset + nameEndIndex);
        }
        offset = StringUtils.skipWS(raw, offset);
        if (offset > nameEndIndex && raw[offset] === OPEN_PARENTHESIS) {
            throw new AdblockSyntaxError('Unexpected whitespace(s) between hint name and opening parenthesis', baseOffset + nameEndIndex, baseOffset + offset);
        }
        const nameNode = ValueParser.parse(name, options, baseOffset + nameStartIndex);
        if (raw[offset] !== OPEN_PARENTHESIS) {
            const result = {
                type: 'Hint',
                name: nameNode,
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + offset;
            }
            return result;
        }
        offset += 1;
        const closeParenthesisIndex = raw.lastIndexOf(CLOSE_PARENTHESIS);
        if (closeParenthesisIndex === -1) {
            throw new AdblockSyntaxError(`Missing closing parenthesis for hint "${name}"`, baseOffset + nameStartIndex, baseOffset + raw.length);
        }
        const paramsStartIndex = offset;
        const paramsEndIndex = closeParenthesisIndex;
        const params = ParameterListParser.parse(raw.slice(paramsStartIndex, paramsEndIndex), options, baseOffset + paramsStartIndex, COMMA);
        offset = closeParenthesisIndex + 1;
        offset = StringUtils.skipWS(raw, offset);
        if (offset !== raw.length) {
            throw new AdblockSyntaxError(
            `Unexpected input after closing parenthesis for hint "${name}": "${raw.slice(closeParenthesisIndex + 1, offset + 1)}"`, baseOffset + closeParenthesisIndex + 1, baseOffset + offset + 1);
        }
        const result = {
            type: 'Hint',
            name: nameNode,
            params,
        };
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + offset;
        }
        return result;
    }
    static generate(hint) {
        let result = EMPTY;
        result += hint.name.value;
        if (hint.params && hint.params.children.length > 0) {
            result += OPEN_PARENTHESIS;
            result += ParameterListParser.generate(hint.params, COMMA);
            result += CLOSE_PARENTHESIS;
        }
        return result;
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.HintNode);
        buffer.writeUint8(HintNodeSerializationMap.Name);
        ValueParser.serialize(node.name, buffer, FREQUENT_HINTS_SERIALIZATION_MAP);
        if (!isUndefined(node.params)) {
            buffer.writeUint8(HintNodeSerializationMap.Params);
            ParameterListParser.serialize(node.params, buffer, FREQUENT_PLATFORMS_SERIALIZATION_MAP);
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(HintNodeSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(HintNodeSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.HintNode);
        node.type = 'Hint';
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case HintNodeSerializationMap.Name:
                    ValueParser.deserialize(buffer, node.name = {}, FREQUENT_HINTS_DESERIALIZATION_MAP);
                    break;
                case HintNodeSerializationMap.Params:
                    ParameterListParser.deserialize(buffer, node.params = {}, FREQUENT_PLATFORMS_DESERIALIZATION_MAP);
                    break;
                case HintNodeSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case HintNodeSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
}
var HintRuleSerializationMap;
(function (HintRuleSerializationMap) {
    HintRuleSerializationMap[HintRuleSerializationMap["Syntax"] = 1] = "Syntax";
    HintRuleSerializationMap[HintRuleSerializationMap["Children"] = 2] = "Children";
    HintRuleSerializationMap[HintRuleSerializationMap["Start"] = 3] = "Start";
    HintRuleSerializationMap[HintRuleSerializationMap["End"] = 4] = "End";
})(HintRuleSerializationMap || (HintRuleSerializationMap = {}));
class HintCommentRuleParser extends ParserBase {
    static isHintRule(raw) {
        return raw.trim().startsWith(HINT_MARKER);
    }
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        if (!HintCommentRuleParser.isHintRule(raw)) {
            return null;
        }
        let offset = 0;
        offset = StringUtils.skipWS(raw);
        offset += HINT_MARKER_LEN;
        const hints = [];
        while (offset < raw.length) {
            offset = StringUtils.skipWS(raw, offset);
            const hintStartIndex = offset;
            let hintEndIndex = offset;
            let balance = 0;
            while (hintEndIndex < raw.length) {
                if (raw[hintEndIndex] === OPEN_PARENTHESIS && raw[hintEndIndex - 1] !== BACKSLASH) {
                    balance += 1;
                    if (balance > 1) {
                        throw new AdblockSyntaxError('Invalid hint: nested parentheses are not allowed', baseOffset + hintStartIndex, baseOffset + hintEndIndex);
                    }
                }
                else if (raw[hintEndIndex] === CLOSE_PARENTHESIS && raw[hintEndIndex - 1] !== BACKSLASH) {
                    balance -= 1;
                }
                else if (StringUtils.isWhitespace(raw[hintEndIndex]) && balance === 0) {
                    break;
                }
                hintEndIndex += 1;
            }
            offset = hintEndIndex;
            offset = StringUtils.skipWS(raw, offset);
            const hint = HintParser.parse(raw.slice(hintStartIndex, hintEndIndex), options, baseOffset + hintStartIndex);
            hints.push(hint);
        }
        if (hints.length === 0) {
            throw new AdblockSyntaxError('Empty hint rule', baseOffset, baseOffset + offset);
        }
        const result = {
            type: CommentRuleType.HintCommentRule,
            category: RuleCategory.Comment,
            syntax: AdblockSyntax.Adg,
            children: hints,
        };
        if (options.includeRaws) {
            result.raws = {
                text: raw,
            };
        }
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + offset;
        }
        return result;
    }
    static generate(node) {
        let result = HINT_MARKER + SPACE$1;
        result += node.children.map(HintParser.generate).join(SPACE$1);
        return result;
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.HintRuleNode);
        if (node.syntax === AdblockSyntax.Adg) {
            buffer.writeUint8(HintRuleSerializationMap.Syntax);
            buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(AdblockSyntax.Adg) ?? 0);
        }
        const count = node.children.length;
        if (count) {
            buffer.writeUint8(HintRuleSerializationMap.Children);
            buffer.writeUint8(count);
            for (let i = 0; i < count; i += 1) {
                HintParser.serialize(node.children[i], buffer);
            }
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(HintRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(HintRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.HintRuleNode);
        node.category = RuleCategory.Comment;
        node.type = CommentRuleType.HintCommentRule;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case HintRuleSerializationMap.Syntax:
                    node.syntax = SYNTAX_DESERIALIZATION_MAP.get(buffer.readUint8()) ?? AdblockSyntax.Common;
                    break;
                case HintRuleSerializationMap.Children:
                    node.children = new Array(buffer.readUint8());
                    for (let i = 0; i < node.children.length; i += 1) {
                        HintParser.deserialize(buffer, node.children[i] = {});
                    }
                    break;
                case HintRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case HintRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
}
var MetadataCommentRuleSerializationMap;
(function (MetadataCommentRuleSerializationMap) {
    MetadataCommentRuleSerializationMap[MetadataCommentRuleSerializationMap["Marker"] = 1] = "Marker";
    MetadataCommentRuleSerializationMap[MetadataCommentRuleSerializationMap["Header"] = 2] = "Header";
    MetadataCommentRuleSerializationMap[MetadataCommentRuleSerializationMap["Value"] = 3] = "Value";
    MetadataCommentRuleSerializationMap[MetadataCommentRuleSerializationMap["Start"] = 4] = "Start";
    MetadataCommentRuleSerializationMap[MetadataCommentRuleSerializationMap["End"] = 5] = "End";
})(MetadataCommentRuleSerializationMap || (MetadataCommentRuleSerializationMap = {}));
const FREQUENT_HEADERS_DESERIALIZATION_MAP = new Map([
    [1, 'Checksum'],
    [2, 'Description'],
    [3, 'Expires'],
    [4, 'Homepage'],
    [5, 'Last Modified'],
    [6, 'LastModified'],
    [7, 'Licence'],
    [8, 'License'],
    [9, 'Time Updated'],
    [10, 'TimeUpdated'],
    [11, 'Version'],
    [12, 'Title'],
]);
const FREQUENT_HEADERS_SERIALIZATION_MAP = new Map(Array.from(FREQUENT_HEADERS_DESERIALIZATION_MAP.entries()).map(([key, value]) => [value.toLowerCase(), key]));
const KNOWN_METADATA_HEADERS = Array.from(FREQUENT_HEADERS_SERIALIZATION_MAP.keys());
class MetadataCommentRuleParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        if (raw.indexOf(COLON) === -1) {
            return null;
        }
        let offset = 0;
        offset = StringUtils.skipWS(raw, offset);
        if (raw[offset] !== CommentMarker.Regular && raw[offset] !== CommentMarker.Hashmark) {
            return null;
        }
        const marker = ValueParser.parse(raw[offset], options, baseOffset + offset);
        offset += 1;
        offset = StringUtils.skipWS(raw, offset);
        const headerStart = offset;
        const text = raw.slice(offset);
        for (let i = 0; i < KNOWN_METADATA_HEADERS.length; i += 1) {
            if (text.toLocaleLowerCase().startsWith(KNOWN_METADATA_HEADERS[i].toLocaleLowerCase())) {
                offset += KNOWN_METADATA_HEADERS[i].length;
                const header = ValueParser.parse(raw.slice(headerStart, offset), options, baseOffset + headerStart);
                offset = StringUtils.skipWS(raw, offset);
                if (raw[offset] !== COLON) {
                    return null;
                }
                offset += 1;
                offset = StringUtils.skipWS(raw, offset);
                const valueStart = offset;
                if (offset >= raw.length) {
                    return null;
                }
                const valueEnd = StringUtils.skipWSBack(raw, raw.length - 1) + 1;
                const value = ValueParser.parse(raw.slice(valueStart, valueEnd), options, baseOffset + valueStart);
                const result = {
                    type: CommentRuleType.MetadataCommentRule,
                    category: RuleCategory.Comment,
                    syntax: AdblockSyntax.Common,
                    marker,
                    header,
                    value,
                };
                if (options.includeRaws) {
                    result.raws = {
                        text: raw,
                    };
                }
                if (options.isLocIncluded) {
                    result.start = baseOffset;
                    result.end = baseOffset + raw.length;
                }
                return result;
            }
        }
        return null;
    }
    static generate(node) {
        let result = EMPTY;
        result += ValueParser.generate(node.marker);
        result += SPACE$1;
        result += ValueParser.generate(node.header);
        result += COLON;
        result += SPACE$1;
        result += ValueParser.generate(node.value);
        return result;
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.MetadataCommentRuleNode);
        buffer.writeUint8(MetadataCommentRuleSerializationMap.Marker);
        ValueParser.serialize(node.marker, buffer);
        buffer.writeUint8(MetadataCommentRuleSerializationMap.Header);
        ValueParser.serialize(node.header, buffer, FREQUENT_HEADERS_SERIALIZATION_MAP, true);
        buffer.writeUint8(MetadataCommentRuleSerializationMap.Value);
        ValueParser.serialize(node.value, buffer);
        if (!isUndefined(node.start)) {
            buffer.writeUint8(MetadataCommentRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(MetadataCommentRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.MetadataCommentRuleNode);
        node.type = CommentRuleType.MetadataCommentRule;
        node.category = RuleCategory.Comment;
        node.syntax = AdblockSyntax.Common;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case MetadataCommentRuleSerializationMap.Marker:
                    ValueParser.deserialize(buffer, node.marker = {});
                    break;
                case MetadataCommentRuleSerializationMap.Header:
                    ValueParser.deserialize(buffer, node.header = {}, FREQUENT_HEADERS_DESERIALIZATION_MAP);
                    break;
                case MetadataCommentRuleSerializationMap.Value:
                    ValueParser.deserialize(buffer, node.value = {});
                    break;
                case MetadataCommentRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case MetadataCommentRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
}
var VariableNodeBinaryPropMap;
(function (VariableNodeBinaryPropMap) {
    VariableNodeBinaryPropMap[VariableNodeBinaryPropMap["Name"] = 1] = "Name";
    VariableNodeBinaryPropMap[VariableNodeBinaryPropMap["FrequentName"] = 2] = "FrequentName";
    VariableNodeBinaryPropMap[VariableNodeBinaryPropMap["Start"] = 3] = "Start";
    VariableNodeBinaryPropMap[VariableNodeBinaryPropMap["End"] = 4] = "End";
})(VariableNodeBinaryPropMap || (VariableNodeBinaryPropMap = {}));
var OperatorNodeBinaryPropMap;
(function (OperatorNodeBinaryPropMap) {
    OperatorNodeBinaryPropMap[OperatorNodeBinaryPropMap["Operator"] = 1] = "Operator";
    OperatorNodeBinaryPropMap[OperatorNodeBinaryPropMap["Left"] = 2] = "Left";
    OperatorNodeBinaryPropMap[OperatorNodeBinaryPropMap["Right"] = 3] = "Right";
    OperatorNodeBinaryPropMap[OperatorNodeBinaryPropMap["Start"] = 4] = "Start";
    OperatorNodeBinaryPropMap[OperatorNodeBinaryPropMap["End"] = 5] = "End";
})(OperatorNodeBinaryPropMap || (OperatorNodeBinaryPropMap = {}));
var ParenthesisNodeBinaryPropMap;
(function (ParenthesisNodeBinaryPropMap) {
    ParenthesisNodeBinaryPropMap[ParenthesisNodeBinaryPropMap["Expression"] = 1] = "Expression";
    ParenthesisNodeBinaryPropMap[ParenthesisNodeBinaryPropMap["Start"] = 2] = "Start";
    ParenthesisNodeBinaryPropMap[ParenthesisNodeBinaryPropMap["End"] = 3] = "End";
})(ParenthesisNodeBinaryPropMap || (ParenthesisNodeBinaryPropMap = {}));
var TokenType;
(function (TokenType) {
    TokenType[TokenType["Variable"] = 0] = "Variable";
    TokenType[TokenType["Operator"] = 1] = "Operator";
    TokenType[TokenType["Parenthesis"] = 2] = "Parenthesis";
})(TokenType || (TokenType = {}));
var NodeType;
(function (NodeType) {
    NodeType["Variable"] = "Variable";
    NodeType["Operator"] = "Operator";
    NodeType["Parenthesis"] = "Parenthesis";
})(NodeType || (NodeType = {}));
const OPERATOR_PRECEDENCE = {
    [OperatorValue.Not]: 3,
    [OperatorValue.And]: 2,
    [OperatorValue.Or]: 1,
};
const OPERATOR_BINARY_MAP = new Map([
    [OperatorValue.Not, 0],
    [OperatorValue.And, 1],
    [OperatorValue.Or, 2],
]);
const OPERATOR_BINARY_MAP_REVERSE = new Map(Array.from(OPERATOR_BINARY_MAP).map(([key, value]) => [value, key]));
const getOperatorOrFail = (binary) => {
    const operator = OPERATOR_BINARY_MAP_REVERSE.get(binary);
    if (isUndefined(operator)) {
        throw new Error(`Unknown operator: ${binary}`);
    }
    return operator;
};
const KNOWN_VARIABLES_MAP = new Map([
    ['ext_abp', 0],
    ['ext_ublock', 1],
    ['ext_ubol', 2],
    ['ext_devbuild', 3],
    ['env_chromium', 4],
    ['env_edge', 5],
    ['env_firefox', 6],
    ['env_mobile', 7],
    ['env_safari', 8],
    ['env_mv3', 9],
    ['false', 10],
    ['cap_html_filtering', 11],
    ['cap_user_stylesheet', 12],
    ['adguard', 13],
    ['adguard_app_windows', 14],
    ['adguard_app_mac', 15],
    ['adguard_app_android', 16],
    ['adguard_app_ios', 17],
    ['adguard_ext_safari', 18],
    ['adguard_ext_chromium', 19],
    ['adguard_ext_firefox', 20],
    ['adguard_ext_edge', 21],
    ['adguard_ext_opera', 22],
    ['adguard_ext_android_cb', 23],
]);
const KNOWN_VARIABLES_MAP_REVERSE = new Map(Array.from(KNOWN_VARIABLES_MAP).map(([key, value]) => [value, key]));
const getFrequentNameOrFail = (binary) => {
    const name = KNOWN_VARIABLES_MAP_REVERSE.get(binary);
    if (isUndefined(name)) {
        throw new Error(`Unknown frequent name: ${binary}`);
    }
    return name;
};
class LogicalExpressionParser extends ParserBase {
    static tokenize(raw, baseOffset = 0) {
        const tokens = [];
        let offset = 0;
        while (offset < raw.length) {
            const char = raw[offset];
            if (StringUtils.isWhitespace(char)) {
                offset += 1;
            }
            else if (StringUtils.isLetter(char)) {
                const nameStart = offset;
                while (offset + 1 < raw.length
                    && (StringUtils.isAlphaNumeric(raw[offset + 1]) || raw[offset + 1] === UNDERSCORE)) {
                    offset += 1;
                }
                tokens.push({
                    type: TokenType.Variable,
                    start: nameStart,
                    end: offset + 1,
                });
                offset += 1;
            }
            else if (char === OPEN_PARENTHESIS || char === CLOSE_PARENTHESIS) {
                tokens.push({
                    type: TokenType.Parenthesis,
                    start: offset,
                    end: offset + 1,
                });
                offset += 1;
            }
            else if (char === AMPERSAND || char === PIPE) {
                if (offset + 1 < raw.length && raw[offset + 1] === char) {
                    tokens.push({
                        type: TokenType.Operator,
                        start: offset,
                        end: offset + 2,
                    });
                    offset += 2;
                }
                else {
                    throw new AdblockSyntaxError(`Unexpected character "${char}"`, baseOffset + offset, baseOffset + offset + 1);
                }
            }
            else if (char === EXCLAMATION_MARK) {
                tokens.push({
                    type: TokenType.Operator,
                    start: offset,
                    end: offset + 1,
                });
                offset += 1;
            }
            else {
                throw new AdblockSyntaxError(`Unexpected character "${char}"`, baseOffset + offset, baseOffset + offset + 1);
            }
        }
        return tokens;
    }
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        const tokens = LogicalExpressionParser.tokenize(raw, baseOffset);
        let tokenIndex = 0;
        function consume(type) {
            const token = tokens[tokenIndex];
            if (!token) {
                throw new AdblockSyntaxError(`Expected token of type "${type}", but reached end of input`, baseOffset, baseOffset + raw.length);
            }
            if (token.type !== type) {
                throw new AdblockSyntaxError(`Expected token of type "${type}", but got "${token.type}"`, baseOffset + token.start, baseOffset + token.end);
            }
            tokenIndex += 1;
            return token;
        }
        function parseVariable() {
            const token = consume(TokenType.Variable);
            const result = {
                type: NodeType.Variable,
                name: raw.slice(token.start, token.end),
            };
            if (options.isLocIncluded) {
                result.start = baseOffset + token.start;
                result.end = baseOffset + token.end;
            }
            return result;
        }
        function parseBinaryExpression(left, minPrecedence = 0) {
            let node = left;
            let operatorToken;
            while (tokens[tokenIndex]) {
                operatorToken = tokens[tokenIndex];
                if (!operatorToken || operatorToken.type !== TokenType.Operator) {
                    break;
                }
                const operator = raw.slice(operatorToken.start, operatorToken.end);
                const precedence = OPERATOR_PRECEDENCE[operator];
                if (precedence < minPrecedence) {
                    break;
                }
                tokenIndex += 1;
                const right = parseExpression(precedence + 1);
                const newNode = {
                    type: NodeType.Operator,
                    operator,
                    left: node,
                    right,
                };
                if (options.isLocIncluded) {
                    newNode.start = node.start ?? baseOffset + operatorToken.start;
                    newNode.end = right.end ?? baseOffset + operatorToken.end;
                }
                node = newNode;
            }
            return node;
        }
        function parseParenthesizedExpression() {
            consume(TokenType.Parenthesis);
            const expression = parseExpression();
            consume(TokenType.Parenthesis);
            const result = {
                type: NodeType.Parenthesis,
                expression,
            };
            if (options.isLocIncluded) {
                result.start = expression.start;
                result.end = expression.end;
            }
            return result;
        }
        function parseExpression(minPrecedence = 0) {
            let node;
            const token = tokens[tokenIndex];
            const value = raw.slice(token.start, token.end);
            if (token.type === TokenType.Variable) {
                node = parseVariable();
            }
            else if (token.type === TokenType.Operator && value === OperatorValue.Not) {
                tokenIndex += 1;
                const expression = parseExpression(OPERATOR_PRECEDENCE[OperatorValue.Not]);
                node = {
                    type: NodeType.Operator,
                    operator: OperatorValue.Not,
                    left: expression,
                };
                if (options.isLocIncluded) {
                    if (expression.end) {
                        node.start = baseOffset + token.start;
                        node.end = expression.end;
                    }
                    else {
                        node.start = baseOffset + token.start;
                        node.end = baseOffset + token.end;
                    }
                }
            }
            else if (token.type === TokenType.Parenthesis && value === OPEN_PARENTHESIS) {
                node = parseParenthesizedExpression();
            }
            else {
                throw new AdblockSyntaxError(`Unexpected token "${value}"`, baseOffset + token.start, baseOffset + token.end);
            }
            return parseBinaryExpression(node, minPrecedence);
        }
        const expression = parseExpression();
        if (tokenIndex !== tokens.length) {
            throw new AdblockSyntaxError(`Unexpected token "${tokens[tokenIndex].type}"`, baseOffset + tokens[tokenIndex].start, baseOffset + tokens[tokenIndex].end);
        }
        return expression;
    }
    static generate(node) {
        if (node.type === NodeType.Variable) {
            return node.name;
        }
        if (node.type === NodeType.Operator) {
            const left = LogicalExpressionParser.generate(node.left);
            const right = node.right ? LogicalExpressionParser.generate(node.right) : undefined;
            const { operator } = node;
            if (operator === OperatorValue.Not) {
                return `${operator}${left}`;
            }
            if (!right) {
                throw new Error('Expected right operand');
            }
            return `${left} ${operator} ${right}`;
        }
        if (node.type === NodeType.Parenthesis) {
            const expressionString = LogicalExpressionParser.generate(node.expression);
            return `(${expressionString})`;
        }
        throw new Error('Unexpected node type');
    }
    static serializeVariableNode(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.ExpressionVariableNode);
        const frequentName = KNOWN_VARIABLES_MAP.get(node.name);
        if (!isUndefined(frequentName)) {
            buffer.writeUint8(VariableNodeBinaryPropMap.FrequentName);
            buffer.writeUint8(frequentName);
        }
        else {
            buffer.writeUint8(VariableNodeBinaryPropMap.Name);
            buffer.writeString(node.name);
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(VariableNodeBinaryPropMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(VariableNodeBinaryPropMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static serializeParenthesisNode(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.ExpressionParenthesisNode);
        buffer.writeUint8(ParenthesisNodeBinaryPropMap.Expression);
        LogicalExpressionParser.serialize(node.expression, buffer);
        if (!isUndefined(node.start)) {
            buffer.writeUint8(ParenthesisNodeBinaryPropMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(ParenthesisNodeBinaryPropMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static serializeOperatorNode(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.ExpressionOperatorNode);
        buffer.writeUint8(OperatorNodeBinaryPropMap.Operator);
        const operatorBinary = OPERATOR_BINARY_MAP.get(node.operator);
        if (isUndefined(operatorBinary)) {
            throw new Error(`Unknown operator: ${node.operator}`);
        }
        buffer.writeUint8(operatorBinary);
        buffer.writeUint8(OperatorNodeBinaryPropMap.Left);
        LogicalExpressionParser.serialize(node.left, buffer);
        if (node.right) {
            buffer.writeUint8(OperatorNodeBinaryPropMap.Right);
            LogicalExpressionParser.serialize(node.right, buffer);
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(OperatorNodeBinaryPropMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(OperatorNodeBinaryPropMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static serialize(node, buffer) {
        switch (node.type) {
            case NodeType.Variable:
                LogicalExpressionParser.serializeVariableNode(node, buffer);
                break;
            case NodeType.Operator:
                LogicalExpressionParser.serializeOperatorNode(node, buffer);
                break;
            case NodeType.Parenthesis:
                LogicalExpressionParser.serializeParenthesisNode(node, buffer);
                break;
            default:
                throw new Error(`Unexpected node type: ${node.type}`);
        }
        buffer.writeUint8(NULL);
    }
    static deserializeVariableNode(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.ExpressionVariableNode);
        node.type = NodeType.Variable;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case VariableNodeBinaryPropMap.Name:
                    node.name = buffer.readString();
                    break;
                case VariableNodeBinaryPropMap.FrequentName:
                    node.name = getFrequentNameOrFail(buffer.readUint8());
                    break;
                case VariableNodeBinaryPropMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case VariableNodeBinaryPropMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
    static deserializeParenthesisNode(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.ExpressionParenthesisNode);
        node.type = NodeType.Parenthesis;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case ParenthesisNodeBinaryPropMap.Expression:
                    LogicalExpressionParser.deserialize(buffer, node.expression = {});
                    break;
                case ParenthesisNodeBinaryPropMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case ParenthesisNodeBinaryPropMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
    static deserializeOperatorNode(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.ExpressionOperatorNode);
        node.type = NodeType.Operator;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case OperatorNodeBinaryPropMap.Operator:
                    node.operator = getOperatorOrFail(buffer.readUint8());
                    break;
                case OperatorNodeBinaryPropMap.Left:
                    LogicalExpressionParser.deserialize(buffer, node.left = {});
                    break;
                case OperatorNodeBinaryPropMap.Right:
                    LogicalExpressionParser.deserialize(buffer, node.right = {});
                    break;
                case OperatorNodeBinaryPropMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case OperatorNodeBinaryPropMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
    static deserialize(buffer, node) {
        let type = buffer.peekUint8();
        while (type !== NULL) {
            switch (type) {
                case BinaryTypeMap.ExpressionVariableNode:
                    LogicalExpressionParser.deserializeVariableNode(buffer, node);
                    break;
                case BinaryTypeMap.ExpressionOperatorNode:
                    LogicalExpressionParser.deserializeOperatorNode(buffer, node);
                    break;
                case BinaryTypeMap.ExpressionParenthesisNode:
                    LogicalExpressionParser.deserializeParenthesisNode(buffer, node);
                    break;
                default:
                    throw new Error(`Unexpected node type: ${type}`);
            }
            type = buffer.peekUint8();
        }
        buffer.readUint8();
    }
}
var PreProcessorRuleSerializationMap;
(function (PreProcessorRuleSerializationMap) {
    PreProcessorRuleSerializationMap[PreProcessorRuleSerializationMap["Name"] = 1] = "Name";
    PreProcessorRuleSerializationMap[PreProcessorRuleSerializationMap["Params"] = 2] = "Params";
    PreProcessorRuleSerializationMap[PreProcessorRuleSerializationMap["Syntax"] = 3] = "Syntax";
    PreProcessorRuleSerializationMap[PreProcessorRuleSerializationMap["Start"] = 4] = "Start";
    PreProcessorRuleSerializationMap[PreProcessorRuleSerializationMap["End"] = 5] = "End";
})(PreProcessorRuleSerializationMap || (PreProcessorRuleSerializationMap = {}));
const FREQUENT_DIRECTIVES_SERIALIZATION_MAP = new Map([
    ['if', 0],
    ['else', 1],
    ['endif', 2],
    ['include', 3],
    ['safari_cb_affinity', 4],
]);
const FREQUENT_DIRECTIVES_DESERIALIZATION_MAP = new Map(Array.from(FREQUENT_DIRECTIVES_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
const FREQUENT_PARAMS_SERIALIZATION_MAP = new Map([
    ['general', 0],
    ['privacy', 1],
    ['social', 2],
    ['security', 3],
    ['other', 4],
    ['custom', 5],
    ['all', 6],
]);
const FREQUENT_PARAMS_DESERIALIZATION_MAP = new Map(Array.from(FREQUENT_PARAMS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
class PreProcessorCommentRuleParser extends ParserBase {
    static isPreProcessorRule(raw) {
        const trimmed = raw.trim();
        return trimmed.startsWith(PREPROCESSOR_MARKER) && trimmed[PREPROCESSOR_MARKER_LEN] !== HASHMARK;
    }
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        if (!PreProcessorCommentRuleParser.isPreProcessorRule(raw)) {
            return null;
        }
        let offset = 0;
        offset = StringUtils.skipWS(raw, offset);
        offset += PREPROCESSOR_MARKER_LEN;
        offset = StringUtils.skipWS(raw, offset);
        const nameStart = offset;
        while (offset < raw.length) {
            const ch = raw[offset];
            if (ch === PREPROCESSOR_SEPARATOR || ch === OPEN_PARENTHESIS) {
                break;
            }
            offset += 1;
        }
        const nameEnd = offset;
        const name = ValueParser.parse(raw.slice(nameStart, nameEnd), options, baseOffset + nameStart);
        offset = StringUtils.skipWS(raw, offset);
        if (name.value === SAFARI_CB_AFFINITY) {
            if (offset > nameEnd) {
                throw new AdblockSyntaxError(`Unexpected whitespace after "${SAFARI_CB_AFFINITY}" directive name`, baseOffset + nameEnd, baseOffset + offset);
            }
            if (StringUtils.skipWS(raw, offset) !== raw.length) {
                if (raw[offset] !== OPEN_PARENTHESIS) {
                    throw new AdblockSyntaxError(`Unexpected character '${raw[offset]}' after '${SAFARI_CB_AFFINITY}' directive name`, baseOffset + offset, baseOffset + offset + 1);
                }
                offset += 1;
                const parameterListStart = offset;
                const closingParenthesesIndex = StringUtils.skipWSBack(raw);
                if (closingParenthesesIndex === -1 || raw[closingParenthesesIndex] !== CLOSE_PARENTHESIS) {
                    throw new AdblockSyntaxError(`Missing closing parenthesis for '${SAFARI_CB_AFFINITY}' directive`, baseOffset + offset, baseOffset + raw.length);
                }
                const parameterListEnd = closingParenthesesIndex;
                const result = {
                    type: CommentRuleType.PreProcessorCommentRule,
                    category: RuleCategory.Comment,
                    syntax: AdblockSyntax.Adg,
                    name,
                    params: ParameterListParser.parse(raw.slice(parameterListStart, parameterListEnd), options, baseOffset + parameterListStart, COMMA),
                };
                if (options.includeRaws) {
                    result.raws = {
                        text: raw,
                    };
                }
                if (options.isLocIncluded) {
                    result.start = baseOffset;
                    result.end = baseOffset + raw.length;
                }
                return result;
            }
        }
        if (offset === raw.length) {
            if (name.value === IF || name.value === INCLUDE) {
                throw new AdblockSyntaxError(`Directive "${name.value}" requires parameters`, baseOffset, baseOffset + raw.length);
            }
            const result = {
                type: CommentRuleType.PreProcessorCommentRule,
                category: RuleCategory.Comment,
                syntax: AdblockSyntax.Common,
                name,
            };
            if (options.includeRaws) {
                result.raws = {
                    text: raw,
                };
            }
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
        const paramsStart = offset;
        const paramsEnd = StringUtils.skipWSBack(raw) + 1;
        let params;
        if (name.value === IF) {
            params = LogicalExpressionParser.parse(raw.slice(paramsStart, paramsEnd), options, baseOffset + paramsStart);
        }
        else {
            params = ValueParser.parse(raw.slice(paramsStart, paramsEnd), options, baseOffset + paramsStart);
        }
        const result = {
            type: CommentRuleType.PreProcessorCommentRule,
            category: RuleCategory.Comment,
            syntax: AdblockSyntax.Common,
            name,
            params,
        };
        if (options.includeRaws) {
            result.raws = {
                text: raw,
            };
        }
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        return result;
    }
    static generate(node) {
        let result = EMPTY;
        result += PREPROCESSOR_MARKER;
        result += node.name.value;
        if (node.params) {
            if (node.name.value !== SAFARI_CB_AFFINITY) {
                result += SPACE$1;
            }
            if (node.params.type === 'Value') {
                result += ValueParser.generate(node.params);
            }
            else if (node.params.type === 'ParameterList') {
                result += OPEN_PARENTHESIS;
                result += ParameterListParser.generate(node.params);
                result += CLOSE_PARENTHESIS;
            }
            else {
                result += LogicalExpressionParser.generate(node.params);
            }
        }
        return result;
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.PreProcessorCommentRuleNode);
        buffer.writeUint8(PreProcessorRuleSerializationMap.Name);
        ValueParser.serialize(node.name, buffer, FREQUENT_DIRECTIVES_SERIALIZATION_MAP);
        buffer.writeUint8(PreProcessorRuleSerializationMap.Syntax);
        buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
        if (!isUndefined(node.params)) {
            buffer.writeUint8(PreProcessorRuleSerializationMap.Params);
            if (node.params.type === 'Value') {
                ValueParser.serialize(node.params, buffer);
            }
            else if (node.params.type === 'ParameterList') {
                ParameterListParser.serialize(node.params, buffer, FREQUENT_PARAMS_SERIALIZATION_MAP, true);
            }
            else {
                LogicalExpressionParser.serialize(node.params, buffer);
            }
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(PreProcessorRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(PreProcessorRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.PreProcessorCommentRuleNode);
        node.type = CommentRuleType.PreProcessorCommentRule;
        node.category = RuleCategory.Comment;
        node.syntax = AdblockSyntax.Common;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case PreProcessorRuleSerializationMap.Name:
                    ValueParser.deserialize(buffer, node.name = {}, FREQUENT_DIRECTIVES_DESERIALIZATION_MAP);
                    break;
                case PreProcessorRuleSerializationMap.Syntax:
                    node.syntax = SYNTAX_DESERIALIZATION_MAP.get(buffer.readUint8()) ?? AdblockSyntax.Common;
                    break;
                case PreProcessorRuleSerializationMap.Params:
                    switch (buffer.peekUint8()) {
                        case BinaryTypeMap.ValueNode:
                            ValueParser.deserialize(buffer, node.params = {});
                            break;
                        case BinaryTypeMap.ParameterListNode:
                            ParameterListParser.deserialize(buffer, node.params = {}, FREQUENT_PARAMS_DESERIALIZATION_MAP);
                            break;
                        case BinaryTypeMap.ExpressionOperatorNode:
                        case BinaryTypeMap.ExpressionParenthesisNode:
                        case BinaryTypeMap.ExpressionVariableNode:
                            LogicalExpressionParser.deserialize(buffer, node.params = {});
                            break;
                        default:
                            throw new Error(`Invalid binary type: ${prop}`);
                    }
                    break;
                case PreProcessorRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case PreProcessorRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
}
var SimpleCommentRuleSerializationMap;
(function (SimpleCommentRuleSerializationMap) {
    SimpleCommentRuleSerializationMap[SimpleCommentRuleSerializationMap["Marker"] = 1] = "Marker";
    SimpleCommentRuleSerializationMap[SimpleCommentRuleSerializationMap["Text"] = 2] = "Text";
    SimpleCommentRuleSerializationMap[SimpleCommentRuleSerializationMap["Start"] = 3] = "Start";
    SimpleCommentRuleSerializationMap[SimpleCommentRuleSerializationMap["End"] = 4] = "End";
})(SimpleCommentRuleSerializationMap || (SimpleCommentRuleSerializationMap = {}));
class SimpleCommentParser extends ParserBase {
    static isSimpleComment(raw) {
        const trimmed = raw.trim();
        if (trimmed.startsWith(CommentMarker.Regular)) {
            return true;
        }
        if (trimmed.startsWith(CommentMarker.Hashmark)) {
            const result = CosmeticRuleSeparatorUtils.find(trimmed);
            if (result === null) {
                return true;
            }
            const { end } = result;
            if (!trimmed[end + 1]
                || StringUtils.isWhitespace(trimmed[end + 1])
                || (trimmed[end + 1] === CommentMarker.Hashmark && trimmed[end + 2] === CommentMarker.Hashmark)) {
                return true;
            }
        }
        return false;
    }
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        if (!this.isSimpleComment(raw)) {
            return null;
        }
        let offset = 0;
        offset = StringUtils.skipWS(raw, offset);
        const marker = ValueParser.parse(raw[offset], options, baseOffset + offset);
        offset += 1;
        const text = ValueParser.parse(raw.slice(offset), options, baseOffset + offset);
        const result = {
            category: RuleCategory.Comment,
            type: CommentRuleType.CommentRule,
            syntax: AdblockSyntax.Common,
            marker,
            text,
        };
        if (options.includeRaws) {
            result.raws = {
                text: raw,
            };
        }
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        return result;
    }
    static generate(node) {
        let result = EMPTY;
        result += ValueParser.generate(node.marker);
        result += ValueParser.generate(node.text);
        return result;
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.CommentRuleNode);
        buffer.writeUint8(SimpleCommentRuleSerializationMap.Marker);
        ValueParser.serialize(node.marker, buffer);
        buffer.writeUint8(SimpleCommentRuleSerializationMap.Text);
        ValueParser.serialize(node.text, buffer);
        if (!isUndefined(node.start)) {
            buffer.writeUint8(SimpleCommentRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(SimpleCommentRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.CommentRuleNode);
        node.type = CommentRuleType.CommentRule;
        node.category = RuleCategory.Comment;
        node.syntax = AdblockSyntax.Common;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case SimpleCommentRuleSerializationMap.Marker:
                    ValueParser.deserialize(buffer, node.marker = {});
                    break;
                case SimpleCommentRuleSerializationMap.Text:
                    ValueParser.deserialize(buffer, node.text = {});
                    break;
                case SimpleCommentRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case SimpleCommentRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
}
class CommentRuleParser extends ParserBase {
    static isCommentRule(raw) {
        const trimmed = raw.trim();
        return SimpleCommentParser.isSimpleComment(trimmed) || AgentCommentRuleParser.isAgentRule(trimmed);
    }
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        if (!CommentRuleParser.isCommentRule(raw)) {
            return null;
        }
        return AgentCommentRuleParser.parse(raw, options, baseOffset)
            || HintCommentRuleParser.parse(raw, options, baseOffset)
            || PreProcessorCommentRuleParser.parse(raw, options, baseOffset)
            || MetadataCommentRuleParser.parse(raw, options, baseOffset)
            || ConfigCommentRuleParser.parse(raw, options, baseOffset)
            || SimpleCommentParser.parse(raw, options, baseOffset);
    }
    static generate(node) {
        switch (node.type) {
            case CommentRuleType.AgentCommentRule:
                return AgentCommentRuleParser.generate(node);
            case CommentRuleType.HintCommentRule:
                return HintCommentRuleParser.generate(node);
            case CommentRuleType.PreProcessorCommentRule:
                return PreProcessorCommentRuleParser.generate(node);
            case CommentRuleType.MetadataCommentRule:
                return MetadataCommentRuleParser.generate(node);
            case CommentRuleType.ConfigCommentRule:
                return ConfigCommentRuleParser.generate(node);
            case CommentRuleType.CommentRule:
                return SimpleCommentParser.generate(node);
            default:
                throw new Error('Unknown comment rule type');
        }
    }
    static serialize(node, buffer) {
        switch (node.type) {
            case CommentRuleType.AgentCommentRule:
                AgentCommentRuleParser.serialize(node, buffer);
                return;
            case CommentRuleType.HintCommentRule:
                HintCommentRuleParser.serialize(node, buffer);
                return;
            case CommentRuleType.PreProcessorCommentRule:
                PreProcessorCommentRuleParser.serialize(node, buffer);
                return;
            case CommentRuleType.MetadataCommentRule:
                MetadataCommentRuleParser.serialize(node, buffer);
                return;
            case CommentRuleType.ConfigCommentRule:
                ConfigCommentRuleParser.serialize(node, buffer);
                return;
            case CommentRuleType.CommentRule:
                SimpleCommentParser.serialize(node, buffer);
                break;
            default:
                throw new Error('Unknown comment rule type');
        }
    }
    static deserialize(buffer, node) {
        const type = buffer.peekUint8();
        switch (type) {
            case BinaryTypeMap.AgentRuleNode:
                AgentCommentRuleParser.deserialize(buffer, node);
                return;
            case BinaryTypeMap.HintRuleNode:
                HintCommentRuleParser.deserialize(buffer, node);
                return;
            case BinaryTypeMap.PreProcessorCommentRuleNode:
                PreProcessorCommentRuleParser.deserialize(buffer, node);
                return;
            case BinaryTypeMap.MetadataCommentRuleNode:
                MetadataCommentRuleParser.deserialize(buffer, node);
                return;
            case BinaryTypeMap.ConfigCommentRuleNode:
                ConfigCommentRuleParser.deserialize(buffer, node);
                return;
            case BinaryTypeMap.CommentRuleNode:
                SimpleCommentParser.deserialize(buffer, node);
                return;
            default:
                throw new Error(`Unknown comment rule type: ${type}`);
        }
    }
}
var ListItemSerializationMap;
(function (ListItemSerializationMap) {
    ListItemSerializationMap[ListItemSerializationMap["Exception"] = 1] = "Exception";
    ListItemSerializationMap[ListItemSerializationMap["Value"] = 2] = "Value";
    ListItemSerializationMap[ListItemSerializationMap["Start"] = 3] = "Start";
    ListItemSerializationMap[ListItemSerializationMap["End"] = 4] = "End";
})(ListItemSerializationMap || (ListItemSerializationMap = {}));
const LIST_PARSE_ERROR_PREFIX = {
    EMPTY_ITEM: 'Empty value specified in the list',
    NO_MULTIPLE_NEGATION: 'Exception marker cannot be followed by another exception marker',
    NO_SEPARATOR_AFTER_NEGATION: 'Exception marker cannot be followed by a separator',
    NO_SEPARATOR_AT_THE_BEGINNING: 'Value list cannot start with a separator',
    NO_SEPARATOR_AT_THE_END: 'Value list cannot end with a separator',
    NO_WHITESPACE_AFTER_NEGATION: 'Exception marker cannot be followed by whitespace',
};
const parseListItems = (raw, options = defaultParserOptions, baseOffset = 0, separator = COMMA, type = ListItemNodeType.Unknown) => {
    const rawListItems = [];
    let offset = 0;
    offset = StringUtils.skipWS(raw, offset);
    if (raw[offset] === separator) {
        throw new AdblockSyntaxError(LIST_PARSE_ERROR_PREFIX.NO_SEPARATOR_AT_THE_BEGINNING, baseOffset + offset, baseOffset + raw.length);
    }
    const realEndIndex = StringUtils.skipWSBack(raw);
    if (raw[realEndIndex] === separator) {
        throw new AdblockSyntaxError(LIST_PARSE_ERROR_PREFIX.NO_SEPARATOR_AT_THE_END, baseOffset + realEndIndex, baseOffset + realEndIndex + 1);
    }
    while (offset < raw.length) {
        offset = StringUtils.skipWS(raw, offset);
        let itemStart = offset;
        const separatorStartIndex = StringUtils.findNextUnescapedCharacter(raw, separator, offset);
        const itemEnd = separatorStartIndex === -1
            ? StringUtils.skipWSBack(raw) + 1
            : StringUtils.skipWSBack(raw, separatorStartIndex - 1) + 1;
        const exception = raw[itemStart] === NEGATION_MARKER;
        if (exception) {
            itemStart += 1;
            const item = raw[itemStart];
            if (item === NEGATION_MARKER) {
                throw new AdblockSyntaxError(LIST_PARSE_ERROR_PREFIX.NO_MULTIPLE_NEGATION, baseOffset + itemStart, baseOffset + itemStart + 1);
            }
            if (item === separator) {
                throw new AdblockSyntaxError(LIST_PARSE_ERROR_PREFIX.NO_SEPARATOR_AFTER_NEGATION, baseOffset + itemStart, baseOffset + itemStart + 1);
            }
            if (StringUtils.isWhitespace(item)) {
                throw new AdblockSyntaxError(LIST_PARSE_ERROR_PREFIX.NO_WHITESPACE_AFTER_NEGATION, baseOffset + itemStart, baseOffset + itemStart + 1);
            }
        }
        if (itemEnd <= itemStart) {
            throw new AdblockSyntaxError(LIST_PARSE_ERROR_PREFIX.EMPTY_ITEM, baseOffset + itemStart, baseOffset + raw.length);
        }
        const listItem = {
            type,
            value: raw.slice(itemStart, itemEnd),
            exception,
        };
        if (options.isLocIncluded) {
            listItem.start = baseOffset + itemStart;
            listItem.end = baseOffset + itemEnd;
        }
        rawListItems.push(listItem);
        offset = separatorStartIndex === -1 ? raw.length : separatorStartIndex + 1;
    }
    return rawListItems;
};
const generateListItem = (item) => {
    return `${item.exception ? NEGATION_MARKER : EMPTY}${item.value}`;
};
const generateListItems = (items, separator) => {
    return items.map(generateListItem).join(separator);
};
const serializeListItem = (item, buffer) => {
    switch (item.type) {
        case ListItemNodeType.App:
            buffer.writeUint8(BinaryTypeMap.AppNode);
            break;
        case ListItemNodeType.Domain:
            buffer.writeUint8(BinaryTypeMap.DomainNode);
            break;
        case ListItemNodeType.Method:
            buffer.writeUint8(BinaryTypeMap.MethodNode);
            break;
        case ListItemNodeType.StealthOption:
            buffer.writeUint8(BinaryTypeMap.StealthOptionNode);
            break;
        default:
            throw new Error(`Invalid list item type: ${item.type}`);
    }
    buffer.writeUint8(ListItemSerializationMap.Exception);
    buffer.writeUint8(item.exception ? 1 : 0);
    buffer.writeUint8(ListItemSerializationMap.Value);
    buffer.writeString(item.value);
    if (!isUndefined(item.start)) {
        buffer.writeUint8(ListItemSerializationMap.Start);
        buffer.writeUint32(item.start);
    }
    if (!isUndefined(item.end)) {
        buffer.writeUint8(ListItemSerializationMap.End);
        buffer.writeUint32(item.end);
    }
    buffer.writeUint8(NULL);
};
const deserializeListItem = (buffer, node) => {
    const type = buffer.readUint8();
    switch (type) {
        case BinaryTypeMap.AppNode:
            node.type = ListItemNodeType.App;
            break;
        case BinaryTypeMap.DomainNode:
            node.type = ListItemNodeType.Domain;
            break;
        case BinaryTypeMap.MethodNode:
            node.type = ListItemNodeType.Method;
            break;
        case BinaryTypeMap.StealthOptionNode:
            node.type = ListItemNodeType.StealthOption;
            break;
        default:
            throw new Error(`Invalid list item type: ${type}`);
    }
    let prop = buffer.readUint8();
    while (prop !== NULL) {
        switch (prop) {
            case ListItemSerializationMap.Exception:
                node.exception = buffer.readUint8() === 1;
                break;
            case ListItemSerializationMap.Value:
                node.value = buffer.readString();
                break;
            case ListItemSerializationMap.Start:
                node.start = buffer.readUint32();
                break;
            case ListItemSerializationMap.End:
                node.end = buffer.readUint32();
                break;
            default:
                throw new Error(`Invalid property: ${type}`);
        }
        prop = buffer.readUint8();
    }
};
const serializeListItems = (items, buffer) => {
    const { length } = items;
    buffer.writeUint16(length);
    for (let i = 0; i < length; i += 1) {
        serializeListItem(items[i], buffer);
    }
};
const deserializeListItems = (buffer, items) => {
    const length = buffer.readUint16();
    items.length = length;
    for (let i = 0; i < length; i += 1) {
        deserializeListItem(buffer, items[i] = {});
    }
};
var DomainListSerializationMap;
(function (DomainListSerializationMap) {
    DomainListSerializationMap[DomainListSerializationMap["Separator"] = 1] = "Separator";
    DomainListSerializationMap[DomainListSerializationMap["Children"] = 2] = "Children";
    DomainListSerializationMap[DomainListSerializationMap["Start"] = 3] = "Start";
    DomainListSerializationMap[DomainListSerializationMap["End"] = 4] = "End";
})(DomainListSerializationMap || (DomainListSerializationMap = {}));
const SEPARATOR_SERIALIZATION_MAP$1 = new Map([
    [COMMA, 0],
    [PIPE, 1],
]);
const SEPARATOR_DESERIALIZATION_MAP$1 = new Map(Array.from(SEPARATOR_SERIALIZATION_MAP$1).map(([key, value]) => [value, key]));
class DomainListParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0, separator = COMMA) {
        if (separator !== COMMA && separator !== PIPE) {
            throw new Error(`Invalid separator: ${separator}`);
        }
        const result = {
            type: ListNodeType.DomainList,
            separator,
            children: parseListItems(raw, options, baseOffset, separator, ListItemNodeType.Domain),
        };
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        return result;
    }
    static generate(node) {
        return generateListItems(node.children, node.separator);
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.DomainListNode);
        const separator = SEPARATOR_SERIALIZATION_MAP$1.get(node.separator);
        if (isUndefined(separator)) {
            throw new Error(`Invalid separator: ${node.separator}`);
        }
        buffer.writeUint8(DomainListSerializationMap.Separator);
        buffer.writeUint8(separator);
        buffer.writeUint8(DomainListSerializationMap.Children);
        serializeListItems(node.children, buffer);
        if (!isUndefined(node.start)) {
            buffer.writeUint8(DomainListSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(DomainListSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.DomainListNode);
        node.type = ListNodeType.DomainList;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case DomainListSerializationMap.Separator:
                    node.separator = (SEPARATOR_DESERIALIZATION_MAP$1.get(buffer.readUint8()) ?? COMMA);
                    break;
                case DomainListSerializationMap.Children:
                    deserializeListItems(buffer, node.children = []);
                    break;
                case DomainListSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case DomainListSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}.`);
            }
            prop = buffer.readUint8();
        }
    }
}
var ModifierNodeSerializationMap;
(function (ModifierNodeSerializationMap) {
    ModifierNodeSerializationMap[ModifierNodeSerializationMap["Name"] = 1] = "Name";
    ModifierNodeSerializationMap[ModifierNodeSerializationMap["Value"] = 2] = "Value";
    ModifierNodeSerializationMap[ModifierNodeSerializationMap["Exception"] = 3] = "Exception";
    ModifierNodeSerializationMap[ModifierNodeSerializationMap["Start"] = 4] = "Start";
    ModifierNodeSerializationMap[ModifierNodeSerializationMap["End"] = 5] = "End";
})(ModifierNodeSerializationMap || (ModifierNodeSerializationMap = {}));
const FREQUENT_MODIFIERS_SERIALIZATION_MAP = new Map([
    ['_', 0],
    ['all', 1],
    ['app', 2],
    ['badfilter', 3],
    ['cname', 4],
    ['content', 5],
    ['cookie', 6],
    ['csp', 7],
    ['denyallow', 8],
    ['document', 9],
    ['doc', 10],
    ['domain', 11],
    ['from', 12],
    ['elemhide', 13],
    ['ehide', 14],
    ['empty', 15],
    ['first-party', 16],
    ['1p', 17],
    ['extension', 18],
    ['font', 19],
    ['genericblock', 20],
    ['generichide', 21],
    ['ghide', 22],
    ['header', 23],
    ['hls', 24],
    ['image', 25],
    ['important', 26],
    ['inline-font', 27],
    ['inline-script', 28],
    ['jsinject', 29],
    ['jsonprune', 30],
    ['match-case', 31],
    ['media', 32],
    ['method', 33],
    ['mp4', 34],
    ['network', 35],
    ['object-subrequest', 36],
    ['object', 37],
    ['other', 38],
    ['permissions', 39],
    ['ping', 40],
    ['popunder', 41],
    ['popup', 42],
    ['redirect-rule', 43],
    ['redirect', 44],
    ['rewrite', 45],
    ['referrerpolicy', 46],
    ['removeheader', 47],
    ['removeparam', 48],
    ['replace', 49],
    ['script', 50],
    ['specifichide', 51],
    ['shide', 52],
    ['stealth', 53],
    ['strict1p', 54],
    ['strict3p', 55],
    ['stylesheet', 56],
    ['css', 57],
    ['subdocument', 58],
    ['frame', 59],
    ['third-party', 60],
    ['3p', 61],
    ['to', 62],
    ['urlblock', 63],
    ['webrtc', 64],
    ['websocket', 65],
    ['xmlhttprequest', 66],
    ['xhr', 67],
]);
const FREQUENT_MODIFIERS_DESERIALIZATION_MAP = new Map(Array.from(FREQUENT_MODIFIERS_SERIALIZATION_MAP, ([key, value]) => [value, key]));
const FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP = new Map([
    ['1x1-transparent.gif', 0],
    ['2x2-transparent.png', 1],
    ['3x2-transparent.png', 2],
    ['32x32-transparent.png', 3],
    ['amazon-apstag', 4],
    ['ati-smarttag', 5],
    ['didomi-loader', 6],
    ['click2load.html', 7],
    ['fingerprintjs2', 8],
    ['fingerprintjs3', 9],
    ['google-analytics', 10],
    ['google-analytics-ga', 11],
    ['googlesyndication-adsbygoogle', 12],
    ['googlesyndication-adsbygoogle', 13],
    ['googletagmanager-gtm', 14],
    ['googletagmanager-gtm', 15],
    ['googletagservices-gpt', 16],
    ['google-ima3', 17],
    ['gemius', 18],
    ['matomo', 19],
    ['metrika-yandex-watch', 20],
    ['metrika-yandex-tag', 21],
    ['naver-wcslog', 22],
    ['noeval', 23],
    ['noopcss', 24],
    ['noopframe', 25],
    ['noopjs', 26],
    ['noopjson', 27],
    ['nooptext', 28],
    ['noopmp3-0.1s', 29],
    ['noopmp4-1s', 30],
    ['noopvmap-1.0', 31],
    ['noopvast-2.0', 32],
    ['noopvast-3.0', 33],
    ['noopvast-4.0', 34],
    ['prebid', 35],
    ['pardot-1.0', 36],
    ['prevent-bab', 37],
    ['prevent-bab2', 38],
    ['prevent-fab-3.2.0', 39],
    ['prevent-fab-3.2.0', 40],
    ['prevent-popads-net', 41],
    ['scorecardresearch-beacon', 42],
    ['set-popads-dummy', 43],
    ['empty', 44],
    ['prebid-ads', 45],
    ['1x1.gif', 60],
    ['2x2.png', 61],
    ['3x2.png', 62],
    ['32x32.png', 63],
    ['amazon_apstag.js', 64],
    ['click2load.html', 65],
    ['fingerprint2.js', 66],
    ['fingerprint3.js', 67],
    ['google-analytics_analytics.js', 68],
    ['google-analytics_ga.js', 69],
    ['googlesyndication_adsbygoogle.js', 70],
    ['googlesyndication.com/adsbygoogle.js', 71],
    ['google-analytics_ga.js', 72],
    ['googletagmanager_gtm.js', 73],
    ['googletagservices_gpt.js', 74],
    ['google-ima.js', 75],
    ['noeval-silent.js', 76],
    ['noop.css', 77],
    ['noop.html', 78],
    ['noop.js', 79],
    ['noop.json', 80],
    ['noop.txt', 81],
    ['noop-0.1s.mp3', 82],
    ['noop-1s.mp4', 83],
    ['noop-vmap1.0.xml', 84],
    ['nobab.js', 85],
    ['nobab2.js', 86],
    ['nofab.js', 87],
    ['fuckadblock.js-3.2.0', 88],
    ['popads.js', 89],
    ['scorecardresearch_beacon.js', 90],
    ['popads-dummy.js', 91],
    ['empty', 92],
    ['prebid-ads.js', 93],
    ['1x1-transparent-gif', 105],
    ['2x2-transparent-png', 106],
    ['3x2-transparent-png', 107],
    ['32x32-transparent-png', 108],
    ['blank-css', 109],
    ['blank-html', 110],
    ['blank-js', 111],
    ['blank-text', 112],
    ['blank-mp3', 113],
    ['blank-mp4', 114],
    ['abp-resource:1x1-transparent-gif', 120],
    ['abp-resource:2x2-transparent-png', 121],
    ['abp-resource:3x2-transparent-png', 122],
    ['abp-resource:32x32-transparent-png', 123],
    ['abp-resource:blank-css', 124],
    ['abp-resource:blank-html', 125],
    ['abp-resource:blank-js', 126],
    ['abp-resource:blank-text', 127],
    ['abp-resource:blank-mp3', 128],
    ['abp-resource:blank-mp4', 129],
]);
const FREQUENT_VALUES_SERIALIZATION_MAPS = new Map([
    ['redirect', FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP],
    ['redirect-rule', FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP],
    ['rewrite', FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP],
]);
const FREQUENT_VALUES_DESERIALIZATION_MAPS = new Map(Array.from(FREQUENT_VALUES_SERIALIZATION_MAPS, ([modifier, valueMap]) => [modifier, new Map(Array.from(valueMap, ([key, value]) => [value, key]))]));
class ModifierParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        let offset = 0;
        offset = StringUtils.skipWS(raw, offset);
        const modifierStart = offset;
        let exception = false;
        if (raw[offset] === NEGATION_MARKER) {
            offset += NEGATION_MARKER.length;
            exception = true;
        }
        offset = StringUtils.skipWS(raw, offset);
        const modifierNameStart = offset;
        const assignmentIndex = StringUtils.findNextUnescapedCharacter(raw, MODIFIER_ASSIGN_OPERATOR);
        const modifierEnd = Math.max(StringUtils.skipWSBack(raw) + 1, modifierNameStart);
        if (modifierNameStart === modifierEnd) {
            throw new AdblockSyntaxError('Modifier name cannot be empty', baseOffset, baseOffset + raw.length);
        }
        let modifier;
        let value;
        if (assignmentIndex === -1) {
            modifier = ValueParser.parse(raw.slice(modifierNameStart, modifierEnd), options, baseOffset + modifierNameStart);
        }
        else {
            const modifierNameEnd = StringUtils.skipWSBack(raw, assignmentIndex - 1) + 1;
            modifier = ValueParser.parse(raw.slice(modifierNameStart, modifierNameEnd), options, baseOffset + modifierNameStart);
            if (assignmentIndex + 1 === modifierEnd) {
                throw new AdblockSyntaxError('Modifier value cannot be empty', baseOffset, baseOffset + raw.length);
            }
            const valueStart = StringUtils.skipWS(raw, assignmentIndex + MODIFIER_ASSIGN_OPERATOR.length);
            value = ValueParser.parse(raw.slice(valueStart, modifierEnd), options, baseOffset + valueStart);
        }
        const result = {
            type: 'Modifier',
            name: modifier,
            value,
            exception,
        };
        if (options.isLocIncluded) {
            result.start = baseOffset + modifierStart;
            result.end = baseOffset + modifierEnd;
        }
        return result;
    }
    static generate(modifier) {
        let result = EMPTY;
        if (modifier.exception) {
            result += NEGATION_MARKER;
        }
        result += modifier.name.value;
        if (modifier.value !== undefined) {
            result += MODIFIER_ASSIGN_OPERATOR;
            result += modifier.value.value;
        }
        return result;
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.ModifierNode);
        buffer.writeUint8(ModifierNodeSerializationMap.Name);
        ValueParser.serialize(node.name, buffer, FREQUENT_MODIFIERS_SERIALIZATION_MAP);
        if (!isUndefined(node.value)) {
            buffer.writeUint8(ModifierNodeSerializationMap.Value);
            ValueParser.serialize(node.value, buffer, FREQUENT_VALUES_SERIALIZATION_MAPS.get(node.name.value));
        }
        buffer.writeUint8(ModifierNodeSerializationMap.Exception);
        buffer.writeUint8(node.exception ? 1 : 0);
        if (!isUndefined(node.start)) {
            buffer.writeUint8(ModifierNodeSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(ModifierNodeSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.ModifierNode);
        node.type = 'Modifier';
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case ModifierNodeSerializationMap.Name:
                    ValueParser.deserialize(buffer, node.name = {}, FREQUENT_MODIFIERS_DESERIALIZATION_MAP);
                    break;
                case ModifierNodeSerializationMap.Value:
                    if (node.name) {
                        ValueParser.deserialize(buffer, node.value = {}, FREQUENT_VALUES_DESERIALIZATION_MAPS.get(node.name.value));
                    }
                    else {
                        ValueParser.deserialize(buffer, node.value = {});
                    }
                    break;
                case ModifierNodeSerializationMap.Exception:
                    node.exception = buffer.readUint8() === 1;
                    break;
                case ModifierNodeSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case ModifierNodeSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}.`);
            }
            prop = buffer.readUint8();
        }
    }
}
var ModifierListNodeSerializationMap;
(function (ModifierListNodeSerializationMap) {
    ModifierListNodeSerializationMap[ModifierListNodeSerializationMap["Children"] = 1] = "Children";
    ModifierListNodeSerializationMap[ModifierListNodeSerializationMap["Start"] = 2] = "Start";
    ModifierListNodeSerializationMap[ModifierListNodeSerializationMap["End"] = 3] = "End";
})(ModifierListNodeSerializationMap || (ModifierListNodeSerializationMap = {}));
class ModifierListParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        const result = {
            type: 'ModifierList',
            children: [],
        };
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        let offset = StringUtils.skipWS(raw);
        let separatorIndex = -1;
        while (offset < raw.length) {
            offset = StringUtils.skipWS(raw, offset);
            const modifierStart = offset;
            separatorIndex = StringUtils.findNextUnescapedCharacter(raw, MODIFIERS_SEPARATOR, offset);
            const modifierEnd = separatorIndex === -1
                ? raw.length
                : StringUtils.skipWSBack(raw, separatorIndex - 1) + 1;
            const modifier = ModifierParser.parse(raw.slice(modifierStart, modifierEnd), options, baseOffset + modifierStart);
            result.children.push(modifier);
            offset = separatorIndex === -1 ? raw.length : separatorIndex + 1;
        }
        if (separatorIndex !== -1) {
            const modifierStart = StringUtils.skipWS(raw, separatorIndex + 1);
            result.children.push(ModifierParser.parse(raw.slice(modifierStart, raw.length), options, baseOffset + modifierStart));
        }
        return result;
    }
    static generate(ast) {
        const result = ast.children
            .map(ModifierParser.generate)
            .join(MODIFIERS_SEPARATOR);
        return result;
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.ModifierListNode);
        const count = node.children.length;
        if (count) {
            buffer.writeUint8(ModifierListNodeSerializationMap.Children);
            if (count > UINT16_MAX) {
                throw new Error(`Too many modifiers: ${count}, the limit is ${UINT16_MAX}`);
            }
            buffer.writeUint16(count);
            for (let i = 0; i < count; i += 1) {
                ModifierParser.serialize(node.children[i], buffer);
            }
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(ModifierListNodeSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(ModifierListNodeSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.ModifierListNode);
        node.type = 'ModifierList';
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case ModifierListNodeSerializationMap.Children:
                    node.children = new Array(buffer.readUint16());
                    for (let i = 0; i < node.children.length; i += 1) {
                        ModifierParser.deserialize(buffer, node.children[i] = {});
                    }
                    break;
                case ModifierListNodeSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case ModifierListNodeSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}.`);
            }
            prop = buffer.readUint8();
        }
    }
}
const END_OF_INPUT = 'end of input';
const ERROR_MESSAGES$6 = {
    EXPECTED_ANY_TOKEN_BUT_GOT: "Expected a token, but got '%s'",
    EXPECTED_TOKEN_BUT_GOT: "Expected '%s', but got '%s'",
    EXPECTED_TOKEN_WITH_BALANCE_BUT_GOT: "Expected '%s' with balance '%d', but got '%d'",
    EXPECTED_TOKEN_WITH_VALUE_BUT_GOT: "Expected '%s' with value '%s', but got '%s'",
};
const standardTokenPairs = new Map([
    [TokenType$1.Function, TokenType$1.CloseParenthesis],
    [TokenType$1.OpenParenthesis, TokenType$1.CloseParenthesis],
    [TokenType$1.OpenSquareBracket, TokenType$1.CloseSquareBracket],
    [TokenType$1.OpenCurlyBracket, TokenType$1.CloseCurlyBracket],
]);
const functionTokenPairs = new Map([
    [TokenType$1.Function, TokenType$1.CloseParenthesis],
    [TokenType$1.OpenParenthesis, TokenType$1.CloseParenthesis],
]);
const tokenizeWithBalancedPairs = (raw, onToken, onError = () => { }, functionHandlers, tokenPairs = standardTokenPairs) => {
    const stack = [];
    const values = new Set(tokenPairs.values());
    tokenizeExtended(raw, (type, start, end, props) => {
        if (tokenPairs.has(type)) {
            stack.push(tokenPairs.get(type));
        }
        else if (values.has(type)) {
            if (stack[stack.length - 1] === type) {
                stack.pop();
            }
            else {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_TOKEN_BUT_GOT, getFormattedTokenName(stack[stack.length - 1]), getFormattedTokenName(type)), start, raw.length);
            }
        }
        onToken(type, start, end, props, stack.length);
    }, onError, functionHandlers);
    if (stack.length > 0) {
        throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_TOKEN_BUT_GOT, getFormattedTokenName(stack[stack.length - 1]), END_OF_INPUT), raw.length - 1, raw.length);
    }
};
const tokenizeBalanced = (raw, onToken, onError = () => { }, functionHandlers) => {
    tokenizeWithBalancedPairs(raw, onToken, onError, functionHandlers);
};
const tokenizeFnBalanced = (raw, onToken, onError = () => { }, functionHandlers) => {
    tokenizeWithBalancedPairs(raw, onToken, onError, functionHandlers, functionTokenPairs);
};
const ERROR_MESSAGES$5 = {
    DUPLICATED_UBO_MODIFIER: "uBO modifier '%s' cannot be used more than once",
    EXPECTED_BUT_GOT_BEFORE: "Expected '%s' but got '%s' before '%s'",
    NEGATED_UBO_MODIFIER_CANNOT_BE_FOLLOWED_BY: "Negated uBO modifier '%s' cannot be followed by anything else than a closing parenthesis or a whitespace",
    NEGATED_UBO_MODIFIER_CANNOT_BE_PRECEDED_BY: "Negated uBO modifier '%s' cannot be preceded by '%s'",
    PSEUDO_CANNOT_BE_NESTED: "uBO modifier '%s' cannot be nested inside '%s', only '%s' is allowed as a wrapper",
    UBO_MODIFIER_CANNOT_BE_NESTED: "uBO modifier '%s' cannot be nested",
    UBO_STYLE_CANNOT_BE_FOLLOWED: 'uBO style injection cannot be followed by anything else than a whitespace',
};
const DUMMY_PARAM = '...';
var UboPseudoName;
(function (UboPseudoName) {
    UboPseudoName["MatchesMedia"] = "matches-media";
    UboPseudoName["MatchesPath"] = "matches-path";
    UboPseudoName["Remove"] = "remove";
    UboPseudoName["Style"] = "style";
})(UboPseudoName || (UboPseudoName = {}));
const KNOWN_UBO_MODIFIERS = new Set([
    UboPseudoName.MatchesMedia,
    UboPseudoName.MatchesPath,
    UboPseudoName.Remove,
    UboPseudoName.Style,
]);
const hasAnyUboModifier = (raw) => {
    let colonIndex = raw.indexOf(COLON);
    while (colonIndex !== -1) {
        const openingParenthesisIndex = raw.indexOf(OPEN_PARENTHESIS, colonIndex + 1);
        if (openingParenthesisIndex === -1) {
            return false;
        }
        if (KNOWN_UBO_MODIFIERS.has(raw.slice(colonIndex + 1, openingParenthesisIndex))) {
            return true;
        }
        colonIndex = raw.indexOf(COLON, openingParenthesisIndex + 1);
    }
    return false;
};
const formatPseudoName = (name, wrapper) => {
    const result = [];
    if (wrapper) {
        result.push(COLON, wrapper, OPEN_PARENTHESIS);
    }
    result.push(COLON, name, OPEN_PARENTHESIS, DUMMY_PARAM, CLOSE_PARENTHESIS);
    if (wrapper) {
        result.push(CLOSE_PARENTHESIS);
    }
    return result.join(EMPTY);
};
class UboSelectorParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        const modifiers = {
            type: 'ModifierList',
            children: [],
        };
        if (options.isLocIncluded) {
            modifiers.start = baseOffset;
            modifiers.end = baseOffset + raw.length;
        }
        if (!hasAnyUboModifier(raw)) {
            const selector = {
                type: 'Value',
                value: raw,
            };
            if (options.isLocIncluded) {
                selector.start = baseOffset;
                selector.end = baseOffset + raw.length;
            }
            const result = {
                type: 'UboSelector',
                selector,
                modifiers,
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
        const processedModifiers = new Set();
        const tokens = [];
        const uboIndexes = new Array(raw.length);
        const uboModifierStack = [];
        let i = 0;
        const stackModifier = (modifier) => {
            if (processedModifiers.has(modifier.name)) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.DUPLICATED_UBO_MODIFIER, formatPseudoName(modifier.name)), baseOffset + modifier.modifierStart, baseOffset + raw.length);
            }
            uboModifierStack.push(modifier);
        };
        tokenizeFnBalanced(raw, (type, start, end, _, balance) => {
            if ((processedModifiers.has(UboPseudoName.Style)
                || processedModifiers.has(UboPseudoName.Remove))
                && type !== TokenType$1.Whitespace) {
                throw new AdblockSyntaxError(ERROR_MESSAGES$5.UBO_STYLE_CANNOT_BE_FOLLOWED, baseOffset + start, baseOffset + raw.length);
            }
            if (tokens[i - 1]?.type === TokenType$1.Colon && type === TokenType$1.Function) {
                const fn = raw.slice(start, end - 1);
                if (KNOWN_UBO_MODIFIERS.has(fn)) {
                    if (balance > 1) {
                        if (fn === UboPseudoName.MatchesPath) {
                            if (uboModifierStack.length > 0) {
                                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.PSEUDO_CANNOT_BE_NESTED, formatPseudoName(UboPseudoName.MatchesPath), formatPseudoName(uboModifierStack[uboModifierStack.length - 1].name), formatPseudoName(CSS_NOT_PSEUDO)), baseOffset + start - 1, baseOffset + raw.length);
                            }
                            let isException = false;
                            let modifierBalance = balance;
                            let modifierStart = start;
                            for (let j = i - 1; j >= 0; j -= 1) {
                                if (tokens[j].balance === 0) {
                                    modifierStart = tokens[j].start;
                                    modifierBalance = tokens[j].balance;
                                    break;
                                }
                                else if (tokens[j].type === TokenType$1.Colon
                                    || tokens[j].type === TokenType$1.Whitespace) {
                                    continue;
                                }
                                else if (tokens[j].type === TokenType$1.Function) {
                                    const wrapperFnName = raw.slice(tokens[j].start, tokens[j].end - 1);
                                    if (wrapperFnName !== CSS_NOT_PSEUDO) {
                                        throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.PSEUDO_CANNOT_BE_NESTED, formatPseudoName(UboPseudoName.MatchesPath), formatPseudoName(wrapperFnName), formatPseudoName(CSS_NOT_PSEUDO)), baseOffset + tokens[j].start - 1, baseOffset + raw.length);
                                    }
                                    if (tokens[j - 1]?.type !== TokenType$1.Colon) {
                                        const got = tokens[j - 1]?.type
                                            ? getFormattedTokenName(tokens[j - 1]?.type)
                                            : 'nothing';
                                        throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.EXPECTED_BUT_GOT_BEFORE, getFormattedTokenName(TokenType$1.Colon), got, formatPseudoName(UboPseudoName.MatchesPath, CSS_NOT_PSEUDO)),
                                        baseOffset + tokens[j - 1]?.start || 0, baseOffset + raw.length);
                                    }
                                    isException = !isException;
                                    continue;
                                }
                                else {
                                    throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.NEGATED_UBO_MODIFIER_CANNOT_BE_PRECEDED_BY, formatPseudoName(UboPseudoName.MatchesPath), getFormattedTokenName(tokens[j].type)), baseOffset + tokens[j].start, baseOffset + raw.length);
                                }
                            }
                            stackModifier({
                                name: fn,
                                modifierStart,
                                modifierBalance,
                                nameStart: start,
                                nameEnd: end - 1,
                                valueStart: end,
                                valueBalance: balance,
                                isException,
                            });
                        }
                        else {
                            throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.UBO_MODIFIER_CANNOT_BE_NESTED, formatPseudoName(fn)), baseOffset + start - 1, baseOffset + raw.length);
                        }
                    }
                    else {
                        stackModifier({
                            name: fn,
                            modifierStart: start - 1,
                            modifierBalance: balance,
                            nameStart: start,
                            nameEnd: end - 1,
                            valueStart: end,
                            valueBalance: balance,
                            isException: false,
                        });
                    }
                }
            }
            else {
                const lastStackedModifier = uboModifierStack[uboModifierStack.length - 1];
                if (lastStackedModifier?.name === UboPseudoName.MatchesPath && lastStackedModifier?.isException) {
                    if (!(type === TokenType$1.CloseParenthesis || type === TokenType$1.Whitespace)
                        && balance < lastStackedModifier.valueBalance) {
                        throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.NEGATED_UBO_MODIFIER_CANNOT_BE_FOLLOWED_BY, formatPseudoName(UboPseudoName.MatchesPath), getFormattedTokenName(type)), baseOffset + start, baseOffset + raw.length);
                    }
                }
                if (type === TokenType$1.CloseParenthesis && lastStackedModifier) {
                    if (balance === Math.max(0, lastStackedModifier.valueBalance - 1)) {
                        lastStackedModifier.valueEnd = start;
                    }
                    if (balance === Math.max(0, lastStackedModifier.modifierBalance - 1)) {
                        const modifierName = {
                            type: 'Value',
                            value: lastStackedModifier.name,
                        };
                        if (options.isLocIncluded) {
                            modifierName.start = baseOffset + lastStackedModifier.nameStart;
                            modifierName.end = baseOffset + lastStackedModifier.nameEnd;
                        }
                        const value = {
                            type: 'Value',
                            value: raw.slice(lastStackedModifier.valueStart, lastStackedModifier.valueEnd),
                        };
                        if (options.isLocIncluded) {
                            value.start = baseOffset + lastStackedModifier.valueStart;
                            value.end = baseOffset + lastStackedModifier.valueEnd;
                        }
                        const modifier = {
                            type: 'Modifier',
                            name: modifierName,
                            value,
                            exception: lastStackedModifier.isException,
                        };
                        if (options.isLocIncluded) {
                            modifier.start = baseOffset + lastStackedModifier.modifierStart;
                            modifier.end = baseOffset + end;
                        }
                        modifiers.children.push(modifier);
                        processedModifiers.add(lastStackedModifier.name);
                        uboModifierStack.pop();
                        uboIndexes.fill(true, lastStackedModifier.modifierStart, end);
                    }
                }
            }
            tokens.push({
                type,
                start,
                end,
                balance,
            });
            i += 1;
        });
        const selector = {
            type: 'Value',
            value: raw
                .split(EMPTY)
                .map((char, p) => (uboIndexes[p] ? EMPTY : char))
                .join(EMPTY)
                .trim(),
        };
        if (options.isLocIncluded) {
            selector.start = baseOffset;
            selector.end = baseOffset + raw.length;
        }
        const result = {
            type: 'UboSelector',
            selector,
            modifiers,
        };
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        return result;
    }
    static generate(node) {
        const prefix = [];
        const suffix = [];
        if (node.modifiers) {
            for (const modifier of node.modifiers.children) {
                switch (modifier.name.value) {
                    case UboPseudoName.Remove:
                    case UboPseudoName.Style:
                        suffix.push(COLON, modifier.name.value, OPEN_PARENTHESIS, modifier.value?.value || EMPTY, CLOSE_PARENTHESIS);
                        break;
                    default:
                        if (modifier.exception) {
                            prefix.push(COLON, CSS_NOT_PSEUDO, OPEN_PARENTHESIS);
                        }
                        prefix.push(COLON, modifier.name.value, OPEN_PARENTHESIS, modifier.value?.value || EMPTY, CLOSE_PARENTHESIS);
                        if (modifier.exception) {
                            prefix.push(CLOSE_PARENTHESIS);
                        }
                        break;
                }
            }
        }
        let result = EMPTY;
        if (prefix.length > 0) {
            result += prefix.join(EMPTY);
            if (node.selector?.value) {
                result += SPACE$1;
            }
        }
        result += node.selector?.value || EMPTY;
        result += suffix.join(EMPTY);
        return result;
    }
}
const LEGACY_EXT_CSS_ATTRIBUTE_PREFIX = '-ext-';
const ABP_EXT_CSS_PREFIX = '-abp';
const EXT_CSS_PSEUDO_CLASSES_STRICT = new Set([
    'contains',
    'if-not',
    'matches-attr',
    'matches-css',
    'matches-property',
    'nth-ancestor',
    'remove',
    'upward',
    'xpath',
    'has-text',
    'matches-css-after',
    'matches-css-before',
    'matches-path',
    'min-text-length',
    'watch-attr',
    '-abp-contains',
    '-abp-has',
    '-abp-properties',
]);
const EXT_CSS_PSEUDO_CLASSES = new Set([
    ...EXT_CSS_PSEUDO_CLASSES_STRICT,
    'has',
    'is',
]);
class CssTokenStream {
    tokens = [];
    source = EMPTY;
    index = 0;
    baseOffset;
    constructor(source, baseOffset = 0) {
        this.source = source;
        tokenizeBalanced(source, (type, start, end, _, balance) => {
            this.tokens.push({
                type,
                start,
                end,
                balance,
            });
        });
        this.index = 0;
        this.baseOffset = baseOffset;
    }
    get length() {
        return this.tokens.length;
    }
    isEof() {
        return this.index >= this.tokens.length;
    }
    get(index = this.index) {
        return this.tokens[index];
    }
    getOrFail(index = this.index) {
        const token = this.get(index);
        if (!token) {
            throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_ANY_TOKEN_BUT_GOT, END_OF_INPUT), this.baseOffset + this.source.length - 1, this.baseOffset + this.source.length);
        }
        return token;
    }
    fragment(index = this.index) {
        const token = this.get(index);
        if (token) {
            return this.source.slice(token.start, token.end);
        }
        return EMPTY;
    }
    advance() {
        if (this.isEof()) {
            return undefined;
        }
        this.index += 1;
        return this.tokens[this.index];
    }
    lookahead(index = 1) {
        return this.tokens[this.index + Math.max(1, index)];
    }
    lookbehind(index = 1) {
        if (this.index === 0) {
            return undefined;
        }
        return this.tokens[this.index - Math.max(1, index)];
    }
    lookbehindForNonWs() {
        for (let i = this.index - 1; i >= 0; i -= 1) {
            if (this.tokens[i].type !== TokenType$1.Whitespace) {
                return this.tokens[i];
            }
        }
        return undefined;
    }
    skipWhitespace() {
        while (this.get()?.type === TokenType$1.Whitespace) {
            this.index += 1;
        }
    }
    skipUntilBalanced() {
        if (this.isEof()) {
            return 0;
        }
        const currentBalance = this.get().balance;
        if (currentBalance === 0) {
            return 0;
        }
        let skipped = 0;
        while (!this.isEof() && this.get()?.balance !== currentBalance - 1) {
            this.index += 1;
            skipped += 1;
        }
        return skipped;
    }
    skipUntil(type, balance) {
        let skipped = 0;
        while (!this.isEof()
            && (this.get()?.type !== type || (balance !== undefined && this.get()?.balance !== balance))) {
            this.index += 1;
            skipped += 1;
        }
        return skipped;
    }
    skipUntilExt(type, balance) {
        let i = this.index;
        let firstNonWsToken = -1;
        let lastNonWsToken = -1;
        while (i < this.tokens.length) {
            const currentToken = this.tokens[i];
            if (currentToken.type === TokenType$1.Whitespace) {
                i += 1;
                continue;
            }
            else if (currentToken.type === type && currentToken.balance === balance) {
                break;
            }
            if (firstNonWsToken === -1) {
                firstNonWsToken = i;
            }
            lastNonWsToken = i;
            i += 1;
        }
        const skipped = i - this.index;
        this.index = i;
        return {
            skipped,
            skippedTrimmed: firstNonWsToken === -1 ? 0 : lastNonWsToken - firstNonWsToken + 1,
        };
    }
    expectNotEof() {
        if (this.isEof()) {
            throw new AdblockSyntaxError('Unexpected end of input', this.baseOffset + this.source.length - 1, this.baseOffset + this.source.length);
        }
    }
    expect(type, data) {
        const token = this.get();
        if (!token) {
            throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_TOKEN_BUT_GOT, getFormattedTokenName(type), END_OF_INPUT), this.baseOffset + this.source.length - 1, this.baseOffset + this.source.length);
        }
        if (token.type !== type) {
            throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_TOKEN_BUT_GOT, getFormattedTokenName(type), getFormattedTokenName(token.type)), this.baseOffset + token.start, this.baseOffset + token.end);
        }
        if (data?.balance !== undefined && token.balance !== data.balance) {
            throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_TOKEN_WITH_BALANCE_BUT_GOT, getFormattedTokenName(type), data.balance, token.balance), this.baseOffset + token.start, this.baseOffset + token.end);
        }
        if (data?.value && this.fragment() !== data.value) {
            throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_TOKEN_WITH_VALUE_BUT_GOT, getFormattedTokenName(type), data.value, this.fragment()), this.baseOffset + token.start, this.baseOffset + token.end);
        }
    }
    getBalance(index = this.index) {
        return this.tokens[index]?.balance || 0;
    }
    hasAnySelectorExtendedCssNode() {
        return this.hasAnySelectorExtendedCssNodeInternal(EXT_CSS_PSEUDO_CLASSES);
    }
    hasAnySelectorExtendedCssNodeStrict() {
        return this.hasAnySelectorExtendedCssNodeInternal(EXT_CSS_PSEUDO_CLASSES_STRICT);
    }
    hasAnySelectorExtendedCssNodeInternal(pseudos) {
        for (let i = 0; i < this.tokens.length; i += 1) {
            const token = this.tokens[i];
            if (token.type === TokenType$1.Function) {
                const name = this.source.slice(token.start, token.end - 1);
                if (pseudos.has(name)) {
                    return true;
                }
            }
            else if (token.type === TokenType$1.OpenSquareBracket) {
                let j = i + 1;
                while (j < this.tokens.length && this.tokens[j].type === TokenType$1.Whitespace) {
                    j += 1;
                }
                if (j < this.tokens.length && this.tokens[j].type === TokenType$1.Ident) {
                    const attr = this.source.slice(this.tokens[j].start, this.tokens[j].end);
                    if (attr.startsWith(LEGACY_EXT_CSS_ATTRIBUTE_PREFIX) || attr.startsWith(ABP_EXT_CSS_PREFIX)) {
                        return true;
                    }
                }
                i = j;
            }
        }
        return false;
    }
}
const REMOVE_PROPERTY$1 = 'remove';
const REMOVE_VALUE = 'true';
const removeDeclaration = `${REMOVE_PROPERTY$1}${COLON}${SPACE$1}${REMOVE_VALUE}${SEMICOLON}`;
const ERROR_MESSAGES$4 = {
    MEDIA_QUERY_LIST_IS_EMPTY: 'Media query list is empty',
    SELECTOR_LIST_IS_EMPTY: 'Selector list is empty',
    DECLARATION_LIST_IS_EMPTY: 'Declaration list is empty',
};
class AdgCssInjectionParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        let mediaQueryList;
        const selectorList = { type: 'Value', value: EMPTY };
        const declarationList = { type: 'Value', value: EMPTY };
        const stream = new CssTokenStream(raw, baseOffset);
        stream.skipWhitespace();
        let balanceShift = 0;
        if (stream.getOrFail().type === TokenType$1.AtKeyword) {
            stream.expect(TokenType$1.AtKeyword, { value: CSS_MEDIA_MARKER, balance: 0 });
            stream.advance();
            stream.skipWhitespace();
            const mediaQueryListStart = stream.getOrFail().start;
            let lastNonWsIndex = -1;
            while (!stream.isEof()) {
                const token = stream.getOrFail();
                if (token.type === TokenType$1.OpenCurlyBracket && token.balance === 1) {
                    break;
                }
                if (token.type !== TokenType$1.Whitespace) {
                    lastNonWsIndex = token.end;
                }
                stream.advance();
            }
            if (lastNonWsIndex === -1) {
                throw new AdblockSyntaxError(ERROR_MESSAGES$4.MEDIA_QUERY_LIST_IS_EMPTY, baseOffset + mediaQueryListStart, baseOffset + raw.length);
            }
            const mediaQueryListEnd = lastNonWsIndex;
            mediaQueryList = {
                type: 'Value',
                value: raw.slice(mediaQueryListStart, mediaQueryListEnd),
            };
            if (options.isLocIncluded) {
                mediaQueryList.start = baseOffset + mediaQueryListStart;
                mediaQueryList.end = baseOffset + mediaQueryListEnd;
            }
            stream.expect(TokenType$1.OpenCurlyBracket);
            stream.advance();
            balanceShift = 1;
        }
        stream.skipWhitespace();
        const selectorStart = stream.getOrFail().start;
        const { skippedTrimmed: selectorTokensLength } = stream.skipUntilExt(TokenType$1.OpenCurlyBracket, balanceShift + 1);
        stream.expect(TokenType$1.OpenCurlyBracket);
        if (selectorTokensLength === 0) {
            throw new AdblockSyntaxError(ERROR_MESSAGES$4.SELECTOR_LIST_IS_EMPTY, baseOffset + selectorStart, baseOffset + raw.length);
        }
        const selectorEnd = stream.lookbehindForNonWs().end;
        selectorList.value = raw.slice(selectorStart, selectorEnd);
        if (options.isLocIncluded) {
            selectorList.start = baseOffset + selectorStart;
            selectorList.end = baseOffset + selectorEnd;
        }
        stream.advance();
        stream.skipWhitespace();
        const declarationsStart = stream.getOrFail().start;
        const declarations = new Set();
        let declarationsEnd = -1;
        let remove = false;
        let lastNonWsIndex = -1;
        while (!stream.isEof()) {
            const token = stream.getOrFail();
            if (token.type === TokenType$1.CloseCurlyBracket && stream.getBalance() === balanceShift) {
                declarationsEnd = lastNonWsIndex;
                break;
            }
            if (token.type !== TokenType$1.Whitespace) {
                lastNonWsIndex = token.end;
            }
            if (token.type === TokenType$1.Ident && stream.lookahead()?.type === TokenType$1.Colon) {
                const ident = raw.slice(token.start, token.end);
                declarations.add(ident);
                stream.advance();
                stream.advance();
                if (ident === REMOVE_PROPERTY$1) {
                    stream.skipWhitespace();
                    stream.expect(TokenType$1.Ident, { value: REMOVE_VALUE });
                    stream.advance();
                    remove = true;
                }
            }
            else {
                stream.advance();
            }
        }
        if (declarationsEnd === -1) {
            throw new AdblockSyntaxError(ERROR_MESSAGES$4.DECLARATION_LIST_IS_EMPTY, baseOffset + declarationsStart, baseOffset + raw.length);
        }
        declarationList.value = raw.slice(declarationsStart, declarationsEnd);
        if (options.isLocIncluded) {
            declarationList.start = baseOffset + declarationsStart;
            declarationList.end = baseOffset + declarationsEnd;
        }
        stream.expect(TokenType$1.CloseCurlyBracket);
        stream.advance();
        stream.skipWhitespace();
        if (balanceShift === 1) {
            stream.expect(TokenType$1.CloseCurlyBracket);
            stream.advance();
        }
        const result = {
            type: 'CssInjectionRuleBody',
            selectorList,
            declarationList,
            remove,
        };
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        if (mediaQueryList) {
            result.mediaQueryList = mediaQueryList;
        }
        return result;
    }
    static generate(node) {
        const result = [];
        if (node.mediaQueryList) {
            result.push(CSS_MEDIA_MARKER, SPACE$1, node.mediaQueryList.value, SPACE$1, OPEN_CURLY_BRACKET, SPACE$1);
        }
        result.push(node.selectorList.value, SPACE$1, OPEN_CURLY_BRACKET, SPACE$1);
        if (node.remove) {
            result.push(removeDeclaration);
        }
        else if (node.declarationList?.value) {
            result.push(node.declarationList.value);
        }
        result.push(SPACE$1, CLOSE_CURLY_BRACKET);
        if (node.mediaQueryList) {
            result.push(SPACE$1, CLOSE_CURLY_BRACKET);
        }
        return result.join(EMPTY);
    }
}
var AbpSnippetBodySerializationMap;
(function (AbpSnippetBodySerializationMap) {
    AbpSnippetBodySerializationMap[AbpSnippetBodySerializationMap["Children"] = 1] = "Children";
    AbpSnippetBodySerializationMap[AbpSnippetBodySerializationMap["Start"] = 2] = "Start";
    AbpSnippetBodySerializationMap[AbpSnippetBodySerializationMap["End"] = 3] = "End";
})(AbpSnippetBodySerializationMap || (AbpSnippetBodySerializationMap = {}));
const serializeScriptletBody = (node, buffer, frequentScriptletArgs) => {
    buffer.writeUint8(BinaryTypeMap.ScriptletInjectionRuleBodyNode);
    const { length } = node.children;
    buffer.writeUint8(AbpSnippetBodySerializationMap.Children);
    if (length > UINT8_MAX) {
        throw new Error(`Too many scriptlet children: ${length}, the limit is ${UINT8_MAX}`);
    }
    buffer.writeUint8(length);
    for (let i = 0; i < length; i += 1) {
        ParameterListParser.serialize(node.children[i], buffer, frequentScriptletArgs);
    }
    if (!isUndefined(node.start)) {
        buffer.writeUint8(AbpSnippetBodySerializationMap.Start);
        buffer.writeUint32(node.start);
    }
    if (!isUndefined(node.end)) {
        buffer.writeUint8(AbpSnippetBodySerializationMap.End);
        buffer.writeUint32(node.end);
    }
    buffer.writeUint8(NULL);
};
const deserializeScriptletBody = (buffer, node, frequentScriptletArgs) => {
    buffer.assertUint8(BinaryTypeMap.ScriptletInjectionRuleBodyNode);
    node.type = 'ScriptletInjectionRuleBody';
    let prop = buffer.readUint8();
    while (prop !== NULL) {
        switch (prop) {
            case AbpSnippetBodySerializationMap.Children:
                node.children = new Array(buffer.readUint8());
                for (let i = 0; i < node.children.length; i += 1) {
                    ParameterListParser.deserialize(buffer, node.children[i] = {}, frequentScriptletArgs);
                }
                break;
            case AbpSnippetBodySerializationMap.Start:
                node.start = buffer.readUint32();
                break;
            case AbpSnippetBodySerializationMap.End:
                node.end = buffer.readUint32();
                break;
            default:
                throw new Error(`Invalid property: ${prop}`);
        }
        prop = buffer.readUint8();
    }
};
class AbpSnippetInjectionBodyParser extends ParserBase {
    static ERROR_MESSAGES = {
        EMPTY_SCRIPTLET_CALL: 'Empty ABP snippet call',
    };
    static FREQUENT_ARGS_SERIALIZATION_MAP = new Map([
        ['abort-current-inline-script', 0],
        ['abort-on-property-read', 1],
        ['abort-on-property-write', 2],
        ['json-prune', 3],
        ['log', 4],
        ['prevent-listener', 5],
        ['cookie-remover', 6],
        ['override-property-read', 7],
        ['abort-on-iframe-property-read', 8],
        ['abort-on-iframe-property-write', 9],
        ['freeze-element', 10],
        ['json-override', 11],
        ['simulate-mouse-event', 12],
        ['strip-fetch-query-parameter', 13],
        ['hide-if-contains', 14],
        ['hide-if-contains-image', 15],
        ['hide-if-contains-image-hash', 16],
        ['hide-if-contains-similar-text', 17],
        ['hide-if-contains-visible-text', 18],
        ['hide-if-contains-and-matches-style', 19],
        ['hide-if-graph-matches', 20],
        ['hide-if-has-and-matches-style', 21],
        ['hide-if-labelled-by', 22],
        ['hide-if-matches-xpath', 23],
        ['hide-if-matches-computed-xpath', 24],
        ['hide-if-shadow-contains', 25],
        ['debug', 26],
        ['trace', 27],
        ['race', 28],
    ]);
    static FREQUENT_ARGS_DESERIALIZATION_MAP = new Map(Array.from(this.FREQUENT_ARGS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        const result = {
            type: 'ScriptletInjectionRuleBody',
            children: [],
        };
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        let offset = 0;
        offset = StringUtils.skipWS(raw, offset);
        while (offset < raw.length) {
            offset = StringUtils.skipWS(raw, offset);
            const scriptletCallStart = offset;
            let semicolonIndex = StringUtils.findUnescapedNonStringNonRegexChar(raw, SEMICOLON, offset);
            if (semicolonIndex === -1) {
                semicolonIndex = raw.length;
            }
            const scriptletCallEnd = Math.max(StringUtils.skipWSBack(raw, semicolonIndex - 1) + 1, scriptletCallStart);
            const params = ParameterListParser.parse(raw.slice(scriptletCallStart, scriptletCallEnd), options, baseOffset + scriptletCallStart, SPACE$1);
            result.children.push(params);
            offset = semicolonIndex + 1;
        }
        if (result.children.length === 0) {
            throw new AdblockSyntaxError(this.ERROR_MESSAGES.EMPTY_SCRIPTLET_CALL, baseOffset, baseOffset + raw.length);
        }
        return result;
    }
    static generate(node) {
        const result = [];
        if (node.children.length === 0) {
            throw new Error(this.ERROR_MESSAGES.EMPTY_SCRIPTLET_CALL);
        }
        for (const scriptletCall of node.children) {
            if (scriptletCall.children.length === 0) {
                throw new Error(this.ERROR_MESSAGES.EMPTY_SCRIPTLET_CALL);
            }
            result.push(ParameterListParser.generate(scriptletCall, SPACE$1));
        }
        return result.join(SEMICOLON + SPACE$1);
    }
    static serialize(node, buffer) {
        serializeScriptletBody(node, buffer, this.FREQUENT_ARGS_SERIALIZATION_MAP);
    }
    static deserialize(buffer, node) {
        deserializeScriptletBody(buffer, node, this.FREQUENT_ARGS_DESERIALIZATION_MAP);
    }
}
const QUOTE_SET = new Set([
    SINGLE_QUOTE,
    DOUBLE_QUOTE,
    BACKTICK_QUOTE,
]);
var QuoteType;
(function (QuoteType) {
    QuoteType["None"] = "none";
    QuoteType["Single"] = "single";
    QuoteType["Double"] = "double";
    QuoteType["Backtick"] = "backtick";
})(QuoteType || (QuoteType = {}));
class QuoteUtils {
    static escapeUnescapedOccurrences(string, char) {
        let result = EMPTY;
        for (let i = 0; i < string.length; i += 1) {
            if (string[i] === char && (i === 0 || string[i - 1] !== ESCAPE_CHARACTER)) {
                result += ESCAPE_CHARACTER;
            }
            result += string[i];
        }
        return result;
    }
    static unescapeSingleEscapedOccurrences(string, char) {
        let result = EMPTY;
        for (let i = 0; i < string.length; i += 1) {
            if (string[i] === char
                && string[i - 1] === ESCAPE_CHARACTER
                && (i === 1 || string[i - 2] !== ESCAPE_CHARACTER)) {
                result = result.slice(0, -1);
            }
            result += string[i];
        }
        return result;
    }
    static getStringQuoteType(string) {
        if (string.length > 1) {
            if (string.startsWith(SINGLE_QUOTE) && string.endsWith(SINGLE_QUOTE)) {
                return QuoteType.Single;
            }
            if (string.startsWith(DOUBLE_QUOTE) && string.endsWith(DOUBLE_QUOTE)) {
                return QuoteType.Double;
            }
            if (string.startsWith(BACKTICK_QUOTE) && string.endsWith(BACKTICK_QUOTE)) {
                return QuoteType.Backtick;
            }
        }
        return QuoteType.None;
    }
    static setStringQuoteType(string, quoteType) {
        const actualQuoteType = QuoteUtils.getStringQuoteType(string);
        switch (quoteType) {
            case QuoteType.None:
                if (actualQuoteType === QuoteType.Single) {
                    return QuoteUtils.escapeUnescapedOccurrences(string.slice(1, -1), SINGLE_QUOTE);
                }
                if (actualQuoteType === QuoteType.Double) {
                    return QuoteUtils.escapeUnescapedOccurrences(string.slice(1, -1), DOUBLE_QUOTE);
                }
                if (actualQuoteType === QuoteType.Backtick) {
                    return QuoteUtils.escapeUnescapedOccurrences(string.slice(1, -1), BACKTICK_QUOTE);
                }
                return string;
            case QuoteType.Single:
                if (actualQuoteType === QuoteType.None) {
                    return SINGLE_QUOTE + QuoteUtils.escapeUnescapedOccurrences(string, SINGLE_QUOTE) + SINGLE_QUOTE;
                }
                if (actualQuoteType === QuoteType.Double) {
                    return SINGLE_QUOTE
                        + QuoteUtils.escapeUnescapedOccurrences(QuoteUtils.unescapeSingleEscapedOccurrences(string.slice(1, -1), DOUBLE_QUOTE), SINGLE_QUOTE) + SINGLE_QUOTE;
                }
                if (actualQuoteType === QuoteType.Backtick) {
                    return SINGLE_QUOTE
                        + QuoteUtils.escapeUnescapedOccurrences(QuoteUtils.unescapeSingleEscapedOccurrences(string.slice(1, -1), BACKTICK_QUOTE), SINGLE_QUOTE) + SINGLE_QUOTE;
                }
                return string;
            case QuoteType.Double:
                if (actualQuoteType === QuoteType.None) {
                    return DOUBLE_QUOTE + QuoteUtils.escapeUnescapedOccurrences(string, DOUBLE_QUOTE) + DOUBLE_QUOTE;
                }
                if (actualQuoteType !== QuoteType.Double) {
                    return DOUBLE_QUOTE
                        + QuoteUtils.escapeUnescapedOccurrences(QuoteUtils.unescapeSingleEscapedOccurrences(string.slice(1, -1), SINGLE_QUOTE), DOUBLE_QUOTE) + DOUBLE_QUOTE;
                }
                return string;
            case QuoteType.Backtick:
                if (actualQuoteType === QuoteType.None) {
                    return BACKTICK_QUOTE + QuoteUtils.escapeUnescapedOccurrences(string, BACKTICK_QUOTE) + BACKTICK_QUOTE;
                }
                if (actualQuoteType !== QuoteType.Backtick) {
                    return BACKTICK_QUOTE
                        + QuoteUtils.escapeUnescapedOccurrences(QuoteUtils.unescapeSingleEscapedOccurrences(string.slice(1, -1), SINGLE_QUOTE), BACKTICK_QUOTE) + BACKTICK_QUOTE;
                }
                return string;
            default:
                return string;
        }
    }
    static removeQuotes(string) {
        if (
        string.length > 1
            && (string[0] === SINGLE_QUOTE || string[0] === DOUBLE_QUOTE || string[0] === BACKTICK_QUOTE)
            && string[0] === string[string.length - 1]) {
            return string.slice(1, -1);
        }
        return string;
    }
    static removeQuotesAndUnescape(string) {
        if (
        string.length > 1
            && (string[0] === SINGLE_QUOTE || string[0] === DOUBLE_QUOTE || string[0] === BACKTICK_QUOTE)
            && string[0] === string[string.length - 1]) {
            return QuoteUtils.unescapeSingleEscapedOccurrences(string.slice(1, -1), string[0]);
        }
        return string;
    }
    static quoteAndJoinStrings(strings, quoteType = QuoteType.Single, separator = `${COMMA}${SPACE$1}`) {
        return strings
            .map((s) => QuoteUtils.setStringQuoteType(s, quoteType))
            .join(separator);
    }
}
class UboParameterListParser extends ParameterListParser {
    static parse(raw, options = defaultParserOptions, baseOffset = 0, separator = COMMA, requireQuotes = false, supportedQuotes = QUOTE_SET) {
        const params = {
            type: 'ParameterList',
            children: [],
        };
        const { length } = raw;
        if (options.isLocIncluded) {
            params.start = baseOffset;
            params.end = baseOffset + length;
        }
        let offset = 0;
        let extraNull = false;
        while (offset < length) {
            offset = StringUtils.skipWS(raw, offset);
            const paramStart = offset;
            let paramEnd = offset;
            if (supportedQuotes.has(raw[offset])) {
                const possibleClosingQuoteIndex = StringUtils.findNextUnescapedCharacter(raw, raw[offset], offset + 1);
                if (possibleClosingQuoteIndex !== -1) {
                    const nextSeparatorIndex = StringUtils.skipWS(raw, possibleClosingQuoteIndex + 1);
                    if (nextSeparatorIndex === length) {
                        if (requireQuotes) {
                            throw new AdblockSyntaxError('Expected separator, got end of string', baseOffset + nextSeparatorIndex, baseOffset + length);
                        }
                        paramEnd = StringUtils.skipWSBack(raw, length - 1) + 1;
                        offset = length;
                    }
                    else if (raw[nextSeparatorIndex] === separator) {
                        paramEnd = possibleClosingQuoteIndex + 1;
                        offset = nextSeparatorIndex + 1;
                    }
                    else {
                        if (requireQuotes) {
                            throw new AdblockSyntaxError(`Expected separator, got: '${raw[nextSeparatorIndex]}'`, baseOffset + nextSeparatorIndex, baseOffset + length);
                        }
                        offset = StringUtils.findNextUnescapedCharacterBackwards(raw, separator, possibleClosingQuoteIndex) + 1;
                        paramEnd = StringUtils.skipWSBack(raw, offset - 2) + 1;
                    }
                }
                else {
                    if (requireQuotes) {
                        throw new AdblockSyntaxError('Expected closing quote, got end of string', baseOffset + offset, baseOffset + length);
                    }
                    paramEnd = StringUtils.skipWSBack(raw, length - 1) + 1;
                    offset = length;
                }
            }
            else {
                if (requireQuotes) {
                    throw new AdblockSyntaxError(`Expected quote, got: '${raw[offset]}'`, baseOffset + offset, baseOffset + length);
                }
                const nextSeparator = StringUtils.findNextUnescapedCharacter(raw, separator, offset);
                if (nextSeparator === -1) {
                    paramEnd = StringUtils.skipWSBack(raw, length - 1) + 1;
                    offset = length;
                }
                else {
                    paramEnd = StringUtils.skipWSBack(raw, nextSeparator - 1) + 1;
                    offset = nextSeparator + 1;
                    if (StringUtils.skipWS(raw, length - 1) === nextSeparator) {
                        extraNull = true;
                    }
                }
            }
            if (paramStart < paramEnd) {
                params.children.push(ValueParser.parse(raw.slice(paramStart, paramEnd), options, baseOffset + paramStart));
            }
            else {
                params.children.push(null);
            }
        }
        if (extraNull) {
            params.children.push(null);
        }
        return params;
    }
}
class UboScriptletInjectionBodyParser extends ParserBase {
    static ERROR_MESSAGES = {
        NO_SCRIPTLET_MASK: `Invalid uBO scriptlet call, no scriptlet call mask '${UBO_SCRIPTLET_MASK}' found`,
        NO_OPENING_PARENTHESIS: `Invalid uBO scriptlet call, no opening parentheses '${OPEN_PARENTHESIS}' found`,
        NO_CLOSING_PARENTHESIS: `Invalid uBO scriptlet call, no closing parentheses '${CLOSE_PARENTHESIS}' found`,
        NO_SCRIPTLET_NAME: 'Invalid uBO scriptlet call, no scriptlet name specified',
        WHITESPACE_AFTER_MASK: 'Invalid uBO scriptlet call, whitespace is not allowed after the scriptlet call mask',
        NO_MULTIPLE_SCRIPTLET_CALLS: 'uBO syntaxes does not support multiple scriptlet calls within one single rule',
    };
    static FREQUENT_ARGS_SERIALIZATION_MAP = new Map([
        ['abort-current-script.js', 0],
        ['acs.js', 1],
        ['abort-current-inline-script.js', 2],
        ['acis.js', 3],
        ['abort-on-property-read.js', 4],
        ['aopr.js', 5],
        ['abort-on-property-write.js', 6],
        ['aopw.js', 7],
        ['abort-on-stack-trace.js', 8],
        ['aost.js', 9],
        ['adjust-setInterval.js', 10],
        ['nano-setInterval-booster.js', 11],
        ['nano-sib.js', 12],
        ['adjust-setTimeout.js', 13],
        ['nano-setTimeout-booster.js', 14],
        ['nano-stb.js', 15],
        ['close-window.js', 16],
        ['window-close-if.js', 17],
        ['disable-newtab-links.js', 18],
        ['evaldata-prune.js', 19],
        ['json-prune.js', 20],
        ['addEventListener-logger.js', 21],
        ['aell.js', 22],
        ['m3u-prune.js', 23],
        ['nowebrtc.js', 24],
        ['addEventListener-defuser.js', 25],
        ['aeld.js', 26],
        ['prevent-addEventListener.js', 27],
        ['adfly-defuser.js', 28],
        ['noeval-if.js', 29],
        ['prevent-eval-if.js', 30],
        ['no-fetch-if.js', 31],
        ['prevent-fetch.js', 32],
        ['no-xhr-if.js', 33],
        ['prevent-xhr.js', 34],
        ['prevent-refresh.js', 35],
        ['refresh-defuser.js', 36],
        ['no-requestAnimationFrame-if.js', 37],
        ['norafif.js', 38],
        ['prevent-requestAnimationFrame.js', 39],
        ['no-setInterval-if.js', 40],
        ['nosiif.js', 41],
        ['prevent-setInterval.js', 42],
        ['setInterval-defuser.js', 43],
        ['no-setTimeout-if.js', 44],
        ['nostif.js', 45],
        ['prevent-setTimeout.js', 46],
        ['setTimeout-defuser.js', 47],
        ['no-window-open-if.js', 48],
        ['nowoif.js', 49],
        ['prevent-window-open.js', 50],
        ['window.open-defuser.js', 51],
        ['remove-attr.js', 52],
        ['ra.js', 53],
        ['remove-class.js', 54],
        ['rc.js', 55],
        ['remove-cookie.js', 56],
        ['cookie-remover.js', 57],
        ['remove-node-text.js', 58],
        ['rmnt.js', 59],
        ['set-attr.js', 60],
        ['set-constant.js', 61],
        ['set.js', 62],
        ['set-cookie.js', 63],
        ['set-local-storage-item.js', 64],
        ['set-session-storage-item.js', 65],
        ['xml-prune.js', 66],
        ['webrtc-if.js', 67],
        ['overlay-buster.js', 68],
        ['alert-buster.js', 69],
        ['golem.de.js', 70],
        ['href-sanitizer.js', 71],
        ['call-nothrow.js', 72],
        ['window.name-defuser.js', 73],
        ['spoof-css.js', 74],
        ['trusted-set-constant.js', 75],
        ['trusted-set.js', 76],
        ['trusted-set-cookie.js', 77],
        ['trusted-set-local-storage-item.js', 78],
        ['trusted-replace-fetch-response.js', 79],
        ['json-prune-fetch-response.js', 80],
        ['json-prune-xhr-response.js', 81],
        ['trusted-replace-xhr-response.js', 82],
        ['multiup.js', 83],
        ['prevent-canvas.js', 84],
        ['set-cookie-reload.js', 85],
        ['trusted-set-cookie-reload.js', 86],
        ['trusted-click-element.js', 87],
        ['trusted-prune-inbound-object.js', 88],
        ['trusted-prune-outbound-object.js', 89],
        ['trusted-set-session-storage-item.js', 90],
        ['trusted-replace-node-text.js', 91],
        ['trusted-rpnt.js', 92],
        ['replace-node-text.js', 93],
        ['rpnt.js', 94],
    ]);
    static FREQUENT_ARGS_DESERIALIZATION_MAP = new Map(Array.from(this.FREQUENT_ARGS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        let offset = 0;
        offset = StringUtils.skipWS(raw, offset);
        let scriptletMaskLength = 0;
        if (raw.startsWith(UBO_SCRIPTLET_MASK, offset)) {
            scriptletMaskLength = UBO_SCRIPTLET_MASK.length;
        }
        else if (raw.startsWith(UBO_SCRIPTLET_MASK_LEGACY, offset)) {
            scriptletMaskLength = UBO_SCRIPTLET_MASK_LEGACY.length;
        }
        if (!scriptletMaskLength) {
            throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_SCRIPTLET_MASK, baseOffset + offset, baseOffset + raw.length);
        }
        offset += scriptletMaskLength;
        if (raw[offset] === SPACE$1) {
            throw new AdblockSyntaxError(this.ERROR_MESSAGES.WHITESPACE_AFTER_MASK, baseOffset + offset, baseOffset + raw.length);
        }
        if (raw[offset] !== OPEN_PARENTHESIS) {
            throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_OPENING_PARENTHESIS, baseOffset + offset, baseOffset + raw.length);
        }
        const openingParenthesesIndex = offset;
        const closingParenthesesIndex = StringUtils.skipWSBack(raw, raw.length - 1);
        if (raw[closingParenthesesIndex] !== CLOSE_PARENTHESIS
            || raw[closingParenthesesIndex - 1] === ESCAPE_CHARACTER) {
            throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_CLOSING_PARENTHESIS, baseOffset + offset, baseOffset + raw.length);
        }
        const result = {
            type: 'ScriptletInjectionRuleBody',
            children: [],
        };
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        if (StringUtils.skipWS(raw, openingParenthesesIndex + 1) === closingParenthesesIndex) {
            return result;
        }
        const params = UboParameterListParser.parse(raw.slice(openingParenthesesIndex + 1, closingParenthesesIndex), options, baseOffset + openingParenthesesIndex + 1, COMMA);
        if (params.children.length > 0 && params.children[0] === null) {
            throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_SCRIPTLET_NAME, baseOffset + offset, baseOffset + raw.length);
        }
        result.children.push(params);
        return result;
    }
    static generate(node) {
        const result = [];
        if (node.children.length > 1) {
            throw new Error(this.ERROR_MESSAGES.NO_MULTIPLE_SCRIPTLET_CALLS);
        }
        result.push(UBO_SCRIPTLET_MASK);
        result.push(OPEN_PARENTHESIS);
        if (node.children.length > 0) {
            const [parameterListNode] = node.children;
            result.push(ParameterListParser.generate(parameterListNode));
        }
        result.push(CLOSE_PARENTHESIS);
        return result.join(EMPTY);
    }
    static serialize(node, buffer) {
        serializeScriptletBody(node, buffer, this.FREQUENT_ARGS_SERIALIZATION_MAP);
    }
    static deserialize(buffer, node) {
        deserializeScriptletBody(buffer, node, this.FREQUENT_ARGS_DESERIALIZATION_MAP);
    }
}
class AdgScriptletInjectionBodyParser extends ParserBase {
    static ERROR_MESSAGES = {
        NO_SCRIPTLET_MASK: `Invalid ADG scriptlet call, no scriptlet call mask '${ADG_SCRIPTLET_MASK}' found`,
        NO_OPENING_PARENTHESIS: `Invalid ADG scriptlet call, no opening parentheses '${OPEN_PARENTHESIS}' found`,
        NO_CLOSING_PARENTHESIS: `Invalid ADG scriptlet call, no closing parentheses '${CLOSE_PARENTHESIS}' found`,
        WHITESPACE_AFTER_MASK: 'Invalid ADG scriptlet call, whitespace is not allowed after the scriptlet call mask',
        NO_MULTIPLE_SCRIPTLET_CALLS: 'ADG syntaxes does not support multiple scriptlet calls within one single rule',
        NO_INCONSISTENT_QUOTES: 'Invalid ADG scriptlet call, inconsistent quotes',
        NO_UNCLOSED_PARAMETER: 'Invalid ADG scriptlet call, unclosed parameter',
        EXPECTED_QUOTE: "Invalid ADG scriptlet call, expected quote, got '%s'",
        EXPECTED_COMMA: "Invalid ADG scriptlet call, expected comma, got '%s'",
    };
    static FREQUENT_ARGS_SERIALIZATION_MAP = new Map([
        ['abort-current-inline-script', 0],
        ['abort-on-property-read', 1],
        ['abort-on-property-write', 2],
        ['abort-on-stack-trace', 3],
        ['adjust-setInterval', 4],
        ['adjust-setTimeout', 5],
        ['close-window', 6],
        ['debug-current-inline-script', 7],
        ['debug-on-property-read', 8],
        ['debug-on-property-write', 9],
        ['dir-string', 10],
        ['disable-newtab-links', 11],
        ['evaldata-prune', 12],
        ['json-prune', 13],
        ['log', 14],
        ['log-addEventListener', 15],
        ['log-eval', 16],
        ['log-on-stack-trace', 17],
        ['m3u-prune', 18],
        ['noeval', 19],
        ['nowebrtc', 20],
        ['no-topics', 21],
        ['prevent-addEventListener', 22],
        ['prevent-adfly', 23],
        ['prevent-bab', 24],
        ['prevent-eval-if', 25],
        ['prevent-fab-3.2.0', 26],
        ['prevent-fetch', 27],
        ['prevent-xhr', 28],
        ['prevent-popads-net', 29],
        ['prevent-refresh', 30],
        ['prevent-requestAnimationFrame', 31],
        ['prevent-setInterval', 32],
        ['prevent-setTimeout', 33],
        ['prevent-window-open', 34],
        ['remove-attr', 35],
        ['remove-class', 36],
        ['remove-cookie', 37],
        ['remove-node-text', 38],
        ['set-attr', 39],
        ['set-constant', 40],
        ['set-cookie', 41],
        ['set-cookie-reload', 42],
        ['set-local-storage-item', 43],
        ['set-popads-dummy', 44],
        ['set-session-storage-item', 45],
        ['xml-prune', 46],
    ]);
    static FREQUENT_ARGS_DESERIALIZATION_MAP = new Map(Array.from(this.FREQUENT_ARGS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        let offset = 0;
        offset = StringUtils.skipWS(raw, offset);
        if (!raw.startsWith(ADG_SCRIPTLET_MASK, offset)) {
            throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_SCRIPTLET_MASK, baseOffset + offset, baseOffset + raw.length);
        }
        offset += ADG_SCRIPTLET_MASK.length;
        if (raw[offset] === SPACE$1) {
            throw new AdblockSyntaxError(this.ERROR_MESSAGES.WHITESPACE_AFTER_MASK, baseOffset + offset, baseOffset + raw.length);
        }
        if (raw[offset] !== OPEN_PARENTHESIS) {
            throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_OPENING_PARENTHESIS, baseOffset + offset, baseOffset + raw.length);
        }
        const openingParenthesesIndex = offset;
        const closingParenthesesIndex = StringUtils.skipWSBack(raw, raw.length - 1);
        if (raw[closingParenthesesIndex] !== CLOSE_PARENTHESIS
            || raw[closingParenthesesIndex - 1] === ESCAPE_CHARACTER) {
            throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_CLOSING_PARENTHESIS, baseOffset + offset, baseOffset + raw.length);
        }
        offset = StringUtils.skipWS(raw, offset + 1);
        const result = {
            type: 'ScriptletInjectionRuleBody',
            children: [],
        };
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        if (StringUtils.skipWS(raw, openingParenthesesIndex + 1) === closingParenthesesIndex) {
            return result;
        }
        let detectedQuote = null;
        const parameterList = {
            type: 'ParameterList',
            children: [],
        };
        if (options.isLocIncluded) {
            parameterList.start = baseOffset + openingParenthesesIndex + 1;
            parameterList.end = baseOffset + closingParenthesesIndex;
        }
        while (offset < closingParenthesesIndex) {
            offset = StringUtils.skipWS(raw, offset);
            if (parameterList.children.length > 0) {
                if (raw[offset] !== COMMA) {
                    throw new AdblockSyntaxError(sprintf.sprintf(AdgScriptletInjectionBodyParser.ERROR_MESSAGES.EXPECTED_COMMA, raw[offset]), baseOffset + offset, baseOffset + raw.length);
                }
                offset += 1;
                offset = StringUtils.skipWS(raw, offset);
            }
            if (raw[offset] === SINGLE_QUOTE || raw[offset] === DOUBLE_QUOTE) {
                if (isNull(detectedQuote)) {
                    detectedQuote = raw[offset];
                }
                else if (detectedQuote !== raw[offset]) {
                    throw new AdblockSyntaxError(AdgScriptletInjectionBodyParser.ERROR_MESSAGES.NO_INCONSISTENT_QUOTES, baseOffset + offset, baseOffset + raw.length);
                }
                const closingQuoteIndex = StringUtils.findNextUnescapedCharacter(raw, detectedQuote, offset + 1);
                if (closingQuoteIndex === -1) {
                    throw new AdblockSyntaxError(AdgScriptletInjectionBodyParser.ERROR_MESSAGES.NO_UNCLOSED_PARAMETER, baseOffset + offset, baseOffset + raw.length);
                }
                const parameter = ValueParser.parse(raw.slice(offset, closingQuoteIndex + 1), options, baseOffset + offset);
                parameterList.children.push(parameter);
                offset = StringUtils.skipWS(raw, closingQuoteIndex + 1);
            }
            else {
                throw new AdblockSyntaxError(sprintf.sprintf(AdgScriptletInjectionBodyParser.ERROR_MESSAGES.EXPECTED_QUOTE, raw[offset]), baseOffset + offset, baseOffset + raw.length);
            }
        }
        result.children.push(parameterList);
        return result;
    }
    static generate(node) {
        const result = [];
        if (node.children.length > 1) {
            throw new Error(this.ERROR_MESSAGES.NO_MULTIPLE_SCRIPTLET_CALLS);
        }
        result.push(ADG_SCRIPTLET_MASK);
        result.push(OPEN_PARENTHESIS);
        if (node.children.length > 0) {
            result.push(ParameterListParser.generate(node.children[0]));
        }
        result.push(CLOSE_PARENTHESIS);
        return result.join(EMPTY);
    }
    static serialize(node, buffer) {
        serializeScriptletBody(node, buffer, this.FREQUENT_ARGS_SERIALIZATION_MAP);
    }
    static deserialize(buffer, node) {
        deserializeScriptletBody(buffer, node, this.FREQUENT_ARGS_DESERIALIZATION_MAP);
    }
}
const SEPARATOR_SERIALIZATION_MAP = new Map([
    ['##', 0],
    ['#@#', 1],
    ['#?#', 2],
    ['#@?#', 3],
    ['#$#', 4],
    ['#$?#', 5],
    ['#@$#', 6],
    ['#@$?#', 7],
    ['#%#', 8],
    ['#@%#', 9],
    ['$$', 10],
    ['$@$', 11],
]);
const SEPARATOR_DESERIALIZATION_MAP = new Map(Array.from(SEPARATOR_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
const COSMETIC_RULE_TYPE_DESERIALIZATION_MAP = new Map([
    [BinaryTypeMap.ElementHidingRule, CosmeticRuleType.ElementHidingRule],
    [BinaryTypeMap.CssInjectionRule, CosmeticRuleType.CssInjectionRule],
    [BinaryTypeMap.ScriptletInjectionRule, CosmeticRuleType.ScriptletInjectionRule],
    [BinaryTypeMap.JsInjectionRule, CosmeticRuleType.JsInjectionRule],
    [BinaryTypeMap.HtmlFilteringRule, CosmeticRuleType.HtmlFilteringRule],
]);
var ElementHidingRuleSerializationMap;
(function (ElementHidingRuleSerializationMap) {
    ElementHidingRuleSerializationMap[ElementHidingRuleSerializationMap["SelectorList"] = 1] = "SelectorList";
    ElementHidingRuleSerializationMap[ElementHidingRuleSerializationMap["Start"] = 2] = "Start";
    ElementHidingRuleSerializationMap[ElementHidingRuleSerializationMap["End"] = 3] = "End";
})(ElementHidingRuleSerializationMap || (ElementHidingRuleSerializationMap = {}));
var CssInjectionRuleSerializationMap;
(function (CssInjectionRuleSerializationMap) {
    CssInjectionRuleSerializationMap[CssInjectionRuleSerializationMap["SelectorList"] = 1] = "SelectorList";
    CssInjectionRuleSerializationMap[CssInjectionRuleSerializationMap["DeclarationList"] = 2] = "DeclarationList";
    CssInjectionRuleSerializationMap[CssInjectionRuleSerializationMap["MediaQueryList"] = 3] = "MediaQueryList";
    CssInjectionRuleSerializationMap[CssInjectionRuleSerializationMap["Remove"] = 4] = "Remove";
    CssInjectionRuleSerializationMap[CssInjectionRuleSerializationMap["Start"] = 5] = "Start";
    CssInjectionRuleSerializationMap[CssInjectionRuleSerializationMap["End"] = 6] = "End";
})(CssInjectionRuleSerializationMap || (CssInjectionRuleSerializationMap = {}));
var CosmeticRuleSerializationMap;
(function (CosmeticRuleSerializationMap) {
    CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Syntax"] = 1] = "Syntax";
    CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Exception"] = 2] = "Exception";
    CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Separator"] = 3] = "Separator";
    CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Modifiers"] = 4] = "Modifiers";
    CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Domains"] = 5] = "Domains";
    CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Body"] = 6] = "Body";
    CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Start"] = 7] = "Start";
    CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["End"] = 8] = "End";
})(CosmeticRuleSerializationMap || (CosmeticRuleSerializationMap = {}));
const ERROR_MESSAGES$3 = {
    EMPTY_RULE_BODY: 'Empty rule body',
    INVALID_BODY_FOR_SEPARATOR: "Body '%s' is not valid for the '%s' cosmetic rule separator",
    MISSING_ADGUARD_MODIFIER_LIST_END: "Missing '%s' at the end of the AdGuard modifier list in pattern '%s'",
    MISSING_ADGUARD_MODIFIER_LIST_MARKER: "Missing '%s' at the beginning of the AdGuard modifier list in pattern '%s'",
    SYNTAXES_CANNOT_BE_MIXED: "'%s' syntax cannot be mixed with '%s' syntax",
    SYNTAX_DISABLED: "Parsing '%s' syntax is disabled, but the rule uses it",
};
const ADG_CSS_INJECTION_PATTERN = /^(?:.+){(?:.+)}$/;
class CosmeticRuleParser extends ParserBase {
    static isCosmeticRule(raw) {
        const trimmed = raw.trim();
        if (CommentRuleParser.isCommentRule(trimmed)) {
            return false;
        }
        return CosmeticRuleSeparatorUtils.find(trimmed) !== null;
    }
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        const separatorResult = CosmeticRuleSeparatorUtils.find(raw);
        if (!separatorResult) {
            return null;
        }
        let syntax = AdblockSyntax.Common;
        let modifiers;
        const patternStart = StringUtils.skipWS(raw);
        const patternEnd = StringUtils.skipWSBack(raw, separatorResult.start - 1) + 1;
        const bodyStart = StringUtils.skipWS(raw, separatorResult.end);
        const bodyEnd = StringUtils.skipWSBack(raw) + 1;
        if (bodyEnd <= bodyStart) {
            throw new AdblockSyntaxError(ERROR_MESSAGES$3.EMPTY_RULE_BODY, baseOffset, baseOffset + raw.length);
        }
        const rawPattern = raw.slice(patternStart, patternEnd);
        let patternOffset = patternStart;
        if (rawPattern[patternOffset] === OPEN_SQUARE_BRACKET) {
            const modifierListStart = patternOffset;
            patternOffset += 1;
            patternOffset = StringUtils.skipWS(rawPattern, patternOffset);
            if (rawPattern[patternOffset] !== DOLLAR_SIGN) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.MISSING_ADGUARD_MODIFIER_LIST_MARKER, DOLLAR_SIGN, rawPattern), baseOffset + patternOffset, baseOffset + rawPattern.length);
            }
            patternOffset += 1;
            patternOffset = StringUtils.skipWS(rawPattern, patternOffset);
            const modifierListEnd = StringUtils.findLastUnescapedCharacter(rawPattern, CLOSE_SQUARE_BRACKET);
            if (modifierListEnd === -1) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.MISSING_ADGUARD_MODIFIER_LIST_END, CLOSE_SQUARE_BRACKET, rawPattern), baseOffset + patternOffset, baseOffset + rawPattern.length);
            }
            modifiers = ModifierListParser.parse(raw.slice(patternOffset, modifierListEnd), options, baseOffset + patternOffset);
            if (options.isLocIncluded) {
                modifiers.start = baseOffset + modifierListStart;
                modifiers.end = baseOffset + modifierListEnd + 1;
            }
            patternOffset = modifierListEnd + 1;
            syntax = AdblockSyntax.Adg;
        }
        patternOffset = StringUtils.skipWS(rawPattern, patternOffset);
        const domains = DomainListParser.parse(rawPattern.slice(patternOffset), options, baseOffset + patternOffset);
        const separator = {
            type: 'Value',
            value: separatorResult.separator,
        };
        if (options.isLocIncluded) {
            separator.start = baseOffset + separatorResult.start;
            separator.end = baseOffset + separatorResult.end;
        }
        const exception = CosmeticRuleSeparatorUtils.isException(separatorResult.separator);
        let rawBody = raw.slice(bodyStart, bodyEnd);
        const expectCommonOrSpecificSyntax = (expectedSyntax) => {
            if (syntax !== AdblockSyntax.Common && syntax !== expectedSyntax) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.SYNTAXES_CANNOT_BE_MIXED, expectedSyntax, syntax), baseOffset + patternStart, baseOffset + bodyEnd);
            }
        };
        let uboSelector;
        if (options.parseUboSpecificRules) {
            uboSelector = UboSelectorParser.parse(rawBody, options, baseOffset + bodyStart);
            rawBody = uboSelector.selector.value;
            if (uboSelector.modifiers && uboSelector.modifiers.children.length > 0) {
                expectCommonOrSpecificSyntax(AdblockSyntax.Ubo);
                syntax = AdblockSyntax.Ubo;
                for (const modifier of uboSelector.modifiers.children) {
                    if (modifier.name.value === UboPseudoName.MatchesPath) {
                        if (!modifiers) {
                            modifiers = {
                                type: 'ModifierList',
                                children: [],
                            };
                            if (options.isLocIncluded) {
                                modifiers.start = baseOffset + bodyStart;
                                modifiers.end = baseOffset + bodyEnd;
                            }
                        }
                        modifiers.children.push(modifier);
                    }
                }
            }
        }
        const raws = {
            text: raw,
        };
        const baseRule = {
            category: RuleCategory.Cosmetic,
            exception,
            modifiers,
            domains,
            separator,
        };
        if (options.includeRaws) {
            baseRule.raws = raws;
        }
        if (options.isLocIncluded) {
            baseRule.start = baseOffset;
            baseRule.end = baseOffset + raw.length;
        }
        const parseUboCssInjection = () => {
            if (!uboSelector || !uboSelector.modifiers || uboSelector.modifiers.children?.length < 1) {
                return null;
            }
            expectCommonOrSpecificSyntax(AdblockSyntax.Ubo);
            const selectorList = uboSelector.selector;
            let declarationList;
            let mediaQueryList;
            let remove = false;
            for (const modifier of uboSelector.modifiers.children) {
                switch (modifier.name.value) {
                    case UboPseudoName.Style:
                        declarationList = modifier.value;
                        break;
                    case UboPseudoName.Remove:
                        declarationList = {
                            type: 'Value',
                            value: '',
                        };
                        remove = true;
                        break;
                    case UboPseudoName.MatchesMedia:
                        mediaQueryList = modifier.value;
                        break;
                }
            }
            if (!declarationList) {
                return null;
            }
            const body = {
                type: 'CssInjectionRuleBody',
                selectorList,
                declarationList,
                mediaQueryList,
                remove,
            };
            if (options.isLocIncluded) {
                body.start = baseOffset + bodyStart;
                body.end = baseOffset + bodyEnd;
            }
            return {
                syntax: AdblockSyntax.Ubo,
                type: CosmeticRuleType.CssInjectionRule,
                body,
            };
        };
        const parseElementHiding = () => {
            const selectorList = {
                type: 'Value',
                value: rawBody,
            };
            if (options.isLocIncluded) {
                selectorList.start = baseOffset + bodyStart;
                selectorList.end = baseOffset + bodyEnd;
            }
            const body = {
                type: 'ElementHidingRuleBody',
                selectorList,
            };
            if (options.isLocIncluded) {
                body.start = baseOffset + bodyStart;
                body.end = baseOffset + bodyEnd;
            }
            return {
                syntax,
                type: CosmeticRuleType.ElementHidingRule,
                body,
            };
        };
        const parseAdgCssInjection = () => {
            if (!ADG_CSS_INJECTION_PATTERN.test(rawBody)) {
                return null;
            }
            expectCommonOrSpecificSyntax(AdblockSyntax.Adg);
            return {
                syntax: AdblockSyntax.Adg,
                type: CosmeticRuleType.CssInjectionRule,
                body: AdgCssInjectionParser.parse(rawBody, options, baseOffset + bodyStart),
            };
        };
        const parseAbpSnippetInjection = () => {
            if (!options.parseAbpSpecificRules) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.SYNTAX_DISABLED, AdblockSyntax.Abp), baseOffset + bodyStart, baseOffset + bodyEnd);
            }
            expectCommonOrSpecificSyntax(AdblockSyntax.Abp);
            const body = AbpSnippetInjectionBodyParser.parse(rawBody, options, baseOffset + bodyStart);
            if (options.isLocIncluded) {
                body.start = baseOffset + bodyStart;
                body.end = baseOffset + bodyEnd;
            }
            return {
                syntax: AdblockSyntax.Abp,
                type: CosmeticRuleType.ScriptletInjectionRule,
                body,
            };
        };
        const parseUboScriptletInjection = () => {
            if (!rawBody.startsWith(UBO_SCRIPTLET_MASK) && !rawBody.startsWith(UBO_SCRIPTLET_MASK_LEGACY)) {
                return null;
            }
            if (!options.parseUboSpecificRules) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.SYNTAX_DISABLED, AdblockSyntax.Ubo), baseOffset + bodyStart, baseOffset + bodyEnd);
            }
            expectCommonOrSpecificSyntax(AdblockSyntax.Ubo);
            const body = UboScriptletInjectionBodyParser.parse(rawBody, options, baseOffset + bodyStart);
            if (options.isLocIncluded) {
                body.start = baseOffset + bodyStart;
                body.end = baseOffset + bodyEnd;
            }
            return {
                syntax: AdblockSyntax.Ubo,
                type: CosmeticRuleType.ScriptletInjectionRule,
                body,
            };
        };
        const parseAdgScriptletInjection = () => {
            if (!rawBody.startsWith(ADG_SCRIPTLET_MASK)) {
                return null;
            }
            expectCommonOrSpecificSyntax(AdblockSyntax.Adg);
            const body = AdgScriptletInjectionBodyParser.parse(rawBody, options, baseOffset + bodyStart);
            if (options.isLocIncluded) {
                body.start = baseOffset + bodyStart;
                body.end = baseOffset + bodyEnd;
            }
            return {
                syntax: AdblockSyntax.Adg,
                type: CosmeticRuleType.ScriptletInjectionRule,
                body,
            };
        };
        const parseAdgJsInjection = () => {
            expectCommonOrSpecificSyntax(AdblockSyntax.Adg);
            const body = {
                type: 'Value',
                value: rawBody,
            };
            if (options.isLocIncluded) {
                body.start = baseOffset + bodyStart;
                body.end = baseOffset + bodyEnd;
            }
            return {
                syntax: AdblockSyntax.Adg,
                type: CosmeticRuleType.JsInjectionRule,
                body,
            };
        };
        const parseUboHtmlFiltering = () => {
            if (!rawBody.startsWith(UBO_HTML_MASK)) {
                return null;
            }
            if (!options.parseUboSpecificRules) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.SYNTAX_DISABLED, AdblockSyntax.Ubo), baseOffset + bodyStart, baseOffset + bodyEnd);
            }
            expectCommonOrSpecificSyntax(AdblockSyntax.Ubo);
            const body = {
                type: 'Value',
                value: rawBody,
            };
            if (options.isLocIncluded) {
                body.start = baseOffset + bodyStart;
                body.end = baseOffset + bodyEnd;
            }
            return {
                syntax: AdblockSyntax.Ubo,
                type: CosmeticRuleType.HtmlFilteringRule,
                body,
            };
        };
        const parseAdgHtmlFiltering = () => {
            expectCommonOrSpecificSyntax(AdblockSyntax.Adg);
            const body = {
                type: 'Value',
                value: rawBody,
            };
            if (options.isLocIncluded) {
                body.start = baseOffset + bodyStart;
                body.end = baseOffset + bodyEnd;
            }
            return {
                syntax: AdblockSyntax.Adg,
                type: CosmeticRuleType.HtmlFilteringRule,
                body,
            };
        };
        const separatorMap = {
            '##': [parseUboHtmlFiltering, parseUboScriptletInjection, parseUboCssInjection, parseElementHiding],
            '#@#': [parseUboHtmlFiltering, parseUboScriptletInjection, parseUboCssInjection, parseElementHiding],
            '#?#': [parseUboCssInjection, parseElementHiding],
            '#@?#': [parseUboCssInjection, parseElementHiding],
            '#$#': [parseAdgCssInjection, parseAbpSnippetInjection],
            '#@$#': [parseAdgCssInjection, parseAbpSnippetInjection],
            '#$?#': [parseAdgCssInjection],
            '#@$?#': [parseAdgCssInjection],
            '#%#': [parseAdgScriptletInjection, parseAdgJsInjection],
            '#@%#': [parseAdgScriptletInjection, parseAdgJsInjection],
            $$: [parseAdgHtmlFiltering],
            '$@$': [parseAdgHtmlFiltering],
        };
        const parseFunctions = separatorMap[separatorResult.separator];
        let restProps;
        for (const parseFunction of parseFunctions) {
            restProps = parseFunction();
            if (restProps) {
                break;
            }
        }
        if (!restProps) {
            throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.INVALID_BODY_FOR_SEPARATOR, rawBody, separatorResult.separator), baseOffset + bodyStart, baseOffset + bodyEnd);
        }
        return {
            ...baseRule,
            ...restProps,
        };
    }
    static generatePattern(node) {
        let result = EMPTY;
        if (node.syntax === AdblockSyntax.Adg && node.modifiers && node.modifiers.children.length > 0) {
            result += OPEN_SQUARE_BRACKET;
            result += DOLLAR_SIGN;
            result += ModifierListParser.generate(node.modifiers);
            result += CLOSE_SQUARE_BRACKET;
        }
        result += DomainListParser.generate(node.domains);
        return result;
    }
    static generateBody(node) {
        let result = EMPTY;
        switch (node.type) {
            case CosmeticRuleType.ElementHidingRule:
                result = node.body.selectorList.value;
                break;
            case CosmeticRuleType.CssInjectionRule:
                if (node.syntax === AdblockSyntax.Adg) {
                    result = AdgCssInjectionParser.generate(node.body);
                }
                else if (node.syntax === AdblockSyntax.Ubo) {
                    if (node.body.mediaQueryList) {
                        result += COLON;
                        result += UboPseudoName.MatchesMedia;
                        result += OPEN_PARENTHESIS;
                        result += node.body.mediaQueryList.value;
                        result += CLOSE_PARENTHESIS;
                        result += SPACE$1;
                    }
                    result += node.body.selectorList.value;
                    if (node.body.remove) {
                        result += COLON;
                        result += UboPseudoName.Remove;
                        result += OPEN_PARENTHESIS;
                        result += CLOSE_PARENTHESIS;
                    }
                    else if (node.body.declarationList) {
                        result += COLON;
                        result += UboPseudoName.Style;
                        result += OPEN_PARENTHESIS;
                        result += node.body.declarationList.value;
                        result += CLOSE_PARENTHESIS;
                    }
                }
                break;
            case CosmeticRuleType.HtmlFilteringRule:
            case CosmeticRuleType.JsInjectionRule:
                result = node.body.value;
                break;
            case CosmeticRuleType.ScriptletInjectionRule:
                switch (node.syntax) {
                    case AdblockSyntax.Adg:
                        result = AdgScriptletInjectionBodyParser.generate(node.body);
                        break;
                    case AdblockSyntax.Abp:
                        result = AbpSnippetInjectionBodyParser.generate(node.body);
                        break;
                    case AdblockSyntax.Ubo:
                        result = UboScriptletInjectionBodyParser.generate(node.body);
                        break;
                    default:
                        throw new Error('Scriptlet rule should have an explicit syntax');
                }
                break;
            default:
                throw new Error('Unknown cosmetic rule type');
        }
        return result;
    }
    static generate(node) {
        let result = EMPTY;
        result += CosmeticRuleParser.generatePattern(node);
        result += node.separator.value;
        if (node.syntax === AdblockSyntax.Ubo && node.modifiers) {
            node.modifiers.children.forEach((modifier) => {
                result += COLON;
                result += modifier.name.value;
                if (modifier.value) {
                    result += OPEN_PARENTHESIS;
                    result += modifier.value.value;
                    result += CLOSE_PARENTHESIS;
                }
            });
            if (node.modifiers.children.length) {
                result += SPACE$1;
            }
        }
        result += CosmeticRuleParser.generateBody(node);
        return result;
    }
    static serializeElementHidingBody(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.ElementHidingRuleBody);
        buffer.writeUint8(ElementHidingRuleSerializationMap.SelectorList);
        ValueParser.serialize(node.selectorList, buffer);
        if (!isUndefined(node.start)) {
            buffer.writeUint8(ElementHidingRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(ElementHidingRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserializeElementHidingBody(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.ElementHidingRuleBody);
        node.type = 'ElementHidingRuleBody';
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case ElementHidingRuleSerializationMap.SelectorList:
                    ValueParser.deserialize(buffer, node.selectorList = {});
                    break;
                case ElementHidingRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case ElementHidingRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Unknown property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
    static serializeCssInjectionBody(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.CssInjectionRuleBody);
        if (node.mediaQueryList) {
            buffer.writeUint8(CssInjectionRuleSerializationMap.MediaQueryList);
            ValueParser.serialize(node.mediaQueryList, buffer);
        }
        buffer.writeUint8(CssInjectionRuleSerializationMap.SelectorList);
        ValueParser.serialize(node.selectorList, buffer);
        if (node.declarationList) {
            buffer.writeUint8(CssInjectionRuleSerializationMap.DeclarationList);
            ValueParser.serialize(node.declarationList, buffer);
        }
        if (node.remove) {
            buffer.writeUint8(CssInjectionRuleSerializationMap.Remove);
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(CssInjectionRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(CssInjectionRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserializeCssInjectionBody(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.CssInjectionRuleBody);
        node.type = 'CssInjectionRuleBody';
        node.remove = false;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case CssInjectionRuleSerializationMap.MediaQueryList:
                    ValueParser.deserialize(buffer, node.mediaQueryList = {});
                    break;
                case CssInjectionRuleSerializationMap.SelectorList:
                    ValueParser.deserialize(buffer, node.selectorList = {});
                    break;
                case CssInjectionRuleSerializationMap.DeclarationList:
                    ValueParser.deserialize(buffer, node.declarationList = {});
                    break;
                case CssInjectionRuleSerializationMap.Remove:
                    node.remove = true;
                    break;
                case CssInjectionRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case CssInjectionRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Unknown property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
    static serialize(node, buffer) {
        switch (node.type) {
            case CosmeticRuleType.ElementHidingRule:
                buffer.writeUint8(BinaryTypeMap.ElementHidingRule);
                buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
                CosmeticRuleParser.serializeElementHidingBody(node.body, buffer);
                break;
            case CosmeticRuleType.CssInjectionRule:
                buffer.writeUint8(BinaryTypeMap.CssInjectionRule);
                buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
                CosmeticRuleParser.serializeCssInjectionBody(node.body, buffer);
                break;
            case CosmeticRuleType.JsInjectionRule:
                buffer.writeUint8(BinaryTypeMap.JsInjectionRule);
                buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
                ValueParser.serialize(node.body, buffer);
                break;
            case CosmeticRuleType.HtmlFilteringRule:
                buffer.writeUint8(BinaryTypeMap.HtmlFilteringRule);
                buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
                ValueParser.serialize(node.body, buffer);
                break;
            case CosmeticRuleType.ScriptletInjectionRule:
                buffer.writeUint8(BinaryTypeMap.ScriptletInjectionRule);
                buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
                switch (node.syntax) {
                    case AdblockSyntax.Adg:
                        AdgScriptletInjectionBodyParser.serialize(node.body, buffer);
                        break;
                    case AdblockSyntax.Abp:
                        AbpSnippetInjectionBodyParser.serialize(node.body, buffer);
                        break;
                    case AdblockSyntax.Ubo:
                        UboScriptletInjectionBodyParser.serialize(node.body, buffer);
                        break;
                    default:
                        throw new Error('Scriptlet rule should have an explicit syntax');
                }
                break;
            default:
                throw new Error('Unknown cosmetic rule type');
        }
        buffer.writeUint8(CosmeticRuleSerializationMap.Exception);
        buffer.writeUint8(node.exception ? 1 : 0);
        buffer.writeUint8(CosmeticRuleSerializationMap.Separator);
        ValueParser.serialize(node.separator, buffer, SEPARATOR_SERIALIZATION_MAP);
        if (node.modifiers) {
            buffer.writeUint8(CosmeticRuleSerializationMap.Modifiers);
            ModifierListParser.serialize(node.modifiers, buffer);
        }
        buffer.writeUint8(CosmeticRuleSerializationMap.Domains);
        DomainListParser.serialize(node.domains, buffer);
        if (!isUndefined(node.start)) {
            buffer.writeUint8(CosmeticRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(CosmeticRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        const type = COSMETIC_RULE_TYPE_DESERIALIZATION_MAP.get(buffer.readUint8());
        if (isUndefined(type)) {
            throw new Error(`Unknown rule type: ${type}`);
        }
        node.type = type;
        node.category = RuleCategory.Cosmetic;
        const syntax = SYNTAX_DESERIALIZATION_MAP.get(buffer.readUint8()) ?? AdblockSyntax.Common;
        node.syntax = syntax;
        node.modifiers = undefined;
        switch (type) {
            case CosmeticRuleType.ElementHidingRule:
                CosmeticRuleParser.deserializeElementHidingBody(buffer, node.body = {});
                break;
            case CosmeticRuleType.CssInjectionRule:
                CosmeticRuleParser.deserializeCssInjectionBody(buffer, node.body = {});
                break;
            case CosmeticRuleType.JsInjectionRule:
                ValueParser.deserialize(buffer, node.body = {});
                break;
            case CosmeticRuleType.HtmlFilteringRule:
                ValueParser.deserialize(buffer, node.body = {});
                break;
            case CosmeticRuleType.ScriptletInjectionRule:
                switch (syntax) {
                    case AdblockSyntax.Adg:
                        AdgScriptletInjectionBodyParser.deserialize(buffer, node.body = {});
                        break;
                    case AdblockSyntax.Abp:
                        AbpSnippetInjectionBodyParser.deserialize(buffer, node.body = {});
                        break;
                    case AdblockSyntax.Ubo:
                        UboScriptletInjectionBodyParser.deserialize(buffer, node.body = {});
                        break;
                    default:
                        throw new Error('Scriptlet rule should have an explicit syntax');
                }
                break;
            default:
                throw new Error('Unknown cosmetic rule type');
        }
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case CosmeticRuleSerializationMap.Exception:
                    node.exception = buffer.readUint8() === 1;
                    break;
                case CosmeticRuleSerializationMap.Separator:
                    ValueParser.deserialize(buffer, node.separator = {}, SEPARATOR_DESERIALIZATION_MAP);
                    break;
                case CosmeticRuleSerializationMap.Modifiers:
                    node.modifiers = {};
                    ModifierListParser.deserialize(buffer, node.modifiers);
                    break;
                case CosmeticRuleSerializationMap.Domains:
                    DomainListParser.deserialize(buffer, node.domains = {});
                    break;
                case CosmeticRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case CosmeticRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Unknown property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
}
var NetworkRuleSerializationMap;
(function (NetworkRuleSerializationMap) {
    NetworkRuleSerializationMap[NetworkRuleSerializationMap["Syntax"] = 1] = "Syntax";
    NetworkRuleSerializationMap[NetworkRuleSerializationMap["Raws"] = 2] = "Raws";
    NetworkRuleSerializationMap[NetworkRuleSerializationMap["Exception"] = 3] = "Exception";
    NetworkRuleSerializationMap[NetworkRuleSerializationMap["Pattern"] = 4] = "Pattern";
    NetworkRuleSerializationMap[NetworkRuleSerializationMap["ModifierList"] = 5] = "ModifierList";
    NetworkRuleSerializationMap[NetworkRuleSerializationMap["Start"] = 6] = "Start";
    NetworkRuleSerializationMap[NetworkRuleSerializationMap["End"] = 7] = "End";
})(NetworkRuleSerializationMap || (NetworkRuleSerializationMap = {}));
class NetworkRuleParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        let offset = 0;
        offset = StringUtils.skipWS(raw, offset);
        let exception = false;
        if (raw.startsWith(NETWORK_RULE_EXCEPTION_MARKER, offset)) {
            offset += NETWORK_RULE_EXCEPTION_MARKER_LEN;
            exception = true;
        }
        const patternStart = offset;
        const separatorIndex = NetworkRuleParser.findNetworkRuleSeparatorIndex(raw);
        const patternEnd = separatorIndex === -1
            ? StringUtils.skipWSBack(raw) + 1
            : StringUtils.skipWSBack(raw, separatorIndex - 1) + 1;
        const pattern = ValueParser.parse(raw.slice(patternStart, patternEnd), options, baseOffset + patternStart);
        let modifiers;
        const modifiersStart = separatorIndex + 1;
        const modifiersEnd = StringUtils.skipWSBack(raw) + 1;
        if (separatorIndex !== -1) {
            modifiers = ModifierListParser.parse(raw.slice(modifiersStart, modifiersEnd), options, baseOffset + modifiersStart);
        }
        if (pattern.value.length === 0 && (modifiers === undefined || modifiers.children.length === 0)) {
            throw new AdblockSyntaxError('Network rule must have a pattern or modifiers', baseOffset, baseOffset + raw.length);
        }
        const result = {
            type: NetworkRuleType.NetworkRule,
            category: RuleCategory.Network,
            syntax: AdblockSyntax.Common,
            exception,
            pattern,
            modifiers,
        };
        if (options.includeRaws) {
            result.raws = {
                text: raw,
            };
        }
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        return result;
    }
    static findNetworkRuleSeparatorIndex(rule) {
        for (let i = rule.length - 1; i >= 0; i -= 1) {
            if (rule[i] === NETWORK_RULE_SEPARATOR && rule[i + 1] !== REGEX_MARKER && rule[i - 1] !== ESCAPE_CHARACTER) {
                return i;
            }
        }
        return -1;
    }
    static generate(node) {
        let result = EMPTY;
        if (node.exception) {
            result += NETWORK_RULE_EXCEPTION_MARKER;
        }
        result += node.pattern.value;
        if (node.modifiers && node.modifiers.children.length > 0) {
            result += NETWORK_RULE_SEPARATOR;
            result += ModifierListParser.generate(node.modifiers);
        }
        return result;
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.NetworkRuleNode);
        buffer.writeUint8(NetworkRuleSerializationMap.Syntax);
        buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
        buffer.writeUint8(NetworkRuleSerializationMap.Exception);
        buffer.writeUint8(node.exception ? 1 : 0);
        buffer.writeUint8(NetworkRuleSerializationMap.Pattern);
        ValueParser.serialize(node.pattern, buffer);
        if (!isUndefined(node.modifiers)) {
            buffer.writeUint8(NetworkRuleSerializationMap.ModifierList);
            ModifierListParser.serialize(node.modifiers, buffer);
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(NetworkRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(NetworkRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.NetworkRuleNode);
        node.type = NetworkRuleType.NetworkRule;
        node.category = RuleCategory.Network;
        node.modifiers = undefined;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case NetworkRuleSerializationMap.Syntax:
                    node.syntax = SYNTAX_DESERIALIZATION_MAP.get(buffer.readUint8()) ?? AdblockSyntax.Common;
                    break;
                case NetworkRuleSerializationMap.Exception:
                    node.exception = buffer.readUint8() === 1;
                    break;
                case NetworkRuleSerializationMap.Pattern:
                    ValueParser.deserialize(buffer, node.pattern = {});
                    break;
                case NetworkRuleSerializationMap.ModifierList:
                    ModifierListParser.deserialize(buffer, node.modifiers = {});
                    break;
                case NetworkRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case NetworkRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}.`);
            }
            prop = buffer.readUint8();
        }
    }
}
var HostRuleSerializationMap;
(function (HostRuleSerializationMap) {
    HostRuleSerializationMap[HostRuleSerializationMap["Syntax"] = 1] = "Syntax";
    HostRuleSerializationMap[HostRuleSerializationMap["Raws"] = 2] = "Raws";
    HostRuleSerializationMap[HostRuleSerializationMap["Ip"] = 3] = "Ip";
    HostRuleSerializationMap[HostRuleSerializationMap["HostnameList"] = 4] = "HostnameList";
    HostRuleSerializationMap[HostRuleSerializationMap["Comment"] = 5] = "Comment";
    HostRuleSerializationMap[HostRuleSerializationMap["Start"] = 6] = "Start";
    HostRuleSerializationMap[HostRuleSerializationMap["End"] = 7] = "End";
})(HostRuleSerializationMap || (HostRuleSerializationMap = {}));
var HostnameListNodeSerializationMap;
(function (HostnameListNodeSerializationMap) {
    HostnameListNodeSerializationMap[HostnameListNodeSerializationMap["Children"] = 1] = "Children";
    HostnameListNodeSerializationMap[HostnameListNodeSerializationMap["Start"] = 2] = "Start";
    HostnameListNodeSerializationMap[HostnameListNodeSerializationMap["End"] = 3] = "End";
})(HostnameListNodeSerializationMap || (HostnameListNodeSerializationMap = {}));
class HostRuleParser extends ParserBase {
    static NULL_IP = '0.0.0.0';
    static COMMENT_MARKER = '#';
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        let offset = StringUtils.skipWS(raw, 0);
        const parts = [];
        let lastPartStartIndex = offset;
        let comment = null;
        const rawLength = raw.length;
        const parsePartIfNeeded = (startIndex, endIndex) => {
            if (startIndex < endIndex) {
                parts.push(ValueParser.parse(raw.slice(startIndex, endIndex), options, baseOffset + startIndex));
            }
        };
        while (offset < rawLength) {
            if (StringUtils.isWhitespace(raw[offset])) {
                parsePartIfNeeded(lastPartStartIndex, offset);
                offset = StringUtils.skipWS(raw, offset);
                lastPartStartIndex = offset;
            }
            else if (raw[offset] === HostRuleParser.COMMENT_MARKER) {
                const commentStart = offset;
                offset = StringUtils.skipWS(raw, offset + 1);
                comment = ValueParser.parse(raw.slice(offset), options, baseOffset + commentStart);
                offset = rawLength;
                lastPartStartIndex = offset;
            }
            else {
                offset += 1;
            }
        }
        parsePartIfNeeded(lastPartStartIndex, offset);
        const partsLength = parts.length;
        if (partsLength < 1) {
            throw new Error('Host rule must have at least one domain name or an IP address and a domain name');
        }
        const result = {
            category: RuleCategory.Network,
            type: NetworkRuleType.HostRule,
            syntax: AdblockSyntax.Common,
        };
        if (partsLength === 1) {
            if (tldts__WEBPACK_IMPORTED_MODULE_0__/* .getDomain */ .ge(parts[0].value) !== parts[0].value) {
                throw new Error(`Not a valid domain: ${parts[0].value}`);
            }
            result.ip = {
                type: 'Value',
                value: HostRuleParser.NULL_IP,
            };
            result.hostnames = {
                type: 'HostnameList',
                children: parts,
            };
        }
        else if (partsLength > 1) {
            const [ip, ...hostnames] = parts;
            if (!isIp$1(ip.value)) {
                throw new Error(`Invalid IP address: ${ip.value}`);
            }
            for (const { value } of hostnames) {
                if (tldts__WEBPACK_IMPORTED_MODULE_0__/* .getHostname */ .Fo(value) !== value) {
                    throw new Error(`Not a valid hostname: ${value}`);
                }
            }
            result.ip = ip;
            result.hostnames = {
                type: 'HostnameList',
                children: hostnames,
            };
        }
        if (comment) {
            result.comment = comment;
        }
        if (options.includeRaws) {
            result.raws = {
                text: raw,
            };
        }
        return result;
    }
    static generate(node) {
        const result = [];
        if (node.ip) {
            result.push(node.ip.value);
        }
        if (node.hostnames) {
            result.push(SPACE$1);
            result.push(node.hostnames.children.map(({ value }) => value).join(SPACE$1));
        }
        if (node.comment) {
            result.push(SPACE$1);
            result.push(HostRuleParser.COMMENT_MARKER);
            result.push(SPACE$1);
            result.push(node.comment.value);
        }
        return result.join(EMPTY);
    }
    static serializeHostnameList(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.HostnameListNode);
        if (!isUndefined(node.start)) {
            buffer.writeUint8(HostnameListNodeSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(HostnameListNodeSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        const count = node.children.length;
        if (count) {
            if (count > UINT16_MAX) {
                throw new Error(`Too many children: ${count}, the limit is ${UINT16_MAX}`);
            }
            buffer.writeUint8(HostnameListNodeSerializationMap.Children);
            buffer.writeUint16(count);
            for (let i = 0; i < count; i += 1) {
                ValueParser.serialize(node.children[i], buffer);
            }
        }
        buffer.writeUint8(NULL);
    }
    static deserializeHostnameList(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.HostnameListNode);
        node.type = 'HostnameList';
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case HostnameListNodeSerializationMap.Children:
                    node.children = new Array(buffer.readUint16());
                    for (let i = 0; i < node.children.length; i += 1) {
                        ValueParser.deserialize(buffer, node.children[i] = {});
                    }
                    break;
                case HostnameListNodeSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case HostnameListNodeSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Unknown property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    }
    static serialize(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.HostRuleNode);
        buffer.writeUint8(HostRuleSerializationMap.Syntax);
        buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
        if (node.ip) {
            buffer.writeUint8(HostRuleSerializationMap.Ip);
            ValueParser.serialize(node.ip, buffer);
        }
        if (node.hostnames) {
            buffer.writeUint8(HostRuleSerializationMap.HostnameList);
            HostRuleParser.serializeHostnameList(node.hostnames, buffer);
        }
        if (node.comment) {
            buffer.writeUint8(HostRuleSerializationMap.Comment);
            ValueParser.serialize(node.comment, buffer);
        }
        if (!isUndefined(node.start)) {
            buffer.writeUint8(HostRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(HostRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserialize(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.HostRuleNode);
        node.category = RuleCategory.Network;
        node.type = NetworkRuleType.HostRule;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case HostRuleSerializationMap.Syntax:
                    node.syntax = SYNTAX_DESERIALIZATION_MAP.get(buffer.readUint8()) ?? AdblockSyntax.Common;
                    break;
                case HostRuleSerializationMap.Ip:
                    node.ip = {};
                    ValueParser.deserialize(buffer, node.ip);
                    break;
                case HostRuleSerializationMap.HostnameList:
                    node.hostnames = {};
                    HostRuleParser.deserializeHostnameList(buffer, node.hostnames);
                    break;
                case HostRuleSerializationMap.Comment:
                    node.comment = {};
                    ValueParser.deserialize(buffer, node.comment);
                    break;
                case HostRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case HostRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}.`);
            }
            prop = buffer.readUint8();
        }
    }
}
var EmptyRuleSerializationMap;
(function (EmptyRuleSerializationMap) {
    EmptyRuleSerializationMap[EmptyRuleSerializationMap["Start"] = 1] = "Start";
    EmptyRuleSerializationMap[EmptyRuleSerializationMap["End"] = 2] = "End";
})(EmptyRuleSerializationMap || (EmptyRuleSerializationMap = {}));
var InvalidRuleErrorNodeSerializationMap;
(function (InvalidRuleErrorNodeSerializationMap) {
    InvalidRuleErrorNodeSerializationMap[InvalidRuleErrorNodeSerializationMap["Name"] = 1] = "Name";
    InvalidRuleErrorNodeSerializationMap[InvalidRuleErrorNodeSerializationMap["Message"] = 2] = "Message";
    InvalidRuleErrorNodeSerializationMap[InvalidRuleErrorNodeSerializationMap["Start"] = 3] = "Start";
    InvalidRuleErrorNodeSerializationMap[InvalidRuleErrorNodeSerializationMap["End"] = 4] = "End";
})(InvalidRuleErrorNodeSerializationMap || (InvalidRuleErrorNodeSerializationMap = {}));
var InvalidRuleSerializationMap;
(function (InvalidRuleSerializationMap) {
    InvalidRuleSerializationMap[InvalidRuleSerializationMap["Error"] = 1] = "Error";
    InvalidRuleSerializationMap[InvalidRuleSerializationMap["Start"] = 2] = "Start";
    InvalidRuleSerializationMap[InvalidRuleSerializationMap["End"] = 3] = "End";
})(InvalidRuleSerializationMap || (InvalidRuleSerializationMap = {}));
class RuleParser extends ParserBase {
    static parseHostOrNetworkRule(raw, options, baseOffset) {
        if (options.parseHostRules) {
            try {
                return HostRuleParser.parse(raw, options, baseOffset);
            }
            catch (error) {
            }
        }
        return NetworkRuleParser.parse(raw, options, baseOffset);
    }
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        try {
            if (raw.trim().length === 0) {
                const result = {
                    type: 'EmptyRule',
                    category: RuleCategory.Empty,
                    syntax: AdblockSyntax.Common,
                };
                if (options.includeRaws) {
                    result.raws = {
                        text: raw,
                    };
                }
                if (options.isLocIncluded) {
                    result.start = baseOffset;
                    result.end = baseOffset + raw.length;
                }
                return result;
            }
            if (options.ignoreComments) {
                if (CommentRuleParser.isCommentRule(raw)) {
                    const result = {
                        type: 'EmptyRule',
                        category: RuleCategory.Empty,
                        syntax: AdblockSyntax.Common,
                    };
                    if (options.includeRaws) {
                        result.raws = {
                            text: raw,
                        };
                    }
                    if (options.isLocIncluded) {
                        result.start = baseOffset;
                        result.end = baseOffset + raw.length;
                    }
                    return result;
                }
                return CosmeticRuleParser.parse(raw, options, baseOffset)
                    || RuleParser.parseHostOrNetworkRule(raw, options, baseOffset);
            }
            return CommentRuleParser.parse(raw, options, baseOffset)
                || CosmeticRuleParser.parse(raw, options, baseOffset)
                || RuleParser.parseHostOrNetworkRule(raw, options, baseOffset);
        }
        catch (error) {
            if (!options.tolerant || !(error instanceof Error)) {
                throw error;
            }
            const errorNode = {
                type: 'InvalidRuleError',
                name: error.name,
                message: error.message,
            };
            if (error instanceof AdblockSyntaxError) {
                errorNode.start = error.start;
                errorNode.end = error.end;
            }
            const result = {
                type: 'InvalidRule',
                category: RuleCategory.Invalid,
                syntax: AdblockSyntax.Common,
                raw,
                error: errorNode,
            };
            if (options.includeRaws) {
                result.raws = {
                    text: raw,
                };
            }
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
    }
    static generate(ast) {
        switch (ast.category) {
            case RuleCategory.Empty:
                return EMPTY;
            case RuleCategory.Invalid:
                return ast.raw;
            case RuleCategory.Comment:
                return CommentRuleParser.generate(ast);
            case RuleCategory.Cosmetic:
                return CosmeticRuleParser.generate(ast);
            case RuleCategory.Network:
                switch (ast.type) {
                    case NetworkRuleType.HostRule:
                        return HostRuleParser.generate(ast);
                    case NetworkRuleType.NetworkRule:
                        return NetworkRuleParser.generate(ast);
                    default:
                        throw new Error('Unknown network rule type');
                }
            default:
                throw new Error('Unknown rule category');
        }
    }
    static serializeEmptyRule(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.EmptyRule);
        if (!isUndefined(node.start)) {
            buffer.writeUint8(EmptyRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(EmptyRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserializeEmptyRule(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.EmptyRule);
        node.type = 'EmptyRule';
        node.category = RuleCategory.Empty;
        node.syntax = AdblockSyntax.Common;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case EmptyRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case EmptyRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}.`);
            }
            prop = buffer.readUint8();
        }
    }
    static serializeInvalidRuleErrorNode(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.InvalidRuleErrorNode);
        buffer.writeUint8(InvalidRuleErrorNodeSerializationMap.Name);
        buffer.writeString(node.name);
        buffer.writeUint8(InvalidRuleErrorNodeSerializationMap.Message);
        buffer.writeString(node.message);
        if (!isUndefined(node.start)) {
            buffer.writeUint8(InvalidRuleErrorNodeSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(InvalidRuleErrorNodeSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserializeInvalidRuleErrorNode(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.InvalidRuleErrorNode);
        node.type = 'InvalidRuleError';
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case InvalidRuleErrorNodeSerializationMap.Name:
                    node.name = buffer.readString();
                    break;
                case InvalidRuleErrorNodeSerializationMap.Message:
                    node.message = buffer.readString();
                    break;
                case InvalidRuleErrorNodeSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case InvalidRuleErrorNodeSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}.`);
            }
            prop = buffer.readUint8();
        }
    }
    static serializeInvalidRule(node, buffer) {
        buffer.writeUint8(BinaryTypeMap.InvalidRule);
        buffer.writeUint8(InvalidRuleSerializationMap.Error);
        RuleParser.serializeInvalidRuleErrorNode(node.error, buffer);
        if (!isUndefined(node.start)) {
            buffer.writeUint8(InvalidRuleSerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined(node.end)) {
            buffer.writeUint8(InvalidRuleSerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    }
    static deserializeInvalidRule(buffer, node) {
        buffer.assertUint8(BinaryTypeMap.InvalidRule);
        node.type = 'InvalidRule';
        node.category = RuleCategory.Invalid;
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case InvalidRuleSerializationMap.Error:
                    RuleParser.deserializeInvalidRuleErrorNode(buffer, node.error = {});
                    break;
                case InvalidRuleSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case InvalidRuleSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}.`);
            }
            prop = buffer.readUint8();
        }
    }
    static serialize(node, buffer) {
        switch (node.category) {
            case RuleCategory.Comment:
                CommentRuleParser.serialize(node, buffer);
                break;
            case RuleCategory.Cosmetic:
                CosmeticRuleParser.serialize(node, buffer);
                break;
            case RuleCategory.Network:
                switch (node.type) {
                    case NetworkRuleType.HostRule:
                        HostRuleParser.serialize(node, buffer);
                        break;
                    case NetworkRuleType.NetworkRule:
                        NetworkRuleParser.serialize(node, buffer);
                        break;
                    default:
                        throw new Error('Unknown network rule type');
                }
                break;
            case RuleCategory.Empty:
                RuleParser.serializeEmptyRule(node, buffer);
                break;
            case RuleCategory.Invalid:
                RuleParser.serializeInvalidRule(node, buffer);
                break;
            default:
                throw new Error('Unknown rule category');
        }
    }
    static deserialize(buffer, node) {
        const type = buffer.peekUint8();
        switch (type) {
            case BinaryTypeMap.AgentRuleNode:
            case BinaryTypeMap.HintRuleNode:
            case BinaryTypeMap.PreProcessorCommentRuleNode:
            case BinaryTypeMap.MetadataCommentRuleNode:
            case BinaryTypeMap.ConfigCommentRuleNode:
            case BinaryTypeMap.CommentRuleNode:
                CommentRuleParser.deserialize(buffer, node);
                break;
            case BinaryTypeMap.ElementHidingRule:
            case BinaryTypeMap.CssInjectionRule:
            case BinaryTypeMap.ScriptletInjectionRule:
            case BinaryTypeMap.HtmlFilteringRule:
            case BinaryTypeMap.JsInjectionRule:
                CosmeticRuleParser.deserialize(buffer, node);
                break;
            case BinaryTypeMap.NetworkRuleNode:
                NetworkRuleParser.deserialize(buffer, node);
                break;
            case BinaryTypeMap.HostRuleNode:
                HostRuleParser.deserialize(buffer, node);
                break;
            case BinaryTypeMap.EmptyRule:
                RuleParser.deserializeEmptyRule(buffer, node);
                break;
            case BinaryTypeMap.InvalidRule:
                RuleParser.deserializeInvalidRule(buffer, node);
                break;
            default:
                throw new Error('Unknown rule category');
        }
    }
}
const APP_LIST_SEPARATOR = PIPE;
class AppListParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        const result = {
            type: ListNodeType.AppList,
            separator: APP_LIST_SEPARATOR,
            children: parseListItems(raw, options, baseOffset, APP_LIST_SEPARATOR, ListItemNodeType.App),
        };
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        return result;
    }
}
const METHOD_LIST_SEPARATOR = PIPE;
class MethodListParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        const result = {
            type: ListNodeType.MethodList,
            separator: METHOD_LIST_SEPARATOR,
            children: parseListItems(raw, options, baseOffset, METHOD_LIST_SEPARATOR, ListItemNodeType.Method),
        };
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        return result;
    }
}
const STEALTH_OPTION_LIST_SEPARATOR = PIPE;
class StealthOptionListParser extends ParserBase {
    static parse(raw, options = defaultParserOptions, baseOffset = 0) {
        const result = {
            type: ListNodeType.StealthOptionList,
            separator: STEALTH_OPTION_LIST_SEPARATOR,
            children: parseListItems(raw, options, baseOffset, STEALTH_OPTION_LIST_SEPARATOR, ListItemNodeType.StealthOption),
        };
        if (options.isLocIncluded) {
            result.start = baseOffset;
            result.end = baseOffset + raw.length;
        }
        return result;
    }
}
var FilterListNodeSerializationMap;
(function (FilterListNodeSerializationMap) {
    FilterListNodeSerializationMap[FilterListNodeSerializationMap["Children"] = 1] = "Children";
    FilterListNodeSerializationMap[FilterListNodeSerializationMap["Start"] = 2] = "Start";
    FilterListNodeSerializationMap[FilterListNodeSerializationMap["End"] = 3] = "End";
})(FilterListNodeSerializationMap || (FilterListNodeSerializationMap = {}));
const ERROR_NAME$1 = 'RuleConversionError';
class RuleConversionError extends Error {
    constructor(message) {
        super(message);
        this.name = ERROR_NAME$1;
    }
}
const ERROR_NAME = 'BinarySchemaMismatchError';
class BinarySchemaMismatchError extends Error {
    expectedVersion;
    actualVersion;
    constructor(expectedVersion, actualVersion) {
        super(`Expected schema version ${expectedVersion}, but got ${actualVersion}`);
        this.name = ERROR_NAME;
        this.expectedVersion = expectedVersion;
        this.actualVersion = actualVersion;
    }
}
({
    [AdblockSyntax.Adg]: 'adg_',
    [AdblockSyntax.Ubo]: 'ubo_',
    [AdblockSyntax.Abp]: 'abp_',
});
const APP_NAME_ALLOWED_CHARS = new Set([
    ...CAPITAL_LETTERS,
    ...SMALL_LETTERS,
    ...NUMBERS,
    UNDERSCORE,
]);
const ALLOWED_METHODS = new Set([
    'connect',
    'delete',
    'get',
    'head',
    'options',
    'patch',
    'post',
    'put',
    'trace',
]);
const ALLOWED_STEALTH_OPTIONS = new Set([
    'searchqueries',
    'donottrack',
    '3p-cookie',
    '1p-cookie',
    '3p-cache',
    '3p-auth',
    'webrtc',
    'push',
    'location',
    'flash',
    'java',
    'referrer',
    'useragent',
    'ip',
    'xclientdata',
    'dpi',
]);
const ALLOWED_CSP_DIRECTIVES = new Set([
    'base-uri',
    'child-src',
    'connect-src',
    'default-src',
    'fenced-frame-src',
    'font-src',
    'form-action',
    'frame-ancestors',
    'frame-src',
    'img-src',
    'manifest-src',
    'media-src',
    'navigate-to',
    'object-src',
    'plugin-types',
    'prefetch-src',
    'referrer',
    'report-to',
    'report-uri',
    'require-trusted-types-for',
    'sandbox',
    'script-src',
    'script-src-attr',
    'script-src-elem',
    'style-src',
    'style-src-attr',
    'style-src-elem',
    'trusted-types',
    'upgrade-insecure-requests',
    'worker-src',
]);
const ALLOWED_PERMISSION_DIRECTIVES = new Set([
    'accelerometer',
    'ambient-light-sensor',
    'autoplay',
    'battery',
    'browsing-topics',
    'camera',
    'display-capture',
    'document-domain',
    'encrypted-media',
    'execution-while-not-rendered',
    'execution-while-out-of-viewport',
    'fullscreen',
    'gamepad',
    'geolocation',
    'gyroscope',
    'hid',
    'identity-credentials-get',
    'idle-detection',
    'join-ad-interest-group',
    'local-fonts',
    'magnetometer',
    'microphone',
    'midi',
    'payment',
    'picture-in-picture',
    'publickey-credentials-create',
    'publickey-credentials-get',
    'run-ad-auction',
    'screen-wake-lock',
    'serial',
    'speaker-selection',
    'storage-access',
    'usb',
    'web-share',
    'xr-spatial-tracking',
]);
const PERMISSIONS_TOKEN_SELF = 'self';
const EMPTY_PERMISSIONS_ALLOWLIST = `${OPEN_PARENTHESIS}${CLOSE_PARENTHESIS}`;
const REFERRER_POLICY_DIRECTIVES = new Set([
    'no-referrer',
    'no-referrer-when-downgrade',
    'origin',
    'origin-when-cross-origin',
    'same-origin',
    'strict-origin',
    'strict-origin-when-cross-origin',
    'unsafe-url',
]);
const VALIDATION_ERROR_PREFIX = {
    BLOCK_ONLY: 'Only blocking rules may contain the modifier',
    EXCEPTION_ONLY: 'Only exception rules may contain the modifier',
    INVALID_CSP_DIRECTIVES: 'Invalid CSP directives for the modifier',
    INVALID_LIST_VALUES: 'Invalid values for the modifier',
    INVALID_NOOP: 'Invalid noop modifier',
    INVALID_PERMISSION_DIRECTIVE: 'Invalid Permissions-Policy directive for the modifier',
    INVALID_PERMISSION_ORIGINS: 'Origins in the value is invalid for the modifier and the directive',
    INVALID_PERMISSION_ORIGIN_QUOTES: 'Double quotes should be used for origins in the value of the modifier',
    INVALID_REFERRER_POLICY_DIRECTIVE: 'Invalid Referrer-Policy directive for the modifier',
    MIXED_NEGATIONS: 'Simultaneous usage of negated and not negated values is forbidden for the modifier',
    NO_CSP_VALUE: 'No CSP value for the modifier and the directive',
    NO_CSP_DIRECTIVE_QUOTE: 'CSP directives should no be quoted for the modifier',
    NO_UNESCAPED_PERMISSION_COMMA: 'Unescaped comma in the value is not allowed for the modifier',
    NOT_EXISTENT: 'Non-existent modifier',
    NOT_NEGATABLE_MODIFIER: 'Non-negatable modifier',
    NOT_NEGATABLE_VALUE: 'Values cannot be negated for the modifier',
    NOT_SUPPORTED: 'The adblocker does not support the modifier',
    REMOVED: 'Removed and no longer supported modifier',
    VALUE_FORBIDDEN: 'Value is not allowed for the modifier',
    VALUE_INVALID: 'Value is invalid for the modifier',
    VALUE_REQUIRED: 'Value is required for the modifier',
};
const getInvalidValidationResult = (error) => {
    return {
        valid: false,
        error,
    };
};
const getValueRequiredValidationResult = (modifierName) => {
    return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.VALUE_REQUIRED}: '${modifierName}'`);
};
const WILDCARD_TLD = DOT + WILDCARD$1;
const WILDCARD_SUBDOMAIN = WILDCARD$1 + DOT;
class DomainUtils {
    static isValidDomainOrHostname(domain) {
        let domainToCheck = domain;
        if (domainToCheck === WILDCARD$1) {
            return true;
        }
        if (domainToCheck.endsWith(WILDCARD_TLD)) {
            domainToCheck = domainToCheck.substring(0, domainToCheck.length - WILDCARD_TLD.length);
        }
        if (domainToCheck.startsWith(WILDCARD_SUBDOMAIN)) {
            domainToCheck = domainToCheck.substring(WILDCARD_SUBDOMAIN.length);
        }
        const tldtsResult = (0,tldts__WEBPACK_IMPORTED_MODULE_0__/* .parse */ .Qc)(domainToCheck);
        return domainToCheck === tldtsResult.domain || domainToCheck === tldtsResult.hostname;
    }
}
var CustomValueFormatValidatorName;
(function (CustomValueFormatValidatorName) {
    CustomValueFormatValidatorName["App"] = "pipe_separated_apps";
    CustomValueFormatValidatorName["Csp"] = "csp_value";
    CustomValueFormatValidatorName["DenyAllow"] = "pipe_separated_denyallow_domains";
    CustomValueFormatValidatorName["Domain"] = "pipe_separated_domains";
    CustomValueFormatValidatorName["Method"] = "pipe_separated_methods";
    CustomValueFormatValidatorName["Permissions"] = "permissions_value";
    CustomValueFormatValidatorName["ReferrerPolicy"] = "referrerpolicy_value";
    CustomValueFormatValidatorName["StealthOption"] = "pipe_separated_stealth_options";
})(CustomValueFormatValidatorName || (CustomValueFormatValidatorName = {}));
const isValidAppNameChunk = (chunk) => {
    if (chunk.length === 0) {
        return false;
    }
    for (let i = 0; i < chunk.length; i += 1) {
        const char = chunk[i];
        if (!APP_NAME_ALLOWED_CHARS.has(char)) {
            return false;
        }
    }
    return true;
};
const isValidAppModifierValue = (value) => {
    if (value.includes(WILDCARD$1)) {
        return false;
    }
    return value
        .split(DOT)
        .every((chunk) => isValidAppNameChunk(chunk));
};
const isValidMethodModifierValue = (value) => {
    return ALLOWED_METHODS.has(value);
};
const isValidStealthModifierValue = (value) => {
    return ALLOWED_STEALTH_OPTIONS.has(value);
};
const isValidPermissionsOrigin = (rawOrigin) => {
    const actualQuoteType = QuoteUtils.getStringQuoteType(rawOrigin);
    if (actualQuoteType !== QuoteType.Double) {
        return false;
    }
    const origin = QuoteUtils.removeQuotes(rawOrigin);
    try {
        new URL(origin);
    }
    catch (e) {
        return false;
    }
    return true;
};
const isValidDenyAllowModifierValue = (value) => {
    if (value.includes(WILDCARD$1)) {
        return false;
    }
    return DomainUtils.isValidDomainOrHostname(value);
};
const isValidDomainModifierValue = (value) => {
    return DomainUtils.isValidDomainOrHostname(value);
};
const customNoNegatedListItemsValidator = (modifierName, listItems) => {
    const negatedValues = [];
    listItems.forEach((listItem) => {
        if (listItem.exception) {
            negatedValues.push(listItem.value);
        }
    });
    if (negatedValues.length > 0) {
        const valuesToStr = QuoteUtils.quoteAndJoinStrings(negatedValues);
        return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.NOT_NEGATABLE_VALUE}: '${modifierName}': ${valuesToStr}`);
    }
    return { valid: true };
};
const customConsistentExceptionsValidator = (modifierName, listItems) => {
    const firstException = listItems[0].exception;
    const nonConsistentItemValues = [];
    listItems.forEach((listItem) => {
        if (listItem.exception !== firstException) {
            nonConsistentItemValues.push(listItem.value);
        }
    });
    if (nonConsistentItemValues.length > 0) {
        const valuesToStr = QuoteUtils.quoteAndJoinStrings(nonConsistentItemValues);
        return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.MIXED_NEGATIONS}: '${modifierName}': ${valuesToStr}`);
    }
    return { valid: true };
};
const validateListItemsModifier = (modifier, listParser, isValidListItem, customListValidator) => {
    const modifierName = modifier.name.value;
    const defaultInvalidValueResult = getValueRequiredValidationResult(modifierName);
    if (!modifier.value?.value) {
        return defaultInvalidValueResult;
    }
    let theList;
    try {
        theList = listParser(modifier.value.value, defaultParserOptions, 0, PIPE);
    }
    catch (e) {
        if (e instanceof AdblockSyntaxError) {
            return {
                valid: false,
                error: e.message,
            };
        }
        return defaultInvalidValueResult;
    }
    const invalidListItems = [];
    theList.children.forEach((item) => {
        if (!isValidListItem(item.value)) {
            invalidListItems.push(item.value);
        }
    });
    if (invalidListItems.length > 0) {
        const itemsToStr = QuoteUtils.quoteAndJoinStrings(invalidListItems);
        return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.INVALID_LIST_VALUES}: '${modifierName}': ${itemsToStr}`);
    }
    if (customListValidator) {
        return customListValidator(modifierName, theList.children);
    }
    return { valid: true };
};
const validatePipeSeparatedApps = (modifier) => {
    return validateListItemsModifier(modifier, (raw) => AppListParser.parse(raw), isValidAppModifierValue);
};
const validatePipeSeparatedDenyAllowDomains = (modifier) => {
    return validateListItemsModifier(modifier, DomainListParser.parse, isValidDenyAllowModifierValue, customNoNegatedListItemsValidator);
};
const validatePipeSeparatedDomains = (modifier) => {
    return validateListItemsModifier(modifier, DomainListParser.parse, isValidDomainModifierValue);
};
const validatePipeSeparatedMethods = (modifier) => {
    return validateListItemsModifier(modifier, (raw) => MethodListParser.parse(raw), isValidMethodModifierValue, customConsistentExceptionsValidator);
};
const validatePipeSeparatedStealthOptions = (modifier) => {
    return validateListItemsModifier(modifier, (raw) => StealthOptionListParser.parse(raw), isValidStealthModifierValue, customNoNegatedListItemsValidator);
};
const validateCspValue = (modifier) => {
    const modifierName = modifier.name.value;
    if (!modifier.value?.value) {
        return getValueRequiredValidationResult(modifierName);
    }
    const policyDirectives = modifier.value.value
        .split(SEMICOLON)
        .filter((i) => !!i);
    const invalidValueValidationResult = getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.VALUE_INVALID}: '${modifierName}': "${modifier.value.value}"`);
    if (policyDirectives.length === 0) {
        return invalidValueValidationResult;
    }
    const invalidDirectives = [];
    for (let i = 0; i < policyDirectives.length; i += 1) {
        const policyDirective = policyDirectives[i].trim();
        if (!policyDirective) {
            return invalidValueValidationResult;
        }
        const chunks = policyDirective.split(SPACE$1);
        const [directive, ...valueChunks] = chunks;
        if (!directive) {
            return invalidValueValidationResult;
        }
        if (!ALLOWED_CSP_DIRECTIVES.has(directive)) {
            if (ALLOWED_CSP_DIRECTIVES.has(QuoteUtils.removeQuotes(directive))) {
                return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.NO_CSP_DIRECTIVE_QUOTE}: '${modifierName}': ${directive}`);
            }
            invalidDirectives.push(directive);
            continue;
        }
        if (valueChunks.length === 0) {
            return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.NO_CSP_VALUE}: '${modifierName}': '${directive}'`);
        }
    }
    if (invalidDirectives.length > 0) {
        const directivesToStr = QuoteUtils.quoteAndJoinStrings(invalidDirectives, QuoteType.Double);
        return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.INVALID_CSP_DIRECTIVES}: '${modifierName}': ${directivesToStr}`);
    }
    return { valid: true };
};
const validatePermissionAllowlistOrigins = (allowlistChunks, directive, modifierName) => {
    const invalidOrigins = [];
    for (let i = 0; i < allowlistChunks.length; i += 1) {
        const chunk = allowlistChunks[i].trim();
        if (chunk.length === 0) {
            continue;
        }
        if (chunk.toLowerCase() === PERMISSIONS_TOKEN_SELF) {
            continue;
        }
        if (QuoteUtils.getStringQuoteType(chunk) !== QuoteType.Double) {
            return getInvalidValidationResult(
            `${VALIDATION_ERROR_PREFIX.INVALID_PERMISSION_ORIGIN_QUOTES}: '${modifierName}': '${directive}': '${QuoteUtils.removeQuotes(chunk)}'`);
        }
        if (!isValidPermissionsOrigin(chunk)) {
            invalidOrigins.push(chunk);
        }
    }
    if (invalidOrigins.length > 0) {
        const originsToStr = QuoteUtils.quoteAndJoinStrings(invalidOrigins);
        return getInvalidValidationResult(
        `${VALIDATION_ERROR_PREFIX.INVALID_PERMISSION_ORIGINS}: '${modifierName}': '${directive}': ${originsToStr}`);
    }
    return { valid: true };
};
const validatePermissionAllowlist = (allowlist, directive, modifierName) => {
    if (allowlist === WILDCARD$1
        || allowlist === EMPTY_PERMISSIONS_ALLOWLIST) {
        return { valid: true };
    }
    if (!(allowlist.startsWith(OPEN_PARENTHESIS) && allowlist.endsWith(CLOSE_PARENTHESIS))) {
        return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.VALUE_INVALID}: '${modifierName}'`);
    }
    const allowlistChunks = allowlist.slice(1, -1).split(SPACE$1);
    return validatePermissionAllowlistOrigins(allowlistChunks, directive, modifierName);
};
const validateSinglePermission = (permission, modifierName, modifierValue) => {
    if (!permission) {
        return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.VALUE_INVALID}: '${modifierName}'`);
    }
    if (permission.includes(COMMA)) {
        return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.NO_UNESCAPED_PERMISSION_COMMA}: '${modifierName}': '${modifierValue}'`);
    }
    const [directive, allowlist] = permission.split(EQUALS);
    if (!ALLOWED_PERMISSION_DIRECTIVES.has(directive)) {
        return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.INVALID_PERMISSION_DIRECTIVE}: '${modifierName}': '${directive}'`);
    }
    return validatePermissionAllowlist(allowlist, directive, modifierName);
};
const validatePermissions = (modifier) => {
    if (!modifier.value?.value) {
        return getValueRequiredValidationResult(modifier.name.value);
    }
    const modifierName = modifier.name.value;
    const modifierValue = modifier.value.value;
    const permissions = modifier.value.value.split(`${BACKSLASH}${COMMA}`);
    for (let i = 0; i < permissions.length; i += 1) {
        const permission = permissions[i].trim();
        const singlePermissionValidationResult = validateSinglePermission(permission, modifierName, modifierValue);
        if (!singlePermissionValidationResult.valid) {
            return singlePermissionValidationResult;
        }
    }
    return { valid: true };
};
const validateReferrerPolicy = (modifier) => {
    if (!modifier.value?.value) {
        return getValueRequiredValidationResult(modifier.name.value);
    }
    const modifierName = modifier.name.value;
    const modifierValue = modifier.value.value;
    if (!REFERRER_POLICY_DIRECTIVES.has(modifierValue)) {
        return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.INVALID_REFERRER_POLICY_DIRECTIVE}: '${modifierName}': '${modifierValue}'`);
    }
    return { valid: true };
};
({
    [CustomValueFormatValidatorName.App]: validatePipeSeparatedApps,
    [CustomValueFormatValidatorName.Csp]: validateCspValue,
    [CustomValueFormatValidatorName.DenyAllow]: validatePipeSeparatedDenyAllowDomains,
    [CustomValueFormatValidatorName.Domain]: validatePipeSeparatedDomains,
    [CustomValueFormatValidatorName.Method]: validatePipeSeparatedMethods,
    [CustomValueFormatValidatorName.Permissions]: validatePermissions,
    [CustomValueFormatValidatorName.ReferrerPolicy]: validateReferrerPolicy,
    [CustomValueFormatValidatorName.StealthOption]: validatePipeSeparatedStealthOptions,
});
function clone(value) {
    return cloneDeep$1(value);
}
var SpecificPlatform;
(function (SpecificPlatform) {
    SpecificPlatform[SpecificPlatform["AdgOsWindows"] = 1] = "AdgOsWindows";
    SpecificPlatform[SpecificPlatform["AdgOsMac"] = 2] = "AdgOsMac";
    SpecificPlatform[SpecificPlatform["AdgOsAndroid"] = 4] = "AdgOsAndroid";
    SpecificPlatform[SpecificPlatform["AdgExtChrome"] = 8] = "AdgExtChrome";
    SpecificPlatform[SpecificPlatform["AdgExtOpera"] = 16] = "AdgExtOpera";
    SpecificPlatform[SpecificPlatform["AdgExtEdge"] = 32] = "AdgExtEdge";
    SpecificPlatform[SpecificPlatform["AdgExtFirefox"] = 64] = "AdgExtFirefox";
    SpecificPlatform[SpecificPlatform["AdgCbAndroid"] = 128] = "AdgCbAndroid";
    SpecificPlatform[SpecificPlatform["AdgCbIos"] = 256] = "AdgCbIos";
    SpecificPlatform[SpecificPlatform["AdgCbSafari"] = 512] = "AdgCbSafari";
    SpecificPlatform[SpecificPlatform["UboExtChrome"] = 1024] = "UboExtChrome";
    SpecificPlatform[SpecificPlatform["UboExtOpera"] = 2048] = "UboExtOpera";
    SpecificPlatform[SpecificPlatform["UboExtEdge"] = 4096] = "UboExtEdge";
    SpecificPlatform[SpecificPlatform["UboExtFirefox"] = 8192] = "UboExtFirefox";
    SpecificPlatform[SpecificPlatform["AbpExtChrome"] = 16384] = "AbpExtChrome";
    SpecificPlatform[SpecificPlatform["AbpExtOpera"] = 32768] = "AbpExtOpera";
    SpecificPlatform[SpecificPlatform["AbpExtEdge"] = 65536] = "AbpExtEdge";
    SpecificPlatform[SpecificPlatform["AbpExtFirefox"] = 131072] = "AbpExtFirefox";
})(SpecificPlatform || (SpecificPlatform = {}));
var GenericPlatform;
(function (GenericPlatform) {
    GenericPlatform[GenericPlatform["AdgOsAny"] = 7] = "AdgOsAny";
    GenericPlatform[GenericPlatform["AdgSafariAny"] = 768] = "AdgSafariAny";
    GenericPlatform[GenericPlatform["AdgExtChromium"] = 56] = "AdgExtChromium";
    GenericPlatform[GenericPlatform["AdgExtAny"] = 120] = "AdgExtAny";
    GenericPlatform[GenericPlatform["AdgAny"] = 1023] = "AdgAny";
    GenericPlatform[GenericPlatform["UboExtChromium"] = 7168] = "UboExtChromium";
    GenericPlatform[GenericPlatform["UboExtAny"] = 15360] = "UboExtAny";
    GenericPlatform[GenericPlatform["UboAny"] = 15360] = "UboAny";
    GenericPlatform[GenericPlatform["AbpExtChromium"] = 114688] = "AbpExtChromium";
    GenericPlatform[GenericPlatform["AbpExtAny"] = 245760] = "AbpExtAny";
    GenericPlatform[GenericPlatform["AbpAny"] = 245760] = "AbpAny";
    GenericPlatform[GenericPlatform["Any"] = 262143] = "Any";
})(GenericPlatform || (GenericPlatform = {}));
const SPECIFIC_PLATFORM_MAP = new Map([
    ['adg_os_windows', SpecificPlatform.AdgOsWindows],
    ['adg_os_mac', SpecificPlatform.AdgOsMac],
    ['adg_os_android', SpecificPlatform.AdgOsAndroid],
    ['adg_ext_chrome', SpecificPlatform.AdgExtChrome],
    ['adg_ext_opera', SpecificPlatform.AdgExtOpera],
    ['adg_ext_edge', SpecificPlatform.AdgExtEdge],
    ['adg_ext_firefox', SpecificPlatform.AdgExtFirefox],
    ['adg_cb_android', SpecificPlatform.AdgCbAndroid],
    ['adg_cb_ios', SpecificPlatform.AdgCbIos],
    ['adg_cb_safari', SpecificPlatform.AdgCbSafari],
    ['ubo_ext_chrome', SpecificPlatform.UboExtChrome],
    ['ubo_ext_opera', SpecificPlatform.UboExtOpera],
    ['ubo_ext_edge', SpecificPlatform.UboExtEdge],
    ['ubo_ext_firefox', SpecificPlatform.UboExtFirefox],
    ['abp_ext_chrome', SpecificPlatform.AbpExtChrome],
    ['abp_ext_opera', SpecificPlatform.AbpExtOpera],
    ['abp_ext_edge', SpecificPlatform.AbpExtEdge],
    ['abp_ext_firefox', SpecificPlatform.AbpExtFirefox],
]);
new Map([...SPECIFIC_PLATFORM_MAP].map(([key, value]) => [value, key]));
const GENERIC_PLATFORM_MAP = new Map([
    ['adg_os_any', GenericPlatform.AdgOsAny],
    ['adg_safari_any', GenericPlatform.AdgSafariAny],
    ['adg_ext_chromium', GenericPlatform.AdgExtChromium],
    ['adg_ext_any', GenericPlatform.AdgExtAny],
    ['adg_any', GenericPlatform.AdgAny],
    ['ubo_ext_chromium', GenericPlatform.UboExtChromium],
    ['ubo_ext_any', GenericPlatform.UboExtAny],
    ['ubo_any', GenericPlatform.UboAny],
    ['abp_ext_chromium', GenericPlatform.AbpExtChromium],
    ['abp_ext_any', GenericPlatform.AbpExtAny],
    ['abp_any', GenericPlatform.AbpAny],
    ['any', GenericPlatform.Any],
]);
const isGenericPlatform = (platform) => {
    return !!(platform & (platform - 1));
};
class CompatibilityTableBase {
    data;
    nameTransformer;
    constructor(data, nameTransformer = null) {
        this.data = data;
        this.nameTransformer = nameTransformer;
    }
    getRowStorage(name) {
        const idx = this.data.map[name];
        if (isUndefined(idx)) {
            return null;
        }
        return this.data.shared[idx];
    }
    existsAny(name) {
        const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
        return !isUndefined(this.data.map[normalizedName]);
    }
    exists(name, platform) {
        const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
        const data = this.getRowStorage(normalizedName);
        if (!data) {
            return false;
        }
        const isMatch = (idx) => {
            const el = data.shared[idx];
            return !isUndefined(el) && (el.name === normalizedName || !!el.aliases?.includes(normalizedName));
        };
        if (isGenericPlatform(platform)) {
            const keys = Object.keys(data.map);
            for (let i = 0; i < keys.length; i += 1) {
                const key = Number(keys[i]);
                if (platform & key) {
                    const idx = data.map[key];
                    if (isMatch(idx)) {
                        return true;
                    }
                }
            }
            return false;
        }
        const idx = data.map[platform];
        return isMatch(idx);
    }
    getSingle(name, platform) {
        const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
        const data = this.getRowStorage(normalizedName);
        if (!data) {
            return null;
        }
        const idx = data.map[platform];
        return isUndefined(idx) ? null : data.shared[idx];
    }
    getMultiple(name, platform) {
        const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
        const data = this.getRowStorage(normalizedName);
        if (!data) {
            return null;
        }
        if (isGenericPlatform(platform)) {
            const result = {};
            const keys = Object.keys(data.map);
            for (let i = 0; i < keys.length; i += 1) {
                const key = Number(keys[i]);
                if (platform & key) {
                    const idx = data.map[key];
                    if (!isUndefined(idx)) {
                        result[key] = data.shared[idx];
                    }
                }
            }
            return result;
        }
        const idx = data.map[platform];
        if (isUndefined(idx)) {
            return null;
        }
        return { key: data.shared[idx] };
    }
    getAllMultiple(platform) {
        const result = [];
        for (let i = 0; i < this.data.shared.length; i += 1) {
            const data = this.data.shared[i];
            const names = new Set(data.shared.map(({ name }) => name));
            names.forEach((name) => {
                const multipleRecords = this.getMultiple(name, platform);
                if (multipleRecords) {
                    result.push(multipleRecords);
                }
            });
        }
        return result;
    }
    getFirst(name, platform) {
        const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
        const data = this.getRowStorage(normalizedName);
        if (!data) {
            return null;
        }
        if (isGenericPlatform(platform)) {
            const keys = Object.keys(data.map);
            for (let i = 0; i < keys.length; i += 1) {
                const key = Number(keys[i]);
                if (platform & key) {
                    const idx = data.map[key];
                    if (!isUndefined(idx)) {
                        return data.shared[idx];
                    }
                }
            }
            return null;
        }
        const idx = data.map[platform];
        if (isUndefined(idx)) {
            return null;
        }
        return data.shared[idx];
    }
    getRow(name) {
        const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
        const data = this.getRowStorage(normalizedName);
        if (!data) {
            return [];
        }
        return data.shared;
    }
    getRowsByProduct() {
        const result = [];
        for (let i = 0; i < this.data.shared.length; i += 1) {
            const data = this.data.shared[i];
            const keys = Object.keys(data.map);
            const row = {
                [AdblockSyntax.Adg]: {},
                [AdblockSyntax.Ubo]: {},
                [AdblockSyntax.Abp]: {},
            };
            for (let j = 0; j < keys.length; j += 1) {
                const key = Number(keys[j]);
                if (key & GenericPlatform.AdgAny) {
                    row[AdblockSyntax.Adg][key] = data.shared[data.map[key]];
                }
                else if (key & GenericPlatform.UboAny) {
                    row[AdblockSyntax.Ubo][key] = data.shared[data.map[key]];
                }
                else if (key & GenericPlatform.AbpAny) {
                    row[AdblockSyntax.Abp][key] = data.shared[data.map[key]];
                }
            }
            result.push(row);
        }
        return result;
    }
}
const deepFreeze = (object) => {
    const propNames = Reflect.ownKeys(object);
    for (const name of propNames) {
        const value = object[name];
        if ((value && typeof value === 'object') || typeof value === 'function') {
            deepFreeze(value);
        }
    }
    return Object.freeze(object);
};
const noopModifierNameNormalizer = (name) => {
    if (name.startsWith(UNDERSCORE)) {
        if (name.split(EMPTY).every((char) => char === UNDERSCORE)) {
            return UNDERSCORE;
        }
    }
    return name;
};
class ModifiersCompatibilityTable extends CompatibilityTableBase {
    constructor(data) {
        super(data, noopModifierNameNormalizer);
    }
}
deepFreeze(modifiersCompatibilityTableData_1);
const modifiersCompatibilityTable = new ModifiersCompatibilityTable(modifiersCompatibilityTableData_1);
class ConverterBase {
    static convertToAdg(data) {
        throw new NotImplementedError();
    }
    static convertToAbp(data) {
        throw new NotImplementedError();
    }
    static convertToUbo(data) {
        throw new NotImplementedError();
    }
}
class RuleConverterBase extends ConverterBase {
    static convertToAdg(rule) {
        throw new NotImplementedError();
    }
    static convertToAbp(rule) {
        throw new NotImplementedError();
    }
    static convertToUbo(rule) {
        throw new NotImplementedError();
    }
}
function createConversionResult(result, isConverted) {
    return {
        result,
        isConverted,
    };
}
function createNodeConversionResult(nodes, isConverted) {
    return createConversionResult(nodes, isConverted);
}
class CommentRuleConverter extends RuleConverterBase {
    static convertToAdg(rule) {
        switch (rule.type) {
            case CommentRuleType.CommentRule:
                if (rule.type === CommentRuleType.CommentRule && rule.marker.value === CommentMarker.Hashmark) {
                    const ruleClone = clone(rule);
                    ruleClone.marker.value = CommentMarker.Regular;
                    ruleClone.text.value = `${SPACE$1}${CommentMarker.Hashmark}${ruleClone.text.value}`;
                    return createNodeConversionResult([ruleClone], true);
                }
                return createNodeConversionResult([rule], false);
            default:
                return createNodeConversionResult([rule], false);
        }
    }
}
const REGEX_START = CARET;
const REGEX_END = DOLLAR_SIGN;
const REGEX_ANY_CHARACTERS = DOT + ASTERISK;
const ADBLOCK_URL_START = PIPE + PIPE;
const ADBLOCK_URL_START_REGEX = '^(http|https|ws|wss)://([a-z0-9-_.]+\\.)?';
const ADBLOCK_URL_SEPARATOR = CARET;
const ADBLOCK_URL_SEPARATOR_REGEX = '([^ a-zA-Z0-9.%_-]|$)';
const ADBLOCK_WILDCARD = ASTERISK;
const ADBLOCK_WILDCARD_REGEX = REGEX_ANY_CHARACTERS;
const REGEX_NEGATION_PREFIX = '^((?!';
const REGEX_NEGATION_SUFFIX = ').)*$';
const SPECIAL_REGEX_SYMBOLS = new Set([
    ASTERISK,
    CARET,
    CLOSE_CURLY_BRACKET,
    CLOSE_PARENTHESIS,
    CLOSE_SQUARE_BRACKET,
    DOLLAR_SIGN,
    DOT,
    ESCAPE_CHARACTER,
    OPEN_CURLY_BRACKET,
    OPEN_PARENTHESIS,
    OPEN_SQUARE_BRACKET,
    PIPE,
    PLUS,
    QUESTION_MARK,
    SLASH,
]);
class RegExpUtils {
    static isRegexPattern(pattern) {
        const trimmedPattern = pattern.trim();
        return trimmedPattern.length > REGEX_MARKER.length * 2
            && trimmedPattern.startsWith(REGEX_MARKER)
            && trimmedPattern.endsWith(REGEX_MARKER)
            && trimmedPattern[REGEX_MARKER.length - 2] !== ESCAPE_CHARACTER;
    }
    static negateRegexPattern(pattern) {
        let result = pattern.trim();
        let slashes = false;
        if (RegExpUtils.isRegexPattern(result)) {
            result = result.substring(REGEX_MARKER.length, result.length - REGEX_MARKER.length);
            slashes = true;
        }
        if (!(result.startsWith(REGEX_NEGATION_PREFIX) && result.endsWith(REGEX_NEGATION_SUFFIX))) {
            if (result.startsWith(REGEX_START)) {
                result = result.substring(REGEX_START.length);
            }
            if (result.endsWith(REGEX_END)) {
                result = result.substring(0, result.length - REGEX_END.length);
            }
            result = `${REGEX_NEGATION_PREFIX}${result}${REGEX_NEGATION_SUFFIX}`;
        }
        if (slashes) {
            result = `${REGEX_MARKER}${result}${REGEX_MARKER}`;
        }
        return result;
    }
    static patternToRegexp(pattern) {
        const trimmed = pattern.trim();
        if (trimmed === ADBLOCK_URL_START
            || trimmed === PIPE
            || trimmed === ADBLOCK_WILDCARD
            || trimmed === EMPTY) {
            return REGEX_ANY_CHARACTERS;
        }
        if (RegExpUtils.isRegexPattern(pattern)) {
            return pattern.substring(REGEX_MARKER.length, pattern.length - REGEX_MARKER.length);
        }
        let result = EMPTY;
        let offset = 0;
        let len = trimmed.length;
        if (trimmed[0] === PIPE) {
            if (trimmed[1] === PIPE) {
                result += ADBLOCK_URL_START_REGEX;
                offset = ADBLOCK_URL_START.length;
            }
            else {
                result += REGEX_START;
                offset = REGEX_START.length;
            }
        }
        let trailingPipe = false;
        if (trimmed.endsWith(PIPE)) {
            trailingPipe = true;
            len -= PIPE.length;
        }
        for (; offset < len; offset += 1) {
            if (trimmed[offset] === ADBLOCK_WILDCARD) {
                result += ADBLOCK_WILDCARD_REGEX;
            }
            else if (trimmed[offset] === ADBLOCK_URL_SEPARATOR) {
                result += ADBLOCK_URL_SEPARATOR_REGEX;
            }
            else if (SPECIAL_REGEX_SYMBOLS.has(trimmed[offset])) {
                result += ESCAPE_CHARACTER + trimmed[offset];
            }
            else {
                result += trimmed[offset];
            }
        }
        if (trailingPipe) {
            result += REGEX_END;
        }
        return result;
    }
}
function cloneScriptletRuleNode(node) {
    return {
        type: node.type,
        children: node.children.map((child) => (isNull(child) ? null : { ...child })),
    };
}
function cloneDomainListNode(node) {
    return {
        type: node.type,
        separator: node.separator,
        children: node.children.map((domain) => ({ ...domain })),
    };
}
function cloneModifierListNode(node) {
    return {
        type: node.type,
        children: node.children.map((modifier) => {
            const res = {
                type: modifier.type,
                exception: modifier.exception,
                name: { ...modifier.name },
            };
            if (modifier.value) {
                res.value = { ...modifier.value };
            }
            return res;
        }),
    };
}
const ADG_HTML_DEFAULT_MAX_LENGTH = 8192;
const ADG_HTML_CONVERSION_MAX_LENGTH = ADG_HTML_DEFAULT_MAX_LENGTH * 32;
const NOT_SPECIFIED = -1;
var PseudoClasses$1;
(function (PseudoClasses) {
    PseudoClasses["Contains"] = "contains";
    PseudoClasses["HasText"] = "has-text";
    PseudoClasses["MinTextLength"] = "min-text-length";
})(PseudoClasses$1 || (PseudoClasses$1 = {}));
var AttributeSelectors;
(function (AttributeSelectors) {
    AttributeSelectors["MaxLength"] = "max-length";
    AttributeSelectors["MinLength"] = "min-length";
    AttributeSelectors["TagContent"] = "tag-content";
    AttributeSelectors["Wildcard"] = "wildcard";
})(AttributeSelectors || (AttributeSelectors = {}));
const SUPPORTED_UBO_PSEUDO_CLASSES = new Set([
    PseudoClasses$1.Contains,
    PseudoClasses$1.HasText,
    PseudoClasses$1.MinTextLength,
]);
const ERROR_MESSAGES$2 = {
    ABP_NOT_SUPPORTED: 'Invalid rule, ABP does not support HTML filtering rules',
    TAG_SHOULD_BE_FIRST_CHILD: "Unexpected token '%s' with value '%s', tag selector should be the first child",
    EXPECTED_BUT_GOT_WITH_VALUE: "Expected '%s', but got '%s' with value '%s'",
    INVALID_ATTRIBUTE_NAME: "Attribute name should be an identifier, but got '%s' with value '%s'",
    INVALID_ATTRIBUTE_VALUE: `Expected '${getFormattedTokenName(TokenType$1.Ident)}' or '${getFormattedTokenName(TokenType$1.String)}' as attribute value, but got '%s' with value '%s`,
    INVALID_FLAG: "Unsupported attribute selector flag '%s'",
    INVALID_OPERATOR_FOR_ATTR: "Unsupported operator '%s' for '%s' attribute",
    VALUE_FOR_ATTR_SHOULD_BE_INT: "Value for '%s' attribute should be an integer, but got '%s'",
    INVALID_PSEUDO_CLASS: "Unsupported pseudo class '%s'",
    VALUE_FOR_PSEUDO_CLASS_SHOULD_BE_INT: "Value for '%s' pseudo class should be an integer, but got '%s'",
    REGEXP_NOT_SUPPORTED: "Cannot convert RegExp parameter '%s' from '%s' pseudo class, because converting RegExp patterns are not supported yet",
    ATTRIBUTE_SELECTOR_REQUIRES_VALUE: "Attribute selector '%s' requires a value",
    INVALID_ATTRIBUTE_SELECTOR_OPERATOR: "Unsupported attribute selector operator '%s'",
    VALUE_SHOULD_BE_SPECIFIED: 'Value should be specified if operator is specified',
    OPERATOR_SHOULD_BE_SPECIFIED: 'Operator should be specified if value is specified',
    UNEXPECTED_TOKEN_WITH_VALUE: "Unexpected token '%s' with value '%s'",
    FLAGS_NOT_SUPPORTED: 'Flags are not supported for attribute selectors',
};
function escapeDoubleQuotes(selector) {
    let withinString = false;
    const buffer = [];
    for (let i = 0; i < selector.length; i += 1) {
        if (!withinString && selector[i] === DOUBLE_QUOTE_MARKER) {
            withinString = true;
            buffer.push(selector[i]);
        }
        else if (withinString && selector[i] === DOUBLE_QUOTE_MARKER && selector[i + 1] === DOUBLE_QUOTE_MARKER) {
            buffer.push(ESCAPE_CHARACTER);
            buffer.push(DOUBLE_QUOTE_MARKER);
            i += 1;
        }
        else if (withinString && selector[i] === DOUBLE_QUOTE_MARKER && selector[i + 1] !== DOUBLE_QUOTE_MARKER) {
            buffer.push(DOUBLE_QUOTE_MARKER);
            withinString = false;
        }
        else {
            buffer.push(selector[i]);
        }
    }
    return buffer.join(EMPTY);
}
function unescapeDoubleQuotes(selector) {
    let withinString = false;
    const buffer = [];
    for (let i = 0; i < selector.length; i += 1) {
        if (selector[i] === DOUBLE_QUOTE_MARKER && selector[i - 1] !== ESCAPE_CHARACTER) {
            withinString = !withinString;
            buffer.push(selector[i]);
        }
        else if (withinString && selector[i] === ESCAPE_CHARACTER && selector[i + 1] === DOUBLE_QUOTE_MARKER) {
            buffer.push(DOUBLE_QUOTE_MARKER);
        }
        else {
            buffer.push(selector[i]);
        }
    }
    return buffer.join(EMPTY);
}
function renderAttrSelector(attr, op, value, flags) {
    const result = [];
    result.push(OPEN_SQUARE_BRACKET);
    result.push(attr);
    if (op !== undefined) {
        if (value === undefined) {
            throw new Error(ERROR_MESSAGES$2.VALUE_SHOULD_BE_SPECIFIED);
        }
        result.push(op);
    }
    if (value !== undefined) {
        if (!op) {
            throw new Error(ERROR_MESSAGES$2.OPERATOR_SHOULD_BE_SPECIFIED);
        }
        result.push(DOUBLE_QUOTE_MARKER);
        result.push(value);
        result.push(DOUBLE_QUOTE_MARKER);
    }
    if (flags !== undefined) {
        result.push(SPACE$1);
        result.push(flags);
    }
    result.push(CLOSE_SQUARE_BRACKET);
    return result.join(EMPTY);
}
class HtmlRuleConverter extends RuleConverterBase {
    static convertToAdg(rule) {
        if (rule.syntax === AdblockSyntax.Adg) {
            return createNodeConversionResult([rule], false);
        }
        if (rule.syntax === AdblockSyntax.Abp) {
            throw new RuleConversionError(ERROR_MESSAGES$2.ABP_NOT_SUPPORTED);
        }
        const source = escapeDoubleQuotes(rule.body.value);
        const stream = new CssTokenStream(source);
        const convertedSelector = [];
        const convertedSelectorList = [];
        let minLen = NOT_SPECIFIED;
        let maxLen = NOT_SPECIFIED;
        stream.skipWhitespace();
        stream.expect(TokenType$1.Delim, { value: UBO_HTML_MASK });
        stream.advance();
        while (!stream.isEof()) {
            const token = stream.getOrFail();
            if (token.type === TokenType$1.Ident) {
                if (convertedSelector.length !== 0 && stream.lookbehindForNonWs() !== undefined) {
                    throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.TAG_SHOULD_BE_FIRST_CHILD, getFormattedTokenName(token.type), source.slice(token.start, token.end)));
                }
                convertedSelector.push(source.slice(token.start, token.end));
                stream.advance();
            }
            else if (token.type === TokenType$1.OpenSquareBracket) {
                const { start } = token;
                let tempToken;
                stream.advance();
                stream.skipWhitespace();
                tempToken = stream.getOrFail();
                if (tempToken.type !== TokenType$1.Ident) {
                    throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.INVALID_ATTRIBUTE_NAME, getFormattedTokenName(tempToken.type), source.slice(tempToken.start, tempToken.end)));
                }
                const attr = source.slice(tempToken.start, tempToken.end);
                stream.advance();
                stream.skipWhitespace();
                tempToken = stream.getOrFail();
                if (tempToken.type === TokenType$1.CloseSquareBracket) {
                    const { end } = tempToken;
                    stream.advance();
                    if (attr === AttributeSelectors.MinLength || attr === AttributeSelectors.MaxLength) {
                        throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.ATTRIBUTE_SELECTOR_REQUIRES_VALUE, attr));
                    }
                    convertedSelector.push(source.slice(start, end));
                    continue;
                }
                stream.expect(TokenType$1.Delim, { value: EQUALS });
                stream.advance();
                stream.skipWhitespace();
                tempToken = stream.getOrFail();
                if (tempToken.type !== TokenType$1.Ident && tempToken.type !== TokenType$1.String) {
                    throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.INVALID_ATTRIBUTE_VALUE, getFormattedTokenName(tempToken.type), source.slice(tempToken.start, tempToken.end)));
                }
                const value = source.slice(tempToken.start, tempToken.end);
                stream.advance();
                stream.skipWhitespace();
                tempToken = stream.getOrFail();
                if (tempToken.type === TokenType$1.Ident) {
                    throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.FLAGS_NOT_SUPPORTED));
                }
                stream.expect(TokenType$1.CloseSquareBracket);
                const { end } = stream.getOrFail();
                stream.advance();
                if (attr === AttributeSelectors.MinLength) {
                    const parsed = parseInt(value, 10);
                    if (Number.isNaN(parsed)) {
                        throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.VALUE_FOR_ATTR_SHOULD_BE_INT, attr, value));
                    }
                    minLen = parsed;
                }
                else if (attr === AttributeSelectors.MaxLength) {
                    const parsed = parseInt(value, 10);
                    if (Number.isNaN(parsed)) {
                        throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.VALUE_FOR_ATTR_SHOULD_BE_INT, attr, value));
                    }
                    maxLen = parsed;
                }
                else {
                    convertedSelector.push(source.slice(start, end));
                }
            }
            else if (token.type === TokenType$1.Colon) {
                let tempToken;
                stream.advance();
                stream.expect(TokenType$1.Function);
                tempToken = stream.getOrFail();
                const fn = source.slice(tempToken.start, tempToken.end - 1);
                if (!SUPPORTED_UBO_PSEUDO_CLASSES.has(fn)) {
                    throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.INVALID_PSEUDO_CLASS, fn));
                }
                const paramStart = tempToken.end;
                stream.skipUntilBalanced();
                tempToken = stream.getOrFail();
                const paramEnd = tempToken.end;
                const param = source.slice(paramStart, paramEnd - 1);
                if (fn === PseudoClasses$1.MinTextLength) {
                    const parsed = parseInt(param, 10);
                    if (Number.isNaN(parsed)) {
                        throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.VALUE_FOR_PSEUDO_CLASS_SHOULD_BE_INT, fn, param));
                    }
                    minLen = parsed;
                }
                else if (fn === PseudoClasses$1.Contains || fn === PseudoClasses$1.HasText) {
                    if (RegExpUtils.isRegexPattern(param)) {
                        throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.REGEXP_NOT_SUPPORTED, param, fn));
                    }
                    const paramEscaped = StringUtils.escapeCharacter(param, DOUBLE_QUOTE_MARKER);
                    convertedSelector.push(renderAttrSelector(AttributeSelectors.TagContent, EQUALS, paramEscaped));
                }
                stream.advance();
            }
            else if (token.type === TokenType$1.Comma && token.balance === 0) {
                if (minLen !== NOT_SPECIFIED) {
                    convertedSelector.push(renderAttrSelector(AttributeSelectors.MinLength, EQUALS, minLen.toString()));
                }
                convertedSelector.push(renderAttrSelector(AttributeSelectors.MaxLength, EQUALS, maxLen !== NOT_SPECIFIED ? maxLen.toString() : ADG_HTML_CONVERSION_MAX_LENGTH.toString()));
                convertedSelectorList.push(convertedSelector.join(EMPTY));
                convertedSelector.length = 0;
                stream.advance();
            }
            else if (token.type === TokenType$1.Whitespace) {
                stream.advance();
            }
            else {
                throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.UNEXPECTED_TOKEN_WITH_VALUE, getFormattedTokenName(token.type), source.slice(token.start, token.end)));
            }
        }
        if (convertedSelector.length !== 0) {
            if (minLen !== NOT_SPECIFIED) {
                convertedSelector.push(renderAttrSelector(AttributeSelectors.MinLength, EQUALS, minLen.toString()));
            }
            convertedSelector.push(renderAttrSelector(AttributeSelectors.MaxLength, EQUALS, maxLen !== NOT_SPECIFIED ? maxLen.toString() : ADG_HTML_CONVERSION_MAX_LENGTH.toString()));
            convertedSelectorList.push(convertedSelector.join(EMPTY));
        }
        return createNodeConversionResult(
        convertedSelectorList.map((selector) => ({
            category: RuleCategory.Cosmetic,
            type: CosmeticRuleType.HtmlFilteringRule,
            syntax: AdblockSyntax.Adg,
            exception: rule.exception,
            domains: cloneDomainListNode(rule.domains),
            separator: {
                type: 'Value',
                value: rule.exception
                    ? CosmeticRuleSeparator.AdgHtmlFilteringException
                    : CosmeticRuleSeparator.AdgHtmlFiltering,
            },
            body: {
                type: 'Value',
                value: unescapeDoubleQuotes(selector),
            },
        })), true);
    }
}
function getScriptletName(scriptletNode) {
    if (scriptletNode.children.length === 0) {
        throw new Error('Empty scriptlet');
    }
    return scriptletNode.children[0]?.value ?? EMPTY;
}
function transformNthScriptletArgument(scriptletNode, index, transform) {
    const child = scriptletNode.children[index];
    if (!isUndefined(child)) {
        const transformed = transform(child?.value ?? null);
        if (isNull(transformed)) {
            scriptletNode.children[index] = null;
            return;
        }
        if (isNull(child)) {
            scriptletNode.children[index] = {
                type: 'Value',
                value: transformed,
            };
            return;
        }
        child.value = transformed;
    }
}
function transformAllScriptletArguments(scriptletNode, transform) {
    for (let i = 0; i < scriptletNode.children.length; i += 1) {
        transformNthScriptletArgument(scriptletNode, i, transform);
    }
}
function setScriptletName(scriptletNode, name) {
    transformNthScriptletArgument(scriptletNode, 0, () => name);
}
function setScriptletQuoteType(scriptletNode, quoteType) {
    transformAllScriptletArguments(scriptletNode, (value) => QuoteUtils.setStringQuoteType(value ?? EMPTY, quoteType));
}
var ResourceType$1;
(function (ResourceType) {
    ResourceType["MainFrame"] = "main_frame";
    ResourceType["SubFrame"] = "sub_frame";
    ResourceType["Stylesheet"] = "stylesheet";
    ResourceType["Script"] = "script";
    ResourceType["Image"] = "image";
    ResourceType["Font"] = "font";
    ResourceType["Object"] = "object";
    ResourceType["XmlHttpRequest"] = "xmlhttprequest";
    ResourceType["Ping"] = "ping";
    ResourceType["Media"] = "media";
    ResourceType["WebSocket"] = "websocket";
    ResourceType["Other"] = "other";
})(ResourceType$1 || (ResourceType$1 = {}));
const resourceTypeSchema = zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].nativeEnum */ .ZP.nativeEnum(ResourceType$1);
const RESOURCE_TYPE_MODIFIER_MAP = Object.freeze({
    [ResourceType$1.MainFrame]: 'document',
    [ResourceType$1.SubFrame]: 'subdocument',
    [ResourceType$1.Stylesheet]: 'stylesheet',
    [ResourceType$1.Script]: 'script',
    [ResourceType$1.Image]: 'image',
    [ResourceType$1.Font]: 'font',
    [ResourceType$1.Object]: 'object',
    [ResourceType$1.XmlHttpRequest]: 'xmlhttprequest',
    [ResourceType$1.Ping]: 'ping',
    [ResourceType$1.Media]: 'media',
    [ResourceType$1.WebSocket]: 'websocket',
    [ResourceType$1.Other]: 'other',
});
const getResourceTypeModifier = (resourceType, platform) => {
    const modifierName = RESOURCE_TYPE_MODIFIER_MAP[resourceType];
    if (!modifierName) {
        return null;
    }
    const modifierData = modifiersCompatibilityTable.getFirst(modifierName, platform);
    if (isNull(modifierData)) {
        return null;
    }
    return modifierData.name;
};
const isValidResourceType = (resourceType) => {
    return Object.values(ResourceType$1).includes(resourceType);
};
const ABP_RESOURCE_PREFIX = 'abp-resource:';
const ABP_RESOURCE_PREFIX_LENGTH = ABP_RESOURCE_PREFIX.length;
const redirectNameNormalizer = (name) => {
    if (name.startsWith(ABP_RESOURCE_PREFIX)) {
        return name.slice(ABP_RESOURCE_PREFIX_LENGTH);
    }
    const colonIndex = name.lastIndexOf(COLON);
    if (colonIndex !== -1 && /^\d+$/.test(name.slice(colonIndex + 1))) {
        return name.slice(0, colonIndex);
    }
    return name;
};
class RedirectsCompatibilityTable extends CompatibilityTableBase {
    constructor(data) {
        super(data, redirectNameNormalizer);
    }
    getResourceTypeModifiers(redirect, platform) {
        let redirectData = null;
        if (isString$1(redirect)) {
            redirectData = this.getFirst(redirect, platform);
        }
        else {
            redirectData = redirect;
        }
        const modifierNames = new Set();
        if (isNull(redirectData) || isUndefined(redirectData.resourceTypes)) {
            return modifierNames;
        }
        for (const resourceType of redirectData.resourceTypes) {
            const modifierName = getResourceTypeModifier(resourceType, platform);
            if (isNull(modifierName)) {
                continue;
            }
            modifierNames.add(modifierName);
        }
        return modifierNames;
    }
}
deepFreeze(redirectsCompatibilityTableData_1);
const redirectsCompatibilityTable = new RedirectsCompatibilityTable(redirectsCompatibilityTableData_1);
class ScriptletsCompatibilityTable extends CompatibilityTableBase {
}
deepFreeze(scriptletsCompatibilityTableData_1);
const scriptletsCompatibilityTable = new ScriptletsCompatibilityTable(scriptletsCompatibilityTableData_1);
const PLATFORM_SEPARATOR = '|';
const PLATFORM_NEGATION = '~';
const parseRawPlatforms = (rawPlatforms) => {
    const rawPlatformList = rawPlatforms
        .split(PLATFORM_SEPARATOR)
        .map((rawPlatform) => rawPlatform.trim());
    let result = 0;
    for (let rawPlatform of rawPlatformList) {
        let negated = false;
        if (rawPlatform.startsWith(PLATFORM_NEGATION)) {
            negated = true;
            rawPlatform = rawPlatform.slice(1).trim();
        }
        const platform = SPECIFIC_PLATFORM_MAP.get(rawPlatform) ?? GENERIC_PLATFORM_MAP.get(rawPlatform);
        if (isUndefined(platform)) {
            throw new Error(`Unknown platform: ${rawPlatform}`);
        }
        if (negated) {
            result &= ~platform;
        }
        else {
            result |= platform;
        }
    }
    if (result === 0) {
        throw new Error('No platforms specified');
    }
    return result;
};
zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].string */ .ZP.string()
    .min(1)
    .transform((value) => parseRawPlatforms(value));
function getDefaultExportFromCjs (x) {
	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
var mapObj$1 = {exports: {}};
const isObject$1 = value => typeof value === 'object' && value !== null;
const mapObjectSkip = Symbol('skip');
const isObjectCustom = value =>
	isObject$1(value) &&
	!(value instanceof RegExp) &&
	!(value instanceof Error) &&
	!(value instanceof Date);
const mapObject = (object, mapper, options, isSeen = new WeakMap()) => {
	options = {
		deep: false,
		target: {},
		...options
	};
	if (isSeen.has(object)) {
		return isSeen.get(object);
	}
	isSeen.set(object, options.target);
	const {target} = options;
	delete options.target;
	const mapArray = array => array.map(element => isObjectCustom(element) ? mapObject(element, mapper, options, isSeen) : element);
	if (Array.isArray(object)) {
		return mapArray(object);
	}
	for (const [key, value] of Object.entries(object)) {
		const mapResult = mapper(key, value, object);
		if (mapResult === mapObjectSkip) {
			continue;
		}
		let [newKey, newValue, {shouldRecurse = true} = {}] = mapResult;
		if (newKey === '__proto__') {
			continue;
		}
		if (options.deep && shouldRecurse && isObjectCustom(newValue)) {
			newValue = Array.isArray(newValue) ?
				mapArray(newValue) :
				mapObject(newValue, mapper, options, isSeen);
		}
		target[newKey] = newValue;
	}
	return target;
};
mapObj$1.exports = (object, mapper, options) => {
	if (!isObject$1(object)) {
		throw new TypeError(`Expected an object, got \`${object}\` (${typeof object})`);
	}
	return mapObject(object, mapper, options);
};
mapObj$1.exports.mapObjectSkip = mapObjectSkip;
var mapObjExports = mapObj$1.exports;
var camelcase = {exports: {}};
const UPPERCASE = /[\p{Lu}]/u;
const LOWERCASE = /[\p{Ll}]/u;
const LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
const SEPARATORS = /[_.\- ]+/;
const LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source);
const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu');
const NUMBERS_AND_IDENTIFIER = new RegExp('\\d+' + IDENTIFIER.source, 'gu');
const preserveCamelCase = (string, toLowerCase, toUpperCase) => {
	let isLastCharLower = false;
	let isLastCharUpper = false;
	let isLastLastCharUpper = false;
	for (let i = 0; i < string.length; i++) {
		const character = string[i];
		if (isLastCharLower && UPPERCASE.test(character)) {
			string = string.slice(0, i) + '-' + string.slice(i);
			isLastCharLower = false;
			isLastLastCharUpper = isLastCharUpper;
			isLastCharUpper = true;
			i++;
		} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character)) {
			string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
			isLastLastCharUpper = isLastCharUpper;
			isLastCharUpper = false;
			isLastCharLower = true;
		} else {
			isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
			isLastLastCharUpper = isLastCharUpper;
			isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
		}
	}
	return string;
};
const preserveConsecutiveUppercase = (input, toLowerCase) => {
	LEADING_CAPITAL.lastIndex = 0;
	return input.replace(LEADING_CAPITAL, m1 => toLowerCase(m1));
};
const postProcess = (input, toUpperCase) => {
	SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
	NUMBERS_AND_IDENTIFIER.lastIndex = 0;
	return input.replace(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier))
		.replace(NUMBERS_AND_IDENTIFIER, m => toUpperCase(m));
};
const camelCase$1 = (input, options) => {
	if (!(typeof input === 'string' || Array.isArray(input))) {
		throw new TypeError('Expected the input to be `string | string[]`');
	}
	options = {
		pascalCase: false,
		preserveConsecutiveUppercase: false,
		...options
	};
	if (Array.isArray(input)) {
		input = input.map(x => x.trim())
			.filter(x => x.length)
			.join('-');
	} else {
		input = input.trim();
	}
	if (input.length === 0) {
		return '';
	}
	const toLowerCase = options.locale === false ?
		string => string.toLowerCase() :
		string => string.toLocaleLowerCase(options.locale);
	const toUpperCase = options.locale === false ?
		string => string.toUpperCase() :
		string => string.toLocaleUpperCase(options.locale);
	if (input.length === 1) {
		return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
	}
	const hasUpperCase = input !== toLowerCase(input);
	if (hasUpperCase) {
		input = preserveCamelCase(input, toLowerCase, toUpperCase);
	}
	input = input.replace(LEADING_SEPARATORS, '');
	if (options.preserveConsecutiveUppercase) {
		input = preserveConsecutiveUppercase(input, toLowerCase);
	} else {
		input = toLowerCase(input);
	}
	if (options.pascalCase) {
		input = toUpperCase(input.charAt(0)) + input.slice(1);
	}
	return postProcess(input, toUpperCase);
};
camelcase.exports = camelCase$1;
camelcase.exports.default = camelCase$1;
var camelcaseExports = camelcase.exports;
class QuickLRU {
	constructor(options = {}) {
		if (!(options.maxSize && options.maxSize > 0)) {
			throw new TypeError('`maxSize` must be a number greater than 0');
		}
		this.maxSize = options.maxSize;
		this.onEviction = options.onEviction;
		this.cache = new Map();
		this.oldCache = new Map();
		this._size = 0;
	}
	_set(key, value) {
		this.cache.set(key, value);
		this._size++;
		if (this._size >= this.maxSize) {
			this._size = 0;
			if (typeof this.onEviction === 'function') {
				for (const [key, value] of this.oldCache.entries()) {
					this.onEviction(key, value);
				}
			}
			this.oldCache = this.cache;
			this.cache = new Map();
		}
	}
	get(key) {
		if (this.cache.has(key)) {
			return this.cache.get(key);
		}
		if (this.oldCache.has(key)) {
			const value = this.oldCache.get(key);
			this.oldCache.delete(key);
			this._set(key, value);
			return value;
		}
	}
	set(key, value) {
		if (this.cache.has(key)) {
			this.cache.set(key, value);
		} else {
			this._set(key, value);
		}
		return this;
	}
	has(key) {
		return this.cache.has(key) || this.oldCache.has(key);
	}
	peek(key) {
		if (this.cache.has(key)) {
			return this.cache.get(key);
		}
		if (this.oldCache.has(key)) {
			return this.oldCache.get(key);
		}
	}
	delete(key) {
		const deleted = this.cache.delete(key);
		if (deleted) {
			this._size--;
		}
		return this.oldCache.delete(key) || deleted;
	}
	clear() {
		this.cache.clear();
		this.oldCache.clear();
		this._size = 0;
	}
	* keys() {
		for (const [key] of this) {
			yield key;
		}
	}
	* values() {
		for (const [, value] of this) {
			yield value;
		}
	}
	* [Symbol.iterator]() {
		for (const item of this.cache) {
			yield item;
		}
		for (const item of this.oldCache) {
			const [key] = item;
			if (!this.cache.has(key)) {
				yield item;
			}
		}
	}
	get size() {
		let oldCacheSize = 0;
		for (const key of this.oldCache.keys()) {
			if (!this.cache.has(key)) {
				oldCacheSize++;
			}
		}
		return Math.min(this._size + oldCacheSize, this.maxSize);
	}
}
var quickLru = QuickLRU;
const mapObj = mapObjExports;
const camelCase = camelcaseExports;
const QuickLru = quickLru;
const has = (array, key) => array.some(x => {
	if (typeof x === 'string') {
		return x === key;
	}
	x.lastIndex = 0;
	return x.test(key);
});
const cache = new QuickLru({maxSize: 100000});
const isObject$2 = value =>
	typeof value === 'object' &&
	value !== null &&
	!(value instanceof RegExp) &&
	!(value instanceof Error) &&
	!(value instanceof Date);
const camelCaseConvert = (input, options) => {
	if (!isObject$2(input)) {
		return input;
	}
	options = {
		deep: false,
		pascalCase: false,
		...options
	};
	const {exclude, pascalCase, stopPaths, deep} = options;
	const stopPathsSet = new Set(stopPaths);
	const makeMapper = parentPath => (key, value) => {
		if (deep && isObject$2(value)) {
			const path = parentPath === undefined ? key : `${parentPath}.${key}`;
			if (!stopPathsSet.has(path)) {
				value = mapObj(value, makeMapper(path));
			}
		}
		if (!(exclude && has(exclude, key))) {
			const cacheKey = pascalCase ? `${key}_` : key;
			if (cache.has(cacheKey)) {
				key = cache.get(cacheKey);
			} else {
				const returnValue = camelCase(key, {pascalCase, locale: false});
				if (key.length < 100) {
					cache.set(cacheKey, returnValue);
				}
				key = returnValue;
			}
		}
		return [key, value];
	};
	return mapObj(input, makeMapper(undefined));
};
var camelcaseKeys = (input, options) => {
	if (Array.isArray(input)) {
		return Object.keys(input).map(key => camelCaseConvert(input[key], options));
	}
	return camelCaseConvert(input, options);
};
var camelCaseKeys = getDefaultExportFromCjs(camelcaseKeys);
const zodToCamelCase = (zod) => {
    return zod.transform((val) => camelCaseKeys(val));
};
const booleanSchema = zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].union */ .ZP.union([
    zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].string */ .ZP.string().transform((val) => val.trim().toLowerCase() === 'true'),
    zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].boolean */ .ZP.boolean(),
]);
const nonEmptyStringSchema = zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].string */ .ZP.string()
    .transform((val) => val.trim())
    .pipe(zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].string */ .ZP.string().min(1));
const baseCompatibilityDataSchema = zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].object */ .ZP.object({
    name: nonEmptyStringSchema,
    aliases: zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].array */ .ZP.array(nonEmptyStringSchema).nullable().default(null),
    description: nonEmptyStringSchema.nullable().default(null),
    docs: nonEmptyStringSchema.nullable().default(null),
    version_added: nonEmptyStringSchema.nullable().default(null),
    version_removed: nonEmptyStringSchema.nullable().default(null),
    deprecated: booleanSchema.default(false),
    deprecation_message: nonEmptyStringSchema.nullable().default(null),
    removed: booleanSchema.default(false),
    removal_message: nonEmptyStringSchema.nullable().default(null),
});
zodToCamelCase(baseCompatibilityDataSchema);
const baseRefineLogic = (data, ctx) => {
    if (data.deprecated && !data.deprecation_message) {
        ctx.addIssue({
            code: zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].ZodIssueCode.custom */ .ZP.ZodIssueCode.custom,
            message: 'deprecation_message is required for deprecated modifiers',
        });
    }
    if (!data.deprecated && data.deprecation_message) {
        ctx.addIssue({
            code: zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].ZodIssueCode.custom */ .ZP.ZodIssueCode.custom,
            message: 'deprecation_message is only allowed for deprecated modifiers',
        });
    }
    if (data.aliases && data.aliases.length !== new Set(data.aliases).size) {
        ctx.addIssue({
            code: zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].ZodIssueCode.custom */ .ZP.ZodIssueCode.custom,
            message: 'Aliases must be unique',
        });
    }
};
function isErrorWithMessage$3(error) {
    return (typeof error === 'object'
        && error !== null
        && 'message' in error
        && typeof error.message === 'string');
}
function toErrorWithMessage$3(maybeError) {
    if (isErrorWithMessage$3(maybeError)) {
        return maybeError;
    }
    try {
        return new Error(JSON.stringify(maybeError));
    }
    catch {
        return new Error(String(maybeError));
    }
}
function getErrorMessage$3(error) {
    return toErrorWithMessage$3(error).message;
}
const KNOWN_VALIDATORS = new Set([
    'domain',
    'pipe_separated_domains',
    'regexp',
    'url',
]);
zodToCamelCase(baseCompatibilityDataSchema.extend({
    conflicts: zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].array */ .ZP.array(nonEmptyStringSchema).nullable().default(null),
    inverse_conflicts: booleanSchema.default(false),
    assignable: booleanSchema.default(false),
    negatable: booleanSchema.default(true),
    block_only: booleanSchema.default(false),
    exception_only: booleanSchema.default(false),
    value_optional: booleanSchema.default(false),
    value_format: nonEmptyStringSchema.nullable().default(null),
}).superRefine((data, ctx) => {
    baseRefineLogic(data, ctx);
    if (data.block_only && data.exception_only) {
        ctx.addIssue({
            code: zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].ZodIssueCode.custom */ .ZP.ZodIssueCode.custom,
            message: 'block_only and exception_only are mutually exclusive',
        });
    }
    if (data.assignable && !data.value_format) {
        ctx.addIssue({
            code: zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].ZodIssueCode.custom */ .ZP.ZodIssueCode.custom,
            message: 'value_format is required for assignable modifiers',
        });
    }
    if (data.value_format) {
        const valueFormat = data.value_format.trim();
        if (KNOWN_VALIDATORS.has(valueFormat)) {
            return;
        }
        try {
            XRegExp(valueFormat);
        }
        catch (error) {
            ctx.addIssue({
                code: zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].ZodIssueCode.custom */ .ZP.ZodIssueCode.custom,
                message: getErrorMessage$3(error),
            });
        }
    }
}));
zodToCamelCase(baseCompatibilityDataSchema.extend({
    is_blocking: booleanSchema.default(false),
    resource_types: zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].array */ .ZP.array(resourceTypeSchema).default([]),
}).superRefine(baseRefineLogic));
const scriptletParameterSchema = zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].object */ .ZP.object({
    name: nonEmptyStringSchema,
    required: booleanSchema,
    description: nonEmptyStringSchema.nullable().default(null),
    pattern: nonEmptyStringSchema.nullable().default(null),
    default: nonEmptyStringSchema.nullable().default(null),
    debug: booleanSchema.default(false),
});
const scriptletParametersSchema = zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].array */ .ZP.array(scriptletParameterSchema);
zodToCamelCase(baseCompatibilityDataSchema.extend({
    parameters: scriptletParametersSchema.optional(),
}).superRefine((data, ctx) => {
    baseRefineLogic(data, ctx);
    if (!data.parameters) {
        return;
    }
    let optionalFound = false;
    for (const parameter of data.parameters) {
        if (optionalFound && parameter.required) {
            ctx.addIssue({
                code: zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].ZodIssueCode.custom */ .ZP.ZodIssueCode.custom,
                message: 'Required parameters must be before optional ones',
            });
        }
        if (!parameter.required) {
            optionalFound = true;
        }
    }
}));
const ABP_SCRIPTLET_PREFIX = 'abp-';
const UBO_SCRIPTLET_PREFIX = 'ubo-';
const UBO_SCRIPTLET_PREFIX_LENGTH = UBO_SCRIPTLET_PREFIX.length;
const UBO_SCRIPTLET_JS_SUFFIX = '.js';
const UBO_SCRIPTLET_JS_SUFFIX_LENGTH = UBO_SCRIPTLET_JS_SUFFIX.length;
const COMMA_SEPARATOR$1 = ',';
const ADG_SET_CONSTANT_NAME = 'set-constant';
const ADG_SET_CONSTANT_EMPTY_STRING = '';
const ADG_SET_CONSTANT_EMPTY_ARRAY = 'emptyArr';
const ADG_SET_CONSTANT_EMPTY_OBJECT = 'emptyObj';
const UBO_SET_CONSTANT_EMPTY_STRING = '\'\'';
const UBO_SET_CONSTANT_EMPTY_ARRAY = '[]';
const UBO_SET_CONSTANT_EMPTY_OBJECT = '{}';
const ADG_PREVENT_FETCH_NAME = 'prevent-fetch';
const ADG_PREVENT_FETCH_EMPTY_STRING = '';
const ADG_PREVENT_FETCH_WILDCARD = '*';
const UBO_NO_FETCH_IF_WILDCARD = '/^/';
const UBO_REMOVE_CLASS_NAME = 'remove-class.js';
const UBO_REMOVE_ATTR_NAME = 'remove-attr.js';
const setConstantAdgToUboMap = {
    [ADG_SET_CONSTANT_EMPTY_STRING]: UBO_SET_CONSTANT_EMPTY_STRING,
    [ADG_SET_CONSTANT_EMPTY_ARRAY]: UBO_SET_CONSTANT_EMPTY_ARRAY,
    [ADG_SET_CONSTANT_EMPTY_OBJECT]: UBO_SET_CONSTANT_EMPTY_OBJECT,
};
const REMOVE_ATTR_CLASS_APPLYING = new Set([
    'asap',
    'stay',
    'complete',
]);
class ScriptletRuleConverter extends RuleConverterBase {
    static convertToAdg(rule) {
        if (rule.syntax === AdblockSyntax.Adg) {
            return createNodeConversionResult([rule], false);
        }
        const separator = rule.separator.value;
        let convertedSeparator = separator;
        convertedSeparator = rule.exception
            ? CosmeticRuleSeparator.AdgJsInjectionException
            : CosmeticRuleSeparator.AdgJsInjection;
        const convertedScriptlets = [];
        for (const scriptlet of rule.body.children) {
            const scriptletClone = cloneScriptletRuleNode(scriptlet);
            const scriptletName = QuoteUtils.setStringQuoteType(getScriptletName(scriptletClone), QuoteType.None);
            let prefix;
            let charToUnescape;
            switch (rule.syntax) {
                case AdblockSyntax.Abp:
                    prefix = ABP_SCRIPTLET_PREFIX;
                    charToUnescape = SPACE$1;
                    break;
                case AdblockSyntax.Ubo:
                    prefix = UBO_SCRIPTLET_PREFIX;
                    charToUnescape = COMMA_SEPARATOR$1;
                    break;
                default:
                    prefix = EMPTY;
            }
            if (!scriptletName.startsWith(prefix)) {
                setScriptletName(scriptletClone, `${prefix}${scriptletName}`);
            }
            if (!isUndefined(charToUnescape)) {
                transformAllScriptletArguments(scriptletClone, (value) => {
                    if (!isNull(value)) {
                        return QuoteUtils.unescapeSingleEscapedOccurrences(value, charToUnescape);
                    }
                    return value;
                });
            }
            if (rule.syntax === AdblockSyntax.Ubo) {
                const scriptletData = scriptletsCompatibilityTable.getFirst(scriptletName, GenericPlatform.UboAny);
                if (scriptletData
                    && (scriptletData.name === UBO_REMOVE_CLASS_NAME
                        || scriptletData.name === UBO_REMOVE_ATTR_NAME)
                    && scriptletClone.children.length > 2) {
                    const selectors = [];
                    let applying = null;
                    let lastArg = scriptletClone.children.pop();
                    if (lastArg) {
                        if (REMOVE_ATTR_CLASS_APPLYING.has(lastArg.value)) {
                            applying = lastArg.value;
                        }
                        else {
                            selectors.push(lastArg.value);
                        }
                    }
                    while (scriptletClone.children.length > 2) {
                        lastArg = scriptletClone.children.pop();
                        if (lastArg) {
                            selectors.push(lastArg.value.trim());
                        }
                    }
                    if (selectors.length > 0) {
                        scriptletClone.children.push({
                            type: 'Value',
                            value: selectors.reverse().join(', '),
                        });
                    }
                    if (!isNull(applying)) {
                        if (selectors.length === 0) {
                            scriptletClone.children.push({
                                type: 'Value',
                                value: EMPTY,
                            });
                        }
                        scriptletClone.children.push({
                            type: 'Value',
                            value: applying,
                        });
                    }
                }
            }
            setScriptletQuoteType(scriptletClone, QuoteType.Single);
            convertedScriptlets.push(scriptletClone);
        }
        if (rule.body.children.length === 0) {
            const convertedScriptletNode = {
                category: rule.category,
                type: rule.type,
                syntax: AdblockSyntax.Adg,
                exception: rule.exception,
                domains: cloneDomainListNode(rule.domains),
                separator: {
                    type: 'Value',
                    value: convertedSeparator,
                },
                body: {
                    type: rule.body.type,
                    children: [],
                },
            };
            if (rule.modifiers) {
                convertedScriptletNode.modifiers = cloneModifierListNode(rule.modifiers);
            }
            return createNodeConversionResult([convertedScriptletNode], true);
        }
        return createNodeConversionResult(convertedScriptlets.map((scriptlet) => {
            const res = {
                category: rule.category,
                type: rule.type,
                syntax: AdblockSyntax.Adg,
                exception: rule.exception,
                domains: cloneDomainListNode(rule.domains),
                separator: {
                    type: 'Value',
                    value: convertedSeparator,
                },
                body: {
                    type: rule.body.type,
                    children: [scriptlet],
                },
            };
            if (rule.modifiers) {
                res.modifiers = cloneModifierListNode(rule.modifiers);
            }
            return res;
        }), true);
    }
    static convertToUbo(rule) {
        if (rule.syntax === AdblockSyntax.Ubo) {
            return createNodeConversionResult([rule], false);
        }
        const separator = rule.separator.value;
        let convertedSeparator = separator;
        convertedSeparator = rule.exception
            ? CosmeticRuleSeparator.ElementHidingException
            : CosmeticRuleSeparator.ElementHiding;
        const convertedScriptlets = [];
        for (const scriptlet of rule.body.children) {
            const scriptletClone = cloneScriptletRuleNode(scriptlet);
            const scriptletName = QuoteUtils.setStringQuoteType(getScriptletName(scriptletClone), QuoteType.None);
            let uboScriptletName;
            if (rule.syntax === AdblockSyntax.Adg && scriptletName.startsWith(UBO_SCRIPTLET_PREFIX)) {
                uboScriptletName = scriptletName.slice(UBO_SCRIPTLET_PREFIX_LENGTH);
            }
            else {
                const uboScriptlet = scriptletsCompatibilityTable.getFirst(scriptletName, GenericPlatform.UboAny);
                uboScriptletName = uboScriptlet?.name ?? scriptletName;
            }
            if (uboScriptletName.endsWith(UBO_SCRIPTLET_JS_SUFFIX)) {
                uboScriptletName = uboScriptletName.slice(0, -UBO_SCRIPTLET_JS_SUFFIX_LENGTH);
            }
            setScriptletName(scriptletClone, uboScriptletName);
            setScriptletQuoteType(scriptletClone, QuoteType.None);
            transformAllScriptletArguments(scriptletClone, (value) => {
                if (!isNull(value)) {
                    return QuoteUtils.escapeUnescapedOccurrences(value, COMMA_SEPARATOR$1);
                }
                return value;
            });
            if (rule.syntax === AdblockSyntax.Abp) {
                transformAllScriptletArguments(scriptletClone, (value) => {
                    if (!isNull(value)) {
                        return QuoteUtils.unescapeSingleEscapedOccurrences(value, SPACE$1);
                    }
                    return value;
                });
            }
            switch (scriptletName) {
                case ADG_SET_CONSTANT_NAME:
                    transformNthScriptletArgument(scriptletClone, 2, (value) => {
                        if (!isNull(value)) {
                            return setConstantAdgToUboMap[value] ?? value;
                        }
                        return value;
                    });
                    break;
                case ADG_PREVENT_FETCH_NAME:
                    transformNthScriptletArgument(scriptletClone, 1, (value) => {
                        if (value === ADG_PREVENT_FETCH_EMPTY_STRING || value === ADG_PREVENT_FETCH_WILDCARD) {
                            return UBO_NO_FETCH_IF_WILDCARD;
                        }
                        return value;
                    });
                    break;
            }
            convertedScriptlets.push(scriptletClone);
        }
        if (rule.body.children.length === 0) {
            const convertedScriptletNode = {
                category: rule.category,
                type: rule.type,
                syntax: AdblockSyntax.Ubo,
                exception: rule.exception,
                domains: cloneDomainListNode(rule.domains),
                separator: {
                    type: 'Value',
                    value: convertedSeparator,
                },
                body: {
                    type: rule.body.type,
                    children: [],
                },
            };
            if (rule.modifiers) {
                convertedScriptletNode.modifiers = cloneModifierListNode(rule.modifiers);
            }
            return createNodeConversionResult([convertedScriptletNode], true);
        }
        return createNodeConversionResult(convertedScriptlets.map((scriptlet) => {
            const res = {
                category: rule.category,
                type: rule.type,
                syntax: AdblockSyntax.Ubo,
                exception: rule.exception,
                domains: cloneDomainListNode(rule.domains),
                separator: {
                    type: 'Value',
                    value: convertedSeparator,
                },
                body: {
                    type: rule.body.type,
                    children: [scriptlet],
                },
            };
            if (rule.modifiers) {
                res.modifiers = cloneModifierListNode(rule.modifiers);
            }
            return res;
        }), true);
    }
}
function createModifierNode(name, value = undefined, exception = false) {
    const result = {
        type: 'Modifier',
        exception,
        name: {
            type: 'Value',
            value: name,
        },
    };
    if (!isUndefined(value)) {
        result.value = {
            type: 'Value',
            value,
        };
    }
    return result;
}
function createModifierListNode(modifiers = []) {
    const result = {
        type: 'ModifierList',
        children: modifiers.length ? clone(modifiers) : [],
    };
    return result;
}
class MultiValueMap extends Map {
    add(key, ...values) {
        let currentValues = super.get(key);
        if (isUndefined(currentValues)) {
            currentValues = [];
            super.set(key, values);
        }
        currentValues.push(...values);
    }
}
const UBO_MATCHES_PATH_OPERATOR = 'matches-path';
const ADG_PATH_MODIFIER = 'path';
const SPECIAL_MODIFIER_REGEX_CHARS = new Set([
    OPEN_SQUARE_BRACKET,
    CLOSE_SQUARE_BRACKET,
    COMMA,
    ESCAPE_CHARACTER,
]);
class AdgCosmeticRuleModifierConverter {
    static convertFromUbo(modifierList) {
        const conversionMap = new MultiValueMap();
        modifierList.children.forEach((modifier, index) => {
            if (modifier.name.value === UBO_MATCHES_PATH_OPERATOR) {
                if (!modifier.value) {
                    throw new RuleConversionError(`'${UBO_MATCHES_PATH_OPERATOR}' operator requires a value`);
                }
                const value = RegExpUtils.isRegexPattern(modifier.value.value)
                    ? StringUtils.escapeCharacters(modifier.value.value, SPECIAL_MODIFIER_REGEX_CHARS)
                    : modifier.value.value;
                conversionMap.add(index, createModifierNode(ADG_PATH_MODIFIER,
                modifier.exception
                    ? `${REGEX_MARKER}${RegExpUtils.negateRegexPattern(RegExpUtils.patternToRegexp(value))}${REGEX_MARKER}`
                    : value));
            }
        });
        if (conversionMap.size) {
            const modifierListClone = clone(modifierList);
            modifierListClone.children = modifierListClone.children.map((modifier, index) => {
                const convertedModifier = conversionMap.get(index);
                return convertedModifier ?? modifier;
            }).flat();
            return createConversionResult(modifierListClone, true);
        }
        return createConversionResult(modifierList, false);
    }
}
const ERROR_MESSAGES$1 = {
    INVALID_ATTRIBUTE_VALUE: `Expected '${getFormattedTokenName(TokenType$1.Ident)}' or '${getFormattedTokenName(TokenType$1.String)}' as attribute value, but got '%s' with value '%s`,
};
var PseudoClasses;
(function (PseudoClasses) {
    PseudoClasses["AbpContains"] = "-abp-contains";
    PseudoClasses["AbpHas"] = "-abp-has";
    PseudoClasses["Contains"] = "contains";
    PseudoClasses["Has"] = "has";
    PseudoClasses["HasText"] = "has-text";
    PseudoClasses["MatchesCss"] = "matches-css";
    PseudoClasses["MatchesCssAfter"] = "matches-css-after";
    PseudoClasses["MatchesCssBefore"] = "matches-css-before";
    PseudoClasses["Not"] = "not";
})(PseudoClasses || (PseudoClasses = {}));
var PseudoElements;
(function (PseudoElements) {
    PseudoElements["After"] = "after";
    PseudoElements["Before"] = "before";
})(PseudoElements || (PseudoElements = {}));
const PSEUDO_ELEMENT_NAMES = new Set([
    PseudoElements.After,
    PseudoElements.Before,
]);
class CssSelectorConverter extends ConverterBase {
    static convertToAdg(selectorList) {
        const stream = selectorList instanceof CssTokenStream
            ? selectorList
            : new CssTokenStream(selectorList);
        const converted = [];
        const convertAndPushPseudo = (pseudo) => {
            switch (pseudo) {
                case PseudoClasses.AbpContains:
                case PseudoClasses.HasText:
                    converted.push(PseudoClasses.Contains);
                    converted.push(OPEN_PARENTHESIS);
                    break;
                case PseudoClasses.AbpHas:
                    converted.push(PseudoClasses.Has);
                    converted.push(OPEN_PARENTHESIS);
                    break;
                case PseudoClasses.MatchesCssBefore:
                case PseudoClasses.MatchesCssAfter:
                    converted.push(PseudoClasses.MatchesCss);
                    converted.push(OPEN_PARENTHESIS);
                    converted.push(pseudo.substring(PseudoClasses.MatchesCss.length + 1));
                    converted.push(COMMA);
                    break;
                default:
                    converted.push(pseudo);
                    converted.push(OPEN_PARENTHESIS);
                    break;
            }
        };
        while (!stream.isEof()) {
            const token = stream.getOrFail();
            if (token.type === TokenType$1.Colon) {
                stream.advance();
                converted.push(COLON);
                const tempToken = stream.getOrFail();
                if (tempToken.type === TokenType$1.Colon) {
                    stream.advance();
                    converted.push(COLON);
                    continue;
                }
                if (tempToken.type === TokenType$1.Ident) {
                    const name = stream.source.slice(tempToken.start, tempToken.end);
                    if (PSEUDO_ELEMENT_NAMES.has(name)) {
                        converted.push(COLON);
                        converted.push(name);
                    }
                    else {
                        converted.push(name);
                    }
                    stream.advance();
                }
                else if (tempToken.type === TokenType$1.Function) {
                    const name = stream.source.slice(tempToken.start, tempToken.end - 1);
                    convertAndPushPseudo(name);
                    stream.advance();
                }
            }
            else if (token.type === TokenType$1.OpenSquareBracket) {
                let tempToken;
                const { start } = token;
                stream.advance();
                stream.skipWhitespace();
                stream.expect(TokenType$1.Ident);
                tempToken = stream.getOrFail();
                let attr = stream.source.slice(tempToken.start, tempToken.end);
                if (!(attr.startsWith(LEGACY_EXT_CSS_ATTRIBUTE_PREFIX) || attr.startsWith(ABP_EXT_CSS_PREFIX))) {
                    converted.push(stream.source.slice(start, tempToken.end));
                    stream.advance();
                    continue;
                }
                if (attr.startsWith(LEGACY_EXT_CSS_ATTRIBUTE_PREFIX)) {
                    attr = attr.slice(LEGACY_EXT_CSS_ATTRIBUTE_PREFIX.length);
                }
                stream.advance();
                stream.skipWhitespace();
                stream.expect(TokenType$1.Delim, { value: EQUALS });
                stream.advance();
                stream.skipWhitespace();
                tempToken = stream.getOrFail();
                if (tempToken.type !== TokenType$1.Ident && tempToken.type !== TokenType$1.String) {
                    throw new Error(sprintf.sprintf(ERROR_MESSAGES$1.INVALID_ATTRIBUTE_VALUE, getFormattedTokenName(tempToken.type), stream.source.slice(tempToken.start, tempToken.end)));
                }
                const value = stream.source.slice(tempToken.start, tempToken.end);
                stream.advance();
                stream.skipWhitespace();
                stream.expect(TokenType$1.CloseSquareBracket);
                stream.advance();
                converted.push(COLON);
                convertAndPushPseudo(attr);
                let processedValue = value.slice(1, -1);
                if (attr === PseudoClasses.Has) {
                    processedValue = CssSelectorConverter.convertToAdg(processedValue).result;
                }
                converted.push(processedValue);
                converted.push(CLOSE_PARENTHESIS);
            }
            else {
                converted.push(stream.source.slice(token.start, token.end));
                stream.advance();
            }
        }
        const convertedSelectorList = converted.join(EMPTY);
        return createConversionResult(convertedSelectorList, stream.source !== convertedSelectorList);
    }
}
class CssInjectionRuleConverter extends RuleConverterBase {
    static convertToAdg(rule) {
        const separator = rule.separator.value;
        let convertedSeparator = separator;
        const stream = new CssTokenStream(rule.body.selectorList.value);
        const convertedSelectorList = CssSelectorConverter.convertToAdg(stream);
        if (stream.hasAnySelectorExtendedCssNodeStrict() || rule.body.remove) {
            convertedSeparator = rule.exception
                ? CosmeticRuleSeparator.AdgExtendedCssInjectionException
                : CosmeticRuleSeparator.AdgExtendedCssInjection;
        }
        else if (rule.syntax !== AdblockSyntax.Adg) {
            convertedSeparator = rule.exception
                ? CosmeticRuleSeparator.AdgCssInjectionException
                : CosmeticRuleSeparator.AdgCssInjection;
        }
        if (!(rule.syntax === AdblockSyntax.Common || rule.syntax === AdblockSyntax.Adg)
            || separator !== convertedSeparator
            || convertedSelectorList.isConverted) {
            const ruleClone = clone(rule);
            ruleClone.syntax = AdblockSyntax.Adg;
            ruleClone.separator.value = convertedSeparator;
            ruleClone.body.selectorList.value = convertedSelectorList.result;
            return createNodeConversionResult([ruleClone], true);
        }
        return createNodeConversionResult([rule], false);
    }
}
class ElementHidingRuleConverter extends RuleConverterBase {
    static convertToAdg(rule) {
        const separator = rule.separator.value;
        let convertedSeparator = separator;
        const stream = new CssTokenStream(rule.body.selectorList.value);
        const convertedSelectorList = CssSelectorConverter.convertToAdg(stream);
        if (stream.hasAnySelectorExtendedCssNodeStrict()) {
            convertedSeparator = rule.exception
                ? CosmeticRuleSeparator.ExtendedElementHidingException
                : CosmeticRuleSeparator.ExtendedElementHiding;
        }
        if (!(rule.syntax === AdblockSyntax.Common || rule.syntax === AdblockSyntax.Adg)
            || separator !== convertedSeparator
            || convertedSelectorList.isConverted) {
            const ruleClone = clone(rule);
            ruleClone.syntax = AdblockSyntax.Adg;
            ruleClone.separator.value = convertedSeparator;
            ruleClone.body.selectorList.value = convertedSelectorList.result;
            return createNodeConversionResult([ruleClone], true);
        }
        return createNodeConversionResult([rule], false);
    }
}
function createNetworkRuleNode(pattern, modifiers = undefined, exception = false, syntax = AdblockSyntax.Common) {
    const result = {
        category: RuleCategory.Network,
        type: NetworkRuleType.NetworkRule,
        syntax,
        exception,
        pattern: {
            type: 'Value',
            value: pattern,
        },
    };
    if (!isUndefined(modifiers)) {
        result.modifiers = clone(modifiers);
    }
    return result;
}
const UBO_RESPONSEHEADER_FN = 'responseheader';
const ADG_REMOVEHEADER_MODIFIER = 'removeheader';
const ERROR_MESSAGES = {
    EMPTY_PARAMETER: `Empty parameter for '${UBO_RESPONSEHEADER_FN}' function`,
    EXPECTED_END_OF_RULE: "Expected end of rule, but got '%s'",
    MULTIPLE_DOMAINS_NOT_SUPPORTED: 'Multiple domains are not supported yet',
};
class HeaderRemovalRuleConverter extends RuleConverterBase {
    static convertToAdg(rule) {
        if (rule.category !== RuleCategory.Cosmetic || rule.type !== CosmeticRuleType.HtmlFilteringRule) {
            return createNodeConversionResult([rule], false);
        }
        const stream = new CssTokenStream(rule.body.value);
        let token;
        stream.skipWhitespace();
        token = stream.get();
        if (!token || token.type !== TokenType$1.Delim || rule.body.value[token.start] !== UBO_HTML_MASK) {
            return createNodeConversionResult([rule], false);
        }
        stream.advance();
        token = stream.get();
        if (!token) {
            return createNodeConversionResult([rule], false);
        }
        const functionName = rule.body.value.slice(token.start, token.end - 1);
        if (functionName !== UBO_RESPONSEHEADER_FN) {
            return createNodeConversionResult([rule], false);
        }
        const paramStart = token.end;
        stream.skipUntilBalanced();
        const paramEnd = stream.getOrFail().end;
        const param = rule.body.value.slice(paramStart, paramEnd - 1).trim();
        if (param.length === 0) {
            throw new RuleConversionError(ERROR_MESSAGES.EMPTY_PARAMETER);
        }
        stream.expect(TokenType$1.CloseParenthesis);
        stream.advance();
        stream.skipWhitespace();
        if (!stream.isEof()) {
            token = stream.getOrFail();
            throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES.EXPECTED_END_OF_RULE, getFormattedTokenName(token.type)));
        }
        const pattern = [];
        if (rule.domains.children.length === 1) {
            pattern.push(ADBLOCK_URL_START, rule.domains.children[0].value, ADBLOCK_URL_SEPARATOR);
        }
        else if (rule.domains.children.length > 1) {
            throw new RuleConversionError(ERROR_MESSAGES.MULTIPLE_DOMAINS_NOT_SUPPORTED);
        }
        const modifiers = createModifierListNode();
        modifiers.children.push(createModifierNode(ADG_REMOVEHEADER_MODIFIER, param));
        return createNodeConversionResult([
            createNetworkRuleNode(pattern.join(EMPTY), modifiers,
            rule.exception, AdblockSyntax.Adg),
        ], true);
    }
}
class CosmeticRuleConverter extends RuleConverterBase {
    static convertToAdg(rule) {
        let subconverterResult;
        switch (rule.type) {
            case CosmeticRuleType.ElementHidingRule:
                subconverterResult = ElementHidingRuleConverter.convertToAdg(rule);
                break;
            case CosmeticRuleType.ScriptletInjectionRule:
                subconverterResult = ScriptletRuleConverter.convertToAdg(rule);
                break;
            case CosmeticRuleType.CssInjectionRule:
                subconverterResult = CssInjectionRuleConverter.convertToAdg(rule);
                break;
            case CosmeticRuleType.HtmlFilteringRule:
                subconverterResult = HeaderRemovalRuleConverter.convertToAdg(rule);
                if (subconverterResult.isConverted) {
                    break;
                }
                subconverterResult = HtmlRuleConverter.convertToAdg(rule);
                break;
            case CosmeticRuleType.JsInjectionRule:
                subconverterResult = createNodeConversionResult([rule], false);
                break;
            default:
                throw new RuleConversionError('Unsupported cosmetic rule type');
        }
        let convertedModifiers;
        if (rule.modifiers) {
            if (rule.syntax === AdblockSyntax.Ubo) {
                if (rule.type === CosmeticRuleType.ScriptletInjectionRule) {
                    throw new RuleConversionError('uBO scriptlet injection rules don\'t support cosmetic rule modifiers');
                }
                convertedModifiers = AdgCosmeticRuleModifierConverter.convertFromUbo(rule.modifiers);
            }
            else if (rule.syntax === AdblockSyntax.Abp) {
                throw new RuleConversionError('ABP don\'t support cosmetic rule modifiers');
            }
        }
        if ((subconverterResult.result.length > 1 || subconverterResult.isConverted)
            || (convertedModifiers && convertedModifiers.isConverted)) {
            subconverterResult.result.forEach((subconverterRule) => {
                if (convertedModifiers && subconverterRule.category === RuleCategory.Cosmetic) {
                    subconverterRule.modifiers = convertedModifiers.result;
                }
            });
            return subconverterResult;
        }
        return createNodeConversionResult([rule], false);
    }
    static convertToUbo(rule) {
        if (rule.type === CosmeticRuleType.ScriptletInjectionRule) {
            if (rule.syntax === AdblockSyntax.Adg && rule.modifiers?.children.length) {
                throw new RuleConversionError('uBO scriptlet injection rules do not support cosmetic rule modifiers');
            }
            return ScriptletRuleConverter.convertToUbo(rule);
        }
        return createNodeConversionResult([rule], false);
    }
}
const CSP_MODIFIER = 'csp';
const CSP_SEPARATOR = SEMICOLON + SPACE$1;
const COMMON_CSP_PARAMS = '\'self\' \'unsafe-eval\' http: https: data: blob: mediastream: filesystem:';
const ABP_REWRITE_MODIFIER = 'rewrite';
const REDIRECT_MODIFIER = 'redirect';
const REDIRECT_RULE_MODIFIER = 'redirect-rule';
const UBO_NOOP_TEXT_RESOURCE = 'noop.txt';
const REDIRECT_MODIFIERS = new Set([
    ABP_REWRITE_MODIFIER,
    REDIRECT_MODIFIER,
    REDIRECT_RULE_MODIFIER,
]);
const ADG_CONVERSION_MAP = new Map([
    ['1p', [{ name: () => 'third-party', exception: (actual) => !actual }]],
    ['3p', [{ name: () => 'third-party' }]],
    ['css', [{ name: () => 'stylesheet' }]],
    ['doc', [{ name: () => 'document' }]],
    ['ehide', [{ name: () => 'elemhide' }]],
    ['empty', [{ name: () => 'redirect', value: () => 'nooptext' }]],
    ['first-party', [{ name: () => 'third-party', exception: (actual) => !actual }]],
    ['frame', [{ name: () => 'subdocument' }]],
    ['ghide', [{ name: () => 'generichide' }]],
    ['inline-font', [{ name: () => CSP_MODIFIER, value: () => `font-src ${COMMON_CSP_PARAMS}` }]],
    ['inline-script', [{ name: () => CSP_MODIFIER, value: () => `script-src ${COMMON_CSP_PARAMS}` }]],
    ['mp4', [{ name: () => 'redirect', value: () => 'noopmp4-1s' }, { name: () => 'media', value: () => undefined }]],
    ['queryprune', [{ name: () => 'removeparam' }]],
    ['shide', [{ name: () => 'specifichide' }]],
    ['xhr', [{ name: () => 'xmlhttprequest' }]],
]);
class NetworkRuleModifierListConverter extends ConverterBase {
    static convertToAdg(modifierList, isException = false) {
        const conversionMap = new MultiValueMap();
        let cspCount = 0;
        modifierList.children.forEach((modifierNode, index) => {
            const modifierConversions = ADG_CONVERSION_MAP.get(modifierNode.name.value);
            if (modifierConversions) {
                for (const modifierConversion of modifierConversions) {
                    const name = modifierConversion.name(modifierNode.name.value);
                    const exception = modifierConversion.exception
                        ? modifierConversion.exception(modifierNode.exception || false)
                        : modifierNode.exception;
                    const value = modifierConversion.value
                        ? modifierConversion.value(modifierNode.value?.value)
                        : modifierNode.value?.value;
                    if (name !== modifierNode.name.value || value !== modifierNode.value?.value) {
                        conversionMap.add(index, createModifierNode(name, value, exception));
                    }
                    if (name === CSP_MODIFIER) {
                        cspCount += 1;
                    }
                }
                return;
            }
            if (REDIRECT_MODIFIERS.has(modifierNode.name.value)) {
                if (modifierNode.exception === true) {
                    throw new RuleConversionError(`Modifier '${modifierNode.name.value}' cannot be negated`);
                }
                const redirectResource = modifierNode.value?.value;
                if (!redirectResource && !isException) {
                    throw new RuleConversionError(`No redirect resource specified for '${modifierNode.name.value}' modifier`);
                }
                const modifierName = modifierNode.name.value === ABP_REWRITE_MODIFIER
                    ? REDIRECT_MODIFIER
                    : modifierNode.name.value;
                const convertedRedirectResource = redirectResource
                    ? redirectsCompatibilityTable.getFirst(redirectResource, GenericPlatform.AdgAny)?.name
                    : undefined;
                if (modifierName !== modifierNode.name.value
                    || (convertedRedirectResource !== undefined && convertedRedirectResource !== redirectResource)) {
                    conversionMap.add(index, createModifierNode(modifierName,
                    convertedRedirectResource || redirectResource, modifierNode.exception));
                }
            }
        });
        if (conversionMap.size || cspCount) {
            const modifierListClone = cloneModifierListNode(modifierList);
            modifierListClone.children = modifierListClone.children.map((modifierNode, index) => {
                const conversionRecord = conversionMap.get(index);
                if (conversionRecord) {
                    return conversionRecord;
                }
                return modifierNode;
            }).flat();
            if (cspCount) {
                const cspValues = [];
                modifierListClone.children = modifierListClone.children.filter((modifierNode) => {
                    if (modifierNode.name.value === CSP_MODIFIER) {
                        if (!modifierNode.value?.value) {
                            throw new RuleConversionError('$csp modifier value is missing');
                        }
                        cspValues.push(modifierNode.value?.value);
                        return false;
                    }
                    return true;
                });
                modifierListClone.children.push(createModifierNode(CSP_MODIFIER, cspValues.join(CSP_SEPARATOR)));
            }
            modifierListClone.children = modifierListClone.children.filter((modifierNode, index, self) => self.findIndex((m) => m.name.value === modifierNode.name.value
                && m.exception === modifierNode.exception
                && m.value?.value === modifierNode.value?.value) === index);
            return createConversionResult(modifierListClone, true);
        }
        return createConversionResult(modifierList, false);
    }
    static convertToUbo(modifierList, isException = false) {
        const conversionMap = new MultiValueMap();
        const resourceTypeModifiersToAdd = new Set();
        modifierList.children.forEach((modifierNode, index) => {
            const originalModifierName = modifierNode.name.value;
            const modifierData = modifiersCompatibilityTable.getFirst(originalModifierName, GenericPlatform.UboAny);
            if (REDIRECT_MODIFIERS.has(originalModifierName)) {
                if (modifierNode.exception === true) {
                    throw new RuleConversionError(`Modifier '${modifierNode.name.value}' cannot be negated`);
                }
                const redirectResourceName = modifierNode.value?.value;
                if (!redirectResourceName && !isException) {
                    throw new RuleConversionError(`No redirect resource specified for '${modifierNode.name.value}' modifier`);
                }
                if (!redirectResourceName) {
                    return;
                }
                const modifierName = modifierNode.name.value === ABP_REWRITE_MODIFIER
                    ? REDIRECT_MODIFIER
                    : modifierNode.name.value;
                const convertedRedirectResourceData = redirectsCompatibilityTable.getFirst(redirectResourceName, GenericPlatform.UboAny);
                const convertedRedirectResourceName = convertedRedirectResourceData?.name ?? redirectResourceName;
                if (convertedRedirectResourceData?.resourceTypes?.length) {
                    const uboResourceTypeModifiers = redirectsCompatibilityTable.getResourceTypeModifiers(convertedRedirectResourceData, GenericPlatform.UboAny);
                    const isNoopTextResource = convertedRedirectResourceName === UBO_NOOP_TEXT_RESOURCE;
                    const hasValidResourceType = modifierList.children.some((modifier) => {
                        const name = modifier.name.value;
                        if (!isValidResourceType(name)) {
                            return false;
                        }
                        const convertedModifierData = modifiersCompatibilityTable.getFirst(name, GenericPlatform.UboAny);
                        return uboResourceTypeModifiers.has(convertedModifierData?.name ?? name);
                    });
                    if (!isNoopTextResource || !hasValidResourceType) {
                        uboResourceTypeModifiers.forEach((resourceType) => {
                            resourceTypeModifiersToAdd.add(resourceType);
                        });
                    }
                }
                if (modifierName !== originalModifierName
                    || (!isUndefined(convertedRedirectResourceName)
                        && convertedRedirectResourceName !== redirectResourceName)) {
                    conversionMap.add(index, createModifierNode(modifierName,
                    convertedRedirectResourceName || redirectResourceName, modifierNode.exception));
                }
                return;
            }
            if (modifierData && modifierData.name !== originalModifierName) {
                conversionMap.add(index, createModifierNode(modifierData.name, modifierNode.value?.value, modifierNode.exception));
            }
        });
        if (conversionMap.size || resourceTypeModifiersToAdd.size) {
            const modifierListClone = cloneModifierListNode(modifierList);
            modifierListClone.children = modifierListClone.children.map((modifierNode, index) => {
                const conversionRecord = conversionMap.get(index);
                if (conversionRecord) {
                    return conversionRecord;
                }
                return modifierNode;
            }).flat();
            modifierListClone.children = modifierListClone.children.filter((modifierNode, index, self) => self.findIndex((m) => m.name.value === modifierNode.name.value
                && m.exception === modifierNode.exception
                && m.value?.value === modifierNode.value?.value) === index);
            if (resourceTypeModifiersToAdd.size) {
                const modifierNameSet = new Set(modifierList.children.map((m) => m.name.value));
                resourceTypeModifiersToAdd.forEach((resourceType) => {
                    if (!modifierNameSet.has(resourceType)) {
                        modifierListClone.children.push(createModifierNode(resourceType));
                    }
                });
            }
            return createConversionResult(modifierListClone, true);
        }
        return createConversionResult(modifierList, false);
    }
}
class NetworkRuleConverter extends RuleConverterBase {
    static convertToAdg(rule) {
        if (rule.type !== NetworkRuleType.NetworkRule) {
            throw new Error(`Invalid rule type: ${rule.type}`);
        }
        if (rule.modifiers) {
            const modifiers = NetworkRuleModifierListConverter.convertToAdg(rule.modifiers, rule.exception);
            if (modifiers.isConverted) {
                return {
                    result: [{
                            category: RuleCategory.Network,
                            type: NetworkRuleType.NetworkRule,
                            syntax: rule.syntax,
                            exception: rule.exception,
                            pattern: {
                                type: 'Value',
                                value: rule.pattern.value,
                            },
                            modifiers: modifiers.result,
                        }],
                    isConverted: true,
                };
            }
        }
        return createNodeConversionResult([rule], false);
    }
    static convertToUbo(rule) {
        if (rule.type !== NetworkRuleType.NetworkRule) {
            throw new Error(`Invalid rule type: ${rule.type}`);
        }
        if (rule.modifiers) {
            const modifiers = NetworkRuleModifierListConverter.convertToUbo(rule.modifiers, rule.exception);
            if (modifiers.isConverted) {
                return {
                    result: [{
                            category: RuleCategory.Network,
                            type: NetworkRuleType.NetworkRule,
                            syntax: rule.syntax,
                            exception: rule.exception,
                            pattern: {
                                type: 'Value',
                                value: rule.pattern.value,
                            },
                            modifiers: modifiers.result,
                        }],
                    isConverted: true,
                };
            }
        }
        return createNodeConversionResult([rule], false);
    }
}
class RuleConverter extends RuleConverterBase {
    static convertToAdg(rule) {
        switch (rule.category) {
            case RuleCategory.Comment:
                return CommentRuleConverter.convertToAdg(rule);
            case RuleCategory.Cosmetic:
                return CosmeticRuleConverter.convertToAdg(rule);
            case RuleCategory.Network:
                if (rule.type === NetworkRuleType.HostRule) {
                    return createConversionResult([rule], false);
                }
                return NetworkRuleConverter.convertToAdg(rule);
            case RuleCategory.Invalid:
            case RuleCategory.Empty:
                return createConversionResult([rule], false);
            default:
                throw new RuleConversionError('Unknown rule category');
        }
    }
    static convertToUbo(rule) {
        if (rule.category === RuleCategory.Cosmetic) {
            return CosmeticRuleConverter.convertToUbo(rule);
        }
        if (rule.category === RuleCategory.Network) {
            return NetworkRuleConverter.convertToUbo(rule);
        }
        return createConversionResult([rule], false);
    }
}
const BINARY_SCHEMA_VERSION = 1;
class ByteBuffer {
    static CHUNK_SIZE = 32768;
    chunks;
    chunksLength;
    constructor(chunks, cloneChunks = false) {
        const chunksToUse = chunks ?? [];
        this.chunks = cloneChunks ? chunksToUse.map((chunk) => new Uint8Array(chunk)) : chunksToUse;
        this.chunksLength = chunks?.length ?? 0;
    }
    ensureCapacity(position) {
        const requiredChunkIndex = position >>> 0x000F;
        for (let i = this.chunksLength; i <= requiredChunkIndex; i += 1) {
            this.chunks.push(new Uint8Array(ByteBuffer.CHUNK_SIZE));
            this.chunksLength += 1;
        }
    }
    writeByte(position, value) {
        const chunkIndex = position >>> 0x000F;
        const chunkOffset = position & 0x7FFF;
        if (chunkIndex >= this.chunksLength) {
            this.ensureCapacity(position);
        }
        this.chunks[chunkIndex][chunkOffset] = value;
    }
    readByte(position) {
        const chunkIndex = position >>> 0x000F;
        const chunkOffset = position & 0x7FFF;
        if (chunkIndex >= this.chunksLength) {
            return undefined;
        }
        return this.chunks[chunkIndex][chunkOffset];
    }
}
const isChromium = () => {
    return typeof window !== 'undefined'
        && (Object.prototype.hasOwnProperty.call(window, 'chrome')
            || (typeof window.navigator !== 'undefined'
                && /chrome/i.test(window.navigator.userAgent)));
};
const REPLACEMENT_CHAR = String.fromCodePoint(0xFFFD);
const decodeTextPolyfill = (buffer, start = 0, end = -1) => {
    let codePoint = 0;
    let bytesSeen = 0;
    let bytesNeeded = 0;
    let lowerBoundary = 0x0080;
    let upperBoundary = 0x00BF;
    let i = start;
    const { length } = buffer;
    const realEnd = end === -1 ? length : Math.min(end, length);
    const result = new Array(realEnd - start);
    let resIdx = 0;
    for (; i < realEnd; i += 1) {
        const byte = buffer[i];
        if (bytesNeeded === 0) {
            if (byte <= 0x007F) {
                codePoint = byte & 0x00FF;
            }
            else if (byte >= 0x00C2 && byte <= 0x00DF) {
                bytesNeeded = 1;
                codePoint = byte & 0x001F;
            }
            else if (byte >= 0x00E0 && byte <= 0x00EF) {
                bytesNeeded = 2;
                codePoint = byte & 0x000F;
                if (byte === 0x00E0) {
                    lowerBoundary = 0x00A0;
                }
                else if (byte === 0x00ED) {
                    upperBoundary = 0x009F;
                }
            }
            else if (byte >= 0x00F0 && byte <= 0x00F4) {
                bytesNeeded = 3;
                codePoint = byte & 0x0007;
                if (byte === 0x00F0) {
                    lowerBoundary = 0x0090;
                }
                else if (byte === 0x00F4) {
                    upperBoundary = 0x008F;
                }
            }
            else {
                result[resIdx++] = REPLACEMENT_CHAR;
                continue;
            }
        }
        else {
            if (!(byte >= lowerBoundary && byte <= upperBoundary)) {
                bytesNeeded = 0;
                bytesSeen = 0;
                lowerBoundary = 0x0080;
                upperBoundary = 0x00BF;
                result[resIdx++] = REPLACEMENT_CHAR;
                i -= 1;
                continue;
            }
            codePoint = (codePoint << 6) | (byte & 0x003F);
            lowerBoundary = 0x0080;
            upperBoundary = 0x00BF;
            bytesSeen += 1;
        }
        if (bytesSeen === bytesNeeded) {
            result[resIdx++] = String.fromCodePoint(codePoint);
            bytesNeeded = 0;
            bytesSeen = 0;
            codePoint = 0;
        }
    }
    return result.join(EMPTY);
};
class InputByteBuffer extends ByteBuffer {
    offset;
    sharedNativeDecoder;
    isChromium;
    constructor(chunks, cloneChunks = false, initialOffset = 0) {
        super(chunks, cloneChunks);
        if (chunks.length === 0) {
            throw new Error('No data in the buffer');
        }
        const actualVersion = this.readSchemaVersion();
        if (actualVersion !== BINARY_SCHEMA_VERSION) {
            throw new BinarySchemaMismatchError(BINARY_SCHEMA_VERSION, actualVersion);
        }
        if (initialOffset < 0 || initialOffset > this.chunks.length * ByteBuffer.CHUNK_SIZE) {
            throw new Error(`Invalid offset: ${initialOffset}`);
        }
        this.offset = Math.max(4, initialOffset);
        this.sharedNativeDecoder = new TextDecoder();
        this.isChromium = isChromium();
    }
    static async createFromStorage(storage, key) {
        const chunks = await storage.get(key);
        if (!isArrayOfUint8Arrays(chunks)) {
            throw new Error('The data from storage is not an array of Uint8Arrays');
        }
        return new InputByteBuffer(chunks);
    }
    readUint8() {
        const result = this.readByte(this.offset++) ?? 0;
        return result;
    }
    readUint16() {
        const result = (((this.readByte(this.offset++) ?? 0) << 8)
            | ((this.readByte(this.offset++) ?? 0))) >>> 0;
        return result;
    }
    readUint32FromIndex(index) {
        const result = (((this.readByte(index) ?? 0) << 24)
            | ((this.readByte(index + 1) ?? 0) << 16)
            | ((this.readByte(index + 2) ?? 0) << 8)
            | ((this.readByte(index + 3) ?? 0))) >>> 0;
        return result;
    }
    readUint32() {
        const result = this.readUint32FromIndex(this.offset);
        this.offset += 4;
        return result;
    }
    readSchemaVersion() {
        return this.readUint32FromIndex(0);
    }
    readInt32() {
        const result = this.readUint32();
        return result > 0x7fffffff ? result - 0x100000000 : result;
    }
    readOptimizedUint() {
        let result = 0;
        let shift = 0;
        while (shift <= 28) {
            const byteValue = this.readByte(this.offset++) ?? 0;
            result |= (byteValue & 0x7F) << shift;
            shift += 7;
            if ((byteValue & 0x80) === 0) {
                break;
            }
        }
        return result;
    }
    readString() {
        const length = this.readOptimizedUint();
        let chunkIndex = this.offset >>> 0x000F;
        const chunkOffset = this.offset & 0x7FFF;
        const endOffset = chunkOffset + length;
        if (endOffset < ByteBuffer.CHUNK_SIZE) {
            this.offset += length;
            if (this.isChromium) {
                return decodeTextPolyfill(this.chunks[chunkIndex], chunkOffset, endOffset);
            }
            return this.sharedNativeDecoder.decode(this.chunks[chunkIndex].subarray(chunkOffset, endOffset));
        }
        const result = [];
        result.push(this.sharedNativeDecoder.decode(this.chunks[chunkIndex++].subarray(chunkOffset), { stream: true }));
        let remaining = length - (ByteBuffer.CHUNK_SIZE - chunkOffset);
        while (remaining) {
            const chunk = this.chunks[chunkIndex];
            if (!chunk) {
                break;
            }
            const toRead = Math.min(remaining, ByteBuffer.CHUNK_SIZE);
            result.push(this.sharedNativeDecoder.decode(chunk.subarray(0, toRead), { stream: true }));
            remaining -= toRead;
            chunkIndex += 1;
        }
        result.push(this.sharedNativeDecoder.decode());
        this.offset += length;
        return result.join('');
    }
    peekUint8() {
        return this.readByte(this.offset) ?? 0;
    }
    assertUint8(value) {
        const result = this.readUint8();
        if (result !== value) {
            throw new Error(`Expected ${value}, but got ${result}`);
        }
    }
    createCopyWithOffset(initialOffset, cloneChunks = false) {
        return new InputByteBuffer(this.chunks, cloneChunks, initialOffset);
    }
    get currentOffset() {
        return this.offset;
    }
    get capacity() {
        return this.chunks.length * ByteBuffer.CHUNK_SIZE;
    }
}

var scriptlets_umd = {exports: {}};

(function (factory) {
    factory();
})((function () {
    function attachDependencies(scriptlet) {
      var _scriptlet$injections = scriptlet.injections,
        injections = _scriptlet$injections === void 0 ? [] : _scriptlet$injections;
      return injections.reduce(function (accum, dep) {
        return "".concat(accum, "\n").concat(dep.toString());
      }, scriptlet.toString());
    }
    function addCall(scriptlet, code) {
      return "\n    const flag = 'done';\n    const uniqueIdentifier = source.uniqueId + source.name + '_' + (Array.isArray(args) ? args.join('_') : '');\n    // Check if the scriptlet has already been executed using the unique identifier\n    if (source.uniqueId) {\n        if (Window.prototype.toString[uniqueIdentifier] === flag) { return; }\n    }\n    ".concat(code, "\n    const updatedArgs = args ? [].concat(source).concat(args) : [source];\n    try {\n        ").concat(scriptlet.name, ".apply(this, updatedArgs);\n        if (source.uniqueId) {\n            Object.defineProperty(Window.prototype.toString, uniqueIdentifier, {\n                value: flag,\n                enumerable: false,\n                writable: false,\n                configurable: false\n            });\n        }\n    } catch (e) {\n        console.log(e);\n    }");
    }
    function passSourceAndProps(source, code) {
      var redirect = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
      var sourceString = JSON.stringify(source);
      var argsString = source.args ? "[".concat(source.args.map(function (arg) {
        return JSON.stringify(arg);
      }), "]") : undefined;
      var params = argsString ? "".concat(sourceString, ", ").concat(argsString) : sourceString;
      if (redirect) {
        return "(function(source, args){\n".concat(code, "\n})(").concat(params, ");");
      }
      return "(".concat(code, ")(").concat(params, ");");
    }
    function wrapInNonameFunc(code) {
      return "function(source, args){\n".concat(code, "\n}");
    }
    function _arrayWithHoles(arr) {
      if (Array.isArray(arr)) return arr;
    }
    function _iterableToArrayLimit(arr, i) {
      var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
      if (null != _i) {
        var _s,
          _e,
          _x,
          _r,
          _arr = [],
          _n = !0,
          _d = !1;
        try {
          if (_x = (_i = _i.call(arr)).next, 0 === i) {
            if (Object(_i) !== _i) return;
            _n = !1;
          } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
        } catch (err) {
          _d = !0, _e = err;
        } finally {
          try {
            if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
          } finally {
            if (_d) throw _e;
          }
        }
        return _arr;
      }
    }
    function _arrayLikeToArray$3(arr, len) {
      if (len == null || len > arr.length) len = arr.length;
      for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
      return arr2;
    }
    function _unsupportedIterableToArray$3(o, minLen) {
      if (!o) return;
      if (typeof o === "string") return _arrayLikeToArray$3(o, minLen);
      var n = Object.prototype.toString.call(o).slice(8, -1);
      if (n === "Object" && o.constructor) n = o.constructor.name;
      if (n === "Map" || n === "Set") return Array.from(o);
      if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen);
    }
    function _nonIterableRest() {
      throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }
    function _slicedToArray$1(arr, i) {
      return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$3(arr, i) || _nonIterableRest();
    }
    function getDefaultExportFromCjs$1 (x) {
    	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
    }
    var debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? function () {
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return console.error('SEMVER', ...args);
    } : function () {};
    var debug_1 = debug$1;
    var SEMVER_SPEC_VERSION = '2.0.0';
    var MAX_LENGTH$1 = 256;
    var MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || 9007199254740991;
    var MAX_SAFE_COMPONENT_LENGTH = 16;
    var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
    var RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];
    var constants = {
      MAX_LENGTH: MAX_LENGTH$1,
      MAX_SAFE_COMPONENT_LENGTH,
      MAX_SAFE_BUILD_LENGTH,
      MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
      RELEASE_TYPES,
      SEMVER_SPEC_VERSION,
      FLAG_INCLUDE_PRERELEASE: 1,
      FLAG_LOOSE: 2
    };
    var re$2 = {exports: {}};
    (function (module, exports) {
      var MAX_SAFE_COMPONENT_LENGTH = constants.MAX_SAFE_COMPONENT_LENGTH,
        MAX_SAFE_BUILD_LENGTH = constants.MAX_SAFE_BUILD_LENGTH,
        MAX_LENGTH = constants.MAX_LENGTH;
      var debug = debug_1;
      exports = module.exports = {};
      var re = exports.re = [];
      var safeRe = exports.safeRe = [];
      var src = exports.src = [];
      var t = exports.t = {};
      var R = 0;
      var LETTERDASHNUMBER = '[a-zA-Z0-9-]';
      var safeRegexReplacements = [['\\s', 1], ['\\d', MAX_LENGTH], [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]];
      var makeSafeRegex = function makeSafeRegex(value) {
        for (var _i = 0, _safeRegexReplacement = safeRegexReplacements; _i < _safeRegexReplacement.length; _i++) {
          var _safeRegexReplacement2 = _slicedToArray$1(_safeRegexReplacement[_i], 2),
            token = _safeRegexReplacement2[0],
            max = _safeRegexReplacement2[1];
          value = value.split("".concat(token, "*")).join("".concat(token, "{0,").concat(max, "}")).split("".concat(token, "+")).join("".concat(token, "{1,").concat(max, "}"));
        }
        return value;
      };
      var createToken = function createToken(name, value, isGlobal) {
        var safe = makeSafeRegex(value);
        var index = R++;
        debug(name, index, value);
        t[name] = index;
        src[index] = value;
        re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
        safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
      };
      createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
      createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
      createToken('NONNUMERICIDENTIFIER', "\\d*[a-zA-Z-]".concat(LETTERDASHNUMBER, "*"));
      createToken('MAINVERSION', "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")"));
      createToken('MAINVERSIONLOOSE', "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")"));
      createToken('PRERELEASEIDENTIFIER', "(?:".concat(src[t.NUMERICIDENTIFIER], "|").concat(src[t.NONNUMERICIDENTIFIER], ")"));
      createToken('PRERELEASEIDENTIFIERLOOSE', "(?:".concat(src[t.NUMERICIDENTIFIERLOOSE], "|").concat(src[t.NONNUMERICIDENTIFIER], ")"));
      createToken('PRERELEASE', "(?:-(".concat(src[t.PRERELEASEIDENTIFIER], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIER], ")*))"));
      createToken('PRERELEASELOOSE', "(?:-?(".concat(src[t.PRERELEASEIDENTIFIERLOOSE], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIERLOOSE], ")*))"));
      createToken('BUILDIDENTIFIER', "".concat(LETTERDASHNUMBER, "+"));
      createToken('BUILD', "(?:\\+(".concat(src[t.BUILDIDENTIFIER], "(?:\\.").concat(src[t.BUILDIDENTIFIER], ")*))"));
      createToken('FULLPLAIN', "v?".concat(src[t.MAINVERSION]).concat(src[t.PRERELEASE], "?").concat(src[t.BUILD], "?"));
      createToken('FULL', "^".concat(src[t.FULLPLAIN], "$"));
      createToken('LOOSEPLAIN', "[v=\\s]*".concat(src[t.MAINVERSIONLOOSE]).concat(src[t.PRERELEASELOOSE], "?").concat(src[t.BUILD], "?"));
      createToken('LOOSE', "^".concat(src[t.LOOSEPLAIN], "$"));
      createToken('GTLT', '((?:<|>)?=?)');
      createToken('XRANGEIDENTIFIERLOOSE', "".concat(src[t.NUMERICIDENTIFIERLOOSE], "|x|X|\\*"));
      createToken('XRANGEIDENTIFIER', "".concat(src[t.NUMERICIDENTIFIER], "|x|X|\\*"));
      createToken('XRANGEPLAIN', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:".concat(src[t.PRERELEASE], ")?").concat(src[t.BUILD], "?") + ")?)?");
      createToken('XRANGEPLAINLOOSE', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:".concat(src[t.PRERELEASELOOSE], ")?").concat(src[t.BUILD], "?") + ")?)?");
      createToken('XRANGE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAIN], "$"));
      createToken('XRANGELOOSE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAINLOOSE], "$"));
      createToken('COERCEPLAIN', "".concat('(^|[^\\d])' + '(\\d{1,').concat(MAX_SAFE_COMPONENT_LENGTH, "})") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?"));
      createToken('COERCE', "".concat(src[t.COERCEPLAIN], "(?:$|[^\\d])"));
      createToken('COERCEFULL', src[t.COERCEPLAIN] + "(?:".concat(src[t.PRERELEASE], ")?") + "(?:".concat(src[t.BUILD], ")?") + "(?:$|[^\\d])");
      createToken('COERCERTL', src[t.COERCE], true);
      createToken('COERCERTLFULL', src[t.COERCEFULL], true);
      createToken('LONETILDE', '(?:~>?)');
      createToken('TILDETRIM', "(\\s*)".concat(src[t.LONETILDE], "\\s+"), true);
      exports.tildeTrimReplace = '$1~';
      createToken('TILDE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAIN], "$"));
      createToken('TILDELOOSE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAINLOOSE], "$"));
      createToken('LONECARET', '(?:\\^)');
      createToken('CARETTRIM', "(\\s*)".concat(src[t.LONECARET], "\\s+"), true);
      exports.caretTrimReplace = '$1^';
      createToken('CARET', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAIN], "$"));
      createToken('CARETLOOSE', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAINLOOSE], "$"));
      createToken('COMPARATORLOOSE', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], ")$|^$"));
      createToken('COMPARATOR', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.FULLPLAIN], ")$|^$"));
      createToken('COMPARATORTRIM', "(\\s*)".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], "|").concat(src[t.XRANGEPLAIN], ")"), true);
      exports.comparatorTrimReplace = '$1$2$3';
      createToken('HYPHENRANGE', "^\\s*(".concat(src[t.XRANGEPLAIN], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAIN], ")") + "\\s*$");
      createToken('HYPHENRANGELOOSE', "^\\s*(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s*$");
      createToken('STAR', '(<|>)?=?\\s*\\*');
      createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
      createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
    })(re$2, re$2.exports);
    var reExports = re$2.exports;
    var looseOption = Object.freeze({
      loose: true
    });
    var emptyOpts = Object.freeze({});
    var parseOptions$1 = function parseOptions(options) {
      if (!options) {
        return emptyOpts;
      }
      if (typeof options !== 'object') {
        return looseOption;
      }
      return options;
    };
    var parseOptions_1 = parseOptions$1;
    var numeric = /^[0-9]+$/;
    var compareIdentifiers$1 = function compareIdentifiers(a, b) {
      var anum = numeric.test(a);
      var bnum = numeric.test(b);
      if (anum && bnum) {
        a = +a;
        b = +b;
      }
      return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
    };
    var rcompareIdentifiers = function rcompareIdentifiers(a, b) {
      return compareIdentifiers$1(b, a);
    };
    var identifiers = {
      compareIdentifiers: compareIdentifiers$1,
      rcompareIdentifiers
    };
    var debug = debug_1;
    var MAX_LENGTH = constants.MAX_LENGTH,
      MAX_SAFE_INTEGER = constants.MAX_SAFE_INTEGER;
    var re$1 = reExports.safeRe,
      t$1 = reExports.t;
    var parseOptions = parseOptions_1;
    var compareIdentifiers = identifiers.compareIdentifiers;
    let SemVer$2 = class SemVer {
      constructor(version, options) {
        options = parseOptions(options);
        if (version instanceof SemVer) {
          if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
            return version;
          } else {
            version = version.version;
          }
        } else if (typeof version !== 'string') {
          throw new TypeError("Invalid version. Must be a string. Got type \"".concat(typeof version, "\"."));
        }
        if (version.length > MAX_LENGTH) {
          throw new TypeError("version is longer than ".concat(MAX_LENGTH, " characters"));
        }
        debug('SemVer', version, options);
        this.options = options;
        this.loose = !!options.loose;
        this.includePrerelease = !!options.includePrerelease;
        var m = version.trim().match(options.loose ? re$1[t$1.LOOSE] : re$1[t$1.FULL]);
        if (!m) {
          throw new TypeError("Invalid Version: ".concat(version));
        }
        this.raw = version;
        this.major = +m[1];
        this.minor = +m[2];
        this.patch = +m[3];
        if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
          throw new TypeError('Invalid major version');
        }
        if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
          throw new TypeError('Invalid minor version');
        }
        if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
          throw new TypeError('Invalid patch version');
        }
        if (!m[4]) {
          this.prerelease = [];
        } else {
          this.prerelease = m[4].split('.').map(function (id) {
            if (/^[0-9]+$/.test(id)) {
              var num = +id;
              if (num >= 0 && num < MAX_SAFE_INTEGER) {
                return num;
              }
            }
            return id;
          });
        }
        this.build = m[5] ? m[5].split('.') : [];
        this.format();
      }
      format() {
        this.version = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
        if (this.prerelease.length) {
          this.version += "-".concat(this.prerelease.join('.'));
        }
        return this.version;
      }
      toString() {
        return this.version;
      }
      compare(other) {
        debug('SemVer.compare', this.version, this.options, other);
        if (!(other instanceof SemVer)) {
          if (typeof other === 'string' && other === this.version) {
            return 0;
          }
          other = new SemVer(other, this.options);
        }
        if (other.version === this.version) {
          return 0;
        }
        return this.compareMain(other) || this.comparePre(other);
      }
      compareMain(other) {
        if (!(other instanceof SemVer)) {
          other = new SemVer(other, this.options);
        }
        return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
      }
      comparePre(other) {
        if (!(other instanceof SemVer)) {
          other = new SemVer(other, this.options);
        }
        if (this.prerelease.length && !other.prerelease.length) {
          return -1;
        } else if (!this.prerelease.length && other.prerelease.length) {
          return 1;
        } else if (!this.prerelease.length && !other.prerelease.length) {
          return 0;
        }
        var i = 0;
        do {
          var a = this.prerelease[i];
          var b = other.prerelease[i];
          debug('prerelease compare', i, a, b);
          if (a === undefined && b === undefined) {
            return 0;
          } else if (b === undefined) {
            return 1;
          } else if (a === undefined) {
            return -1;
          } else if (a === b) {
            continue;
          } else {
            return compareIdentifiers(a, b);
          }
        } while (++i);
      }
      compareBuild(other) {
        if (!(other instanceof SemVer)) {
          other = new SemVer(other, this.options);
        }
        var i = 0;
        do {
          var a = this.build[i];
          var b = other.build[i];
          debug('build compare', i, a, b);
          if (a === undefined && b === undefined) {
            return 0;
          } else if (b === undefined) {
            return 1;
          } else if (a === undefined) {
            return -1;
          } else if (a === b) {
            continue;
          } else {
            return compareIdentifiers(a, b);
          }
        } while (++i);
      }
      inc(release, identifier, identifierBase) {
        switch (release) {
          case 'premajor':
            this.prerelease.length = 0;
            this.patch = 0;
            this.minor = 0;
            this.major++;
            this.inc('pre', identifier, identifierBase);
            break;
          case 'preminor':
            this.prerelease.length = 0;
            this.patch = 0;
            this.minor++;
            this.inc('pre', identifier, identifierBase);
            break;
          case 'prepatch':
            this.prerelease.length = 0;
            this.inc('patch', identifier, identifierBase);
            this.inc('pre', identifier, identifierBase);
            break;
          case 'prerelease':
            if (this.prerelease.length === 0) {
              this.inc('patch', identifier, identifierBase);
            }
            this.inc('pre', identifier, identifierBase);
            break;
          case 'major':
            if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
              this.major++;
            }
            this.minor = 0;
            this.patch = 0;
            this.prerelease = [];
            break;
          case 'minor':
            if (this.patch !== 0 || this.prerelease.length === 0) {
              this.minor++;
            }
            this.patch = 0;
            this.prerelease = [];
            break;
          case 'patch':
            if (this.prerelease.length === 0) {
              this.patch++;
            }
            this.prerelease = [];
            break;
          case 'pre':
            {
              var base = Number(identifierBase) ? 1 : 0;
              if (!identifier && identifierBase === false) {
                throw new Error('invalid increment argument: identifier is empty');
              }
              if (this.prerelease.length === 0) {
                this.prerelease = [base];
              } else {
                var i = this.prerelease.length;
                while (--i >= 0) {
                  if (typeof this.prerelease[i] === 'number') {
                    this.prerelease[i]++;
                    i = -2;
                  }
                }
                if (i === -1) {
                  if (identifier === this.prerelease.join('.') && identifierBase === false) {
                    throw new Error('invalid increment argument: identifier already exists');
                  }
                  this.prerelease.push(base);
                }
              }
              if (identifier) {
                var prerelease = [identifier, base];
                if (identifierBase === false) {
                  prerelease = [identifier];
                }
                if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
                  if (isNaN(this.prerelease[1])) {
                    this.prerelease = prerelease;
                  }
                } else {
                  this.prerelease = prerelease;
                }
              }
              break;
            }
          default:
            throw new Error("invalid increment argument: ".concat(release));
        }
        this.raw = this.format();
        if (this.build.length) {
          this.raw += "+".concat(this.build.join('.'));
        }
        return this;
      }
    };
    var semver = SemVer$2;
    var SemVer$1 = semver;
    var parse$4 = function parse(version, options) {
      var throwErrors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
      if (version instanceof SemVer$1) {
        return version;
      }
      try {
        return new SemVer$1(version, options);
      } catch (er) {
        if (!throwErrors) {
          return null;
        }
        throw er;
      }
    };
    var parse_1 = parse$4;
    var parse$3 = parse_1;
    var valid = function valid(version, options) {
      var v = parse$3(version, options);
      return v ? v.version : null;
    };
    var valid_1 = valid;
    var valid$1 = getDefaultExportFromCjs$1(valid_1);
    var SemVer = semver;
    var parse$2 = parse_1;
    var re = reExports.safeRe,
      t = reExports.t;
    var coerce$1 = function coerce(version, options) {
      if (version instanceof SemVer) {
        return version;
      }
      if (typeof version === 'number') {
        version = String(version);
      }
      if (typeof version !== 'string') {
        return null;
      }
      options = options || {};
      var match = null;
      if (!options.rtl) {
        match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
      } else {
        var coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
        var next;
        while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
          if (!match || next.index + next[0].length !== match.index + match[0].length) {
            match = next;
          }
          coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
        }
        coerceRtlRegex.lastIndex = -1;
      }
      if (match === null) {
        return null;
      }
      var major = match[2];
      var minor = match[3] || '0';
      var patch = match[4] || '0';
      var prerelease = options.includePrerelease && match[5] ? "-".concat(match[5]) : '';
      var build = options.includePrerelease && match[6] ? "+".concat(match[6]) : '';
      return parse$2("".concat(major, ".").concat(minor, ".").concat(patch).concat(prerelease).concat(build), options);
    };
    var coerce_1 = coerce$1;
    var coerce$2 = getDefaultExportFromCjs$1(coerce_1);
    var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
    var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
    var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
    var unicode = {
    	Space_Separator: Space_Separator,
    	ID_Start: ID_Start,
    	ID_Continue: ID_Continue
    };
    var util$1 = {
        isSpaceSeparator (c) {
            return typeof c === 'string' && unicode.Space_Separator.test(c)
        },
        isIdStartChar (c) {
            return typeof c === 'string' && (
                (c >= 'a' && c <= 'z') ||
            (c >= 'A' && c <= 'Z') ||
            (c === '$') || (c === '_') ||
            unicode.ID_Start.test(c)
            )
        },
        isIdContinueChar (c) {
            return typeof c === 'string' && (
                (c >= 'a' && c <= 'z') ||
            (c >= 'A' && c <= 'Z') ||
            (c >= '0' && c <= '9') ||
            (c === '$') || (c === '_') ||
            (c === '\u200C') || (c === '\u200D') ||
            unicode.ID_Continue.test(c)
            )
        },
        isDigit (c) {
            return typeof c === 'string' && /[0-9]/.test(c)
        },
        isHexDigit (c) {
            return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
        },
    };
    let source;
    let parseState;
    let stack;
    let pos;
    let line;
    let column;
    let token;
    let key;
    let root;
    var parse$1 = function parse (text, reviver) {
        source = String(text);
        parseState = 'start';
        stack = [];
        pos = 0;
        line = 1;
        column = 0;
        token = undefined;
        key = undefined;
        root = undefined;
        do {
            token = lex();
            parseStates[parseState]();
        } while (token.type !== 'eof')
        if (typeof reviver === 'function') {
            return internalize({'': root}, '', reviver)
        }
        return root
    };
    function internalize (holder, name, reviver) {
        const value = holder[name];
        if (value != null && typeof value === 'object') {
            if (Array.isArray(value)) {
                for (let i = 0; i < value.length; i++) {
                    const key = String(i);
                    const replacement = internalize(value, key, reviver);
                    if (replacement === undefined) {
                        delete value[key];
                    } else {
                        Object.defineProperty(value, key, {
                            value: replacement,
                            writable: true,
                            enumerable: true,
                            configurable: true,
                        });
                    }
                }
            } else {
                for (const key in value) {
                    const replacement = internalize(value, key, reviver);
                    if (replacement === undefined) {
                        delete value[key];
                    } else {
                        Object.defineProperty(value, key, {
                            value: replacement,
                            writable: true,
                            enumerable: true,
                            configurable: true,
                        });
                    }
                }
            }
        }
        return reviver.call(holder, name, value)
    }
    let lexState;
    let buffer;
    let doubleQuote;
    let sign;
    let c;
    function lex () {
        lexState = 'default';
        buffer = '';
        doubleQuote = false;
        sign = 1;
        for (;;) {
            c = peek();
            const token = lexStates[lexState]();
            if (token) {
                return token
            }
        }
    }
    function peek () {
        if (source[pos]) {
            return String.fromCodePoint(source.codePointAt(pos))
        }
    }
    function read () {
        const c = peek();
        if (c === '\n') {
            line++;
            column = 0;
        } else if (c) {
            column += c.length;
        } else {
            column++;
        }
        if (c) {
            pos += c.length;
        }
        return c
    }
    const lexStates = {
        default () {
            switch (c) {
            case '\t':
            case '\v':
            case '\f':
            case ' ':
            case '\u00A0':
            case '\uFEFF':
            case '\n':
            case '\r':
            case '\u2028':
            case '\u2029':
                read();
                return
            case '/':
                read();
                lexState = 'comment';
                return
            case undefined:
                read();
                return newToken('eof')
            }
            if (util$1.isSpaceSeparator(c)) {
                read();
                return
            }
            return lexStates[parseState]()
        },
        comment () {
            switch (c) {
            case '*':
                read();
                lexState = 'multiLineComment';
                return
            case '/':
                read();
                lexState = 'singleLineComment';
                return
            }
            throw invalidChar(read())
        },
        multiLineComment () {
            switch (c) {
            case '*':
                read();
                lexState = 'multiLineCommentAsterisk';
                return
            case undefined:
                throw invalidChar(read())
            }
            read();
        },
        multiLineCommentAsterisk () {
            switch (c) {
            case '*':
                read();
                return
            case '/':
                read();
                lexState = 'default';
                return
            case undefined:
                throw invalidChar(read())
            }
            read();
            lexState = 'multiLineComment';
        },
        singleLineComment () {
            switch (c) {
            case '\n':
            case '\r':
            case '\u2028':
            case '\u2029':
                read();
                lexState = 'default';
                return
            case undefined:
                read();
                return newToken('eof')
            }
            read();
        },
        value () {
            switch (c) {
            case '{':
            case '[':
                return newToken('punctuator', read())
            case 'n':
                read();
                literal('ull');
                return newToken('null', null)
            case 't':
                read();
                literal('rue');
                return newToken('boolean', true)
            case 'f':
                read();
                literal('alse');
                return newToken('boolean', false)
            case '-':
            case '+':
                if (read() === '-') {
                    sign = -1;
                }
                lexState = 'sign';
                return
            case '.':
                buffer = read();
                lexState = 'decimalPointLeading';
                return
            case '0':
                buffer = read();
                lexState = 'zero';
                return
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                buffer = read();
                lexState = 'decimalInteger';
                return
            case 'I':
                read();
                literal('nfinity');
                return newToken('numeric', Infinity)
            case 'N':
                read();
                literal('aN');
                return newToken('numeric', NaN)
            case '"':
            case "'":
                doubleQuote = (read() === '"');
                buffer = '';
                lexState = 'string';
                return
            }
            throw invalidChar(read())
        },
        identifierNameStartEscape () {
            if (c !== 'u') {
                throw invalidChar(read())
            }
            read();
            const u = unicodeEscape();
            switch (u) {
            case '$':
            case '_':
                break
            default:
                if (!util$1.isIdStartChar(u)) {
                    throw invalidIdentifier()
                }
                break
            }
            buffer += u;
            lexState = 'identifierName';
        },
        identifierName () {
            switch (c) {
            case '$':
            case '_':
            case '\u200C':
            case '\u200D':
                buffer += read();
                return
            case '\\':
                read();
                lexState = 'identifierNameEscape';
                return
            }
            if (util$1.isIdContinueChar(c)) {
                buffer += read();
                return
            }
            return newToken('identifier', buffer)
        },
        identifierNameEscape () {
            if (c !== 'u') {
                throw invalidChar(read())
            }
            read();
            const u = unicodeEscape();
            switch (u) {
            case '$':
            case '_':
            case '\u200C':
            case '\u200D':
                break
            default:
                if (!util$1.isIdContinueChar(u)) {
                    throw invalidIdentifier()
                }
                break
            }
            buffer += u;
            lexState = 'identifierName';
        },
        sign () {
            switch (c) {
            case '.':
                buffer = read();
                lexState = 'decimalPointLeading';
                return
            case '0':
                buffer = read();
                lexState = 'zero';
                return
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                buffer = read();
                lexState = 'decimalInteger';
                return
            case 'I':
                read();
                literal('nfinity');
                return newToken('numeric', sign * Infinity)
            case 'N':
                read();
                literal('aN');
                return newToken('numeric', NaN)
            }
            throw invalidChar(read())
        },
        zero () {
            switch (c) {
            case '.':
                buffer += read();
                lexState = 'decimalPoint';
                return
            case 'e':
            case 'E':
                buffer += read();
                lexState = 'decimalExponent';
                return
            case 'x':
            case 'X':
                buffer += read();
                lexState = 'hexadecimal';
                return
            }
            return newToken('numeric', sign * 0)
        },
        decimalInteger () {
            switch (c) {
            case '.':
                buffer += read();
                lexState = 'decimalPoint';
                return
            case 'e':
            case 'E':
                buffer += read();
                lexState = 'decimalExponent';
                return
            }
            if (util$1.isDigit(c)) {
                buffer += read();
                return
            }
            return newToken('numeric', sign * Number(buffer))
        },
        decimalPointLeading () {
            if (util$1.isDigit(c)) {
                buffer += read();
                lexState = 'decimalFraction';
                return
            }
            throw invalidChar(read())
        },
        decimalPoint () {
            switch (c) {
            case 'e':
            case 'E':
                buffer += read();
                lexState = 'decimalExponent';
                return
            }
            if (util$1.isDigit(c)) {
                buffer += read();
                lexState = 'decimalFraction';
                return
            }
            return newToken('numeric', sign * Number(buffer))
        },
        decimalFraction () {
            switch (c) {
            case 'e':
            case 'E':
                buffer += read();
                lexState = 'decimalExponent';
                return
            }
            if (util$1.isDigit(c)) {
                buffer += read();
                return
            }
            return newToken('numeric', sign * Number(buffer))
        },
        decimalExponent () {
            switch (c) {
            case '+':
            case '-':
                buffer += read();
                lexState = 'decimalExponentSign';
                return
            }
            if (util$1.isDigit(c)) {
                buffer += read();
                lexState = 'decimalExponentInteger';
                return
            }
            throw invalidChar(read())
        },
        decimalExponentSign () {
            if (util$1.isDigit(c)) {
                buffer += read();
                lexState = 'decimalExponentInteger';
                return
            }
            throw invalidChar(read())
        },
        decimalExponentInteger () {
            if (util$1.isDigit(c)) {
                buffer += read();
                return
            }
            return newToken('numeric', sign * Number(buffer))
        },
        hexadecimal () {
            if (util$1.isHexDigit(c)) {
                buffer += read();
                lexState = 'hexadecimalInteger';
                return
            }
            throw invalidChar(read())
        },
        hexadecimalInteger () {
            if (util$1.isHexDigit(c)) {
                buffer += read();
                return
            }
            return newToken('numeric', sign * Number(buffer))
        },
        string () {
            switch (c) {
            case '\\':
                read();
                buffer += escape();
                return
            case '"':
                if (doubleQuote) {
                    read();
                    return newToken('string', buffer)
                }
                buffer += read();
                return
            case "'":
                if (!doubleQuote) {
                    read();
                    return newToken('string', buffer)
                }
                buffer += read();
                return
            case '\n':
            case '\r':
                throw invalidChar(read())
            case '\u2028':
            case '\u2029':
                separatorChar(c);
                break
            case undefined:
                throw invalidChar(read())
            }
            buffer += read();
        },
        start () {
            switch (c) {
            case '{':
            case '[':
                return newToken('punctuator', read())
            }
            lexState = 'value';
        },
        beforePropertyName () {
            switch (c) {
            case '$':
            case '_':
                buffer = read();
                lexState = 'identifierName';
                return
            case '\\':
                read();
                lexState = 'identifierNameStartEscape';
                return
            case '}':
                return newToken('punctuator', read())
            case '"':
            case "'":
                doubleQuote = (read() === '"');
                lexState = 'string';
                return
            }
            if (util$1.isIdStartChar(c)) {
                buffer += read();
                lexState = 'identifierName';
                return
            }
            throw invalidChar(read())
        },
        afterPropertyName () {
            if (c === ':') {
                return newToken('punctuator', read())
            }
            throw invalidChar(read())
        },
        beforePropertyValue () {
            lexState = 'value';
        },
        afterPropertyValue () {
            switch (c) {
            case ',':
            case '}':
                return newToken('punctuator', read())
            }
            throw invalidChar(read())
        },
        beforeArrayValue () {
            if (c === ']') {
                return newToken('punctuator', read())
            }
            lexState = 'value';
        },
        afterArrayValue () {
            switch (c) {
            case ',':
            case ']':
                return newToken('punctuator', read())
            }
            throw invalidChar(read())
        },
        end () {
            throw invalidChar(read())
        },
    };
    function newToken (type, value) {
        return {
            type,
            value,
            line,
            column,
        }
    }
    function literal (s) {
        for (const c of s) {
            const p = peek();
            if (p !== c) {
                throw invalidChar(read())
            }
            read();
        }
    }
    function escape () {
        const c = peek();
        switch (c) {
        case 'b':
            read();
            return '\b'
        case 'f':
            read();
            return '\f'
        case 'n':
            read();
            return '\n'
        case 'r':
            read();
            return '\r'
        case 't':
            read();
            return '\t'
        case 'v':
            read();
            return '\v'
        case '0':
            read();
            if (util$1.isDigit(peek())) {
                throw invalidChar(read())
            }
            return '\0'
        case 'x':
            read();
            return hexEscape()
        case 'u':
            read();
            return unicodeEscape()
        case '\n':
        case '\u2028':
        case '\u2029':
            read();
            return ''
        case '\r':
            read();
            if (peek() === '\n') {
                read();
            }
            return ''
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
        case '8':
        case '9':
            throw invalidChar(read())
        case undefined:
            throw invalidChar(read())
        }
        return read()
    }
    function hexEscape () {
        let buffer = '';
        let c = peek();
        if (!util$1.isHexDigit(c)) {
            throw invalidChar(read())
        }
        buffer += read();
        c = peek();
        if (!util$1.isHexDigit(c)) {
            throw invalidChar(read())
        }
        buffer += read();
        return String.fromCodePoint(parseInt(buffer, 16))
    }
    function unicodeEscape () {
        let buffer = '';
        let count = 4;
        while (count-- > 0) {
            const c = peek();
            if (!util$1.isHexDigit(c)) {
                throw invalidChar(read())
            }
            buffer += read();
        }
        return String.fromCodePoint(parseInt(buffer, 16))
    }
    const parseStates = {
        start () {
            if (token.type === 'eof') {
                throw invalidEOF()
            }
            push();
        },
        beforePropertyName () {
            switch (token.type) {
            case 'identifier':
            case 'string':
                key = token.value;
                parseState = 'afterPropertyName';
                return
            case 'punctuator':
                pop();
                return
            case 'eof':
                throw invalidEOF()
            }
        },
        afterPropertyName () {
            if (token.type === 'eof') {
                throw invalidEOF()
            }
            parseState = 'beforePropertyValue';
        },
        beforePropertyValue () {
            if (token.type === 'eof') {
                throw invalidEOF()
            }
            push();
        },
        beforeArrayValue () {
            if (token.type === 'eof') {
                throw invalidEOF()
            }
            if (token.type === 'punctuator' && token.value === ']') {
                pop();
                return
            }
            push();
        },
        afterPropertyValue () {
            if (token.type === 'eof') {
                throw invalidEOF()
            }
            switch (token.value) {
            case ',':
                parseState = 'beforePropertyName';
                return
            case '}':
                pop();
            }
        },
        afterArrayValue () {
            if (token.type === 'eof') {
                throw invalidEOF()
            }
            switch (token.value) {
            case ',':
                parseState = 'beforeArrayValue';
                return
            case ']':
                pop();
            }
        },
        end () {
        },
    };
    function push () {
        let value;
        switch (token.type) {
        case 'punctuator':
            switch (token.value) {
            case '{':
                value = {};
                break
            case '[':
                value = [];
                break
            }
            break
        case 'null':
        case 'boolean':
        case 'numeric':
        case 'string':
            value = token.value;
            break
        }
        if (root === undefined) {
            root = value;
        } else {
            const parent = stack[stack.length - 1];
            if (Array.isArray(parent)) {
                parent.push(value);
            } else {
                Object.defineProperty(parent, key, {
                    value,
                    writable: true,
                    enumerable: true,
                    configurable: true,
                });
            }
        }
        if (value !== null && typeof value === 'object') {
            stack.push(value);
            if (Array.isArray(value)) {
                parseState = 'beforeArrayValue';
            } else {
                parseState = 'beforePropertyName';
            }
        } else {
            const current = stack[stack.length - 1];
            if (current == null) {
                parseState = 'end';
            } else if (Array.isArray(current)) {
                parseState = 'afterArrayValue';
            } else {
                parseState = 'afterPropertyValue';
            }
        }
    }
    function pop () {
        stack.pop();
        const current = stack[stack.length - 1];
        if (current == null) {
            parseState = 'end';
        } else if (Array.isArray(current)) {
            parseState = 'afterArrayValue';
        } else {
            parseState = 'afterPropertyValue';
        }
    }
    function invalidChar (c) {
        if (c === undefined) {
            return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
        }
        return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
    }
    function invalidEOF () {
        return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
    }
    function invalidIdentifier () {
        column -= 5;
        return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`)
    }
    function separatorChar (c) {
        console.warn(`JSON5: '${formatChar(c)}' in strings is not valid ECMAScript; consider escaping`);
    }
    function formatChar (c) {
        const replacements = {
            "'": "\\'",
            '"': '\\"',
            '\\': '\\\\',
            '\b': '\\b',
            '\f': '\\f',
            '\n': '\\n',
            '\r': '\\r',
            '\t': '\\t',
            '\v': '\\v',
            '\0': '\\0',
            '\u2028': '\\u2028',
            '\u2029': '\\u2029',
        };
        if (replacements[c]) {
            return replacements[c]
        }
        if (c < ' ') {
            const hexString = c.charCodeAt(0).toString(16);
            return '\\x' + ('00' + hexString).substring(hexString.length)
        }
        return c
    }
    function syntaxError (message) {
        const err = new SyntaxError(message);
        err.lineNumber = line;
        err.columnNumber = column;
        return err
    }
    var stringify = function stringify (value, replacer, space) {
        const stack = [];
        let indent = '';
        let propertyList;
        let replacerFunc;
        let gap = '';
        let quote;
        if (
            replacer != null &&
            typeof replacer === 'object' &&
            !Array.isArray(replacer)
        ) {
            space = replacer.space;
            quote = replacer.quote;
            replacer = replacer.replacer;
        }
        if (typeof replacer === 'function') {
            replacerFunc = replacer;
        } else if (Array.isArray(replacer)) {
            propertyList = [];
            for (const v of replacer) {
                let item;
                if (typeof v === 'string') {
                    item = v;
                } else if (
                    typeof v === 'number' ||
                    v instanceof String ||
                    v instanceof Number
                ) {
                    item = String(v);
                }
                if (item !== undefined && propertyList.indexOf(item) < 0) {
                    propertyList.push(item);
                }
            }
        }
        if (space instanceof Number) {
            space = Number(space);
        } else if (space instanceof String) {
            space = String(space);
        }
        if (typeof space === 'number') {
            if (space > 0) {
                space = Math.min(10, Math.floor(space));
                gap = '          '.substr(0, space);
            }
        } else if (typeof space === 'string') {
            gap = space.substr(0, 10);
        }
        return serializeProperty('', {'': value})
        function serializeProperty (key, holder) {
            let value = holder[key];
            if (value != null) {
                if (typeof value.toJSON5 === 'function') {
                    value = value.toJSON5(key);
                } else if (typeof value.toJSON === 'function') {
                    value = value.toJSON(key);
                }
            }
            if (replacerFunc) {
                value = replacerFunc.call(holder, key, value);
            }
            if (value instanceof Number) {
                value = Number(value);
            } else if (value instanceof String) {
                value = String(value);
            } else if (value instanceof Boolean) {
                value = value.valueOf();
            }
            switch (value) {
            case null: return 'null'
            case true: return 'true'
            case false: return 'false'
            }
            if (typeof value === 'string') {
                return quoteString(value)
            }
            if (typeof value === 'number') {
                return String(value)
            }
            if (typeof value === 'object') {
                return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
            }
            return undefined
        }
        function quoteString (value) {
            const quotes = {
                "'": 0.1,
                '"': 0.2,
            };
            const replacements = {
                "'": "\\'",
                '"': '\\"',
                '\\': '\\\\',
                '\b': '\\b',
                '\f': '\\f',
                '\n': '\\n',
                '\r': '\\r',
                '\t': '\\t',
                '\v': '\\v',
                '\0': '\\0',
                '\u2028': '\\u2028',
                '\u2029': '\\u2029',
            };
            let product = '';
            for (let i = 0; i < value.length; i++) {
                const c = value[i];
                switch (c) {
                case "'":
                case '"':
                    quotes[c]++;
                    product += c;
                    continue
                case '\0':
                    if (util$1.isDigit(value[i + 1])) {
                        product += '\\x00';
                        continue
                    }
                }
                if (replacements[c]) {
                    product += replacements[c];
                    continue
                }
                if (c < ' ') {
                    let hexString = c.charCodeAt(0).toString(16);
                    product += '\\x' + ('00' + hexString).substring(hexString.length);
                    continue
                }
                product += c;
            }
            const quoteChar = quote || Object.keys(quotes).reduce((a, b) => (quotes[a] < quotes[b]) ? a : b);
            product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
            return quoteChar + product + quoteChar
        }
        function serializeObject (value) {
            if (stack.indexOf(value) >= 0) {
                throw TypeError('Converting circular structure to JSON5')
            }
            stack.push(value);
            let stepback = indent;
            indent = indent + gap;
            let keys = propertyList || Object.keys(value);
            let partial = [];
            for (const key of keys) {
                const propertyString = serializeProperty(key, value);
                if (propertyString !== undefined) {
                    let member = serializeKey(key) + ':';
                    if (gap !== '') {
                        member += ' ';
                    }
                    member += propertyString;
                    partial.push(member);
                }
            }
            let final;
            if (partial.length === 0) {
                final = '{}';
            } else {
                let properties;
                if (gap === '') {
                    properties = partial.join(',');
                    final = '{' + properties + '}';
                } else {
                    let separator = ',\n' + indent;
                    properties = partial.join(separator);
                    final = '{\n' + indent + properties + ',\n' + stepback + '}';
                }
            }
            stack.pop();
            indent = stepback;
            return final
        }
        function serializeKey (key) {
            if (key.length === 0) {
                return quoteString(key)
            }
            const firstChar = String.fromCodePoint(key.codePointAt(0));
            if (!util$1.isIdStartChar(firstChar)) {
                return quoteString(key)
            }
            for (let i = firstChar.length; i < key.length; i++) {
                if (!util$1.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
                    return quoteString(key)
                }
            }
            return key
        }
        function serializeArray (value) {
            if (stack.indexOf(value) >= 0) {
                throw TypeError('Converting circular structure to JSON5')
            }
            stack.push(value);
            let stepback = indent;
            indent = indent + gap;
            let partial = [];
            for (let i = 0; i < value.length; i++) {
                const propertyString = serializeProperty(String(i), value);
                partial.push((propertyString !== undefined) ? propertyString : 'null');
            }
            let final;
            if (partial.length === 0) {
                final = '[]';
            } else {
                if (gap === '') {
                    let properties = partial.join(',');
                    final = '[' + properties + ']';
                } else {
                    let separator = ',\n' + indent;
                    let properties = partial.join(separator);
                    final = '[\n' + indent + properties + ',\n' + stepback + ']';
                }
            }
            stack.pop();
            indent = stepback;
            return final
        }
    };
    const JSON5 = {
        parse: parse$1,
        stringify,
    };
    var lib = JSON5;
    var sprintf = {};
    (function (exports) {
      !function () {
        var re = {
          not_string: /[^s]/,
          not_bool: /[^t]/,
          not_type: /[^T]/,
          not_primitive: /[^v]/,
          number: /[diefg]/,
          numeric_arg: /[bcdiefguxX]/,
          json: /[j]/,
          not_json: /[^j]/,
          text: /^[^\x25]+/,
          modulo: /^\x25{2}/,
          placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,
          key: /^([a-z_][a-z_\d]*)/i,
          key_access: /^\.([a-z_][a-z_\d]*)/i,
          index_access: /^\[(\d+)\]/,
          sign: /^[+-]/
        };
        function sprintf(key) {
          return sprintf_format(sprintf_parse(key), arguments);
        }
        function vsprintf(fmt, argv) {
          return sprintf.apply(null, [fmt].concat(argv || []));
        }
        function sprintf_format(parse_tree, argv) {
          var cursor = 1,
            tree_length = parse_tree.length,
            arg,
            output = '',
            i,
            k,
            ph,
            pad,
            pad_character,
            pad_length,
            is_positive,
            sign;
          for (i = 0; i < tree_length; i++) {
            if (typeof parse_tree[i] === 'string') {
              output += parse_tree[i];
            } else if (typeof parse_tree[i] === 'object') {
              ph = parse_tree[i];
              if (ph.keys) {
                arg = argv[cursor];
                for (k = 0; k < ph.keys.length; k++) {
                  if (arg == undefined) {
                    throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k - 1]));
                  }
                  arg = arg[ph.keys[k]];
                }
              } else if (ph.param_no) {
                arg = argv[ph.param_no];
              } else {
                arg = argv[cursor++];
              }
              if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {
                arg = arg();
              }
              if (re.numeric_arg.test(ph.type) && typeof arg !== 'number' && isNaN(arg)) {
                throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg));
              }
              if (re.number.test(ph.type)) {
                is_positive = arg >= 0;
              }
              switch (ph.type) {
                case 'b':
                  arg = parseInt(arg, 10).toString(2);
                  break;
                case 'c':
                  arg = String.fromCharCode(parseInt(arg, 10));
                  break;
                case 'd':
                case 'i':
                  arg = parseInt(arg, 10);
                  break;
                case 'j':
                  arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0);
                  break;
                case 'e':
                  arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential();
                  break;
                case 'f':
                  arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg);
                  break;
                case 'g':
                  arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg);
                  break;
                case 'o':
                  arg = (parseInt(arg, 10) >>> 0).toString(8);
                  break;
                case 's':
                  arg = String(arg);
                  arg = ph.precision ? arg.substring(0, ph.precision) : arg;
                  break;
                case 't':
                  arg = String(!!arg);
                  arg = ph.precision ? arg.substring(0, ph.precision) : arg;
                  break;
                case 'T':
                  arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase();
                  arg = ph.precision ? arg.substring(0, ph.precision) : arg;
                  break;
                case 'u':
                  arg = parseInt(arg, 10) >>> 0;
                  break;
                case 'v':
                  arg = arg.valueOf();
                  arg = ph.precision ? arg.substring(0, ph.precision) : arg;
                  break;
                case 'x':
                  arg = (parseInt(arg, 10) >>> 0).toString(16);
                  break;
                case 'X':
                  arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase();
                  break;
              }
              if (re.json.test(ph.type)) {
                output += arg;
              } else {
                if (re.number.test(ph.type) && (!is_positive || ph.sign)) {
                  sign = is_positive ? '+' : '-';
                  arg = arg.toString().replace(re.sign, '');
                } else {
                  sign = '';
                }
                pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' ';
                pad_length = ph.width - (sign + arg).length;
                pad = ph.width ? pad_length > 0 ? pad_character.repeat(pad_length) : '' : '';
                output += ph.align ? sign + arg + pad : pad_character === '0' ? sign + pad + arg : pad + sign + arg;
              }
            }
          }
          return output;
        }
        var sprintf_cache = Object.create(null);
        function sprintf_parse(fmt) {
          if (sprintf_cache[fmt]) {
            return sprintf_cache[fmt];
          }
          var _fmt = fmt,
            match,
            parse_tree = [],
            arg_names = 0;
          while (_fmt) {
            if ((match = re.text.exec(_fmt)) !== null) {
              parse_tree.push(match[0]);
            } else if ((match = re.modulo.exec(_fmt)) !== null) {
              parse_tree.push('%');
            } else if ((match = re.placeholder.exec(_fmt)) !== null) {
              if (match[2]) {
                arg_names |= 1;
                var field_list = [],
                  replacement_field = match[2],
                  field_match = [];
                if ((field_match = re.key.exec(replacement_field)) !== null) {
                  field_list.push(field_match[1]);
                  while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
                    if ((field_match = re.key_access.exec(replacement_field)) !== null) {
                      field_list.push(field_match[1]);
                    } else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
                      field_list.push(field_match[1]);
                    } else {
                      throw new SyntaxError('[sprintf] failed to parse named argument key');
                    }
                  }
                } else {
                  throw new SyntaxError('[sprintf] failed to parse named argument key');
                }
                match[2] = field_list;
              } else {
                arg_names |= 2;
              }
              if (arg_names === 3) {
                throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported');
              }
              parse_tree.push({
                placeholder: match[0],
                param_no: match[1],
                keys: match[2],
                sign: match[3],
                pad_char: match[4],
                align: match[5],
                width: match[6],
                precision: match[7],
                type: match[8]
              });
            } else {
              throw new SyntaxError('[sprintf] unexpected placeholder');
            }
            _fmt = _fmt.substring(match[0].length);
          }
          return sprintf_cache[fmt] = parse_tree;
        }
        {
          exports['sprintf'] = sprintf;
          exports['vsprintf'] = vsprintf;
        }
        if (typeof window !== 'undefined') {
          window['sprintf'] = sprintf;
          window['vsprintf'] = vsprintf;
        }
      }();
    })(sprintf);
    function isBetween(code, min, max) {
        return code >= min && code <= max;
    }
    function isGreaterThanOrEqual(code, min) {
        return code >= min;
    }
    function isDigit(code) {
        return isBetween(code, 48 , 57 );
    }
    function isHexDigit(code) {
        return isDigit(code)
            || isBetween(code, 65 , 70 )
            || isBetween(code, 97 , 102 );
    }
    function isUppercaseLetter(code) {
        return isBetween(code, 65 , 90 );
    }
    function isLowercaseLetter(code) {
        return isBetween(code, 97 , 122 );
    }
    function isLetter(code) {
        return isUppercaseLetter(code) || isLowercaseLetter(code);
    }
    function isNonAsciiCodePoint(code) {
        return isGreaterThanOrEqual(code, 128 );
    }
    function isIdentStartCodePoint(code) {
        return isLetter(code) || isNonAsciiCodePoint(code) || code === 95 ;
    }
    function isIdentCodePoint(code) {
        return isIdentStartCodePoint(code) || isDigit(code) || code === 45 ;
    }
    function isNonPrintableCodePoint(code) {
        return isBetween(code, 0 , 8 )
            || code === 11
            || isBetween(code, 14 , 31 )
            || code === 127 ;
    }
    function isNewline(code) {
        return code === 10  || code === 13  || code === 12 ;
    }
    function isWhitespace$1(code) {
        return isNewline(code) || code === 9  || code === 32 ;
    }
    function isBOM(code) {
        return code === 65279  || code === 65534 ;
    }
    const checkForValidEscape = (a, b) => {
        if (a !== 92 ) {
            return false;
        }
        return !isNewline(b);
    };
    const checkForIdentStart = (a, b, c) => {
        if (a === 45 ) {
            return isIdentStartCodePoint(b) || b === 45  || checkForValidEscape(b, c);
        }
        if (isIdentStartCodePoint(a)) {
            return true;
        }
        if (a === 92 ) {
            return checkForValidEscape(a, b);
        }
        return false;
    };
    const checkForNumberStart = (a, b, c) => {
        if (a === 43  || a === 45 ) {
            if (isDigit(b)) {
                return true;
            }
            return b === 46  && isDigit(c);
        }
        if (a === 46 ) {
            return isDigit(b);
        }
        return isDigit(a);
    };
    function getCodePointsArrayHash(arr, start, end) {
        let hash = 5381;
        for (let i = start; i < end; i += 1) {
            hash = hash * 33 ^ (arr[i] | 0x20);
        }
        return hash >>> 0;
    }
    class TokenizerContext {
        length;
        onToken;
        onError;
        codes;
        cursor;
        customFunctionHandlers;
        constructor(source, onToken, onError, functionHandlers) {
            this.length = source.length;
            this.preprocess(source);
            this.cursor = isBOM(this.codes[0]) ? 1 : 0;
            this.onToken = onToken;
            this.onError = onError;
            if (functionHandlers) {
                this.customFunctionHandlers = new Map();
                for (const [hash, handler] of functionHandlers) {
                    this.customFunctionHandlers.set(hash, handler);
                }
            }
        }
        preprocess(source) {
            const len = source.length;
            this.codes = new Int32Array(len + 1);
            for (let i = 0; i < len; i += 1) {
                this.codes[i] = source.charCodeAt(i);
            }
            this.codes[len] = -1 ;
        }
        getFunctionHandler(hash) {
            return this.customFunctionHandlers?.get(hash);
        }
        hasFunctionHandler(hash) {
            return this.customFunctionHandlers?.has(hash) ?? false;
        }
        get offset() {
            return this.cursor;
        }
        get code() {
            return this.codes[this.offset];
        }
        get prevCode() {
            return this.codes[this.offset - 1];
        }
        get nextCode() {
            return this.codes[this.offset + 1];
        }
        getRelativeCode(relativeOffset) {
            return this.codes[this.offset + relativeOffset];
        }
        isEof() {
            return this.offset >= this.length;
        }
        isNextEof() {
            return this.cursor + 1 === this.length;
        }
        isLessThanEqualToEof() {
            return this.offset <= this.length;
        }
        consumeCodePoint(n = 1) {
            this.cursor += n;
        }
        getNextNonWsCode() {
            let i = this.cursor;
            while (i < this.length && isWhitespace$1(this.codes[i])) {
                i += 1;
            }
            return this.codes[i];
        }
        consumeWhitespace() {
            while (this.code && isWhitespace$1(this.code)) {
                this.consumeCodePoint();
            }
        }
        consumeSingleWhitespace() {
            if (isWhitespace$1(this.code)) {
                this.cursor += this.code === 13  && this.nextCode === 10  ? 2 : 1;
            }
        }
        consumeUntilCommentEnd() {
            while (this.cursor < this.length) {
                if (this.code === 42  && this.nextCode === 47 ) {
                    this.cursor += 2;
                    break;
                }
                this.cursor += 1;
            }
        }
        consumeTrivialToken(tokenType) {
            this.onToken(tokenType, this.cursor, ++this.cursor);
        }
        getHashFrom(start) {
            return getCodePointsArrayHash(this.codes, start, this.cursor);
        }
    }
    var TokenType$1;
    (function (TokenType) {
        TokenType[TokenType["Eof"] = 0] = "Eof";
        TokenType[TokenType["Ident"] = 1] = "Ident";
        TokenType[TokenType["Function"] = 2] = "Function";
        TokenType[TokenType["AtKeyword"] = 3] = "AtKeyword";
        TokenType[TokenType["Hash"] = 4] = "Hash";
        TokenType[TokenType["String"] = 5] = "String";
        TokenType[TokenType["BadString"] = 6] = "BadString";
        TokenType[TokenType["Url"] = 7] = "Url";
        TokenType[TokenType["BadUrl"] = 8] = "BadUrl";
        TokenType[TokenType["Delim"] = 9] = "Delim";
        TokenType[TokenType["Number"] = 10] = "Number";
        TokenType[TokenType["Percentage"] = 11] = "Percentage";
        TokenType[TokenType["Dimension"] = 12] = "Dimension";
        TokenType[TokenType["Whitespace"] = 13] = "Whitespace";
        TokenType[TokenType["Cdo"] = 14] = "Cdo";
        TokenType[TokenType["Cdc"] = 15] = "Cdc";
        TokenType[TokenType["Colon"] = 16] = "Colon";
        TokenType[TokenType["Semicolon"] = 17] = "Semicolon";
        TokenType[TokenType["Comma"] = 18] = "Comma";
        TokenType[TokenType["OpenSquareBracket"] = 19] = "OpenSquareBracket";
        TokenType[TokenType["CloseSquareBracket"] = 20] = "CloseSquareBracket";
        TokenType[TokenType["OpenParenthesis"] = 21] = "OpenParenthesis";
        TokenType[TokenType["CloseParenthesis"] = 22] = "CloseParenthesis";
        TokenType[TokenType["OpenCurlyBracket"] = 23] = "OpenCurlyBracket";
        TokenType[TokenType["CloseCurlyBracket"] = 24] = "CloseCurlyBracket";
        TokenType[TokenType["Comment"] = 25] = "Comment";
    })(TokenType$1 || (TokenType$1 = {}));
    const UNKNOWN_TOKEN_NAME = 'unknown';
    const TOKEN_NAMES = Object.freeze({
        [TokenType$1.Eof]: 'eof',
        [TokenType$1.Ident]: 'ident',
        [TokenType$1.Function]: 'function',
        [TokenType$1.AtKeyword]: 'at-keyword',
        [TokenType$1.Hash]: 'hash',
        [TokenType$1.String]: 'string',
        [TokenType$1.BadString]: 'bad-string',
        [TokenType$1.Url]: 'url',
        [TokenType$1.BadUrl]: 'bad-url',
        [TokenType$1.Delim]: 'delim',
        [TokenType$1.Number]: 'number',
        [TokenType$1.Percentage]: 'percentage',
        [TokenType$1.Dimension]: 'dimension',
        [TokenType$1.Whitespace]: 'whitespace',
        [TokenType$1.Cdo]: 'CDO',
        [TokenType$1.Cdc]: 'CDC',
        [TokenType$1.Colon]: 'colon',
        [TokenType$1.Semicolon]: 'semicolon',
        [TokenType$1.Comma]: 'comma',
        [TokenType$1.OpenSquareBracket]: '[',
        [TokenType$1.CloseSquareBracket]: ']',
        [TokenType$1.OpenParenthesis]: '(',
        [TokenType$1.CloseParenthesis]: ')',
        [TokenType$1.OpenCurlyBracket]: '{',
        [TokenType$1.CloseCurlyBracket]: '}',
        [TokenType$1.Comment]: 'comment',
    });
    const getBaseTokenName = (type) => {
        return TOKEN_NAMES[type] ?? UNKNOWN_TOKEN_NAME;
    };
    const getFormattedTokenName = (type) => {
        return `<${getBaseTokenName(type)}-token>`;
    };
    const MAX_HEX_DIGITS = 6;
    const consumeEscapedCodePoint = (context) => {
        context.consumeCodePoint();
        if (isHexDigit(context.code)) {
            let consumedHexDigits = 0;
            while (isHexDigit(context.code) && consumedHexDigits <= MAX_HEX_DIGITS) {
                context.consumeCodePoint();
                consumedHexDigits += 1;
            }
            context.consumeSingleWhitespace();
        }
        if (context.isEof()) {
            context.onError("Unexpected end of file while parsing escaped code point." , context.offset, context.offset);
        }
    };
    const consumeIndentSequence = (context) => {
        while (!context.isEof()) {
            if (isIdentCodePoint(context.code)) {
                context.consumeCodePoint();
                continue;
            }
            if (checkForValidEscape(context.code, context.nextCode)) {
                context.consumeCodePoint();
                consumeEscapedCodePoint(context);
                continue;
            }
            return;
        }
    };
    function consumeBadUrlRemnants(context) {
        for (; !context.isEof(); context.consumeCodePoint()) {
            if (context.code === 41 ) {
                context.consumeCodePoint();
                return;
            }
            if (checkForValidEscape(context.getRelativeCode(1), context.getRelativeCode(2))) {
                context.consumeCodePoint();
                consumeEscapedCodePoint(context);
                continue;
            }
        }
    }
    function consumeBadUrlToken(context, start) {
        consumeBadUrlRemnants(context);
        context.onToken(TokenType$1.BadUrl, start, context.offset);
    }
    const consumeUrlToken = (context, start) => {
        while (isWhitespace$1(context.code)) {
            context.consumeCodePoint();
        }
        while (context.offset <= context.length) {
            if (context.code === 41 ) {
                context.consumeCodePoint();
                context.onToken(TokenType$1.Url, start, context.offset);
                return;
            }
            if (context.isEof()) {
                context.onToken(TokenType$1.Url, start, context.offset);
                context.onError("Unexpected end of file while parsing URL." , start, context.offset);
                return;
            }
            if (isWhitespace$1(context.code)) {
                while (isWhitespace$1(context.code)) {
                    context.consumeCodePoint();
                }
                if (context.code === 41  || context.isEof()) {
                    context.consumeCodePoint();
                    context.onToken(TokenType$1.Url, start, context.offset);
                    context.onError("Unexpected end of file while parsing URL." , start, context.offset);
                    return;
                }
                context.onError("Unexpected character in URL." , start, context.offset);
                consumeBadUrlToken(context, start);
                return;
            }
            if (context.code === 34
                || context.code === 39
                || context.code === 40
                || isNonPrintableCodePoint(context.code)) {
                context.onError("Unexpected character in URL." , start, context.offset);
                consumeBadUrlToken(context, start);
                return;
            }
            if (context.code === 92 ) {
                if (checkForValidEscape(context.code, context.nextCode)) {
                    context.consumeCodePoint();
                    consumeEscapedCodePoint(context);
                    continue;
                }
                context.onError("Unexpected character in URL." , start, context.offset);
                consumeBadUrlToken(context, start);
                return;
            }
            context.consumeCodePoint();
        }
    };
    const URL_FUNCTION_HASH = 193422222;
    const consumeIdentLikeToken = (context) => {
        const start = context.offset;
        consumeIndentSequence(context);
        if (context.code === 40 ) {
            const fnHash = context.getHashFrom(start);
            context.consumeCodePoint();
            if (fnHash === URL_FUNCTION_HASH) {
                const nextNonWsCode = context.getNextNonWsCode();
                if (nextNonWsCode === 34  || nextNonWsCode === 39 ) {
                    context.onToken(TokenType$1.Function, start, context.offset);
                    return;
                }
                consumeUrlToken(context, start);
                return;
            }
            if (context.hasFunctionHandler(fnHash)) {
                context.onToken(TokenType$1.Function, start, context.offset);
                context.getFunctionHandler(fnHash)(context);
                return;
            }
            context.onToken(TokenType$1.Function, start, context.offset);
            return;
        }
        context.onToken(TokenType$1.Ident, start, context.offset);
    };
    const consumeNumber = (context) => {
        if (context.code === 43  || context.code === 45 ) {
            context.consumeCodePoint();
        }
        while (isDigit(context.code)) {
            context.consumeCodePoint();
        }
        if (context.code === 46  && isDigit(context.nextCode)) {
            context.consumeCodePoint(2);
            while (isDigit(context.code)) {
                context.consumeCodePoint();
            }
        }
        if ((context.code === 69  || context.code === 101 )) {
            if ((context.nextCode === 45  || context.nextCode === 43 )
                && isDigit(context.getRelativeCode(2))) {
                context.consumeCodePoint(3);
                while (isDigit(context.code)) {
                    context.consumeCodePoint();
                }
            }
            else if (isDigit(context.nextCode)) {
                context.consumeCodePoint(2);
                while (isDigit(context.code)) {
                    context.consumeCodePoint();
                }
            }
        }
    };
    const consumeNumericToken = (context) => {
        const start = context.offset;
        consumeNumber(context);
        if (checkForIdentStart(context.code, context.nextCode, context.getRelativeCode(2))) {
            consumeIndentSequence(context);
            context.onToken(TokenType$1.Dimension, start, context.offset);
            return;
        }
        if (context.code === 37 ) {
            context.consumeCodePoint();
            context.onToken(TokenType$1.Percentage, start, context.offset);
            return;
        }
        context.onToken(TokenType$1.Number, start, context.offset);
    };
    const consumeStringToken = (context) => {
        const endingCodePoint = context.code;
        const start = context.offset;
        context.consumeCodePoint();
        while (context.isLessThanEqualToEof()) {
            switch (context.code) {
                case endingCodePoint:
                    context.consumeCodePoint();
                    context.onToken(TokenType$1.String, start, context.offset);
                    return;
                case -1 :
                    context.onToken(TokenType$1.String, start, context.offset);
                    context.onError("Unexpected end of file while parsing string token." , start, context.offset);
                    return;
                case 13 :
                case 10 :
                case 12 :
                    if (context.code === 13  && context.nextCode === 10 ) {
                        context.consumeCodePoint(1);
                    }
                    context.consumeCodePoint(1);
                    context.onToken(TokenType$1.BadString, start, context.offset);
                    context.onError("Unexpected newline while parsing string token." , start, context.offset);
                    return;
                case 92 :
                    if (context.isNextEof()) {
                        context.consumeCodePoint();
                        context.onToken(TokenType$1.String, start, context.offset);
                        context.onError("Unexpected end of file while parsing string token." , start, context.offset);
                        return;
                    }
                    if (isNewline(context.nextCode)) {
                        context.consumeCodePoint(2);
                        break;
                    }
                    if (checkForValidEscape(context.code, context.nextCode)) {
                        context.consumeCodePoint();
                        consumeEscapedCodePoint(context);
                    }
                    break;
                default:
                    context.consumeCodePoint();
            }
        }
    };
    const consumeWhitespaceToken = (context) => {
        const start = context.offset;
        context.consumeWhitespace();
        context.onToken(TokenType$1.Whitespace, start, context.offset);
    };
    const tokenize = (source, onToken, onError = () => { }, functionHandlers) => {
        const context = new TokenizerContext(source, onToken, onError, functionHandlers);
        while (!context.isEof()) {
            switch (context.code) {
                case 9 :
                case 32 :
                case 10 :
                case 12 :
                case 13 :
                    consumeWhitespaceToken(context);
                    break;
                case 48 :
                case 49 :
                case 50 :
                case 51 :
                case 52 :
                case 53 :
                case 54 :
                case 55 :
                case 56 :
                case 57 :
                    consumeNumericToken(context);
                    break;
                case 40 :
                    context.consumeTrivialToken(TokenType$1.OpenParenthesis);
                    break;
                case 41 :
                    context.consumeTrivialToken(TokenType$1.CloseParenthesis);
                    break;
                case 44 :
                    context.consumeTrivialToken(TokenType$1.Comma);
                    break;
                case 58 :
                    context.consumeTrivialToken(TokenType$1.Colon);
                    break;
                case 59 :
                    context.consumeTrivialToken(TokenType$1.Semicolon);
                    break;
                case 91 :
                    context.consumeTrivialToken(TokenType$1.OpenSquareBracket);
                    break;
                case 93 :
                    context.consumeTrivialToken(TokenType$1.CloseSquareBracket);
                    break;
                case 123 :
                    context.consumeTrivialToken(TokenType$1.OpenCurlyBracket);
                    break;
                case 125 :
                    context.consumeTrivialToken(TokenType$1.CloseCurlyBracket);
                    break;
                case 39 :
                case 34 :
                    consumeStringToken(context);
                    break;
                case 35 :
                    if (isIdentCodePoint(context.getRelativeCode(1))
                        || checkForValidEscape(context.getRelativeCode(1), context.getRelativeCode(2))) {
                        const start = context.offset;
                        context.consumeCodePoint();
                        consumeIndentSequence(context);
                        context.onToken(TokenType$1.Hash, start, context.offset);
                        break;
                    }
                    context.consumeTrivialToken(TokenType$1.Delim);
                    break;
                case 43 :
                    if (checkForNumberStart(context.code, context.getRelativeCode(1), context.getRelativeCode(2))) {
                        consumeNumericToken(context);
                        break;
                    }
                    context.consumeTrivialToken(TokenType$1.Delim);
                    break;
                case 45 :
                    if (checkForNumberStart(context.code, context.getRelativeCode(1), context.getRelativeCode(2))) {
                        consumeNumericToken(context);
                        break;
                    }
                    if (context.getRelativeCode(1) === 45
                        && context.getRelativeCode(2) === 62 ) {
                        context.consumeCodePoint(3);
                        context.onToken(TokenType$1.Cdc, context.offset - 3, context.offset);
                        break;
                    }
                    if (checkForIdentStart(context.code, context.getRelativeCode(1), context.getRelativeCode(2))) {
                        consumeIdentLikeToken(context);
                        break;
                    }
                    context.consumeTrivialToken(TokenType$1.Delim);
                    break;
                case 46 :
                    if (checkForNumberStart(context.code, context.getRelativeCode(1), context.getRelativeCode(2))) {
                        consumeNumericToken(context);
                        break;
                    }
                    context.consumeTrivialToken(TokenType$1.Delim);
                    break;
                case 60 :
                    if (context.getRelativeCode(1) === 33
                        && context.getRelativeCode(2) === 45
                        && context.getRelativeCode(3) === 45 ) {
                        context.consumeCodePoint(4);
                        context.onToken(TokenType$1.Cdo, context.offset - 4, context.offset);
                        break;
                    }
                    context.consumeTrivialToken(TokenType$1.Delim);
                    break;
                case 64 :
                    if (checkForIdentStart(context.getRelativeCode(1), context.getRelativeCode(2), context.getRelativeCode(3))) {
                        const start = context.offset;
                        context.consumeCodePoint();
                        consumeIndentSequence(context);
                        context.onToken(TokenType$1.AtKeyword, start, context.offset);
                        break;
                    }
                    context.consumeTrivialToken(TokenType$1.Delim);
                    break;
                case 92 :
                    if (checkForValidEscape(context.code, context.getRelativeCode(1))) {
                        consumeIdentLikeToken(context);
                        break;
                    }
                    context.consumeTrivialToken(TokenType$1.Delim);
                    context.onError("Invalid escape sequence." , context.offset - 1, context.offset);
                    break;
                case 47 :
                    if (context.getRelativeCode(1) === 42 ) {
                        const start = context.offset;
                        context.consumeCodePoint(2);
                        context.consumeUntilCommentEnd();
                        if (context.isEof()) {
                            context.onError("Unterminated comment." , start, context.length - 2);
                        }
                        context.onToken(TokenType$1.Comment, start, context.offset);
                        break;
                    }
                    context.consumeTrivialToken(TokenType$1.Delim);
                    break;
                default:
                    if (isIdentStartCodePoint(context.code)) {
                        consumeIdentLikeToken(context);
                        break;
                    }
                    context.consumeTrivialToken(TokenType$1.Delim);
            }
        }
    };
    const handleRegularExtendedCssPseudo = (context) => {
        const start = context.offset;
        context.consumeWhitespace();
        if (context.code === 39  || context.code === 34 ) {
            if (context.offset > start) {
                context.onToken(TokenType$1.Whitespace, start, context.offset);
            }
            return;
        }
        let balance = 1;
        for (let i = start; i < context.offset; i += 1) {
            context.onToken(TokenType$1.Delim, i, i + 1);
        }
        while (!context.isEof()) {
            if (context.code === 40  && context.prevCode !== 92 ) {
                balance += 1;
            }
            else if (context.code === 41  && context.prevCode !== 92 ) {
                balance -= 1;
                if (balance === 0) {
                    break;
                }
            }
            context.consumeTrivialToken(TokenType$1.Delim);
        }
    };
    const handleXpathExtendedCssPseudo = (context) => {
        const start = context.offset;
        context.consumeWhitespace();
        if (context.code === 39  || context.code === 34 ) {
            if (context.offset > start) {
                context.onToken(TokenType$1.Whitespace, start, context.offset);
            }
            return;
        }
        let balance = 1;
        for (let i = start; i < context.offset; i += 1) {
            context.onToken(TokenType$1.Delim, i, i + 1);
        }
        let inString = false;
        while (!context.isEof()) {
            if (context.code === 34  && context.prevCode !== 92 ) {
                inString = !inString;
            }
            if (!inString) {
                if (context.code === 40  && context.prevCode !== 92 ) {
                    balance += 1;
                }
                else if (context.code === 41  && context.prevCode !== 92 ) {
                    balance -= 1;
                    if (balance === 0) {
                        break;
                    }
                }
            }
            context.consumeTrivialToken(TokenType$1.Delim);
        }
    };
    function mergeMaps(map1, map2) {
        const result = new Map();
        for (const [key, value] of map1) {
            result.set(key, value);
        }
        for (const [key, value] of map2) {
            result.set(key, value);
        }
        return result;
    }
    const ABP_CONTAINS_HASH = 1989084725;
    const CONTAINS_HASH = 2399470598;
    const HAS_TEXT_HASH = 1221663855;
    const MATCHES_CSS_HASH = 102304302;
    const MATCHES_CSS_AFTER_HASH = 2923888231;
    const MATCHES_CSS_BEFORE_HASH = 1739713050;
    const MATCHES_PROPERTY_HASH = 1860790666;
    const MATCHES_ATTR_HASH = 3376104318;
    const XPATH_HASH = 196571984;
    const EXT_CSS_PSEUDO_HANDLERS = new Map([
        [ABP_CONTAINS_HASH, handleRegularExtendedCssPseudo],
        [CONTAINS_HASH, handleRegularExtendedCssPseudo],
        [HAS_TEXT_HASH, handleRegularExtendedCssPseudo],
        [MATCHES_CSS_HASH, handleRegularExtendedCssPseudo],
        [MATCHES_CSS_AFTER_HASH, handleRegularExtendedCssPseudo],
        [MATCHES_CSS_BEFORE_HASH, handleRegularExtendedCssPseudo],
        [MATCHES_PROPERTY_HASH, handleRegularExtendedCssPseudo],
        [MATCHES_ATTR_HASH, handleRegularExtendedCssPseudo],
        [XPATH_HASH, handleXpathExtendedCssPseudo],
    ]);
    function tokenizeExtended(source, onToken, onError = () => { }, functionHandlers = new Map()) {
        tokenize(source, onToken, onError,
        functionHandlers.size > 0
            ? mergeMaps(EXT_CSS_PSEUDO_HANDLERS, functionHandlers)
            : EXT_CSS_PSEUDO_HANDLERS);
    }
    function shareSameDomainSuffix(hostname, vhost) {
      if (hostname.endsWith(vhost)) {
        return hostname.length === vhost.length || hostname[hostname.length - vhost.length - 1] === '.';
      }
      return false;
    }
    function extractDomainWithSuffix(hostname, publicSuffix) {
      var publicSuffixIndex = hostname.length - publicSuffix.length - 2;
      var lastDotBeforeSuffixIndex = hostname.lastIndexOf('.', publicSuffixIndex);
      if (lastDotBeforeSuffixIndex === -1) {
        return hostname;
      }
      return hostname.slice(lastDotBeforeSuffixIndex + 1);
    }
    function getDomain$1(suffix, hostname, options) {
      if (options.validHosts !== null) {
        var validHosts = options.validHosts;
        for (var i = 0; i < validHosts.length; i += 1) {
          var vhost = validHosts[i];
          if ( shareSameDomainSuffix(hostname, vhost) === true) {
            return vhost;
          }
        }
      }
      if (suffix.length === hostname.length) {
        return null;
      }
      return (extractDomainWithSuffix(hostname, suffix)
      );
    }
    function getDomainWithoutSuffix(domain, suffix) {
      return domain.slice(0, -suffix.length - 1);
    }
    function extractHostname(url, urlIsValidHostname) {
      var start = 0;
      var end = url.length;
      var hasUpper = false;
      if (urlIsValidHostname === false) {
        if (url.startsWith('data:') === true) {
          return null;
        }
        while (start < url.length && url.charCodeAt(start) <= 32) {
          start += 1;
        }
        while (end > start + 1 && url.charCodeAt(end - 1) <= 32) {
          end -= 1;
        }
        if (url.charCodeAt(start) === 47  && url.charCodeAt(start + 1) === 47 ) {
          start += 2;
        } else {
          var indexOfProtocol = url.indexOf(':/', start);
          if (indexOfProtocol !== -1) {
            var protocolSize = indexOfProtocol - start;
            var c0 = url.charCodeAt(start);
            var c1 = url.charCodeAt(start + 1);
            var c2 = url.charCodeAt(start + 2);
            var c3 = url.charCodeAt(start + 3);
            var c4 = url.charCodeAt(start + 4);
            if (protocolSize === 5 && c0 === 104  && c1 === 116  && c2 === 116  && c3 === 112  && c4 === 115 ) ; else if (protocolSize === 4 && c0 === 104  && c1 === 116  && c2 === 116  && c3 === 112 ) ; else if (protocolSize === 3 && c0 === 119  && c1 === 115  && c2 === 115 ) ; else if (protocolSize === 2 && c0 === 119  && c1 === 115 ) ; else {
              for (var i = start; i < indexOfProtocol; i += 1) {
                var lowerCaseCode = url.charCodeAt(i) | 32;
                if ((lowerCaseCode >= 97 && lowerCaseCode <= 122 ||
                lowerCaseCode >= 48 && lowerCaseCode <= 57 ||
                lowerCaseCode === 46 ||
                lowerCaseCode === 45 ||
                lowerCaseCode === 43) === false
                ) {
                  return null;
                }
              }
            }
            start = indexOfProtocol + 2;
            while (url.charCodeAt(start) === 47 ) {
              start += 1;
            }
          }
        }
        var indexOfIdentifier = -1;
        var indexOfClosingBracket = -1;
        var indexOfPort = -1;
        for (var _i = start; _i < end; _i += 1) {
          var code = url.charCodeAt(_i);
          if (code === 35 ||
          code === 47 ||
          code === 63
          ) {
            end = _i;
            break;
          } else if (code === 64) {
            indexOfIdentifier = _i;
          } else if (code === 93) {
            indexOfClosingBracket = _i;
          } else if (code === 58) {
            indexOfPort = _i;
          } else if (code >= 65 && code <= 90) {
            hasUpper = true;
          }
        }
        if (indexOfIdentifier !== -1 && indexOfIdentifier > start && indexOfIdentifier < end) {
          start = indexOfIdentifier + 1;
        }
        if (url.charCodeAt(start) === 91 ) {
          if (indexOfClosingBracket !== -1) {
            return url.slice(start + 1, indexOfClosingBracket).toLowerCase();
          }
          return null;
        } else if (indexOfPort !== -1 && indexOfPort > start && indexOfPort < end) {
          end = indexOfPort;
        }
      }
      while (end > start + 1 && url.charCodeAt(end - 1) === 46 ) {
        end -= 1;
      }
      var hostname = start !== 0 || end !== url.length ? url.slice(start, end) : url;
      if (hasUpper) {
        return hostname.toLowerCase();
      }
      return hostname;
    }
    function isProbablyIpv4(hostname) {
      if (hostname.length < 7) {
        return false;
      }
      if (hostname.length > 15) {
        return false;
      }
      var numberOfDots = 0;
      for (var i = 0; i < hostname.length; i += 1) {
        var code = hostname.charCodeAt(i);
        if (code === 46 ) {
          numberOfDots += 1;
        } else if (code < 48  || code > 57 ) {
          return false;
        }
      }
      return numberOfDots === 3 && hostname.charCodeAt(0) !== 46  && hostname.charCodeAt(hostname.length - 1) !== 46 ;
    }
    function isProbablyIpv6(hostname) {
      if (hostname.length < 3) {
        return false;
      }
      var start = hostname[0] === '[' ? 1 : 0;
      var end = hostname.length;
      if (hostname[end - 1] === ']') {
        end -= 1;
      }
      if (end - start > 39) {
        return false;
      }
      var hasColon = false;
      for (; start < end; start += 1) {
        var code = hostname.charCodeAt(start);
        if (code === 58 ) {
          hasColon = true;
        } else if ((code >= 48 && code <= 57 ||
        code >= 97 && code <= 102 ||
        code >= 65 && code <= 90) ===
        false) {
          return false;
        }
      }
      return hasColon;
    }
    function isIp$2(hostname) {
      return isProbablyIpv6(hostname) || isProbablyIpv4(hostname);
    }
    function isValidAscii(code) {
      return code >= 97 && code <= 122 || code >= 48 && code <= 57 || code > 127;
    }
    function isValidHostname (hostname) {
      if (hostname.length > 255) {
        return false;
      }
      if (hostname.length === 0) {
        return false;
      }
      if ( isValidAscii(hostname.charCodeAt(0)) === false) {
        return false;
      }
      var lastDotIndex = -1;
      var lastCharCode = -1;
      var len = hostname.length;
      for (var i = 0; i < len; i += 1) {
        var code = hostname.charCodeAt(i);
        if (code === 46 ) {
          if (
          i - lastDotIndex > 64 ||
          lastCharCode === 46 ||
          lastCharCode === 45 ||
          lastCharCode === 95) {
            return false;
          }
          lastDotIndex = i;
        } else if (( isValidAscii(code) || code === 45 || code === 95) === false) {
          return false;
        }
        lastCharCode = code;
      }
      return (
        len - lastDotIndex - 1 <= 63 &&
        lastCharCode !== 45
      );
    }
    function setDefaultsImpl(_ref) {
      var _ref$allowIcannDomain = _ref.allowIcannDomains,
        allowIcannDomains = _ref$allowIcannDomain === void 0 ? true : _ref$allowIcannDomain,
        _ref$allowPrivateDoma = _ref.allowPrivateDomains,
        allowPrivateDomains = _ref$allowPrivateDoma === void 0 ? false : _ref$allowPrivateDoma,
        _ref$detectIp = _ref.detectIp,
        detectIp = _ref$detectIp === void 0 ? true : _ref$detectIp,
        _ref$extractHostname = _ref.extractHostname,
        extractHostname = _ref$extractHostname === void 0 ? true : _ref$extractHostname,
        _ref$mixedInputs = _ref.mixedInputs,
        mixedInputs = _ref$mixedInputs === void 0 ? true : _ref$mixedInputs,
        _ref$validHosts = _ref.validHosts,
        validHosts = _ref$validHosts === void 0 ? null : _ref$validHosts,
        _ref$validateHostname = _ref.validateHostname,
        validateHostname = _ref$validateHostname === void 0 ? true : _ref$validateHostname;
      return {
        allowIcannDomains,
        allowPrivateDomains,
        detectIp,
        extractHostname,
        mixedInputs,
        validHosts,
        validateHostname
      };
    }
    var DEFAULT_OPTIONS = setDefaultsImpl({});
    function setDefaults(options) {
      if (options === undefined) {
        return DEFAULT_OPTIONS;
      }
      return (setDefaultsImpl(options)
      );
    }
    function getSubdomain(hostname, domain) {
      if (domain.length === hostname.length) {
        return '';
      }
      return hostname.slice(0, -domain.length - 1);
    }
    function getEmptyResult() {
      return {
        domain: null,
        domainWithoutSuffix: null,
        hostname: null,
        isIcann: null,
        isIp: null,
        isPrivate: null,
        publicSuffix: null,
        subdomain: null
      };
    }
    function resetResult(result) {
      result.domain = null;
      result.domainWithoutSuffix = null;
      result.hostname = null;
      result.isIcann = null;
      result.isIp = null;
      result.isPrivate = null;
      result.publicSuffix = null;
      result.subdomain = null;
    }
    function parseImpl(url, step, suffixLookup, partialOptions, result) {
      var options = setDefaults(partialOptions);
      if (typeof url !== 'string') {
        return result;
      }
      if (options.extractHostname === false) {
        result.hostname = url;
      } else if (options.mixedInputs === true) {
        result.hostname = extractHostname(url, isValidHostname(url));
      } else {
        result.hostname = extractHostname(url, false);
      }
      if (step === 0  || result.hostname === null) {
        return result;
      }
      if (options.detectIp === true) {
        result.isIp = isIp$2(result.hostname);
        if (result.isIp === true) {
          return result;
        }
      }
      if (options.validateHostname === true && options.extractHostname === true && isValidHostname(result.hostname) === false) {
        result.hostname = null;
        return result;
      }
      suffixLookup(result.hostname, options, result);
      if (step === 2  || result.publicSuffix === null) {
        return result;
      }
      result.domain = getDomain$1(result.publicSuffix, result.hostname, options);
      if (step === 3  || result.domain === null) {
        return result;
      }
      result.subdomain = getSubdomain(result.hostname, result.domain);
      if (step === 4 ) {
        return result;
      }
      result.domainWithoutSuffix = getDomainWithoutSuffix(result.domain, result.publicSuffix);
      return result;
    }
    function fastPathLookup (hostname, options, out) {
      if (options.allowPrivateDomains === false && hostname.length > 3) {
        var last = hostname.length - 1;
        var c3 = hostname.charCodeAt(last);
        var c2 = hostname.charCodeAt(last - 1);
        var c1 = hostname.charCodeAt(last - 2);
        var c0 = hostname.charCodeAt(last - 3);
        if (c3 === 109  && c2 === 111  && c1 === 99  && c0 === 46 ) {
          out.isIcann = true;
          out.isPrivate = false;
          out.publicSuffix = 'com';
          return true;
        } else if (c3 === 103  && c2 === 114  && c1 === 111  && c0 === 46 ) {
          out.isIcann = true;
          out.isPrivate = false;
          out.publicSuffix = 'org';
          return true;
        } else if (c3 === 117  && c2 === 100  && c1 === 101  && c0 === 46 ) {
          out.isIcann = true;
          out.isPrivate = false;
          out.publicSuffix = 'edu';
          return true;
        } else if (c3 === 118  && c2 === 111  && c1 === 103  && c0 === 46 ) {
          out.isIcann = true;
          out.isPrivate = false;
          out.publicSuffix = 'gov';
          return true;
        } else if (c3 === 116  && c2 === 101  && c1 === 110  && c0 === 46 ) {
          out.isIcann = true;
          out.isPrivate = false;
          out.publicSuffix = 'net';
          return true;
        } else if (c3 === 101  && c2 === 100  && c1 === 46 ) {
          out.isIcann = true;
          out.isPrivate = false;
          out.publicSuffix = 'de';
          return true;
        }
      }
      return false;
    }
    var exceptions = function () {
      var _0 = {
          "$": 1,
          "succ": {}
        },
        _1 = {
          "$": 0,
          "succ": {
            "city": _0
          }
        };
      var exceptions = {
        "$": 0,
        "succ": {
          "ck": {
            "$": 0,
            "succ": {
              "www": _0
            }
          },
          "jp": {
            "$": 0,
            "succ": {
              "kawasaki": _1,
              "kitakyushu": _1,
              "kobe": _1,
              "nagoya": _1,
              "sapporo": _1,
              "sendai": _1,
              "yokohama": _1
            }
          }
        }
      };
      return exceptions;
    }();
    var rules = function () {
      var _2 = {
          "$": 1,
          "succ": {}
        },
        _3 = {
          "$": 2,
          "succ": {}
        },
        _4 = {
          "$": 1,
          "succ": {
            "gov": _2,
            "com": _2,
            "org": _2,
            "net": _2,
            "edu": _2
          }
        },
        _5 = {
          "$": 0,
          "succ": {
            "*": _3
          }
        },
        _6 = {
          "$": 1,
          "succ": {
            "blogspot": _3
          }
        },
        _7 = {
          "$": 1,
          "succ": {
            "gov": _2
          }
        },
        _8 = {
          "$": 0,
          "succ": {
            "*": _2
          }
        },
        _9 = {
          "$": 0,
          "succ": {
            "cloud": _3
          }
        },
        _10 = {
          "$": 1,
          "succ": {
            "co": _3
          }
        },
        _11 = {
          "$": 2,
          "succ": {
            "nodes": _3
          }
        },
        _12 = {
          "$": 0,
          "succ": {
            "s3": _3
          }
        },
        _13 = {
          "$": 0,
          "succ": {
            "direct": _3
          }
        },
        _14 = {
          "$": 2,
          "succ": {
            "id": _3
          }
        },
        _15 = {
          "$": 0,
          "succ": {
            "vfs": _3,
            "webview-assets": _3
          }
        },
        _16 = {
          "$": 0,
          "succ": {
            "cloud9": _15
          }
        },
        _17 = {
          "$": 0,
          "succ": {
            "dualstack": _12,
            "cloud9": _15
          }
        },
        _18 = {
          "$": 0,
          "succ": {
            "dualstack": _12,
            "s3": _3,
            "s3-website": _3,
            "cloud9": _15
          }
        },
        _19 = {
          "$": 0,
          "succ": {
            "apps": _3
          }
        },
        _20 = {
          "$": 0,
          "succ": {
            "paas": _3
          }
        },
        _21 = {
          "$": 0,
          "succ": {
            "app": _3
          }
        },
        _22 = {
          "$": 2,
          "succ": {
            "eu": _3
          }
        },
        _23 = {
          "$": 0,
          "succ": {
            "site": _3
          }
        },
        _24 = {
          "$": 0,
          "succ": {
            "pages": _3
          }
        },
        _25 = {
          "$": 1,
          "succ": {
            "com": _2,
            "edu": _2,
            "net": _2,
            "org": _2
          }
        },
        _26 = {
          "$": 0,
          "succ": {
            "j": _3
          }
        },
        _27 = {
          "$": 0,
          "succ": {
            "jelastic": _3
          }
        },
        _28 = {
          "$": 0,
          "succ": {
            "user": _3
          }
        },
        _29 = {
          "$": 1,
          "succ": {
            "ybo": _3
          }
        },
        _30 = {
          "$": 0,
          "succ": {
            "cust": _3,
            "reservd": _3
          }
        },
        _31 = {
          "$": 0,
          "succ": {
            "cust": _3
          }
        },
        _32 = {
          "$": 1,
          "succ": {
            "gov": _2,
            "edu": _2,
            "mil": _2,
            "com": _2,
            "org": _2,
            "net": _2
          }
        },
        _33 = {
          "$": 1,
          "succ": {
            "edu": _2,
            "biz": _2,
            "net": _2,
            "org": _2,
            "gov": _2,
            "info": _2,
            "com": _2
          }
        },
        _34 = {
          "$": 1,
          "succ": {
            "gov": _2,
            "blogspot": _3
          }
        },
        _35 = {
          "$": 1,
          "succ": {
            "framer": _3
          }
        },
        _36 = {
          "$": 1,
          "succ": {
            "barsy": _3
          }
        },
        _37 = {
          "$": 0,
          "succ": {
            "forgot": _3
          }
        },
        _38 = {
          "$": 1,
          "succ": {
            "gs": _2
          }
        },
        _39 = {
          "$": 0,
          "succ": {
            "nes": _2
          }
        },
        _40 = {
          "$": 1,
          "succ": {
            "k12": _2,
            "cc": _2,
            "lib": _2
          }
        },
        _41 = {
          "$": 1,
          "succ": {
            "cc": _2,
            "lib": _2
          }
        };
      var rules = {
        "$": 0,
        "succ": {
          "ac": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "net": _2,
              "mil": _2,
              "org": _2,
              "drr": _3
            }
          },
          "ad": {
            "$": 1,
            "succ": {
              "nom": _2
            }
          },
          "ae": {
            "$": 1,
            "succ": {
              "co": _2,
              "net": _2,
              "org": _2,
              "sch": _2,
              "ac": _2,
              "gov": _2,
              "mil": _2,
              "blogspot": _3
            }
          },
          "aero": {
            "$": 1,
            "succ": {
              "accident-investigation": _2,
              "accident-prevention": _2,
              "aerobatic": _2,
              "aeroclub": _2,
              "aerodrome": _2,
              "agents": _2,
              "aircraft": _2,
              "airline": _2,
              "airport": _2,
              "air-surveillance": _2,
              "airtraffic": _2,
              "air-traffic-control": _2,
              "ambulance": _2,
              "amusement": _2,
              "association": _2,
              "author": _2,
              "ballooning": _2,
              "broker": _2,
              "caa": _2,
              "cargo": _2,
              "catering": _2,
              "certification": _2,
              "championship": _2,
              "charter": _2,
              "civilaviation": _2,
              "club": _2,
              "conference": _2,
              "consultant": _2,
              "consulting": _2,
              "control": _2,
              "council": _2,
              "crew": _2,
              "design": _2,
              "dgca": _2,
              "educator": _2,
              "emergency": _2,
              "engine": _2,
              "engineer": _2,
              "entertainment": _2,
              "equipment": _2,
              "exchange": _2,
              "express": _2,
              "federation": _2,
              "flight": _2,
              "fuel": _2,
              "gliding": _2,
              "government": _2,
              "groundhandling": _2,
              "group": _2,
              "hanggliding": _2,
              "homebuilt": _2,
              "insurance": _2,
              "journal": _2,
              "journalist": _2,
              "leasing": _2,
              "logistics": _2,
              "magazine": _2,
              "maintenance": _2,
              "media": _2,
              "microlight": _2,
              "modelling": _2,
              "navigation": _2,
              "parachuting": _2,
              "paragliding": _2,
              "passenger-association": _2,
              "pilot": _2,
              "press": _2,
              "production": _2,
              "recreation": _2,
              "repbody": _2,
              "res": _2,
              "research": _2,
              "rotorcraft": _2,
              "safety": _2,
              "scientist": _2,
              "services": _2,
              "show": _2,
              "skydiving": _2,
              "software": _2,
              "student": _2,
              "trader": _2,
              "trading": _2,
              "trainer": _2,
              "union": _2,
              "workinggroup": _2,
              "works": _2
            }
          },
          "af": _4,
          "ag": {
            "$": 1,
            "succ": {
              "com": _2,
              "org": _2,
              "net": _2,
              "co": _2,
              "nom": _2
            }
          },
          "ai": {
            "$": 1,
            "succ": {
              "off": _2,
              "com": _2,
              "net": _2,
              "org": _2,
              "uwu": _3
            }
          },
          "al": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "mil": _2,
              "net": _2,
              "org": _2,
              "blogspot": _3
            }
          },
          "am": {
            "$": 1,
            "succ": {
              "co": _2,
              "com": _2,
              "commune": _2,
              "net": _2,
              "org": _2,
              "radio": _3,
              "blogspot": _3,
              "neko": _3,
              "nyaa": _3
            }
          },
          "ao": {
            "$": 1,
            "succ": {
              "ed": _2,
              "gv": _2,
              "og": _2,
              "co": _2,
              "pb": _2,
              "it": _2
            }
          },
          "aq": _2,
          "ar": {
            "$": 1,
            "succ": {
              "bet": _2,
              "com": _6,
              "coop": _2,
              "edu": _2,
              "gob": _2,
              "gov": _2,
              "int": _2,
              "mil": _2,
              "musica": _2,
              "mutual": _2,
              "net": _2,
              "org": _2,
              "senasa": _2,
              "tur": _2
            }
          },
          "arpa": {
            "$": 1,
            "succ": {
              "e164": _2,
              "in-addr": _2,
              "ip6": _2,
              "iris": _2,
              "uri": _2,
              "urn": _2
            }
          },
          "as": _7,
          "asia": {
            "$": 1,
            "succ": {
              "cloudns": _3
            }
          },
          "at": {
            "$": 1,
            "succ": {
              "ac": {
                "$": 1,
                "succ": {
                  "sth": _2
                }
              },
              "co": _6,
              "gv": _2,
              "or": _2,
              "funkfeuer": {
                "$": 0,
                "succ": {
                  "wien": _3
                }
              },
              "futurecms": {
                "$": 0,
                "succ": {
                  "*": _3,
                  "ex": _5,
                  "in": _5
                }
              },
              "futurehosting": _3,
              "futuremailing": _3,
              "ortsinfo": {
                "$": 0,
                "succ": {
                  "ex": _5,
                  "kunden": _5
                }
              },
              "biz": _3,
              "info": _3,
              "123webseite": _3,
              "priv": _3,
              "myspreadshop": _3,
              "12hp": _3,
              "2ix": _3,
              "4lima": _3,
              "lima-city": _3
            }
          },
          "au": {
            "$": 1,
            "succ": {
              "com": {
                "$": 1,
                "succ": {
                  "blogspot": _3,
                  "cloudlets": {
                    "$": 0,
                    "succ": {
                      "mel": _3
                    }
                  },
                  "myspreadshop": _3
                }
              },
              "net": _2,
              "org": _2,
              "edu": {
                "$": 1,
                "succ": {
                  "act": _2,
                  "catholic": _2,
                  "nsw": {
                    "$": 1,
                    "succ": {
                      "schools": _2
                    }
                  },
                  "nt": _2,
                  "qld": _2,
                  "sa": _2,
                  "tas": _2,
                  "vic": _2,
                  "wa": _2
                }
              },
              "gov": {
                "$": 1,
                "succ": {
                  "qld": _2,
                  "sa": _2,
                  "tas": _2,
                  "vic": _2,
                  "wa": _2
                }
              },
              "asn": _2,
              "id": _2,
              "info": _2,
              "conf": _2,
              "oz": _2,
              "act": _2,
              "nsw": _2,
              "nt": _2,
              "qld": _2,
              "sa": _2,
              "tas": _2,
              "vic": _2,
              "wa": _2
            }
          },
          "aw": {
            "$": 1,
            "succ": {
              "com": _2
            }
          },
          "ax": {
            "$": 1,
            "succ": {
              "be": _3,
              "cat": _3,
              "es": _3,
              "eu": _3,
              "gg": _3,
              "mc": _3,
              "us": _3,
              "xy": _3
            }
          },
          "az": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "int": _2,
              "gov": _2,
              "org": _2,
              "edu": _2,
              "info": _2,
              "pp": _2,
              "mil": _2,
              "name": _2,
              "pro": _2,
              "biz": _2
            }
          },
          "ba": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "mil": _2,
              "net": _2,
              "org": _2,
              "rs": _3,
              "blogspot": _3
            }
          },
          "bb": {
            "$": 1,
            "succ": {
              "biz": _2,
              "co": _2,
              "com": _2,
              "edu": _2,
              "gov": _2,
              "info": _2,
              "net": _2,
              "org": _2,
              "store": _2,
              "tv": _2
            }
          },
          "bd": _8,
          "be": {
            "$": 1,
            "succ": {
              "ac": _2,
              "webhosting": _3,
              "blogspot": _3,
              "interhostsolutions": _9,
              "kuleuven": {
                "$": 0,
                "succ": {
                  "ezproxy": _3
                }
              },
              "123website": _3,
              "myspreadshop": _3,
              "transurl": _5
            }
          },
          "bf": _7,
          "bg": {
            "$": 1,
            "succ": {
              "0": _2,
              "1": _2,
              "2": _2,
              "3": _2,
              "4": _2,
              "5": _2,
              "6": _2,
              "7": _2,
              "8": _2,
              "9": _2,
              "a": _2,
              "b": _2,
              "c": _2,
              "d": _2,
              "e": _2,
              "f": _2,
              "g": _2,
              "h": _2,
              "i": _2,
              "j": _2,
              "k": _2,
              "l": _2,
              "m": _2,
              "n": _2,
              "o": _2,
              "p": _2,
              "q": _2,
              "r": _2,
              "s": _2,
              "t": _2,
              "u": _2,
              "v": _2,
              "w": _2,
              "x": _2,
              "y": _2,
              "z": _2,
              "blogspot": _3,
              "barsy": _3
            }
          },
          "bh": _4,
          "bi": {
            "$": 1,
            "succ": {
              "co": _2,
              "com": _2,
              "edu": _2,
              "or": _2,
              "org": _2
            }
          },
          "biz": {
            "$": 1,
            "succ": {
              "activetrail": _3,
              "cloudns": _3,
              "jozi": _3,
              "dyndns": _3,
              "for-better": _3,
              "for-more": _3,
              "for-some": _3,
              "for-the": _3,
              "selfip": _3,
              "webhop": _3,
              "orx": _3,
              "mmafan": _3,
              "myftp": _3,
              "no-ip": _3,
              "dscloud": _3
            }
          },
          "bj": {
            "$": 1,
            "succ": {
              "africa": _2,
              "agro": _2,
              "architectes": _2,
              "assur": _2,
              "avocats": _2,
              "co": _2,
              "com": _2,
              "eco": _2,
              "econo": _2,
              "edu": _2,
              "info": _2,
              "loisirs": _2,
              "money": _2,
              "net": _2,
              "org": _2,
              "ote": _2,
              "resto": _2,
              "restaurant": _2,
              "tourism": _2,
              "univ": _2,
              "blogspot": _3
            }
          },
          "bm": _4,
          "bn": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "net": _2,
              "org": _2,
              "co": _3
            }
          },
          "bo": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gob": _2,
              "int": _2,
              "org": _2,
              "net": _2,
              "mil": _2,
              "tv": _2,
              "web": _2,
              "academia": _2,
              "agro": _2,
              "arte": _2,
              "blog": _2,
              "bolivia": _2,
              "ciencia": _2,
              "cooperativa": _2,
              "democracia": _2,
              "deporte": _2,
              "ecologia": _2,
              "economia": _2,
              "empresa": _2,
              "indigena": _2,
              "industria": _2,
              "info": _2,
              "medicina": _2,
              "movimiento": _2,
              "musica": _2,
              "natural": _2,
              "nombre": _2,
              "noticias": _2,
              "patria": _2,
              "politica": _2,
              "profesional": _2,
              "plurinacional": _2,
              "pueblo": _2,
              "revista": _2,
              "salud": _2,
              "tecnologia": _2,
              "tksat": _2,
              "transporte": _2,
              "wiki": _2
            }
          },
          "br": {
            "$": 1,
            "succ": {
              "9guacu": _2,
              "abc": _2,
              "adm": _2,
              "adv": _2,
              "agr": _2,
              "aju": _2,
              "am": _2,
              "anani": _2,
              "aparecida": _2,
              "app": _2,
              "arq": _2,
              "art": _2,
              "ato": _2,
              "b": _2,
              "barueri": _2,
              "belem": _2,
              "bhz": _2,
              "bib": _2,
              "bio": _2,
              "blog": _2,
              "bmd": _2,
              "boavista": _2,
              "bsb": _2,
              "campinagrande": _2,
              "campinas": _2,
              "caxias": _2,
              "cim": _2,
              "cng": _2,
              "cnt": _2,
              "com": {
                "$": 1,
                "succ": {
                  "blogspot": _3,
                  "virtualcloud": {
                    "$": 0,
                    "succ": {
                      "scale": {
                        "$": 0,
                        "succ": {
                          "users": _3
                        }
                      }
                    }
                  },
                  "simplesite": _3
                }
              },
              "contagem": _2,
              "coop": _2,
              "coz": _2,
              "cri": _2,
              "cuiaba": _2,
              "curitiba": _2,
              "def": _2,
              "des": _2,
              "det": _2,
              "dev": _2,
              "ecn": _2,
              "eco": _2,
              "edu": _2,
              "emp": _2,
              "enf": _2,
              "eng": _2,
              "esp": _2,
              "etc": _2,
              "eti": _2,
              "far": _2,
              "feira": _2,
              "flog": _2,
              "floripa": _2,
              "fm": _2,
              "fnd": _2,
              "fortal": _2,
              "fot": _2,
              "foz": _2,
              "fst": _2,
              "g12": _2,
              "geo": _2,
              "ggf": _2,
              "goiania": _2,
              "gov": {
                "$": 1,
                "succ": {
                  "ac": _2,
                  "al": _2,
                  "am": _2,
                  "ap": _2,
                  "ba": _2,
                  "ce": _2,
                  "df": _2,
                  "es": _2,
                  "go": _2,
                  "ma": _2,
                  "mg": _2,
                  "ms": _2,
                  "mt": _2,
                  "pa": _2,
                  "pb": _2,
                  "pe": _2,
                  "pi": _2,
                  "pr": _2,
                  "rj": _2,
                  "rn": _2,
                  "ro": _2,
                  "rr": _2,
                  "rs": _2,
                  "sc": _2,
                  "se": _2,
                  "sp": _2,
                  "to": _2
                }
              },
              "gru": _2,
              "imb": _2,
              "ind": _2,
              "inf": _2,
              "jab": _2,
              "jampa": _2,
              "jdf": _2,
              "joinville": _2,
              "jor": _2,
              "jus": _2,
              "leg": {
                "$": 1,
                "succ": {
                  "ac": _3,
                  "al": _3,
                  "am": _3,
                  "ap": _3,
                  "ba": _3,
                  "ce": _3,
                  "df": _3,
                  "es": _3,
                  "go": _3,
                  "ma": _3,
                  "mg": _3,
                  "ms": _3,
                  "mt": _3,
                  "pa": _3,
                  "pb": _3,
                  "pe": _3,
                  "pi": _3,
                  "pr": _3,
                  "rj": _3,
                  "rn": _3,
                  "ro": _3,
                  "rr": _3,
                  "rs": _3,
                  "sc": _3,
                  "se": _3,
                  "sp": _3,
                  "to": _3
                }
              },
              "lel": _2,
              "log": _2,
              "londrina": _2,
              "macapa": _2,
              "maceio": _2,
              "manaus": _2,
              "maringa": _2,
              "mat": _2,
              "med": _2,
              "mil": _2,
              "morena": _2,
              "mp": _2,
              "mus": _2,
              "natal": _2,
              "net": _2,
              "niteroi": _2,
              "nom": _8,
              "not": _2,
              "ntr": _2,
              "odo": _2,
              "ong": _2,
              "org": _2,
              "osasco": _2,
              "palmas": _2,
              "poa": _2,
              "ppg": _2,
              "pro": _2,
              "psc": _2,
              "psi": _2,
              "pvh": _2,
              "qsl": _2,
              "radio": _2,
              "rec": _2,
              "recife": _2,
              "rep": _2,
              "ribeirao": _2,
              "rio": _2,
              "riobranco": _2,
              "riopreto": _2,
              "salvador": _2,
              "sampa": _2,
              "santamaria": _2,
              "santoandre": _2,
              "saobernardo": _2,
              "saogonca": _2,
              "seg": _2,
              "sjc": _2,
              "slg": _2,
              "slz": _2,
              "sorocaba": _2,
              "srv": _2,
              "taxi": _2,
              "tc": _2,
              "tec": _2,
              "teo": _2,
              "the": _2,
              "tmp": _2,
              "trd": _2,
              "tur": _2,
              "tv": _2,
              "udi": _2,
              "vet": _2,
              "vix": _2,
              "vlog": _2,
              "wiki": _2,
              "zlg": _2
            }
          },
          "bs": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "org": _2,
              "edu": _2,
              "gov": _2,
              "we": _3
            }
          },
          "bt": _4,
          "bv": _2,
          "bw": {
            "$": 1,
            "succ": {
              "co": _2,
              "org": _2
            }
          },
          "by": {
            "$": 1,
            "succ": {
              "gov": _2,
              "mil": _2,
              "com": _6,
              "of": _2,
              "mycloud": _3,
              "mediatech": _3
            }
          },
          "bz": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "org": _2,
              "edu": _2,
              "gov": _2,
              "za": _3,
              "gsj": _3
            }
          },
          "ca": {
            "$": 1,
            "succ": {
              "ab": _2,
              "bc": _2,
              "mb": _2,
              "nb": _2,
              "nf": _2,
              "nl": _2,
              "ns": _2,
              "nt": _2,
              "nu": _2,
              "on": _2,
              "pe": _2,
              "qc": _2,
              "sk": _2,
              "yk": _2,
              "gc": _2,
              "barsy": _3,
              "awdev": _5,
              "co": _3,
              "blogspot": _3,
              "no-ip": _3,
              "myspreadshop": _3
            }
          },
          "cat": _2,
          "cc": {
            "$": 1,
            "succ": {
              "cloudns": _3,
              "ftpaccess": _3,
              "game-server": _3,
              "myphotos": _3,
              "scrapping": _3,
              "twmail": _3,
              "csx": _3,
              "fantasyleague": _3,
              "spawn": {
                "$": 0,
                "succ": {
                  "instances": _3
                }
              }
            }
          },
          "cd": _7,
          "cf": _6,
          "cg": _2,
          "ch": {
            "$": 1,
            "succ": {
              "square7": _3,
              "blogspot": _3,
              "flow": {
                "$": 0,
                "succ": {
                  "ae": {
                    "$": 0,
                    "succ": {
                      "alp1": _3
                    }
                  },
                  "appengine": _3
                }
              },
              "linkyard-cloud": _3,
              "dnsking": _3,
              "gotdns": _3,
              "123website": _3,
              "myspreadshop": _3,
              "firenet": {
                "$": 0,
                "succ": {
                  "*": _3,
                  "svc": _5
                }
              },
              "12hp": _3,
              "2ix": _3,
              "4lima": _3,
              "lima-city": _3
            }
          },
          "ci": {
            "$": 1,
            "succ": {
              "org": _2,
              "or": _2,
              "com": _2,
              "co": _2,
              "edu": _2,
              "ed": _2,
              "ac": _2,
              "net": _2,
              "go": _2,
              "asso": _2,
              "xn--aroport-bya": _2,
              "aéroport": _2,
              "int": _2,
              "presse": _2,
              "md": _2,
              "gouv": _2,
              "fin": _3,
              "nl": _3
            }
          },
          "ck": _8,
          "cl": {
            "$": 1,
            "succ": {
              "co": _2,
              "gob": _2,
              "gov": _2,
              "mil": _2,
              "blogspot": _3
            }
          },
          "cm": {
            "$": 1,
            "succ": {
              "co": _2,
              "com": _2,
              "gov": _2,
              "net": _2
            }
          },
          "cn": {
            "$": 1,
            "succ": {
              "ac": _2,
              "com": {
                "$": 1,
                "succ": {
                  "amazonaws": {
                    "$": 0,
                    "succ": {
                      "compute": _5,
                      "cn-north-1": _12,
                      "eb": {
                        "$": 0,
                        "succ": {
                          "cn-north-1": _3,
                          "cn-northwest-1": _3
                        }
                      },
                      "elb": _5
                    }
                  }
                }
              },
              "edu": _2,
              "gov": _2,
              "net": _2,
              "org": _2,
              "mil": _2,
              "xn--55qx5d": _2,
              "公司": _2,
              "xn--io0a7i": _2,
              "网络": _2,
              "xn--od0alg": _2,
              "網絡": _2,
              "ah": _2,
              "bj": _2,
              "cq": _2,
              "fj": _2,
              "gd": _2,
              "gs": _2,
              "gz": _2,
              "gx": _2,
              "ha": _2,
              "hb": _2,
              "he": _2,
              "hi": _2,
              "hl": _2,
              "hn": _2,
              "jl": _2,
              "js": _2,
              "jx": _2,
              "ln": _2,
              "nm": _2,
              "nx": _2,
              "qh": _2,
              "sc": _2,
              "sd": _2,
              "sh": _2,
              "sn": _2,
              "sx": _2,
              "tj": _2,
              "xj": _2,
              "xz": _2,
              "yn": _2,
              "zj": _2,
              "hk": _2,
              "mo": _2,
              "tw": _2,
              "canva-apps": _3,
              "instantcloud": _3,
              "quickconnect": _13
            }
          },
          "co": {
            "$": 1,
            "succ": {
              "arts": _2,
              "com": _6,
              "edu": _2,
              "firm": _2,
              "gov": _2,
              "info": _2,
              "int": _2,
              "mil": _2,
              "net": _2,
              "nom": _2,
              "org": _2,
              "rec": _2,
              "web": _2,
              "carrd": _3,
              "crd": _3,
              "otap": _5,
              "leadpages": _3,
              "lpages": _3,
              "mypi": _3,
              "n4t": _3,
              "firewalledreplit": _14,
              "repl": _14,
              "supabase": _3
            }
          },
          "com": {
            "$": 1,
            "succ": {
              "devcdnaccesso": _5,
              "adobeaemcloud": {
                "$": 2,
                "succ": {
                  "dev": _5
                }
              },
              "airkitapps": _3,
              "airkitapps-au": _3,
              "aivencloud": _3,
              "kasserver": _3,
              "amazonaws": {
                "$": 0,
                "succ": {
                  "compute": _5,
                  "compute-1": _5,
                  "us-east-1": {
                    "$": 2,
                    "succ": {
                      "dualstack": _12,
                      "cloud9": _15
                    }
                  },
                  "ap-northeast-1": _17,
                  "ap-northeast-2": _18,
                  "ap-south-1": _18,
                  "ap-southeast-1": _17,
                  "ap-southeast-2": _17,
                  "ca-central-1": _18,
                  "eu-central-1": _18,
                  "eu-west-1": _17,
                  "eu-west-2": _18,
                  "eu-west-3": _18,
                  "s3": _3,
                  "s3-ap-northeast-1": _3,
                  "s3-ap-northeast-2": _3,
                  "s3-ap-south-1": _3,
                  "s3-ap-southeast-1": _3,
                  "s3-ap-southeast-2": _3,
                  "s3-ca-central-1": _3,
                  "s3-eu-central-1": _3,
                  "s3-eu-west-1": _3,
                  "s3-eu-west-2": _3,
                  "s3-eu-west-3": _3,
                  "s3-external-1": _3,
                  "s3-fips-us-gov-west-1": _3,
                  "s3-sa-east-1": _3,
                  "s3-us-east-2": _3,
                  "s3-us-gov-west-1": _3,
                  "s3-us-west-1": _3,
                  "s3-us-west-2": _3,
                  "s3-website-ap-northeast-1": _3,
                  "s3-website-ap-southeast-1": _3,
                  "s3-website-ap-southeast-2": _3,
                  "s3-website-eu-west-1": _3,
                  "s3-website-sa-east-1": _3,
                  "s3-website-us-east-1": _3,
                  "s3-website-us-west-1": _3,
                  "s3-website-us-west-2": _3,
                  "sa-east-1": _17,
                  "us-east-2": _18,
                  "af-south-1": _16,
                  "ap-east-1": _16,
                  "ap-northeast-3": _16,
                  "eu-north-1": _16,
                  "eu-south-1": _16,
                  "me-south-1": _16,
                  "us-west-1": _16,
                  "us-west-2": _16,
                  "elb": _5
                }
              },
              "elasticbeanstalk": {
                "$": 2,
                "succ": {
                  "ap-northeast-1": _3,
                  "ap-northeast-2": _3,
                  "ap-northeast-3": _3,
                  "ap-south-1": _3,
                  "ap-southeast-1": _3,
                  "ap-southeast-2": _3,
                  "ca-central-1": _3,
                  "eu-central-1": _3,
                  "eu-west-1": _3,
                  "eu-west-2": _3,
                  "eu-west-3": _3,
                  "sa-east-1": _3,
                  "us-east-1": _3,
                  "us-east-2": _3,
                  "us-gov-west-1": _3,
                  "us-west-1": _3,
                  "us-west-2": _3
                }
              },
              "awsglobalaccelerator": _3,
              "siiites": _3,
              "appspacehosted": _3,
              "appspaceusercontent": _3,
              "on-aptible": _3,
              "myasustor": _3,
              "balena-devices": _3,
              "betainabox": _3,
              "boutir": _3,
              "bplaced": _3,
              "cafjs": _3,
              "canva-apps": _3,
              "br": _3,
              "cn": _3,
              "de": _3,
              "eu": _3,
              "jpn": _3,
              "mex": _3,
              "ru": _3,
              "sa": _3,
              "uk": _3,
              "us": _3,
              "za": _3,
              "ar": _3,
              "hu": _3,
              "kr": _3,
              "no": _3,
              "qc": _3,
              "uy": _3,
              "africa": _3,
              "gr": _3,
              "co": _3,
              "jdevcloud": _3,
              "wpdevcloud": _3,
              "cloudcontrolled": _3,
              "cloudcontrolapp": _3,
              "cf-ipfs": _3,
              "cloudflare-ipfs": _3,
              "trycloudflare": _3,
              "customer-oci": {
                "$": 0,
                "succ": {
                  "*": _3,
                  "oci": _5,
                  "ocp": _5,
                  "ocs": _5
                }
              },
              "dattolocal": _3,
              "dattorelay": _3,
              "dattoweb": _3,
              "mydatto": _3,
              "builtwithdark": _3,
              "datadetect": {
                "$": 0,
                "succ": {
                  "demo": _3,
                  "instance": _3
                }
              },
              "ddns5": _3,
              "discordsays": _3,
              "discordsez": _3,
              "drayddns": _3,
              "dreamhosters": _3,
              "mydrobo": _3,
              "dyndns-at-home": _3,
              "dyndns-at-work": _3,
              "dyndns-blog": _3,
              "dyndns-free": _3,
              "dyndns-home": _3,
              "dyndns-ip": _3,
              "dyndns-mail": _3,
              "dyndns-office": _3,
              "dyndns-pics": _3,
              "dyndns-remote": _3,
              "dyndns-server": _3,
              "dyndns-web": _3,
              "dyndns-wiki": _3,
              "dyndns-work": _3,
              "blogdns": _3,
              "cechire": _3,
              "dnsalias": _3,
              "dnsdojo": _3,
              "doesntexist": _3,
              "dontexist": _3,
              "doomdns": _3,
              "dyn-o-saur": _3,
              "dynalias": _3,
              "est-a-la-maison": _3,
              "est-a-la-masion": _3,
              "est-le-patron": _3,
              "est-mon-blogueur": _3,
              "from-ak": _3,
              "from-al": _3,
              "from-ar": _3,
              "from-ca": _3,
              "from-ct": _3,
              "from-dc": _3,
              "from-de": _3,
              "from-fl": _3,
              "from-ga": _3,
              "from-hi": _3,
              "from-ia": _3,
              "from-id": _3,
              "from-il": _3,
              "from-in": _3,
              "from-ks": _3,
              "from-ky": _3,
              "from-ma": _3,
              "from-md": _3,
              "from-mi": _3,
              "from-mn": _3,
              "from-mo": _3,
              "from-ms": _3,
              "from-mt": _3,
              "from-nc": _3,
              "from-nd": _3,
              "from-ne": _3,
              "from-nh": _3,
              "from-nj": _3,
              "from-nm": _3,
              "from-nv": _3,
              "from-oh": _3,
              "from-ok": _3,
              "from-or": _3,
              "from-pa": _3,
              "from-pr": _3,
              "from-ri": _3,
              "from-sc": _3,
              "from-sd": _3,
              "from-tn": _3,
              "from-tx": _3,
              "from-ut": _3,
              "from-va": _3,
              "from-vt": _3,
              "from-wa": _3,
              "from-wi": _3,
              "from-wv": _3,
              "from-wy": _3,
              "getmyip": _3,
              "gotdns": _3,
              "hobby-site": _3,
              "homelinux": _3,
              "homeunix": _3,
              "iamallama": _3,
              "is-a-anarchist": _3,
              "is-a-blogger": _3,
              "is-a-bookkeeper": _3,
              "is-a-bulls-fan": _3,
              "is-a-caterer": _3,
              "is-a-chef": _3,
              "is-a-conservative": _3,
              "is-a-cpa": _3,
              "is-a-cubicle-slave": _3,
              "is-a-democrat": _3,
              "is-a-designer": _3,
              "is-a-doctor": _3,
              "is-a-financialadvisor": _3,
              "is-a-geek": _3,
              "is-a-green": _3,
              "is-a-guru": _3,
              "is-a-hard-worker": _3,
              "is-a-hunter": _3,
              "is-a-landscaper": _3,
              "is-a-lawyer": _3,
              "is-a-liberal": _3,
              "is-a-libertarian": _3,
              "is-a-llama": _3,
              "is-a-musician": _3,
              "is-a-nascarfan": _3,
              "is-a-nurse": _3,
              "is-a-painter": _3,
              "is-a-personaltrainer": _3,
              "is-a-photographer": _3,
              "is-a-player": _3,
              "is-a-republican": _3,
              "is-a-rockstar": _3,
              "is-a-socialist": _3,
              "is-a-student": _3,
              "is-a-teacher": _3,
              "is-a-techie": _3,
              "is-a-therapist": _3,
              "is-an-accountant": _3,
              "is-an-actor": _3,
              "is-an-actress": _3,
              "is-an-anarchist": _3,
              "is-an-artist": _3,
              "is-an-engineer": _3,
              "is-an-entertainer": _3,
              "is-certified": _3,
              "is-gone": _3,
              "is-into-anime": _3,
              "is-into-cars": _3,
              "is-into-cartoons": _3,
              "is-into-games": _3,
              "is-leet": _3,
              "is-not-certified": _3,
              "is-slick": _3,
              "is-uberleet": _3,
              "is-with-theband": _3,
              "isa-geek": _3,
              "isa-hockeynut": _3,
              "issmarterthanyou": _3,
              "likes-pie": _3,
              "likescandy": _3,
              "neat-url": _3,
              "saves-the-whales": _3,
              "selfip": _3,
              "sells-for-less": _3,
              "sells-for-u": _3,
              "servebbs": _3,
              "simple-url": _3,
              "space-to-rent": _3,
              "teaches-yoga": _3,
              "writesthisblog": _3,
              "digitaloceanspaces": _5,
              "ddnsfree": _3,
              "ddnsgeek": _3,
              "giize": _3,
              "gleeze": _3,
              "kozow": _3,
              "loseyourip": _3,
              "ooguy": _3,
              "theworkpc": _3,
              "mytuleap": _3,
              "tuleap-partners": _3,
              "encoreapi": _3,
              "evennode": {
                "$": 0,
                "succ": {
                  "eu-1": _3,
                  "eu-2": _3,
                  "eu-3": _3,
                  "eu-4": _3,
                  "us-1": _3,
                  "us-2": _3,
                  "us-3": _3,
                  "us-4": _3
                }
              },
              "onfabrica": _3,
              "fbsbx": _19,
              "fastly-edge": _3,
              "fastly-terrarium": _3,
              "fastvps-server": _3,
              "mydobiss": _3,
              "firebaseapp": _3,
              "fldrv": _3,
              "forgeblocks": _3,
              "framercanvas": _3,
              "freebox-os": _3,
              "freeboxos": _3,
              "freemyip": _3,
              "gentapps": _3,
              "gentlentapis": _3,
              "githubusercontent": _3,
              "0emm": _5,
              "appspot": {
                "$": 2,
                "succ": {
                  "r": _5
                }
              },
              "codespot": _3,
              "googleapis": _3,
              "googlecode": _3,
              "pagespeedmobilizer": _3,
              "publishproxy": _3,
              "withgoogle": _3,
              "withyoutube": _3,
              "blogspot": _3,
              "awsmppl": _3,
              "herokuapp": _3,
              "herokussl": _3,
              "impertrixcdn": _3,
              "impertrix": _3,
              "smushcdn": _3,
              "wphostedmail": _3,
              "wpmucdn": _3,
              "pixolino": _3,
              "amscompute": _3,
              "clicketcloud": _3,
              "dopaas": _3,
              "hidora": _3,
              "hosted-by-previder": _20,
              "hosteur": {
                "$": 0,
                "succ": {
                  "rag-cloud": _3,
                  "rag-cloud-ch": _3
                }
              },
              "ik-server": {
                "$": 0,
                "succ": {
                  "jcloud": _3,
                  "jcloud-ver-jpc": _3
                }
              },
              "jelastic": {
                "$": 0,
                "succ": {
                  "demo": _3
                }
              },
              "kilatiron": _3,
              "massivegrid": _20,
              "wafaicloud": {
                "$": 0,
                "succ": {
                  "jed": _3,
                  "lon": _3,
                  "ryd": _3
                }
              },
              "joyent": {
                "$": 0,
                "succ": {
                  "cns": _5
                }
              },
              "ktistory": _3,
              "lpusercontent": _3,
              "lmpm": _21,
              "linode": {
                "$": 0,
                "succ": {
                  "members": _3,
                  "nodebalancer": _5
                }
              },
              "linodeobjects": _5,
              "linodeusercontent": {
                "$": 0,
                "succ": {
                  "ip": _3
                }
              },
              "barsycenter": _3,
              "barsyonline": _3,
              "mazeplay": _3,
              "miniserver": _3,
              "meteorapp": _22,
              "hostedpi": _3,
              "mythic-beasts": {
                "$": 0,
                "succ": {
                  "customer": _3,
                  "caracal": _3,
                  "fentiger": _3,
                  "lynx": _3,
                  "ocelot": _3,
                  "oncilla": _3,
                  "onza": _3,
                  "sphinx": _3,
                  "vs": _3,
                  "x": _3,
                  "yali": _3
                }
              },
              "nospamproxy": _9,
              "4u": _3,
              "nfshost": _3,
              "001www": _3,
              "ddnslive": _3,
              "myiphost": _3,
              "blogsyte": _3,
              "ciscofreak": _3,
              "damnserver": _3,
              "ditchyourip": _3,
              "dnsiskinky": _3,
              "dynns": _3,
              "geekgalaxy": _3,
              "health-carereform": _3,
              "homesecuritymac": _3,
              "homesecuritypc": _3,
              "myactivedirectory": _3,
              "mysecuritycamera": _3,
              "net-freaks": _3,
              "onthewifi": _3,
              "point2this": _3,
              "quicksytes": _3,
              "securitytactics": _3,
              "serveexchange": _3,
              "servehumour": _3,
              "servep2p": _3,
              "servesarcasm": _3,
              "stufftoread": _3,
              "unusualperson": _3,
              "workisboring": _3,
              "3utilities": _3,
              "ddnsking": _3,
              "myvnc": _3,
              "servebeer": _3,
              "servecounterstrike": _3,
              "serveftp": _3,
              "servegame": _3,
              "servehalflife": _3,
              "servehttp": _3,
              "serveirc": _3,
              "servemp3": _3,
              "servepics": _3,
              "servequake": _3,
              "observableusercontent": {
                "$": 0,
                "succ": {
                  "static": _3
                }
              },
              "simplesite": _3,
              "orsites": _3,
              "operaunite": _3,
              "authgear-staging": _3,
              "authgearapps": _3,
              "skygearapp": _3,
              "outsystemscloud": _3,
              "ownprovider": _3,
              "pgfog": _3,
              "pagefrontapp": _3,
              "pagexl": _3,
              "paywhirl": _5,
              "gotpantheon": _3,
              "platter-app": _3,
              "pleskns": _3,
              "postman-echo": _3,
              "prgmr": {
                "$": 0,
                "succ": {
                  "xen": _3
                }
              },
              "pythonanywhere": _22,
              "qualifioapp": _3,
              "qbuser": _3,
              "qa2": _3,
              "dev-myqnapcloud": _3,
              "alpha-myqnapcloud": _3,
              "myqnapcloud": _3,
              "quipelements": _5,
              "rackmaze": _3,
              "rhcloud": _3,
              "render": _21,
              "onrender": _3,
              "180r": _3,
              "dojin": _3,
              "sakuratan": _3,
              "sakuraweb": _3,
              "x0": _3,
              "code": {
                "$": 0,
                "succ": {
                  "builder": _5,
                  "dev-builder": _5,
                  "stg-builder": _5
                }
              },
              "logoip": _3,
              "scrysec": _3,
              "firewall-gateway": _3,
              "myshopblocks": _3,
              "myshopify": _3,
              "shopitsite": _3,
              "1kapp": _3,
              "appchizi": _3,
              "applinzi": _3,
              "sinaapp": _3,
              "vipsinaapp": _3,
              "bounty-full": {
                "$": 2,
                "succ": {
                  "alpha": _3,
                  "beta": _3
                }
              },
              "streamlitapp": _3,
              "try-snowplow": _3,
              "stackhero-network": _3,
              "playstation-cloud": _3,
              "myspreadshop": _3,
              "stdlib": {
                "$": 0,
                "succ": {
                  "api": _3
                }
              },
              "temp-dns": _3,
              "dsmynas": _3,
              "familyds": _3,
              "mytabit": _3,
              "tb-hosting": _23,
              "reservd": _3,
              "thingdustdata": _3,
              "bloxcms": _3,
              "townnews-staging": _3,
              "typeform": {
                "$": 0,
                "succ": {
                  "pro": _3
                }
              },
              "hk": _3,
              "it": _3,
              "vultrobjects": _5,
              "wafflecell": _3,
              "reserve-online": _3,
              "hotelwithflight": _3,
              "remotewd": _3,
              "wiardweb": _24,
              "messwithdns": _3,
              "woltlab-demo": _3,
              "wpenginepowered": {
                "$": 2,
                "succ": {
                  "js": _3
                }
              },
              "wixsite": _3,
              "xnbay": {
                "$": 2,
                "succ": {
                  "u2": _3,
                  "u2-local": _3
                }
              },
              "yolasite": _3
            }
          },
          "coop": _2,
          "cr": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": _2,
              "ed": _2,
              "fi": _2,
              "go": _2,
              "or": _2,
              "sa": _2
            }
          },
          "cu": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "org": _2,
              "net": _2,
              "gov": _2,
              "inf": _2
            }
          },
          "cv": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "int": _2,
              "nome": _2,
              "org": _2,
              "blogspot": _3
            }
          },
          "cw": _25,
          "cx": {
            "$": 1,
            "succ": {
              "gov": _2,
              "ath": _3,
              "info": _3
            }
          },
          "cy": {
            "$": 1,
            "succ": {
              "ac": _2,
              "biz": _2,
              "com": {
                "$": 1,
                "succ": {
                  "blogspot": _3,
                  "scaleforce": _26
                }
              },
              "ekloges": _2,
              "gov": _2,
              "ltd": _2,
              "mil": _2,
              "net": _2,
              "org": _2,
              "press": _2,
              "pro": _2,
              "tm": _2
            }
          },
          "cz": {
            "$": 1,
            "succ": {
              "co": _3,
              "realm": _3,
              "e4": _3,
              "blogspot": _3,
              "metacentrum": {
                "$": 0,
                "succ": {
                  "cloud": _5,
                  "custom": _3
                }
              },
              "muni": {
                "$": 0,
                "succ": {
                  "cloud": {
                    "$": 0,
                    "succ": {
                      "flt": _3,
                      "usr": _3
                    }
                  }
                }
              }
            }
          },
          "de": {
            "$": 1,
            "succ": {
              "bplaced": _3,
              "square7": _3,
              "com": _3,
              "cosidns": {
                "$": 0,
                "succ": {
                  "dyn": _3
                }
              },
              "dynamisches-dns": _3,
              "dnsupdater": _3,
              "internet-dns": _3,
              "l-o-g-i-n": _3,
              "dnshome": _3,
              "fuettertdasnetz": _3,
              "isteingeek": _3,
              "istmein": _3,
              "lebtimnetz": _3,
              "leitungsen": _3,
              "traeumtgerade": _3,
              "ddnss": {
                "$": 2,
                "succ": {
                  "dyn": _3,
                  "dyndns": _3
                }
              },
              "dyndns1": _3,
              "dyn-ip24": _3,
              "home-webserver": {
                "$": 2,
                "succ": {
                  "dyn": _3
                }
              },
              "myhome-server": _3,
              "frusky": _5,
              "goip": _3,
              "blogspot": _3,
              "xn--gnstigbestellen-zvb": _3,
              "günstigbestellen": _3,
              "xn--gnstigliefern-wob": _3,
              "günstigliefern": _3,
              "hs-heilbronn": {
                "$": 0,
                "succ": {
                  "it": _24
                }
              },
              "dyn-berlin": _3,
              "in-berlin": _3,
              "in-brb": _3,
              "in-butter": _3,
              "in-dsl": _3,
              "in-vpn": _3,
              "iservschule": _3,
              "mein-iserv": _3,
              "schulplattform": _3,
              "schulserver": _3,
              "test-iserv": _3,
              "keymachine": _3,
              "git-repos": _3,
              "lcube-server": _3,
              "svn-repos": _3,
              "barsy": _3,
              "123webseite": _3,
              "logoip": _3,
              "firewall-gateway": _3,
              "my-gateway": _3,
              "my-router": _3,
              "spdns": _3,
              "speedpartner": {
                "$": 0,
                "succ": {
                  "customer": _3
                }
              },
              "myspreadshop": _3,
              "taifun-dns": _3,
              "12hp": _3,
              "2ix": _3,
              "4lima": _3,
              "lima-city": _3,
              "dd-dns": _3,
              "dray-dns": _3,
              "draydns": _3,
              "dyn-vpn": _3,
              "dynvpn": _3,
              "mein-vigor": _3,
              "my-vigor": _3,
              "my-wan": _3,
              "syno-ds": _3,
              "synology-diskstation": _3,
              "synology-ds": _3,
              "uberspace": _5,
              "virtualuser": _3,
              "virtual-user": _3,
              "community-pro": _3,
              "diskussionsbereich": _3
            }
          },
          "dj": _2,
          "dk": {
            "$": 1,
            "succ": {
              "biz": _3,
              "co": _3,
              "firm": _3,
              "reg": _3,
              "store": _3,
              "blogspot": _3,
              "123hjemmeside": _3,
              "myspreadshop": _3
            }
          },
          "dm": _4,
          "do": {
            "$": 1,
            "succ": {
              "art": _2,
              "com": _2,
              "edu": _2,
              "gob": _2,
              "gov": _2,
              "mil": _2,
              "net": _2,
              "org": _2,
              "sld": _2,
              "web": _2
            }
          },
          "dz": {
            "$": 1,
            "succ": {
              "art": _2,
              "asso": _2,
              "com": _2,
              "edu": _2,
              "gov": _2,
              "org": _2,
              "net": _2,
              "pol": _2,
              "soc": _2,
              "tm": _2
            }
          },
          "ec": {
            "$": 1,
            "succ": {
              "com": _2,
              "info": _2,
              "net": _2,
              "fin": _2,
              "k12": _2,
              "med": _2,
              "pro": _2,
              "org": _2,
              "edu": _2,
              "gov": _2,
              "gob": _2,
              "mil": _2,
              "base": _3,
              "official": _3
            }
          },
          "edu": {
            "$": 1,
            "succ": {
              "rit": {
                "$": 0,
                "succ": {
                  "git-pages": _3
                }
              }
            }
          },
          "ee": {
            "$": 1,
            "succ": {
              "edu": _2,
              "gov": _2,
              "riik": _2,
              "lib": _2,
              "med": _2,
              "com": _6,
              "pri": _2,
              "aip": _2,
              "org": _2,
              "fie": _2
            }
          },
          "eg": {
            "$": 1,
            "succ": {
              "com": _6,
              "edu": _2,
              "eun": _2,
              "gov": _2,
              "mil": _2,
              "name": _2,
              "net": _2,
              "org": _2,
              "sci": _2
            }
          },
          "er": _8,
          "es": {
            "$": 1,
            "succ": {
              "com": _6,
              "nom": _2,
              "org": _2,
              "gob": _2,
              "edu": _2,
              "123miweb": _3,
              "myspreadshop": _3
            }
          },
          "et": {
            "$": 1,
            "succ": {
              "com": _2,
              "gov": _2,
              "org": _2,
              "edu": _2,
              "biz": _2,
              "name": _2,
              "info": _2,
              "net": _2
            }
          },
          "eu": {
            "$": 1,
            "succ": {
              "airkitapps": _3,
              "mycd": _3,
              "cloudns": _3,
              "dogado": _27,
              "barsy": _3,
              "wellbeingzone": _3,
              "spdns": _3,
              "transurl": _5,
              "diskstation": _3
            }
          },
          "fi": {
            "$": 1,
            "succ": {
              "aland": _2,
              "dy": _3,
              "blogspot": _3,
              "xn--hkkinen-5wa": _3,
              "häkkinen": _3,
              "iki": _3,
              "cloudplatform": {
                "$": 0,
                "succ": {
                  "fi": _3
                }
              },
              "datacenter": {
                "$": 0,
                "succ": {
                  "demo": _3,
                  "paas": _3
                }
              },
              "kapsi": _3,
              "123kotisivu": _3,
              "myspreadshop": _3
            }
          },
          "fj": {
            "$": 1,
            "succ": {
              "ac": _2,
              "biz": _2,
              "com": _2,
              "gov": _2,
              "info": _2,
              "mil": _2,
              "name": _2,
              "net": _2,
              "org": _2,
              "pro": _2
            }
          },
          "fk": _8,
          "fm": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "net": _2,
              "org": _2,
              "radio": _3,
              "user": _5
            }
          },
          "fo": _2,
          "fr": {
            "$": 1,
            "succ": {
              "asso": _2,
              "com": _2,
              "gouv": _2,
              "nom": _2,
              "prd": _2,
              "tm": _2,
              "aeroport": _2,
              "avocat": _2,
              "avoues": _2,
              "cci": _2,
              "chambagri": _2,
              "chirurgiens-dentistes": _2,
              "experts-comptables": _2,
              "geometre-expert": _2,
              "greta": _2,
              "huissier-justice": _2,
              "medecin": _2,
              "notaires": _2,
              "pharmacien": _2,
              "port": _2,
              "veterinaire": _2,
              "en-root": _3,
              "fbx-os": _3,
              "fbxos": _3,
              "freebox-os": _3,
              "freeboxos": _3,
              "blogspot": _3,
              "goupile": _3,
              "123siteweb": _3,
              "on-web": _3,
              "chirurgiens-dentistes-en-france": _3,
              "dedibox": _3,
              "myspreadshop": _3,
              "ynh": _3
            }
          },
          "ga": _2,
          "gb": _2,
          "gd": {
            "$": 1,
            "succ": {
              "edu": _2,
              "gov": _2
            }
          },
          "ge": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "org": _2,
              "mil": _2,
              "net": _2,
              "pvt": _2
            }
          },
          "gf": _2,
          "gg": {
            "$": 1,
            "succ": {
              "co": _2,
              "net": _2,
              "org": _2,
              "kaas": _3,
              "cya": _3,
              "panel": {
                "$": 2,
                "succ": {
                  "daemon": _3
                }
              }
            }
          },
          "gh": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "org": _2,
              "mil": _2
            }
          },
          "gi": {
            "$": 1,
            "succ": {
              "com": _2,
              "ltd": _2,
              "gov": _2,
              "mod": _2,
              "edu": _2,
              "org": _2
            }
          },
          "gl": {
            "$": 1,
            "succ": {
              "co": _2,
              "com": _2,
              "edu": _2,
              "net": _2,
              "org": _2,
              "biz": _3,
              "xx": _3
            }
          },
          "gm": _2,
          "gn": {
            "$": 1,
            "succ": {
              "ac": _2,
              "com": _2,
              "edu": _2,
              "gov": _2,
              "org": _2,
              "net": _2
            }
          },
          "gov": _2,
          "gp": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "mobi": _2,
              "edu": _2,
              "org": _2,
              "asso": _2,
              "app": _3
            }
          },
          "gq": _2,
          "gr": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "net": _2,
              "org": _2,
              "gov": _2,
              "blogspot": _3,
              "simplesite": _3
            }
          },
          "gs": _2,
          "gt": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gob": _2,
              "ind": _2,
              "mil": _2,
              "net": _2,
              "org": _2,
              "blog": _3,
              "de": _3,
              "to": _3
            }
          },
          "gu": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "guam": _2,
              "info": _2,
              "net": _2,
              "org": _2,
              "web": _2
            }
          },
          "gw": _2,
          "gy": {
            "$": 1,
            "succ": {
              "co": _2,
              "com": _2,
              "edu": _2,
              "gov": _2,
              "net": _2,
              "org": _2,
              "be": _3
            }
          },
          "hk": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "idv": _2,
              "net": _2,
              "org": _2,
              "xn--55qx5d": _2,
              "公司": _2,
              "xn--wcvs22d": _2,
              "教育": _2,
              "xn--lcvr32d": _2,
              "敎育": _2,
              "xn--mxtq1m": _2,
              "政府": _2,
              "xn--gmqw5a": _2,
              "個人": _2,
              "xn--ciqpn": _2,
              "个人": _2,
              "xn--gmq050i": _2,
              "箇人": _2,
              "xn--zf0avx": _2,
              "網络": _2,
              "xn--io0a7i": _2,
              "网络": _2,
              "xn--mk0axi": _2,
              "组織": _2,
              "xn--od0alg": _2,
              "網絡": _2,
              "xn--od0aq3b": _2,
              "网絡": _2,
              "xn--tn0ag": _2,
              "组织": _2,
              "xn--uc0atv": _2,
              "組織": _2,
              "xn--uc0ay4a": _2,
              "組织": _2,
              "blogspot": _3,
              "secaas": _3,
              "ltd": _3,
              "inc": _3
            }
          },
          "hm": _2,
          "hn": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "org": _2,
              "net": _2,
              "mil": _2,
              "gob": _2,
              "cc": _3
            }
          },
          "hr": {
            "$": 1,
            "succ": {
              "iz": _2,
              "from": _2,
              "name": _2,
              "com": _2,
              "blogspot": _3,
              "free": _3
            }
          },
          "ht": {
            "$": 1,
            "succ": {
              "com": _2,
              "shop": _2,
              "firm": _2,
              "info": _2,
              "adult": _2,
              "net": _2,
              "pro": _2,
              "org": _2,
              "med": _2,
              "art": _2,
              "coop": _2,
              "pol": _2,
              "asso": _2,
              "edu": _2,
              "rel": _2,
              "gouv": _2,
              "perso": _2
            }
          },
          "hu": {
            "$": 1,
            "succ": {
              "2000": _2,
              "co": _2,
              "info": _2,
              "org": _2,
              "priv": _2,
              "sport": _2,
              "tm": _2,
              "agrar": _2,
              "bolt": _2,
              "casino": _2,
              "city": _2,
              "erotica": _2,
              "erotika": _2,
              "film": _2,
              "forum": _2,
              "games": _2,
              "hotel": _2,
              "ingatlan": _2,
              "jogasz": _2,
              "konyvelo": _2,
              "lakas": _2,
              "media": _2,
              "news": _2,
              "reklam": _2,
              "sex": _2,
              "shop": _2,
              "suli": _2,
              "szex": _2,
              "tozsde": _2,
              "utazas": _2,
              "video": _2,
              "blogspot": _3
            }
          },
          "id": {
            "$": 1,
            "succ": {
              "ac": _2,
              "biz": _2,
              "co": _6,
              "desa": _2,
              "go": _2,
              "mil": _2,
              "my": {
                "$": 1,
                "succ": {
                  "rss": _5
                }
              },
              "net": _2,
              "or": _2,
              "ponpes": _2,
              "sch": _2,
              "web": _2,
              "flap": _3,
              "forte": _3
            }
          },
          "ie": {
            "$": 1,
            "succ": {
              "gov": _2,
              "blogspot": _3,
              "myspreadshop": _3
            }
          },
          "il": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": {
                "$": 1,
                "succ": {
                  "ravpage": _3,
                  "blogspot": _3,
                  "tabitorder": _3,
                  "mytabit": _3
                }
              },
              "gov": _2,
              "idf": _2,
              "k12": _2,
              "muni": _2,
              "net": _2,
              "org": _2
            }
          },
          "xn--4dbrk0ce": {
            "$": 1,
            "succ": {
              "xn--4dbgdty6c": _2,
              "xn--5dbhl8d": _2,
              "xn--8dbq2a": _2,
              "xn--hebda8b": _2
            }
          },
          "ישראל": {
            "$": 1,
            "succ": {
              "אקדמיה": _2,
              "ישוב": _2,
              "צהל": _2,
              "ממשל": _2
            }
          },
          "im": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": {
                "$": 1,
                "succ": {
                  "ltd": _2,
                  "plc": _2
                }
              },
              "com": _2,
              "net": _2,
              "org": _2,
              "tt": _2,
              "tv": _2,
              "ro": _3
            }
          },
          "in": {
            "$": 1,
            "succ": {
              "5g": _2,
              "6g": _2,
              "ac": _2,
              "ai": _2,
              "am": _2,
              "bihar": _2,
              "biz": _2,
              "business": _2,
              "ca": _2,
              "cn": _2,
              "co": _2,
              "com": _2,
              "coop": _2,
              "cs": _2,
              "delhi": _2,
              "dr": _2,
              "edu": _2,
              "er": _2,
              "firm": _2,
              "gen": _2,
              "gov": _2,
              "gujarat": _2,
              "ind": _2,
              "info": _2,
              "int": _2,
              "internet": _2,
              "io": _2,
              "me": _2,
              "mil": _2,
              "net": _2,
              "nic": _2,
              "org": _2,
              "pg": _2,
              "post": _2,
              "pro": _2,
              "res": _2,
              "travel": _2,
              "tv": _2,
              "uk": _2,
              "up": _2,
              "us": _2,
              "web": _3,
              "cloudns": _3,
              "blogspot": _3,
              "barsy": _3,
              "supabase": _3
            }
          },
          "info": {
            "$": 1,
            "succ": {
              "cloudns": _3,
              "dynamic-dns": _3,
              "dyndns": _3,
              "barrel-of-knowledge": _3,
              "barrell-of-knowledge": _3,
              "for-our": _3,
              "groks-the": _3,
              "groks-this": _3,
              "here-for-more": _3,
              "knowsitall": _3,
              "selfip": _3,
              "webhop": _3,
              "barsy": _3,
              "mayfirst": _3,
              "forumz": _3,
              "nsupdate": _3,
              "dvrcam": _3,
              "ilovecollege": _3,
              "no-ip": _3,
              "dnsupdate": _3,
              "v-info": _3
            }
          },
          "int": {
            "$": 1,
            "succ": {
              "eu": _2
            }
          },
          "io": {
            "$": 1,
            "succ": {
              "2038": _3,
              "com": _2,
              "on-acorn": _5,
              "apigee": _3,
              "b-data": _3,
              "backplaneapp": _3,
              "banzaicloud": {
                "$": 0,
                "succ": {
                  "app": _3,
                  "backyards": _5
                }
              },
              "beagleboard": _3,
              "bitbucket": _3,
              "bluebite": _3,
              "boxfuse": _3,
              "browsersafetymark": _3,
              "bigv": {
                "$": 0,
                "succ": {
                  "uk0": _3
                }
              },
              "cleverapps": _3,
              "dappnode": {
                "$": 0,
                "succ": {
                  "dyndns": _3
                }
              },
              "dedyn": _3,
              "drud": _3,
              "definima": _3,
              "fh-muenster": _3,
              "shw": _3,
              "forgerock": {
                "$": 0,
                "succ": {
                  "id": _3
                }
              },
              "ghost": _3,
              "github": _3,
              "gitlab": _3,
              "lolipop": _3,
              "hasura-app": _3,
              "hostyhosting": _3,
              "moonscale": _5,
              "beebyte": _20,
              "beebyteapp": {
                "$": 0,
                "succ": {
                  "sekd1": _3
                }
              },
              "jele": _3,
              "unispace": {
                "$": 0,
                "succ": {
                  "cloud-fr1": _3
                }
              },
              "webthings": _3,
              "loginline": _3,
              "barsy": _3,
              "azurecontainer": _5,
              "ngrok": {
                "$": 2,
                "succ": {
                  "ap": _3,
                  "au": _3,
                  "eu": _3,
                  "in": _3,
                  "jp": _3,
                  "sa": _3,
                  "us": _3
                }
              },
              "nodeart": {
                "$": 0,
                "succ": {
                  "stage": _3
                }
              },
              "nid": _3,
              "pantheonsite": _3,
              "dyn53": _3,
              "pstmn": {
                "$": 2,
                "succ": {
                  "mock": _3
                }
              },
              "protonet": _3,
              "qoto": _3,
              "qcx": {
                "$": 2,
                "succ": {
                  "sys": _5
                }
              },
              "vaporcloud": _3,
              "vbrplsbx": {
                "$": 0,
                "succ": {
                  "g": _3
                }
              },
              "on-k3s": _5,
              "on-rio": _5,
              "readthedocs": _3,
              "resindevice": _3,
              "resinstaging": {
                "$": 0,
                "succ": {
                  "devices": _3
                }
              },
              "hzc": _3,
              "sandcats": _3,
              "shiftcrypto": _3,
              "shiftedit": _3,
              "mo-siemens": _3,
              "musician": _3,
              "lair": _19,
              "stolos": _5,
              "spacekit": _3,
              "utwente": _3,
              "s5y": _5,
              "edugit": _3,
              "telebit": _3,
              "thingdust": {
                "$": 0,
                "succ": {
                  "dev": _30,
                  "disrec": _30,
                  "prod": _31,
                  "testing": _30
                }
              },
              "tickets": _3,
              "upli": _3,
              "wedeploy": _3,
              "editorx": _3,
              "basicserver": _3,
              "virtualserver": _3
            }
          },
          "iq": _32,
          "ir": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": _2,
              "gov": _2,
              "id": _2,
              "net": _2,
              "org": _2,
              "sch": _2,
              "xn--mgba3a4f16a": _2,
              "ایران": _2,
              "xn--mgba3a4fra": _2,
              "ايران": _2
            }
          },
          "is": {
            "$": 1,
            "succ": {
              "net": _2,
              "com": _2,
              "edu": _2,
              "gov": _2,
              "org": _2,
              "int": _2,
              "cupcake": _3,
              "blogspot": _3
            }
          },
          "it": {
            "$": 1,
            "succ": {
              "gov": _2,
              "edu": _2,
              "abr": _2,
              "abruzzo": _2,
              "aosta-valley": _2,
              "aostavalley": _2,
              "bas": _2,
              "basilicata": _2,
              "cal": _2,
              "calabria": _2,
              "cam": _2,
              "campania": _2,
              "emilia-romagna": _2,
              "emiliaromagna": _2,
              "emr": _2,
              "friuli-v-giulia": _2,
              "friuli-ve-giulia": _2,
              "friuli-vegiulia": _2,
              "friuli-venezia-giulia": _2,
              "friuli-veneziagiulia": _2,
              "friuli-vgiulia": _2,
              "friuliv-giulia": _2,
              "friulive-giulia": _2,
              "friulivegiulia": _2,
              "friulivenezia-giulia": _2,
              "friuliveneziagiulia": _2,
              "friulivgiulia": _2,
              "fvg": _2,
              "laz": _2,
              "lazio": _2,
              "lig": _2,
              "liguria": _2,
              "lom": _2,
              "lombardia": _2,
              "lombardy": _2,
              "lucania": _2,
              "mar": _2,
              "marche": _2,
              "mol": _2,
              "molise": _2,
              "piedmont": _2,
              "piemonte": _2,
              "pmn": _2,
              "pug": _2,
              "puglia": _2,
              "sar": _2,
              "sardegna": _2,
              "sardinia": _2,
              "sic": _2,
              "sicilia": _2,
              "sicily": _2,
              "taa": _2,
              "tos": _2,
              "toscana": _2,
              "trentin-sud-tirol": _2,
              "xn--trentin-sd-tirol-rzb": _2,
              "trentin-süd-tirol": _2,
              "trentin-sudtirol": _2,
              "xn--trentin-sdtirol-7vb": _2,
              "trentin-südtirol": _2,
              "trentin-sued-tirol": _2,
              "trentin-suedtirol": _2,
              "trentino-a-adige": _2,
              "trentino-aadige": _2,
              "trentino-alto-adige": _2,
              "trentino-altoadige": _2,
              "trentino-s-tirol": _2,
              "trentino-stirol": _2,
              "trentino-sud-tirol": _2,
              "xn--trentino-sd-tirol-c3b": _2,
              "trentino-süd-tirol": _2,
              "trentino-sudtirol": _2,
              "xn--trentino-sdtirol-szb": _2,
              "trentino-südtirol": _2,
              "trentino-sued-tirol": _2,
              "trentino-suedtirol": _2,
              "trentino": _2,
              "trentinoa-adige": _2,
              "trentinoaadige": _2,
              "trentinoalto-adige": _2,
              "trentinoaltoadige": _2,
              "trentinos-tirol": _2,
              "trentinostirol": _2,
              "trentinosud-tirol": _2,
              "xn--trentinosd-tirol-rzb": _2,
              "trentinosüd-tirol": _2,
              "trentinosudtirol": _2,
              "xn--trentinosdtirol-7vb": _2,
              "trentinosüdtirol": _2,
              "trentinosued-tirol": _2,
              "trentinosuedtirol": _2,
              "trentinsud-tirol": _2,
              "xn--trentinsd-tirol-6vb": _2,
              "trentinsüd-tirol": _2,
              "trentinsudtirol": _2,
              "xn--trentinsdtirol-nsb": _2,
              "trentinsüdtirol": _2,
              "trentinsued-tirol": _2,
              "trentinsuedtirol": _2,
              "tuscany": _2,
              "umb": _2,
              "umbria": _2,
              "val-d-aosta": _2,
              "val-daosta": _2,
              "vald-aosta": _2,
              "valdaosta": _2,
              "valle-aosta": _2,
              "valle-d-aosta": _2,
              "valle-daosta": _2,
              "valleaosta": _2,
              "valled-aosta": _2,
              "valledaosta": _2,
              "vallee-aoste": _2,
              "xn--valle-aoste-ebb": _2,
              "vallée-aoste": _2,
              "vallee-d-aoste": _2,
              "xn--valle-d-aoste-ehb": _2,
              "vallée-d-aoste": _2,
              "valleeaoste": _2,
              "xn--valleaoste-e7a": _2,
              "valléeaoste": _2,
              "valleedaoste": _2,
              "xn--valledaoste-ebb": _2,
              "valléedaoste": _2,
              "vao": _2,
              "vda": _2,
              "ven": _2,
              "veneto": _2,
              "ag": _2,
              "agrigento": _2,
              "al": _2,
              "alessandria": _2,
              "alto-adige": _2,
              "altoadige": _2,
              "an": _2,
              "ancona": _2,
              "andria-barletta-trani": _2,
              "andria-trani-barletta": _2,
              "andriabarlettatrani": _2,
              "andriatranibarletta": _2,
              "ao": _2,
              "aosta": _2,
              "aoste": _2,
              "ap": _2,
              "aq": _2,
              "aquila": _2,
              "ar": _2,
              "arezzo": _2,
              "ascoli-piceno": _2,
              "ascolipiceno": _2,
              "asti": _2,
              "at": _2,
              "av": _2,
              "avellino": _2,
              "ba": _2,
              "balsan-sudtirol": _2,
              "xn--balsan-sdtirol-nsb": _2,
              "balsan-südtirol": _2,
              "balsan-suedtirol": _2,
              "balsan": _2,
              "bari": _2,
              "barletta-trani-andria": _2,
              "barlettatraniandria": _2,
              "belluno": _2,
              "benevento": _2,
              "bergamo": _2,
              "bg": _2,
              "bi": _2,
              "biella": _2,
              "bl": _2,
              "bn": _2,
              "bo": _2,
              "bologna": _2,
              "bolzano-altoadige": _2,
              "bolzano": _2,
              "bozen-sudtirol": _2,
              "xn--bozen-sdtirol-2ob": _2,
              "bozen-südtirol": _2,
              "bozen-suedtirol": _2,
              "bozen": _2,
              "br": _2,
              "brescia": _2,
              "brindisi": _2,
              "bs": _2,
              "bt": _2,
              "bulsan-sudtirol": _2,
              "xn--bulsan-sdtirol-nsb": _2,
              "bulsan-südtirol": _2,
              "bulsan-suedtirol": _2,
              "bulsan": _2,
              "bz": _2,
              "ca": _2,
              "cagliari": _2,
              "caltanissetta": _2,
              "campidano-medio": _2,
              "campidanomedio": _2,
              "campobasso": _2,
              "carbonia-iglesias": _2,
              "carboniaiglesias": _2,
              "carrara-massa": _2,
              "carraramassa": _2,
              "caserta": _2,
              "catania": _2,
              "catanzaro": _2,
              "cb": _2,
              "ce": _2,
              "cesena-forli": _2,
              "xn--cesena-forl-mcb": _2,
              "cesena-forlì": _2,
              "cesenaforli": _2,
              "xn--cesenaforl-i8a": _2,
              "cesenaforlì": _2,
              "ch": _2,
              "chieti": _2,
              "ci": _2,
              "cl": _2,
              "cn": _2,
              "co": _2,
              "como": _2,
              "cosenza": _2,
              "cr": _2,
              "cremona": _2,
              "crotone": _2,
              "cs": _2,
              "ct": _2,
              "cuneo": _2,
              "cz": _2,
              "dell-ogliastra": _2,
              "dellogliastra": _2,
              "en": _2,
              "enna": _2,
              "fc": _2,
              "fe": _2,
              "fermo": _2,
              "ferrara": _2,
              "fg": _2,
              "fi": _2,
              "firenze": _2,
              "florence": _2,
              "fm": _2,
              "foggia": _2,
              "forli-cesena": _2,
              "xn--forl-cesena-fcb": _2,
              "forlì-cesena": _2,
              "forlicesena": _2,
              "xn--forlcesena-c8a": _2,
              "forlìcesena": _2,
              "fr": _2,
              "frosinone": _2,
              "ge": _2,
              "genoa": _2,
              "genova": _2,
              "go": _2,
              "gorizia": _2,
              "gr": _2,
              "grosseto": _2,
              "iglesias-carbonia": _2,
              "iglesiascarbonia": _2,
              "im": _2,
              "imperia": _2,
              "is": _2,
              "isernia": _2,
              "kr": _2,
              "la-spezia": _2,
              "laquila": _2,
              "laspezia": _2,
              "latina": _2,
              "lc": _2,
              "le": _2,
              "lecce": _2,
              "lecco": _2,
              "li": _2,
              "livorno": _2,
              "lo": _2,
              "lodi": _2,
              "lt": _2,
              "lu": _2,
              "lucca": _2,
              "macerata": _2,
              "mantova": _2,
              "massa-carrara": _2,
              "massacarrara": _2,
              "matera": _2,
              "mb": _2,
              "mc": _2,
              "me": _2,
              "medio-campidano": _2,
              "mediocampidano": _2,
              "messina": _2,
              "mi": _2,
              "milan": _2,
              "milano": _2,
              "mn": _2,
              "mo": _2,
              "modena": _2,
              "monza-brianza": _2,
              "monza-e-della-brianza": _2,
              "monza": _2,
              "monzabrianza": _2,
              "monzaebrianza": _2,
              "monzaedellabrianza": _2,
              "ms": _2,
              "mt": _2,
              "na": _2,
              "naples": _2,
              "napoli": _2,
              "no": _2,
              "novara": _2,
              "nu": _2,
              "nuoro": _2,
              "og": _2,
              "ogliastra": _2,
              "olbia-tempio": _2,
              "olbiatempio": _2,
              "or": _2,
              "oristano": _2,
              "ot": _2,
              "pa": _2,
              "padova": _2,
              "padua": _2,
              "palermo": _2,
              "parma": _2,
              "pavia": _2,
              "pc": _2,
              "pd": _2,
              "pe": _2,
              "perugia": _2,
              "pesaro-urbino": _2,
              "pesarourbino": _2,
              "pescara": _2,
              "pg": _2,
              "pi": _2,
              "piacenza": _2,
              "pisa": _2,
              "pistoia": _2,
              "pn": _2,
              "po": _2,
              "pordenone": _2,
              "potenza": _2,
              "pr": _2,
              "prato": _2,
              "pt": _2,
              "pu": _2,
              "pv": _2,
              "pz": _2,
              "ra": _2,
              "ragusa": _2,
              "ravenna": _2,
              "rc": _2,
              "re": _2,
              "reggio-calabria": _2,
              "reggio-emilia": _2,
              "reggiocalabria": _2,
              "reggioemilia": _2,
              "rg": _2,
              "ri": _2,
              "rieti": _2,
              "rimini": _2,
              "rm": _2,
              "rn": _2,
              "ro": _2,
              "roma": _2,
              "rome": _2,
              "rovigo": _2,
              "sa": _2,
              "salerno": _2,
              "sassari": _2,
              "savona": _2,
              "si": _2,
              "siena": _2,
              "siracusa": _2,
              "so": _2,
              "sondrio": _2,
              "sp": _2,
              "sr": _2,
              "ss": _2,
              "suedtirol": _2,
              "xn--sdtirol-n2a": _2,
              "südtirol": _2,
              "sv": _2,
              "ta": _2,
              "taranto": _2,
              "te": _2,
              "tempio-olbia": _2,
              "tempioolbia": _2,
              "teramo": _2,
              "terni": _2,
              "tn": _2,
              "to": _2,
              "torino": _2,
              "tp": _2,
              "tr": _2,
              "trani-andria-barletta": _2,
              "trani-barletta-andria": _2,
              "traniandriabarletta": _2,
              "tranibarlettaandria": _2,
              "trapani": _2,
              "trento": _2,
              "treviso": _2,
              "trieste": _2,
              "ts": _2,
              "turin": _2,
              "tv": _2,
              "ud": _2,
              "udine": _2,
              "urbino-pesaro": _2,
              "urbinopesaro": _2,
              "va": _2,
              "varese": _2,
              "vb": _2,
              "vc": _2,
              "ve": _2,
              "venezia": _2,
              "venice": _2,
              "verbania": _2,
              "vercelli": _2,
              "verona": _2,
              "vi": _2,
              "vibo-valentia": _2,
              "vibovalentia": _2,
              "vicenza": _2,
              "viterbo": _2,
              "vr": _2,
              "vs": _2,
              "vt": _2,
              "vv": _2,
              "blogspot": _3,
              "ibxos": _3,
              "iliadboxos": _3,
              "neen": {
                "$": 0,
                "succ": {
                  "jc": _3
                }
              },
              "tim": {
                "$": 0,
                "succ": {
                  "open": {
                    "$": 0,
                    "succ": {
                      "jelastic": _9
                    }
                  }
                }
              },
              "16-b": _3,
              "32-b": _3,
              "64-b": _3,
              "123homepage": _3,
              "myspreadshop": _3,
              "syncloud": _3
            }
          },
          "je": {
            "$": 1,
            "succ": {
              "co": _2,
              "net": _2,
              "org": _2,
              "of": _3
            }
          },
          "jm": _8,
          "jo": {
            "$": 1,
            "succ": {
              "com": _2,
              "org": _2,
              "net": _2,
              "edu": _2,
              "sch": _2,
              "gov": _2,
              "mil": _2,
              "name": _2
            }
          },
          "jobs": _2,
          "jp": {
            "$": 1,
            "succ": {
              "ac": _2,
              "ad": _2,
              "co": _2,
              "ed": _2,
              "go": _2,
              "gr": _2,
              "lg": _2,
              "ne": {
                "$": 1,
                "succ": {
                  "aseinet": _28,
                  "gehirn": _3,
                  "ivory": _3,
                  "mail-box": _3,
                  "mints": _3,
                  "mokuren": _3,
                  "opal": _3,
                  "sakura": _3,
                  "sumomo": _3,
                  "topaz": _3
                }
              },
              "or": _2,
              "aichi": {
                "$": 1,
                "succ": {
                  "aisai": _2,
                  "ama": _2,
                  "anjo": _2,
                  "asuke": _2,
                  "chiryu": _2,
                  "chita": _2,
                  "fuso": _2,
                  "gamagori": _2,
                  "handa": _2,
                  "hazu": _2,
                  "hekinan": _2,
                  "higashiura": _2,
                  "ichinomiya": _2,
                  "inazawa": _2,
                  "inuyama": _2,
                  "isshiki": _2,
                  "iwakura": _2,
                  "kanie": _2,
                  "kariya": _2,
                  "kasugai": _2,
                  "kira": _2,
                  "kiyosu": _2,
                  "komaki": _2,
                  "konan": _2,
                  "kota": _2,
                  "mihama": _2,
                  "miyoshi": _2,
                  "nishio": _2,
                  "nisshin": _2,
                  "obu": _2,
                  "oguchi": _2,
                  "oharu": _2,
                  "okazaki": _2,
                  "owariasahi": _2,
                  "seto": _2,
                  "shikatsu": _2,
                  "shinshiro": _2,
                  "shitara": _2,
                  "tahara": _2,
                  "takahama": _2,
                  "tobishima": _2,
                  "toei": _2,
                  "togo": _2,
                  "tokai": _2,
                  "tokoname": _2,
                  "toyoake": _2,
                  "toyohashi": _2,
                  "toyokawa": _2,
                  "toyone": _2,
                  "toyota": _2,
                  "tsushima": _2,
                  "yatomi": _2
                }
              },
              "akita": {
                "$": 1,
                "succ": {
                  "akita": _2,
                  "daisen": _2,
                  "fujisato": _2,
                  "gojome": _2,
                  "hachirogata": _2,
                  "happou": _2,
                  "higashinaruse": _2,
                  "honjo": _2,
                  "honjyo": _2,
                  "ikawa": _2,
                  "kamikoani": _2,
                  "kamioka": _2,
                  "katagami": _2,
                  "kazuno": _2,
                  "kitaakita": _2,
                  "kosaka": _2,
                  "kyowa": _2,
                  "misato": _2,
                  "mitane": _2,
                  "moriyoshi": _2,
                  "nikaho": _2,
                  "noshiro": _2,
                  "odate": _2,
                  "oga": _2,
                  "ogata": _2,
                  "semboku": _2,
                  "yokote": _2,
                  "yurihonjo": _2
                }
              },
              "aomori": {
                "$": 1,
                "succ": {
                  "aomori": _2,
                  "gonohe": _2,
                  "hachinohe": _2,
                  "hashikami": _2,
                  "hiranai": _2,
                  "hirosaki": _2,
                  "itayanagi": _2,
                  "kuroishi": _2,
                  "misawa": _2,
                  "mutsu": _2,
                  "nakadomari": _2,
                  "noheji": _2,
                  "oirase": _2,
                  "owani": _2,
                  "rokunohe": _2,
                  "sannohe": _2,
                  "shichinohe": _2,
                  "shingo": _2,
                  "takko": _2,
                  "towada": _2,
                  "tsugaru": _2,
                  "tsuruta": _2
                }
              },
              "chiba": {
                "$": 1,
                "succ": {
                  "abiko": _2,
                  "asahi": _2,
                  "chonan": _2,
                  "chosei": _2,
                  "choshi": _2,
                  "chuo": _2,
                  "funabashi": _2,
                  "futtsu": _2,
                  "hanamigawa": _2,
                  "ichihara": _2,
                  "ichikawa": _2,
                  "ichinomiya": _2,
                  "inzai": _2,
                  "isumi": _2,
                  "kamagaya": _2,
                  "kamogawa": _2,
                  "kashiwa": _2,
                  "katori": _2,
                  "katsuura": _2,
                  "kimitsu": _2,
                  "kisarazu": _2,
                  "kozaki": _2,
                  "kujukuri": _2,
                  "kyonan": _2,
                  "matsudo": _2,
                  "midori": _2,
                  "mihama": _2,
                  "minamiboso": _2,
                  "mobara": _2,
                  "mutsuzawa": _2,
                  "nagara": _2,
                  "nagareyama": _2,
                  "narashino": _2,
                  "narita": _2,
                  "noda": _2,
                  "oamishirasato": _2,
                  "omigawa": _2,
                  "onjuku": _2,
                  "otaki": _2,
                  "sakae": _2,
                  "sakura": _2,
                  "shimofusa": _2,
                  "shirako": _2,
                  "shiroi": _2,
                  "shisui": _2,
                  "sodegaura": _2,
                  "sosa": _2,
                  "tako": _2,
                  "tateyama": _2,
                  "togane": _2,
                  "tohnosho": _2,
                  "tomisato": _2,
                  "urayasu": _2,
                  "yachimata": _2,
                  "yachiyo": _2,
                  "yokaichiba": _2,
                  "yokoshibahikari": _2,
                  "yotsukaido": _2
                }
              },
              "ehime": {
                "$": 1,
                "succ": {
                  "ainan": _2,
                  "honai": _2,
                  "ikata": _2,
                  "imabari": _2,
                  "iyo": _2,
                  "kamijima": _2,
                  "kihoku": _2,
                  "kumakogen": _2,
                  "masaki": _2,
                  "matsuno": _2,
                  "matsuyama": _2,
                  "namikata": _2,
                  "niihama": _2,
                  "ozu": _2,
                  "saijo": _2,
                  "seiyo": _2,
                  "shikokuchuo": _2,
                  "tobe": _2,
                  "toon": _2,
                  "uchiko": _2,
                  "uwajima": _2,
                  "yawatahama": _2
                }
              },
              "fukui": {
                "$": 1,
                "succ": {
                  "echizen": _2,
                  "eiheiji": _2,
                  "fukui": _2,
                  "ikeda": _2,
                  "katsuyama": _2,
                  "mihama": _2,
                  "minamiechizen": _2,
                  "obama": _2,
                  "ohi": _2,
                  "ono": _2,
                  "sabae": _2,
                  "sakai": _2,
                  "takahama": _2,
                  "tsuruga": _2,
                  "wakasa": _2
                }
              },
              "fukuoka": {
                "$": 1,
                "succ": {
                  "ashiya": _2,
                  "buzen": _2,
                  "chikugo": _2,
                  "chikuho": _2,
                  "chikujo": _2,
                  "chikushino": _2,
                  "chikuzen": _2,
                  "chuo": _2,
                  "dazaifu": _2,
                  "fukuchi": _2,
                  "hakata": _2,
                  "higashi": _2,
                  "hirokawa": _2,
                  "hisayama": _2,
                  "iizuka": _2,
                  "inatsuki": _2,
                  "kaho": _2,
                  "kasuga": _2,
                  "kasuya": _2,
                  "kawara": _2,
                  "keisen": _2,
                  "koga": _2,
                  "kurate": _2,
                  "kurogi": _2,
                  "kurume": _2,
                  "minami": _2,
                  "miyako": _2,
                  "miyama": _2,
                  "miyawaka": _2,
                  "mizumaki": _2,
                  "munakata": _2,
                  "nakagawa": _2,
                  "nakama": _2,
                  "nishi": _2,
                  "nogata": _2,
                  "ogori": _2,
                  "okagaki": _2,
                  "okawa": _2,
                  "oki": _2,
                  "omuta": _2,
                  "onga": _2,
                  "onojo": _2,
                  "oto": _2,
                  "saigawa": _2,
                  "sasaguri": _2,
                  "shingu": _2,
                  "shinyoshitomi": _2,
                  "shonai": _2,
                  "soeda": _2,
                  "sue": _2,
                  "tachiarai": _2,
                  "tagawa": _2,
                  "takata": _2,
                  "toho": _2,
                  "toyotsu": _2,
                  "tsuiki": _2,
                  "ukiha": _2,
                  "umi": _2,
                  "usui": _2,
                  "yamada": _2,
                  "yame": _2,
                  "yanagawa": _2,
                  "yukuhashi": _2
                }
              },
              "fukushima": {
                "$": 1,
                "succ": {
                  "aizubange": _2,
                  "aizumisato": _2,
                  "aizuwakamatsu": _2,
                  "asakawa": _2,
                  "bandai": _2,
                  "date": _2,
                  "fukushima": _2,
                  "furudono": _2,
                  "futaba": _2,
                  "hanawa": _2,
                  "higashi": _2,
                  "hirata": _2,
                  "hirono": _2,
                  "iitate": _2,
                  "inawashiro": _2,
                  "ishikawa": _2,
                  "iwaki": _2,
                  "izumizaki": _2,
                  "kagamiishi": _2,
                  "kaneyama": _2,
                  "kawamata": _2,
                  "kitakata": _2,
                  "kitashiobara": _2,
                  "koori": _2,
                  "koriyama": _2,
                  "kunimi": _2,
                  "miharu": _2,
                  "mishima": _2,
                  "namie": _2,
                  "nango": _2,
                  "nishiaizu": _2,
                  "nishigo": _2,
                  "okuma": _2,
                  "omotego": _2,
                  "ono": _2,
                  "otama": _2,
                  "samegawa": _2,
                  "shimogo": _2,
                  "shirakawa": _2,
                  "showa": _2,
                  "soma": _2,
                  "sukagawa": _2,
                  "taishin": _2,
                  "tamakawa": _2,
                  "tanagura": _2,
                  "tenei": _2,
                  "yabuki": _2,
                  "yamato": _2,
                  "yamatsuri": _2,
                  "yanaizu": _2,
                  "yugawa": _2
                }
              },
              "gifu": {
                "$": 1,
                "succ": {
                  "anpachi": _2,
                  "ena": _2,
                  "gifu": _2,
                  "ginan": _2,
                  "godo": _2,
                  "gujo": _2,
                  "hashima": _2,
                  "hichiso": _2,
                  "hida": _2,
                  "higashishirakawa": _2,
                  "ibigawa": _2,
                  "ikeda": _2,
                  "kakamigahara": _2,
                  "kani": _2,
                  "kasahara": _2,
                  "kasamatsu": _2,
                  "kawaue": _2,
                  "kitagata": _2,
                  "mino": _2,
                  "minokamo": _2,
                  "mitake": _2,
                  "mizunami": _2,
                  "motosu": _2,
                  "nakatsugawa": _2,
                  "ogaki": _2,
                  "sakahogi": _2,
                  "seki": _2,
                  "sekigahara": _2,
                  "shirakawa": _2,
                  "tajimi": _2,
                  "takayama": _2,
                  "tarui": _2,
                  "toki": _2,
                  "tomika": _2,
                  "wanouchi": _2,
                  "yamagata": _2,
                  "yaotsu": _2,
                  "yoro": _2
                }
              },
              "gunma": {
                "$": 1,
                "succ": {
                  "annaka": _2,
                  "chiyoda": _2,
                  "fujioka": _2,
                  "higashiagatsuma": _2,
                  "isesaki": _2,
                  "itakura": _2,
                  "kanna": _2,
                  "kanra": _2,
                  "katashina": _2,
                  "kawaba": _2,
                  "kiryu": _2,
                  "kusatsu": _2,
                  "maebashi": _2,
                  "meiwa": _2,
                  "midori": _2,
                  "minakami": _2,
                  "naganohara": _2,
                  "nakanojo": _2,
                  "nanmoku": _2,
                  "numata": _2,
                  "oizumi": _2,
                  "ora": _2,
                  "ota": _2,
                  "shibukawa": _2,
                  "shimonita": _2,
                  "shinto": _2,
                  "showa": _2,
                  "takasaki": _2,
                  "takayama": _2,
                  "tamamura": _2,
                  "tatebayashi": _2,
                  "tomioka": _2,
                  "tsukiyono": _2,
                  "tsumagoi": _2,
                  "ueno": _2,
                  "yoshioka": _2
                }
              },
              "hiroshima": {
                "$": 1,
                "succ": {
                  "asaminami": _2,
                  "daiwa": _2,
                  "etajima": _2,
                  "fuchu": _2,
                  "fukuyama": _2,
                  "hatsukaichi": _2,
                  "higashihiroshima": _2,
                  "hongo": _2,
                  "jinsekikogen": _2,
                  "kaita": _2,
                  "kui": _2,
                  "kumano": _2,
                  "kure": _2,
                  "mihara": _2,
                  "miyoshi": _2,
                  "naka": _2,
                  "onomichi": _2,
                  "osakikamijima": _2,
                  "otake": _2,
                  "saka": _2,
                  "sera": _2,
                  "seranishi": _2,
                  "shinichi": _2,
                  "shobara": _2,
                  "takehara": _2
                }
              },
              "hokkaido": {
                "$": 1,
                "succ": {
                  "abashiri": _2,
                  "abira": _2,
                  "aibetsu": _2,
                  "akabira": _2,
                  "akkeshi": _2,
                  "asahikawa": _2,
                  "ashibetsu": _2,
                  "ashoro": _2,
                  "assabu": _2,
                  "atsuma": _2,
                  "bibai": _2,
                  "biei": _2,
                  "bifuka": _2,
                  "bihoro": _2,
                  "biratori": _2,
                  "chippubetsu": _2,
                  "chitose": _2,
                  "date": _2,
                  "ebetsu": _2,
                  "embetsu": _2,
                  "eniwa": _2,
                  "erimo": _2,
                  "esan": _2,
                  "esashi": _2,
                  "fukagawa": _2,
                  "fukushima": _2,
                  "furano": _2,
                  "furubira": _2,
                  "haboro": _2,
                  "hakodate": _2,
                  "hamatonbetsu": _2,
                  "hidaka": _2,
                  "higashikagura": _2,
                  "higashikawa": _2,
                  "hiroo": _2,
                  "hokuryu": _2,
                  "hokuto": _2,
                  "honbetsu": _2,
                  "horokanai": _2,
                  "horonobe": _2,
                  "ikeda": _2,
                  "imakane": _2,
                  "ishikari": _2,
                  "iwamizawa": _2,
                  "iwanai": _2,
                  "kamifurano": _2,
                  "kamikawa": _2,
                  "kamishihoro": _2,
                  "kamisunagawa": _2,
                  "kamoenai": _2,
                  "kayabe": _2,
                  "kembuchi": _2,
                  "kikonai": _2,
                  "kimobetsu": _2,
                  "kitahiroshima": _2,
                  "kitami": _2,
                  "kiyosato": _2,
                  "koshimizu": _2,
                  "kunneppu": _2,
                  "kuriyama": _2,
                  "kuromatsunai": _2,
                  "kushiro": _2,
                  "kutchan": _2,
                  "kyowa": _2,
                  "mashike": _2,
                  "matsumae": _2,
                  "mikasa": _2,
                  "minamifurano": _2,
                  "mombetsu": _2,
                  "moseushi": _2,
                  "mukawa": _2,
                  "muroran": _2,
                  "naie": _2,
                  "nakagawa": _2,
                  "nakasatsunai": _2,
                  "nakatombetsu": _2,
                  "nanae": _2,
                  "nanporo": _2,
                  "nayoro": _2,
                  "nemuro": _2,
                  "niikappu": _2,
                  "niki": _2,
                  "nishiokoppe": _2,
                  "noboribetsu": _2,
                  "numata": _2,
                  "obihiro": _2,
                  "obira": _2,
                  "oketo": _2,
                  "okoppe": _2,
                  "otaru": _2,
                  "otobe": _2,
                  "otofuke": _2,
                  "otoineppu": _2,
                  "oumu": _2,
                  "ozora": _2,
                  "pippu": _2,
                  "rankoshi": _2,
                  "rebun": _2,
                  "rikubetsu": _2,
                  "rishiri": _2,
                  "rishirifuji": _2,
                  "saroma": _2,
                  "sarufutsu": _2,
                  "shakotan": _2,
                  "shari": _2,
                  "shibecha": _2,
                  "shibetsu": _2,
                  "shikabe": _2,
                  "shikaoi": _2,
                  "shimamaki": _2,
                  "shimizu": _2,
                  "shimokawa": _2,
                  "shinshinotsu": _2,
                  "shintoku": _2,
                  "shiranuka": _2,
                  "shiraoi": _2,
                  "shiriuchi": _2,
                  "sobetsu": _2,
                  "sunagawa": _2,
                  "taiki": _2,
                  "takasu": _2,
                  "takikawa": _2,
                  "takinoue": _2,
                  "teshikaga": _2,
                  "tobetsu": _2,
                  "tohma": _2,
                  "tomakomai": _2,
                  "tomari": _2,
                  "toya": _2,
                  "toyako": _2,
                  "toyotomi": _2,
                  "toyoura": _2,
                  "tsubetsu": _2,
                  "tsukigata": _2,
                  "urakawa": _2,
                  "urausu": _2,
                  "uryu": _2,
                  "utashinai": _2,
                  "wakkanai": _2,
                  "wassamu": _2,
                  "yakumo": _2,
                  "yoichi": _2
                }
              },
              "hyogo": {
                "$": 1,
                "succ": {
                  "aioi": _2,
                  "akashi": _2,
                  "ako": _2,
                  "amagasaki": _2,
                  "aogaki": _2,
                  "asago": _2,
                  "ashiya": _2,
                  "awaji": _2,
                  "fukusaki": _2,
                  "goshiki": _2,
                  "harima": _2,
                  "himeji": _2,
                  "ichikawa": _2,
                  "inagawa": _2,
                  "itami": _2,
                  "kakogawa": _2,
                  "kamigori": _2,
                  "kamikawa": _2,
                  "kasai": _2,
                  "kasuga": _2,
                  "kawanishi": _2,
                  "miki": _2,
                  "minamiawaji": _2,
                  "nishinomiya": _2,
                  "nishiwaki": _2,
                  "ono": _2,
                  "sanda": _2,
                  "sannan": _2,
                  "sasayama": _2,
                  "sayo": _2,
                  "shingu": _2,
                  "shinonsen": _2,
                  "shiso": _2,
                  "sumoto": _2,
                  "taishi": _2,
                  "taka": _2,
                  "takarazuka": _2,
                  "takasago": _2,
                  "takino": _2,
                  "tamba": _2,
                  "tatsuno": _2,
                  "toyooka": _2,
                  "yabu": _2,
                  "yashiro": _2,
                  "yoka": _2,
                  "yokawa": _2
                }
              },
              "ibaraki": {
                "$": 1,
                "succ": {
                  "ami": _2,
                  "asahi": _2,
                  "bando": _2,
                  "chikusei": _2,
                  "daigo": _2,
                  "fujishiro": _2,
                  "hitachi": _2,
                  "hitachinaka": _2,
                  "hitachiomiya": _2,
                  "hitachiota": _2,
                  "ibaraki": _2,
                  "ina": _2,
                  "inashiki": _2,
                  "itako": _2,
                  "iwama": _2,
                  "joso": _2,
                  "kamisu": _2,
                  "kasama": _2,
                  "kashima": _2,
                  "kasumigaura": _2,
                  "koga": _2,
                  "miho": _2,
                  "mito": _2,
                  "moriya": _2,
                  "naka": _2,
                  "namegata": _2,
                  "oarai": _2,
                  "ogawa": _2,
                  "omitama": _2,
                  "ryugasaki": _2,
                  "sakai": _2,
                  "sakuragawa": _2,
                  "shimodate": _2,
                  "shimotsuma": _2,
                  "shirosato": _2,
                  "sowa": _2,
                  "suifu": _2,
                  "takahagi": _2,
                  "tamatsukuri": _2,
                  "tokai": _2,
                  "tomobe": _2,
                  "tone": _2,
                  "toride": _2,
                  "tsuchiura": _2,
                  "tsukuba": _2,
                  "uchihara": _2,
                  "ushiku": _2,
                  "yachiyo": _2,
                  "yamagata": _2,
                  "yawara": _2,
                  "yuki": _2
                }
              },
              "ishikawa": {
                "$": 1,
                "succ": {
                  "anamizu": _2,
                  "hakui": _2,
                  "hakusan": _2,
                  "kaga": _2,
                  "kahoku": _2,
                  "kanazawa": _2,
                  "kawakita": _2,
                  "komatsu": _2,
                  "nakanoto": _2,
                  "nanao": _2,
                  "nomi": _2,
                  "nonoichi": _2,
                  "noto": _2,
                  "shika": _2,
                  "suzu": _2,
                  "tsubata": _2,
                  "tsurugi": _2,
                  "uchinada": _2,
                  "wajima": _2
                }
              },
              "iwate": {
                "$": 1,
                "succ": {
                  "fudai": _2,
                  "fujisawa": _2,
                  "hanamaki": _2,
                  "hiraizumi": _2,
                  "hirono": _2,
                  "ichinohe": _2,
                  "ichinoseki": _2,
                  "iwaizumi": _2,
                  "iwate": _2,
                  "joboji": _2,
                  "kamaishi": _2,
                  "kanegasaki": _2,
                  "karumai": _2,
                  "kawai": _2,
                  "kitakami": _2,
                  "kuji": _2,
                  "kunohe": _2,
                  "kuzumaki": _2,
                  "miyako": _2,
                  "mizusawa": _2,
                  "morioka": _2,
                  "ninohe": _2,
                  "noda": _2,
                  "ofunato": _2,
                  "oshu": _2,
                  "otsuchi": _2,
                  "rikuzentakata": _2,
                  "shiwa": _2,
                  "shizukuishi": _2,
                  "sumita": _2,
                  "tanohata": _2,
                  "tono": _2,
                  "yahaba": _2,
                  "yamada": _2
                }
              },
              "kagawa": {
                "$": 1,
                "succ": {
                  "ayagawa": _2,
                  "higashikagawa": _2,
                  "kanonji": _2,
                  "kotohira": _2,
                  "manno": _2,
                  "marugame": _2,
                  "mitoyo": _2,
                  "naoshima": _2,
                  "sanuki": _2,
                  "tadotsu": _2,
                  "takamatsu": _2,
                  "tonosho": _2,
                  "uchinomi": _2,
                  "utazu": _2,
                  "zentsuji": _2
                }
              },
              "kagoshima": {
                "$": 1,
                "succ": {
                  "akune": _2,
                  "amami": _2,
                  "hioki": _2,
                  "isa": _2,
                  "isen": _2,
                  "izumi": _2,
                  "kagoshima": _2,
                  "kanoya": _2,
                  "kawanabe": _2,
                  "kinko": _2,
                  "kouyama": _2,
                  "makurazaki": _2,
                  "matsumoto": _2,
                  "minamitane": _2,
                  "nakatane": _2,
                  "nishinoomote": _2,
                  "satsumasendai": _2,
                  "soo": _2,
                  "tarumizu": _2,
                  "yusui": _2
                }
              },
              "kanagawa": {
                "$": 1,
                "succ": {
                  "aikawa": _2,
                  "atsugi": _2,
                  "ayase": _2,
                  "chigasaki": _2,
                  "ebina": _2,
                  "fujisawa": _2,
                  "hadano": _2,
                  "hakone": _2,
                  "hiratsuka": _2,
                  "isehara": _2,
                  "kaisei": _2,
                  "kamakura": _2,
                  "kiyokawa": _2,
                  "matsuda": _2,
                  "minamiashigara": _2,
                  "miura": _2,
                  "nakai": _2,
                  "ninomiya": _2,
                  "odawara": _2,
                  "oi": _2,
                  "oiso": _2,
                  "sagamihara": _2,
                  "samukawa": _2,
                  "tsukui": _2,
                  "yamakita": _2,
                  "yamato": _2,
                  "yokosuka": _2,
                  "yugawara": _2,
                  "zama": _2,
                  "zushi": _2
                }
              },
              "kochi": {
                "$": 1,
                "succ": {
                  "aki": _2,
                  "geisei": _2,
                  "hidaka": _2,
                  "higashitsuno": _2,
                  "ino": _2,
                  "kagami": _2,
                  "kami": _2,
                  "kitagawa": _2,
                  "kochi": _2,
                  "mihara": _2,
                  "motoyama": _2,
                  "muroto": _2,
                  "nahari": _2,
                  "nakamura": _2,
                  "nankoku": _2,
                  "nishitosa": _2,
                  "niyodogawa": _2,
                  "ochi": _2,
                  "okawa": _2,
                  "otoyo": _2,
                  "otsuki": _2,
                  "sakawa": _2,
                  "sukumo": _2,
                  "susaki": _2,
                  "tosa": _2,
                  "tosashimizu": _2,
                  "toyo": _2,
                  "tsuno": _2,
                  "umaji": _2,
                  "yasuda": _2,
                  "yusuhara": _2
                }
              },
              "kumamoto": {
                "$": 1,
                "succ": {
                  "amakusa": _2,
                  "arao": _2,
                  "aso": _2,
                  "choyo": _2,
                  "gyokuto": _2,
                  "kamiamakusa": _2,
                  "kikuchi": _2,
                  "kumamoto": _2,
                  "mashiki": _2,
                  "mifune": _2,
                  "minamata": _2,
                  "minamioguni": _2,
                  "nagasu": _2,
                  "nishihara": _2,
                  "oguni": _2,
                  "ozu": _2,
                  "sumoto": _2,
                  "takamori": _2,
                  "uki": _2,
                  "uto": _2,
                  "yamaga": _2,
                  "yamato": _2,
                  "yatsushiro": _2
                }
              },
              "kyoto": {
                "$": 1,
                "succ": {
                  "ayabe": _2,
                  "fukuchiyama": _2,
                  "higashiyama": _2,
                  "ide": _2,
                  "ine": _2,
                  "joyo": _2,
                  "kameoka": _2,
                  "kamo": _2,
                  "kita": _2,
                  "kizu": _2,
                  "kumiyama": _2,
                  "kyotamba": _2,
                  "kyotanabe": _2,
                  "kyotango": _2,
                  "maizuru": _2,
                  "minami": _2,
                  "minamiyamashiro": _2,
                  "miyazu": _2,
                  "muko": _2,
                  "nagaokakyo": _2,
                  "nakagyo": _2,
                  "nantan": _2,
                  "oyamazaki": _2,
                  "sakyo": _2,
                  "seika": _2,
                  "tanabe": _2,
                  "uji": _2,
                  "ujitawara": _2,
                  "wazuka": _2,
                  "yamashina": _2,
                  "yawata": _2
                }
              },
              "mie": {
                "$": 1,
                "succ": {
                  "asahi": _2,
                  "inabe": _2,
                  "ise": _2,
                  "kameyama": _2,
                  "kawagoe": _2,
                  "kiho": _2,
                  "kisosaki": _2,
                  "kiwa": _2,
                  "komono": _2,
                  "kumano": _2,
                  "kuwana": _2,
                  "matsusaka": _2,
                  "meiwa": _2,
                  "mihama": _2,
                  "minamiise": _2,
                  "misugi": _2,
                  "miyama": _2,
                  "nabari": _2,
                  "shima": _2,
                  "suzuka": _2,
                  "tado": _2,
                  "taiki": _2,
                  "taki": _2,
                  "tamaki": _2,
                  "toba": _2,
                  "tsu": _2,
                  "udono": _2,
                  "ureshino": _2,
                  "watarai": _2,
                  "yokkaichi": _2
                }
              },
              "miyagi": {
                "$": 1,
                "succ": {
                  "furukawa": _2,
                  "higashimatsushima": _2,
                  "ishinomaki": _2,
                  "iwanuma": _2,
                  "kakuda": _2,
                  "kami": _2,
                  "kawasaki": _2,
                  "marumori": _2,
                  "matsushima": _2,
                  "minamisanriku": _2,
                  "misato": _2,
                  "murata": _2,
                  "natori": _2,
                  "ogawara": _2,
                  "ohira": _2,
                  "onagawa": _2,
                  "osaki": _2,
                  "rifu": _2,
                  "semine": _2,
                  "shibata": _2,
                  "shichikashuku": _2,
                  "shikama": _2,
                  "shiogama": _2,
                  "shiroishi": _2,
                  "tagajo": _2,
                  "taiwa": _2,
                  "tome": _2,
                  "tomiya": _2,
                  "wakuya": _2,
                  "watari": _2,
                  "yamamoto": _2,
                  "zao": _2
                }
              },
              "miyazaki": {
                "$": 1,
                "succ": {
                  "aya": _2,
                  "ebino": _2,
                  "gokase": _2,
                  "hyuga": _2,
                  "kadogawa": _2,
                  "kawaminami": _2,
                  "kijo": _2,
                  "kitagawa": _2,
                  "kitakata": _2,
                  "kitaura": _2,
                  "kobayashi": _2,
                  "kunitomi": _2,
                  "kushima": _2,
                  "mimata": _2,
                  "miyakonojo": _2,
                  "miyazaki": _2,
                  "morotsuka": _2,
                  "nichinan": _2,
                  "nishimera": _2,
                  "nobeoka": _2,
                  "saito": _2,
                  "shiiba": _2,
                  "shintomi": _2,
                  "takaharu": _2,
                  "takanabe": _2,
                  "takazaki": _2,
                  "tsuno": _2
                }
              },
              "nagano": {
                "$": 1,
                "succ": {
                  "achi": _2,
                  "agematsu": _2,
                  "anan": _2,
                  "aoki": _2,
                  "asahi": _2,
                  "azumino": _2,
                  "chikuhoku": _2,
                  "chikuma": _2,
                  "chino": _2,
                  "fujimi": _2,
                  "hakuba": _2,
                  "hara": _2,
                  "hiraya": _2,
                  "iida": _2,
                  "iijima": _2,
                  "iiyama": _2,
                  "iizuna": _2,
                  "ikeda": _2,
                  "ikusaka": _2,
                  "ina": _2,
                  "karuizawa": _2,
                  "kawakami": _2,
                  "kiso": _2,
                  "kisofukushima": _2,
                  "kitaaiki": _2,
                  "komagane": _2,
                  "komoro": _2,
                  "matsukawa": _2,
                  "matsumoto": _2,
                  "miasa": _2,
                  "minamiaiki": _2,
                  "minamimaki": _2,
                  "minamiminowa": _2,
                  "minowa": _2,
                  "miyada": _2,
                  "miyota": _2,
                  "mochizuki": _2,
                  "nagano": _2,
                  "nagawa": _2,
                  "nagiso": _2,
                  "nakagawa": _2,
                  "nakano": _2,
                  "nozawaonsen": _2,
                  "obuse": _2,
                  "ogawa": _2,
                  "okaya": _2,
                  "omachi": _2,
                  "omi": _2,
                  "ookuwa": _2,
                  "ooshika": _2,
                  "otaki": _2,
                  "otari": _2,
                  "sakae": _2,
                  "sakaki": _2,
                  "saku": _2,
                  "sakuho": _2,
                  "shimosuwa": _2,
                  "shinanomachi": _2,
                  "shiojiri": _2,
                  "suwa": _2,
                  "suzaka": _2,
                  "takagi": _2,
                  "takamori": _2,
                  "takayama": _2,
                  "tateshina": _2,
                  "tatsuno": _2,
                  "togakushi": _2,
                  "togura": _2,
                  "tomi": _2,
                  "ueda": _2,
                  "wada": _2,
                  "yamagata": _2,
                  "yamanouchi": _2,
                  "yasaka": _2,
                  "yasuoka": _2
                }
              },
              "nagasaki": {
                "$": 1,
                "succ": {
                  "chijiwa": _2,
                  "futsu": _2,
                  "goto": _2,
                  "hasami": _2,
                  "hirado": _2,
                  "iki": _2,
                  "isahaya": _2,
                  "kawatana": _2,
                  "kuchinotsu": _2,
                  "matsuura": _2,
                  "nagasaki": _2,
                  "obama": _2,
                  "omura": _2,
                  "oseto": _2,
                  "saikai": _2,
                  "sasebo": _2,
                  "seihi": _2,
                  "shimabara": _2,
                  "shinkamigoto": _2,
                  "togitsu": _2,
                  "tsushima": _2,
                  "unzen": _2
                }
              },
              "nara": {
                "$": 1,
                "succ": {
                  "ando": _2,
                  "gose": _2,
                  "heguri": _2,
                  "higashiyoshino": _2,
                  "ikaruga": _2,
                  "ikoma": _2,
                  "kamikitayama": _2,
                  "kanmaki": _2,
                  "kashiba": _2,
                  "kashihara": _2,
                  "katsuragi": _2,
                  "kawai": _2,
                  "kawakami": _2,
                  "kawanishi": _2,
                  "koryo": _2,
                  "kurotaki": _2,
                  "mitsue": _2,
                  "miyake": _2,
                  "nara": _2,
                  "nosegawa": _2,
                  "oji": _2,
                  "ouda": _2,
                  "oyodo": _2,
                  "sakurai": _2,
                  "sango": _2,
                  "shimoichi": _2,
                  "shimokitayama": _2,
                  "shinjo": _2,
                  "soni": _2,
                  "takatori": _2,
                  "tawaramoto": _2,
                  "tenkawa": _2,
                  "tenri": _2,
                  "uda": _2,
                  "yamatokoriyama": _2,
                  "yamatotakada": _2,
                  "yamazoe": _2,
                  "yoshino": _2
                }
              },
              "niigata": {
                "$": 1,
                "succ": {
                  "aga": _2,
                  "agano": _2,
                  "gosen": _2,
                  "itoigawa": _2,
                  "izumozaki": _2,
                  "joetsu": _2,
                  "kamo": _2,
                  "kariwa": _2,
                  "kashiwazaki": _2,
                  "minamiuonuma": _2,
                  "mitsuke": _2,
                  "muika": _2,
                  "murakami": _2,
                  "myoko": _2,
                  "nagaoka": _2,
                  "niigata": _2,
                  "ojiya": _2,
                  "omi": _2,
                  "sado": _2,
                  "sanjo": _2,
                  "seiro": _2,
                  "seirou": _2,
                  "sekikawa": _2,
                  "shibata": _2,
                  "tagami": _2,
                  "tainai": _2,
                  "tochio": _2,
                  "tokamachi": _2,
                  "tsubame": _2,
                  "tsunan": _2,
                  "uonuma": _2,
                  "yahiko": _2,
                  "yoita": _2,
                  "yuzawa": _2
                }
              },
              "oita": {
                "$": 1,
                "succ": {
                  "beppu": _2,
                  "bungoono": _2,
                  "bungotakada": _2,
                  "hasama": _2,
                  "hiji": _2,
                  "himeshima": _2,
                  "hita": _2,
                  "kamitsue": _2,
                  "kokonoe": _2,
                  "kuju": _2,
                  "kunisaki": _2,
                  "kusu": _2,
                  "oita": _2,
                  "saiki": _2,
                  "taketa": _2,
                  "tsukumi": _2,
                  "usa": _2,
                  "usuki": _2,
                  "yufu": _2
                }
              },
              "okayama": {
                "$": 1,
                "succ": {
                  "akaiwa": _2,
                  "asakuchi": _2,
                  "bizen": _2,
                  "hayashima": _2,
                  "ibara": _2,
                  "kagamino": _2,
                  "kasaoka": _2,
                  "kibichuo": _2,
                  "kumenan": _2,
                  "kurashiki": _2,
                  "maniwa": _2,
                  "misaki": _2,
                  "nagi": _2,
                  "niimi": _2,
                  "nishiawakura": _2,
                  "okayama": _2,
                  "satosho": _2,
                  "setouchi": _2,
                  "shinjo": _2,
                  "shoo": _2,
                  "soja": _2,
                  "takahashi": _2,
                  "tamano": _2,
                  "tsuyama": _2,
                  "wake": _2,
                  "yakage": _2
                }
              },
              "okinawa": {
                "$": 1,
                "succ": {
                  "aguni": _2,
                  "ginowan": _2,
                  "ginoza": _2,
                  "gushikami": _2,
                  "haebaru": _2,
                  "higashi": _2,
                  "hirara": _2,
                  "iheya": _2,
                  "ishigaki": _2,
                  "ishikawa": _2,
                  "itoman": _2,
                  "izena": _2,
                  "kadena": _2,
                  "kin": _2,
                  "kitadaito": _2,
                  "kitanakagusuku": _2,
                  "kumejima": _2,
                  "kunigami": _2,
                  "minamidaito": _2,
                  "motobu": _2,
                  "nago": _2,
                  "naha": _2,
                  "nakagusuku": _2,
                  "nakijin": _2,
                  "nanjo": _2,
                  "nishihara": _2,
                  "ogimi": _2,
                  "okinawa": _2,
                  "onna": _2,
                  "shimoji": _2,
                  "taketomi": _2,
                  "tarama": _2,
                  "tokashiki": _2,
                  "tomigusuku": _2,
                  "tonaki": _2,
                  "urasoe": _2,
                  "uruma": _2,
                  "yaese": _2,
                  "yomitan": _2,
                  "yonabaru": _2,
                  "yonaguni": _2,
                  "zamami": _2
                }
              },
              "osaka": {
                "$": 1,
                "succ": {
                  "abeno": _2,
                  "chihayaakasaka": _2,
                  "chuo": _2,
                  "daito": _2,
                  "fujiidera": _2,
                  "habikino": _2,
                  "hannan": _2,
                  "higashiosaka": _2,
                  "higashisumiyoshi": _2,
                  "higashiyodogawa": _2,
                  "hirakata": _2,
                  "ibaraki": _2,
                  "ikeda": _2,
                  "izumi": _2,
                  "izumiotsu": _2,
                  "izumisano": _2,
                  "kadoma": _2,
                  "kaizuka": _2,
                  "kanan": _2,
                  "kashiwara": _2,
                  "katano": _2,
                  "kawachinagano": _2,
                  "kishiwada": _2,
                  "kita": _2,
                  "kumatori": _2,
                  "matsubara": _2,
                  "minato": _2,
                  "minoh": _2,
                  "misaki": _2,
                  "moriguchi": _2,
                  "neyagawa": _2,
                  "nishi": _2,
                  "nose": _2,
                  "osakasayama": _2,
                  "sakai": _2,
                  "sayama": _2,
                  "sennan": _2,
                  "settsu": _2,
                  "shijonawate": _2,
                  "shimamoto": _2,
                  "suita": _2,
                  "tadaoka": _2,
                  "taishi": _2,
                  "tajiri": _2,
                  "takaishi": _2,
                  "takatsuki": _2,
                  "tondabayashi": _2,
                  "toyonaka": _2,
                  "toyono": _2,
                  "yao": _2
                }
              },
              "saga": {
                "$": 1,
                "succ": {
                  "ariake": _2,
                  "arita": _2,
                  "fukudomi": _2,
                  "genkai": _2,
                  "hamatama": _2,
                  "hizen": _2,
                  "imari": _2,
                  "kamimine": _2,
                  "kanzaki": _2,
                  "karatsu": _2,
                  "kashima": _2,
                  "kitagata": _2,
                  "kitahata": _2,
                  "kiyama": _2,
                  "kouhoku": _2,
                  "kyuragi": _2,
                  "nishiarita": _2,
                  "ogi": _2,
                  "omachi": _2,
                  "ouchi": _2,
                  "saga": _2,
                  "shiroishi": _2,
                  "taku": _2,
                  "tara": _2,
                  "tosu": _2,
                  "yoshinogari": _2
                }
              },
              "saitama": {
                "$": 1,
                "succ": {
                  "arakawa": _2,
                  "asaka": _2,
                  "chichibu": _2,
                  "fujimi": _2,
                  "fujimino": _2,
                  "fukaya": _2,
                  "hanno": _2,
                  "hanyu": _2,
                  "hasuda": _2,
                  "hatogaya": _2,
                  "hatoyama": _2,
                  "hidaka": _2,
                  "higashichichibu": _2,
                  "higashimatsuyama": _2,
                  "honjo": _2,
                  "ina": _2,
                  "iruma": _2,
                  "iwatsuki": _2,
                  "kamiizumi": _2,
                  "kamikawa": _2,
                  "kamisato": _2,
                  "kasukabe": _2,
                  "kawagoe": _2,
                  "kawaguchi": _2,
                  "kawajima": _2,
                  "kazo": _2,
                  "kitamoto": _2,
                  "koshigaya": _2,
                  "kounosu": _2,
                  "kuki": _2,
                  "kumagaya": _2,
                  "matsubushi": _2,
                  "minano": _2,
                  "misato": _2,
                  "miyashiro": _2,
                  "miyoshi": _2,
                  "moroyama": _2,
                  "nagatoro": _2,
                  "namegawa": _2,
                  "niiza": _2,
                  "ogano": _2,
                  "ogawa": _2,
                  "ogose": _2,
                  "okegawa": _2,
                  "omiya": _2,
                  "otaki": _2,
                  "ranzan": _2,
                  "ryokami": _2,
                  "saitama": _2,
                  "sakado": _2,
                  "satte": _2,
                  "sayama": _2,
                  "shiki": _2,
                  "shiraoka": _2,
                  "soka": _2,
                  "sugito": _2,
                  "toda": _2,
                  "tokigawa": _2,
                  "tokorozawa": _2,
                  "tsurugashima": _2,
                  "urawa": _2,
                  "warabi": _2,
                  "yashio": _2,
                  "yokoze": _2,
                  "yono": _2,
                  "yorii": _2,
                  "yoshida": _2,
                  "yoshikawa": _2,
                  "yoshimi": _2
                }
              },
              "shiga": {
                "$": 1,
                "succ": {
                  "aisho": _2,
                  "gamo": _2,
                  "higashiomi": _2,
                  "hikone": _2,
                  "koka": _2,
                  "konan": _2,
                  "kosei": _2,
                  "koto": _2,
                  "kusatsu": _2,
                  "maibara": _2,
                  "moriyama": _2,
                  "nagahama": _2,
                  "nishiazai": _2,
                  "notogawa": _2,
                  "omihachiman": _2,
                  "otsu": _2,
                  "ritto": _2,
                  "ryuoh": _2,
                  "takashima": _2,
                  "takatsuki": _2,
                  "torahime": _2,
                  "toyosato": _2,
                  "yasu": _2
                }
              },
              "shimane": {
                "$": 1,
                "succ": {
                  "akagi": _2,
                  "ama": _2,
                  "gotsu": _2,
                  "hamada": _2,
                  "higashiizumo": _2,
                  "hikawa": _2,
                  "hikimi": _2,
                  "izumo": _2,
                  "kakinoki": _2,
                  "masuda": _2,
                  "matsue": _2,
                  "misato": _2,
                  "nishinoshima": _2,
                  "ohda": _2,
                  "okinoshima": _2,
                  "okuizumo": _2,
                  "shimane": _2,
                  "tamayu": _2,
                  "tsuwano": _2,
                  "unnan": _2,
                  "yakumo": _2,
                  "yasugi": _2,
                  "yatsuka": _2
                }
              },
              "shizuoka": {
                "$": 1,
                "succ": {
                  "arai": _2,
                  "atami": _2,
                  "fuji": _2,
                  "fujieda": _2,
                  "fujikawa": _2,
                  "fujinomiya": _2,
                  "fukuroi": _2,
                  "gotemba": _2,
                  "haibara": _2,
                  "hamamatsu": _2,
                  "higashiizu": _2,
                  "ito": _2,
                  "iwata": _2,
                  "izu": _2,
                  "izunokuni": _2,
                  "kakegawa": _2,
                  "kannami": _2,
                  "kawanehon": _2,
                  "kawazu": _2,
                  "kikugawa": _2,
                  "kosai": _2,
                  "makinohara": _2,
                  "matsuzaki": _2,
                  "minamiizu": _2,
                  "mishima": _2,
                  "morimachi": _2,
                  "nishiizu": _2,
                  "numazu": _2,
                  "omaezaki": _2,
                  "shimada": _2,
                  "shimizu": _2,
                  "shimoda": _2,
                  "shizuoka": _2,
                  "susono": _2,
                  "yaizu": _2,
                  "yoshida": _2
                }
              },
              "tochigi": {
                "$": 1,
                "succ": {
                  "ashikaga": _2,
                  "bato": _2,
                  "haga": _2,
                  "ichikai": _2,
                  "iwafune": _2,
                  "kaminokawa": _2,
                  "kanuma": _2,
                  "karasuyama": _2,
                  "kuroiso": _2,
                  "mashiko": _2,
                  "mibu": _2,
                  "moka": _2,
                  "motegi": _2,
                  "nasu": _2,
                  "nasushiobara": _2,
                  "nikko": _2,
                  "nishikata": _2,
                  "nogi": _2,
                  "ohira": _2,
                  "ohtawara": _2,
                  "oyama": _2,
                  "sakura": _2,
                  "sano": _2,
                  "shimotsuke": _2,
                  "shioya": _2,
                  "takanezawa": _2,
                  "tochigi": _2,
                  "tsuga": _2,
                  "ujiie": _2,
                  "utsunomiya": _2,
                  "yaita": _2
                }
              },
              "tokushima": {
                "$": 1,
                "succ": {
                  "aizumi": _2,
                  "anan": _2,
                  "ichiba": _2,
                  "itano": _2,
                  "kainan": _2,
                  "komatsushima": _2,
                  "matsushige": _2,
                  "mima": _2,
                  "minami": _2,
                  "miyoshi": _2,
                  "mugi": _2,
                  "nakagawa": _2,
                  "naruto": _2,
                  "sanagochi": _2,
                  "shishikui": _2,
                  "tokushima": _2,
                  "wajiki": _2
                }
              },
              "tokyo": {
                "$": 1,
                "succ": {
                  "adachi": _2,
                  "akiruno": _2,
                  "akishima": _2,
                  "aogashima": _2,
                  "arakawa": _2,
                  "bunkyo": _2,
                  "chiyoda": _2,
                  "chofu": _2,
                  "chuo": _2,
                  "edogawa": _2,
                  "fuchu": _2,
                  "fussa": _2,
                  "hachijo": _2,
                  "hachioji": _2,
                  "hamura": _2,
                  "higashikurume": _2,
                  "higashimurayama": _2,
                  "higashiyamato": _2,
                  "hino": _2,
                  "hinode": _2,
                  "hinohara": _2,
                  "inagi": _2,
                  "itabashi": _2,
                  "katsushika": _2,
                  "kita": _2,
                  "kiyose": _2,
                  "kodaira": _2,
                  "koganei": _2,
                  "kokubunji": _2,
                  "komae": _2,
                  "koto": _2,
                  "kouzushima": _2,
                  "kunitachi": _2,
                  "machida": _2,
                  "meguro": _2,
                  "minato": _2,
                  "mitaka": _2,
                  "mizuho": _2,
                  "musashimurayama": _2,
                  "musashino": _2,
                  "nakano": _2,
                  "nerima": _2,
                  "ogasawara": _2,
                  "okutama": _2,
                  "ome": _2,
                  "oshima": _2,
                  "ota": _2,
                  "setagaya": _2,
                  "shibuya": _2,
                  "shinagawa": _2,
                  "shinjuku": _2,
                  "suginami": _2,
                  "sumida": _2,
                  "tachikawa": _2,
                  "taito": _2,
                  "tama": _2,
                  "toshima": _2
                }
              },
              "tottori": {
                "$": 1,
                "succ": {
                  "chizu": _2,
                  "hino": _2,
                  "kawahara": _2,
                  "koge": _2,
                  "kotoura": _2,
                  "misasa": _2,
                  "nanbu": _2,
                  "nichinan": _2,
                  "sakaiminato": _2,
                  "tottori": _2,
                  "wakasa": _2,
                  "yazu": _2,
                  "yonago": _2
                }
              },
              "toyama": {
                "$": 1,
                "succ": {
                  "asahi": _2,
                  "fuchu": _2,
                  "fukumitsu": _2,
                  "funahashi": _2,
                  "himi": _2,
                  "imizu": _2,
                  "inami": _2,
                  "johana": _2,
                  "kamiichi": _2,
                  "kurobe": _2,
                  "nakaniikawa": _2,
                  "namerikawa": _2,
                  "nanto": _2,
                  "nyuzen": _2,
                  "oyabe": _2,
                  "taira": _2,
                  "takaoka": _2,
                  "tateyama": _2,
                  "toga": _2,
                  "tonami": _2,
                  "toyama": _2,
                  "unazuki": _2,
                  "uozu": _2,
                  "yamada": _2
                }
              },
              "wakayama": {
                "$": 1,
                "succ": {
                  "arida": _2,
                  "aridagawa": _2,
                  "gobo": _2,
                  "hashimoto": _2,
                  "hidaka": _2,
                  "hirogawa": _2,
                  "inami": _2,
                  "iwade": _2,
                  "kainan": _2,
                  "kamitonda": _2,
                  "katsuragi": _2,
                  "kimino": _2,
                  "kinokawa": _2,
                  "kitayama": _2,
                  "koya": _2,
                  "koza": _2,
                  "kozagawa": _2,
                  "kudoyama": _2,
                  "kushimoto": _2,
                  "mihama": _2,
                  "misato": _2,
                  "nachikatsuura": _2,
                  "shingu": _2,
                  "shirahama": _2,
                  "taiji": _2,
                  "tanabe": _2,
                  "wakayama": _2,
                  "yuasa": _2,
                  "yura": _2
                }
              },
              "yamagata": {
                "$": 1,
                "succ": {
                  "asahi": _2,
                  "funagata": _2,
                  "higashine": _2,
                  "iide": _2,
                  "kahoku": _2,
                  "kaminoyama": _2,
                  "kaneyama": _2,
                  "kawanishi": _2,
                  "mamurogawa": _2,
                  "mikawa": _2,
                  "murayama": _2,
                  "nagai": _2,
                  "nakayama": _2,
                  "nanyo": _2,
                  "nishikawa": _2,
                  "obanazawa": _2,
                  "oe": _2,
                  "oguni": _2,
                  "ohkura": _2,
                  "oishida": _2,
                  "sagae": _2,
                  "sakata": _2,
                  "sakegawa": _2,
                  "shinjo": _2,
                  "shirataka": _2,
                  "shonai": _2,
                  "takahata": _2,
                  "tendo": _2,
                  "tozawa": _2,
                  "tsuruoka": _2,
                  "yamagata": _2,
                  "yamanobe": _2,
                  "yonezawa": _2,
                  "yuza": _2
                }
              },
              "yamaguchi": {
                "$": 1,
                "succ": {
                  "abu": _2,
                  "hagi": _2,
                  "hikari": _2,
                  "hofu": _2,
                  "iwakuni": _2,
                  "kudamatsu": _2,
                  "mitou": _2,
                  "nagato": _2,
                  "oshima": _2,
                  "shimonoseki": _2,
                  "shunan": _2,
                  "tabuse": _2,
                  "tokuyama": _2,
                  "toyota": _2,
                  "ube": _2,
                  "yuu": _2
                }
              },
              "yamanashi": {
                "$": 1,
                "succ": {
                  "chuo": _2,
                  "doshi": _2,
                  "fuefuki": _2,
                  "fujikawa": _2,
                  "fujikawaguchiko": _2,
                  "fujiyoshida": _2,
                  "hayakawa": _2,
                  "hokuto": _2,
                  "ichikawamisato": _2,
                  "kai": _2,
                  "kofu": _2,
                  "koshu": _2,
                  "kosuge": _2,
                  "minami-alps": _2,
                  "minobu": _2,
                  "nakamichi": _2,
                  "nanbu": _2,
                  "narusawa": _2,
                  "nirasaki": _2,
                  "nishikatsura": _2,
                  "oshino": _2,
                  "otsuki": _2,
                  "showa": _2,
                  "tabayama": _2,
                  "tsuru": _2,
                  "uenohara": _2,
                  "yamanakako": _2,
                  "yamanashi": _2
                }
              },
              "xn--4pvxs": _2,
              "栃木": _2,
              "xn--vgu402c": _2,
              "愛知": _2,
              "xn--c3s14m": _2,
              "愛媛": _2,
              "xn--f6qx53a": _2,
              "兵庫": _2,
              "xn--8pvr4u": _2,
              "熊本": _2,
              "xn--uist22h": _2,
              "茨城": _2,
              "xn--djrs72d6uy": _2,
              "北海道": _2,
              "xn--mkru45i": _2,
              "千葉": _2,
              "xn--0trq7p7nn": _2,
              "和歌山": _2,
              "xn--8ltr62k": _2,
              "長崎": _2,
              "xn--2m4a15e": _2,
              "長野": _2,
              "xn--efvn9s": _2,
              "新潟": _2,
              "xn--32vp30h": _2,
              "青森": _2,
              "xn--4it797k": _2,
              "静岡": _2,
              "xn--1lqs71d": _2,
              "東京": _2,
              "xn--5rtp49c": _2,
              "石川": _2,
              "xn--5js045d": _2,
              "埼玉": _2,
              "xn--ehqz56n": _2,
              "三重": _2,
              "xn--1lqs03n": _2,
              "京都": _2,
              "xn--qqqt11m": _2,
              "佐賀": _2,
              "xn--kbrq7o": _2,
              "大分": _2,
              "xn--pssu33l": _2,
              "大阪": _2,
              "xn--ntsq17g": _2,
              "奈良": _2,
              "xn--uisz3g": _2,
              "宮城": _2,
              "xn--6btw5a": _2,
              "宮崎": _2,
              "xn--1ctwo": _2,
              "富山": _2,
              "xn--6orx2r": _2,
              "山口": _2,
              "xn--rht61e": _2,
              "山形": _2,
              "xn--rht27z": _2,
              "山梨": _2,
              "xn--djty4k": _2,
              "岩手": _2,
              "xn--nit225k": _2,
              "岐阜": _2,
              "xn--rht3d": _2,
              "岡山": _2,
              "xn--klty5x": _2,
              "島根": _2,
              "xn--kltx9a": _2,
              "広島": _2,
              "xn--kltp7d": _2,
              "徳島": _2,
              "xn--uuwu58a": _2,
              "沖縄": _2,
              "xn--zbx025d": _2,
              "滋賀": _2,
              "xn--ntso0iqx3a": _2,
              "神奈川": _2,
              "xn--elqq16h": _2,
              "福井": _2,
              "xn--4it168d": _2,
              "福岡": _2,
              "xn--klt787d": _2,
              "福島": _2,
              "xn--rny31h": _2,
              "秋田": _2,
              "xn--7t0a264c": _2,
              "群馬": _2,
              "xn--5rtq34k": _2,
              "香川": _2,
              "xn--k7yn95e": _2,
              "高知": _2,
              "xn--tor131o": _2,
              "鳥取": _2,
              "xn--d5qv7z876c": _2,
              "鹿児島": _2,
              "kawasaki": _8,
              "kitakyushu": _8,
              "kobe": _8,
              "nagoya": _8,
              "sapporo": _8,
              "sendai": _8,
              "yokohama": _8,
              "buyshop": _3,
              "fashionstore": _3,
              "handcrafted": _3,
              "kawaiishop": _3,
              "supersale": _3,
              "theshop": _3,
              "usercontent": _3,
              "angry": _3,
              "babyblue": _3,
              "babymilk": _3,
              "backdrop": _3,
              "bambina": _3,
              "bitter": _3,
              "blush": _3,
              "boo": _3,
              "boy": _3,
              "boyfriend": _3,
              "but": _3,
              "candypop": _3,
              "capoo": _3,
              "catfood": _3,
              "cheap": _3,
              "chicappa": _3,
              "chillout": _3,
              "chips": _3,
              "chowder": _3,
              "chu": _3,
              "ciao": _3,
              "cocotte": _3,
              "coolblog": _3,
              "cranky": _3,
              "cutegirl": _3,
              "daa": _3,
              "deca": _3,
              "deci": _3,
              "digick": _3,
              "egoism": _3,
              "fakefur": _3,
              "fem": _3,
              "flier": _3,
              "floppy": _3,
              "fool": _3,
              "frenchkiss": _3,
              "girlfriend": _3,
              "girly": _3,
              "gloomy": _3,
              "gonna": _3,
              "greater": _3,
              "hacca": _3,
              "heavy": _3,
              "her": _3,
              "hiho": _3,
              "hippy": _3,
              "holy": _3,
              "hungry": _3,
              "icurus": _3,
              "itigo": _3,
              "jellybean": _3,
              "kikirara": _3,
              "kill": _3,
              "kilo": _3,
              "kuron": _3,
              "littlestar": _3,
              "lolipopmc": _3,
              "lolitapunk": _3,
              "lomo": _3,
              "lovepop": _3,
              "lovesick": _3,
              "main": _3,
              "mods": _3,
              "mond": _3,
              "mongolian": _3,
              "moo": _3,
              "namaste": _3,
              "nikita": _3,
              "nobushi": _3,
              "noor": _3,
              "oops": _3,
              "parallel": _3,
              "parasite": _3,
              "pecori": _3,
              "peewee": _3,
              "penne": _3,
              "pepper": _3,
              "perma": _3,
              "pigboat": _3,
              "pinoko": _3,
              "punyu": _3,
              "pupu": _3,
              "pussycat": _3,
              "pya": _3,
              "raindrop": _3,
              "readymade": _3,
              "sadist": _3,
              "schoolbus": _3,
              "secret": _3,
              "staba": _3,
              "stripper": _3,
              "sub": _3,
              "sunnyday": _3,
              "thick": _3,
              "tonkotsu": _3,
              "under": _3,
              "upper": _3,
              "velvet": _3,
              "verse": _3,
              "versus": _3,
              "vivian": _3,
              "watson": _3,
              "weblike": _3,
              "whitesnow": _3,
              "zombie": _3,
              "blogspot": _3,
              "2-d": _3,
              "bona": _3,
              "crap": _3,
              "daynight": _3,
              "eek": _3,
              "flop": _3,
              "halfmoon": _3,
              "jeez": _3,
              "matrix": _3,
              "mimoza": _3,
              "netgamers": _3,
              "nyanta": _3,
              "o0o0": _3,
              "rdy": _3,
              "rgr": _3,
              "rulez": _3,
              "sakurastorage": {
                "$": 0,
                "succ": {
                  "isk01": _12,
                  "isk02": _12
                }
              },
              "saloon": _3,
              "sblo": _3,
              "skr": _3,
              "tank": _3,
              "uh-oh": _3,
              "undo": _3,
              "webaccel": {
                "$": 0,
                "succ": {
                  "rs": _3,
                  "user": _3
                }
              },
              "websozai": _3,
              "xii": _3
            }
          },
          "ke": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": _6,
              "go": _2,
              "info": _2,
              "me": _2,
              "mobi": _2,
              "ne": _2,
              "or": _2,
              "sc": _2
            }
          },
          "kg": {
            "$": 1,
            "succ": {
              "org": _2,
              "net": _2,
              "com": _2,
              "edu": _2,
              "gov": _2,
              "mil": _2,
              "blog": _3,
              "io": _3,
              "jp": _3,
              "tv": _3,
              "uk": _3,
              "us": _3
            }
          },
          "kh": _8,
          "ki": _33,
          "km": {
            "$": 1,
            "succ": {
              "org": _2,
              "nom": _2,
              "gov": _2,
              "prd": _2,
              "tm": _2,
              "edu": _2,
              "mil": _2,
              "ass": _2,
              "com": _2,
              "coop": _2,
              "asso": _2,
              "presse": _2,
              "medecin": _2,
              "notaires": _2,
              "pharmaciens": _2,
              "veterinaire": _2,
              "gouv": _2
            }
          },
          "kn": {
            "$": 1,
            "succ": {
              "net": _2,
              "org": _2,
              "edu": _2,
              "gov": _2
            }
          },
          "kp": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "org": _2,
              "rep": _2,
              "tra": _2
            }
          },
          "kr": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": _2,
              "es": _2,
              "go": _2,
              "hs": _2,
              "kg": _2,
              "mil": _2,
              "ms": _2,
              "ne": _2,
              "or": _2,
              "pe": _2,
              "re": _2,
              "sc": _2,
              "busan": _2,
              "chungbuk": _2,
              "chungnam": _2,
              "daegu": _2,
              "daejeon": _2,
              "gangwon": _2,
              "gwangju": _2,
              "gyeongbuk": _2,
              "gyeonggi": _2,
              "gyeongnam": _2,
              "incheon": _2,
              "jeju": _2,
              "jeonbuk": _2,
              "jeonnam": _2,
              "seoul": _2,
              "ulsan": _2,
              "blogspot": _3
            }
          },
          "kw": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "emb": _2,
              "gov": _2,
              "ind": _2,
              "net": _2,
              "org": _2
            }
          },
          "ky": _25,
          "kz": {
            "$": 1,
            "succ": {
              "org": _2,
              "edu": _2,
              "net": _2,
              "gov": _2,
              "mil": _2,
              "com": _2,
              "jcloud": _3,
              "kazteleport": {
                "$": 0,
                "succ": {
                  "upaas": _3
                }
              }
            }
          },
          "la": {
            "$": 1,
            "succ": {
              "int": _2,
              "net": _2,
              "info": _2,
              "edu": _2,
              "gov": _2,
              "per": _2,
              "com": _2,
              "org": _2,
              "bnr": _3,
              "c": _3
            }
          },
          "lb": _4,
          "lc": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "co": _2,
              "org": _2,
              "edu": _2,
              "gov": _2,
              "oy": _3
            }
          },
          "li": {
            "$": 1,
            "succ": {
              "blogspot": _3,
              "caa": _3
            }
          },
          "lk": {
            "$": 1,
            "succ": {
              "gov": _2,
              "sch": _2,
              "net": _2,
              "int": _2,
              "com": _2,
              "org": _2,
              "edu": _2,
              "ngo": _2,
              "soc": _2,
              "web": _2,
              "ltd": _2,
              "assn": _2,
              "grp": _2,
              "hotel": _2,
              "ac": _2
            }
          },
          "lr": _4,
          "ls": {
            "$": 1,
            "succ": {
              "ac": _2,
              "biz": _2,
              "co": _2,
              "edu": _2,
              "gov": _2,
              "info": _2,
              "net": _2,
              "org": _2,
              "sc": _2,
              "de": _3
            }
          },
          "lt": _34,
          "lu": {
            "$": 1,
            "succ": {
              "blogspot": _3,
              "123website": _3
            }
          },
          "lv": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "org": _2,
              "mil": _2,
              "id": _2,
              "net": _2,
              "asn": _2,
              "conf": _2
            }
          },
          "ly": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "gov": _2,
              "plc": _2,
              "edu": _2,
              "sch": _2,
              "med": _2,
              "org": _2,
              "id": _2
            }
          },
          "ma": {
            "$": 1,
            "succ": {
              "co": _2,
              "net": _2,
              "gov": _2,
              "org": _2,
              "ac": _2,
              "press": _2
            }
          },
          "mc": {
            "$": 1,
            "succ": {
              "tm": _2,
              "asso": _2
            }
          },
          "md": {
            "$": 1,
            "succ": {
              "blogspot": _3,
              "at": _3,
              "de": _3,
              "jp": _3,
              "to": _3
            }
          },
          "me": {
            "$": 1,
            "succ": {
              "co": _2,
              "net": _2,
              "org": _2,
              "edu": _2,
              "ac": _2,
              "gov": _2,
              "its": _2,
              "priv": _2,
              "c66": _3,
              "daplie": {
                "$": 2,
                "succ": {
                  "localhost": _3
                }
              },
              "edgestack": _3,
              "filegear": _3,
              "filegear-au": _3,
              "filegear-de": _3,
              "filegear-gb": _3,
              "filegear-ie": _3,
              "filegear-jp": _3,
              "filegear-sg": _3,
              "glitch": _3,
              "ravendb": _3,
              "lohmus": _3,
              "barsy": _3,
              "mcpe": _3,
              "mcdir": _3,
              "soundcast": _3,
              "tcp4": _3,
              "brasilia": _3,
              "ddns": _3,
              "dnsfor": _3,
              "hopto": _3,
              "loginto": _3,
              "noip": _3,
              "webhop": _3,
              "vp4": _3,
              "diskstation": _3,
              "dscloud": _3,
              "i234": _3,
              "myds": _3,
              "synology": _3,
              "transip": _23,
              "wedeploy": _3,
              "yombo": _3,
              "nohost": _3
            }
          },
          "mg": {
            "$": 1,
            "succ": {
              "org": _2,
              "nom": _2,
              "gov": _2,
              "prd": _2,
              "tm": _2,
              "edu": _2,
              "mil": _2,
              "com": _2,
              "co": _2
            }
          },
          "mh": _2,
          "mil": _2,
          "mk": {
            "$": 1,
            "succ": {
              "com": _2,
              "org": _2,
              "net": _2,
              "edu": _2,
              "gov": _2,
              "inf": _2,
              "name": _2,
              "blogspot": _3
            }
          },
          "ml": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gouv": _2,
              "gov": _2,
              "net": _2,
              "org": _2,
              "presse": _2
            }
          },
          "mm": _8,
          "mn": {
            "$": 1,
            "succ": {
              "gov": _2,
              "edu": _2,
              "org": _2,
              "nyc": _3
            }
          },
          "mo": _4,
          "mobi": {
            "$": 1,
            "succ": {
              "barsy": _3,
              "dscloud": _3
            }
          },
          "mp": {
            "$": 1,
            "succ": {
              "ju": _3
            }
          },
          "mq": _2,
          "mr": _34,
          "ms": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "net": _2,
              "org": _2,
              "lab": _3,
              "minisite": _3
            }
          },
          "mt": {
            "$": 1,
            "succ": {
              "com": _6,
              "edu": _2,
              "net": _2,
              "org": _2
            }
          },
          "mu": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "org": _2,
              "gov": _2,
              "ac": _2,
              "co": _2,
              "or": _2
            }
          },
          "museum": {
            "$": 1,
            "succ": {
              "academy": _2,
              "agriculture": _2,
              "air": _2,
              "airguard": _2,
              "alabama": _2,
              "alaska": _2,
              "amber": _2,
              "ambulance": _2,
              "american": _2,
              "americana": _2,
              "americanantiques": _2,
              "americanart": _2,
              "amsterdam": _2,
              "and": _2,
              "annefrank": _2,
              "anthro": _2,
              "anthropology": _2,
              "antiques": _2,
              "aquarium": _2,
              "arboretum": _2,
              "archaeological": _2,
              "archaeology": _2,
              "architecture": _2,
              "art": _2,
              "artanddesign": _2,
              "artcenter": _2,
              "artdeco": _2,
              "arteducation": _2,
              "artgallery": _2,
              "arts": _2,
              "artsandcrafts": _2,
              "asmatart": _2,
              "assassination": _2,
              "assisi": _2,
              "association": _2,
              "astronomy": _2,
              "atlanta": _2,
              "austin": _2,
              "australia": _2,
              "automotive": _2,
              "aviation": _2,
              "axis": _2,
              "badajoz": _2,
              "baghdad": _2,
              "bahn": _2,
              "bale": _2,
              "baltimore": _2,
              "barcelona": _2,
              "baseball": _2,
              "basel": _2,
              "baths": _2,
              "bauern": _2,
              "beauxarts": _2,
              "beeldengeluid": _2,
              "bellevue": _2,
              "bergbau": _2,
              "berkeley": _2,
              "berlin": _2,
              "bern": _2,
              "bible": _2,
              "bilbao": _2,
              "bill": _2,
              "birdart": _2,
              "birthplace": _2,
              "bonn": _2,
              "boston": _2,
              "botanical": _2,
              "botanicalgarden": _2,
              "botanicgarden": _2,
              "botany": _2,
              "brandywinevalley": _2,
              "brasil": _2,
              "bristol": _2,
              "british": _2,
              "britishcolumbia": _2,
              "broadcast": _2,
              "brunel": _2,
              "brussel": _2,
              "brussels": _2,
              "bruxelles": _2,
              "building": _2,
              "burghof": _2,
              "bus": _2,
              "bushey": _2,
              "cadaques": _2,
              "california": _2,
              "cambridge": _2,
              "can": _2,
              "canada": _2,
              "capebreton": _2,
              "carrier": _2,
              "cartoonart": _2,
              "casadelamoneda": _2,
              "castle": _2,
              "castres": _2,
              "celtic": _2,
              "center": _2,
              "chattanooga": _2,
              "cheltenham": _2,
              "chesapeakebay": _2,
              "chicago": _2,
              "children": _2,
              "childrens": _2,
              "childrensgarden": _2,
              "chiropractic": _2,
              "chocolate": _2,
              "christiansburg": _2,
              "cincinnati": _2,
              "cinema": _2,
              "circus": _2,
              "civilisation": _2,
              "civilization": _2,
              "civilwar": _2,
              "clinton": _2,
              "clock": _2,
              "coal": _2,
              "coastaldefence": _2,
              "cody": _2,
              "coldwar": _2,
              "collection": _2,
              "colonialwilliamsburg": _2,
              "coloradoplateau": _2,
              "columbia": _2,
              "columbus": _2,
              "communication": _2,
              "communications": _2,
              "community": _2,
              "computer": _2,
              "computerhistory": _2,
              "xn--comunicaes-v6a2o": _2,
              "comunicações": _2,
              "contemporary": _2,
              "contemporaryart": _2,
              "convent": _2,
              "copenhagen": _2,
              "corporation": _2,
              "xn--correios-e-telecomunicaes-ghc29a": _2,
              "correios-e-telecomunicações": _2,
              "corvette": _2,
              "costume": _2,
              "countryestate": _2,
              "county": _2,
              "crafts": _2,
              "cranbrook": _2,
              "creation": _2,
              "cultural": _2,
              "culturalcenter": _2,
              "culture": _2,
              "cyber": _2,
              "cymru": _2,
              "dali": _2,
              "dallas": _2,
              "database": _2,
              "ddr": _2,
              "decorativearts": _2,
              "delaware": _2,
              "delmenhorst": _2,
              "denmark": _2,
              "depot": _2,
              "design": _2,
              "detroit": _2,
              "dinosaur": _2,
              "discovery": _2,
              "dolls": _2,
              "donostia": _2,
              "durham": _2,
              "eastafrica": _2,
              "eastcoast": _2,
              "education": _2,
              "educational": _2,
              "egyptian": _2,
              "eisenbahn": _2,
              "elburg": _2,
              "elvendrell": _2,
              "embroidery": _2,
              "encyclopedic": _2,
              "england": _2,
              "entomology": _2,
              "environment": _2,
              "environmentalconservation": _2,
              "epilepsy": _2,
              "essex": _2,
              "estate": _2,
              "ethnology": _2,
              "exeter": _2,
              "exhibition": _2,
              "family": _2,
              "farm": _2,
              "farmequipment": _2,
              "farmers": _2,
              "farmstead": _2,
              "field": _2,
              "figueres": _2,
              "filatelia": _2,
              "film": _2,
              "fineart": _2,
              "finearts": _2,
              "finland": _2,
              "flanders": _2,
              "florida": _2,
              "force": _2,
              "fortmissoula": _2,
              "fortworth": _2,
              "foundation": _2,
              "francaise": _2,
              "frankfurt": _2,
              "franziskaner": _2,
              "freemasonry": _2,
              "freiburg": _2,
              "fribourg": _2,
              "frog": _2,
              "fundacio": _2,
              "furniture": _2,
              "gallery": _2,
              "garden": _2,
              "gateway": _2,
              "geelvinck": _2,
              "gemological": _2,
              "geology": _2,
              "georgia": _2,
              "giessen": _2,
              "glas": _2,
              "glass": _2,
              "gorge": _2,
              "grandrapids": _2,
              "graz": _2,
              "guernsey": _2,
              "halloffame": _2,
              "hamburg": _2,
              "handson": _2,
              "harvestcelebration": _2,
              "hawaii": _2,
              "health": _2,
              "heimatunduhren": _2,
              "hellas": _2,
              "helsinki": _2,
              "hembygdsforbund": _2,
              "heritage": _2,
              "histoire": _2,
              "historical": _2,
              "historicalsociety": _2,
              "historichouses": _2,
              "historisch": _2,
              "historisches": _2,
              "history": _2,
              "historyofscience": _2,
              "horology": _2,
              "house": _2,
              "humanities": _2,
              "illustration": _2,
              "imageandsound": _2,
              "indian": _2,
              "indiana": _2,
              "indianapolis": _2,
              "indianmarket": _2,
              "intelligence": _2,
              "interactive": _2,
              "iraq": _2,
              "iron": _2,
              "isleofman": _2,
              "jamison": _2,
              "jefferson": _2,
              "jerusalem": _2,
              "jewelry": _2,
              "jewish": _2,
              "jewishart": _2,
              "jfk": _2,
              "journalism": _2,
              "judaica": _2,
              "judygarland": _2,
              "juedisches": _2,
              "juif": _2,
              "karate": _2,
              "karikatur": _2,
              "kids": _2,
              "koebenhavn": _2,
              "koeln": _2,
              "kunst": _2,
              "kunstsammlung": _2,
              "kunstunddesign": _2,
              "labor": _2,
              "labour": _2,
              "lajolla": _2,
              "lancashire": _2,
              "landes": _2,
              "lans": _2,
              "xn--lns-qla": _2,
              "läns": _2,
              "larsson": _2,
              "lewismiller": _2,
              "lincoln": _2,
              "linz": _2,
              "living": _2,
              "livinghistory": _2,
              "localhistory": _2,
              "london": _2,
              "losangeles": _2,
              "louvre": _2,
              "loyalist": _2,
              "lucerne": _2,
              "luxembourg": _2,
              "luzern": _2,
              "mad": _2,
              "madrid": _2,
              "mallorca": _2,
              "manchester": _2,
              "mansion": _2,
              "mansions": _2,
              "manx": _2,
              "marburg": _2,
              "maritime": _2,
              "maritimo": _2,
              "maryland": _2,
              "marylhurst": _2,
              "media": _2,
              "medical": _2,
              "medizinhistorisches": _2,
              "meeres": _2,
              "memorial": _2,
              "mesaverde": _2,
              "michigan": _2,
              "midatlantic": _2,
              "military": _2,
              "mill": _2,
              "miners": _2,
              "mining": _2,
              "minnesota": _2,
              "missile": _2,
              "missoula": _2,
              "modern": _2,
              "moma": _2,
              "money": _2,
              "monmouth": _2,
              "monticello": _2,
              "montreal": _2,
              "moscow": _2,
              "motorcycle": _2,
              "muenchen": _2,
              "muenster": _2,
              "mulhouse": _2,
              "muncie": _2,
              "museet": _2,
              "museumcenter": _2,
              "museumvereniging": _2,
              "music": _2,
              "national": _2,
              "nationalfirearms": _2,
              "nationalheritage": _2,
              "nativeamerican": _2,
              "naturalhistory": _2,
              "naturalhistorymuseum": _2,
              "naturalsciences": _2,
              "nature": _2,
              "naturhistorisches": _2,
              "natuurwetenschappen": _2,
              "naumburg": _2,
              "naval": _2,
              "nebraska": _2,
              "neues": _2,
              "newhampshire": _2,
              "newjersey": _2,
              "newmexico": _2,
              "newport": _2,
              "newspaper": _2,
              "newyork": _2,
              "niepce": _2,
              "norfolk": _2,
              "north": _2,
              "nrw": _2,
              "nyc": _2,
              "nyny": _2,
              "oceanographic": _2,
              "oceanographique": _2,
              "omaha": _2,
              "online": _2,
              "ontario": _2,
              "openair": _2,
              "oregon": _2,
              "oregontrail": _2,
              "otago": _2,
              "oxford": _2,
              "pacific": _2,
              "paderborn": _2,
              "palace": _2,
              "paleo": _2,
              "palmsprings": _2,
              "panama": _2,
              "paris": _2,
              "pasadena": _2,
              "pharmacy": _2,
              "philadelphia": _2,
              "philadelphiaarea": _2,
              "philately": _2,
              "phoenix": _2,
              "photography": _2,
              "pilots": _2,
              "pittsburgh": _2,
              "planetarium": _2,
              "plantation": _2,
              "plants": _2,
              "plaza": _2,
              "portal": _2,
              "portland": _2,
              "portlligat": _2,
              "posts-and-telecommunications": _2,
              "preservation": _2,
              "presidio": _2,
              "press": _2,
              "project": _2,
              "public": _2,
              "pubol": _2,
              "quebec": _2,
              "railroad": _2,
              "railway": _2,
              "research": _2,
              "resistance": _2,
              "riodejaneiro": _2,
              "rochester": _2,
              "rockart": _2,
              "roma": _2,
              "russia": _2,
              "saintlouis": _2,
              "salem": _2,
              "salvadordali": _2,
              "salzburg": _2,
              "sandiego": _2,
              "sanfrancisco": _2,
              "santabarbara": _2,
              "santacruz": _2,
              "santafe": _2,
              "saskatchewan": _2,
              "satx": _2,
              "savannahga": _2,
              "schlesisches": _2,
              "schoenbrunn": _2,
              "schokoladen": _2,
              "school": _2,
              "schweiz": _2,
              "science": _2,
              "scienceandhistory": _2,
              "scienceandindustry": _2,
              "sciencecenter": _2,
              "sciencecenters": _2,
              "science-fiction": _2,
              "sciencehistory": _2,
              "sciences": _2,
              "sciencesnaturelles": _2,
              "scotland": _2,
              "seaport": _2,
              "settlement": _2,
              "settlers": _2,
              "shell": _2,
              "sherbrooke": _2,
              "sibenik": _2,
              "silk": _2,
              "ski": _2,
              "skole": _2,
              "society": _2,
              "sologne": _2,
              "soundandvision": _2,
              "southcarolina": _2,
              "southwest": _2,
              "space": _2,
              "spy": _2,
              "square": _2,
              "stadt": _2,
              "stalbans": _2,
              "starnberg": _2,
              "state": _2,
              "stateofdelaware": _2,
              "station": _2,
              "steam": _2,
              "steiermark": _2,
              "stjohn": _2,
              "stockholm": _2,
              "stpetersburg": _2,
              "stuttgart": _2,
              "suisse": _2,
              "surgeonshall": _2,
              "surrey": _2,
              "svizzera": _2,
              "sweden": _2,
              "sydney": _2,
              "tank": _2,
              "tcm": _2,
              "technology": _2,
              "telekommunikation": _2,
              "television": _2,
              "texas": _2,
              "textile": _2,
              "theater": _2,
              "time": _2,
              "timekeeping": _2,
              "topology": _2,
              "torino": _2,
              "touch": _2,
              "town": _2,
              "transport": _2,
              "tree": _2,
              "trolley": _2,
              "trust": _2,
              "trustee": _2,
              "uhren": _2,
              "ulm": _2,
              "undersea": _2,
              "university": _2,
              "usa": _2,
              "usantiques": _2,
              "usarts": _2,
              "uscountryestate": _2,
              "usculture": _2,
              "usdecorativearts": _2,
              "usgarden": _2,
              "ushistory": _2,
              "ushuaia": _2,
              "uslivinghistory": _2,
              "utah": _2,
              "uvic": _2,
              "valley": _2,
              "vantaa": _2,
              "versailles": _2,
              "viking": _2,
              "village": _2,
              "virginia": _2,
              "virtual": _2,
              "virtuel": _2,
              "vlaanderen": _2,
              "volkenkunde": _2,
              "wales": _2,
              "wallonie": _2,
              "war": _2,
              "washingtondc": _2,
              "watchandclock": _2,
              "watch-and-clock": _2,
              "western": _2,
              "westfalen": _2,
              "whaling": _2,
              "wildlife": _2,
              "williamsburg": _2,
              "windmill": _2,
              "workshop": _2,
              "york": _2,
              "yorkshire": _2,
              "yosemite": _2,
              "youth": _2,
              "zoological": _2,
              "zoology": _2,
              "xn--9dbhblg6di": _2,
              "ירושלים": _2,
              "xn--h1aegh": _2,
              "иком": _2
            }
          },
          "mv": {
            "$": 1,
            "succ": {
              "aero": _2,
              "biz": _2,
              "com": _2,
              "coop": _2,
              "edu": _2,
              "gov": _2,
              "info": _2,
              "int": _2,
              "mil": _2,
              "museum": _2,
              "name": _2,
              "net": _2,
              "org": _2,
              "pro": _2
            }
          },
          "mw": {
            "$": 1,
            "succ": {
              "ac": _2,
              "biz": _2,
              "co": _2,
              "com": _2,
              "coop": _2,
              "edu": _2,
              "gov": _2,
              "int": _2,
              "museum": _2,
              "net": _2,
              "org": _2
            }
          },
          "mx": {
            "$": 1,
            "succ": {
              "com": _2,
              "org": _2,
              "gob": _2,
              "edu": _2,
              "net": _2,
              "blogspot": _3
            }
          },
          "my": {
            "$": 1,
            "succ": {
              "biz": _2,
              "com": _2,
              "edu": _2,
              "gov": _2,
              "mil": _2,
              "name": _2,
              "net": _2,
              "org": _2,
              "blogspot": _3
            }
          },
          "mz": {
            "$": 1,
            "succ": {
              "ac": _2,
              "adv": _2,
              "co": _2,
              "edu": _2,
              "gov": _2,
              "mil": _2,
              "net": _2,
              "org": _2
            }
          },
          "na": {
            "$": 1,
            "succ": {
              "info": _2,
              "pro": _2,
              "name": _2,
              "school": _2,
              "or": _2,
              "dr": _2,
              "us": _2,
              "mx": _2,
              "ca": _2,
              "in": _2,
              "cc": _2,
              "tv": _2,
              "ws": _2,
              "mobi": _2,
              "co": _2,
              "com": _2,
              "org": _2
            }
          },
          "name": {
            "$": 1,
            "succ": {
              "her": _37,
              "his": _37
            }
          },
          "nc": {
            "$": 1,
            "succ": {
              "asso": _2,
              "nom": _2
            }
          },
          "ne": _2,
          "net": {
            "$": 1,
            "succ": {
              "adobeaemcloud": _3,
              "adobeio-static": _3,
              "adobeioruntime": _3,
              "akadns": _3,
              "akamai": _3,
              "akamai-staging": _3,
              "akamaiedge": _3,
              "akamaiedge-staging": _3,
              "akamaihd": _3,
              "akamaihd-staging": _3,
              "akamaiorigin": _3,
              "akamaiorigin-staging": _3,
              "akamaized": _3,
              "akamaized-staging": _3,
              "edgekey": _3,
              "edgekey-staging": _3,
              "edgesuite": _3,
              "edgesuite-staging": _3,
              "alwaysdata": _3,
              "myamaze": _3,
              "cloudfront": _3,
              "t3l3p0rt": _3,
              "appudo": _3,
              "atlassian-dev": {
                "$": 0,
                "succ": {
                  "prod": {
                    "$": 0,
                    "succ": {
                      "cdn": _3
                    }
                  }
                }
              },
              "myfritz": _3,
              "onavstack": _3,
              "shopselect": _3,
              "blackbaudcdn": _3,
              "boomla": _3,
              "bplaced": _3,
              "square7": _3,
              "gb": _3,
              "hu": _3,
              "jp": _3,
              "se": _3,
              "uk": _3,
              "in": _3,
              "clickrising": _3,
              "cloudaccess": _3,
              "cdn77-ssl": _3,
              "cdn77": {
                "$": 0,
                "succ": {
                  "r": _3
                }
              },
              "feste-ip": _3,
              "knx-server": _3,
              "static-access": _3,
              "cryptonomic": _5,
              "dattolocal": _3,
              "mydatto": _3,
              "debian": _3,
              "bitbridge": _3,
              "at-band-camp": _3,
              "blogdns": _3,
              "broke-it": _3,
              "buyshouses": _3,
              "dnsalias": _3,
              "dnsdojo": _3,
              "does-it": _3,
              "dontexist": _3,
              "dynalias": _3,
              "dynathome": _3,
              "endofinternet": _3,
              "from-az": _3,
              "from-co": _3,
              "from-la": _3,
              "from-ny": _3,
              "gets-it": _3,
              "ham-radio-op": _3,
              "homeftp": _3,
              "homeip": _3,
              "homelinux": _3,
              "homeunix": _3,
              "in-the-band": _3,
              "is-a-chef": _3,
              "is-a-geek": _3,
              "isa-geek": _3,
              "kicks-ass": _3,
              "office-on-the": _3,
              "podzone": _3,
              "scrapper-site": _3,
              "selfip": _3,
              "sells-it": _3,
              "servebbs": _3,
              "serveftp": _3,
              "thruhere": _3,
              "webhop": _3,
              "definima": _3,
              "casacam": _3,
              "dynu": _3,
              "dynv6": _3,
              "twmail": _3,
              "ru": _3,
              "channelsdvr": {
                "$": 2,
                "succ": {
                  "u": _3
                }
              },
              "fastlylb": {
                "$": 2,
                "succ": {
                  "map": _3
                }
              },
              "fastly": {
                "$": 0,
                "succ": {
                  "freetls": _3,
                  "map": _3,
                  "prod": {
                    "$": 0,
                    "succ": {
                      "a": _3,
                      "global": _3
                    }
                  },
                  "ssl": {
                    "$": 0,
                    "succ": {
                      "a": _3,
                      "b": _3,
                      "global": _3
                    }
                  }
                }
              },
              "edgeapp": _3,
              "flynnhosting": _3,
              "cdn-edges": _3,
              "heteml": _3,
              "cloudfunctions": _3,
              "moonscale": _3,
              "in-dsl": _3,
              "in-vpn": _3,
              "ipifony": _3,
              "iobb": _3,
              "cloudjiffy": {
                "$": 2,
                "succ": {
                  "fra1-de": _3,
                  "west1-us": _3
                }
              },
              "elastx": {
                "$": 0,
                "succ": {
                  "jls-sto1": _3,
                  "jls-sto2": _3,
                  "jls-sto3": _3
                }
              },
              "faststacks": _3,
              "massivegrid": {
                "$": 0,
                "succ": {
                  "paas": {
                    "$": 0,
                    "succ": {
                      "fr-1": _3,
                      "lon-1": _3,
                      "lon-2": _3,
                      "ny-1": _3,
                      "ny-2": _3,
                      "sg-1": _3
                    }
                  }
                }
              },
              "saveincloud": {
                "$": 0,
                "succ": {
                  "jelastic": _3,
                  "nordeste-idc": _3
                }
              },
              "scaleforce": _26,
              "tsukaeru": _27,
              "kinghost": _3,
              "uni5": _3,
              "krellian": _3,
              "barsy": _3,
              "memset": _3,
              "azurewebsites": _3,
              "azure-mobile": _3,
              "cloudapp": _3,
              "azurestaticapps": {
                "$": 2,
                "succ": {
                  "1": _3,
                  "2": _3,
                  "3": _3,
                  "centralus": _3,
                  "eastasia": _3,
                  "eastus2": _3,
                  "westeurope": _3,
                  "westus2": _3
                }
              },
              "dnsup": _3,
              "hicam": _3,
              "now-dns": _3,
              "ownip": _3,
              "vpndns": _3,
              "eating-organic": _3,
              "mydissent": _3,
              "myeffect": _3,
              "mymediapc": _3,
              "mypsx": _3,
              "mysecuritycamera": _3,
              "nhlfan": _3,
              "no-ip": _3,
              "pgafan": _3,
              "privatizehealthinsurance": _3,
              "bounceme": _3,
              "ddns": _3,
              "redirectme": _3,
              "serveblog": _3,
              "serveminecraft": _3,
              "sytes": _3,
              "cloudycluster": _3,
              "ovh": {
                "$": 0,
                "succ": {
                  "webpaas": _5,
                  "hosting": _5
                }
              },
              "bar0": _3,
              "bar1": _3,
              "bar2": _3,
              "rackmaze": _3,
              "squares": _3,
              "schokokeks": _3,
              "firewall-gateway": _3,
              "seidat": _3,
              "senseering": _3,
              "siteleaf": _3,
              "vps-host": {
                "$": 2,
                "succ": {
                  "jelastic": {
                    "$": 0,
                    "succ": {
                      "atl": _3,
                      "njs": _3,
                      "ric": _3
                    }
                  }
                }
              },
              "myspreadshop": _3,
              "srcf": {
                "$": 0,
                "succ": {
                  "soc": _3,
                  "user": _3
                }
              },
              "supabase": _3,
              "dsmynas": _3,
              "familyds": _3,
              "tailscale": {
                "$": 0,
                "succ": {
                  "beta": _3
                }
              },
              "ts": _3,
              "torproject": {
                "$": 2,
                "succ": {
                  "pages": _3
                }
              },
              "reserve-online": _3,
              "community-pro": _3,
              "meinforum": _3,
              "yandexcloud": {
                "$": 2,
                "succ": {
                  "storage": _3,
                  "website": _3
                }
              },
              "za": _3
            }
          },
          "nf": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "per": _2,
              "rec": _2,
              "web": _2,
              "arts": _2,
              "firm": _2,
              "info": _2,
              "other": _2,
              "store": _2
            }
          },
          "ng": {
            "$": 1,
            "succ": {
              "com": _6,
              "edu": _2,
              "gov": _2,
              "i": _2,
              "mil": _2,
              "mobi": _2,
              "name": _2,
              "net": _2,
              "org": _2,
              "sch": _2,
              "col": _3,
              "firm": _3,
              "gen": _3,
              "ltd": _3,
              "ngo": _3
            }
          },
          "ni": {
            "$": 1,
            "succ": {
              "ac": _2,
              "biz": _2,
              "co": _2,
              "com": _2,
              "edu": _2,
              "gob": _2,
              "in": _2,
              "info": _2,
              "int": _2,
              "mil": _2,
              "net": _2,
              "nom": _2,
              "org": _2,
              "web": _2
            }
          },
          "nl": {
            "$": 1,
            "succ": {
              "co": _3,
              "hosting-cluster": _3,
              "blogspot": _3,
              "gov": _3,
              "khplay": _3,
              "123website": _3,
              "myspreadshop": _3,
              "transurl": _5,
              "cistron": _3,
              "demon": _3
            }
          },
          "no": {
            "$": 1,
            "succ": {
              "fhs": _2,
              "vgs": _2,
              "fylkesbibl": _2,
              "folkebibl": _2,
              "museum": _2,
              "idrett": _2,
              "priv": _2,
              "mil": _2,
              "stat": _2,
              "dep": _2,
              "kommune": _2,
              "herad": _2,
              "aa": _38,
              "ah": _38,
              "bu": _38,
              "fm": _38,
              "hl": _38,
              "hm": _38,
              "jan-mayen": _38,
              "mr": _38,
              "nl": _38,
              "nt": _38,
              "of": _38,
              "ol": _38,
              "oslo": _38,
              "rl": _38,
              "sf": _38,
              "st": _38,
              "svalbard": _38,
              "tm": _38,
              "tr": _38,
              "va": _38,
              "vf": _38,
              "akrehamn": _2,
              "xn--krehamn-dxa": _2,
              "åkrehamn": _2,
              "algard": _2,
              "xn--lgrd-poac": _2,
              "ålgård": _2,
              "arna": _2,
              "brumunddal": _2,
              "bryne": _2,
              "bronnoysund": _2,
              "xn--brnnysund-m8ac": _2,
              "brønnøysund": _2,
              "drobak": _2,
              "xn--drbak-wua": _2,
              "drøbak": _2,
              "egersund": _2,
              "fetsund": _2,
              "floro": _2,
              "xn--flor-jra": _2,
              "florø": _2,
              "fredrikstad": _2,
              "hokksund": _2,
              "honefoss": _2,
              "xn--hnefoss-q1a": _2,
              "hønefoss": _2,
              "jessheim": _2,
              "jorpeland": _2,
              "xn--jrpeland-54a": _2,
              "jørpeland": _2,
              "kirkenes": _2,
              "kopervik": _2,
              "krokstadelva": _2,
              "langevag": _2,
              "xn--langevg-jxa": _2,
              "langevåg": _2,
              "leirvik": _2,
              "mjondalen": _2,
              "xn--mjndalen-64a": _2,
              "mjøndalen": _2,
              "mo-i-rana": _2,
              "mosjoen": _2,
              "xn--mosjen-eya": _2,
              "mosjøen": _2,
              "nesoddtangen": _2,
              "orkanger": _2,
              "osoyro": _2,
              "xn--osyro-wua": _2,
              "osøyro": _2,
              "raholt": _2,
              "xn--rholt-mra": _2,
              "råholt": _2,
              "sandnessjoen": _2,
              "xn--sandnessjen-ogb": _2,
              "sandnessjøen": _2,
              "skedsmokorset": _2,
              "slattum": _2,
              "spjelkavik": _2,
              "stathelle": _2,
              "stavern": _2,
              "stjordalshalsen": _2,
              "xn--stjrdalshalsen-sqb": _2,
              "stjørdalshalsen": _2,
              "tananger": _2,
              "tranby": _2,
              "vossevangen": _2,
              "afjord": _2,
              "xn--fjord-lra": _2,
              "åfjord": _2,
              "agdenes": _2,
              "al": _2,
              "xn--l-1fa": _2,
              "ål": _2,
              "alesund": _2,
              "xn--lesund-hua": _2,
              "ålesund": _2,
              "alstahaug": _2,
              "alta": _2,
              "xn--lt-liac": _2,
              "áltá": _2,
              "alaheadju": _2,
              "xn--laheadju-7ya": _2,
              "álaheadju": _2,
              "alvdal": _2,
              "amli": _2,
              "xn--mli-tla": _2,
              "åmli": _2,
              "amot": _2,
              "xn--mot-tla": _2,
              "åmot": _2,
              "andebu": _2,
              "andoy": _2,
              "xn--andy-ira": _2,
              "andøy": _2,
              "andasuolo": _2,
              "ardal": _2,
              "xn--rdal-poa": _2,
              "årdal": _2,
              "aremark": _2,
              "arendal": _2,
              "xn--s-1fa": _2,
              "ås": _2,
              "aseral": _2,
              "xn--seral-lra": _2,
              "åseral": _2,
              "asker": _2,
              "askim": _2,
              "askvoll": _2,
              "askoy": _2,
              "xn--asky-ira": _2,
              "askøy": _2,
              "asnes": _2,
              "xn--snes-poa": _2,
              "åsnes": _2,
              "audnedaln": _2,
              "aukra": _2,
              "aure": _2,
              "aurland": _2,
              "aurskog-holand": _2,
              "xn--aurskog-hland-jnb": _2,
              "aurskog-høland": _2,
              "austevoll": _2,
              "austrheim": _2,
              "averoy": _2,
              "xn--avery-yua": _2,
              "averøy": _2,
              "balestrand": _2,
              "ballangen": _2,
              "balat": _2,
              "xn--blt-elab": _2,
              "bálát": _2,
              "balsfjord": _2,
              "bahccavuotna": _2,
              "xn--bhccavuotna-k7a": _2,
              "báhccavuotna": _2,
              "bamble": _2,
              "bardu": _2,
              "beardu": _2,
              "beiarn": _2,
              "bajddar": _2,
              "xn--bjddar-pta": _2,
              "bájddar": _2,
              "baidar": _2,
              "xn--bidr-5nac": _2,
              "báidár": _2,
              "berg": _2,
              "bergen": _2,
              "berlevag": _2,
              "xn--berlevg-jxa": _2,
              "berlevåg": _2,
              "bearalvahki": _2,
              "xn--bearalvhki-y4a": _2,
              "bearalváhki": _2,
              "bindal": _2,
              "birkenes": _2,
              "bjarkoy": _2,
              "xn--bjarky-fya": _2,
              "bjarkøy": _2,
              "bjerkreim": _2,
              "bjugn": _2,
              "bodo": _2,
              "xn--bod-2na": _2,
              "bodø": _2,
              "badaddja": _2,
              "xn--bdddj-mrabd": _2,
              "bådåddjå": _2,
              "budejju": _2,
              "bokn": _2,
              "bremanger": _2,
              "bronnoy": _2,
              "xn--brnny-wuac": _2,
              "brønnøy": _2,
              "bygland": _2,
              "bykle": _2,
              "barum": _2,
              "xn--brum-voa": _2,
              "bærum": _2,
              "telemark": {
                "$": 0,
                "succ": {
                  "bo": _2,
                  "xn--b-5ga": _2,
                  "bø": _2
                }
              },
              "nordland": {
                "$": 0,
                "succ": {
                  "bo": _2,
                  "xn--b-5ga": _2,
                  "bø": _2,
                  "heroy": _2,
                  "xn--hery-ira": _2,
                  "herøy": _2
                }
              },
              "bievat": _2,
              "xn--bievt-0qa": _2,
              "bievát": _2,
              "bomlo": _2,
              "xn--bmlo-gra": _2,
              "bømlo": _2,
              "batsfjord": _2,
              "xn--btsfjord-9za": _2,
              "båtsfjord": _2,
              "bahcavuotna": _2,
              "xn--bhcavuotna-s4a": _2,
              "báhcavuotna": _2,
              "dovre": _2,
              "drammen": _2,
              "drangedal": _2,
              "dyroy": _2,
              "xn--dyry-ira": _2,
              "dyrøy": _2,
              "donna": _2,
              "xn--dnna-gra": _2,
              "dønna": _2,
              "eid": _2,
              "eidfjord": _2,
              "eidsberg": _2,
              "eidskog": _2,
              "eidsvoll": _2,
              "eigersund": _2,
              "elverum": _2,
              "enebakk": _2,
              "engerdal": _2,
              "etne": _2,
              "etnedal": _2,
              "evenes": _2,
              "evenassi": _2,
              "xn--eveni-0qa01ga": _2,
              "evenášši": _2,
              "evje-og-hornnes": _2,
              "farsund": _2,
              "fauske": _2,
              "fuossko": _2,
              "fuoisku": _2,
              "fedje": _2,
              "fet": _2,
              "finnoy": _2,
              "xn--finny-yua": _2,
              "finnøy": _2,
              "fitjar": _2,
              "fjaler": _2,
              "fjell": _2,
              "flakstad": _2,
              "flatanger": _2,
              "flekkefjord": _2,
              "flesberg": _2,
              "flora": _2,
              "fla": _2,
              "xn--fl-zia": _2,
              "flå": _2,
              "folldal": _2,
              "forsand": _2,
              "fosnes": _2,
              "frei": _2,
              "frogn": _2,
              "froland": _2,
              "frosta": _2,
              "frana": _2,
              "xn--frna-woa": _2,
              "fræna": _2,
              "froya": _2,
              "xn--frya-hra": _2,
              "frøya": _2,
              "fusa": _2,
              "fyresdal": _2,
              "forde": _2,
              "xn--frde-gra": _2,
              "førde": _2,
              "gamvik": _2,
              "gangaviika": _2,
              "xn--ggaviika-8ya47h": _2,
              "gáŋgaviika": _2,
              "gaular": _2,
              "gausdal": _2,
              "gildeskal": _2,
              "xn--gildeskl-g0a": _2,
              "gildeskål": _2,
              "giske": _2,
              "gjemnes": _2,
              "gjerdrum": _2,
              "gjerstad": _2,
              "gjesdal": _2,
              "gjovik": _2,
              "xn--gjvik-wua": _2,
              "gjøvik": _2,
              "gloppen": _2,
              "gol": _2,
              "gran": _2,
              "grane": _2,
              "granvin": _2,
              "gratangen": _2,
              "grimstad": _2,
              "grong": _2,
              "kraanghke": _2,
              "xn--kranghke-b0a": _2,
              "kråanghke": _2,
              "grue": _2,
              "gulen": _2,
              "hadsel": _2,
              "halden": _2,
              "halsa": _2,
              "hamar": _2,
              "hamaroy": _2,
              "habmer": _2,
              "xn--hbmer-xqa": _2,
              "hábmer": _2,
              "hapmir": _2,
              "xn--hpmir-xqa": _2,
              "hápmir": _2,
              "hammerfest": _2,
              "hammarfeasta": _2,
              "xn--hmmrfeasta-s4ac": _2,
              "hámmárfeasta": _2,
              "haram": _2,
              "hareid": _2,
              "harstad": _2,
              "hasvik": _2,
              "aknoluokta": _2,
              "xn--koluokta-7ya57h": _2,
              "ákŋoluokta": _2,
              "hattfjelldal": _2,
              "aarborte": _2,
              "haugesund": _2,
              "hemne": _2,
              "hemnes": _2,
              "hemsedal": _2,
              "more-og-romsdal": {
                "$": 0,
                "succ": {
                  "heroy": _2,
                  "sande": _2
                }
              },
              "xn--mre-og-romsdal-qqb": {
                "$": 0,
                "succ": {
                  "xn--hery-ira": _2,
                  "sande": _2
                }
              },
              "møre-og-romsdal": {
                "$": 0,
                "succ": {
                  "herøy": _2,
                  "sande": _2
                }
              },
              "hitra": _2,
              "hjartdal": _2,
              "hjelmeland": _2,
              "hobol": _2,
              "xn--hobl-ira": _2,
              "hobøl": _2,
              "hof": _2,
              "hol": _2,
              "hole": _2,
              "holmestrand": _2,
              "holtalen": _2,
              "xn--holtlen-hxa": _2,
              "holtålen": _2,
              "hornindal": _2,
              "horten": _2,
              "hurdal": _2,
              "hurum": _2,
              "hvaler": _2,
              "hyllestad": _2,
              "hagebostad": _2,
              "xn--hgebostad-g3a": _2,
              "hægebostad": _2,
              "hoyanger": _2,
              "xn--hyanger-q1a": _2,
              "høyanger": _2,
              "hoylandet": _2,
              "xn--hylandet-54a": _2,
              "høylandet": _2,
              "ha": _2,
              "xn--h-2fa": _2,
              "hå": _2,
              "ibestad": _2,
              "inderoy": _2,
              "xn--indery-fya": _2,
              "inderøy": _2,
              "iveland": _2,
              "jevnaker": _2,
              "jondal": _2,
              "jolster": _2,
              "xn--jlster-bya": _2,
              "jølster": _2,
              "karasjok": _2,
              "karasjohka": _2,
              "xn--krjohka-hwab49j": _2,
              "kárášjohka": _2,
              "karlsoy": _2,
              "galsa": _2,
              "xn--gls-elac": _2,
              "gálsá": _2,
              "karmoy": _2,
              "xn--karmy-yua": _2,
              "karmøy": _2,
              "kautokeino": _2,
              "guovdageaidnu": _2,
              "klepp": _2,
              "klabu": _2,
              "xn--klbu-woa": _2,
              "klæbu": _2,
              "kongsberg": _2,
              "kongsvinger": _2,
              "kragero": _2,
              "xn--krager-gya": _2,
              "kragerø": _2,
              "kristiansand": _2,
              "kristiansund": _2,
              "krodsherad": _2,
              "xn--krdsherad-m8a": _2,
              "krødsherad": _2,
              "kvalsund": _2,
              "rahkkeravju": _2,
              "xn--rhkkervju-01af": _2,
              "ráhkkerávju": _2,
              "kvam": _2,
              "kvinesdal": _2,
              "kvinnherad": _2,
              "kviteseid": _2,
              "kvitsoy": _2,
              "xn--kvitsy-fya": _2,
              "kvitsøy": _2,
              "kvafjord": _2,
              "xn--kvfjord-nxa": _2,
              "kvæfjord": _2,
              "giehtavuoatna": _2,
              "kvanangen": _2,
              "xn--kvnangen-k0a": _2,
              "kvænangen": _2,
              "navuotna": _2,
              "xn--nvuotna-hwa": _2,
              "návuotna": _2,
              "kafjord": _2,
              "xn--kfjord-iua": _2,
              "kåfjord": _2,
              "gaivuotna": _2,
              "xn--givuotna-8ya": _2,
              "gáivuotna": _2,
              "larvik": _2,
              "lavangen": _2,
              "lavagis": _2,
              "loabat": _2,
              "xn--loabt-0qa": _2,
              "loabát": _2,
              "lebesby": _2,
              "davvesiida": _2,
              "leikanger": _2,
              "leirfjord": _2,
              "leka": _2,
              "leksvik": _2,
              "lenvik": _2,
              "leangaviika": _2,
              "xn--leagaviika-52b": _2,
              "leaŋgaviika": _2,
              "lesja": _2,
              "levanger": _2,
              "lier": _2,
              "lierne": _2,
              "lillehammer": _2,
              "lillesand": _2,
              "lindesnes": _2,
              "lindas": _2,
              "xn--linds-pra": _2,
              "lindås": _2,
              "lom": _2,
              "loppa": _2,
              "lahppi": _2,
              "xn--lhppi-xqa": _2,
              "láhppi": _2,
              "lund": _2,
              "lunner": _2,
              "luroy": _2,
              "xn--lury-ira": _2,
              "lurøy": _2,
              "luster": _2,
              "lyngdal": _2,
              "lyngen": _2,
              "ivgu": _2,
              "lardal": _2,
              "lerdal": _2,
              "xn--lrdal-sra": _2,
              "lærdal": _2,
              "lodingen": _2,
              "xn--ldingen-q1a": _2,
              "lødingen": _2,
              "lorenskog": _2,
              "xn--lrenskog-54a": _2,
              "lørenskog": _2,
              "loten": _2,
              "xn--lten-gra": _2,
              "løten": _2,
              "malvik": _2,
              "masoy": _2,
              "xn--msy-ula0h": _2,
              "måsøy": _2,
              "muosat": _2,
              "xn--muost-0qa": _2,
              "muosát": _2,
              "mandal": _2,
              "marker": _2,
              "marnardal": _2,
              "masfjorden": _2,
              "meland": _2,
              "meldal": _2,
              "melhus": _2,
              "meloy": _2,
              "xn--mely-ira": _2,
              "meløy": _2,
              "meraker": _2,
              "xn--merker-kua": _2,
              "meråker": _2,
              "moareke": _2,
              "xn--moreke-jua": _2,
              "moåreke": _2,
              "midsund": _2,
              "midtre-gauldal": _2,
              "modalen": _2,
              "modum": _2,
              "molde": _2,
              "moskenes": _2,
              "moss": _2,
              "mosvik": _2,
              "malselv": _2,
              "xn--mlselv-iua": _2,
              "målselv": _2,
              "malatvuopmi": _2,
              "xn--mlatvuopmi-s4a": _2,
              "málatvuopmi": _2,
              "namdalseid": _2,
              "aejrie": _2,
              "namsos": _2,
              "namsskogan": _2,
              "naamesjevuemie": _2,
              "xn--nmesjevuemie-tcba": _2,
              "nååmesjevuemie": _2,
              "laakesvuemie": _2,
              "nannestad": _2,
              "narvik": _2,
              "narviika": _2,
              "naustdal": _2,
              "nedre-eiker": _2,
              "akershus": _39,
              "buskerud": _39,
              "nesna": _2,
              "nesodden": _2,
              "nesseby": _2,
              "unjarga": _2,
              "xn--unjrga-rta": _2,
              "unjárga": _2,
              "nesset": _2,
              "nissedal": _2,
              "nittedal": _2,
              "nord-aurdal": _2,
              "nord-fron": _2,
              "nord-odal": _2,
              "norddal": _2,
              "nordkapp": _2,
              "davvenjarga": _2,
              "xn--davvenjrga-y4a": _2,
              "davvenjárga": _2,
              "nordre-land": _2,
              "nordreisa": _2,
              "raisa": _2,
              "xn--risa-5na": _2,
              "ráisa": _2,
              "nore-og-uvdal": _2,
              "notodden": _2,
              "naroy": _2,
              "xn--nry-yla5g": _2,
              "nærøy": _2,
              "notteroy": _2,
              "xn--nttery-byae": _2,
              "nøtterøy": _2,
              "odda": _2,
              "oksnes": _2,
              "xn--ksnes-uua": _2,
              "øksnes": _2,
              "oppdal": _2,
              "oppegard": _2,
              "xn--oppegrd-ixa": _2,
              "oppegård": _2,
              "orkdal": _2,
              "orland": _2,
              "xn--rland-uua": _2,
              "ørland": _2,
              "orskog": _2,
              "xn--rskog-uua": _2,
              "ørskog": _2,
              "orsta": _2,
              "xn--rsta-fra": _2,
              "ørsta": _2,
              "hedmark": {
                "$": 0,
                "succ": {
                  "os": _2,
                  "valer": _2,
                  "xn--vler-qoa": _2,
                  "våler": _2
                }
              },
              "hordaland": {
                "$": 0,
                "succ": {
                  "os": _2
                }
              },
              "osen": _2,
              "osteroy": _2,
              "xn--ostery-fya": _2,
              "osterøy": _2,
              "ostre-toten": _2,
              "xn--stre-toten-zcb": _2,
              "østre-toten": _2,
              "overhalla": _2,
              "ovre-eiker": _2,
              "xn--vre-eiker-k8a": _2,
              "øvre-eiker": _2,
              "oyer": _2,
              "xn--yer-zna": _2,
              "øyer": _2,
              "oygarden": _2,
              "xn--ygarden-p1a": _2,
              "øygarden": _2,
              "oystre-slidre": _2,
              "xn--ystre-slidre-ujb": _2,
              "øystre-slidre": _2,
              "porsanger": _2,
              "porsangu": _2,
              "xn--porsgu-sta26f": _2,
              "porsáŋgu": _2,
              "porsgrunn": _2,
              "radoy": _2,
              "xn--rady-ira": _2,
              "radøy": _2,
              "rakkestad": _2,
              "rana": _2,
              "ruovat": _2,
              "randaberg": _2,
              "rauma": _2,
              "rendalen": _2,
              "rennebu": _2,
              "rennesoy": _2,
              "xn--rennesy-v1a": _2,
              "rennesøy": _2,
              "rindal": _2,
              "ringebu": _2,
              "ringerike": _2,
              "ringsaker": _2,
              "rissa": _2,
              "risor": _2,
              "xn--risr-ira": _2,
              "risør": _2,
              "roan": _2,
              "rollag": _2,
              "rygge": _2,
              "ralingen": _2,
              "xn--rlingen-mxa": _2,
              "rælingen": _2,
              "rodoy": _2,
              "xn--rdy-0nab": _2,
              "rødøy": _2,
              "romskog": _2,
              "xn--rmskog-bya": _2,
              "rømskog": _2,
              "roros": _2,
              "xn--rros-gra": _2,
              "røros": _2,
              "rost": _2,
              "xn--rst-0na": _2,
              "røst": _2,
              "royken": _2,
              "xn--ryken-vua": _2,
              "røyken": _2,
              "royrvik": _2,
              "xn--ryrvik-bya": _2,
              "røyrvik": _2,
              "rade": _2,
              "xn--rde-ula": _2,
              "råde": _2,
              "salangen": _2,
              "siellak": _2,
              "saltdal": _2,
              "salat": _2,
              "xn--slt-elab": _2,
              "sálát": _2,
              "xn--slat-5na": _2,
              "sálat": _2,
              "samnanger": _2,
              "vestfold": {
                "$": 0,
                "succ": {
                  "sande": _2
                }
              },
              "sandefjord": _2,
              "sandnes": _2,
              "sandoy": _2,
              "xn--sandy-yua": _2,
              "sandøy": _2,
              "sarpsborg": _2,
              "sauda": _2,
              "sauherad": _2,
              "sel": _2,
              "selbu": _2,
              "selje": _2,
              "seljord": _2,
              "sigdal": _2,
              "siljan": _2,
              "sirdal": _2,
              "skaun": _2,
              "skedsmo": _2,
              "ski": _2,
              "skien": _2,
              "skiptvet": _2,
              "skjervoy": _2,
              "xn--skjervy-v1a": _2,
              "skjervøy": _2,
              "skierva": _2,
              "xn--skierv-uta": _2,
              "skiervá": _2,
              "skjak": _2,
              "xn--skjk-soa": _2,
              "skjåk": _2,
              "skodje": _2,
              "skanland": _2,
              "xn--sknland-fxa": _2,
              "skånland": _2,
              "skanit": _2,
              "xn--sknit-yqa": _2,
              "skánit": _2,
              "smola": _2,
              "xn--smla-hra": _2,
              "smøla": _2,
              "snillfjord": _2,
              "snasa": _2,
              "xn--snsa-roa": _2,
              "snåsa": _2,
              "snoasa": _2,
              "snaase": _2,
              "xn--snase-nra": _2,
              "snåase": _2,
              "sogndal": _2,
              "sokndal": _2,
              "sola": _2,
              "solund": _2,
              "songdalen": _2,
              "sortland": _2,
              "spydeberg": _2,
              "stange": _2,
              "stavanger": _2,
              "steigen": _2,
              "steinkjer": _2,
              "stjordal": _2,
              "xn--stjrdal-s1a": _2,
              "stjørdal": _2,
              "stokke": _2,
              "stor-elvdal": _2,
              "stord": _2,
              "stordal": _2,
              "storfjord": _2,
              "omasvuotna": _2,
              "strand": _2,
              "stranda": _2,
              "stryn": _2,
              "sula": _2,
              "suldal": _2,
              "sund": _2,
              "sunndal": _2,
              "surnadal": _2,
              "sveio": _2,
              "svelvik": _2,
              "sykkylven": _2,
              "sogne": _2,
              "xn--sgne-gra": _2,
              "søgne": _2,
              "somna": _2,
              "xn--smna-gra": _2,
              "sømna": _2,
              "sondre-land": _2,
              "xn--sndre-land-0cb": _2,
              "søndre-land": _2,
              "sor-aurdal": _2,
              "xn--sr-aurdal-l8a": _2,
              "sør-aurdal": _2,
              "sor-fron": _2,
              "xn--sr-fron-q1a": _2,
              "sør-fron": _2,
              "sor-odal": _2,
              "xn--sr-odal-q1a": _2,
              "sør-odal": _2,
              "sor-varanger": _2,
              "xn--sr-varanger-ggb": _2,
              "sør-varanger": _2,
              "matta-varjjat": _2,
              "xn--mtta-vrjjat-k7af": _2,
              "mátta-várjjat": _2,
              "sorfold": _2,
              "xn--srfold-bya": _2,
              "sørfold": _2,
              "sorreisa": _2,
              "xn--srreisa-q1a": _2,
              "sørreisa": _2,
              "sorum": _2,
              "xn--srum-gra": _2,
              "sørum": _2,
              "tana": _2,
              "deatnu": _2,
              "time": _2,
              "tingvoll": _2,
              "tinn": _2,
              "tjeldsund": _2,
              "dielddanuorri": _2,
              "tjome": _2,
              "xn--tjme-hra": _2,
              "tjøme": _2,
              "tokke": _2,
              "tolga": _2,
              "torsken": _2,
              "tranoy": _2,
              "xn--trany-yua": _2,
              "tranøy": _2,
              "tromso": _2,
              "xn--troms-zua": _2,
              "tromsø": _2,
              "tromsa": _2,
              "romsa": _2,
              "trondheim": _2,
              "troandin": _2,
              "trysil": _2,
              "trana": _2,
              "xn--trna-woa": _2,
              "træna": _2,
              "trogstad": _2,
              "xn--trgstad-r1a": _2,
              "trøgstad": _2,
              "tvedestrand": _2,
              "tydal": _2,
              "tynset": _2,
              "tysfjord": _2,
              "divtasvuodna": _2,
              "divttasvuotna": _2,
              "tysnes": _2,
              "tysvar": _2,
              "xn--tysvr-vra": _2,
              "tysvær": _2,
              "tonsberg": _2,
              "xn--tnsberg-q1a": _2,
              "tønsberg": _2,
              "ullensaker": _2,
              "ullensvang": _2,
              "ulvik": _2,
              "utsira": _2,
              "vadso": _2,
              "xn--vads-jra": _2,
              "vadsø": _2,
              "cahcesuolo": _2,
              "xn--hcesuolo-7ya35b": _2,
              "čáhcesuolo": _2,
              "vaksdal": _2,
              "valle": _2,
              "vang": _2,
              "vanylven": _2,
              "vardo": _2,
              "xn--vard-jra": _2,
              "vardø": _2,
              "varggat": _2,
              "xn--vrggt-xqad": _2,
              "várggát": _2,
              "vefsn": _2,
              "vaapste": _2,
              "vega": _2,
              "vegarshei": _2,
              "xn--vegrshei-c0a": _2,
              "vegårshei": _2,
              "vennesla": _2,
              "verdal": _2,
              "verran": _2,
              "vestby": _2,
              "vestnes": _2,
              "vestre-slidre": _2,
              "vestre-toten": _2,
              "vestvagoy": _2,
              "xn--vestvgy-ixa6o": _2,
              "vestvågøy": _2,
              "vevelstad": _2,
              "vik": _2,
              "vikna": _2,
              "vindafjord": _2,
              "volda": _2,
              "voss": _2,
              "varoy": _2,
              "xn--vry-yla5g": _2,
              "værøy": _2,
              "vagan": _2,
              "xn--vgan-qoa": _2,
              "vågan": _2,
              "voagat": _2,
              "vagsoy": _2,
              "xn--vgsy-qoa0j": _2,
              "vågsøy": _2,
              "vaga": _2,
              "xn--vg-yiab": _2,
              "vågå": _2,
              "ostfold": {
                "$": 0,
                "succ": {
                  "valer": _2
                }
              },
              "xn--stfold-9xa": {
                "$": 0,
                "succ": {
                  "xn--vler-qoa": _2
                }
              },
              "østfold": {
                "$": 0,
                "succ": {
                  "våler": _2
                }
              },
              "co": _3,
              "blogspot": _3,
              "123hjemmeside": _3,
              "myspreadshop": _3
            }
          },
          "np": _8,
          "nr": _33,
          "nu": {
            "$": 1,
            "succ": {
              "merseine": _3,
              "mine": _3,
              "shacknet": _3,
              "enterprisecloud": _3
            }
          },
          "nz": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": _6,
              "cri": _2,
              "geek": _2,
              "gen": _2,
              "govt": _2,
              "health": _2,
              "iwi": _2,
              "kiwi": _2,
              "maori": _2,
              "mil": _2,
              "xn--mori-qsa": _2,
              "māori": _2,
              "net": _2,
              "org": _2,
              "parliament": _2,
              "school": _2
            }
          },
          "om": {
            "$": 1,
            "succ": {
              "co": _2,
              "com": _2,
              "edu": _2,
              "gov": _2,
              "med": _2,
              "museum": _2,
              "net": _2,
              "org": _2,
              "pro": _2
            }
          },
          "onion": _2,
          "org": {
            "$": 1,
            "succ": {
              "altervista": _3,
              "amune": {
                "$": 0,
                "succ": {
                  "tele": _3
                }
              },
              "pimienta": _3,
              "poivron": _3,
              "potager": _3,
              "sweetpepper": _3,
              "ae": _3,
              "us": _3,
              "certmgr": _3,
              "cdn77": {
                "$": 0,
                "succ": {
                  "c": _3,
                  "rsc": _3
                }
              },
              "cdn77-secure": {
                "$": 0,
                "succ": {
                  "origin": {
                    "$": 0,
                    "succ": {
                      "ssl": _3
                    }
                  }
                }
              },
              "cloudns": _3,
              "duckdns": _3,
              "tunk": _3,
              "dyndns": {
                "$": 2,
                "succ": {
                  "go": _3,
                  "home": _3
                }
              },
              "blogdns": _3,
              "blogsite": _3,
              "boldlygoingnowhere": _3,
              "dnsalias": _3,
              "dnsdojo": _3,
              "doesntexist": _3,
              "dontexist": _3,
              "doomdns": _3,
              "dvrdns": _3,
              "dynalias": _3,
              "endofinternet": _3,
              "endoftheinternet": _3,
              "from-me": _3,
              "game-host": _3,
              "gotdns": _3,
              "hobby-site": _3,
              "homedns": _3,
              "homeftp": _3,
              "homelinux": _3,
              "homeunix": _3,
              "is-a-bruinsfan": _3,
              "is-a-candidate": _3,
              "is-a-celticsfan": _3,
              "is-a-chef": _3,
              "is-a-geek": _3,
              "is-a-knight": _3,
              "is-a-linux-user": _3,
              "is-a-patsfan": _3,
              "is-a-soxfan": _3,
              "is-found": _3,
              "is-lost": _3,
              "is-saved": _3,
              "is-very-bad": _3,
              "is-very-evil": _3,
              "is-very-good": _3,
              "is-very-nice": _3,
              "is-very-sweet": _3,
              "isa-geek": _3,
              "kicks-ass": _3,
              "misconfused": _3,
              "podzone": _3,
              "readmyblog": _3,
              "selfip": _3,
              "sellsyourhome": _3,
              "servebbs": _3,
              "serveftp": _3,
              "servegame": _3,
              "stuff-4-sale": _3,
              "webhop": _3,
              "ddnss": _3,
              "accesscam": _3,
              "camdvr": _3,
              "freeddns": _3,
              "mywire": _3,
              "webredirect": _3,
              "eu": {
                "$": 2,
                "succ": {
                  "al": _3,
                  "asso": _3,
                  "at": _3,
                  "au": _3,
                  "be": _3,
                  "bg": _3,
                  "ca": _3,
                  "cd": _3,
                  "ch": _3,
                  "cn": _3,
                  "cy": _3,
                  "cz": _3,
                  "de": _3,
                  "dk": _3,
                  "edu": _3,
                  "ee": _3,
                  "es": _3,
                  "fi": _3,
                  "fr": _3,
                  "gr": _3,
                  "hr": _3,
                  "hu": _3,
                  "ie": _3,
                  "il": _3,
                  "in": _3,
                  "int": _3,
                  "is": _3,
                  "it": _3,
                  "jp": _3,
                  "kr": _3,
                  "lt": _3,
                  "lu": _3,
                  "lv": _3,
                  "mc": _3,
                  "me": _3,
                  "mk": _3,
                  "mt": _3,
                  "my": _3,
                  "net": _3,
                  "ng": _3,
                  "nl": _3,
                  "no": _3,
                  "nz": _3,
                  "paris": _3,
                  "pl": _3,
                  "pt": _3,
                  "q-a": _3,
                  "ro": _3,
                  "ru": _3,
                  "se": _3,
                  "si": _3,
                  "sk": _3,
                  "tr": _3,
                  "uk": _3,
                  "us": _3
                }
              },
              "twmail": _3,
              "fedorainfracloud": _3,
              "fedorapeople": _3,
              "fedoraproject": {
                "$": 0,
                "succ": {
                  "cloud": _3,
                  "os": _21,
                  "stg": {
                    "$": 0,
                    "succ": {
                      "os": _21
                    }
                  }
                }
              },
              "freedesktop": _3,
              "hepforge": _3,
              "in-dsl": _3,
              "in-vpn": _3,
              "js": _3,
              "barsy": _3,
              "mayfirst": _3,
              "mozilla-iot": _3,
              "bmoattachments": _3,
              "dynserv": _3,
              "now-dns": _3,
              "cable-modem": _3,
              "collegefan": _3,
              "couchpotatofries": _3,
              "mlbfan": _3,
              "mysecuritycamera": _3,
              "nflfan": _3,
              "read-books": _3,
              "ufcfan": _3,
              "hopto": _3,
              "myftp": _3,
              "no-ip": _3,
              "zapto": _3,
              "httpbin": _3,
              "pubtls": _3,
              "jpn": _3,
              "my-firewall": _3,
              "myfirewall": _3,
              "spdns": _3,
              "small-web": _3,
              "dsmynas": _3,
              "familyds": _3,
              "teckids": _12,
              "tuxfamily": _3,
              "diskstation": _3,
              "hk": _3,
              "wmflabs": _3,
              "toolforge": _3,
              "wmcloud": _3,
              "za": _3
            }
          },
          "pa": {
            "$": 1,
            "succ": {
              "ac": _2,
              "gob": _2,
              "com": _2,
              "org": _2,
              "sld": _2,
              "edu": _2,
              "net": _2,
              "ing": _2,
              "abo": _2,
              "med": _2,
              "nom": _2
            }
          },
          "pe": {
            "$": 1,
            "succ": {
              "edu": _2,
              "gob": _2,
              "nom": _2,
              "mil": _2,
              "org": _2,
              "com": _2,
              "net": _2,
              "blogspot": _3
            }
          },
          "pf": {
            "$": 1,
            "succ": {
              "com": _2,
              "org": _2,
              "edu": _2
            }
          },
          "pg": _8,
          "ph": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "org": _2,
              "gov": _2,
              "edu": _2,
              "ngo": _2,
              "mil": _2,
              "i": _2
            }
          },
          "pk": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "edu": _2,
              "org": _2,
              "fam": _2,
              "biz": _2,
              "web": _2,
              "gov": _2,
              "gob": _2,
              "gok": _2,
              "gon": _2,
              "gop": _2,
              "gos": _2,
              "info": _2
            }
          },
          "pl": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "org": _2,
              "aid": _2,
              "agro": _2,
              "atm": _2,
              "auto": _2,
              "biz": _2,
              "edu": _2,
              "gmina": _2,
              "gsm": _2,
              "info": _2,
              "mail": _2,
              "miasta": _2,
              "media": _2,
              "mil": _2,
              "nieruchomosci": _2,
              "nom": _2,
              "pc": _2,
              "powiat": _2,
              "priv": _2,
              "realestate": _2,
              "rel": _2,
              "sex": _2,
              "shop": _2,
              "sklep": _2,
              "sos": _2,
              "szkola": _2,
              "targi": _2,
              "tm": _2,
              "tourism": _2,
              "travel": _2,
              "turystyka": _2,
              "gov": {
                "$": 1,
                "succ": {
                  "ap": _2,
                  "ic": _2,
                  "is": _2,
                  "us": _2,
                  "kmpsp": _2,
                  "kppsp": _2,
                  "kwpsp": _2,
                  "psp": _2,
                  "wskr": _2,
                  "kwp": _2,
                  "mw": _2,
                  "ug": _2,
                  "um": _2,
                  "umig": _2,
                  "ugim": _2,
                  "upow": _2,
                  "uw": _2,
                  "starostwo": _2,
                  "pa": _2,
                  "po": _2,
                  "psse": _2,
                  "pup": _2,
                  "rzgw": _2,
                  "sa": _2,
                  "so": _2,
                  "sr": _2,
                  "wsa": _2,
                  "sko": _2,
                  "uzs": _2,
                  "wiih": _2,
                  "winb": _2,
                  "pinb": _2,
                  "wios": _2,
                  "witd": _2,
                  "wzmiuw": _2,
                  "piw": _2,
                  "wiw": _2,
                  "griw": _2,
                  "wif": _2,
                  "oum": _2,
                  "sdn": _2,
                  "zp": _2,
                  "uppo": _2,
                  "mup": _2,
                  "wuoz": _2,
                  "konsulat": _2,
                  "oirm": _2
                }
              },
              "augustow": _2,
              "babia-gora": _2,
              "bedzin": _2,
              "beskidy": _2,
              "bialowieza": _2,
              "bialystok": _2,
              "bielawa": _2,
              "bieszczady": _2,
              "boleslawiec": _2,
              "bydgoszcz": _2,
              "bytom": _2,
              "cieszyn": _2,
              "czeladz": _2,
              "czest": _2,
              "dlugoleka": _2,
              "elblag": _2,
              "elk": _2,
              "glogow": _2,
              "gniezno": _2,
              "gorlice": _2,
              "grajewo": _2,
              "ilawa": _2,
              "jaworzno": _2,
              "jelenia-gora": _2,
              "jgora": _2,
              "kalisz": _2,
              "kazimierz-dolny": _2,
              "karpacz": _2,
              "kartuzy": _2,
              "kaszuby": _2,
              "katowice": _2,
              "kepno": _2,
              "ketrzyn": _2,
              "klodzko": _2,
              "kobierzyce": _2,
              "kolobrzeg": _2,
              "konin": _2,
              "konskowola": _2,
              "kutno": _2,
              "lapy": _2,
              "lebork": _2,
              "legnica": _2,
              "lezajsk": _2,
              "limanowa": _2,
              "lomza": _2,
              "lowicz": _2,
              "lubin": _2,
              "lukow": _2,
              "malbork": _2,
              "malopolska": _2,
              "mazowsze": _2,
              "mazury": _2,
              "mielec": _2,
              "mielno": _2,
              "mragowo": _2,
              "naklo": _2,
              "nowaruda": _2,
              "nysa": _2,
              "olawa": _2,
              "olecko": _2,
              "olkusz": _2,
              "olsztyn": _2,
              "opoczno": _2,
              "opole": _2,
              "ostroda": _2,
              "ostroleka": _2,
              "ostrowiec": _2,
              "ostrowwlkp": _2,
              "pila": _2,
              "pisz": _2,
              "podhale": _2,
              "podlasie": _2,
              "polkowice": _2,
              "pomorze": _2,
              "pomorskie": _2,
              "prochowice": _2,
              "pruszkow": _2,
              "przeworsk": _2,
              "pulawy": _2,
              "radom": _2,
              "rawa-maz": _2,
              "rybnik": _2,
              "rzeszow": _2,
              "sanok": _2,
              "sejny": _2,
              "slask": _2,
              "slupsk": _2,
              "sosnowiec": _2,
              "stalowa-wola": _2,
              "skoczow": _2,
              "starachowice": _2,
              "stargard": _2,
              "suwalki": _2,
              "swidnica": _2,
              "swiebodzin": _2,
              "swinoujscie": _2,
              "szczecin": _2,
              "szczytno": _2,
              "tarnobrzeg": _2,
              "tgory": _2,
              "turek": _2,
              "tychy": _2,
              "ustka": _2,
              "walbrzych": _2,
              "warmia": _2,
              "warszawa": _2,
              "waw": _2,
              "wegrow": _2,
              "wielun": _2,
              "wlocl": _2,
              "wloclawek": _2,
              "wodzislaw": _2,
              "wolomin": _2,
              "wroclaw": _2,
              "zachpomor": _2,
              "zagan": _2,
              "zarow": _2,
              "zgora": _2,
              "zgorzelec": _2,
              "beep": _3,
              "ecommerce-shop": _3,
              "shoparena": _3,
              "homesklep": _3,
              "sdscloud": _3,
              "unicloud": _3,
              "krasnik": _3,
              "leczna": _3,
              "lubartow": _3,
              "lublin": _3,
              "poniatowa": _3,
              "swidnik": _3,
              "co": _3,
              "simplesite": _3,
              "art": _3,
              "gliwice": _3,
              "krakow": _3,
              "poznan": _3,
              "wroc": _3,
              "zakopane": _3,
              "myspreadshop": _3,
              "gda": _3,
              "gdansk": _3,
              "gdynia": _3,
              "med": _3,
              "sopot": _3
            }
          },
          "pm": {
            "$": 1,
            "succ": {
              "own": _3,
              "name": _3
            }
          },
          "pn": {
            "$": 1,
            "succ": {
              "gov": _2,
              "co": _2,
              "org": _2,
              "edu": _2,
              "net": _2
            }
          },
          "post": _2,
          "pr": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "org": _2,
              "gov": _2,
              "edu": _2,
              "isla": _2,
              "pro": _2,
              "biz": _2,
              "info": _2,
              "name": _2,
              "est": _2,
              "prof": _2,
              "ac": _2
            }
          },
          "pro": {
            "$": 1,
            "succ": {
              "aaa": _2,
              "aca": _2,
              "acct": _2,
              "avocat": _2,
              "bar": _2,
              "cpa": _2,
              "eng": _2,
              "jur": _2,
              "law": _2,
              "med": _2,
              "recht": _2,
              "cloudns": _3,
              "dnstrace": {
                "$": 0,
                "succ": {
                  "bci": _3
                }
              },
              "barsy": _3
            }
          },
          "ps": {
            "$": 1,
            "succ": {
              "edu": _2,
              "gov": _2,
              "sec": _2,
              "plo": _2,
              "com": _2,
              "org": _2,
              "net": _2
            }
          },
          "pt": {
            "$": 1,
            "succ": {
              "net": _2,
              "gov": _2,
              "org": _2,
              "edu": _2,
              "int": _2,
              "publ": _2,
              "com": _2,
              "nome": _2,
              "blogspot": _3,
              "123paginaweb": _3
            }
          },
          "pw": {
            "$": 1,
            "succ": {
              "co": _2,
              "ne": _2,
              "or": _2,
              "ed": _2,
              "go": _2,
              "belau": _2,
              "cloudns": _3,
              "x443": _3
            }
          },
          "py": {
            "$": 1,
            "succ": {
              "com": _2,
              "coop": _2,
              "edu": _2,
              "gov": _2,
              "mil": _2,
              "net": _2,
              "org": _2
            }
          },
          "qa": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "mil": _2,
              "name": _2,
              "net": _2,
              "org": _2,
              "sch": _2,
              "blogspot": _3
            }
          },
          "re": {
            "$": 1,
            "succ": {
              "asso": _2,
              "com": _2,
              "nom": _2,
              "blogspot": _3
            }
          },
          "ro": {
            "$": 1,
            "succ": {
              "arts": _2,
              "com": _2,
              "firm": _2,
              "info": _2,
              "nom": _2,
              "nt": _2,
              "org": _2,
              "rec": _2,
              "store": _2,
              "tm": _2,
              "www": _2,
              "co": _3,
              "shop": _3,
              "blogspot": _3,
              "barsy": _3
            }
          },
          "rs": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": _2,
              "edu": _2,
              "gov": _2,
              "in": _2,
              "org": _2,
              "brendly": {
                "$": 0,
                "succ": {
                  "shop": _3
                }
              },
              "blogspot": _3,
              "ua": _3,
              "ox": _3
            }
          },
          "ru": {
            "$": 1,
            "succ": {
              "ac": _3,
              "edu": _3,
              "gov": _3,
              "int": _3,
              "mil": _3,
              "test": _3,
              "eurodir": _3,
              "adygeya": _3,
              "bashkiria": _3,
              "bir": _3,
              "cbg": _3,
              "com": _3,
              "dagestan": _3,
              "grozny": _3,
              "kalmykia": _3,
              "kustanai": _3,
              "marine": _3,
              "mordovia": _3,
              "msk": _3,
              "mytis": _3,
              "nalchik": _3,
              "nov": _3,
              "pyatigorsk": _3,
              "spb": _3,
              "vladikavkaz": _3,
              "vladimir": _3,
              "blogspot": _3,
              "na4u": _3,
              "mircloud": _3,
              "regruhosting": _27,
              "myjino": {
                "$": 2,
                "succ": {
                  "hosting": _5,
                  "landing": _5,
                  "spectrum": _5,
                  "vps": _5
                }
              },
              "cldmail": {
                "$": 0,
                "succ": {
                  "hb": _3
                }
              },
              "mcdir": {
                "$": 2,
                "succ": {
                  "vps": _3
                }
              },
              "mcpre": _3,
              "net": _3,
              "org": _3,
              "pp": _3,
              "123sait": _3,
              "lk3": _3,
              "ras": _3
            }
          },
          "rw": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": _2,
              "coop": _2,
              "gov": _2,
              "mil": _2,
              "net": _2,
              "org": _2
            }
          },
          "sa": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "org": _2,
              "gov": _2,
              "med": _2,
              "pub": _2,
              "edu": _2,
              "sch": _2
            }
          },
          "sb": _4,
          "sc": _4,
          "sd": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "org": _2,
              "edu": _2,
              "med": _2,
              "tv": _2,
              "gov": _2,
              "info": _2
            }
          },
          "se": {
            "$": 1,
            "succ": {
              "a": _2,
              "ac": _2,
              "b": _2,
              "bd": _2,
              "brand": _2,
              "c": _2,
              "d": _2,
              "e": _2,
              "f": _2,
              "fh": _2,
              "fhsk": _2,
              "fhv": _2,
              "g": _2,
              "h": _2,
              "i": _2,
              "k": _2,
              "komforb": _2,
              "kommunalforbund": _2,
              "komvux": _2,
              "l": _2,
              "lanbib": _2,
              "m": _2,
              "n": _2,
              "naturbruksgymn": _2,
              "o": _2,
              "org": _2,
              "p": _2,
              "parti": _2,
              "pp": _2,
              "press": _2,
              "r": _2,
              "s": _2,
              "t": _2,
              "tm": _2,
              "u": _2,
              "w": _2,
              "x": _2,
              "y": _2,
              "z": _2,
              "com": _3,
              "blogspot": _3,
              "conf": _3,
              "iopsys": _3,
              "123minsida": _3,
              "itcouldbewor": _3,
              "myspreadshop": _3,
              "paba": {
                "$": 0,
                "succ": {
                  "su": _3
                }
              }
            }
          },
          "sg": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "org": _2,
              "gov": _2,
              "edu": _2,
              "per": _2,
              "blogspot": _3,
              "enscaled": _3
            }
          },
          "sh": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "gov": _2,
              "org": _2,
              "mil": _2,
              "bip": _3,
              "hashbang": _3,
              "platform": {
                "$": 0,
                "succ": {
                  "bc": _3,
                  "ent": _3,
                  "eu": _3,
                  "us": _3
                }
              },
              "now": _3,
              "vxl": _3,
              "wedeploy": _3
            }
          },
          "si": {
            "$": 1,
            "succ": {
              "gitapp": _3,
              "gitpage": _3,
              "blogspot": _3
            }
          },
          "sj": _2,
          "sk": _6,
          "sl": _4,
          "sm": _2,
          "sn": {
            "$": 1,
            "succ": {
              "art": _2,
              "com": _2,
              "edu": _2,
              "gouv": _2,
              "org": _2,
              "perso": _2,
              "univ": _2,
              "blogspot": _3
            }
          },
          "so": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "me": _2,
              "net": _2,
              "org": _2,
              "sch": _3
            }
          },
          "sr": _2,
          "ss": {
            "$": 1,
            "succ": {
              "biz": _2,
              "com": _2,
              "edu": _2,
              "gov": _2,
              "me": _2,
              "net": _2,
              "org": _2,
              "sch": _2
            }
          },
          "st": {
            "$": 1,
            "succ": {
              "co": _2,
              "com": _2,
              "consulado": _2,
              "edu": _2,
              "embaixada": _2,
              "mil": _2,
              "net": _2,
              "org": _2,
              "principe": _2,
              "saotome": _2,
              "store": _2,
              "kirara": _3,
              "noho": _3
            }
          },
          "su": {
            "$": 1,
            "succ": {
              "abkhazia": _3,
              "adygeya": _3,
              "aktyubinsk": _3,
              "arkhangelsk": _3,
              "armenia": _3,
              "ashgabad": _3,
              "azerbaijan": _3,
              "balashov": _3,
              "bashkiria": _3,
              "bryansk": _3,
              "bukhara": _3,
              "chimkent": _3,
              "dagestan": _3,
              "east-kazakhstan": _3,
              "exnet": _3,
              "georgia": _3,
              "grozny": _3,
              "ivanovo": _3,
              "jambyl": _3,
              "kalmykia": _3,
              "kaluga": _3,
              "karacol": _3,
              "karaganda": _3,
              "karelia": _3,
              "khakassia": _3,
              "krasnodar": _3,
              "kurgan": _3,
              "kustanai": _3,
              "lenug": _3,
              "mangyshlak": _3,
              "mordovia": _3,
              "msk": _3,
              "murmansk": _3,
              "nalchik": _3,
              "navoi": _3,
              "north-kazakhstan": _3,
              "nov": _3,
              "obninsk": _3,
              "penza": _3,
              "pokrovsk": _3,
              "sochi": _3,
              "spb": _3,
              "tashkent": _3,
              "termez": _3,
              "togliatti": _3,
              "troitsk": _3,
              "tselinograd": _3,
              "tula": _3,
              "tuva": _3,
              "vladikavkaz": _3,
              "vladimir": _3,
              "vologda": _3
            }
          },
          "sv": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gob": _2,
              "org": _2,
              "red": _2
            }
          },
          "sx": _7,
          "sy": _32,
          "sz": {
            "$": 1,
            "succ": {
              "co": _2,
              "ac": _2,
              "org": _2
            }
          },
          "tc": {
            "$": 1,
            "succ": {
              "ch": _3,
              "me": _3,
              "we": _3
            }
          },
          "td": _6,
          "tel": _2,
          "tf": {
            "$": 1,
            "succ": {
              "sch": _3
            }
          },
          "tg": _2,
          "th": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": _2,
              "go": _2,
              "in": _2,
              "mi": _2,
              "net": _2,
              "or": _2,
              "online": _3,
              "shop": _3
            }
          },
          "tj": {
            "$": 1,
            "succ": {
              "ac": _2,
              "biz": _2,
              "co": _2,
              "com": _2,
              "edu": _2,
              "go": _2,
              "gov": _2,
              "int": _2,
              "mil": _2,
              "name": _2,
              "net": _2,
              "nic": _2,
              "org": _2,
              "test": _2,
              "web": _2
            }
          },
          "tk": _2,
          "tl": _7,
          "tm": {
            "$": 1,
            "succ": {
              "com": _2,
              "co": _2,
              "org": _2,
              "net": _2,
              "nom": _2,
              "gov": _2,
              "mil": _2,
              "edu": _2
            }
          },
          "tn": {
            "$": 1,
            "succ": {
              "com": _2,
              "ens": _2,
              "fin": _2,
              "gov": _2,
              "ind": _2,
              "info": _2,
              "intl": _2,
              "mincom": _2,
              "nat": _2,
              "net": _2,
              "org": _2,
              "perso": _2,
              "tourism": _2,
              "orangecloud": _3
            }
          },
          "to": {
            "$": 1,
            "succ": {
              "611": _3,
              "com": _2,
              "gov": _2,
              "net": _2,
              "org": _2,
              "edu": _2,
              "mil": _2,
              "oya": _3,
              "rdv": _3,
              "x0": _3,
              "vpnplus": _3,
              "quickconnect": _13,
              "nyan": _3
            }
          },
          "tr": {
            "$": 1,
            "succ": {
              "av": _2,
              "bbs": _2,
              "bel": _2,
              "biz": _2,
              "com": _6,
              "dr": _2,
              "edu": _2,
              "gen": _2,
              "gov": _2,
              "info": _2,
              "mil": _2,
              "k12": _2,
              "kep": _2,
              "name": _2,
              "net": _2,
              "org": _2,
              "pol": _2,
              "tel": _2,
              "tsk": _2,
              "tv": _2,
              "web": _2,
              "nc": _7
            }
          },
          "tt": {
            "$": 1,
            "succ": {
              "co": _2,
              "com": _2,
              "org": _2,
              "net": _2,
              "biz": _2,
              "info": _2,
              "pro": _2,
              "int": _2,
              "coop": _2,
              "jobs": _2,
              "mobi": _2,
              "travel": _2,
              "museum": _2,
              "aero": _2,
              "name": _2,
              "gov": _2,
              "edu": _2
            }
          },
          "tv": {
            "$": 1,
            "succ": {
              "dyndns": _3,
              "better-than": _3,
              "on-the-web": _3,
              "worse-than": _3,
              "from": _3,
              "sakura": _3
            }
          },
          "tw": {
            "$": 1,
            "succ": {
              "edu": _2,
              "gov": _2,
              "mil": _2,
              "com": {
                "$": 1,
                "succ": {
                  "mymailer": _3
                }
              },
              "net": _2,
              "org": _2,
              "idv": _2,
              "game": _2,
              "ebiz": _2,
              "club": _2,
              "xn--zf0ao64a": _2,
              "網路": _2,
              "xn--uc0atv": _2,
              "組織": _2,
              "xn--czrw28b": _2,
              "商業": _2,
              "url": _3,
              "blogspot": _3
            }
          },
          "tz": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": _2,
              "go": _2,
              "hotel": _2,
              "info": _2,
              "me": _2,
              "mil": _2,
              "mobi": _2,
              "ne": _2,
              "or": _2,
              "sc": _2,
              "tv": _2
            }
          },
          "ua": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "gov": _2,
              "in": _2,
              "net": _2,
              "org": _2,
              "cherkassy": _2,
              "cherkasy": _2,
              "chernigov": _2,
              "chernihiv": _2,
              "chernivtsi": _2,
              "chernovtsy": _2,
              "ck": _2,
              "cn": _2,
              "cr": _2,
              "crimea": _2,
              "cv": _2,
              "dn": _2,
              "dnepropetrovsk": _2,
              "dnipropetrovsk": _2,
              "donetsk": _2,
              "dp": _2,
              "if": _2,
              "ivano-frankivsk": _2,
              "kh": _2,
              "kharkiv": _2,
              "kharkov": _2,
              "kherson": _2,
              "khmelnitskiy": _2,
              "khmelnytskyi": _2,
              "kiev": _2,
              "kirovograd": _2,
              "km": _2,
              "kr": _2,
              "krym": _2,
              "ks": _2,
              "kv": _2,
              "kyiv": _2,
              "lg": _2,
              "lt": _2,
              "lugansk": _2,
              "lutsk": _2,
              "lv": _2,
              "lviv": _2,
              "mk": _2,
              "mykolaiv": _2,
              "nikolaev": _2,
              "od": _2,
              "odesa": _2,
              "odessa": _2,
              "pl": _2,
              "poltava": _2,
              "rivne": _2,
              "rovno": _2,
              "rv": _2,
              "sb": _2,
              "sebastopol": _2,
              "sevastopol": _2,
              "sm": _2,
              "sumy": _2,
              "te": _2,
              "ternopil": _2,
              "uz": _2,
              "uzhgorod": _2,
              "vinnica": _2,
              "vinnytsia": _2,
              "vn": _2,
              "volyn": _2,
              "yalta": _2,
              "zaporizhzhe": _2,
              "zaporizhzhia": _2,
              "zhitomir": _2,
              "zhytomyr": _2,
              "zp": _2,
              "zt": _2,
              "cc": _3,
              "inf": _3,
              "ltd": _3,
              "cx": _3,
              "ie": _3,
              "biz": _3,
              "co": _3,
              "pp": _3,
              "v": _3
            }
          },
          "ug": {
            "$": 1,
            "succ": {
              "co": _2,
              "or": _2,
              "ac": _2,
              "sc": _2,
              "go": _2,
              "ne": _2,
              "com": _2,
              "org": _2,
              "blogspot": _3
            }
          },
          "uk": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": {
                "$": 1,
                "succ": {
                  "bytemark": {
                    "$": 0,
                    "succ": {
                      "dh": _3,
                      "vm": _3
                    }
                  },
                  "blogspot": _3,
                  "layershift": _26,
                  "barsy": _3,
                  "barsyonline": _3,
                  "retrosnub": _31,
                  "nh-serv": _3,
                  "no-ip": _3,
                  "wellbeingzone": _3,
                  "adimo": _3,
                  "myspreadshop": _3
                }
              },
              "gov": {
                "$": 1,
                "succ": {
                  "campaign": _3,
                  "service": _3,
                  "api": _3,
                  "homeoffice": _3
                }
              },
              "ltd": _2,
              "me": _2,
              "net": _2,
              "nhs": _2,
              "org": {
                "$": 1,
                "succ": {
                  "glug": _3,
                  "lug": _3,
                  "lugs": _3,
                  "affinitylottery": _3,
                  "raffleentry": _3,
                  "weeklylottery": _3
                }
              },
              "plc": _2,
              "police": _2,
              "sch": _8,
              "conn": _3,
              "copro": _3,
              "hosp": _3,
              "independent-commission": _3,
              "independent-inquest": _3,
              "independent-inquiry": _3,
              "independent-panel": _3,
              "independent-review": _3,
              "public-inquiry": _3,
              "royal-commission": _3,
              "pymnt": _3,
              "barsy": _3
            }
          },
          "us": {
            "$": 1,
            "succ": {
              "dni": _2,
              "fed": _2,
              "isa": _2,
              "kids": _2,
              "nsn": _2,
              "ak": _40,
              "al": _40,
              "ar": _40,
              "as": _40,
              "az": _40,
              "ca": _40,
              "co": _40,
              "ct": _40,
              "dc": _40,
              "de": {
                "$": 1,
                "succ": {
                  "k12": _2,
                  "cc": _2,
                  "lib": _3
                }
              },
              "fl": _40,
              "ga": _40,
              "gu": _40,
              "hi": _41,
              "ia": _40,
              "id": _40,
              "il": _40,
              "in": _40,
              "ks": _40,
              "ky": _40,
              "la": _40,
              "ma": {
                "$": 1,
                "succ": {
                  "k12": {
                    "$": 1,
                    "succ": {
                      "pvt": _2,
                      "chtr": _2,
                      "paroch": _2
                    }
                  },
                  "cc": _2,
                  "lib": _2
                }
              },
              "md": _40,
              "me": _40,
              "mi": {
                "$": 1,
                "succ": {
                  "k12": _2,
                  "cc": _2,
                  "lib": _2,
                  "ann-arbor": _2,
                  "cog": _2,
                  "dst": _2,
                  "eaton": _2,
                  "gen": _2,
                  "mus": _2,
                  "tec": _2,
                  "washtenaw": _2
                }
              },
              "mn": _40,
              "mo": _40,
              "ms": _40,
              "mt": _40,
              "nc": _40,
              "nd": _41,
              "ne": _40,
              "nh": _40,
              "nj": _40,
              "nm": _40,
              "nv": _40,
              "ny": _40,
              "oh": _40,
              "ok": _40,
              "or": _40,
              "pa": _40,
              "pr": _40,
              "ri": _41,
              "sc": _40,
              "sd": _41,
              "tn": _40,
              "tx": _40,
              "ut": _40,
              "vi": _40,
              "vt": _40,
              "va": _40,
              "wa": _40,
              "wi": _40,
              "wv": {
                "$": 1,
                "succ": {
                  "cc": _2
                }
              },
              "wy": _40,
              "graphox": _3,
              "cloudns": _3,
              "drud": _3,
              "is-by": _3,
              "land-4-sale": _3,
              "stuff-4-sale": _3,
              "enscaled": {
                "$": 0,
                "succ": {
                  "phx": _3
                }
              },
              "mircloud": _3,
              "freeddns": _3,
              "golffan": _3,
              "noip": _3,
              "pointto": _3,
              "platterp": _3
            }
          },
          "uy": {
            "$": 1,
            "succ": {
              "com": _6,
              "edu": _2,
              "gub": _2,
              "mil": _2,
              "net": _2,
              "org": _2
            }
          },
          "uz": {
            "$": 1,
            "succ": {
              "co": _2,
              "com": _2,
              "net": _2,
              "org": _2
            }
          },
          "va": _2,
          "vc": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "org": _2,
              "gov": _2,
              "mil": _2,
              "edu": _2,
              "gv": {
                "$": 2,
                "succ": {
                  "d": _3
                }
              },
              "0e": _3
            }
          },
          "ve": {
            "$": 1,
            "succ": {
              "arts": _2,
              "bib": _2,
              "co": _2,
              "com": _2,
              "e12": _2,
              "edu": _2,
              "firm": _2,
              "gob": _2,
              "gov": _2,
              "info": _2,
              "int": _2,
              "mil": _2,
              "net": _2,
              "nom": _2,
              "org": _2,
              "rar": _2,
              "rec": _2,
              "store": _2,
              "tec": _2,
              "web": _2
            }
          },
          "vg": {
            "$": 1,
            "succ": {
              "at": _3
            }
          },
          "vi": {
            "$": 1,
            "succ": {
              "co": _2,
              "com": _2,
              "k12": _2,
              "net": _2,
              "org": _2
            }
          },
          "vn": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "org": _2,
              "edu": _2,
              "gov": _2,
              "int": _2,
              "ac": _2,
              "biz": _2,
              "info": _2,
              "name": _2,
              "pro": _2,
              "health": _2,
              "blogspot": _3
            }
          },
          "vu": {
            "$": 1,
            "succ": {
              "com": _2,
              "edu": _2,
              "net": _2,
              "org": _2,
              "cn": _3,
              "blog": _3,
              "dev": _3,
              "me": _3
            }
          },
          "wf": {
            "$": 1,
            "succ": {
              "biz": _3,
              "sch": _3
            }
          },
          "ws": {
            "$": 1,
            "succ": {
              "com": _2,
              "net": _2,
              "org": _2,
              "gov": _2,
              "edu": _2,
              "advisor": _5,
              "cloud66": _3,
              "dyndns": _3,
              "mypets": _3
            }
          },
          "yt": {
            "$": 1,
            "succ": {
              "org": _3
            }
          },
          "xn--mgbaam7a8h": _2,
          "امارات": _2,
          "xn--y9a3aq": _2,
          "հայ": _2,
          "xn--54b7fta0cc": _2,
          "বাংলা": _2,
          "xn--90ae": _2,
          "бг": _2,
          "xn--mgbcpq6gpa1a": _2,
          "البحرين": _2,
          "xn--90ais": _2,
          "бел": _2,
          "xn--fiqs8s": _2,
          "中国": _2,
          "xn--fiqz9s": _2,
          "中國": _2,
          "xn--lgbbat1ad8j": _2,
          "الجزائر": _2,
          "xn--wgbh1c": _2,
          "مصر": _2,
          "xn--e1a4c": _2,
          "ею": _2,
          "xn--qxa6a": _2,
          "ευ": _2,
          "xn--mgbah1a3hjkrd": _2,
          "موريتانيا": _2,
          "xn--node": _2,
          "გე": _2,
          "xn--qxam": _2,
          "ελ": _2,
          "xn--j6w193g": {
            "$": 1,
            "succ": {
              "xn--55qx5d": _2,
              "xn--wcvs22d": _2,
              "xn--mxtq1m": _2,
              "xn--gmqw5a": _2,
              "xn--od0alg": _2,
              "xn--uc0atv": _2
            }
          },
          "香港": {
            "$": 1,
            "succ": {
              "公司": _2,
              "教育": _2,
              "政府": _2,
              "個人": _2,
              "網絡": _2,
              "組織": _2
            }
          },
          "xn--2scrj9c": _2,
          "ಭಾರತ": _2,
          "xn--3hcrj9c": _2,
          "ଭାରତ": _2,
          "xn--45br5cyl": _2,
          "ভাৰত": _2,
          "xn--h2breg3eve": _2,
          "भारतम्": _2,
          "xn--h2brj9c8c": _2,
          "भारोत": _2,
          "xn--mgbgu82a": _2,
          "ڀارت": _2,
          "xn--rvc1e0am3e": _2,
          "ഭാരതം": _2,
          "xn--h2brj9c": _2,
          "भारत": _2,
          "xn--mgbbh1a": _2,
          "بارت": _2,
          "xn--mgbbh1a71e": _2,
          "بھارت": _2,
          "xn--fpcrj9c3d": _2,
          "భారత్": _2,
          "xn--gecrj9c": _2,
          "ભારત": _2,
          "xn--s9brj9c": _2,
          "ਭਾਰਤ": _2,
          "xn--45brj9c": _2,
          "ভারত": _2,
          "xn--xkc2dl3a5ee0h": _2,
          "இந்தியா": _2,
          "xn--mgba3a4f16a": _2,
          "ایران": _2,
          "xn--mgba3a4fra": _2,
          "ايران": _2,
          "xn--mgbtx2b": _2,
          "عراق": _2,
          "xn--mgbayh7gpa": _2,
          "الاردن": _2,
          "xn--3e0b707e": _2,
          "한국": _2,
          "xn--80ao21a": _2,
          "қаз": _2,
          "xn--q7ce6a": _2,
          "ລາວ": _2,
          "xn--fzc2c9e2c": _2,
          "ලංකා": _2,
          "xn--xkc2al3hye2a": _2,
          "இலங்கை": _2,
          "xn--mgbc0a9azcg": _2,
          "المغرب": _2,
          "xn--d1alf": _2,
          "мкд": _2,
          "xn--l1acc": _2,
          "мон": _2,
          "xn--mix891f": _2,
          "澳門": _2,
          "xn--mix082f": _2,
          "澳门": _2,
          "xn--mgbx4cd0ab": _2,
          "مليسيا": _2,
          "xn--mgb9awbf": _2,
          "عمان": _2,
          "xn--mgbai9azgqp6j": _2,
          "پاکستان": _2,
          "xn--mgbai9a5eva00b": _2,
          "پاكستان": _2,
          "xn--ygbi2ammx": _2,
          "فلسطين": _2,
          "xn--90a3ac": {
            "$": 1,
            "succ": {
              "xn--o1ac": _2,
              "xn--c1avg": _2,
              "xn--90azh": _2,
              "xn--d1at": _2,
              "xn--o1ach": _2,
              "xn--80au": _2
            }
          },
          "срб": {
            "$": 1,
            "succ": {
              "пр": _2,
              "орг": _2,
              "обр": _2,
              "од": _2,
              "упр": _2,
              "ак": _2
            }
          },
          "xn--p1ai": _2,
          "рф": _2,
          "xn--wgbl6a": _2,
          "قطر": _2,
          "xn--mgberp4a5d4ar": _2,
          "السعودية": _2,
          "xn--mgberp4a5d4a87g": _2,
          "السعودیة": _2,
          "xn--mgbqly7c0a67fbc": _2,
          "السعودیۃ": _2,
          "xn--mgbqly7cvafr": _2,
          "السعوديه": _2,
          "xn--mgbpl2fh": _2,
          "سودان": _2,
          "xn--yfro4i67o": _2,
          "新加坡": _2,
          "xn--clchc0ea0b2g2a9gcd": _2,
          "சிங்கப்பூர்": _2,
          "xn--ogbpf8fl": _2,
          "سورية": _2,
          "xn--mgbtf8fl": _2,
          "سوريا": _2,
          "xn--o3cw4h": {
            "$": 1,
            "succ": {
              "xn--12c1fe0br": _2,
              "xn--12co0c3b4eva": _2,
              "xn--h3cuzk1di": _2,
              "xn--o3cyx2a": _2,
              "xn--m3ch0j3a": _2,
              "xn--12cfi8ixb8l": _2
            }
          },
          "ไทย": {
            "$": 1,
            "succ": {
              "ศึกษา": _2,
              "ธุรกิจ": _2,
              "รัฐบาล": _2,
              "ทหาร": _2,
              "เน็ต": _2,
              "องค์กร": _2
            }
          },
          "xn--pgbs0dh": _2,
          "تونس": _2,
          "xn--kpry57d": _2,
          "台灣": _2,
          "xn--kprw13d": _2,
          "台湾": _2,
          "xn--nnx388a": _2,
          "臺灣": _2,
          "xn--j1amh": _2,
          "укр": _2,
          "xn--mgb2ddes": _2,
          "اليمن": _2,
          "xxx": _2,
          "ye": _32,
          "za": {
            "$": 0,
            "succ": {
              "ac": _2,
              "agric": _2,
              "alt": _2,
              "co": _6,
              "edu": _2,
              "gov": _2,
              "grondar": _2,
              "law": _2,
              "mil": _2,
              "net": _2,
              "ngo": _2,
              "nic": _2,
              "nis": _2,
              "nom": _2,
              "org": _2,
              "school": _2,
              "tm": _2,
              "web": _2
            }
          },
          "zm": {
            "$": 1,
            "succ": {
              "ac": _2,
              "biz": _2,
              "co": _2,
              "com": _2,
              "edu": _2,
              "gov": _2,
              "info": _2,
              "mil": _2,
              "net": _2,
              "org": _2,
              "sch": _2
            }
          },
          "zw": {
            "$": 1,
            "succ": {
              "ac": _2,
              "co": _2,
              "gov": _2,
              "mil": _2,
              "org": _2
            }
          },
          "aaa": _2,
          "aarp": _2,
          "abarth": _2,
          "abb": _2,
          "abbott": _2,
          "abbvie": _2,
          "abc": _2,
          "able": _2,
          "abogado": _2,
          "abudhabi": _2,
          "academy": {
            "$": 1,
            "succ": {
              "official": _3
            }
          },
          "accenture": _2,
          "accountant": _2,
          "accountants": _2,
          "aco": _2,
          "actor": _2,
          "ads": _2,
          "adult": _2,
          "aeg": _2,
          "aetna": _2,
          "afl": _2,
          "africa": _2,
          "agakhan": _2,
          "agency": _2,
          "aig": _2,
          "airbus": _2,
          "airforce": _2,
          "airtel": _2,
          "akdn": _2,
          "alfaromeo": _2,
          "alibaba": _2,
          "alipay": _2,
          "allfinanz": _2,
          "allstate": _2,
          "ally": _2,
          "alsace": _2,
          "alstom": _2,
          "amazon": _2,
          "americanexpress": _2,
          "americanfamily": _2,
          "amex": _2,
          "amfam": _2,
          "amica": _2,
          "amsterdam": _2,
          "analytics": _2,
          "android": _2,
          "anquan": _2,
          "anz": _2,
          "aol": _2,
          "apartments": _2,
          "app": {
            "$": 1,
            "succ": {
              "beget": _5,
              "clerk": _3,
              "clerkstage": _3,
              "wnext": _3,
              "platform0": _3,
              "deta": _3,
              "ondigitalocean": _3,
              "easypanel": _3,
              "encr": _3,
              "edgecompute": _3,
              "fireweb": _3,
              "onflashdrive": _3,
              "framer": _3,
              "run": {
                "$": 2,
                "succ": {
                  "a": _3
                }
              },
              "web": _3,
              "hasura": _3,
              "loginline": _3,
              "messerli": _3,
              "netlify": _3,
              "ngrok": _3,
              "ngrok-free": _3,
              "developer": _5,
              "noop": _3,
              "northflank": _5,
              "snowflake": {
                "$": 2,
                "succ": {
                  "privatelink": _3
                }
              },
              "streamlit": _3,
              "telebit": _3,
              "typedream": _3,
              "vercel": _3,
              "bookonline": _3
            }
          },
          "apple": _2,
          "aquarelle": _2,
          "arab": _2,
          "aramco": _2,
          "archi": _2,
          "army": _2,
          "art": _2,
          "arte": _2,
          "asda": _2,
          "associates": _2,
          "athleta": _2,
          "attorney": _2,
          "auction": _2,
          "audi": _2,
          "audible": _2,
          "audio": _2,
          "auspost": _2,
          "author": _2,
          "auto": _2,
          "autos": _2,
          "avianca": _2,
          "aws": _2,
          "axa": _2,
          "azure": _2,
          "baby": _2,
          "baidu": _2,
          "banamex": _2,
          "bananarepublic": _2,
          "band": _2,
          "bank": _2,
          "bar": _2,
          "barcelona": _2,
          "barclaycard": _2,
          "barclays": _2,
          "barefoot": _2,
          "bargains": _2,
          "baseball": _2,
          "basketball": {
            "$": 1,
            "succ": {
              "aus": _3,
              "nz": _3
            }
          },
          "bauhaus": _2,
          "bayern": _2,
          "bbc": _2,
          "bbt": _2,
          "bbva": _2,
          "bcg": _2,
          "bcn": _2,
          "beats": _2,
          "beauty": _2,
          "beer": _2,
          "bentley": _2,
          "berlin": _2,
          "best": _2,
          "bestbuy": _2,
          "bet": _2,
          "bharti": _2,
          "bible": _2,
          "bid": _2,
          "bike": _2,
          "bing": _2,
          "bingo": _2,
          "bio": _2,
          "black": _2,
          "blackfriday": _2,
          "blockbuster": _2,
          "blog": _2,
          "bloomberg": _2,
          "blue": _2,
          "bms": _2,
          "bmw": _2,
          "bnpparibas": _2,
          "boats": _2,
          "boehringer": _2,
          "bofa": _2,
          "bom": _2,
          "bond": _2,
          "boo": _2,
          "book": _2,
          "booking": _2,
          "bosch": _2,
          "bostik": _2,
          "boston": _2,
          "bot": _2,
          "boutique": _2,
          "box": _2,
          "bradesco": _2,
          "bridgestone": _2,
          "broadway": _2,
          "broker": _2,
          "brother": _2,
          "brussels": _2,
          "build": _2,
          "builders": {
            "$": 1,
            "succ": {
              "cloudsite": _3
            }
          },
          "business": _10,
          "buy": _2,
          "buzz": _2,
          "bzh": _2,
          "cab": _2,
          "cafe": _2,
          "cal": _2,
          "call": _2,
          "calvinklein": _2,
          "cam": _2,
          "camera": _2,
          "camp": _2,
          "canon": _2,
          "capetown": _2,
          "capital": _2,
          "capitalone": _2,
          "car": _2,
          "caravan": _2,
          "cards": _2,
          "care": _2,
          "career": _2,
          "careers": _2,
          "cars": _2,
          "casa": {
            "$": 1,
            "succ": {
              "nabu": {
                "$": 0,
                "succ": {
                  "ui": _3
                }
              }
            }
          },
          "case": _2,
          "cash": _2,
          "casino": _2,
          "catering": _2,
          "catholic": _2,
          "cba": _2,
          "cbn": _2,
          "cbre": _2,
          "cbs": _2,
          "center": _2,
          "ceo": _2,
          "cern": _2,
          "cfa": _2,
          "cfd": _2,
          "chanel": _2,
          "channel": _2,
          "charity": _2,
          "chase": _2,
          "chat": _2,
          "cheap": _2,
          "chintai": _2,
          "christmas": _2,
          "chrome": _2,
          "church": _2,
          "cipriani": _2,
          "circle": _2,
          "cisco": _2,
          "citadel": _2,
          "citi": _2,
          "citic": _2,
          "city": _2,
          "cityeats": _2,
          "claims": _2,
          "cleaning": _2,
          "click": _2,
          "clinic": _2,
          "clinique": _2,
          "clothing": _2,
          "cloud": {
            "$": 1,
            "succ": {
              "banzai": _5,
              "elementor": _3,
              "encoway": {
                "$": 0,
                "succ": {
                  "eu": _3
                }
              },
              "statics": _5,
              "ravendb": _3,
              "axarnet": {
                "$": 0,
                "succ": {
                  "es-1": _3
                }
              },
              "diadem": _3,
              "jelastic": {
                "$": 0,
                "succ": {
                  "vip": _3
                }
              },
              "jele": _3,
              "jenv-aruba": {
                "$": 0,
                "succ": {
                  "aruba": {
                    "$": 0,
                    "succ": {
                      "eur": {
                        "$": 0,
                        "succ": {
                          "it1": _3
                        }
                      }
                    }
                  },
                  "it1": _3
                }
              },
              "keliweb": {
                "$": 2,
                "succ": {
                  "cs": _3
                }
              },
              "oxa": {
                "$": 2,
                "succ": {
                  "tn": _3,
                  "uk": _3
                }
              },
              "primetel": {
                "$": 2,
                "succ": {
                  "uk": _3
                }
              },
              "reclaim": {
                "$": 0,
                "succ": {
                  "ca": _3,
                  "uk": _3,
                  "us": _3
                }
              },
              "trendhosting": {
                "$": 0,
                "succ": {
                  "ch": _3,
                  "de": _3
                }
              },
              "jotelulu": _3,
              "kuleuven": _3,
              "linkyard": _3,
              "magentosite": _5,
              "perspecta": _3,
              "vapor": _3,
              "on-rancher": _5,
              "scw": {
                "$": 0,
                "succ": {
                  "baremetal": {
                    "$": 0,
                    "succ": {
                      "fr-par-1": _3,
                      "fr-par-2": _3,
                      "nl-ams-1": _3
                    }
                  },
                  "fr-par": {
                    "$": 0,
                    "succ": {
                      "fnc": {
                        "$": 2,
                        "succ": {
                          "functions": _3
                        }
                      },
                      "k8s": _11,
                      "s3": _3,
                      "s3-website": _3,
                      "whm": _3
                    }
                  },
                  "instances": {
                    "$": 0,
                    "succ": {
                      "priv": _3,
                      "pub": _3
                    }
                  },
                  "k8s": _3,
                  "nl-ams": {
                    "$": 0,
                    "succ": {
                      "k8s": _11,
                      "s3": _3,
                      "s3-website": _3,
                      "whm": _3
                    }
                  },
                  "pl-waw": {
                    "$": 0,
                    "succ": {
                      "k8s": _11,
                      "s3": _3,
                      "s3-website": _3
                    }
                  },
                  "scalebook": _3,
                  "smartlabeling": _3
                }
              },
              "sensiosite": _5,
              "trafficplex": _3,
              "urown": _3,
              "voorloper": _3
            }
          },
          "club": {
            "$": 1,
            "succ": {
              "cloudns": _3,
              "jele": _3,
              "barsy": _3
            }
          },
          "clubmed": _2,
          "coach": _2,
          "codes": {
            "$": 1,
            "succ": {
              "owo": _5
            }
          },
          "coffee": _2,
          "college": _2,
          "cologne": _2,
          "comcast": _2,
          "commbank": _2,
          "community": {
            "$": 1,
            "succ": {
              "nog": _3,
              "ravendb": _3,
              "myforum": _3
            }
          },
          "company": _2,
          "compare": _2,
          "computer": _2,
          "comsec": _2,
          "condos": _2,
          "construction": _2,
          "consulting": _2,
          "contact": _2,
          "contractors": _2,
          "cooking": _2,
          "cookingchannel": _2,
          "cool": {
            "$": 1,
            "succ": {
              "elementor": _3,
              "de": _3
            }
          },
          "corsica": _2,
          "country": _2,
          "coupon": _2,
          "coupons": _2,
          "courses": _2,
          "cpa": _2,
          "credit": _2,
          "creditcard": _2,
          "creditunion": _2,
          "cricket": _2,
          "crown": _2,
          "crs": _2,
          "cruise": _2,
          "cruises": _2,
          "cuisinella": _2,
          "cymru": _2,
          "cyou": _2,
          "dabur": _2,
          "dad": _2,
          "dance": _2,
          "data": _2,
          "date": _2,
          "dating": _2,
          "datsun": _2,
          "day": _2,
          "dclk": _2,
          "dds": _2,
          "deal": _2,
          "dealer": _2,
          "deals": _2,
          "degree": _2,
          "delivery": _2,
          "dell": _2,
          "deloitte": _2,
          "delta": _2,
          "democrat": _2,
          "dental": _2,
          "dentist": _2,
          "desi": _2,
          "design": {
            "$": 1,
            "succ": {
              "bss": _3
            }
          },
          "dev": {
            "$": 1,
            "succ": {
              "autocode": _3,
              "lcl": _5,
              "lclstage": _5,
              "stg": _5,
              "stgstage": _5,
              "pages": _3,
              "r2": _3,
              "workers": _3,
              "curv": _3,
              "deno": _3,
              "deno-staging": _3,
              "deta": _3,
              "fly": _3,
              "githubpreview": _3,
              "gateway": _5,
              "iserv": _3,
              "localcert": {
                "$": 0,
                "succ": {
                  "user": _5
                }
              },
              "loginline": _3,
              "mediatech": _3,
              "ngrok": _3,
              "ngrok-free": _3,
              "platter-app": _3,
              "shiftcrypto": _3,
              "vercel": _3,
              "webhare": _5
            }
          },
          "dhl": _2,
          "diamonds": _2,
          "diet": _2,
          "digital": {
            "$": 1,
            "succ": {
              "cloudapps": {
                "$": 2,
                "succ": {
                  "london": _3
                }
              }
            }
          },
          "direct": _2,
          "directory": _2,
          "discount": _2,
          "discover": _2,
          "dish": _2,
          "diy": _2,
          "dnp": _2,
          "docs": _2,
          "doctor": _2,
          "dog": _2,
          "domains": _2,
          "dot": _2,
          "download": _2,
          "drive": _2,
          "dtv": _2,
          "dubai": _2,
          "dunlop": _2,
          "dupont": _2,
          "durban": _2,
          "dvag": _2,
          "dvr": _2,
          "earth": {
            "$": 1,
            "succ": {
              "dapps": {
                "$": 0,
                "succ": {
                  "*": _3,
                  "bzz": _5
                }
              }
            }
          },
          "eat": _2,
          "eco": _2,
          "edeka": _2,
          "education": _10,
          "email": _2,
          "emerck": _2,
          "energy": _2,
          "engineer": _2,
          "engineering": _2,
          "enterprises": _2,
          "epson": _2,
          "equipment": _2,
          "ericsson": _2,
          "erni": _2,
          "esq": _2,
          "estate": {
            "$": 1,
            "succ": {
              "compute": _5
            }
          },
          "etisalat": _2,
          "eurovision": _2,
          "eus": {
            "$": 1,
            "succ": {
              "party": _28
            }
          },
          "events": {
            "$": 1,
            "succ": {
              "koobin": _3,
              "co": _3
            }
          },
          "exchange": _2,
          "expert": _2,
          "exposed": _2,
          "express": _2,
          "extraspace": _2,
          "fage": _2,
          "fail": _2,
          "fairwinds": _2,
          "faith": _29,
          "family": _2,
          "fan": _2,
          "fans": _2,
          "farm": {
            "$": 1,
            "succ": {
              "storj": _3
            }
          },
          "farmers": _2,
          "fashion": _2,
          "fast": _2,
          "fedex": _2,
          "feedback": _2,
          "ferrari": _2,
          "ferrero": _2,
          "fiat": _2,
          "fidelity": _2,
          "fido": _2,
          "film": _2,
          "final": _2,
          "finance": _2,
          "financial": _10,
          "fire": _2,
          "firestone": _2,
          "firmdale": _2,
          "fish": _2,
          "fishing": _2,
          "fit": _2,
          "fitness": _2,
          "flickr": _2,
          "flights": _2,
          "flir": _2,
          "florist": _2,
          "flowers": _2,
          "fly": _2,
          "foo": _2,
          "food": _2,
          "foodnetwork": _2,
          "football": _2,
          "ford": _2,
          "forex": _2,
          "forsale": _2,
          "forum": _2,
          "foundation": _2,
          "fox": _2,
          "free": _2,
          "fresenius": _2,
          "frl": _2,
          "frogans": _2,
          "frontdoor": _2,
          "frontier": _2,
          "ftr": _2,
          "fujitsu": _2,
          "fun": _2,
          "fund": _2,
          "furniture": _2,
          "futbol": _2,
          "fyi": _2,
          "gal": _2,
          "gallery": _2,
          "gallo": _2,
          "gallup": _2,
          "game": _2,
          "games": _2,
          "gap": _2,
          "garden": _2,
          "gay": _2,
          "gbiz": _2,
          "gdn": {
            "$": 1,
            "succ": {
              "cnpy": _3
            }
          },
          "gea": _2,
          "gent": _2,
          "genting": _2,
          "george": _2,
          "ggee": _2,
          "gift": _2,
          "gifts": _2,
          "gives": _2,
          "giving": _2,
          "glass": _2,
          "gle": _2,
          "global": _2,
          "globo": _2,
          "gmail": _2,
          "gmbh": _2,
          "gmo": _2,
          "gmx": _2,
          "godaddy": _2,
          "gold": _2,
          "goldpoint": _2,
          "golf": _2,
          "goo": _2,
          "goodyear": _2,
          "goog": {
            "$": 1,
            "succ": {
              "cloud": _3,
              "translate": _3,
              "usercontent": _5
            }
          },
          "google": _2,
          "gop": _2,
          "got": _2,
          "grainger": _2,
          "graphics": _2,
          "gratis": _2,
          "green": _2,
          "gripe": _2,
          "grocery": _2,
          "group": {
            "$": 1,
            "succ": {
              "discourse": _3
            }
          },
          "guardian": _2,
          "gucci": _2,
          "guge": _2,
          "guide": _2,
          "guitars": _2,
          "guru": _2,
          "hair": _2,
          "hamburg": _2,
          "hangout": _2,
          "haus": _2,
          "hbo": _2,
          "hdfc": _2,
          "hdfcbank": _2,
          "health": {
            "$": 1,
            "succ": {
              "hra": _3
            }
          },
          "healthcare": _2,
          "help": _2,
          "helsinki": _2,
          "here": _2,
          "hermes": _2,
          "hgtv": _2,
          "hiphop": _2,
          "hisamitsu": _2,
          "hitachi": _2,
          "hiv": _2,
          "hkt": _2,
          "hockey": _2,
          "holdings": _2,
          "holiday": _2,
          "homedepot": _2,
          "homegoods": _2,
          "homes": _2,
          "homesense": _2,
          "honda": _2,
          "horse": _2,
          "hospital": _2,
          "host": {
            "$": 1,
            "succ": {
              "cloudaccess": _3,
              "freesite": _3,
              "easypanel": _3,
              "fastvps": _3,
              "myfast": _3,
              "tempurl": _3,
              "wpmudev": _3,
              "jele": _3,
              "mircloud": _3,
              "pcloud": _3,
              "half": _3
            }
          },
          "hosting": {
            "$": 1,
            "succ": {
              "opencraft": _3
            }
          },
          "hot": _2,
          "hoteles": _2,
          "hotels": _2,
          "hotmail": _2,
          "house": _2,
          "how": _2,
          "hsbc": _2,
          "hughes": _2,
          "hyatt": _2,
          "hyundai": _2,
          "ibm": _2,
          "icbc": _2,
          "ice": _2,
          "icu": _2,
          "ieee": _2,
          "ifm": _2,
          "ikano": _2,
          "imamat": _2,
          "imdb": _2,
          "immo": _2,
          "immobilien": _2,
          "inc": _2,
          "industries": _2,
          "infiniti": _2,
          "ing": _2,
          "ink": _2,
          "institute": _2,
          "insurance": _2,
          "insure": _2,
          "international": _2,
          "intuit": _2,
          "investments": _2,
          "ipiranga": _2,
          "irish": _2,
          "ismaili": _2,
          "ist": _2,
          "istanbul": _2,
          "itau": _2,
          "itv": _2,
          "jaguar": _2,
          "java": _2,
          "jcb": _2,
          "jeep": _2,
          "jetzt": _2,
          "jewelry": _2,
          "jio": _2,
          "jll": _2,
          "jmp": _2,
          "jnj": _2,
          "joburg": _2,
          "jot": _2,
          "joy": _2,
          "jpmorgan": _2,
          "jprs": _2,
          "juegos": _2,
          "juniper": _2,
          "kaufen": _2,
          "kddi": _2,
          "kerryhotels": _2,
          "kerrylogistics": _2,
          "kerryproperties": _2,
          "kfh": _2,
          "kia": _2,
          "kids": _2,
          "kim": _2,
          "kinder": _2,
          "kindle": _2,
          "kitchen": _2,
          "kiwi": _2,
          "koeln": _2,
          "komatsu": _2,
          "kosher": _2,
          "kpmg": _2,
          "kpn": _2,
          "krd": {
            "$": 1,
            "succ": {
              "co": _3,
              "edu": _3
            }
          },
          "kred": _2,
          "kuokgroup": _2,
          "kyoto": _2,
          "lacaixa": _2,
          "lamborghini": _2,
          "lamer": _2,
          "lancaster": _2,
          "lancia": _2,
          "land": {
            "$": 1,
            "succ": {
              "static": {
                "$": 2,
                "succ": {
                  "dev": _3,
                  "sites": _3
                }
              }
            }
          },
          "landrover": _2,
          "lanxess": _2,
          "lasalle": _2,
          "lat": _2,
          "latino": _2,
          "latrobe": _2,
          "law": _2,
          "lawyer": _2,
          "lds": _2,
          "lease": _2,
          "leclerc": _2,
          "lefrak": _2,
          "legal": _2,
          "lego": _2,
          "lexus": _2,
          "lgbt": _2,
          "lidl": _2,
          "life": _2,
          "lifeinsurance": _2,
          "lifestyle": _2,
          "lighting": _2,
          "like": _2,
          "lilly": _2,
          "limited": _2,
          "limo": _2,
          "lincoln": _2,
          "link": {
            "$": 1,
            "succ": {
              "cyon": _3,
              "mypep": _3,
              "dweb": _5
            }
          },
          "lipsy": _2,
          "live": {
            "$": 1,
            "succ": {
              "hlx": _3
            }
          },
          "living": _2,
          "llc": _2,
          "llp": _2,
          "loan": _2,
          "loans": _2,
          "locker": _2,
          "locus": _2,
          "lol": {
            "$": 1,
            "succ": {
              "omg": _3
            }
          },
          "london": _2,
          "lotte": _2,
          "lotto": _2,
          "love": _2,
          "lpl": _2,
          "lplfinancial": _2,
          "ltd": _2,
          "ltda": _2,
          "lundbeck": _2,
          "luxe": _2,
          "luxury": _2,
          "madrid": _2,
          "maif": _2,
          "maison": _2,
          "makeup": _2,
          "man": _2,
          "management": {
            "$": 1,
            "succ": {
              "router": _3
            }
          },
          "mango": _2,
          "map": _2,
          "market": _2,
          "marketing": _2,
          "markets": _2,
          "marriott": _2,
          "marshalls": _2,
          "maserati": _2,
          "mattel": _2,
          "mba": _2,
          "mckinsey": _2,
          "med": _2,
          "media": _35,
          "meet": _2,
          "melbourne": _2,
          "meme": _2,
          "memorial": _2,
          "men": _2,
          "menu": _36,
          "merckmsd": _2,
          "miami": _2,
          "microsoft": _2,
          "mini": _2,
          "mint": _2,
          "mit": _2,
          "mitsubishi": _2,
          "mlb": _2,
          "mls": _2,
          "mma": _2,
          "mobile": _2,
          "moda": _2,
          "moe": _2,
          "moi": _2,
          "mom": _2,
          "monash": _2,
          "money": _2,
          "monster": _2,
          "mormon": _2,
          "mortgage": _2,
          "moscow": _2,
          "moto": _2,
          "motorcycles": _2,
          "mov": _2,
          "movie": _2,
          "msd": _2,
          "mtn": _2,
          "mtr": _2,
          "music": _2,
          "mutual": _2,
          "nab": _2,
          "nagoya": _2,
          "natura": _2,
          "navy": _2,
          "nba": _2,
          "nec": _2,
          "netbank": _2,
          "netflix": _2,
          "network": {
            "$": 1,
            "succ": {
              "alces": _5,
              "co": _3,
              "arvo": _3,
              "azimuth": _3,
              "tlon": _3
            }
          },
          "neustar": _2,
          "new": _2,
          "news": {
            "$": 1,
            "succ": {
              "noticeable": _3
            }
          },
          "next": _2,
          "nextdirect": _2,
          "nexus": _2,
          "nfl": _2,
          "ngo": _2,
          "nhk": _2,
          "nico": _2,
          "nike": _2,
          "nikon": _2,
          "ninja": _2,
          "nissan": _2,
          "nissay": _2,
          "nokia": _2,
          "northwesternmutual": _2,
          "norton": _2,
          "now": _2,
          "nowruz": _2,
          "nowtv": _2,
          "nra": _2,
          "nrw": _2,
          "ntt": _2,
          "nyc": _2,
          "obi": _2,
          "observer": _2,
          "office": _2,
          "okinawa": _2,
          "olayan": _2,
          "olayangroup": _2,
          "oldnavy": _2,
          "ollo": _2,
          "omega": _2,
          "one": {
            "$": 1,
            "succ": {
              "onred": {
                "$": 2,
                "succ": {
                  "staging": _3
                }
              },
              "service": _3,
              "homelink": _3
            }
          },
          "ong": _2,
          "onl": _2,
          "online": {
            "$": 1,
            "succ": {
              "eero": _3,
              "eero-stage": _3,
              "barsy": _3
            }
          },
          "ooo": _2,
          "open": _2,
          "oracle": _2,
          "orange": {
            "$": 1,
            "succ": {
              "tech": _3
            }
          },
          "organic": _2,
          "origins": _2,
          "osaka": _2,
          "otsuka": _2,
          "ott": _2,
          "ovh": {
            "$": 1,
            "succ": {
              "nerdpol": _3
            }
          },
          "page": {
            "$": 1,
            "succ": {
              "hlx": _3,
              "hlx3": _3,
              "translated": _3,
              "codeberg": _3,
              "pdns": _3,
              "plesk": _3,
              "prvcy": _3,
              "rocky": _3,
              "magnet": _3
            }
          },
          "panasonic": _2,
          "paris": _2,
          "pars": _2,
          "partners": _2,
          "parts": _2,
          "party": _29,
          "passagens": _2,
          "pay": _2,
          "pccw": _2,
          "pet": _2,
          "pfizer": _2,
          "pharmacy": _2,
          "phd": _2,
          "philips": _2,
          "phone": _2,
          "photo": _2,
          "photography": _2,
          "photos": _35,
          "physio": _2,
          "pics": _2,
          "pictet": _2,
          "pictures": {
            "$": 1,
            "succ": {
              "1337": _3
            }
          },
          "pid": _2,
          "pin": _2,
          "ping": _2,
          "pink": _2,
          "pioneer": _2,
          "pizza": {
            "$": 1,
            "succ": {
              "ngrok": _3
            }
          },
          "place": _10,
          "play": _2,
          "playstation": _2,
          "plumbing": _2,
          "plus": _2,
          "pnc": _2,
          "pohl": _2,
          "poker": _2,
          "politie": _2,
          "porn": {
            "$": 1,
            "succ": {
              "indie": _3
            }
          },
          "pramerica": _2,
          "praxi": _2,
          "press": _2,
          "prime": _2,
          "prod": _2,
          "productions": _2,
          "prof": _2,
          "progressive": _2,
          "promo": _2,
          "properties": _2,
          "property": _2,
          "protection": _2,
          "pru": _2,
          "prudential": _2,
          "pub": _36,
          "pwc": _2,
          "qpon": _2,
          "quebec": _2,
          "quest": _2,
          "racing": _2,
          "radio": _2,
          "read": _2,
          "realestate": _2,
          "realtor": _2,
          "realty": _2,
          "recipes": _2,
          "red": _2,
          "redstone": _2,
          "redumbrella": _2,
          "rehab": _2,
          "reise": _2,
          "reisen": _2,
          "reit": _2,
          "reliance": _2,
          "ren": _2,
          "rent": _2,
          "rentals": _2,
          "repair": _2,
          "report": _2,
          "republican": _2,
          "rest": _2,
          "restaurant": _2,
          "review": _29,
          "reviews": _2,
          "rexroth": _2,
          "rich": _2,
          "richardli": _2,
          "ricoh": _2,
          "ril": _2,
          "rio": _2,
          "rip": {
            "$": 1,
            "succ": {
              "clan": _3
            }
          },
          "rocher": _2,
          "rocks": {
            "$": 1,
            "succ": {
              "myddns": _3,
              "lima-city": _3,
              "webspace": _3
            }
          },
          "rodeo": _2,
          "rogers": _2,
          "room": _2,
          "rsvp": _2,
          "rugby": _2,
          "ruhr": _2,
          "run": {
            "$": 1,
            "succ": {
              "hs": _3,
              "development": _3,
              "ravendb": _3,
              "servers": _3,
              "build": _5,
              "code": _5,
              "database": _5,
              "migration": _5,
              "onporter": _3,
              "repl": _3
            }
          },
          "rwe": _2,
          "ryukyu": _2,
          "saarland": _2,
          "safe": _2,
          "safety": _2,
          "sakura": _2,
          "sale": _2,
          "salon": _2,
          "samsclub": _2,
          "samsung": _2,
          "sandvik": _2,
          "sandvikcoromant": _2,
          "sanofi": _2,
          "sap": _2,
          "sarl": _2,
          "sas": _2,
          "save": _2,
          "saxo": _2,
          "sbi": _2,
          "sbs": _2,
          "sca": _2,
          "scb": _2,
          "schaeffler": _2,
          "schmidt": _2,
          "scholarships": _2,
          "school": _2,
          "schule": _2,
          "schwarz": _2,
          "science": _29,
          "scot": {
            "$": 1,
            "succ": {
              "edu": _3,
              "gov": {
                "$": 2,
                "succ": {
                  "service": _3
                }
              }
            }
          },
          "search": _2,
          "seat": _2,
          "secure": _2,
          "security": _2,
          "seek": _2,
          "select": _2,
          "sener": _2,
          "services": {
            "$": 1,
            "succ": {
              "loginline": _3
            }
          },
          "seven": _2,
          "sew": _2,
          "sex": _2,
          "sexy": _2,
          "sfr": _2,
          "shangrila": _2,
          "sharp": _2,
          "shaw": _2,
          "shell": _2,
          "shia": _2,
          "shiksha": _2,
          "shoes": _2,
          "shop": {
            "$": 1,
            "succ": {
              "base": _3,
              "hoplix": _3,
              "barsy": _3
            }
          },
          "shopping": _2,
          "shouji": _2,
          "show": _2,
          "showtime": _2,
          "silk": _2,
          "sina": _2,
          "singles": _2,
          "site": {
            "$": 1,
            "succ": {
              "cloudera": _5,
              "cyon": _3,
              "fnwk": _3,
              "folionetwork": _3,
              "fastvps": _3,
              "jele": _3,
              "lelux": _3,
              "loginline": _3,
              "barsy": _3,
              "mintere": _3,
              "omniwe": _3,
              "opensocial": _3,
              "platformsh": _5,
              "tst": _5,
              "byen": _3,
              "srht": _3,
              "novecore": _3
            }
          },
          "ski": _2,
          "skin": _2,
          "sky": _2,
          "skype": _2,
          "sling": _2,
          "smart": _2,
          "smile": _2,
          "sncf": _2,
          "soccer": _2,
          "social": _2,
          "softbank": _2,
          "software": _2,
          "sohu": _2,
          "solar": _2,
          "solutions": {
            "$": 1,
            "succ": {
              "diher": _5
            }
          },
          "song": _2,
          "sony": _2,
          "soy": _2,
          "spa": _2,
          "space": {
            "$": 1,
            "succ": {
              "myfast": _3,
              "uber": _3,
              "xs4all": _3
            }
          },
          "sport": _2,
          "spot": _2,
          "srl": _2,
          "stada": _2,
          "staples": _2,
          "star": _2,
          "statebank": _2,
          "statefarm": _2,
          "stc": _2,
          "stcgroup": _2,
          "stockholm": _2,
          "storage": _2,
          "store": {
            "$": 1,
            "succ": {
              "sellfy": _3,
              "shopware": _3,
              "storebase": _3
            }
          },
          "stream": _2,
          "studio": _2,
          "study": _2,
          "style": _2,
          "sucks": _2,
          "supplies": _2,
          "supply": _2,
          "support": _36,
          "surf": _2,
          "surgery": _2,
          "suzuki": _2,
          "swatch": _2,
          "swiss": _2,
          "sydney": _2,
          "systems": {
            "$": 1,
            "succ": {
              "knightpoint": _3
            }
          },
          "tab": _2,
          "taipei": _2,
          "talk": _2,
          "taobao": _2,
          "target": _2,
          "tatamotors": _2,
          "tatar": _2,
          "tattoo": _2,
          "tax": _2,
          "taxi": _2,
          "tci": _2,
          "tdk": _2,
          "team": {
            "$": 1,
            "succ": {
              "discourse": _3,
              "jelastic": _3
            }
          },
          "tech": _2,
          "technology": _10,
          "temasek": _2,
          "tennis": _2,
          "teva": _2,
          "thd": _2,
          "theater": _2,
          "theatre": _2,
          "tiaa": _2,
          "tickets": _2,
          "tienda": _2,
          "tiffany": _2,
          "tips": _2,
          "tires": _2,
          "tirol": _2,
          "tjmaxx": _2,
          "tjx": _2,
          "tkmaxx": _2,
          "tmall": _2,
          "today": {
            "$": 1,
            "succ": {
              "prequalifyme": _3
            }
          },
          "tokyo": _2,
          "tools": _2,
          "top": {
            "$": 1,
            "succ": {
              "now-dns": _3,
              "ntdll": _3
            }
          },
          "toray": _2,
          "toshiba": _2,
          "total": _2,
          "tours": _2,
          "town": _2,
          "toyota": _2,
          "toys": _2,
          "trade": _29,
          "trading": _2,
          "training": _2,
          "travel": _2,
          "travelchannel": _2,
          "travelers": _2,
          "travelersinsurance": _2,
          "trust": _2,
          "trv": _2,
          "tube": _2,
          "tui": _2,
          "tunes": _2,
          "tushu": _2,
          "tvs": _2,
          "ubank": _2,
          "ubs": _2,
          "unicom": _2,
          "university": _2,
          "uno": _2,
          "uol": _2,
          "ups": _2,
          "vacations": _2,
          "vana": _2,
          "vanguard": _2,
          "vegas": _2,
          "ventures": _2,
          "verisign": _2,
          "versicherung": _2,
          "vet": _2,
          "viajes": _2,
          "video": _2,
          "vig": _2,
          "viking": _2,
          "villas": _2,
          "vin": _2,
          "vip": _2,
          "virgin": _2,
          "visa": _2,
          "vision": _2,
          "viva": _2,
          "vivo": _2,
          "vlaanderen": _2,
          "vodka": _2,
          "volkswagen": _2,
          "volvo": _2,
          "vote": _2,
          "voting": _2,
          "voto": _2,
          "voyage": _2,
          "vuelos": _2,
          "wales": _2,
          "walmart": _2,
          "walter": _2,
          "wang": _2,
          "wanggou": _2,
          "watch": _2,
          "watches": _2,
          "weather": _2,
          "weatherchannel": _2,
          "webcam": _2,
          "weber": _2,
          "website": _35,
          "wedding": _2,
          "weibo": _2,
          "weir": _2,
          "whoswho": _2,
          "wien": _2,
          "wiki": _35,
          "williamhill": _2,
          "win": _2,
          "windows": _2,
          "wine": _2,
          "winners": _2,
          "wme": _2,
          "wolterskluwer": _2,
          "woodside": _2,
          "work": _2,
          "works": _2,
          "world": _2,
          "wow": _2,
          "wtc": _2,
          "wtf": _2,
          "xbox": _2,
          "xerox": _2,
          "xfinity": _2,
          "xihuan": _2,
          "xin": _2,
          "xn--11b4c3d": _2,
          "कॉम": _2,
          "xn--1ck2e1b": _2,
          "セール": _2,
          "xn--1qqw23a": _2,
          "佛山": _2,
          "xn--30rr7y": _2,
          "慈善": _2,
          "xn--3bst00m": _2,
          "集团": _2,
          "xn--3ds443g": _2,
          "在线": _2,
          "xn--3pxu8k": _2,
          "点看": _2,
          "xn--42c2d9a": _2,
          "คอม": _2,
          "xn--45q11c": _2,
          "八卦": _2,
          "xn--4gbrim": _2,
          "موقع": _2,
          "xn--55qw42g": _2,
          "公益": _2,
          "xn--55qx5d": _2,
          "公司": _2,
          "xn--5su34j936bgsg": _2,
          "香格里拉": _2,
          "xn--5tzm5g": _2,
          "网站": _2,
          "xn--6frz82g": _2,
          "移动": _2,
          "xn--6qq986b3xl": _2,
          "我爱你": _2,
          "xn--80adxhks": _2,
          "москва": _2,
          "xn--80aqecdr1a": _2,
          "католик": _2,
          "xn--80asehdb": _2,
          "онлайн": _2,
          "xn--80aswg": _2,
          "сайт": _2,
          "xn--8y0a063a": _2,
          "联通": _2,
          "xn--9dbq2a": _2,
          "קום": _2,
          "xn--9et52u": _2,
          "时尚": _2,
          "xn--9krt00a": _2,
          "微博": _2,
          "xn--b4w605ferd": _2,
          "淡马锡": _2,
          "xn--bck1b9a5dre4c": _2,
          "ファッション": _2,
          "xn--c1avg": _2,
          "орг": _2,
          "xn--c2br7g": _2,
          "नेट": _2,
          "xn--cck2b3b": _2,
          "ストア": _2,
          "xn--cckwcxetd": _2,
          "アマゾン": _2,
          "xn--cg4bki": _2,
          "삼성": _2,
          "xn--czr694b": _2,
          "商标": _2,
          "xn--czrs0t": _2,
          "商店": _2,
          "xn--czru2d": _2,
          "商城": _2,
          "xn--d1acj3b": _2,
          "дети": _2,
          "xn--eckvdtc9d": _2,
          "ポイント": _2,
          "xn--efvy88h": _2,
          "新闻": _2,
          "xn--fct429k": _2,
          "家電": _2,
          "xn--fhbei": _2,
          "كوم": _2,
          "xn--fiq228c5hs": _2,
          "中文网": _2,
          "xn--fiq64b": _2,
          "中信": _2,
          "xn--fjq720a": _2,
          "娱乐": _2,
          "xn--flw351e": _2,
          "谷歌": _2,
          "xn--fzys8d69uvgm": _2,
          "電訊盈科": _2,
          "xn--g2xx48c": _2,
          "购物": _2,
          "xn--gckr3f0f": _2,
          "クラウド": _2,
          "xn--gk3at1e": _2,
          "通販": _2,
          "xn--hxt814e": _2,
          "网店": _2,
          "xn--i1b6b1a6a2e": _2,
          "संगठन": _2,
          "xn--imr513n": _2,
          "餐厅": _2,
          "xn--io0a7i": _2,
          "网络": _2,
          "xn--j1aef": _2,
          "ком": _2,
          "xn--jlq480n2rg": _2,
          "亚马逊": _2,
          "xn--jvr189m": _2,
          "食品": _2,
          "xn--kcrx77d1x4a": _2,
          "飞利浦": _2,
          "xn--kput3i": _2,
          "手机": _2,
          "xn--mgba3a3ejt": _2,
          "ارامكو": _2,
          "xn--mgba7c0bbn0a": _2,
          "العليان": _2,
          "xn--mgbaakc7dvf": _2,
          "اتصالات": _2,
          "xn--mgbab2bd": _2,
          "بازار": _2,
          "xn--mgbca7dzdo": _2,
          "ابوظبي": _2,
          "xn--mgbi4ecexp": _2,
          "كاثوليك": _2,
          "xn--mgbt3dhd": _2,
          "همراه": _2,
          "xn--mk1bu44c": _2,
          "닷컴": _2,
          "xn--mxtq1m": _2,
          "政府": _2,
          "xn--ngbc5azd": _2,
          "شبكة": _2,
          "xn--ngbe9e0a": _2,
          "بيتك": _2,
          "xn--ngbrx": _2,
          "عرب": _2,
          "xn--nqv7f": _2,
          "机构": _2,
          "xn--nqv7fs00ema": _2,
          "组织机构": _2,
          "xn--nyqy26a": _2,
          "健康": _2,
          "xn--otu796d": _2,
          "招聘": _2,
          "xn--p1acf": {
            "$": 1,
            "succ": {
              "xn--90amc": _3,
              "xn--j1aef": _3,
              "xn--j1ael8b": _3,
              "xn--h1ahn": _3,
              "xn--j1adp": _3,
              "xn--c1avg": _3,
              "xn--80aaa0cvac": _3,
              "xn--h1aliz": _3,
              "xn--90a1af": _3,
              "xn--41a": _3
            }
          },
          "рус": {
            "$": 1,
            "succ": {
              "биз": _3,
              "ком": _3,
              "крым": _3,
              "мир": _3,
              "мск": _3,
              "орг": _3,
              "самара": _3,
              "сочи": _3,
              "спб": _3,
              "я": _3
            }
          },
          "xn--pssy2u": _2,
          "大拿": _2,
          "xn--q9jyb4c": _2,
          "みんな": _2,
          "xn--qcka1pmc": _2,
          "グーグル": _2,
          "xn--rhqv96g": _2,
          "世界": _2,
          "xn--rovu88b": _2,
          "書籍": _2,
          "xn--ses554g": _2,
          "网址": _2,
          "xn--t60b56a": _2,
          "닷넷": _2,
          "xn--tckwe": _2,
          "コム": _2,
          "xn--tiq49xqyj": _2,
          "天主教": _2,
          "xn--unup4y": _2,
          "游戏": _2,
          "xn--vermgensberater-ctb": _2,
          "vermögensberater": _2,
          "xn--vermgensberatung-pwb": _2,
          "vermögensberatung": _2,
          "xn--vhquv": _2,
          "企业": _2,
          "xn--vuq861b": _2,
          "信息": _2,
          "xn--w4r85el8fhu5dnra": _2,
          "嘉里大酒店": _2,
          "xn--w4rs40l": _2,
          "嘉里": _2,
          "xn--xhq521b": _2,
          "广东": _2,
          "xn--zfr164b": _2,
          "政务": _2,
          "xyz": {
            "$": 1,
            "succ": {
              "blogsite": _3,
              "localzone": _3,
              "crafting": _3,
              "zapto": _3,
              "telebit": _5
            }
          },
          "yachts": _2,
          "yahoo": _2,
          "yamaxun": _2,
          "yandex": _2,
          "yodobashi": _2,
          "yoga": _2,
          "yokohama": _2,
          "you": _2,
          "youtube": _2,
          "yun": _2,
          "zappos": _2,
          "zara": _2,
          "zero": _2,
          "zip": _2,
          "zone": {
            "$": 1,
            "succ": {
              "cloud66": _3,
              "hs": _3,
              "triton": _5,
              "lima": _3
            }
          },
          "zuerich": _2
        }
      };
      return rules;
    }();
    function lookupInTrie(parts, trie, index, allowedMask) {
      var result = null;
      var node = trie;
      while (node !== undefined) {
        if ((node.$ & allowedMask) !== 0) {
          result = {
            index: index + 1,
            isIcann: node.$ === 1 ,
            isPrivate: node.$ === 2
          };
        }
        if (index === -1) {
          break;
        }
        var succ = node.succ;
        node = succ && (succ[parts[index]] || succ['*']);
        index -= 1;
      }
      return result;
    }
    function suffixLookup(hostname, options, out) {
      if (fastPathLookup(hostname, options, out) === true) {
        return;
      }
      var hostnameParts = hostname.split('.');
      var allowedMask = (options.allowPrivateDomains === true ? 2  : 0) | (options.allowIcannDomains === true ? 1  : 0);
      var exceptionMatch = lookupInTrie(hostnameParts, exceptions, hostnameParts.length - 1, allowedMask);
      if (exceptionMatch !== null) {
        out.isIcann = exceptionMatch.isIcann;
        out.isPrivate = exceptionMatch.isPrivate;
        out.publicSuffix = hostnameParts.slice(exceptionMatch.index + 1).join('.');
        return;
      }
      var rulesMatch = lookupInTrie(hostnameParts, rules, hostnameParts.length - 1, allowedMask);
      if (rulesMatch !== null) {
        out.isIcann = rulesMatch.isIcann;
        out.isPrivate = rulesMatch.isPrivate;
        out.publicSuffix = hostnameParts.slice(rulesMatch.index).join('.');
        return;
      }
      out.isIcann = false;
      out.isPrivate = false;
      out.publicSuffix = hostnameParts[hostnameParts.length - 1];
    }
    var RESULT = getEmptyResult();
    function parse(url) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      return parseImpl(url, 5 , suffixLookup, options, getEmptyResult());
    }
    function getHostname(url) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      resetResult(RESULT);
      return parseImpl(url, 0 , suffixLookup, options, RESULT).hostname;
    }
    function getDomain(url) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      resetResult(RESULT);
      return parseImpl(url, 3 , suffixLookup, options, RESULT).domain;
    }
    var word = '[a-fA-F\\d:]';
    var b = function b(options) {
      return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=".concat(word, ")|(?<=").concat(word, ")(?=\\s|$))") : '';
    };
    var v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}';
    var v6seg = '[a-fA-F\\d]{1,4}';
    var v6 = "\n(?:\n(?:".concat(v6seg, ":){7}(?:").concat(v6seg, "|:)|                                    // 1:2:3:4:5:6:7::  1:2:3:4:5:6:7:8\n(?:").concat(v6seg, ":){6}(?:").concat(v4, "|:").concat(v6seg, "|:)|                             // 1:2:3:4:5:6::    1:2:3:4:5:6::8   1:2:3:4:5:6::8  1:2:3:4:5:6::1.2.3.4\n(?:").concat(v6seg, ":){5}(?::").concat(v4, "|(?::").concat(v6seg, "){1,2}|:)|                   // 1:2:3:4:5::      1:2:3:4:5::7:8   1:2:3:4:5::8    1:2:3:4:5::7:1.2.3.4\n(?:").concat(v6seg, ":){4}(?:(?::").concat(v6seg, "){0,1}:").concat(v4, "|(?::").concat(v6seg, "){1,3}|:)| // 1:2:3:4::        1:2:3:4::6:7:8   1:2:3:4::8      1:2:3:4::6:7:1.2.3.4\n(?:").concat(v6seg, ":){3}(?:(?::").concat(v6seg, "){0,2}:").concat(v4, "|(?::").concat(v6seg, "){1,4}|:)| // 1:2:3::          1:2:3::5:6:7:8   1:2:3::8        1:2:3::5:6:7:1.2.3.4\n(?:").concat(v6seg, ":){2}(?:(?::").concat(v6seg, "){0,3}:").concat(v4, "|(?::").concat(v6seg, "){1,5}|:)| // 1:2::            1:2::4:5:6:7:8   1:2::8          1:2::4:5:6:7:1.2.3.4\n(?:").concat(v6seg, ":){1}(?:(?::").concat(v6seg, "){0,4}:").concat(v4, "|(?::").concat(v6seg, "){1,6}|:)| // 1::              1::3:4:5:6:7:8   1::8            1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::").concat(v6seg, "){0,5}:").concat(v4, "|(?::").concat(v6seg, "){1,7}|:))             // ::2:3:4:5:6:7:8  ::2:3:4:5:6:7:8  ::8             ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})?                                             // %eth0            %1\n").replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim();
    var v46Exact = new RegExp("(?:^".concat(v4, "$)|(?:^").concat(v6, "$)"));
    var v4exact = new RegExp("^".concat(v4, "$"));
    var v6exact = new RegExp("^".concat(v6, "$"));
    var ip = function ip(options) {
      return options && options.exact ? v46Exact : new RegExp("(?:".concat(b(options)).concat(v4).concat(b(options), ")|(?:").concat(b(options)).concat(v6).concat(b(options), ")"), 'g');
    };
    ip.v4 = function (options) {
      return options && options.exact ? v4exact : new RegExp("".concat(b(options)).concat(v4).concat(b(options)), 'g');
    };
    ip.v6 = function (options) {
      return options && options.exact ? v6exact : new RegExp("".concat(b(options)).concat(v6).concat(b(options)), 'g');
    };
    var ipRegex$1 = ip;
    var ipRegex = ipRegex$1;
    var isIp = function isIp(string) {
      return ipRegex({
        exact: true
      }).test(string);
    };
    isIp.v4 = function (string) {
      return ipRegex.v4({
        exact: true
      }).test(string);
    };
    isIp.v6 = function (string) {
      return ipRegex.v6({
        exact: true
      }).test(string);
    };
    isIp.version = function (string) {
      return isIp(string) ? isIp.v4(string) ? 4 : 6 : undefined;
    };
    var isIp_1 = isIp;
    var isIp$1 = getDefaultExportFromCjs$1(isIp_1);
    function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
    function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
    function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
    var REGEX_DATA = 'xregexp';
    var features = {
      astral: false,
      namespacing: true
    };
    var fixed = {};
    var regexCache = {};
    var patternCache = {};
    var tokens = [];
    var defaultScope = 'default';
    var classScope = 'class';
    var nativeTokens = {
      'default': /\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|\(\?(?:[:=!]|<[=!])|[?*+]\?|{\d+(?:,\d*)?}\??|[\s\S]/,
      'class': /\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|[\s\S]/
    };
    var replacementToken = /\$(?:\{([^\}]+)\}|<([^>]+)>|(\d\d?|[\s\S]?))/g;
    var correctExecNpcg = /()??/.exec('')[1] === undefined;
    var hasFlagsProp = /x/.flags !== undefined;
    function hasNativeFlag(flag) {
      var isSupported = true;
      try {
        new RegExp('', flag);
        if (flag === 'y') {
          var gy = function () {
            return 'gy';
          }();
          var incompleteY = '.a'.replace(new RegExp('a', gy), '.') === '..';
          if (incompleteY) {
            isSupported = false;
          }
        }
      } catch (exception) {
        isSupported = false;
      }
      return isSupported;
    }
    var hasNativeD = hasNativeFlag('d');
    var hasNativeS = hasNativeFlag('s');
    var hasNativeU = hasNativeFlag('u');
    var hasNativeY = hasNativeFlag('y');
    var registeredFlags = {
      d: hasNativeD,
      g: true,
      i: true,
      m: true,
      s: hasNativeS,
      u: hasNativeU,
      y: hasNativeY
    };
    var nonnativeFlags = hasNativeS ? /[^dgimsuy]+/g : /[^dgimuy]+/g;
    function augment(regex, captureNames, xSource, xFlags, isInternalOnly) {
      regex[REGEX_DATA] = {
        captureNames
      };
      if (isInternalOnly) {
        return regex;
      }
      if (regex.__proto__) {
        regex.__proto__ = XRegExp.prototype;
      } else {
        for (var p in XRegExp.prototype) {
          regex[p] = XRegExp.prototype[p];
        }
      }
      regex[REGEX_DATA].source = xSource;
      regex[REGEX_DATA].flags = xFlags ? xFlags.split('').sort().join('') : xFlags;
      return regex;
    }
    function clipDuplicates(str) {
      return str.replace(/([\s\S])(?=[\s\S]*\1)/g, '');
    }
    function copyRegex(regex, options) {
      if (!XRegExp.isRegExp(regex)) {
        throw new TypeError('Type RegExp expected');
      }
      var xData = regex[REGEX_DATA] || {};
      var flags = getNativeFlags(regex);
      var flagsToAdd = '';
      var flagsToRemove = '';
      var xregexpSource = null;
      var xregexpFlags = null;
      options = options || {};
      if (options.removeG) {
        flagsToRemove += 'g';
      }
      if (options.removeY) {
        flagsToRemove += 'y';
      }
      if (flagsToRemove) {
        flags = flags.replace(new RegExp("[".concat(flagsToRemove, "]+"), 'g'), '');
      }
      if (options.addG) {
        flagsToAdd += 'g';
      }
      if (options.addY) {
        flagsToAdd += 'y';
      }
      if (flagsToAdd) {
        flags = clipDuplicates(flags + flagsToAdd);
      }
      if (!options.isInternalOnly) {
        if (xData.source !== undefined) {
          xregexpSource = xData.source;
        }
        if (xData.flags != null) {
          xregexpFlags = flagsToAdd ? clipDuplicates(xData.flags + flagsToAdd) : xData.flags;
        }
      }
      regex = augment(new RegExp(options.source || regex.source, flags), hasNamedCapture(regex) ? xData.captureNames.slice(0) : null, xregexpSource, xregexpFlags, options.isInternalOnly);
      return regex;
    }
    function dec(hex) {
      return parseInt(hex, 16);
    }
    function getContextualTokenSeparator(match, scope, flags) {
      var matchEndPos = match.index + match[0].length;
      var precedingChar = match.input[match.index - 1];
      var followingChar = match.input[matchEndPos];
      if (
      /^[()|]$/.test(precedingChar) || /^[()|]$/.test(followingChar) ||
      match.index === 0 || matchEndPos === match.input.length ||
      /\(\?(?:[:=!]|<[=!])$/.test(match.input.substring(match.index - 4, match.index)) ||
      isQuantifierNext(match.input, matchEndPos, flags)) {
        return '';
      }
      return '(?:)';
    }
    function getNativeFlags(regex) {
      return hasFlagsProp ? regex.flags :
      /\/([a-z]*)$/i.exec(RegExp.prototype.toString.call(regex))[1];
    }
    function hasNamedCapture(regex) {
      return !!(regex[REGEX_DATA] && regex[REGEX_DATA].captureNames);
    }
    function hex(dec) {
      return parseInt(dec, 10).toString(16);
    }
    function isQuantifierNext(pattern, pos, flags) {
      var inlineCommentPattern = '\\(\\?#[^)]*\\)';
      var lineCommentPattern = '#[^#\\n]*';
      var quantifierPattern = '[?*+]|{\\d+(?:,\\d*)?}';
      var regex = flags.includes('x') ?
      new RegExp("^(?:\\s|".concat(lineCommentPattern, "|").concat(inlineCommentPattern, ")*(?:").concat(quantifierPattern, ")")) :
      new RegExp("^(?:".concat(inlineCommentPattern, ")*(?:").concat(quantifierPattern, ")"));
      return regex.test(pattern.slice(pos));
    }
    function isType(value, type) {
      return Object.prototype.toString.call(value) === "[object ".concat(type, "]");
    }
    function nullThrows(value) {
      if (value == null) {
        throw new TypeError('Cannot convert null or undefined to object');
      }
      return value;
    }
    function pad4(str) {
      while (str.length < 4) {
        str = "0".concat(str);
      }
      return str;
    }
    function prepareFlags(pattern, flags) {
      if (clipDuplicates(flags) !== flags) {
        throw new SyntaxError("Invalid duplicate regex flag ".concat(flags));
      }
      pattern = pattern.replace(/^\(\?([\w$]+)\)/, function ($0, $1) {
        if (/[dgy]/.test($1)) {
          throw new SyntaxError("Cannot use flags dgy in mode modifier ".concat($0));
        }
        flags = clipDuplicates(flags + $1);
        return '';
      });
      var _iterator = _createForOfIteratorHelper$2(flags),
        _step;
      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var flag = _step.value;
          if (!registeredFlags[flag]) {
            throw new SyntaxError("Unknown regex flag ".concat(flag));
          }
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }
      return {
        pattern,
        flags
      };
    }
    function prepareOptions(value) {
      var options = {};
      if (isType(value, 'String')) {
        XRegExp.forEach(value, /[^\s,]+/, function (match) {
          options[match] = true;
        });
        return options;
      }
      return value;
    }
    function registerFlag(flag) {
      if (!/^[\w$]$/.test(flag)) {
        throw new Error('Flag must be a single character A-Za-z0-9_$');
      }
      registeredFlags[flag] = true;
    }
    function runTokens(pattern, flags, pos, scope, context) {
      var i = tokens.length;
      var leadChar = pattern[pos];
      var result = null;
      var match;
      var t;
      while (i--) {
        t = tokens[i];
        if (t.leadChar && t.leadChar !== leadChar || t.scope !== scope && t.scope !== 'all' || t.flag && !flags.includes(t.flag)) {
          continue;
        }
        match = XRegExp.exec(pattern, t.regex, pos, 'sticky');
        if (match) {
          result = {
            matchLength: match[0].length,
            output: t.handler.call(context, match, scope, flags),
            reparse: t.reparse
          };
          break;
        }
      }
      return result;
    }
    function setAstral(on) {
      features.astral = on;
    }
    function setNamespacing(on) {
      features.namespacing = on;
    }
    function XRegExp(pattern, flags) {
      if (XRegExp.isRegExp(pattern)) {
        if (flags !== undefined) {
          throw new TypeError('Cannot supply flags when copying a RegExp');
        }
        return copyRegex(pattern);
      }
      pattern = pattern === undefined ? '' : String(pattern);
      flags = flags === undefined ? '' : String(flags);
      if (XRegExp.isInstalled('astral') && !flags.includes('A')) {
        flags += 'A';
      }
      if (!patternCache[pattern]) {
        patternCache[pattern] = {};
      }
      if (!patternCache[pattern][flags]) {
        var context = {
          hasNamedCapture: false,
          captureNames: []
        };
        var scope = defaultScope;
        var output = '';
        var pos = 0;
        var result;
        var applied = prepareFlags(pattern, flags);
        var appliedPattern = applied.pattern;
        var appliedFlags = applied.flags;
        while (pos < appliedPattern.length) {
          do {
            result = runTokens(appliedPattern, appliedFlags, pos, scope, context);
            if (result && result.reparse) {
              appliedPattern = appliedPattern.slice(0, pos) + result.output + appliedPattern.slice(pos + result.matchLength);
            }
          } while (result && result.reparse);
          if (result) {
            output += result.output;
            pos += result.matchLength || 1;
          } else {
            var _XRegExp$exec = XRegExp.exec(appliedPattern, nativeTokens[scope], pos, 'sticky'),
              _XRegExp$exec2 = _slicedToArray$1(_XRegExp$exec, 1),
              token = _XRegExp$exec2[0];
            output += token;
            pos += token.length;
            if (token === '[' && scope === defaultScope) {
              scope = classScope;
            } else if (token === ']' && scope === classScope) {
              scope = defaultScope;
            }
          }
        }
        patternCache[pattern][flags] = {
          pattern: output.replace(/(?:\(\?:\))+/g, '(?:)'),
          flags: appliedFlags.replace(nonnativeFlags, ''),
          captures: context.hasNamedCapture ? context.captureNames : null
        };
      }
      var generated = patternCache[pattern][flags];
      return augment(new RegExp(generated.pattern, generated.flags), generated.captures, pattern, flags);
    }
    XRegExp.prototype = new RegExp();
    XRegExp.version = '5.1.1';
    XRegExp._clipDuplicates = clipDuplicates;
    XRegExp._hasNativeFlag = hasNativeFlag;
    XRegExp._dec = dec;
    XRegExp._hex = hex;
    XRegExp._pad4 = pad4;
    XRegExp.addToken = function (regex, handler, options) {
      options = options || {};
      var _options = options,
        optionalFlags = _options.optionalFlags;
      if (options.flag) {
        registerFlag(options.flag);
      }
      if (optionalFlags) {
        optionalFlags = optionalFlags.split('');
        var _iterator2 = _createForOfIteratorHelper$2(optionalFlags),
          _step2;
        try {
          for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
            var flag = _step2.value;
            registerFlag(flag);
          }
        } catch (err) {
          _iterator2.e(err);
        } finally {
          _iterator2.f();
        }
      }
      tokens.push({
        regex: copyRegex(regex, {
          addG: true,
          addY: hasNativeY,
          isInternalOnly: true
        }),
        handler,
        scope: options.scope || defaultScope,
        flag: options.flag,
        reparse: options.reparse,
        leadChar: options.leadChar
      });
      XRegExp.cache.flush('patterns');
    };
    XRegExp.cache = function (pattern, flags) {
      if (!regexCache[pattern]) {
        regexCache[pattern] = {};
      }
      return regexCache[pattern][flags] || (regexCache[pattern][flags] = XRegExp(pattern, flags));
    };
    XRegExp.cache.flush = function (cacheName) {
      if (cacheName === 'patterns') {
        patternCache = {};
      } else {
        regexCache = {};
      }
    };
    XRegExp.escape = function (str) {
      return String(nullThrows(str)).
      replace(/[\\\[\]{}()*+?.^$|]/g, '\\$&').
      replace(/[\s#\-,]/g, function (match) {
        return "\\u".concat(pad4(hex(match.charCodeAt(0))));
      });
    };
    XRegExp.exec = function (str, regex, pos, sticky) {
      var cacheKey = 'g';
      var addY = false;
      var fakeY = false;
      var match;
      addY = hasNativeY && !!(sticky || regex.sticky && sticky !== false);
      if (addY) {
        cacheKey += 'y';
      } else if (sticky) {
        fakeY = true;
        cacheKey += 'FakeY';
      }
      regex[REGEX_DATA] = regex[REGEX_DATA] || {};
      var r2 = regex[REGEX_DATA][cacheKey] || (regex[REGEX_DATA][cacheKey] = copyRegex(regex, {
        addG: true,
        addY,
        source: fakeY ? "".concat(regex.source, "|()") : undefined,
        removeY: sticky === false,
        isInternalOnly: true
      }));
      pos = pos || 0;
      r2.lastIndex = pos;
      match = fixed.exec.call(r2, str);
      if (fakeY && match && match.pop() === '') {
        match = null;
      }
      if (regex.global) {
        regex.lastIndex = match ? r2.lastIndex : 0;
      }
      return match;
    };
    XRegExp.forEach = function (str, regex, callback) {
      var pos = 0;
      var i = -1;
      var match;
      while (match = XRegExp.exec(str, regex, pos)) {
        callback(match, ++i, str, regex);
        pos = match.index + (match[0].length || 1);
      }
    };
    XRegExp.globalize = function (regex) {
      return copyRegex(regex, {
        addG: true
      });
    };
    XRegExp.install = function (options) {
      options = prepareOptions(options);
      if (!features.astral && options.astral) {
        setAstral(true);
      }
      if (!features.namespacing && options.namespacing) {
        setNamespacing(true);
      }
    };
    XRegExp.isInstalled = function (feature) {
      return !!features[feature];
    };
    XRegExp.isRegExp = function (value) {
      return Object.prototype.toString.call(value) === '[object RegExp]';
    };
    XRegExp.match = function (str, regex, scope) {
      var global = regex.global && scope !== 'one' || scope === 'all';
      var cacheKey = (global ? 'g' : '') + (regex.sticky ? 'y' : '') || 'noGY';
      regex[REGEX_DATA] = regex[REGEX_DATA] || {};
      var r2 = regex[REGEX_DATA][cacheKey] || (regex[REGEX_DATA][cacheKey] = copyRegex(regex, {
        addG: !!global,
        removeG: scope === 'one',
        isInternalOnly: true
      }));
      var result = String(nullThrows(str)).match(r2);
      if (regex.global) {
        regex.lastIndex = scope === 'one' && result ?
        result.index + result[0].length : 0;
      }
      return global ? result || [] : result && result[0];
    };
    XRegExp.matchChain = function (str, chain) {
      return function recurseChain(values, level) {
        var item = chain[level].regex ? chain[level] : {
          regex: chain[level]
        };
        var matches = [];
        function addMatch(match) {
          if (item.backref) {
            var ERR_UNDEFINED_GROUP = "Backreference to undefined group: ".concat(item.backref);
            var isNamedBackref = isNaN(item.backref);
            if (isNamedBackref && XRegExp.isInstalled('namespacing')) {
              if (!(match.groups && item.backref in match.groups)) {
                throw new ReferenceError(ERR_UNDEFINED_GROUP);
              }
            } else if (!match.hasOwnProperty(item.backref)) {
              throw new ReferenceError(ERR_UNDEFINED_GROUP);
            }
            var backrefValue = isNamedBackref && XRegExp.isInstalled('namespacing') ? match.groups[item.backref] : match[item.backref];
            matches.push(backrefValue || '');
          } else {
            matches.push(match[0]);
          }
        }
        var _iterator3 = _createForOfIteratorHelper$2(values),
          _step3;
        try {
          for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
            var value = _step3.value;
            XRegExp.forEach(value, item.regex, addMatch);
          }
        } catch (err) {
          _iterator3.e(err);
        } finally {
          _iterator3.f();
        }
        return level === chain.length - 1 || !matches.length ? matches : recurseChain(matches, level + 1);
      }([str], 0);
    };
    XRegExp.replace = function (str, search, replacement, scope) {
      var isRegex = XRegExp.isRegExp(search);
      var global = search.global && scope !== 'one' || scope === 'all';
      var cacheKey = (global ? 'g' : '') + (search.sticky ? 'y' : '') || 'noGY';
      var s2 = search;
      if (isRegex) {
        search[REGEX_DATA] = search[REGEX_DATA] || {};
        s2 = search[REGEX_DATA][cacheKey] || (search[REGEX_DATA][cacheKey] = copyRegex(search, {
          addG: !!global,
          removeG: scope === 'one',
          isInternalOnly: true
        }));
      } else if (global) {
        s2 = new RegExp(XRegExp.escape(String(search)), 'g');
      }
      var result = fixed.replace.call(nullThrows(str), s2, replacement);
      if (isRegex && search.global) {
        search.lastIndex = 0;
      }
      return result;
    };
    XRegExp.replaceEach = function (str, replacements) {
      var _iterator4 = _createForOfIteratorHelper$2(replacements),
        _step4;
      try {
        for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
          var r = _step4.value;
          str = XRegExp.replace(str, r[0], r[1], r[2]);
        }
      } catch (err) {
        _iterator4.e(err);
      } finally {
        _iterator4.f();
      }
      return str;
    };
    XRegExp.split = function (str, separator, limit) {
      return fixed.split.call(nullThrows(str), separator, limit);
    };
    XRegExp.test = function (str, regex, pos, sticky) {
      return !!XRegExp.exec(str, regex, pos, sticky);
    };
    XRegExp.uninstall = function (options) {
      options = prepareOptions(options);
      if (features.astral && options.astral) {
        setAstral(false);
      }
      if (features.namespacing && options.namespacing) {
        setNamespacing(false);
      }
    };
    XRegExp.union = function (patterns, flags, options) {
      options = options || {};
      var conjunction = options.conjunction || 'or';
      var numCaptures = 0;
      var numPriorCaptures;
      var captureNames;
      function rewrite(match, paren, backref) {
        var name = captureNames[numCaptures - numPriorCaptures];
        if (paren) {
          ++numCaptures;
          if (name) {
            return "(?<".concat(name, ">");
          }
        } else if (backref) {
          return "\\".concat(+backref + numPriorCaptures);
        }
        return match;
      }
      if (!(isType(patterns, 'Array') && patterns.length)) {
        throw new TypeError('Must provide a nonempty array of patterns to merge');
      }
      var parts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*\]/g;
      var output = [];
      var _iterator5 = _createForOfIteratorHelper$2(patterns),
        _step5;
      try {
        for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
          var pattern = _step5.value;
          if (XRegExp.isRegExp(pattern)) {
            numPriorCaptures = numCaptures;
            captureNames = pattern[REGEX_DATA] && pattern[REGEX_DATA].captureNames || [];
            output.push(XRegExp(pattern.source).source.replace(parts, rewrite));
          } else {
            output.push(XRegExp.escape(pattern));
          }
        }
      } catch (err) {
        _iterator5.e(err);
      } finally {
        _iterator5.f();
      }
      var separator = conjunction === 'none' ? '' : '|';
      return XRegExp(output.join(separator), flags);
    };
    fixed.exec = function (str) {
      var origLastIndex = this.lastIndex;
      var match = RegExp.prototype.exec.apply(this, arguments);
      if (match) {
        if (!correctExecNpcg && match.length > 1 && match.includes('')) {
          var r2 = copyRegex(this, {
            removeG: true,
            isInternalOnly: true
          });
          String(str).slice(match.index).replace(r2, function () {
            var len = arguments.length;
            for (var i = 1; i < len - 2; ++i) {
              if ((i < 0 || arguments.length <= i ? undefined : arguments[i]) === undefined) {
                match[i] = undefined;
              }
            }
          });
        }
        if (this[REGEX_DATA] && this[REGEX_DATA].captureNames) {
          var groupsObject = match;
          if (XRegExp.isInstalled('namespacing')) {
            match.groups = Object.create(null);
            groupsObject = match.groups;
          }
          for (var i = 1; i < match.length; ++i) {
            var name = this[REGEX_DATA].captureNames[i - 1];
            if (name) {
              groupsObject[name] = match[i];
            }
          }
        } else if (!match.groups && XRegExp.isInstalled('namespacing')) {
          match.groups = undefined;
        }
        if (this.global && !match[0].length && this.lastIndex > match.index) {
          this.lastIndex = match.index;
        }
      }
      if (!this.global) {
        this.lastIndex = origLastIndex;
      }
      return match;
    };
    fixed.test = function (str) {
      return !!fixed.exec.call(this, str);
    };
    fixed.match = function (regex) {
      if (!XRegExp.isRegExp(regex)) {
        regex = new RegExp(regex);
      } else if (regex.global) {
        var result = String.prototype.match.apply(this, arguments);
        regex.lastIndex = 0;
        return result;
      }
      return fixed.exec.call(regex, nullThrows(this));
    };
    fixed.replace = function (search, replacement) {
      var isRegex = XRegExp.isRegExp(search);
      var origLastIndex;
      var captureNames;
      var result;
      if (isRegex) {
        if (search[REGEX_DATA]) {
          captureNames = search[REGEX_DATA].captureNames;
        }
        origLastIndex = search.lastIndex;
      } else {
        search += '';
      }
      if (isType(replacement, 'Function')) {
        result = String(this).replace(search, function () {
          for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }
          if (captureNames) {
            var groupsObject;
            if (XRegExp.isInstalled('namespacing')) {
              groupsObject = Object.create(null);
              args.push(groupsObject);
            } else {
              args[0] = new String(args[0]);
              groupsObject = args[0];
            }
            for (var i = 0; i < captureNames.length; ++i) {
              if (captureNames[i]) {
                groupsObject[captureNames[i]] = args[i + 1];
              }
            }
          }
          return replacement(...args);
        });
      } else {
        result = String(nullThrows(this)).replace(search, function () {
          for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
            args[_key2] = arguments[_key2];
          }
          return String(replacement).replace(replacementToken, replacer);
          function replacer($0, bracketed, angled, dollarToken) {
            bracketed = bracketed || angled;
            var numNonCaptureArgs = isType(args[args.length - 1], 'Object') ? 4 : 3;
            var numCaptures = args.length - numNonCaptureArgs;
            if (bracketed) {
              if (/^\d+$/.test(bracketed)) {
                var _n = +bracketed;
                if (_n <= numCaptures) {
                  return args[_n] || '';
                }
              }
              var n = captureNames ? captureNames.indexOf(bracketed) : -1;
              if (n < 0) {
                throw new SyntaxError("Backreference to undefined group ".concat($0));
              }
              return args[n + 1] || '';
            }
            if (dollarToken === '' || dollarToken === ' ') {
              throw new SyntaxError("Invalid token ".concat($0));
            }
            if (dollarToken === '&' || +dollarToken === 0) {
              return args[0];
            }
            if (dollarToken === '$') {
              return '$';
            }
            if (dollarToken === '`') {
              return args[args.length - 1].slice(0, args[args.length - 2]);
            }
            if (dollarToken === "'") {
              return args[args.length - 1].slice(args[args.length - 2] + args[0].length);
            }
            dollarToken = +dollarToken;
            if (!isNaN(dollarToken)) {
              if (dollarToken > numCaptures) {
                throw new SyntaxError("Backreference to undefined group ".concat($0));
              }
              return args[dollarToken] || '';
            }
            throw new SyntaxError("Invalid token ".concat($0));
          }
        });
      }
      if (isRegex) {
        if (search.global) {
          search.lastIndex = 0;
        } else {
          search.lastIndex = origLastIndex;
        }
      }
      return result;
    };
    fixed.split = function (separator, limit) {
      if (!XRegExp.isRegExp(separator)) {
        return String.prototype.split.apply(this, arguments);
      }
      var str = String(this);
      var output = [];
      var origLastIndex = separator.lastIndex;
      var lastLastIndex = 0;
      var lastLength;
      limit = (limit === undefined ? -1 : limit) >>> 0;
      XRegExp.forEach(str, separator, function (match) {
        if (match.index + match[0].length > lastLastIndex) {
          output.push(str.slice(lastLastIndex, match.index));
          if (match.length > 1 && match.index < str.length) {
            Array.prototype.push.apply(output, match.slice(1));
          }
          lastLength = match[0].length;
          lastLastIndex = match.index + lastLength;
        }
      });
      if (lastLastIndex === str.length) {
        if (!separator.test('') || lastLength) {
          output.push('');
        }
      } else {
        output.push(str.slice(lastLastIndex));
      }
      separator.lastIndex = origLastIndex;
      return output.length > limit ? output.slice(0, limit) : output;
    };
    XRegExp.addToken(/\\([ABCE-RTUVXYZaeg-mopqyz]|c(?![A-Za-z])|u(?![\dA-Fa-f]{4}|{[\dA-Fa-f]+})|x(?![\dA-Fa-f]{2}))/, function (match, scope) {
      if (match[1] === 'B' && scope === defaultScope) {
        return match[0];
      }
      throw new SyntaxError("Invalid escape ".concat(match[0]));
    }, {
      scope: 'all',
      leadChar: '\\'
    });
    XRegExp.addToken(/\\u{([\dA-Fa-f]+)}/, function (match, scope, flags) {
      var code = dec(match[1]);
      if (code > 0x10FFFF) {
        throw new SyntaxError("Invalid Unicode code point ".concat(match[0]));
      }
      if (code <= 0xFFFF) {
        return "\\u".concat(pad4(hex(code)));
      }
      if (hasNativeU && flags.includes('u')) {
        return match[0];
      }
      throw new SyntaxError("Cannot use Unicode code point above \\u{FFFF} without flag u");
    }, {
      scope: 'all',
      leadChar: '\\'
    });
    XRegExp.addToken(/\(\?#[^)]*\)/, getContextualTokenSeparator, {
      leadChar: '('
    });
    XRegExp.addToken(/\s+|#[^\n]*\n?/, getContextualTokenSeparator, {
      flag: 'x'
    });
    if (!hasNativeS) {
      XRegExp.addToken(/\./, function () {
        return '[\\s\\S]';
      }, {
        flag: 's',
        leadChar: '.'
      });
    }
    XRegExp.addToken(/\\k<([^>]+)>/, function (match) {
      var index = isNaN(match[1]) ? this.captureNames.indexOf(match[1]) + 1 : +match[1];
      var endIndex = match.index + match[0].length;
      if (!index || index > this.captureNames.length) {
        throw new SyntaxError("Backreference to undefined group ".concat(match[0]));
      }
      return "\\".concat(index).concat(endIndex === match.input.length || isNaN(match.input[endIndex]) ? '' : '(?:)');
    }, {
      leadChar: '\\'
    });
    XRegExp.addToken(/\\(\d+)/, function (match, scope) {
      if (!(scope === defaultScope && /^[1-9]/.test(match[1]) && +match[1] <= this.captureNames.length) && match[1] !== '0') {
        throw new SyntaxError("Cannot use octal escape or backreference to undefined group ".concat(match[0]));
      }
      return match[0];
    }, {
      scope: 'all',
      leadChar: '\\'
    });
    XRegExp.addToken(/\(\?P?<((?:[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[\$0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u0870-\u0887\u0889-\u088E\u0898-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3C-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C5D\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1-\u0CF3\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1715\u171F-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B4C\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA827\uA82C\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDE80-\uDEA9\uDEAB\uDEAC\uDEB0\uDEB1\uDEFD-\uDF1C\uDF27\uDF30-\uDF50\uDF70-\uDF85\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC75\uDC7F-\uDCBA\uDCC2\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD47\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDCE-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E-\uDE41\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E-\uDC61\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39\uDF40-\uDF46]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6\uDF00-\uDF10\uDF12-\uDF3A\uDF3E-\uDF42\uDF50-\uDF59\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC40-\uDC55]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFE4\uDFF0\uDFF1]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC30-\uDC6D\uDC8F\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAE\uDEC0-\uDEF9]|\uD839[\uDCD0-\uDCF9\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF]|\uDB40[\uDD00-\uDDEF])*)>/, function (match) {
      if (!XRegExp.isInstalled('namespacing') && (match[1] === 'length' || match[1] === '__proto__')) {
        throw new SyntaxError("Cannot use reserved word as capture name ".concat(match[0]));
      }
      if (this.captureNames.includes(match[1])) {
        throw new SyntaxError("Cannot use same name for multiple groups ".concat(match[0]));
      }
      this.captureNames.push(match[1]);
      this.hasNamedCapture = true;
      return '(';
    }, {
      leadChar: '('
    });
    XRegExp.addToken(/\((?!\?)/, function (match, scope, flags) {
      if (flags.includes('n')) {
        return '(?:';
      }
      this.captureNames.push(null);
      return '(';
    }, {
      optionalFlags: 'n',
      leadChar: '('
    });
    var build = (function (XRegExp) {
      var REGEX_DATA = 'xregexp';
      var subParts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*\]/g;
      var parts = XRegExp.union([/\({{([\w$]+)}}\)|{{([\w$]+)}}/, subParts], 'g', {
        conjunction: 'or'
      });
      function deanchor(pattern) {
        var leadingAnchor = /^(?:\(\?:\))*\^/;
        var trailingAnchor = /\$(?:\(\?:\))*$/;
        if (leadingAnchor.test(pattern) && trailingAnchor.test(pattern) &&
        trailingAnchor.test(pattern.replace(/\\[\s\S]/g, ''))) {
          return pattern.replace(leadingAnchor, '').replace(trailingAnchor, '');
        }
        return pattern;
      }
      function asXRegExp(value, addFlagX) {
        var flags = addFlagX ? 'x' : '';
        return XRegExp.isRegExp(value) ? value[REGEX_DATA] && value[REGEX_DATA].captureNames ?
        value :
        XRegExp(value.source, flags) :
        XRegExp(value, flags);
      }
      function interpolate(substitution) {
        return substitution instanceof RegExp ? substitution : XRegExp.escape(substitution);
      }
      function reduceToSubpatternsObject(subpatterns, interpolated, subpatternIndex) {
        subpatterns["subpattern".concat(subpatternIndex)] = interpolated;
        return subpatterns;
      }
      function embedSubpatternAfter(raw, subpatternIndex, rawLiterals) {
        var hasSubpattern = subpatternIndex < rawLiterals.length - 1;
        return raw + (hasSubpattern ? "{{subpattern".concat(subpatternIndex, "}}") : '');
      }
      XRegExp.tag = function (flags) {
        return function (literals) {
          for (var _len = arguments.length, substitutions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            substitutions[_key - 1] = arguments[_key];
          }
          var subpatterns = substitutions.map(interpolate).reduce(reduceToSubpatternsObject, {});
          var pattern = literals.raw.map(embedSubpatternAfter).join('');
          return XRegExp.build(pattern, subpatterns, flags);
        };
      };
      XRegExp.build = function (pattern, subs, flags) {
        flags = flags || '';
        var addFlagX = flags.includes('x');
        var inlineFlags = /^\(\?([\w$]+)\)/.exec(pattern);
        if (inlineFlags) {
          flags = XRegExp._clipDuplicates(flags + inlineFlags[1]);
        }
        var data = {};
        for (var p in subs) {
          if (subs.hasOwnProperty(p)) {
            var sub = asXRegExp(subs[p], addFlagX);
            data[p] = {
              pattern: deanchor(sub.source),
              names: sub[REGEX_DATA].captureNames || []
            };
          }
        }
        var patternAsRegex = asXRegExp(pattern, addFlagX);
        var numCaps = 0;
        var numPriorCaps;
        var numOuterCaps = 0;
        var outerCapsMap = [0];
        var outerCapNames = patternAsRegex[REGEX_DATA].captureNames || [];
        var output = patternAsRegex.source.replace(parts, function ($0, $1, $2, $3, $4) {
          var subName = $1 || $2;
          var capName;
          var intro;
          var localCapIndex;
          if (subName) {
            if (!data.hasOwnProperty(subName)) {
              throw new ReferenceError("Undefined property ".concat($0));
            }
            if ($1) {
              capName = outerCapNames[numOuterCaps];
              outerCapsMap[++numOuterCaps] = ++numCaps;
              intro = "(?<".concat(capName || subName, ">");
            } else {
              intro = '(?:';
            }
            numPriorCaps = numCaps;
            var rewrittenSubpattern = data[subName].pattern.replace(subParts, function (match, paren, backref) {
              if (paren) {
                capName = data[subName].names[numCaps - numPriorCaps];
                ++numCaps;
                if (capName) {
                  return "(?<".concat(capName, ">");
                }
              } else if (backref) {
                localCapIndex = +backref - 1;
                return data[subName].names[localCapIndex] ?
                "\\k<".concat(data[subName].names[localCapIndex], ">") : "\\".concat(+backref + numPriorCaps);
              }
              return match;
            });
            return "".concat(intro).concat(rewrittenSubpattern, ")");
          }
          if ($3) {
            capName = outerCapNames[numOuterCaps];
            outerCapsMap[++numOuterCaps] = ++numCaps;
            if (capName) {
              return "(?<".concat(capName, ">");
            }
          } else if ($4) {
            localCapIndex = +$4 - 1;
            return outerCapNames[localCapIndex] ?
            "\\k<".concat(outerCapNames[localCapIndex], ">") : "\\".concat(outerCapsMap[+$4]);
          }
          return $0;
        });
        return XRegExp(output, flags);
      };
    });
    var matchRecursive = (function (XRegExp) {
      function row(name, value, start, end) {
        return {
          name,
          value,
          start,
          end
        };
      }
      XRegExp.matchRecursive = function (str, left, right, flags, options) {
        flags = flags || '';
        options = options || {};
        var global = flags.includes('g');
        var sticky = flags.includes('y');
        var basicFlags = flags.replace(/y/g, '');
        left = XRegExp(left, basicFlags);
        right = XRegExp(right, basicFlags);
        var esc;
        var _options = options,
          escapeChar = _options.escapeChar;
        if (escapeChar) {
          if (escapeChar.length > 1) {
            throw new Error('Cannot use more than one escape character');
          }
          escapeChar = XRegExp.escape(escapeChar);
          esc = new RegExp("(?:".concat(escapeChar, "[\\S\\s]|(?:(?!").concat(
          XRegExp.union([left, right], '', {
            conjunction: 'or'
          }).source, ")[^").concat(escapeChar, "])+)+"),
          flags.replace(XRegExp._hasNativeFlag('s') ? /[^imsu]/g : /[^imu]/g, ''));
        }
        var openTokens = 0;
        var delimStart = 0;
        var delimEnd = 0;
        var lastOuterEnd = 0;
        var outerStart;
        var innerStart;
        var leftMatch;
        var rightMatch;
        var vN = options.valueNames;
        var output = [];
        while (true) {
          if (escapeChar) {
            delimEnd += (XRegExp.exec(str, esc, delimEnd, 'sticky') || [''])[0].length;
          }
          leftMatch = XRegExp.exec(str, left, delimEnd);
          rightMatch = XRegExp.exec(str, right, delimEnd);
          if (leftMatch && rightMatch) {
            if (leftMatch.index <= rightMatch.index) {
              rightMatch = null;
            } else {
              leftMatch = null;
            }
          }
          if (leftMatch || rightMatch) {
            delimStart = (leftMatch || rightMatch).index;
            delimEnd = delimStart + (leftMatch || rightMatch)[0].length;
          } else if (!openTokens) {
            break;
          }
          if (sticky && !openTokens && delimStart > lastOuterEnd) {
            break;
          }
          if (leftMatch) {
            if (!openTokens) {
              outerStart = delimStart;
              innerStart = delimEnd;
            }
            openTokens += 1;
          } else if (rightMatch && openTokens) {
            openTokens -= 1;
            if (!openTokens) {
              if (vN) {
                if (vN[0] && outerStart > lastOuterEnd) {
                  output.push(row(vN[0], str.slice(lastOuterEnd, outerStart), lastOuterEnd, outerStart));
                }
                if (vN[1]) {
                  output.push(row(vN[1], str.slice(outerStart, innerStart), outerStart, innerStart));
                }
                if (vN[2]) {
                  output.push(row(vN[2], str.slice(innerStart, delimStart), innerStart, delimStart));
                }
                if (vN[3]) {
                  output.push(row(vN[3], str.slice(delimStart, delimEnd), delimStart, delimEnd));
                }
              } else {
                output.push(str.slice(innerStart, delimStart));
              }
              lastOuterEnd = delimEnd;
              if (!global) {
                break;
              }
            }
          } else {
            var unbalanced = options.unbalanced || 'error';
            if (unbalanced === 'skip' || unbalanced === 'skip-lazy') {
              if (rightMatch) {
                rightMatch = null;
              } else {
                if (unbalanced === 'skip') {
                  var outerStartDelimLength = XRegExp.exec(str, left, outerStart, 'sticky')[0].length;
                  delimEnd = outerStart + (outerStartDelimLength || 1);
                } else {
                  delimEnd = outerStart + 1;
                }
                openTokens = 0;
              }
            } else if (unbalanced === 'error') {
              var delimSide = rightMatch ? 'right' : 'left';
              var errorPos = rightMatch ? delimStart : outerStart;
              throw new Error("Unbalanced ".concat(delimSide, " delimiter found in string at position ").concat(errorPos));
            } else {
              throw new Error("Unsupported value for unbalanced: ".concat(unbalanced));
            }
          }
          if (delimStart === delimEnd) {
            delimEnd += 1;
          }
        }
        if (global && output.length > 0 && !sticky && vN && vN[0] && str.length > lastOuterEnd) {
          output.push(row(vN[0], str.slice(lastOuterEnd), lastOuterEnd, str.length));
        }
        return output;
      };
    });
    function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
    function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
    function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
    var unicodeBase = (function (XRegExp) {
      var unicode = {};
      var unicodeTypes = {};
      var dec = XRegExp._dec;
      var hex = XRegExp._hex;
      var pad4 = XRegExp._pad4;
      function normalize(name) {
        return name.replace(/[- _]+/g, '').toLowerCase();
      }
      function charCode(chr) {
        var esc = /^\\[xu](.+)/.exec(chr);
        return esc ? dec(esc[1]) : chr.charCodeAt(chr[0] === '\\' ? 1 : 0);
      }
      function invertBmp(range) {
        var output = '';
        var lastEnd = -1;
        XRegExp.forEach(range, /(\\x..|\\u....|\\?[\s\S])(?:-(\\x..|\\u....|\\?[\s\S]))?/, function (m) {
          var start = charCode(m[1]);
          if (start > lastEnd + 1) {
            output += "\\u".concat(pad4(hex(lastEnd + 1)));
            if (start > lastEnd + 2) {
              output += "-\\u".concat(pad4(hex(start - 1)));
            }
          }
          lastEnd = charCode(m[2] || m[1]);
        });
        if (lastEnd < 0xFFFF) {
          output += "\\u".concat(pad4(hex(lastEnd + 1)));
          if (lastEnd < 0xFFFE) {
            output += "-\\uFFFF";
          }
        }
        return output;
      }
      function cacheInvertedBmp(slug) {
        var prop = 'b!';
        return unicode[slug][prop] || (unicode[slug][prop] = invertBmp(unicode[slug].bmp));
      }
      function buildAstral(slug, isNegated) {
        var item = unicode[slug];
        var combined = '';
        if (item.bmp && !item.isBmpLast) {
          combined = "[".concat(item.bmp, "]").concat(item.astral ? '|' : '');
        }
        if (item.astral) {
          combined += item.astral;
        }
        if (item.isBmpLast && item.bmp) {
          combined += "".concat(item.astral ? '|' : '', "[").concat(item.bmp, "]");
        }
        return isNegated ? "(?:(?!".concat(combined, ")(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[\0-\uFFFF]))") : "(?:".concat(combined, ")");
      }
      function cacheAstral(slug, isNegated) {
        var prop = isNegated ? 'a!' : 'a=';
        return unicode[slug][prop] || (unicode[slug][prop] = buildAstral(slug, isNegated));
      }
      XRegExp.addToken(
      /\\([pP])(?:{(\^?)(?:(\w+)=)?([^}]*)}|([A-Za-z]))/, function (match, scope, flags) {
        var ERR_DOUBLE_NEG = 'Invalid double negation ';
        var ERR_UNKNOWN_NAME = 'Unknown Unicode token ';
        var ERR_UNKNOWN_REF = 'Unicode token missing data ';
        var ERR_ASTRAL_ONLY = 'Astral mode required for Unicode token ';
        var ERR_ASTRAL_IN_CLASS = 'Astral mode does not support Unicode tokens within character classes';
        var _match = _slicedToArray$1(match, 6),
          fullToken = _match[0],
          pPrefix = _match[1],
          caretNegation = _match[2],
          typePrefix = _match[3],
          tokenName = _match[4],
          tokenSingleCharName = _match[5];
        var isNegated = pPrefix === 'P' || !!caretNegation;
        var isAstralMode = flags.includes('A');
        var slug = normalize(tokenSingleCharName || tokenName);
        var item = unicode[slug];
        if (pPrefix === 'P' && caretNegation) {
          throw new SyntaxError(ERR_DOUBLE_NEG + fullToken);
        }
        if (!unicode.hasOwnProperty(slug)) {
          throw new SyntaxError(ERR_UNKNOWN_NAME + fullToken);
        }
        if (typePrefix) {
          if (!(unicodeTypes[typePrefix] && unicodeTypes[typePrefix][slug])) {
            throw new SyntaxError(ERR_UNKNOWN_NAME + fullToken);
          }
        }
        if (item.inverseOf) {
          slug = normalize(item.inverseOf);
          if (!unicode.hasOwnProperty(slug)) {
            throw new ReferenceError("".concat(ERR_UNKNOWN_REF + fullToken, " -> ").concat(item.inverseOf));
          }
          item = unicode[slug];
          isNegated = !isNegated;
        }
        if (!(item.bmp || isAstralMode)) {
          throw new SyntaxError(ERR_ASTRAL_ONLY + fullToken);
        }
        if (isAstralMode) {
          if (scope === 'class') {
            throw new SyntaxError(ERR_ASTRAL_IN_CLASS);
          }
          return cacheAstral(slug, isNegated);
        }
        return scope === 'class' ? isNegated ? cacheInvertedBmp(slug) : item.bmp : "".concat((isNegated ? '[^' : '[') + item.bmp, "]");
      }, {
        scope: 'all',
        optionalFlags: 'A',
        leadChar: '\\'
      });
      XRegExp.addUnicodeData = function (data, typePrefix) {
        var ERR_NO_NAME = 'Unicode token requires name';
        var ERR_NO_DATA = 'Unicode token has no character data ';
        if (typePrefix) {
          unicodeTypes[typePrefix] = {};
        }
        var _iterator = _createForOfIteratorHelper$1(data),
          _step;
        try {
          for (_iterator.s(); !(_step = _iterator.n()).done;) {
            var item = _step.value;
            if (!item.name) {
              throw new Error(ERR_NO_NAME);
            }
            if (!(item.inverseOf || item.bmp || item.astral)) {
              throw new Error(ERR_NO_DATA + item.name);
            }
            var normalizedName = normalize(item.name);
            unicode[normalizedName] = item;
            if (typePrefix) {
              unicodeTypes[typePrefix][normalizedName] = true;
            }
            if (item.alias) {
              var normalizedAlias = normalize(item.alias);
              unicode[normalizedAlias] = item;
              if (typePrefix) {
                unicodeTypes[typePrefix][normalizedAlias] = true;
              }
            }
          }
        } catch (err) {
          _iterator.e(err);
        } finally {
          _iterator.f();
        }
        XRegExp.cache.flush('patterns');
      };
      XRegExp._getUnicodeProperty = function (name) {
        var slug = normalize(name);
        return unicode[slug];
      };
    });
    var categories = [{
      'name': 'C',
      'alias': 'Other',
      'isBmpLast': true,
      'bmp': "\0-\x1F\x7F-\x9F\xAD\u0378\u0379\u0380-\u0383\u038B\u038D\u03A2\u0530\u0557\u0558\u058B\u058C\u0590\u05C8-\u05CF\u05EB-\u05EE\u05F5-\u0605\u061C\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB\u07FC\u082E\u082F\u083F\u085C\u085D\u085F\u086B-\u086F\u088F-\u0897\u08E2\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A77-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0BFF\u0C0D\u0C11\u0C29\u0C3A\u0C3B\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C64\u0C65\u0C70-\u0C76\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDC\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D50-\u0D53\u0D64\u0D65\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F6\u13F7\u13FE\u13FF\u169D-\u169F\u16F9-\u16FF\u1716-\u171E\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180E\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE\u1AAF\u1ACF-\u1AFF\u1B4D-\u1B4F\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C89-\u1C8F\u1CBB\u1CBC\u1CC8-\u1CCF\u1CFB-\u1CFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20C1-\u20CF\u20F1-\u20FF\u218C-\u218F\u2427-\u243F\u244B-\u245F\u2B74\u2B75\u2B96\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E5E-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u3130\u318F\u31E4-\u31EF\u321F\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA6F8-\uA6FF\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA82D-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C6-\uA8CD\uA8DA-\uA8DF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB6C-\uAB6F\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC3-\uFBD2\uFD90\uFD91\uFDC8-\uFDCE\uFDD0-\uFDEF\uFE1A-\uFE1F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF",
      'astral': "\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDCFF\uDD03-\uDD06\uDD34-\uDD36\uDD8F\uDD9D-\uDD9F\uDDA1-\uDDCF\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEFC-\uDEFF\uDF24-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDFC4-\uDFC7\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6E\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56\uDC9F-\uDCA6\uDCB0-\uDCDF\uDCF3\uDCF6-\uDCFA\uDD1C-\uDD1E\uDD3A-\uDD3E\uDD40-\uDD7F\uDDB8-\uDDBB\uDDD0\uDDD1\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE49-\uDE4F\uDE59-\uDE5F\uDEA0-\uDEBF\uDEE7-\uDEEA\uDEF7-\uDEFF\uDF36-\uDF38\uDF56\uDF57\uDF73-\uDF77\uDF92-\uDF98\uDF9D-\uDFA8\uDFB0-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCF9\uDD28-\uDD2F\uDD3A-\uDE5F\uDE7F\uDEAA\uDEAE\uDEAF\uDEB2-\uDEFF\uDF28-\uDF2F\uDF5A-\uDF6F\uDF8A-\uDFAF\uDFCC-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC4E-\uDC51\uDC76-\uDC7E\uDCBD\uDCC3-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD48-\uDD4F\uDD77-\uDD7F\uDDE0\uDDF5-\uDDFF\uDE12\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEAA-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC5C\uDC62-\uDC7F\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDDE-\uDDFF\uDE45-\uDE4F\uDE5A-\uDE5F\uDE6D-\uDE7F\uDEBA-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF47-\uDFFF]|\uD806[\uDC3C-\uDC9F\uDCF3-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD47-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE5-\uDDFF\uDE48-\uDE4F\uDEA3-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC46-\uDC4F\uDC6D-\uDC6F\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF9-\uDFAF\uDFB1-\uDFBF\uDFF2-\uDFFE]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F\uDC75-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD832\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF3-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDE6D\uDEBF\uDECA-\uDECF\uDEEE\uDEEF\uDEF6-\uDEFF\uDF46-\uDF4F\uDF5A\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE9B-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A\uDC9B\uDCA0-\uDFFF]|\uD833[\uDC00-\uDEFF\uDF2E\uDF2F\uDF47-\uDF4F\uDFC4-\uDFFF]|\uD834[\uDCF6-\uDCFF\uDD27\uDD28\uDD73-\uDD7A\uDDEB-\uDDFF\uDE46-\uDEDF\uDEF4-\uDEFF\uDF57-\uDF5F\uDF79-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]|\uD836[\uDE8C-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD50-\uDE8F\uDEAF-\uDEBF\uDEFA-\uDEFE\uDF00-\uDFFF]|\uD839[\uDC00-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5\uDCC6\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDD5D\uDD60-\uDFFF]|\uD83B[\uDC00-\uDC70\uDCB5-\uDD00\uDD3E-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDEEF\uDEF2-\uDFFF]|\uD83C[\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCD0\uDCF6-\uDCFF\uDDAE-\uDDE5\uDE03-\uDE0F\uDE3C-\uDE3F\uDE49-\uDE4F\uDE52-\uDE5F\uDE66-\uDEFF]|\uD83D[\uDED8-\uDEDC\uDEED-\uDEEF\uDEFD-\uDEFF\uDF74-\uDF7F\uDFD9-\uDFDF\uDFEC-\uDFEF\uDFF1-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCB2-\uDCFF\uDE54-\uDE5F\uDE6E\uDE6F\uDE75-\uDE77\uDE7D-\uDE7F\uDE87-\uDE8F\uDEAD-\uDEAF\uDEBB-\uDEBF\uDEC6-\uDECF\uDEDA-\uDEDF\uDEE8-\uDEEF\uDEF7-\uDEFF\uDF93\uDFCB-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF39-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]"
    }, {
      'name': 'Cc',
      'alias': 'Control',
      'bmp': '\0-\x1F\x7F-\x9F'
    }, {
      'name': 'Cf',
      'alias': 'Format',
      'bmp': "\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB",
      'astral': "\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC38]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]"
    }, {
      'name': 'Cn',
      'alias': 'Unassigned',
      'bmp': "\u0378\u0379\u0380-\u0383\u038B\u038D\u03A2\u0530\u0557\u0558\u058B\u058C\u0590\u05C8-\u05CF\u05EB-\u05EE\u05F5-\u05FF\u070E\u074B\u074C\u07B2-\u07BF\u07FB\u07FC\u082E\u082F\u083F\u085C\u085D\u085F\u086B-\u086F\u088F\u0892-\u0897\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A77-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0BFF\u0C0D\u0C11\u0C29\u0C3A\u0C3B\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C64\u0C65\u0C70-\u0C76\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDC\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D50-\u0D53\u0D64\u0D65\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F6\u13F7\u13FE\u13FF\u169D-\u169F\u16F9-\u16FF\u1716-\u171E\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE\u1AAF\u1ACF-\u1AFF\u1B4D-\u1B4F\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C89-\u1C8F\u1CBB\u1CBC\u1CC8-\u1CCF\u1CFB-\u1CFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u2065\u2072\u2073\u208F\u209D-\u209F\u20C1-\u20CF\u20F1-\u20FF\u218C-\u218F\u2427-\u243F\u244B-\u245F\u2B74\u2B75\u2B96\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E5E-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u3130\u318F\u31E4-\u31EF\u321F\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA6F8-\uA6FF\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA82D-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C6-\uA8CD\uA8DA-\uA8DF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB6C-\uAB6F\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC3-\uFBD2\uFD90\uFD91\uFDC8-\uFDCE\uFDD0-\uFDEF\uFE1A-\uFE1F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD\uFEFE\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFF8\uFFFE\uFFFF",
      'astral': "\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDCFF\uDD03-\uDD06\uDD34-\uDD36\uDD8F\uDD9D-\uDD9F\uDDA1-\uDDCF\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEFC-\uDEFF\uDF24-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDFC4-\uDFC7\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6E\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56\uDC9F-\uDCA6\uDCB0-\uDCDF\uDCF3\uDCF6-\uDCFA\uDD1C-\uDD1E\uDD3A-\uDD3E\uDD40-\uDD7F\uDDB8-\uDDBB\uDDD0\uDDD1\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE49-\uDE4F\uDE59-\uDE5F\uDEA0-\uDEBF\uDEE7-\uDEEA\uDEF7-\uDEFF\uDF36-\uDF38\uDF56\uDF57\uDF73-\uDF77\uDF92-\uDF98\uDF9D-\uDFA8\uDFB0-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCF9\uDD28-\uDD2F\uDD3A-\uDE5F\uDE7F\uDEAA\uDEAE\uDEAF\uDEB2-\uDEFF\uDF28-\uDF2F\uDF5A-\uDF6F\uDF8A-\uDFAF\uDFCC-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC4E-\uDC51\uDC76-\uDC7E\uDCC3-\uDCCC\uDCCE\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD48-\uDD4F\uDD77-\uDD7F\uDDE0\uDDF5-\uDDFF\uDE12\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEAA-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC5C\uDC62-\uDC7F\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDDE-\uDDFF\uDE45-\uDE4F\uDE5A-\uDE5F\uDE6D-\uDE7F\uDEBA-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF47-\uDFFF]|\uD806[\uDC3C-\uDC9F\uDCF3-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD47-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE5-\uDDFF\uDE48-\uDE4F\uDEA3-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC46-\uDC4F\uDC6D-\uDC6F\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF9-\uDFAF\uDFB1-\uDFBF\uDFF2-\uDFFE]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F\uDC75-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD832\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDB7F][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF3-\uDFFF]|\uD80D[\uDC2F\uDC39-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDE6D\uDEBF\uDECA-\uDECF\uDEEE\uDEEF\uDEF6-\uDEFF\uDF46-\uDF4F\uDF5A\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE9B-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A\uDC9B\uDCA4-\uDFFF]|\uD833[\uDC00-\uDEFF\uDF2E\uDF2F\uDF47-\uDF4F\uDFC4-\uDFFF]|\uD834[\uDCF6-\uDCFF\uDD27\uDD28\uDDEB-\uDDFF\uDE46-\uDEDF\uDEF4-\uDEFF\uDF57-\uDF5F\uDF79-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]|\uD836[\uDE8C-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD50-\uDE8F\uDEAF-\uDEBF\uDEFA-\uDEFE\uDF00-\uDFFF]|\uD839[\uDC00-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5\uDCC6\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDD5D\uDD60-\uDFFF]|\uD83B[\uDC00-\uDC70\uDCB5-\uDD00\uDD3E-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDEEF\uDEF2-\uDFFF]|\uD83C[\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCD0\uDCF6-\uDCFF\uDDAE-\uDDE5\uDE03-\uDE0F\uDE3C-\uDE3F\uDE49-\uDE4F\uDE52-\uDE5F\uDE66-\uDEFF]|\uD83D[\uDED8-\uDEDC\uDEED-\uDEEF\uDEFD-\uDEFF\uDF74-\uDF7F\uDFD9-\uDFDF\uDFEC-\uDFEF\uDFF1-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCB2-\uDCFF\uDE54-\uDE5F\uDE6E\uDE6F\uDE75-\uDE77\uDE7D-\uDE7F\uDE87-\uDE8F\uDEAD-\uDEAF\uDEBB-\uDEBF\uDEC6-\uDECF\uDEDA-\uDEDF\uDEE8-\uDEEF\uDEF7-\uDEFF\uDF93\uDFCB-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF39-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00\uDC02-\uDC1F\uDC80-\uDCFF\uDDF0-\uDFFF]|[\uDBBF\uDBFF][\uDFFE\uDFFF]"
    }, {
      'name': 'Co',
      'alias': 'Private_Use',
      'bmp': "\uE000-\uF8FF",
      'astral': "[\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uDBBF\uDBFF][\uDC00-\uDFFD]"
    }, {
      'name': 'Cs',
      'alias': 'Surrogate',
      'bmp': "\uD800-\uDFFF"
    }, {
      'name': 'L',
      'alias': 'Letter',
      'bmp': "A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",
      'astral': "\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]"
    }, {
      'name': 'LC',
      'alias': 'Cased_Letter',
      'bmp': "A-Za-z\xB5\xC0-\xD6\xD8-\xF6\xF8-\u01BA\u01BC-\u01BF\u01C4-\u0293\u0295-\u02AF\u0370-\u0373\u0376\u0377\u037B-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0560-\u0588\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FD-\u10FF\u13A0-\u13F5\u13F8-\u13FD\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2134\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C7B\u2C7E-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA640-\uA66D\uA680-\uA69B\uA722-\uA76F\uA771-\uA787\uA78B-\uA78E\uA790-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F5\uA7F6\uA7FA\uAB30-\uAB5A\uAB60-\uAB68\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A\uFF41-\uFF5A",
      'astral': "\uD801[\uDC00-\uDC4F\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC]|\uD803[\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD806[\uDCA0-\uDCDF]|\uD81B[\uDE40-\uDE7F]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF09\uDF0B-\uDF1E]|\uD83A[\uDD00-\uDD43]"
    }, {
      'name': 'Ll',
      'alias': 'Lowercase_Letter',
      'bmp': "a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0560-\u0588\u10D0-\u10FA\u10FD-\u10FF\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5F\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7AF\uA7B5\uA7B7\uA7B9\uA7BB\uA7BD\uA7BF\uA7C1\uA7C3\uA7C8\uA7CA\uA7D1\uA7D3\uA7D5\uA7D7\uA7D9\uA7F6\uA7FA\uAB30-\uAB5A\uAB60-\uAB68\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A",
      'astral': "\uD801[\uDC28-\uDC4F\uDCD8-\uDCFB\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC]|\uD803[\uDCC0-\uDCF2]|\uD806[\uDCC0-\uDCDF]|\uD81B[\uDE60-\uDE7F]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD837[\uDF00-\uDF09\uDF0B-\uDF1E]|\uD83A[\uDD22-\uDD43]"
    }, {
      'name': 'Lm',
      'alias': 'Modifier_Letter',
      'bmp': "\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5\u06E6\u07F4\u07F5\u07FA\u081A\u0824\u0828\u08C9\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA69C\uA69D\uA717-\uA71F\uA770\uA788\uA7F2-\uA7F4\uA7F8\uA7F9\uA9CF\uA9E6\uAA70\uAADD\uAAF3\uAAF4\uAB5C-\uAB5F\uAB69\uFF70\uFF9E\uFF9F",
      'astral': "\uD801[\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD81A[\uDF40-\uDF43]|\uD81B[\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD838[\uDD37-\uDD3D]|\uD83A\uDD4B"
    }, {
      'name': 'Lo',
      'alias': 'Other_Letter',
      'bmp': "\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05EF-\u05F2\u0620-\u063F\u0641-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C8\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E45\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1100-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A\uA62B\uA66E\uA6A0-\uA6E5\uA78F\uA7F7\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",
      'astral': "\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC50-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF4A\uDF50]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD837\uDF0A|\uD838[\uDD00-\uDD2C\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]"
    }, {
      'name': 'Lt',
      'alias': 'Titlecase_Letter',
      'bmp': "\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC"
    }, {
      'name': 'Lu',
      'alias': 'Uppercase_Letter',
      'bmp': "A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1C90-\u1CBA\u1CBD-\u1CBF\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2F\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uA7B8\uA7BA\uA7BC\uA7BE\uA7C0\uA7C2\uA7C4-\uA7C7\uA7C9\uA7D0\uA7D6\uA7D8\uA7F5\uFF21-\uFF3A",
      'astral': "\uD801[\uDC00-\uDC27\uDCB0-\uDCD3\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95]|\uD803[\uDC80-\uDCB2]|\uD806[\uDCA0-\uDCBF]|\uD81B[\uDE40-\uDE5F]|\uD835[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA]|\uD83A[\uDD00-\uDD21]"
    }, {
      'name': 'M',
      'alias': 'Mark',
      'bmp': "\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F",
      'astral': "\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF]"
    }, {
      'name': 'Mc',
      'alias': 'Spacing_Mark',
      'bmp': "\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E\u094F\u0982\u0983\u09BE-\u09C0\u09C7\u09C8\u09CB\u09CC\u09D7\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB\u0ACC\u0B02\u0B03\u0B3E\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0B57\u0BBE\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD7\u0C01-\u0C03\u0C41-\u0C44\u0C82\u0C83\u0CBE\u0CC0-\u0CC4\u0CC7\u0CC8\u0CCA\u0CCB\u0CD5\u0CD6\u0D02\u0D03\u0D3E-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D57\u0D82\u0D83\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DF2\u0DF3\u0F3E\u0F3F\u0F7F\u102B\u102C\u1031\u1038\u103B\u103C\u1056\u1057\u1062-\u1064\u1067-\u106D\u1083\u1084\u1087-\u108C\u108F\u109A-\u109C\u1715\u1734\u17B6\u17BE-\u17C5\u17C7\u17C8\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1A19\u1A1A\u1A55\u1A57\u1A61\u1A63\u1A64\u1A6D-\u1A72\u1B04\u1B35\u1B3B\u1B3D-\u1B41\u1B43\u1B44\u1B82\u1BA1\u1BA6\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1C24-\u1C2B\u1C34\u1C35\u1CE1\u1CF7\u302E\u302F\uA823\uA824\uA827\uA880\uA881\uA8B4-\uA8C3\uA952\uA953\uA983\uA9B4\uA9B5\uA9BA\uA9BB\uA9BE-\uA9C0\uAA2F\uAA30\uAA33\uAA34\uAA4D\uAA7B\uAA7D\uAAEB\uAAEE\uAAEF\uAAF5\uABE3\uABE4\uABE6\uABE7\uABE9\uABEA\uABEC",
      'astral': "\uD804[\uDC00\uDC02\uDC82\uDCB0-\uDCB2\uDCB7\uDCB8\uDD2C\uDD45\uDD46\uDD82\uDDB3-\uDDB5\uDDBF\uDDC0\uDDCE\uDE2C-\uDE2E\uDE32\uDE33\uDE35\uDEE0-\uDEE2\uDF02\uDF03\uDF3E\uDF3F\uDF41-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63]|\uD805[\uDC35-\uDC37\uDC40\uDC41\uDC45\uDCB0-\uDCB2\uDCB9\uDCBB-\uDCBE\uDCC1\uDDAF-\uDDB1\uDDB8-\uDDBB\uDDBE\uDE30-\uDE32\uDE3B\uDE3C\uDE3E\uDEAC\uDEAE\uDEAF\uDEB6\uDF20\uDF21\uDF26]|\uD806[\uDC2C-\uDC2E\uDC38\uDD30-\uDD35\uDD37\uDD38\uDD3D\uDD40\uDD42\uDDD1-\uDDD3\uDDDC-\uDDDF\uDDE4\uDE39\uDE57\uDE58\uDE97]|\uD807[\uDC2F\uDC3E\uDCA9\uDCB1\uDCB4\uDD8A-\uDD8E\uDD93\uDD94\uDD96\uDEF5\uDEF6]|\uD81B[\uDF51-\uDF87\uDFF0\uDFF1]|\uD834[\uDD65\uDD66\uDD6D-\uDD72]"
    }, {
      'name': 'Me',
      'alias': 'Enclosing_Mark',
      'bmp': "\u0488\u0489\u1ABE\u20DD-\u20E0\u20E2-\u20E4\uA670-\uA672"
    }, {
      'name': 'Mn',
      'alias': 'Nonspacing_Mark',
      'bmp': "\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F",
      'astral': "\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF40\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB3-\uDCB8\uDCBA\uDCBF\uDCC0\uDCC2\uDCC3\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF]"
    }, {
      'name': 'N',
      'alias': 'Number',
      'bmp': "0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19",
      'astral': "\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]"
    }, {
      'name': 'Nd',
      'alias': 'Decimal_Number',
      'bmp': "0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19",
      'astral': "\uD801[\uDCA0-\uDCA9]|\uD803[\uDD30-\uDD39]|\uD804[\uDC66-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF39]|\uD806[\uDCE0-\uDCE9\uDD50-\uDD59]|\uD807[\uDC50-\uDC59\uDD50-\uDD59\uDDA0-\uDDA9]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD83A[\uDD50-\uDD59]|\uD83E[\uDFF0-\uDFF9]"
    }, {
      'name': 'Nl',
      'alias': 'Letter_Number',
      'bmp': "\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF",
      'astral': "\uD800[\uDD40-\uDD74\uDF41\uDF4A\uDFD1-\uDFD5]|\uD809[\uDC00-\uDC6E]"
    }, {
      'name': 'No',
      'alias': 'Other_Number',
      'bmp': "\xB2\xB3\xB9\xBC-\xBE\u09F4-\u09F9\u0B72-\u0B77\u0BF0-\u0BF2\u0C78-\u0C7E\u0D58-\u0D5E\u0D70-\u0D78\u0F2A-\u0F33\u1369-\u137C\u17F0-\u17F9\u19DA\u2070\u2074-\u2079\u2080-\u2089\u2150-\u215F\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA830-\uA835",
      'astral': "\uD800[\uDD07-\uDD33\uDD75-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC65\uDDE1-\uDDF4]|\uD805[\uDF3A\uDF3B]|\uD806[\uDCEA-\uDCF2]|\uD807[\uDC5A-\uDC6C\uDFC0-\uDFD4]|\uD81A[\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD83A[\uDCC7-\uDCCF]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]"
    }, {
      'name': 'P',
      'alias': 'Punctuation',
      'bmp': "!-#%-\\*,-\\/:;\\?@\\[-\\]_\\{\\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65",
      'astral': "\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]"
    }, {
      'name': 'Pc',
      'alias': 'Connector_Punctuation',
      'bmp': "_\u203F\u2040\u2054\uFE33\uFE34\uFE4D-\uFE4F\uFF3F"
    }, {
      'name': 'Pd',
      'alias': 'Dash_Punctuation',
      'bmp': "\\-\u058A\u05BE\u1400\u1806\u2010-\u2015\u2E17\u2E1A\u2E3A\u2E3B\u2E40\u2E5D\u301C\u3030\u30A0\uFE31\uFE32\uFE58\uFE63\uFF0D",
      'astral': "\uD803\uDEAD"
    }, {
      'name': 'Pe',
      'alias': 'Close_Punctuation',
      'bmp': "\\)\\]\\}\u0F3B\u0F3D\u169C\u2046\u207E\u208E\u2309\u230B\u232A\u2769\u276B\u276D\u276F\u2771\u2773\u2775\u27C6\u27E7\u27E9\u27EB\u27ED\u27EF\u2984\u2986\u2988\u298A\u298C\u298E\u2990\u2992\u2994\u2996\u2998\u29D9\u29DB\u29FD\u2E23\u2E25\u2E27\u2E29\u2E56\u2E58\u2E5A\u2E5C\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u301E\u301F\uFD3E\uFE18\uFE36\uFE38\uFE3A\uFE3C\uFE3E\uFE40\uFE42\uFE44\uFE48\uFE5A\uFE5C\uFE5E\uFF09\uFF3D\uFF5D\uFF60\uFF63"
    }, {
      'name': 'Pf',
      'alias': 'Final_Punctuation',
      'bmp': "\xBB\u2019\u201D\u203A\u2E03\u2E05\u2E0A\u2E0D\u2E1D\u2E21"
    }, {
      'name': 'Pi',
      'alias': 'Initial_Punctuation',
      'bmp': "\xAB\u2018\u201B\u201C\u201F\u2039\u2E02\u2E04\u2E09\u2E0C\u2E1C\u2E20"
    }, {
      'name': 'Po',
      'alias': 'Other_Punctuation',
      'bmp': "!-#%-'\\*,\\.\\/:;\\?@\\\xA1\xA7\xB6\xB7\xBF\u037E\u0387\u055A-\u055F\u0589\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u166E\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u1805\u1807-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2016\u2017\u2020-\u2027\u2030-\u2038\u203B-\u203E\u2041-\u2043\u2047-\u2051\u2053\u2055-\u205E\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00\u2E01\u2E06-\u2E08\u2E0B\u2E0E-\u2E16\u2E18\u2E19\u2E1B\u2E1E\u2E1F\u2E2A-\u2E2E\u2E30-\u2E39\u2E3C-\u2E3F\u2E41\u2E43-\u2E4F\u2E52-\u2E54\u3001-\u3003\u303D\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFE10-\uFE16\uFE19\uFE30\uFE45\uFE46\uFE49-\uFE4C\uFE50-\uFE52\uFE54-\uFE57\uFE5F-\uFE61\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF07\uFF0A\uFF0C\uFF0E\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3C\uFF61\uFF64\uFF65",
      'astral': "\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]"
    }, {
      'name': 'Ps',
      'alias': 'Open_Punctuation',
      'bmp': "\\(\\[\\{\u0F3A\u0F3C\u169B\u201A\u201E\u2045\u207D\u208D\u2308\u230A\u2329\u2768\u276A\u276C\u276E\u2770\u2772\u2774\u27C5\u27E6\u27E8\u27EA\u27EC\u27EE\u2983\u2985\u2987\u2989\u298B\u298D\u298F\u2991\u2993\u2995\u2997\u29D8\u29DA\u29FC\u2E22\u2E24\u2E26\u2E28\u2E42\u2E55\u2E57\u2E59\u2E5B\u3008\u300A\u300C\u300E\u3010\u3014\u3016\u3018\u301A\u301D\uFD3F\uFE17\uFE35\uFE37\uFE39\uFE3B\uFE3D\uFE3F\uFE41\uFE43\uFE47\uFE59\uFE5B\uFE5D\uFF08\uFF3B\uFF5B\uFF5F\uFF62"
    }, {
      'name': 'S',
      'alias': 'Symbol',
      'bmp': "\\$\\+<->\\^`\\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD",
      'astral': "\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDD-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC5\uDED0-\uDED9\uDEE0-\uDEE7\uDEF0-\uDEF6\uDF00-\uDF92\uDF94-\uDFCA]"
    }, {
      'name': 'Sc',
      'alias': 'Currency_Symbol',
      'bmp': "\\$\xA2-\xA5\u058F\u060B\u07FE\u07FF\u09F2\u09F3\u09FB\u0AF1\u0BF9\u0E3F\u17DB\u20A0-\u20C0\uA838\uFDFC\uFE69\uFF04\uFFE0\uFFE1\uFFE5\uFFE6",
      'astral': "\uD807[\uDFDD-\uDFE0]|\uD838\uDEFF|\uD83B\uDCB0"
    }, {
      'name': 'Sk',
      'alias': 'Modifier_Symbol',
      'bmp': "\\^`\xA8\xAF\xB4\xB8\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u0888\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u309B\u309C\uA700-\uA716\uA720\uA721\uA789\uA78A\uAB5B\uAB6A\uAB6B\uFBB2-\uFBC2\uFF3E\uFF40\uFFE3",
      'astral': "\uD83C[\uDFFB-\uDFFF]"
    }, {
      'name': 'Sm',
      'alias': 'Math_Symbol',
      'bmp': "\\+<->\\|~\xAC\xB1\xD7\xF7\u03F6\u0606-\u0608\u2044\u2052\u207A-\u207C\u208A-\u208C\u2118\u2140-\u2144\u214B\u2190-\u2194\u219A\u219B\u21A0\u21A3\u21A6\u21AE\u21CE\u21CF\u21D2\u21D4\u21F4-\u22FF\u2320\u2321\u237C\u239B-\u23B3\u23DC-\u23E1\u25B7\u25C1\u25F8-\u25FF\u266F\u27C0-\u27C4\u27C7-\u27E5\u27F0-\u27FF\u2900-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2AFF\u2B30-\u2B44\u2B47-\u2B4C\uFB29\uFE62\uFE64-\uFE66\uFF0B\uFF1C-\uFF1E\uFF5C\uFF5E\uFFE2\uFFE9-\uFFEC",
      'astral': "\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD83B[\uDEF0\uDEF1]"
    }, {
      'name': 'So',
      'alias': 'Other_Symbol',
      'bmp': "\xA6\xA9\xAE\xB0\u0482\u058D\u058E\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u09FA\u0B70\u0BF3-\u0BF8\u0BFA\u0C7F\u0D4F\u0D79\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116\u2117\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u214A\u214C\u214D\u214F\u218A\u218B\u2195-\u2199\u219C-\u219F\u21A1\u21A2\u21A4\u21A5\u21A7-\u21AD\u21AF-\u21CD\u21D0\u21D1\u21D3\u21D5-\u21F3\u2300-\u2307\u230C-\u231F\u2322-\u2328\u232B-\u237B\u237D-\u239A\u23B4-\u23DB\u23E2-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u25B6\u25B8-\u25C0\u25C2-\u25F7\u2600-\u266E\u2670-\u2767\u2794-\u27BF\u2800-\u28FF\u2B00-\u2B2F\u2B45\u2B46\u2B4D-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA828-\uA82B\uA836\uA837\uA839\uAA77-\uAA79\uFD40-\uFD4F\uFDCF\uFDFD-\uFDFF\uFFE4\uFFE8\uFFED\uFFEE\uFFFC\uFFFD",
      'astral': "\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFDC\uDFE1-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838\uDD4F|\uD83B[\uDCAC\uDD2E]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFA]|\uD83D[\uDC00-\uDED7\uDEDD-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC5\uDED0-\uDED9\uDEE0-\uDEE7\uDEF0-\uDEF6\uDF00-\uDF92\uDF94-\uDFCA]"
    }, {
      'name': 'Z',
      'alias': 'Separator',
      'bmp': " \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000"
    }, {
      'name': 'Zl',
      'alias': 'Line_Separator',
      'bmp': "\u2028"
    }, {
      'name': 'Zp',
      'alias': 'Paragraph_Separator',
      'bmp': "\u2029"
    }, {
      'name': 'Zs',
      'alias': 'Space_Separator',
      'bmp': " \xA0\u1680\u2000-\u200A\u202F\u205F\u3000"
    }];
    var categories$1 = getDefaultExportFromCjs$1(categories);
    var unicodeCategories = (function (XRegExp) {
      if (!XRegExp.addUnicodeData) {
        throw new ReferenceError('Unicode Base must be loaded before Unicode Categories');
      }
      XRegExp.addUnicodeData(categories$1);
    });
    var properties = [{
      'name': 'ASCII',
      'bmp': '\0-\x7F'
    }, {
      'name': 'Alphabetic',
      'bmp': "A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0345\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05B0-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0657\u0659-\u065F\u066E-\u06D3\u06D5-\u06DC\u06E1-\u06E8\u06ED-\u06EF\u06FA-\u06FC\u06FF\u0710-\u073F\u074D-\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0817\u081A-\u082C\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u08D4-\u08DF\u08E3-\u08E9\u08F0-\u093B\u093D-\u094C\u094E-\u0950\u0955-\u0963\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C4\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09F0\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B\u0A4C\u0A51\u0A59-\u0A5C\u0A5E\u0A70-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC5\u0AC7-\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0-\u0AE3\u0AF9-\u0AFC\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D-\u0B44\u0B47\u0B48\u0B4B\u0B4C\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4C\u0C55\u0C56\u0C58-\u0C5A\u0C5D\u0C60-\u0C63\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCC\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0-\u0CE3\u0CF1\u0CF2\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E46\u0E4D\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0ECD\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F71-\u0F81\u0F88-\u0F97\u0F99-\u0FBC\u1000-\u1036\u1038\u103B-\u103F\u1050-\u108F\u109A-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1713\u171F-\u1733\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17B3\u17B6-\u17C8\u17D7\u17DC\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u1938\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A1B\u1A20-\u1A5E\u1A61-\u1A74\u1AA7\u1ABF\u1AC0\u1ACC-\u1ACE\u1B00-\u1B33\u1B35-\u1B43\u1B45-\u1B4C\u1B80-\u1BA9\u1BAC-\u1BAF\u1BBA-\u1BE5\u1BE7-\u1BF1\u1C00-\u1C36\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1DE7-\u1DF4\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u24B6-\u24E9\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA674-\uA67B\uA67F-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA805\uA807-\uA827\uA840-\uA873\uA880-\uA8C3\uA8C5\uA8F2-\uA8F7\uA8FB\uA8FD-\uA8FF\uA90A-\uA92A\uA930-\uA952\uA960-\uA97C\uA980-\uA9B2\uA9B4-\uA9BF\uA9CF\uA9E0-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA60-\uAA76\uAA7A-\uAABE\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF5\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",
      'astral': "\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDE80-\uDEA9\uDEAB\uDEAC\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC45\uDC71-\uDC75\uDC82-\uDCB8\uDCC2\uDCD0-\uDCE8\uDD00-\uDD32\uDD44-\uDD47\uDD50-\uDD72\uDD76\uDD80-\uDDBF\uDDC1-\uDDC4\uDDCE\uDDCF\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE34\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEE8\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D-\uDF44\uDF47\uDF48\uDF4B\uDF4C\uDF50\uDF57\uDF5D-\uDF63]|\uD805[\uDC00-\uDC41\uDC43-\uDC45\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCC1\uDCC4\uDCC5\uDCC7\uDD80-\uDDB5\uDDB8-\uDDBE\uDDD8-\uDDDD\uDE00-\uDE3E\uDE40\uDE44\uDE80-\uDEB5\uDEB8\uDF00-\uDF1A\uDF1D-\uDF2A\uDF40-\uDF46]|\uD806[\uDC00-\uDC38\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B\uDD3C\uDD3F-\uDD42\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDDF\uDDE1\uDDE3\uDDE4\uDE00-\uDE32\uDE35-\uDE3E\uDE50-\uDE97\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC3E\uDC40\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD41\uDD43\uDD46\uDD47\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD96\uDD98\uDEE0-\uDEF6\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF0\uDFF1]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9E]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD47\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD30-\uDD49\uDD50-\uDD69\uDD70-\uDD89]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]"
    }, {
      'name': 'Any',
      'isBmpLast': true,
      'bmp': "\0-\uFFFF",
      'astral': "[\uD800-\uDBFF][\uDC00-\uDFFF]"
    }, {
      'name': 'Default_Ignorable_Code_Point',
      'bmp': "\xAD\u034F\u061C\u115F\u1160\u17B4\u17B5\u180B-\u180F\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8",
      'astral': "\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|[\uDB40-\uDB43][\uDC00-\uDFFF]"
    }, {
      'name': 'Lowercase',
      'bmp': "a-z\xAA\xB5\xBA\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02B8\u02C0\u02C1\u02E0-\u02E4\u0345\u0371\u0373\u0377\u037A-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0560-\u0588\u10D0-\u10FA\u10FD-\u10FF\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1DBF\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u2071\u207F\u2090-\u209C\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2170-\u217F\u2184\u24D0-\u24E9\u2C30-\u2C5F\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7D\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B-\uA69D\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7AF\uA7B5\uA7B7\uA7B9\uA7BB\uA7BD\uA7BF\uA7C1\uA7C3\uA7C8\uA7CA\uA7D1\uA7D3\uA7D5\uA7D7\uA7D9\uA7F6\uA7F8-\uA7FA\uAB30-\uAB5A\uAB5C-\uAB68\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A",
      'astral': "\uD801[\uDC28-\uDC4F\uDCD8-\uDCFB\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDF80\uDF83-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD803[\uDCC0-\uDCF2]|\uD806[\uDCC0-\uDCDF]|\uD81B[\uDE60-\uDE7F]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD837[\uDF00-\uDF09\uDF0B-\uDF1E]|\uD83A[\uDD22-\uDD43]"
    }, {
      'name': 'Noncharacter_Code_Point',
      'bmp': "\uFDD0-\uFDEF\uFFFE\uFFFF",
      'astral': "[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]"
    }, {
      'name': 'Uppercase',
      'bmp': "A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1C90-\u1CBA\u1CBD-\u1CBF\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2160-\u216F\u2183\u24B6-\u24CF\u2C00-\u2C2F\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uA7B8\uA7BA\uA7BC\uA7BE\uA7C0\uA7C2\uA7C4-\uA7C7\uA7C9\uA7D0\uA7D6\uA7D8\uA7F5\uFF21-\uFF3A",
      'astral': "\uD801[\uDC00-\uDC27\uDCB0-\uDCD3\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95]|\uD803[\uDC80-\uDCB2]|\uD806[\uDCA0-\uDCBF]|\uD81B[\uDE40-\uDE5F]|\uD835[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA]|\uD83A[\uDD00-\uDD21]|\uD83C[\uDD30-\uDD49\uDD50-\uDD69\uDD70-\uDD89]"
    }, {
      'name': 'White_Space',
      'bmp': "\t-\r \x85\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000"
    }];
    var properties$1 = getDefaultExportFromCjs$1(properties);
    var unicodeProperties = (function (XRegExp) {
      if (!XRegExp.addUnicodeData) {
        throw new ReferenceError('Unicode Base must be loaded before Unicode Properties');
      }
      var unicodeData = properties$1;
      unicodeData.push({
        name: 'Assigned',
        inverseOf: 'Cn'
      });
      XRegExp.addUnicodeData(unicodeData);
    });
    var scripts = [{
      'name': 'Adlam',
      'astral': "\uD83A[\uDD00-\uDD4B\uDD50-\uDD59\uDD5E\uDD5F]"
    }, {
      'name': 'Ahom',
      'astral': "\uD805[\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF46]"
    }, {
      'name': 'Anatolian_Hieroglyphs',
      'astral': "\uD811[\uDC00-\uDE46]"
    }, {
      'name': 'Arabic',
      'bmp': "\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u06FF\u0750-\u077F\u0870-\u088E\u0890\u0891\u0898-\u08E1\u08E3-\u08FF\uFB50-\uFBC2\uFBD3-\uFD3D\uFD40-\uFD8F\uFD92-\uFDC7\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC",
      'astral': "\uD803[\uDE60-\uDE7E]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]"
    }, {
      'name': 'Armenian',
      'bmp': "\u0531-\u0556\u0559-\u058A\u058D-\u058F\uFB13-\uFB17"
    }, {
      'name': 'Avestan',
      'astral': "\uD802[\uDF00-\uDF35\uDF39-\uDF3F]"
    }, {
      'name': 'Balinese',
      'bmp': "\u1B00-\u1B4C\u1B50-\u1B7E"
    }, {
      'name': 'Bamum',
      'bmp': "\uA6A0-\uA6F7",
      'astral': "\uD81A[\uDC00-\uDE38]"
    }, {
      'name': 'Bassa_Vah',
      'astral': "\uD81A[\uDED0-\uDEED\uDEF0-\uDEF5]"
    }, {
      'name': 'Batak',
      'bmp': "\u1BC0-\u1BF3\u1BFC-\u1BFF"
    }, {
      'name': 'Bengali',
      'bmp': "\u0980-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09FE"
    }, {
      'name': 'Bhaiksuki',
      'astral': "\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC45\uDC50-\uDC6C]"
    }, {
      'name': 'Bopomofo',
      'bmp': "\u02EA\u02EB\u3105-\u312F\u31A0-\u31BF"
    }, {
      'name': 'Brahmi',
      'astral': "\uD804[\uDC00-\uDC4D\uDC52-\uDC75\uDC7F]"
    }, {
      'name': 'Braille',
      'bmp': "\u2800-\u28FF"
    }, {
      'name': 'Buginese',
      'bmp': "\u1A00-\u1A1B\u1A1E\u1A1F"
    }, {
      'name': 'Buhid',
      'bmp': "\u1740-\u1753"
    }, {
      'name': 'Canadian_Aboriginal',
      'bmp': "\u1400-\u167F\u18B0-\u18F5",
      'astral': "\uD806[\uDEB0-\uDEBF]"
    }, {
      'name': 'Carian',
      'astral': "\uD800[\uDEA0-\uDED0]"
    }, {
      'name': 'Caucasian_Albanian',
      'astral': "\uD801[\uDD30-\uDD63\uDD6F]"
    }, {
      'name': 'Chakma',
      'astral': "\uD804[\uDD00-\uDD34\uDD36-\uDD47]"
    }, {
      'name': 'Cham',
      'bmp': "\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA5C-\uAA5F"
    }, {
      'name': 'Cherokee',
      'bmp': "\u13A0-\u13F5\u13F8-\u13FD\uAB70-\uABBF"
    }, {
      'name': 'Chorasmian',
      'astral': "\uD803[\uDFB0-\uDFCB]"
    }, {
      'name': 'Common',
      'bmp': "\0-@\\[-`\\{-\xA9\xAB-\xB9\xBB-\xBF\xD7\xF7\u02B9-\u02DF\u02E5-\u02E9\u02EC-\u02FF\u0374\u037E\u0385\u0387\u0605\u060C\u061B\u061F\u0640\u06DD\u08E2\u0964\u0965\u0E3F\u0FD5-\u0FD8\u10FB\u16EB-\u16ED\u1735\u1736\u1802\u1803\u1805\u1CD3\u1CE1\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5-\u1CF7\u1CFA\u2000-\u200B\u200E-\u2064\u2066-\u2070\u2074-\u207E\u2080-\u208E\u20A0-\u20C0\u2100-\u2125\u2127-\u2129\u212C-\u2131\u2133-\u214D\u214F-\u215F\u2189-\u218B\u2190-\u2426\u2440-\u244A\u2460-\u27FF\u2900-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2E00-\u2E5D\u2FF0-\u2FFB\u3000-\u3004\u3006\u3008-\u3020\u3030-\u3037\u303C-\u303F\u309B\u309C\u30A0\u30FB\u30FC\u3190-\u319F\u31C0-\u31E3\u3220-\u325F\u327F-\u32CF\u32FF\u3358-\u33FF\u4DC0-\u4DFF\uA700-\uA721\uA788-\uA78A\uA830-\uA839\uA92E\uA9CF\uAB5B\uAB6A\uAB6B\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFEFF\uFF01-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFF70\uFF9E\uFF9F\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFF9-\uFFFD",
      'astral': "\uD800[\uDD00-\uDD02\uDD07-\uDD33\uDD37-\uDD3F\uDD90-\uDD9C\uDDD0-\uDDFC\uDEE1-\uDEFB]|\uD82F[\uDCA0-\uDCA3]|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD66\uDD6A-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDEE0-\uDEF3\uDF00-\uDF56\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDFCB\uDFCE-\uDFFF]|\uD83B[\uDC71-\uDCB4\uDD01-\uDD3D]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD00-\uDDAD\uDDE6-\uDDFF\uDE01\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDD-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC5\uDED0-\uDED9\uDEE0-\uDEE7\uDEF0-\uDEF6\uDF00-\uDF92\uDF94-\uDFCA\uDFF0-\uDFF9]|\uDB40[\uDC01\uDC20-\uDC7F]"
    }, {
      'name': 'Coptic',
      'bmp': "\u03E2-\u03EF\u2C80-\u2CF3\u2CF9-\u2CFF"
    }, {
      'name': 'Cuneiform',
      'astral': "\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC70-\uDC74\uDC80-\uDD43]"
    }, {
      'name': 'Cypriot',
      'astral': "\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F]"
    }, {
      'name': 'Cypro_Minoan',
      'astral': "\uD80B[\uDF90-\uDFF2]"
    }, {
      'name': 'Cyrillic',
      'bmp': "\u0400-\u0484\u0487-\u052F\u1C80-\u1C88\u1D2B\u1D78\u2DE0-\u2DFF\uA640-\uA69F\uFE2E\uFE2F"
    }, {
      'name': 'Deseret',
      'astral': "\uD801[\uDC00-\uDC4F]"
    }, {
      'name': 'Devanagari',
      'bmp': "\u0900-\u0950\u0955-\u0963\u0966-\u097F\uA8E0-\uA8FF"
    }, {
      'name': 'Dives_Akuru',
      'astral': "\uD806[\uDD00-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B-\uDD46\uDD50-\uDD59]"
    }, {
      'name': 'Dogra',
      'astral': "\uD806[\uDC00-\uDC3B]"
    }, {
      'name': 'Duployan',
      'astral': "\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9C-\uDC9F]"
    }, {
      'name': 'Egyptian_Hieroglyphs',
      'astral': "\uD80C[\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E\uDC30-\uDC38]"
    }, {
      'name': 'Elbasan',
      'astral': "\uD801[\uDD00-\uDD27]"
    }, {
      'name': 'Elymaic',
      'astral': "\uD803[\uDFE0-\uDFF6]"
    }, {
      'name': 'Ethiopic',
      'bmp': "\u1200-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u137C\u1380-\u1399\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E",
      'astral': "\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]"
    }, {
      'name': 'Georgian',
      'bmp': "\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u10FF\u1C90-\u1CBA\u1CBD-\u1CBF\u2D00-\u2D25\u2D27\u2D2D"
    }, {
      'name': 'Glagolitic',
      'bmp': "\u2C00-\u2C5F",
      'astral': "\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]"
    }, {
      'name': 'Gothic',
      'astral': "\uD800[\uDF30-\uDF4A]"
    }, {
      'name': 'Grantha',
      'astral': "\uD804[\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]"
    }, {
      'name': 'Greek',
      'bmp': "\u0370-\u0373\u0375-\u0377\u037A-\u037D\u037F\u0384\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03E1\u03F0-\u03FF\u1D26-\u1D2A\u1D5D-\u1D61\u1D66-\u1D6A\u1DBF\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEF\u1FF2-\u1FF4\u1FF6-\u1FFE\u2126\uAB65",
      'astral': "\uD800[\uDD40-\uDD8E\uDDA0]|\uD834[\uDE00-\uDE45]"
    }, {
      'name': 'Gujarati',
      'bmp': "\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AF1\u0AF9-\u0AFF"
    }, {
      'name': 'Gunjala_Gondi',
      'astral': "\uD807[\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9]"
    }, {
      'name': 'Gurmukhi',
      'bmp': "\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A76"
    }, {
      'name': 'Han',
      'bmp': "\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u3005\u3007\u3021-\u3029\u3038-\u303B\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFA6D\uFA70-\uFAD9",
      'astral': "\uD81B[\uDFE2\uDFE3\uDFF0\uDFF1]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]"
    }, {
      'name': 'Hangul',
      'bmp': "\u1100-\u11FF\u302E\u302F\u3131-\u318E\u3200-\u321E\u3260-\u327E\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC"
    }, {
      'name': 'Hanifi_Rohingya',
      'astral': "\uD803[\uDD00-\uDD27\uDD30-\uDD39]"
    }, {
      'name': 'Hanunoo',
      'bmp': "\u1720-\u1734"
    }, {
      'name': 'Hatran',
      'astral': "\uD802[\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDCFF]"
    }, {
      'name': 'Hebrew',
      'bmp': "\u0591-\u05C7\u05D0-\u05EA\u05EF-\u05F4\uFB1D-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4F"
    }, {
      'name': 'Hiragana',
      'bmp': "\u3041-\u3096\u309D-\u309F",
      'astral': "\uD82C[\uDC01-\uDD1F\uDD50-\uDD52]|\uD83C\uDE00"
    }, {
      'name': 'Imperial_Aramaic',
      'astral': "\uD802[\uDC40-\uDC55\uDC57-\uDC5F]"
    }, {
      'name': 'Inherited',
      'bmp': "\u0300-\u036F\u0485\u0486\u064B-\u0655\u0670\u0951-\u0954\u1AB0-\u1ACE\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u200D\u20D0-\u20F0\u302A-\u302D\u3099\u309A\uFE00-\uFE0F\uFE20-\uFE2D",
      'astral': "\uD800[\uDDFD\uDEE0]|\uD804\uDF3B|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uDB40[\uDD00-\uDDEF]"
    }, {
      'name': 'Inscriptional_Pahlavi',
      'astral': "\uD802[\uDF60-\uDF72\uDF78-\uDF7F]"
    }, {
      'name': 'Inscriptional_Parthian',
      'astral': "\uD802[\uDF40-\uDF55\uDF58-\uDF5F]"
    }, {
      'name': 'Javanese',
      'bmp': "\uA980-\uA9CD\uA9D0-\uA9D9\uA9DE\uA9DF"
    }, {
      'name': 'Kaithi',
      'astral': "\uD804[\uDC80-\uDCC2\uDCCD]"
    }, {
      'name': 'Kannada',
      'bmp': "\u0C80-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2"
    }, {
      'name': 'Katakana',
      'bmp': "\u30A1-\u30FA\u30FD-\u30FF\u31F0-\u31FF\u32D0-\u32FE\u3300-\u3357\uFF66-\uFF6F\uFF71-\uFF9D",
      'astral': "\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00\uDD20-\uDD22\uDD64-\uDD67]"
    }, {
      'name': 'Kayah_Li',
      'bmp': "\uA900-\uA92D\uA92F"
    }, {
      'name': 'Kharoshthi',
      'astral': "\uD802[\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F-\uDE48\uDE50-\uDE58]"
    }, {
      'name': 'Khitan_Small_Script',
      'astral': "\uD81B\uDFE4|\uD822[\uDF00-\uDFFF]|\uD823[\uDC00-\uDCD5]"
    }, {
      'name': 'Khmer',
      'bmp': "\u1780-\u17DD\u17E0-\u17E9\u17F0-\u17F9\u19E0-\u19FF"
    }, {
      'name': 'Khojki',
      'astral': "\uD804[\uDE00-\uDE11\uDE13-\uDE3E]"
    }, {
      'name': 'Khudawadi',
      'astral': "\uD804[\uDEB0-\uDEEA\uDEF0-\uDEF9]"
    }, {
      'name': 'Lao',
      'bmp': "\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF"
    }, {
      'name': 'Latin',
      'bmp': "A-Za-z\xAA\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uAB66-\uAB69\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A",
      'astral': "\uD801[\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD837[\uDF00-\uDF1E]"
    }, {
      'name': 'Lepcha',
      'bmp': "\u1C00-\u1C37\u1C3B-\u1C49\u1C4D-\u1C4F"
    }, {
      'name': 'Limbu',
      'bmp': "\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1940\u1944-\u194F"
    }, {
      'name': 'Linear_A',
      'astral': "\uD801[\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]"
    }, {
      'name': 'Linear_B',
      'astral': "\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA]"
    }, {
      'name': 'Lisu',
      'bmp': "\uA4D0-\uA4FF",
      'astral': "\uD807\uDFB0"
    }, {
      'name': 'Lycian',
      'astral': "\uD800[\uDE80-\uDE9C]"
    }, {
      'name': 'Lydian',
      'astral': "\uD802[\uDD20-\uDD39\uDD3F]"
    }, {
      'name': 'Mahajani',
      'astral': "\uD804[\uDD50-\uDD76]"
    }, {
      'name': 'Makasar',
      'astral': "\uD807[\uDEE0-\uDEF8]"
    }, {
      'name': 'Malayalam',
      'bmp': "\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4F\u0D54-\u0D63\u0D66-\u0D7F"
    }, {
      'name': 'Mandaic',
      'bmp': "\u0840-\u085B\u085E"
    }, {
      'name': 'Manichaean',
      'astral': "\uD802[\uDEC0-\uDEE6\uDEEB-\uDEF6]"
    }, {
      'name': 'Marchen',
      'astral': "\uD807[\uDC70-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]"
    }, {
      'name': 'Masaram_Gondi',
      'astral': "\uD807[\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]"
    }, {
      'name': 'Medefaidrin',
      'astral': "\uD81B[\uDE40-\uDE9A]"
    }, {
      'name': 'Meetei_Mayek',
      'bmp': "\uAAE0-\uAAF6\uABC0-\uABED\uABF0-\uABF9"
    }, {
      'name': 'Mende_Kikakui',
      'astral': "\uD83A[\uDC00-\uDCC4\uDCC7-\uDCD6]"
    }, {
      'name': 'Meroitic_Cursive',
      'astral': "\uD802[\uDDA0-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDDFF]"
    }, {
      'name': 'Meroitic_Hieroglyphs',
      'astral': "\uD802[\uDD80-\uDD9F]"
    }, {
      'name': 'Miao',
      'astral': "\uD81B[\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F]"
    }, {
      'name': 'Modi',
      'astral': "\uD805[\uDE00-\uDE44\uDE50-\uDE59]"
    }, {
      'name': 'Mongolian',
      'bmp': "\u1800\u1801\u1804\u1806-\u1819\u1820-\u1878\u1880-\u18AA",
      'astral': "\uD805[\uDE60-\uDE6C]"
    }, {
      'name': 'Mro',
      'astral': "\uD81A[\uDE40-\uDE5E\uDE60-\uDE69\uDE6E\uDE6F]"
    }, {
      'name': 'Multani',
      'astral': "\uD804[\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA9]"
    }, {
      'name': 'Myanmar',
      'bmp': "\u1000-\u109F\uA9E0-\uA9FE\uAA60-\uAA7F"
    }, {
      'name': 'Nabataean',
      'astral': "\uD802[\uDC80-\uDC9E\uDCA7-\uDCAF]"
    }, {
      'name': 'Nandinagari',
      'astral': "\uD806[\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE4]"
    }, {
      'name': 'New_Tai_Lue',
      'bmp': "\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u19DE\u19DF"
    }, {
      'name': 'Newa',
      'astral': "\uD805[\uDC00-\uDC5B\uDC5D-\uDC61]"
    }, {
      'name': 'Nko',
      'bmp': "\u07C0-\u07FA\u07FD-\u07FF"
    }, {
      'name': 'Nushu',
      'astral': "\uD81B\uDFE1|\uD82C[\uDD70-\uDEFB]"
    }, {
      'name': 'Nyiakeng_Puachue_Hmong',
      'astral': "\uD838[\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDD4F]"
    }, {
      'name': 'Ogham',
      'bmp': "\u1680-\u169C"
    }, {
      'name': 'Ol_Chiki',
      'bmp': "\u1C50-\u1C7F"
    }, {
      'name': 'Old_Hungarian',
      'astral': "\uD803[\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDCFF]"
    }, {
      'name': 'Old_Italic',
      'astral': "\uD800[\uDF00-\uDF23\uDF2D-\uDF2F]"
    }, {
      'name': 'Old_North_Arabian',
      'astral': "\uD802[\uDE80-\uDE9F]"
    }, {
      'name': 'Old_Permic',
      'astral': "\uD800[\uDF50-\uDF7A]"
    }, {
      'name': 'Old_Persian',
      'astral': "\uD800[\uDFA0-\uDFC3\uDFC8-\uDFD5]"
    }, {
      'name': 'Old_Sogdian',
      'astral': "\uD803[\uDF00-\uDF27]"
    }, {
      'name': 'Old_South_Arabian',
      'astral': "\uD802[\uDE60-\uDE7F]"
    }, {
      'name': 'Old_Turkic',
      'astral': "\uD803[\uDC00-\uDC48]"
    }, {
      'name': 'Old_Uyghur',
      'astral': "\uD803[\uDF70-\uDF89]"
    }, {
      'name': 'Oriya',
      'bmp': "\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B77"
    }, {
      'name': 'Osage',
      'astral': "\uD801[\uDCB0-\uDCD3\uDCD8-\uDCFB]"
    }, {
      'name': 'Osmanya',
      'astral': "\uD801[\uDC80-\uDC9D\uDCA0-\uDCA9]"
    }, {
      'name': 'Pahawh_Hmong',
      'astral': "\uD81A[\uDF00-\uDF45\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]"
    }, {
      'name': 'Palmyrene',
      'astral': "\uD802[\uDC60-\uDC7F]"
    }, {
      'name': 'Pau_Cin_Hau',
      'astral': "\uD806[\uDEC0-\uDEF8]"
    }, {
      'name': 'Phags_Pa',
      'bmp': "\uA840-\uA877"
    }, {
      'name': 'Phoenician',
      'astral': "\uD802[\uDD00-\uDD1B\uDD1F]"
    }, {
      'name': 'Psalter_Pahlavi',
      'astral': "\uD802[\uDF80-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]"
    }, {
      'name': 'Rejang',
      'bmp': "\uA930-\uA953\uA95F"
    }, {
      'name': 'Runic',
      'bmp': "\u16A0-\u16EA\u16EE-\u16F8"
    }, {
      'name': 'Samaritan',
      'bmp': "\u0800-\u082D\u0830-\u083E"
    }, {
      'name': 'Saurashtra',
      'bmp': "\uA880-\uA8C5\uA8CE-\uA8D9"
    }, {
      'name': 'Sharada',
      'astral': "\uD804[\uDD80-\uDDDF]"
    }, {
      'name': 'Shavian',
      'astral': "\uD801[\uDC50-\uDC7F]"
    }, {
      'name': 'Siddham',
      'astral': "\uD805[\uDD80-\uDDB5\uDDB8-\uDDDD]"
    }, {
      'name': 'SignWriting',
      'astral': "\uD836[\uDC00-\uDE8B\uDE9B-\uDE9F\uDEA1-\uDEAF]"
    }, {
      'name': 'Sinhala',
      'bmp': "\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4",
      'astral': "\uD804[\uDDE1-\uDDF4]"
    }, {
      'name': 'Sogdian',
      'astral': "\uD803[\uDF30-\uDF59]"
    }, {
      'name': 'Sora_Sompeng',
      'astral': "\uD804[\uDCD0-\uDCE8\uDCF0-\uDCF9]"
    }, {
      'name': 'Soyombo',
      'astral': "\uD806[\uDE50-\uDEA2]"
    }, {
      'name': 'Sundanese',
      'bmp': "\u1B80-\u1BBF\u1CC0-\u1CC7"
    }, {
      'name': 'Syloti_Nagri',
      'bmp': "\uA800-\uA82C"
    }, {
      'name': 'Syriac',
      'bmp': "\u0700-\u070D\u070F-\u074A\u074D-\u074F\u0860-\u086A"
    }, {
      'name': 'Tagalog',
      'bmp': "\u1700-\u1715\u171F"
    }, {
      'name': 'Tagbanwa',
      'bmp': "\u1760-\u176C\u176E-\u1770\u1772\u1773"
    }, {
      'name': 'Tai_Le',
      'bmp': "\u1950-\u196D\u1970-\u1974"
    }, {
      'name': 'Tai_Tham',
      'bmp': "\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD"
    }, {
      'name': 'Tai_Viet',
      'bmp': "\uAA80-\uAAC2\uAADB-\uAADF"
    }, {
      'name': 'Takri',
      'astral': "\uD805[\uDE80-\uDEB9\uDEC0-\uDEC9]"
    }, {
      'name': 'Tamil',
      'bmp': "\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BFA",
      'astral': "\uD807[\uDFC0-\uDFF1\uDFFF]"
    }, {
      'name': 'Tangsa',
      'astral': "\uD81A[\uDE70-\uDEBE\uDEC0-\uDEC9]"
    }, {
      'name': 'Tangut',
      'astral': "\uD81B\uDFE0|[\uD81C-\uD820][\uDC00-\uDFFF]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEFF]|\uD823[\uDD00-\uDD08]"
    }, {
      'name': 'Telugu',
      'bmp': "\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3C-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C5D\u0C60-\u0C63\u0C66-\u0C6F\u0C77-\u0C7F"
    }, {
      'name': 'Thaana',
      'bmp': "\u0780-\u07B1"
    }, {
      'name': 'Thai',
      'bmp': "\u0E01-\u0E3A\u0E40-\u0E5B"
    }, {
      'name': 'Tibetan',
      'bmp': "\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FD4\u0FD9\u0FDA"
    }, {
      'name': 'Tifinagh',
      'bmp': "\u2D30-\u2D67\u2D6F\u2D70\u2D7F"
    }, {
      'name': 'Tirhuta',
      'astral': "\uD805[\uDC80-\uDCC7\uDCD0-\uDCD9]"
    }, {
      'name': 'Toto',
      'astral': "\uD838[\uDE90-\uDEAE]"
    }, {
      'name': 'Ugaritic',
      'astral': "\uD800[\uDF80-\uDF9D\uDF9F]"
    }, {
      'name': 'Vai',
      'bmp': "\uA500-\uA62B"
    }, {
      'name': 'Vithkuqi',
      'astral': "\uD801[\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC]"
    }, {
      'name': 'Wancho',
      'astral': "\uD838[\uDEC0-\uDEF9\uDEFF]"
    }, {
      'name': 'Warang_Citi',
      'astral': "\uD806[\uDCA0-\uDCF2\uDCFF]"
    }, {
      'name': 'Yezidi',
      'astral': "\uD803[\uDE80-\uDEA9\uDEAB-\uDEAD\uDEB0\uDEB1]"
    }, {
      'name': 'Yi',
      'bmp': "\uA000-\uA48C\uA490-\uA4C6"
    }, {
      'name': 'Zanabazar_Square',
      'astral': "\uD806[\uDE00-\uDE47]"
    }];
    var scripts$1 = getDefaultExportFromCjs$1(scripts);
    var unicodeScripts = (function (XRegExp) {
      if (!XRegExp.addUnicodeData) {
        throw new ReferenceError('Unicode Base must be loaded before Unicode Scripts');
      }
      XRegExp.addUnicodeData(scripts$1, 'Script');
    });
    build(XRegExp);
    matchRecursive(XRegExp);
    unicodeBase(XRegExp);
    unicodeCategories(XRegExp);
    unicodeProperties(XRegExp);
    unicodeScripts(XRegExp);
    var toString = Object.prototype.toString;
    var kindOf = function kindOf(val) {
      if (val === void 0) return 'undefined';
      if (val === null) return 'null';
      var type = typeof val;
      if (type === 'boolean') return 'boolean';
      if (type === 'string') return 'string';
      if (type === 'number') return 'number';
      if (type === 'symbol') return 'symbol';
      if (type === 'function') {
        return isGeneratorFn(val) ? 'generatorfunction' : 'function';
      }
      if (isArray(val)) return 'array';
      if (isBuffer(val)) return 'buffer';
      if (isArguments(val)) return 'arguments';
      if (isDate(val)) return 'date';
      if (isError(val)) return 'error';
      if (isRegexp(val)) return 'regexp';
      switch (ctorName(val)) {
        case 'Symbol':
          return 'symbol';
        case 'Promise':
          return 'promise';
        case 'WeakMap':
          return 'weakmap';
        case 'WeakSet':
          return 'weakset';
        case 'Map':
          return 'map';
        case 'Set':
          return 'set';
        case 'Int8Array':
          return 'int8array';
        case 'Uint8Array':
          return 'uint8array';
        case 'Uint8ClampedArray':
          return 'uint8clampedarray';
        case 'Int16Array':
          return 'int16array';
        case 'Uint16Array':
          return 'uint16array';
        case 'Int32Array':
          return 'int32array';
        case 'Uint32Array':
          return 'uint32array';
        case 'Float32Array':
          return 'float32array';
        case 'Float64Array':
          return 'float64array';
      }
      if (isGeneratorObj(val)) {
        return 'generator';
      }
      type = toString.call(val);
      switch (type) {
        case '[object Object]':
          return 'object';
        case '[object Map Iterator]':
          return 'mapiterator';
        case '[object Set Iterator]':
          return 'setiterator';
        case '[object String Iterator]':
          return 'stringiterator';
        case '[object Array Iterator]':
          return 'arrayiterator';
      }
      return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
    };
    function ctorName(val) {
      return typeof val.constructor === 'function' ? val.constructor.name : null;
    }
    function isArray(val) {
      if (Array.isArray) return Array.isArray(val);
      return val instanceof Array;
    }
    function isError(val) {
      return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
    }
    function isDate(val) {
      if (val instanceof Date) return true;
      return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
    }
    function isRegexp(val) {
      if (val instanceof RegExp) return true;
      return typeof val.flags === 'string' && typeof val.ignoreCase === 'boolean' && typeof val.multiline === 'boolean' && typeof val.global === 'boolean';
    }
    function isGeneratorFn(name, val) {
      return ctorName(name) === 'GeneratorFunction';
    }
    function isGeneratorObj(val) {
      return typeof val.throw === 'function' && typeof val.return === 'function' && typeof val.next === 'function';
    }
    function isArguments(val) {
      try {
        if (typeof val.length === 'number' && typeof val.callee === 'function') {
          return true;
        }
      } catch (err) {
        if (err.message.indexOf('callee') !== -1) {
          return true;
        }
      }
      return false;
    }
    function isBuffer(val) {
      if (val.constructor && typeof val.constructor.isBuffer === 'function') {
        return val.constructor.isBuffer(val);
      }
      return false;
    }
    var valueOf = Symbol.prototype.valueOf;
    var typeOf$1 = kindOf;
    function clone$2(val, deep) {
      switch (typeOf$1(val)) {
        case 'array':
          return val.slice();
        case 'object':
          return Object.assign({}, val);
        case 'date':
          return new val.constructor(Number(val));
        case 'map':
          return new Map(val);
        case 'set':
          return new Set(val);
        case 'buffer':
          return cloneBuffer(val);
        case 'symbol':
          return cloneSymbol(val);
        case 'arraybuffer':
          return cloneArrayBuffer(val);
        case 'float32array':
        case 'float64array':
        case 'int16array':
        case 'int32array':
        case 'int8array':
        case 'uint16array':
        case 'uint32array':
        case 'uint8clampedarray':
        case 'uint8array':
          return cloneTypedArray(val);
        case 'regexp':
          return cloneRegExp(val);
        case 'error':
          return Object.create(val);
        default:
          {
            return val;
          }
      }
    }
    function cloneRegExp(val) {
      var flags = val.flags !== void 0 ? val.flags : /\w+$/.exec(val) || void 0;
      var re = new val.constructor(val.source, flags);
      re.lastIndex = val.lastIndex;
      return re;
    }
    function cloneArrayBuffer(val) {
      var res = new val.constructor(val.byteLength);
      new Uint8Array(res).set(new Uint8Array(val));
      return res;
    }
    function cloneTypedArray(val, deep) {
      return new val.constructor(val.buffer, val.byteOffset, val.length);
    }
    function cloneBuffer(val) {
      var len = val.length;
      var buf = Buffer.allocUnsafe ? Buffer.allocUnsafe(len) : Buffer.from(len);
      val.copy(buf);
      return buf;
    }
    function cloneSymbol(val) {
      return valueOf ? Object(valueOf.call(val)) : {};
    }
    var shallowClone = clone$2;
    var isobject = function isObject(val) {
      return val != null && typeof val === 'object' && Array.isArray(val) === false;
    };
    var isObject$3 = isobject;
    function isObjectObject(o) {
      return isObject$3(o) === true && Object.prototype.toString.call(o) === '[object Object]';
    }
    var isPlainObject$1 = function isPlainObject(o) {
      var ctor, prot;
      if (isObjectObject(o) === false) return false;
      ctor = o.constructor;
      if (typeof ctor !== 'function') return false;
      prot = ctor.prototype;
      if (isObjectObject(prot) === false) return false;
      if (prot.hasOwnProperty('isPrototypeOf') === false) {
        return false;
      }
      return true;
    };
    var clone$1 = shallowClone;
    var typeOf = kindOf;
    var isPlainObject = isPlainObject$1;
    function cloneDeep(val, instanceClone) {
      switch (typeOf(val)) {
        case 'object':
          return cloneObjectDeep(val, instanceClone);
        case 'array':
          return cloneArrayDeep(val, instanceClone);
        default:
          {
            return clone$1(val);
          }
      }
    }
    function cloneObjectDeep(val, instanceClone) {
      if (typeof instanceClone === 'function') {
        return instanceClone(val);
      }
      if (instanceClone || isPlainObject(val)) {
        var res = new val.constructor();
        for (var key in val) {
          res[key] = cloneDeep(val[key], instanceClone);
        }
        return res;
      }
      return val;
    }
    function cloneArrayDeep(val, instanceClone) {
      var res = new val.constructor(val.length);
      for (var i = 0; i < val.length; i++) {
        res[i] = cloneDeep(val[i], instanceClone);
      }
      return res;
    }
    var cloneDeep_1 = cloneDeep;
    var cloneDeep$1 = getDefaultExportFromCjs$1(cloneDeep_1);
    var compatibilityTableData$1 = {};
    Object.defineProperty(compatibilityTableData$1, '__esModule', {
      value: true
    });
    var modifiersCompatibilityTableData = {
      shared: [{
        shared: [{
          name: "all",
          aliases: null,
          description: "$all modifier is made of $document, $popup, and all content-type modifiers combined.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#all-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: true,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "all",
          aliases: null,
          description: "The `all` option is equivalent to specifying all network-based types\n+ `popup`, `document`, `inline-font` and `inline-script`.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#all",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "app",
          aliases: null,
          description: "The `$app` modifier lets you narrow the rule coverage down to a specific application or a list of applications.\nThe modifier's behavior and syntax perfectly match the corresponding basic rules `$app` modifier.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#app-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "pipe_separated_apps"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0
        }
      }, {
        shared: [{
          name: "badfilter",
          aliases: null,
          description: "The rules with the `$badfilter` modifier disable other basic rules to which they refer. It means that\nthe text of the disabled rule should match the text of the `$badfilter` rule (without the `$badfilter` modifier).",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#badfilter-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "badfilter",
          aliases: null,
          description: "The rules with the `$badfilter` modifier disable other basic rules to which they refer. It means that\nthe text of the disabled rule should match the text of the `$badfilter` rule (without the `$badfilter` modifier).",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#badfilter",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "cname",
          aliases: null,
          description: "When used in an exception filter,\nit will bypass blocking CNAME uncloaked requests for the current (specified) document.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#cname",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1024": 0,
          "2048": 0,
          "4096": 0,
          "8192": 0
        }
      }, {
        shared: [{
          name: "content",
          aliases: null,
          description: "Disables HTML filtering and `$replace` rules on the pages that match the rule.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#content-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0
        }
      }, {
        shared: [{
          name: "cookie",
          aliases: null,
          description: "The `$cookie` modifier completely changes rule behavior.\nInstead of blocking a request, this modifier makes us suppress or modify the Cookie and Set-Cookie headers.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#cookie-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "^([^;=\\s]*?)((?:;(maxAge=\\d+;?)?|(sameSite=(lax|none|strict);?)?){1,3})(?<!;)$"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "csp",
          aliases: null,
          description: "This modifier completely changes the rule behavior.\nIf it is applied to a rule, it will not block the matching request.\nThe response headers are going to be modified instead.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#csp-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "important", "subdocument", "badfilter"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "csp_value"
        }, {
          name: "csp",
          aliases: null,
          description: "This modifier completely changes the rule behavior.\nIf it is applied to a rule, it will not block the matching request.\nThe response headers are going to be modified instead.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#csp",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["1p", "3p", "domain", "badfilter"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "csp_value"
        }, {
          name: "csp",
          aliases: null,
          description: "This modifier completely changes the rule behavior.\nIf it is applied to a rule, it will not block the matching request.\nThe response headers are going to be modified instead.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#content-security-policies",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "subdocument"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "csp_value"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "denyallow",
          aliases: null,
          description: "The `$denyallow` modifier allows to avoid creating additional rules\nwhen it is needed to disable a certain rule for specific domains.\n`$denyallow` matches only target domains and not referrer domains.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#denyallow-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["to"],
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "pipe_separated_denyallow_domains"
        }, {
          name: "denyallow",
          aliases: null,
          description: "The `$denyallow` modifier allows to avoid creating additional rules\nwhen it is needed to disable a certain rule for specific domains.\n`$denyallow` matches only target domains and not referrer domains.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#denyallow",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["to"],
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "pipe_separated_denyallow_domains"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "document",
          aliases: null,
          description: "The rule corresponds to the main frame document requests,\ni.e. HTML documents that are loaded in the browser tab.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#document-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "document",
          aliases: null,
          description: "The rule corresponds to the main frame document requests,\ni.e. HTML documents that are loaded in the browser tab.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#document-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "document",
          aliases: null,
          description: "The rule corresponds to the main frame document requests,\ni.e. HTML documents that are loaded in the browser tab.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#document-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "document",
          aliases: null,
          description: "The rule corresponds to the main frame document requests,\ni.e. HTML documents that are loaded in the browser tab.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#document-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "document",
          aliases: ["doc"],
          description: "The rule corresponds to the main frame document requests,\ni.e. HTML documents that are loaded in the browser tab.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#document",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "document",
          aliases: null,
          description: "The rule corresponds to the main frame document requests,\ni.e. HTML documents that are loaded in the browser tab.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#allowlist",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "256": 2,
          "512": 3,
          "1024": 4,
          "2048": 4,
          "4096": 4,
          "8192": 4,
          "16384": 5,
          "32768": 5,
          "65536": 5,
          "131072": 5
        }
      }, {
        shared: [{
          name: "domain",
          aliases: ["from"],
          description: "The `$domain` modifier limits the rule application area to a list of domains and their subdomains.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#domain-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "pipe_separated_domains"
        }, {
          name: "domain",
          aliases: ["from"],
          description: "The `$domain` modifier limits the rule application area to a list of domains and their subdomains.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#from",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "pipe_separated_domains"
        }, {
          name: "domain",
          aliases: null,
          description: "The `$domain` modifier limits the rule application area to a list of domains and their subdomains.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#domain-restrictions",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "pipe_separated_domains"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "elemhide",
          aliases: ["ehide"],
          description: "Disables any cosmetic rules on the pages matching the rule.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#elemhide-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "elemhide",
          aliases: ["ehide"],
          description: "Disables any cosmetic rules on the pages matching the rule.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#elemhide-1",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "elemhide",
          aliases: ["ehide"],
          description: "Disables any cosmetic rules on the pages matching the rule.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "empty",
          aliases: null,
          description: "This modifier is deprecated in favor of the $redirect modifier.\nRules with `$empty` are still supported and being converted into `$redirect=nooptext` now\nbut the support shall be removed in the future.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#empty-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: true,
          deprecationMessage: "Rules with `$empty` are still supported and being converted into `$redirect=nooptext` now\nbut the support shall be removed in the future.",
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "empty",
          aliases: null,
          description: "This modifier is deprecated in favor of the $redirect modifier.\nRules with `$empty` are still supported and being converted into `$redirect=nooptext` now\nbut the support shall be removed in the future.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#empty-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: true,
          deprecationMessage: "Rules with `$empty` are still supported and being converted into `$redirect=nooptext` now\nbut the support shall be removed in the future.",
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "empty",
          aliases: null,
          description: "This modifier is deprecated in favor of the $redirect modifier.\nRules with `$empty` are supported and being converted into `$redirect=nooptext`.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#empty",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "1024": 2,
          "2048": 2,
          "4096": 2,
          "8192": 2
        }
      }, {
        shared: [{
          name: "extension",
          aliases: null,
          description: "Disables all userscripts on the pages matching this rule.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#extension-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "specifichide", "generichide", "elemhide", "genericblock", "urlblock", "jsinject", "content", "xmlhttprequest", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0
        }
      }, {
        shared: [{
          name: "first-party",
          aliases: ["1p", "~third-party"],
          description: "A restriction of first-party requests. Equal to `~third-party`.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#third-party-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "first-party",
          aliases: ["1p", "~third-party"],
          description: "A restriction of first-party requests. Equal to `~third-party`.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#1p",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "font",
          aliases: null,
          description: "The rule corresponds to requests for fonts, e.g. `.woff` filename extension.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#font-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "font",
          aliases: null,
          description: "The rule corresponds to requests for fonts, e.g. `.woff` filename extension.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "font",
          aliases: null,
          description: "The rule corresponds to requests for fonts, e.g. `.woff` filename extension.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "genericblock",
          aliases: null,
          description: "Disables generic basic rules on pages that correspond to exception rule.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#genericblock-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "specifichide", "generichide", "elemhide", "extension", "jsinject", "content", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "genericblock",
          aliases: null,
          description: "Disables generic basic rules on pages that correspond to exception rule.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#genericblock-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "specifichide", "generichide", "elemhide", "jsinject", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "genericblock",
          aliases: null,
          description: "Disables generic basic rules on pages that correspond to exception rule.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#genericblock-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "specifichide", "generichide", "elemhide", "jsinject", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "genericblock",
          aliases: null,
          description: "Disables generic basic rules on pages that correspond to exception rule.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#genericblock-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "specifichide", "generichide", "elemhide", "jsinject", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "genericblock",
          aliases: null,
          description: "Disables generic basic rules on pages that correspond to exception rule.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "256": 2,
          "512": 3,
          "16384": 4,
          "32768": 4,
          "65536": 4,
          "131072": 4
        }
      }, {
        shared: [{
          name: "generichide",
          aliases: ["ghide"],
          description: "Disables all generic cosmetic rules.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#generichide-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "genericblock", "urlblock", "extension", "jsinject", "content", "xmlhttprequest", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "generichide",
          aliases: ["ghide"],
          description: "Disables all generic cosmetic rules.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#generichide",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "generichide",
          aliases: null,
          description: "Disables all generic cosmetic rules.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "header",
          aliases: null,
          description: "The `$header` modifier allows matching the HTTP response\nhaving a specific header with (optionally) a specific value.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#header-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "(?xi)\n  ^\n    # header name\n    [\\w-]+\n    (\n      :\n      # header value: string or regexp\n      (\\w+|\\/.+\\/)\n    )?"
        }, {
          name: "header",
          aliases: null,
          description: "The `$header` modifier allows matching the HTTP response\nhaving a specific header with (optionally) a specific value.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#header-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "(?xi)\n  ^\n    # header name\n    [\\w-]+\n    (\n      :\n      # header value: string or regexp\n      (\\w+|\\/.+\\/)\n    )?"
        }, {
          name: "header",
          aliases: null,
          description: "The `$header` modifier allows matching the HTTP response\nhaving a specific header with (optionally) a specific value.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#header",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "(?xi)\n  ^\n    # header name\n    [\\w-]+\n    (\n      :\n      # header value: string or regexp\n      (\\w+|\\/.+\\/)\n    )?"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "1024": 2,
          "2048": 2,
          "4096": 2,
          "8192": 2
        }
      }, {
        shared: [{
          name: "hls",
          aliases: null,
          description: "The `$hls` rules modify the response of a matching request.\nThey are intended as a convenient way to remove segments from HLS playlists (RFC 8216).",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#hls-modifier",
          versionAdded: "CoreLibs 1.10",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "third-party", "app", "important", "match-case", "xmlhttprequest"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "(?xi)\n  (\n    # string pattern\n    \\w+\n    # or regexp pattern\n    |\n    # TODO: improve regexp pattern to invalidate unescaped `/`, `$`, and `,`\n    \\/.+\\/\n      # options\n      ([ti]*)?\n  )"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0
        }
      }, {
        shared: [{
          name: "image",
          aliases: null,
          description: "The rule corresponds to images requests.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#image-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "image",
          aliases: null,
          description: "The rule corresponds to images requests.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "image",
          aliases: null,
          description: "The rule corresponds to images requests.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "important",
          aliases: null,
          description: "The `$important` modifier applied to a rule increases its priority\nover any other rule without `$important` modifier. Even over basic exception rules.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#important-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "important",
          aliases: null,
          description: "The `$important` modifier applied to a rule increases its priority\nover any other rule without `$important` modifier. Even over basic exception rules.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#important",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "inline-font",
          aliases: null,
          description: "The `$inline-font` modifier is a sort of a shortcut for $csp modifier with specific value.\nE.g. `||example.org^$inline-font` is converting into:\n```adblock\n||example.org^$csp=font-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:\n```",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#inline-font-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "inline-font",
          aliases: null,
          description: "The `$inline-font` modifier is a sort of a shortcut for $csp modifier with specific value.\nE.g. `||example.org^$inline-font` is converting into:\n```adblock\n||example.org^$csp=font-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:\n```",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#inline-font-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "inline-font",
          aliases: null,
          description: "The `$inline-font` modifier is a sort of a shortcut for $csp modifier with specific value.\nE.g. `||example.org^$inline-font` is converting into:\n```adblock\n||example.org^$csp=font-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:\n```",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#inline-font",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "1024": 2,
          "2048": 2,
          "4096": 2,
          "8192": 2
        }
      }, {
        shared: [{
          name: "inline-script",
          aliases: null,
          description: "The `$inline-script` modifier is a sort of a shortcut for $csp modifier with specific value.\nE.g. `||example.org^$inline-script` is converting into:\n```adblock\n||example.org^$csp=script-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:\n```",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#inline-script-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "inline-script",
          aliases: null,
          description: "The `$inline-script` modifier is a sort of a shortcut for $csp modifier with specific value.\nE.g. `||example.org^$inline-script` is converting into:\n```adblock\n||example.org^$csp=script-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:\n```",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#inline-script-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "inline-script",
          aliases: null,
          description: "The `$inline-script` modifier is a sort of a shortcut for $csp modifier with specific value.\nE.g. `||example.org^$inline-script` is converting into:\n```adblock\n||example.org^$csp=script-src 'self' 'unsafe-eval' http: https: data: blob: mediastream: filesystem:\n```",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#inline-script",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "1024": 2,
          "2048": 2,
          "4096": 2,
          "8192": 2
        }
      }, {
        shared: [{
          name: "jsinject",
          aliases: null,
          description: "Forbids adding of javascript code to the page.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#jsinject-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "specifichide", "generichide", "elemhide", "genericblock", "urlblock", "extension", "content", "xmlhttprequest", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "jsinject",
          aliases: null,
          description: "Forbids adding of javascript code to the page.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#jsinject-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "specifichide", "generichide", "elemhide", "genericblock", "urlblock", "xmlhttprequest", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "jsinject",
          aliases: null,
          description: "Forbids adding of javascript code to the page.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#jsinject-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "specifichide", "generichide", "elemhide", "genericblock", "urlblock", "xmlhttprequest", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "jsinject",
          aliases: null,
          description: "Forbids adding of javascript code to the page.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#jsinject-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "specifichide", "generichide", "elemhide", "genericblock", "urlblock", "xmlhttprequest", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "256": 2,
          "512": 3
        }
      }, {
        shared: [{
          name: "jsonprune",
          aliases: null,
          description: "The `$jsonprune` rules modify the response to a matching request\nby removing JSON items that match a modified JSONPath expression.\nThey do not modify responses which are not valid JSON documents.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#jsonprune-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "(?xi)\n  ^\n    # the expression always starts with a dollar sign (for root)\n    # which should be escaped\n    \\\\\n    \\$\n    \\.?\n    # TODO: improve the expression to invalidate unescaped `$` and `,`\n    .+\n  $"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0
        }
      }, {
        shared: [{
          name: "match-case",
          aliases: null,
          description: "This modifier defines a rule which applies only to addresses that match the case.\nDefault rules are case-insensitive.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#match-case-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "match-case",
          aliases: null,
          description: "This modifier defines a rule which applies only to addresses that match the case.\nDefault rules are case-insensitive.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#match-case",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "match-case",
          aliases: null,
          description: "This modifier defines a rule which applies only to addresses that match the case.\nDefault rules are case-insensitive.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "media",
          aliases: null,
          description: "A restriction of third-party and own requests.\nA third-party request is a request from a different domain.\nFor example, a request to `example.org` from `domain.com` is a third-party request.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#media-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "media",
          aliases: null,
          description: "A restriction of third-party and own requests.\nA third-party request is a request from a different domain.\nFor example, a request to `example.org` from `domain.com` is a third-party request.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "media",
          aliases: null,
          description: "A restriction of third-party and own requests.\nA third-party request is a request from a different domain.\nFor example, a request to `example.org` from `domain.com` is a third-party request.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "method",
          aliases: null,
          description: "This modifier limits the rule scope to requests that use the specified set of HTTP methods.\nNegated methods are allowed.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#method-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "pipe_separated_methods"
        }, {
          name: "method",
          aliases: null,
          description: "This modifier limits the rule scope to requests that use the specified set of HTTP methods.\nNegated methods are allowed.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#method-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "pipe_separated_methods"
        }, {
          name: "method",
          aliases: null,
          description: "This modifier limits the rule scope to requests that use the specified set of HTTP methods.\nNegated methods are allowed.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#method",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "pipe_separated_methods"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "1024": 2,
          "2048": 2,
          "4096": 2,
          "8192": 2
        }
      }, {
        shared: [{
          name: "mp4",
          aliases: null,
          description: "As a response to blocked request AdGuard returns a short video placeholder.\nRules with `$mp4` are still supported and being converted into `$redirect=noopmp4-1s` now\nbut the support shall be removed in the future.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#mp4-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: true,
          deprecationMessage: "Rules with `$mp4` are still supported and being converted into `$redirect=noopmp4-1s` now\nbut the support shall be removed in the future.",
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "mp4",
          aliases: null,
          description: "As a response to blocked request AdGuard returns a short video placeholder.\nRules with `$mp4` are still supported and being converted into `$redirect=noopmp4-1s` now\nbut the support shall be removed in the future.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#mp4-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: true,
          deprecationMessage: "Rules with `$mp4` are still supported and being converted into `$redirect=noopmp4-1s` now\nbut the support shall be removed in the future.",
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "mp4",
          aliases: null,
          description: "As a response to blocked request a short video placeholder is returned.\nRules with `$mp4` are supported and being converted into `$redirect=noopmp4-1s`.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#mp4",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "1024": 2,
          "2048": 2,
          "4096": 2,
          "8192": 2
        }
      }, {
        shared: [{
          name: "network",
          aliases: null,
          description: "This is basically a Firewall-kind of rules allowing to fully block\nor unblock access to a specified remote address.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#network-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["app", "important"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0
        }
      }, {
        shared: [{
          name: "_",
          aliases: null,
          description: "The noop modifier does nothing and can be used solely to increase rules' readability.\nIt consists of a sequence of underscore characters (_) of any length\nand can appear in a rule as many times as needed.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#noop-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "_",
          aliases: null,
          description: "The noop modifier does nothing and can be used solely to increase rules' readability.\nIt consists of a sequence of underscore characters (_) of any length\nand can appear in a rule as many times as needed.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#noop-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "_",
          aliases: null,
          description: "The noop modifier does nothing and can be used solely to increase rules' readability.\nIt consists of a sequence of underscore characters (_) of any length\nand can appear in a rule as many times as needed.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#noop-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "_",
          aliases: null,
          description: "The noop modifier does nothing and can be used solely to increase rules' readability.\nIt consists of a sequence of underscore characters (_) of any length\nand can appear in a rule as many times as needed.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#noop-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "_",
          aliases: null,
          description: "The noop modifier does nothing and can be used solely to increase rules' readability.\nIt consists of a sequence of underscore characters (_) of any length\nand can appear in a rule as many times as needed.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#_-aka-noop",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "256": 2,
          "512": 3,
          "1024": 4,
          "2048": 4,
          "4096": 4,
          "8192": 4
        }
      }, {
        shared: [{
          name: "object-subrequest",
          aliases: null,
          description: "The `$object-subrequest` modifier is removed and is no longer supported.\nRules with it are considered as invalid.\nThe rule corresponds to requests by browser plugins (it is usually Flash).",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#object-subrequest-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: true,
          removalMessage: "The `$object-subrequest` modifier is removed and is no longer supported.\nRules with it are considered as invalid.",
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0
        }
      }, {
        shared: [{
          name: "object",
          aliases: null,
          description: "The rule corresponds to browser plugins resources, e.g. Java or Flash",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#object-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "object",
          aliases: null,
          description: "The rule corresponds to browser plugins resources, e.g. Java or Flash.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "object",
          aliases: null,
          description: "The rule corresponds to browser plugins resources, e.g. Java or Flash.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "other",
          aliases: null,
          description: "The rule applies to requests for which the type has not been determined\nor does not match the types listed above.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#other-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "other",
          aliases: null,
          description: "The rule applies to requests for which the type has not been determined\nor does not match the types listed above.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "other",
          aliases: null,
          description: "The rule applies to requests for which the type has not been determined\nor does not match the types listed above.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "permissions",
          aliases: null,
          description: "For the requests matching a `$permissions` rule, ad blocker strengthens response's feature policy\nby adding additional feature policy equal to the `$permissions` modifier contents.\n`$permissions` rules are applied independently from any other rule type.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#permissions-modifier",
          versionAdded: "CoreLibs 1.11",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "important", "subdocument"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "permissions_value"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0
        }
      }, {
        shared: [{
          name: "ping",
          aliases: null,
          description: "The rule corresponds to requests caused by either navigator.sendBeacon() or the ping attribute on links.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#ping-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "ping",
          aliases: null,
          description: "The rule corresponds to requests caused by either navigator.sendBeacon() or the ping attribute on links.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "ping",
          aliases: null,
          description: "The rule corresponds to requests caused by either navigator.sendBeacon() or the ping attribute on links.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "popunder",
          aliases: null,
          description: "To block \"popunders\" windows/tabs where the original page redirects to an advertisement\nand the desired content loads in the newly created one.\nTo be used in the same manner as the popup filter option, except that it will block popunders.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#popunder",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: true,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1024": 0,
          "2048": 0,
          "4096": 0,
          "8192": 0
        }
      }, {
        shared: [{
          name: "popup",
          aliases: null,
          description: "Pages opened in a new tab or window.\nNote: Filters will not block pop-ups by default, only if the `$popup`  type option is specified.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#popup-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "popup",
          aliases: null,
          description: "Pages opened in a new tab or window.\nNote: Filters will not block pop-ups by default, only if the `$popup`  type option is specified.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "popup",
          aliases: null,
          description: "Pages opened in a new tab or window.\nNote: Filters will not block pop-ups by default, only if the `$popup`  type option is specified.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "redirect-rule",
          aliases: null,
          description: "This is basically an alias to `$redirect`\nsince it has the same \"redirection\" values and the logic is almost similar.\nThe difference is that `$redirect-rule` is applied only in the case\nwhen the target request is blocked by a different basic rule.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#redirect-rule-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "to", "third-party", "popup", "match-case", "header", "first-party", "document", "image", "stylesheet", "script", "object", "font", "media", "subdocument", "ping", "xmlhttprequest", "websocket", "other", "webrtc", "important", "badfilter", "app"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "(?x)\n  ^(\n    1x1-transparent\\.gif|\n    2x2-transparent\\.png|\n    3x2-transparent\\.png|\n    32x32-transparent\\.png|\n    noopframe|\n    noopcss|\n    noopjs|\n    noopjson|\n    nooptext|\n    empty|\n    noopvmap-1\\.0|\n    noopvast-2\\.0|\n    noopvast-3\\.0|\n    noopvast-4\\.0|\n    noopmp3-0\\.1s|\n    noopmp4-1s|\n    amazon-apstag|\n    ati-smarttag|\n    didomi-loader|\n    fingerprintjs2|\n    fingerprintjs3|\n    gemius|\n    google-analytics-ga|\n    google-analytics|\n    google-ima3|\n    googlesyndication-adsbygoogle|\n    googletagservices-gpt|\n    matomo|\n    metrika-yandex-tag|\n    metrika-yandex-watch|\n    naver-wcslog|\n    noeval|\n    pardot-1\\.0|\n    prebid-ads|\n    prebid|\n    prevent-bab|\n    prevent-bab2|\n    prevent-fab-3\\.2\\.0|\n    prevent-popads-net|\n    scorecardresearch-beacon|\n    set-popads-dummy|\n    click2load\\.html|\n  )?$"
        }, {
          name: "redirect-rule",
          aliases: null,
          description: "This is basically an alias to `$redirect`\nsince it has the same \"redirection\" values and the logic is almost similar.\nThe difference is that `$redirect-rule` is applied only in the case\nwhen the target request is blocked by a different basic rule.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#redirect-rule-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "to", "third-party", "popup", "match-case", "header", "first-party", "document", "image", "stylesheet", "script", "object", "font", "media", "subdocument", "ping", "xmlhttprequest", "websocket", "other", "webrtc", "important", "badfilter"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "(?x)\n  ^(\n    1x1-transparent\\.gif|\n    2x2-transparent\\.png|\n    3x2-transparent\\.png|\n    32x32-transparent\\.png|\n    noopframe|\n    noopcss|\n    noopjs|\n    noopjson|\n    nooptext|\n    empty|\n    noopvmap-1\\.0|\n    noopvast-2\\.0|\n    noopvast-3\\.0|\n    noopvast-4\\.0|\n    noopmp3-0\\.1s|\n    noopmp4-1s|\n    amazon-apstag|\n    ati-smarttag|\n    didomi-loader|\n    fingerprintjs2|\n    fingerprintjs3|\n    gemius|\n    google-analytics-ga|\n    google-analytics|\n    google-ima3|\n    googlesyndication-adsbygoogle|\n    googletagservices-gpt|\n    matomo|\n    metrika-yandex-tag|\n    metrika-yandex-watch|\n    naver-wcslog|\n    noeval|\n    pardot-1\\.0|\n    prebid-ads|\n    prebid|\n    prevent-bab|\n    prevent-bab2|\n    prevent-fab-3\\.2\\.0|\n    prevent-popads-net|\n    scorecardresearch-beacon|\n    set-popads-dummy|\n    click2load\\.html|\n  )?$"
        }, {
          name: "redirect-rule",
          aliases: null,
          description: "This is basically an alias to `$redirect`\nsince it has the same \"redirection\" values and the logic is almost similar.\nThe difference is that `$redirect-rule` is applied only in the case\nwhen the target request is blocked by a different basic rule.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#redirect-rule",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "to", "third-party", "popup", "match-case", "header", "first-party", "document", "image", "stylesheet", "script", "object", "font", "media", "subdocument", "ping", "xmlhttprequest", "websocket", "other", "webrtc", "important", "badfilter"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "(?x)\n  ^(\n    1x1\\.gif|\n    2x2\\.png|\n    3x2\\.png|\n    32x32\\.png|\n    noop\\.css|\n    noop\\.html|\n    noopframe|\n    noop\\.js|\n    noop\\.txt|\n    noop-0\\.1s\\.mp3|\n    noop-0\\.5s\\.mp3|\n    noop-1s\\.mp4|\n    none|\n    click2load\\.html|\n    addthis_widget\\.js|\n    amazon_ads\\.js|\n    amazon_apstag\\.js|\n    monkeybroker\\.js|\n    doubleclick_instream_ad_status|\n    google-analytics_ga\\.js|\n    google-analytics_analytics\\.js|\n    google-analytics_inpage_linkid\\.js|\n    google-analytics_cx_api\\.js|\n    google-ima\\.js|\n    googletagservices_gpt\\.js|\n    googletagmanager_gtm\\.js|\n    googlesyndication_adsbygoogle\\.js|\n    scorecardresearch_beacon\\.js|\n    outbrain-widget\\.js|\n    hd-main\\.js\n  )\n  (:[0-9]+)?$"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "1024": 2,
          "2048": 2,
          "4096": 2,
          "8192": 2
        }
      }, {
        shared: [{
          name: "redirect",
          aliases: null,
          description: "Used to redirect web requests to a local \"resource\".",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#redirect-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "(?x)\n  ^(\n    1x1-transparent\\.gif|\n    2x2-transparent\\.png|\n    3x2-transparent\\.png|\n    32x32-transparent\\.png|\n    noopframe|\n    noopcss|\n    noopjs|\n    noopjson|\n    nooptext|\n    empty|\n    noopvmap-1\\.0|\n    noopvast-2\\.0|\n    noopvast-3\\.0|\n    noopvast-4\\.0|\n    noopmp3-0\\.1s|\n    noopmp4-1s|\n    amazon-apstag|\n    ati-smarttag|\n    didomi-loader|\n    fingerprintjs2|\n    fingerprintjs3|\n    gemius|\n    google-analytics-ga|\n    google-analytics|\n    googletagmanager-gtm|\n    google-ima3|\n    googlesyndication-adsbygoogle|\n    googletagservices-gpt|\n    matomo|\n    metrika-yandex-tag|\n    metrika-yandex-watch|\n    naver-wcslog|\n    noeval|\n    pardot-1\\.0|\n    prebid-ads|\n    prebid|\n    prevent-bab|\n    prevent-bab2|\n    prevent-fab-3\\.2\\.0|\n    prevent-popads-net|\n    scorecardresearch-beacon|\n    set-popads-dummy|\n    click2load\\.html\n  )?$"
        }, {
          name: "redirect",
          aliases: null,
          description: "Used to redirect web requests to a local \"resource\".",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#redirect-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "(?x)\n  ^(\n    1x1-transparent\\.gif|\n    2x2-transparent\\.png|\n    3x2-transparent\\.png|\n    32x32-transparent\\.png|\n    noopframe|\n    noopcss|\n    noopjs|\n    noopjson|\n    nooptext|\n    empty|\n    noopvmap-1\\.0|\n    noopvast-2\\.0|\n    noopvast-3\\.0|\n    noopvast-4\\.0|\n    noopmp3-0\\.1s|\n    noopmp4-1s|\n    amazon-apstag|\n    ati-smarttag|\n    didomi-loader|\n    fingerprintjs2|\n    fingerprintjs3|\n    gemius|\n    google-analytics-ga|\n    google-analytics|\n    googletagmanager-gtm|\n    google-ima3|\n    googlesyndication-adsbygoogle|\n    googletagservices-gpt|\n    matomo|\n    metrika-yandex-tag|\n    metrika-yandex-watch|\n    naver-wcslog|\n    noeval|\n    pardot-1\\.0|\n    prebid-ads|\n    prebid|\n    prevent-bab|\n    prevent-bab2|\n    prevent-fab-3\\.2\\.0|\n    prevent-popads-net|\n    scorecardresearch-beacon|\n    set-popads-dummy|\n    click2load\\.html\n  )?$"
        }, {
          name: "redirect",
          aliases: null,
          description: "Used to redirect web requests to a local \"resource\".",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#redirect",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "(?x)\n  ^(\n    1x1\\.gif|\n    2x2\\.png|\n    3x2\\.png|\n    32x32\\.png|\n    noop\\.css|\n    noop\\.html|\n    noopframe|\n    noop\\.js|\n    noop\\.txt|\n    noop-0\\.1s\\.mp3|\n    noop-0\\.5s\\.mp3|\n    noop-1s\\.mp4|\n    none|\n    click2load\\.html|\n    addthis_widget\\.js|\n    amazon_ads\\.js|\n    amazon_apstag\\.js|\n    monkeybroker\\.js|\n    doubleclick_instream_ad_status|\n    google-analytics_ga\\.js|\n    google-analytics_analytics\\.js|\n    google-analytics_inpage_linkid\\.js|\n    google-analytics_cx_api\\.js|\n    google-ima\\.js|\n    googletagservices_gpt\\.js|\n    googletagmanager_gtm\\.js|\n    googlesyndication_adsbygoogle\\.js|\n    scorecardresearch_beacon\\.js|\n    outbrain-widget\\.js|\n    hd-main\\.js\n  )\n  (:[0-9]+)?$"
        }, {
          name: "rewrite",
          aliases: null,
          description: "The `rewrite=` option allows the rewriting of URLs (or redirecting requests) to an internal\nresource in order to deactivate it without causing an error. Indicate the internal resource\nby name and prefix `abp-resource:` in order to be recognized. For example\n`$rewrite=abp-resource:blank-js` sends an empty JavaScript.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "(?x)\n  # ABP resources always starts with the `abp-resource:` prefix\n  ^abp-resource:\n  # Possible resource names\n  (\n    blank-text|\n    blank-css|\n    blank-js|\n    blank-html|\n    blank-mp3|\n    1x1-transparent-gif|\n    2x2-transparent-png|\n    3x2-transparent-png|\n    32x32-transparent-png\n  )$"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "1024": 2,
          "2048": 2,
          "4096": 2,
          "8192": 2,
          "16384": 3,
          "32768": 3,
          "65536": 3,
          "131072": 3
        }
      }, {
        shared: [{
          name: "referrerpolicy",
          aliases: null,
          description: "This modifier allows overriding of a page's referrer policy.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#referrerpolicy-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["document", "subdocument"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "referrerpolicy_value"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0
        }
      }, {
        shared: [{
          name: "removeheader",
          aliases: null,
          description: "Rules with the `$removeheader` modifier are intended to remove headers from HTTP requests and responses.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#removeheader-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "third-party", "first-party", "app", "important", "match-case", "document", "image", "stylesheet", "script", "object", "font", "media", "subdocument", "ping", "xmlhttpreqeust", "websocket", "other", "webrtc"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "(?xi)\n  ^\n    # Value may start with \"request:\"\n    (request:)?\n\n    # Forbidden header names\n    (?!\n      (\n        access-control-allow-origin|\n        access-control-allow-credentials|\n        access-control-allow-headers|\n        access-control-allow-methods|\n        access-control-expose-headers|\n        access-control-max-age|\n        access-control-request-headers|\n        access-control-request-method|\n        origin|\n        timing-allow-origin|\n        allow|\n        cross-origin-embedder-policy|\n        cross-origin-opener-policy|\n        cross-origin-resource-policy|\n        content-security-policy|\n        content-security-policy-report-only|\n        expect-ct|\n        feature-policy|\n        origin-isolation|\n        strict-transport-security|\n        upgrade-insecure-requests|\n        x-content-type-options|\n        x-download-options|\n        x-frame-options|\n        x-permitted-cross-domain-policies|\n        x-powered-by|\n        x-xss-protection|\n        public-key-pins|\n        public-key-pins-report-only|\n        sec-websocket-key|\n        sec-websocket-extensions|\n        sec-websocket-accept|\n        sec-websocket-protocol|\n        sec-websocket-version|\n        p3p|\n        sec-fetch-mode|\n        sec-fetch-dest|\n        sec-fetch-site|\n        sec-fetch-user|\n        referrer-policy|\n        content-type|\n        content-length|\n        accept|\n        accept-encoding|\n        host|\n        connection|\n        transfer-encoding|\n        upgrade\n      )\n    $)\n\n    # Any other header name is allowed, if it matches the following regex\n    [A-z0-9-]+\n  $"
        }, {
          name: "removeheader",
          aliases: null,
          description: "Rules with the `$removeheader` modifier are intended to remove headers from HTTP requests and responses.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#removeheader-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "third-party", "first-party", "app", "important", "match-case", "document", "image", "stylesheet", "script", "object", "font", "media", "subdocument", "ping", "xmlhttpreqeust", "websocket", "other", "webrtc"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "(?xi)\n  ^\n    # Value may start with \"request:\"\n    (request:)?\n\n    # Forbidden header names\n    (?!\n      (\n        access-control-allow-origin|\n        access-control-allow-credentials|\n        access-control-allow-headers|\n        access-control-allow-methods|\n        access-control-expose-headers|\n        access-control-max-age|\n        access-control-request-headers|\n        access-control-request-method|\n        origin|\n        timing-allow-origin|\n        allow|\n        cross-origin-embedder-policy|\n        cross-origin-opener-policy|\n        cross-origin-resource-policy|\n        content-security-policy|\n        content-security-policy-report-only|\n        expect-ct|\n        feature-policy|\n        origin-isolation|\n        strict-transport-security|\n        upgrade-insecure-requests|\n        x-content-type-options|\n        x-download-options|\n        x-frame-options|\n        x-permitted-cross-domain-policies|\n        x-powered-by|\n        x-xss-protection|\n        public-key-pins|\n        public-key-pins-report-only|\n        sec-websocket-key|\n        sec-websocket-extensions|\n        sec-websocket-accept|\n        sec-websocket-protocol|\n        sec-websocket-version|\n        p3p|\n        sec-fetch-mode|\n        sec-fetch-dest|\n        sec-fetch-site|\n        sec-fetch-user|\n        referrer-policy|\n        content-type|\n        content-length|\n        accept|\n        accept-encoding|\n        host|\n        connection|\n        transfer-encoding|\n        upgrade\n      )\n    $)\n\n    # Any other header name is allowed, if it matches the following regex\n    [A-z0-9-]+\n  $"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1
        }
      }, {
        shared: [{
          name: "removeparam",
          aliases: null,
          description: "Rules with the `$removeparam` modifier are intended to strip query parameters from requests' URLs.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#removeparam-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "(?xi)\n  (\n    # string pattern\n    \\w+\n    # or regexp pattern\n    |\n    \\/.+\\/\n      # flags\n      ([gimuy]+)?\n  )"
        }, {
          name: "removeparam",
          aliases: null,
          description: "Rules with the `$removeparam` modifier are intended to strip query parameters from requests' URLs.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#removeparam-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: true,
          valueFormat: "(?xi)\n  (\n    # string pattern\n    \\w+\n    # or regexp pattern\n    |\n    \\/.+\\/\n      # flags\n      ([gimuy]+)?\n  )"
        }, {
          name: "removeparam",
          aliases: null,
          description: "Rules with the `$removeparam` modifier are intended to strip query parameters from requests' URLs.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#removeparam",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "(?xi)\n  (\n    # string pattern\n    \\w+\n    # or regexp pattern\n    |\n    \\/.+\\/\n      # flags\n      ([gimuy]+)?\n  )"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "1024": 2,
          "2048": 2,
          "4096": 2,
          "8192": 2
        }
      }, {
        shared: [{
          name: "replace",
          aliases: null,
          description: "This modifier completely changes the rule behavior.\nIf it is applied, the rule will not block the request. The response is going to be modified instead.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#replace-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["app", "domain", "document", "subdocument", "script", "stylesheet", "other", "xmlhttprequest", "first-party", "third-party", "important", "badfilter"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "(?xi)\n  ^\n    \\/\n      # the regexp to match by\n      (.+)\n    # separator\n    \\/\n      # replacement\n      (.+)?\n    \\/\n      # flags\n      ([gimuy]*)?\n  $"
        }, {
          name: "replace",
          aliases: null,
          description: "This modifier completely changes the rule behavior.\nIf it is applied, the rule will not block the request. The response is going to be modified instead.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#replace-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["app", "domain", "document", "subdocument", "script", "stylesheet", "other", "xmlhttprequest", "first-party", "third-party", "important", "badfilter"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "(?xi)\n  ^\n    \\/\n      # the regexp to match by\n      (.+)\n    # separator\n    \\/\n      # replacement\n      (.+)?\n    \\/\n      # flags\n      ([gimuy]*)?\n  $"
        }, {
          name: "replace",
          aliases: null,
          description: "This modifier completely changes the rule behavior.\nIf it is applied, the rule will not block the request. The response is going to be modified instead.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#replace",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["app", "domain", "document", "subdocument", "script", "stylesheet", "other", "xmlhttprequest", "first-party", "third-party", "important", "badfilter"],
          inverseConflicts: true,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "(?xi)\n  ^\n    \\/\n      # the regexp to match by\n      (.+)\n    # separator\n    \\/\n      # replacement\n      (.+)?\n    \\/\n      # flags\n      ([gimuy]*)?\n  $"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "64": 1,
          "8192": 2
        }
      }, {
        shared: [{
          name: "script",
          aliases: null,
          description: "The rule corresponds to script requests, e.g. javascript, vbscript.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#script-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "script",
          aliases: null,
          description: "The rule corresponds to script requests, e.g. javascript, vbscript.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "script",
          aliases: null,
          description: "The rule corresponds to script requests, e.g. javascript, vbscript.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "specifichide",
          aliases: ["shide"],
          description: "Disables all specific element hiding and CSS rules, but not general ones.\nHas an opposite effect to `$generichide`.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#specifichide-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "genericblock", "urlblock", "extension", "jsinject", "content", "xmlhttprequest", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "specifichide",
          aliases: ["shide"],
          description: "Disables all specific element hiding and CSS rules, but not general ones.\nHas an opposite effect to `$generichide`.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#specifichide",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "stealth",
          aliases: null,
          description: "Disables the Stealth Mode module for all corresponding pages and requests.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#stealth-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: true,
          valueFormat: "pipe_separated_stealth_options"
        }, {
          name: "stealth",
          aliases: null,
          description: "Disables the Stealth Mode module for all corresponding pages and requests.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#stealth-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: true,
          valueFormat: "pipe_separated_stealth_options"
        }, {
          name: "stealth",
          aliases: null,
          description: "Disables the Stealth Mode module for all corresponding pages and requests.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#stealth-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: true,
          valueFormat: "pipe_separated_stealth_options"
        }, {
          name: "stealth",
          aliases: null,
          description: "Disables the Stealth Mode module for all corresponding pages and requests.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#stealth-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: true,
          valueFormat: "pipe_separated_stealth_options"
        }, {
          name: "stealth",
          aliases: null,
          description: "Disables the Stealth Mode module for all corresponding pages and requests.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#stealth-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: true,
          valueFormat: "pipe_separated_stealth_options"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 2,
          "32": 3,
          "64": 4
        }
      }, {
        shared: [{
          name: "strict1p",
          aliases: null,
          description: "This new `strict1p` option can check for strict partyness.\nFor example, a network request qualifies as 1st-party if both the context and the request share the same hostname.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#strict1p",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1024": 0,
          "2048": 0,
          "4096": 0,
          "8192": 0
        }
      }, {
        shared: [{
          name: "strict3p",
          aliases: null,
          description: "This new `strict3p` option can check for strict partyness.\nFor example, a network request qualifies as 3rd-party if the context and the request hostnames are different.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#strict3p",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1024": 0,
          "2048": 0,
          "4096": 0,
          "8192": 0
        }
      }, {
        shared: [{
          name: "stylesheet",
          aliases: null,
          description: "The rule corresponds to CSS files requests.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#stylesheet-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "stylesheet",
          aliases: ["css"],
          description: "The rule corresponds to CSS files requests.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#css",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "stylesheet",
          aliases: null,
          description: "The rule corresponds to CSS files requests.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "subdocument",
          aliases: null,
          description: "The rule corresponds to requests for built-in pages — HTML tags frame and iframe.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#subdocument-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "subdocument",
          aliases: ["frame"],
          description: "The rule corresponds to requests for built-in pages — HTML tags frame and iframe.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#frame",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "subdocument",
          aliases: null,
          description: "The rule corresponds to requests for built-in pages — HTML tags frame and iframe.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "third-party",
          aliases: ["3p"],
          description: "A restriction of third-party and own requests.\nA third-party request is a request from a different domain.\nFor example, a request to `example.org` from `domain.com` is a third-party request.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#third-party-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "3p",
          aliases: ["third-party"],
          description: "A restriction of third-party and own requests.\nA third-party request is a request from a different domain.\nFor example, a request to `example.org` from `domain.com` is a third-party request.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#3p",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "third-party",
          aliases: null,
          description: "A restriction of third-party and own requests.\nA third-party request is a request from a different domain.\nFor example, a request to `example.org` from `domain.com` is a third-party request.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#party-requests",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "to",
          aliases: null,
          description: "`$to` limits the rule scope to requests made to the specified domains and their subdomains.\nTo add multiple domains to one rule, use the `|` character as a separator.",
          docs: "https://adguard.com/kb/general/ad-filtering/create-own-filters/#to-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["denyallow"],
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "pipe_separated_domains"
        }, {
          name: "to",
          aliases: null,
          description: "`$to` limits the rule scope to requests made to the specified domains and their subdomains.\nTo add multiple domains to one rule, use the `|` character as a separator.",
          docs: "https://adguard.com/kb/general/ad-filtering/create-own-filters/#to-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["denyallow"],
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "pipe_separated_domains"
        }, {
          name: "to",
          aliases: null,
          description: "The main motivation of this option is\nto give static network filtering engine an equivalent of DNR's `requestDomains` and `excludedRequestDomains`.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#to",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["denyallow"],
          inverseConflicts: false,
          assignable: true,
          negatable: false,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: "pipe_separated_domains"
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "1024": 2,
          "2048": 2,
          "4096": 2,
          "8192": 2
        }
      }, {
        shared: [{
          name: "urlblock",
          aliases: null,
          description: "Disables blocking of all requests sent from the pages matching the rule.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#urlblock-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: ["domain", "specifichide", "generichide", "elemhide", "extension", "jsinject", "content", "badfilter"],
          inverseConflicts: true,
          assignable: false,
          negatable: false,
          blockOnly: false,
          exceptionOnly: true,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0
        }
      }, {
        shared: [{
          name: "webrtc",
          aliases: null,
          description: "The rule applies only to WebRTC connections.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#webrtc-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: true,
          removalMessage: "This modifier is removed and is no longer supported.\nRules with it are considered as invalid. If you need to suppress WebRTC, consider using\nthe [nowebrtc scriptlet](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#nowebrtc).",
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "webrtc",
          aliases: null,
          description: "The rule applies only to WebRTC connections.",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: true,
          removalMessage: "This modifier is removed and is no longer supported.\nIf you need to suppress WebRTC, consider using\nthe [nowebrtc scriptlet](https://github.com/gorhill/uBlock/wiki/Resources-Library#nowebrtcjs-).",
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "webrtc",
          aliases: null,
          description: "The rule applies only to WebRTC connections.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: "1.13.3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "websocket",
          aliases: null,
          description: "The rule applies only to WebSocket connections.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#websocket-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "websocket",
          aliases: null,
          description: "The rule applies only to WebSocket connections.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#websocket-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "websocket",
          aliases: null,
          description: "The rule applies only to WebSocket connections.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#websocket-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "websocket",
          aliases: null,
          description: "The rule applies only to WebSocket connections.",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#websocket-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "websocket",
          aliases: null,
          description: "The rule applies only to WebSocket connections.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "websocket",
          aliases: null,
          description: "The rule applies only to WebSocket connections.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 1,
          "16": 1,
          "32": 1,
          "64": 1,
          "256": 2,
          "512": 3,
          "1024": 4,
          "2048": 4,
          "4096": 4,
          "8192": 4,
          "16384": 5,
          "32768": 5,
          "65536": 5,
          "131072": 5
        }
      }, {
        shared: [{
          name: "xmlhttprequest",
          aliases: ["xhr"],
          description: "The rule applies only to ajax requests (requests sent via javascript object XMLHttpRequest).",
          docs: "https://adguard.app/kb/general/ad-filtering/create-own-filters/#xmlhttprequest-modifier",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "xhr",
          aliases: ["xmlhttprequest"],
          description: "The rule applies only to ajax requests (requests sent via javascript object XMLHttpRequest).",
          docs: "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#xhr",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }, {
          name: "xmlhttprequest",
          aliases: null,
          description: "The rule applies only to ajax requests (requests sent via javascript object XMLHttpRequest).",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#type-options",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          conflicts: null,
          inverseConflicts: false,
          assignable: false,
          negatable: true,
          blockOnly: false,
          exceptionOnly: false,
          valueOptional: false,
          valueFormat: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "128": 0,
          "256": 0,
          "512": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }],
      map: {
        all: 0,
        app: 1,
        badfilter: 2,
        cname: 3,
        content: 4,
        cookie: 5,
        csp: 6,
        denyallow: 7,
        document: 8,
        doc: 8,
        domain: 9,
        from: 9,
        elemhide: 10,
        ehide: 10,
        empty: 11,
        extension: 12,
        "first-party": 13,
        "1p": 13,
        "~third-party": 13,
        font: 14,
        genericblock: 15,
        generichide: 16,
        ghide: 16,
        header: 17,
        hls: 18,
        image: 19,
        important: 20,
        "inline-font": 21,
        "inline-script": 22,
        jsinject: 23,
        jsonprune: 24,
        "match-case": 25,
        media: 26,
        method: 27,
        mp4: 28,
        network: 29,
        _: 30,
        "object-subrequest": 31,
        object: 32,
        other: 33,
        permissions: 34,
        ping: 35,
        popunder: 36,
        popup: 37,
        "redirect-rule": 38,
        redirect: 39,
        rewrite: 39,
        referrerpolicy: 40,
        removeheader: 41,
        removeparam: 42,
        replace: 43,
        script: 44,
        specifichide: 45,
        shide: 45,
        stealth: 46,
        strict1p: 47,
        strict3p: 48,
        stylesheet: 49,
        css: 49,
        subdocument: 50,
        frame: 50,
        "third-party": 51,
        "3p": 51,
        to: 52,
        urlblock: 53,
        webrtc: 54,
        websocket: 55,
        xmlhttprequest: 56,
        xhr: 56
      }
    };
    var redirectsCompatibilityTableData = {
      shared: [{
        shared: [{
          name: "1x1-transparent.gif",
          aliases: ["1x1.gif", "1x1-transparent-gif"],
          description: "Redirects to a 1x1 transparent GIF.",
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#1x1-transparent.gif",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "1x1.gif",
          aliases: null,
          description: "Redirects to a 1x1 transparent GIF.",
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#available-empty-redirect-resources",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["image"]
        }, {
          name: "1x1-transparent-gif",
          aliases: null,
          description: "Redirects to a 1x1 transparent GIF.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "2x2-transparent.png",
          aliases: ["2x2.png", "2x2-transparent-png"],
          description: "Redirects to a 2x2 transparent PNG.",
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#2x2-transparent.png",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "2x2.png",
          aliases: null,
          description: "Redirects to a 2x2 transparent PNG.",
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#available-empty-redirect-resources",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["image"]
        }, {
          name: "2x2-transparent-png",
          aliases: null,
          description: "Redirects to a 2x2 transparent PNG.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "32x32-transparent.png",
          aliases: ["32x32.png", "32x32-transparent-png"],
          description: "Redirects to a 32x32 transparent PNG.",
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#32x32-transparent.png",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "32x32.png",
          aliases: null,
          description: "Redirects to a 32x32 transparent PNG.",
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#available-empty-redirect-resources",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["image"]
        }, {
          name: "32x32-transparent-png",
          aliases: null,
          description: "Redirects to a 32x32 transparent PNG.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "3x2-transparent.png",
          aliases: ["3x2.png", "3x2-transparent-png"],
          description: "Redirects to a 3x2 transparent PNG.",
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#3x2-transparent.png",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "3x2.png",
          aliases: null,
          description: "Redirects to a 3x2 transparent PNG.",
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#available-empty-redirect-resources",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["image"]
        }, {
          name: "3x2-transparent-png",
          aliases: null,
          description: "Redirects to a 3x2 transparent PNG.",
          docs: "https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "amazon-apstag",
          aliases: ["ubo-amazon_apstag.js", "amazon_apstag.js"],
          description: "Mocks Amazon's apstag.js",
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#amazon-apstag",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "amazon_apstag.js",
          aliases: null,
          description: "Mocks Amazon's apstag.js",
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#amazon_apstagjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "amazon_ads.js",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1024": 0,
          "2048": 0,
          "4096": 0,
          "8192": 0
        }
      }, {
        shared: [{
          name: "ampproject_v0.js",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1024": 0,
          "2048": 0,
          "4096": 0,
          "8192": 0
        }
      }, {
        shared: [{
          name: "ati-smarttag",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "chartbeat.js",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1024": 0,
          "2048": 0,
          "4096": 0,
          "8192": 0
        }
      }, {
        shared: [{
          name: "click2load.html",
          aliases: ["click2load.html", "ubo-click2load.html"],
          description: "Redirects resource and replaces supposed content by decoy frame with button for original content recovering.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: true,
          resourceTypes: []
        }, {
          name: "click2load.html",
          aliases: null,
          description: "Redirects resource and replaces supposed content by decoy frame with button for original content recovering.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: true,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "didomi-loader",
          aliases: null,
          description: "Mocks Didomi's CMP loader script.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "empty",
          aliases: null,
          description: "Redirects to an empty file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "empty",
          aliases: null,
          description: "Redirects to an empty file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "fingerprintjs2",
          aliases: ["fingerprint2.js"],
          description: "Mocks FingerprintJS2 script.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "fingerprint2.js",
          aliases: null,
          description: "Mocks FingerprintJS2 script.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "fingerprintjs3",
          aliases: ["fingerprint3.js"],
          description: "Mocks FingerprintJS v3.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "fingerprint3.js",
          aliases: null,
          description: "Mocks FingerprintJS v3.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "gemius",
          aliases: null,
          description: "Mocks Gemius Analytics.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "google-analytics-ga",
          aliases: ["ubo-google-analytics_ga.js", "google-analytics_ga.js"],
          description: "Mocks old Google Analytics API.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "google-analytics_ga.js",
          aliases: null,
          description: "Mocks old Google Analytics API.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "google-analytics",
          aliases: ["ubo-google-analytics_analytics.js", "google-analytics_analytics.js", "googletagmanager-gtm", "ubo-googletagmanager_gtm.js", "googletagmanager_gtm.js"],
          description: "Mocks Google's Analytics and Tag Manager APIs.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "google-analytics_analytics.js",
          aliases: null,
          description: "Mocks Google's Analytics and Tag Manager APIs.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "google-analytics_cx_api.js",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1024": 0,
          "2048": 0,
          "4096": 0,
          "8192": 0
        }
      }, {
        shared: [{
          name: "google-analytics_inpage_linkid.js",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1024": 0,
          "2048": 0,
          "4096": 0,
          "8192": 0
        }
      }, {
        shared: [{
          name: "google-ima3",
          aliases: ["ubo-google-ima.js", "google-ima.js"],
          description: "Mocks the IMA SDK of Google.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "google-ima.js",
          aliases: null,
          description: "Mocks the IMA SDK of Google.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "googlesyndication-adsbygoogle",
          aliases: ["ubo-googlesyndication_adsbygoogle.js", "ubo-googlesyndication.com/adsbygoogle.js", "googlesyndication_adsbygoogle.js"],
          description: "Mocks Google AdSense API.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "googlesyndication_adsbygoogle.js",
          aliases: ["googlesyndication.com/adsbygoogle.js"],
          description: "Mocks Google AdSense API.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "googletagservices-gpt",
          aliases: ["ubo-googletagservices_gpt.js", "googletagservices_gpt.js"],
          description: "Mocks Google Publisher Tag API.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "googletagservices_gpt.js",
          aliases: null,
          description: "Mocks Google Publisher Tag API.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "hd-main.js",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1024": 0,
          "2048": 0,
          "4096": 0,
          "8192": 0
        }
      }, {
        shared: [{
          name: "matomo",
          aliases: null,
          description: "Mocks the piwik.js file of Matomo (formerly Piwik).",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "metrika-yandex-tag",
          aliases: null,
          description: "Mocks Yandex Metrika API.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "metrika-yandex-watch",
          aliases: null,
          description: "Mocks the old Yandex Metrika API.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "naver-wcslog",
          aliases: null,
          description: "Mocks wcslog.js of Naver Analytics.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "no-protected-audience",
          aliases: null,
          description: "Prevents using the Protected Audience API.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "no-topics",
          aliases: null,
          description: "Prevents using the Topics API.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "noeval",
          aliases: ["noeval.js", "silent-noeval.js", "ubo-noeval.js", "ubo-silent-noeval.js", "ubo-noeval", "ubo-silent-noeval"],
          description: "Prevents page to use eval.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "noeval.js",
          aliases: null,
          description: "Prevents page to use eval.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "noop-0.5s.mp3",
          aliases: null,
          description: "Redirects to an empty MP3 file with a duration of 0.5 seconds.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["media"]
        }],
        map: {
          "1024": 0,
          "2048": 0,
          "4096": 0,
          "8192": 0
        }
      }, {
        shared: [{
          name: "noopcss",
          aliases: ["noop.css", "blank-css"],
          description: "Redirects to an empty CSS file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "noop.css",
          aliases: null,
          description: "Redirects to an empty CSS file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["stylesheet"]
        }, {
          name: "blank-css",
          aliases: null,
          description: "Redirects to an empty CSS file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "noopframe",
          aliases: ["noop.html", "blank-html"],
          description: "Redirects to an empty HTML file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "noop.html",
          aliases: null,
          description: "Redirects to an empty HTML file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["sub_frame"]
        }, {
          name: "blank-html",
          aliases: null,
          description: "Redirects to an empty HTML file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "noopjs",
          aliases: ["noop.js", "blank-js"],
          description: "Redirects to an empty JavaScript file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "noop.js",
          aliases: null,
          description: "Redirects to an empty JavaScript file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }, {
          name: "blank-js",
          aliases: null,
          description: "Redirects to an empty JavaScript file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "noopjson",
          aliases: ["noop.json"],
          description: "Redirects to an empty JSON file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "noop.json",
          aliases: null,
          description: "Redirects to an empty JSON file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "noopmp3-0.1s",
          aliases: ["noop-0.1s.mp3", "blank-mp3"],
          description: "Redirects to an empty MP3 file with a duration of 0.1 seconds.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "noop-0.1s.mp3",
          aliases: null,
          description: "Redirects to an empty MP3 file with a duration of 0.1 seconds.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["media"]
        }, {
          name: "blank-mp3",
          aliases: null,
          description: "Redirects to an empty MP3 file with a duration of 0.1 seconds.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "noopmp4-1s",
          aliases: ["noop-1s.mp4", "blank-mp4"],
          description: "Redirects to an empty MP4 file with a duration of 1 second.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "noop-1s.mp4",
          aliases: null,
          description: "Redirects to an empty MP4 file with a duration of 1 second.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["media"]
        }, {
          name: "blank-mp4",
          aliases: null,
          description: "Redirects to an empty MP4 file with a duration of 1 second.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "nooptext",
          aliases: ["noop.txt", "blank-text"],
          description: "Redirects to an empty text file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "noop.txt",
          aliases: null,
          description: "Redirects to an empty text file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["image", "media", "sub_frame", "stylesheet", "script", "xmlhttprequest", "other"]
        }, {
          name: "blank-text",
          aliases: null,
          description: "Redirects to an empty text file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "noopvast-2.0",
          aliases: null,
          description: "Redirects to an empty VAST 2.0 XML file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "noopvast-3.0",
          aliases: null,
          description: "Redirects to an empty VAST 3.0 XML file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "noopvast-4.0",
          aliases: null,
          description: "Redirects to an empty VAST 4.0 XML file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "noopvmap-1.0",
          aliases: ["noop-vmap1.0.xml"],
          description: "Redirects to an empty VMAP 1.0 XML file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "noop-vmap1.0.xml",
          aliases: null,
          description: "Redirects to an empty VMAP 1.0 XML file.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["media"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "nowebrtc",
          aliases: ["nowebrtc.js", "ubo-nowebrtc.js", "ubo-nowebrtc"],
          description: "Disables WebRTC by overriding `RTCPeerConnection`.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "nowebrtc.js",
          aliases: null,
          description: "Disables WebRTC by overriding `RTCPeerConnection`.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["other"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "outbrain-widget.js",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1024": 0,
          "2048": 0,
          "4096": 0,
          "8192": 0
        }
      }, {
        shared: [{
          name: "pardot-1.0",
          aliases: null,
          description: "Mocks the pd.js file of Salesforce.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "prebid-ads",
          aliases: ["prebid-ads.js"],
          description: "Mocks prebid-ads.js script.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "prebid-ads.js",
          aliases: null,
          description: "Mocks prebid-ads.js script.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "prebid",
          aliases: null,
          description: "Mocks the prebid.js header bidding suit.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "prevent-bab",
          aliases: ["nobab.js"],
          description: "Prevents BlockAdblock script from detecting an ad blocker.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "nobab.js",
          aliases: null,
          description: "Prevents BlockAdblock script from detecting an ad blocker.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "prevent-bab2",
          aliases: ["nobab2.js"],
          description: "Prevents BlockAdblock script from detecting an ad blocker.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "nobab2.js",
          aliases: null,
          description: "Prevents BlockAdblock script from detecting an ad blocker.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "prevent-fab-3.2.0",
          aliases: ["nofab.js"],
          description: "Mocks FAB script v3.2.0.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "nofab.js",
          aliases: ["fuckadblock.js-3.2.0", "fuckadblock.js-3.2.0.js"],
          description: "Mocks FAB script v3.2.0.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "prevent-popads-net",
          aliases: ["popads.js"],
          description: "Aborts on property write (PopAds, popns), throws reference error with random id.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "popads.js",
          aliases: null,
          description: "Aborts on property write (PopAds, popns), throws reference error with random id.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "scorecardresearch-beacon",
          aliases: ["scorecardresearch_beacon.js"],
          description: "Mocks Scorecard Research API.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "scorecardresearch_beacon.js",
          aliases: null,
          description: "Mocks Scorecard Research API.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "set-popads-dummy",
          aliases: ["popads-dummy.js"],
          description: "Sets static properties PopAds and popns.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: []
        }, {
          name: "popads-dummy.js",
          aliases: null,
          description: "Sets static properties PopAds and popns.",
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          isBlocking: false,
          resourceTypes: ["script"]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }],
      map: {
        "1x1-transparent.gif": 0,
        "1x1.gif": 0,
        "1x1-transparent-gif": 0,
        "2x2-transparent.png": 1,
        "2x2.png": 1,
        "2x2-transparent-png": 1,
        "32x32-transparent.png": 2,
        "32x32.png": 2,
        "32x32-transparent-png": 2,
        "3x2-transparent.png": 3,
        "3x2.png": 3,
        "3x2-transparent-png": 3,
        "amazon-apstag": 4,
        "ubo-amazon_apstag.js": 4,
        "amazon_apstag.js": 4,
        "amazon_ads.js": 5,
        "ampproject_v0.js": 6,
        "ati-smarttag": 7,
        "chartbeat.js": 8,
        "click2load.html": 9,
        "ubo-click2load.html": 9,
        "didomi-loader": 10,
        empty: 11,
        fingerprintjs2: 12,
        "fingerprint2.js": 12,
        fingerprintjs3: 13,
        "fingerprint3.js": 13,
        gemius: 14,
        "google-analytics-ga": 15,
        "ubo-google-analytics_ga.js": 15,
        "google-analytics_ga.js": 15,
        "google-analytics": 16,
        "ubo-google-analytics_analytics.js": 16,
        "google-analytics_analytics.js": 16,
        "googletagmanager-gtm": 16,
        "ubo-googletagmanager_gtm.js": 16,
        "googletagmanager_gtm.js": 16,
        "google-analytics_cx_api.js": 17,
        "google-analytics_inpage_linkid.js": 18,
        "google-ima3": 19,
        "ubo-google-ima.js": 19,
        "google-ima.js": 19,
        "googlesyndication-adsbygoogle": 20,
        "ubo-googlesyndication_adsbygoogle.js": 20,
        "ubo-googlesyndication.com/adsbygoogle.js": 20,
        "googlesyndication_adsbygoogle.js": 20,
        "googlesyndication.com/adsbygoogle.js": 20,
        "googletagservices-gpt": 21,
        "ubo-googletagservices_gpt.js": 21,
        "googletagservices_gpt.js": 21,
        "hd-main.js": 22,
        matomo: 23,
        "metrika-yandex-tag": 24,
        "metrika-yandex-watch": 25,
        "naver-wcslog": 26,
        "no-protected-audience": 27,
        "no-topics": 28,
        noeval: 29,
        "noeval.js": 29,
        "silent-noeval.js": 29,
        "ubo-noeval.js": 29,
        "ubo-silent-noeval.js": 29,
        "ubo-noeval": 29,
        "ubo-silent-noeval": 29,
        "noop-0.5s.mp3": 30,
        noopcss: 31,
        "noop.css": 31,
        "blank-css": 31,
        noopframe: 32,
        "noop.html": 32,
        "blank-html": 32,
        noopjs: 33,
        "noop.js": 33,
        "blank-js": 33,
        noopjson: 34,
        "noop.json": 34,
        "noopmp3-0.1s": 35,
        "noop-0.1s.mp3": 35,
        "blank-mp3": 35,
        "noopmp4-1s": 36,
        "noop-1s.mp4": 36,
        "blank-mp4": 36,
        nooptext: 37,
        "noop.txt": 37,
        "blank-text": 37,
        "noopvast-2.0": 38,
        "noopvast-3.0": 39,
        "noopvast-4.0": 40,
        "noopvmap-1.0": 41,
        "noop-vmap1.0.xml": 41,
        nowebrtc: 42,
        "nowebrtc.js": 42,
        "ubo-nowebrtc.js": 42,
        "ubo-nowebrtc": 42,
        "outbrain-widget.js": 43,
        "pardot-1.0": 44,
        "prebid-ads": 45,
        "prebid-ads.js": 45,
        prebid: 46,
        "prevent-bab": 47,
        "nobab.js": 47,
        "prevent-bab2": 48,
        "nobab2.js": 48,
        "prevent-fab-3.2.0": 49,
        "nofab.js": 49,
        "fuckadblock.js-3.2.0": 49,
        "fuckadblock.js-3.2.0.js": 49,
        "prevent-popads-net": 50,
        "popads.js": 50,
        "scorecardresearch-beacon": 51,
        "scorecardresearch_beacon.js": 51,
        "set-popads-dummy": 52,
        "popads-dummy.js": 52
      }
    };
    var scriptletsCompatibilityTableData = {
      shared: [{
        shared: [{
          name: "abort-current-inline-script",
          aliases: ["abort-current-script.js", "ubo-abort-current-script.js", "acs.js", "ubo-acs.js", "ubo-abort-current-script", "ubo-acs", "abort-current-inline-script.js", "ubo-abort-current-inline-script.js", "acis.js", "ubo-acis.js", "ubo-abort-current-inline-script", "ubo-acis", "abp-abort-current-inline-script"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#abort-current-inline-script",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "search",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "abort-current-script.js",
          aliases: ["acs.js", "abort-current-inline-script.js", "acis.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#abort-current-scriptjs-",
          versionAdded: "1.37.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "search",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "abort-current-inline-script",
          aliases: null,
          description: null,
          docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
          versionAdded: "3.4.3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "api",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "search",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "abort-on-property-read",
          aliases: ["abort-on-property-read.js", "ubo-abort-on-property-read.js", "aopr.js", "ubo-aopr.js", "ubo-abort-on-property-read", "ubo-aopr", "abp-abort-on-property-read"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#abort-on-property-read",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "abort-on-property-read.js",
          aliases: ["aopr.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#abort-on-property-readjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "abort-on-property-read",
          aliases: null,
          description: null,
          docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
          versionAdded: "3.4.1",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "setConfigurable",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "abort-on-property-write",
          aliases: ["abort-on-property-write.js", "ubo-abort-on-property-write.js", "aopw.js", "ubo-aopw.js", "ubo-abort-on-property-write", "ubo-aopw", "abp-abort-on-property-write"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#abort-on-property-write",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "abort-on-property-write.js",
          aliases: ["aopw.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#abort-on-property-writejs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "abort-on-property-write",
          aliases: null,
          description: null,
          docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
          versionAdded: "3.4.3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "setConfigurable",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "abort-on-stack-trace",
          aliases: ["abort-on-stack-trace.js", "ubo-abort-on-stack-trace.js", "aost.js", "ubo-aost.js", "ubo-abort-on-stack-trace", "ubo-aost", "abp-abort-on-stack-trace"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#abort-on-stack-trace",
          versionAdded: "1.5.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "abort-on-stack-trace.js",
          aliases: ["aost.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#abort-on-stack-tracejs-",
          versionAdded: "1.29.3rc9",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "adjust-setInterval",
          aliases: ["nano-setInterval-booster.js", "ubo-nano-setInterval-booster.js", "nano-sib.js", "ubo-nano-sib.js", "adjust-setInterval.js", "ubo-adjust-setInterval.js", "ubo-nano-setInterval-booster", "ubo-nano-sib", "ubo-adjust-setInterval"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#adjust-setInterval",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "matchCallback",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "matchDelay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "boost",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "adjust-setInterval.js",
          aliases: ["nano-setInterval-booster.js", "nano-sib.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#adjust-setIntervaljs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "matchCallback",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "matchDelay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "boost",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "adjust-setTimeout",
          aliases: ["adjust-setTimeout.js", "ubo-adjust-setTimeout.js", "nano-setTimeout-booster.js", "ubo-nano-setTimeout-booster.js", "nano-stb.js", "ubo-nano-stb.js", "ubo-adjust-setTimeout", "ubo-nano-setTimeout-booster", "ubo-nano-stb"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#adjust-setTimeout",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "matchCallback",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "matchDelay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "boost",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "adjust-setTimeout.js",
          aliases: ["nano-setTimeout-booster.js", "nano-stb.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#adjust-setTimeoutjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "matchCallback",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "matchDelay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "boost",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "amazon-apstag",
          aliases: ["ubo-amazon_apstag.js", "amazon_apstag.js"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#amazon-apstag",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "call-nothrow",
          aliases: ["call-nothrow.js", "ubo-call-nothrow.js", "ubo-call-nothrow"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#call-nothrow",
          versionAdded: "1.10.1",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "functionName",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "call-nothrow.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#call-nothrowjs-",
          versionAdded: "1.48.1b0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "functionName",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "close-window",
          aliases: ["window-close-if.js", "ubo-window-close-if.js", "ubo-window-close-if", "close-window.js", "ubo-close-window.js", "ubo-close-window"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#close-window",
          versionAdded: "1.5.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "path",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "close-window.js",
          aliases: ["window-close-if.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#close-windowjs-",
          versionAdded: "1.39.3b10",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "path",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "debug-current-inline-script",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#debug-current-inline-script",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "search",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "debug-on-property-read",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#debug-on-property-read",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "debug-on-property-write",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#debug-on-property-write",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "didomi-loader",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#didomi-loader",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "dir-string",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#dir-string",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "times",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "disable-newtab-links",
          aliases: ["disable-newtab-links.js", "ubo-disable-newtab-links.js", "ubo-disable-newtab-links"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#disable-newtab-links",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }, {
          name: "disable-newtab-links.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#disable-newtab-linksjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "evaldata-prune",
          aliases: ["evaldata-prune.js", "ubo-evaldata-prune.js", "ubo-evaldata-prune"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#evaldata-prune",
          versionAdded: "1.9.37",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToRemove",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "obligatoryProps",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "evaldata-prune.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#evaldata-prunejs-",
          versionAdded: "1.49.3rc15",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToRemove",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "obligatoryProps",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "fingerprintjs2",
          aliases: ["ubo-fingerprint2.js", "fingerprint2.js"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#fingerprintjs2",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "fingerprintjs3",
          aliases: ["ubo-fingerprint3.js", "fingerprint3.js"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#fingerprintjs3",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "gemius",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#gemius",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "google-analytics-ga",
          aliases: ["ubo-google-analytics_ga.js", "google-analytics_ga.js"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#google-analytics-ga",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "google-analytics",
          aliases: ["ubo-google-analytics_analytics.js", "google-analytics_analytics.js", "googletagmanager-gtm", "ubo-googletagmanager_gtm.js", "googletagmanager_gtm.js"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#google-analytics",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "google-ima3",
          aliases: ["ubo-google-ima.js", "google-ima.js"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#google-ima3",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "googlesyndication-adsbygoogle",
          aliases: ["ubo-googlesyndication_adsbygoogle.js", "googlesyndication_adsbygoogle.js"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#googlesyndication-adsbygoogle",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "googletagservices-gpt",
          aliases: ["ubo-googletagservices_gpt.js", "googletagservices_gpt.js"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#googletagservices-gpt",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "hide-in-shadow-dom",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#hide-in-shadow-dom",
          versionAdded: "1.3.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "selector",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "baseSelector",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "href-sanitizer",
          aliases: ["href-sanitizer.js", "ubo-href-sanitizer.js", "ubo-href-sanitizer"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#href-sanitizer",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "selector",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "attribute",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "href-sanitizer.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#href-sanitizerjs-",
          versionAdded: "1.47.5b4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "selector",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "attribute",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "inject-css-in-shadow-dom",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#inject-css-in-shadow-dom",
          versionAdded: "1.8.2",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "cssRule",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "hostSelector",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "json-prune-fetch-response",
          aliases: ["json-prune-fetch-response.js", "ubo-json-prune-fetch-response.js", "ubo-json-prune-fetch-response"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#json-prune-fetch-response",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToRemove",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "obligatoryProps",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "propsToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "json-prune-fetch-response.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#json-prune-fetch-responsejs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToRemove",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "obligatoryProps",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "propsToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "json-prune-xhr-response",
          aliases: ["json-prune-xhr-response.js", "ubo-json-prune-xhr-response.js", "ubo-json-prune-xhr-response"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#json-prune-xhr-response",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToRemove",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "obligatoryProps",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "propsToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "json-prune-xhr-response.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#json-prune-xhr-responsejs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToRemove",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "obligatoryProps",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "propsToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "json-prune",
          aliases: ["json-prune.js", "ubo-json-prune.js", "ubo-json-prune", "abp-json-prune"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#json-prune",
          versionAdded: "1.1.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToRemove",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "obligatoryProps",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "json-prune.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#json-prunejs-",
          versionAdded: "1.23.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToRemove",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "obligatoryProps",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "json-prune",
          aliases: null,
          description: null,
          docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
          versionAdded: "3.9.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "rawPrunePaths",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "rawNeedlePaths",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "log-addEventListener",
          aliases: ["addEventListener-logger.js", "ubo-addEventListener-logger.js", "aell.js", "ubo-aell.js", "ubo-addEventListener-logger", "ubo-aell"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#log-addEventListener",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "log-eval",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#log-eval",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "log-on-stack-trace",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#log-on-stack-trace",
          versionAdded: "1.5.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "log",
          aliases: ["abp-log"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#log",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "arguments",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "m3u-prune",
          aliases: ["m3u-prune.js", "ubo-m3u-prune.js", "ubo-m3u-prune"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#m3u-prune",
          versionAdded: "1.9.1",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToRemove",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "urlToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "m3u-prune.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#m3u-prunejs-",
          versionAdded: "1.44.5b6",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToRemove",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "urlToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "matomo",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#matomo",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "metrika-yandex-tag",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#metrika-yandex-tag",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "metrika-yandex-watch",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#metrika-yandex-watch",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "naver-wcslog",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#naver-wcslog",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "no-protected-audience",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#no-protected-audience",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "no-topics",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#no-topics",
          versionAdded: "1.6.18",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "noeval",
          aliases: ["noeval.js", "silent-noeval.js", "ubo-noeval.js", "ubo-silent-noeval.js", "ubo-noeval", "ubo-silent-noeval"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#noeval",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "nowebrtc",
          aliases: ["nowebrtc.js", "ubo-nowebrtc.js", "ubo-nowebrtc"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#nowebrtc",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }, {
          name: "nowebrtc.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#nowebrtcjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "pardot-1.0",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#pardot-1.0",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "prebid",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prebid",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "prevent-addEventListener",
          aliases: ["addEventListener-defuser.js", "ubo-addEventListener-defuser.js", "aeld.js", "ubo-aeld.js", "ubo-addEventListener-defuser", "ubo-aeld", "abp-prevent-listener"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-addEventListener",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "typeSearch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "listenerSearch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "addEventListener-defuser.js",
          aliases: ["aeld.js", "prevent-addEventListener.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#addEventListener-defuserjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "typeSearch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "listenerSearch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "prevent-listener",
          aliases: null,
          description: null,
          docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
          versionAdded: "3.11.2",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "type",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "handler",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "selector",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "prevent-adfly",
          aliases: ["adfly-defuser.js", "ubo-adfly-defuser.js", "ubo-adfly-defuser"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-adfly",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "prevent-bab",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-bab",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "prevent-element-src-loading",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-element-src-loading",
          versionAdded: "1.6.2",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "tagName",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "match",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "prevent-eval-if",
          aliases: ["noeval-if.js", "ubo-noeval-if.js", "ubo-noeval-if"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-eval-if",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "search",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "noeval-if.js",
          aliases: ["prevent-eval-if.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#noeval-ifjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "search",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "prevent-fab-3.2.0",
          aliases: ["nofab.js", "ubo-nofab.js", "fuckadblock.js-3.2.0", "ubo-fuckadblock.js-3.2.0", "ubo-nofab"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-fab-3.2.0",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "prevent-fetch",
          aliases: ["prevent-fetch.js", "no-fetch-if.js", "ubo-no-fetch-if.js", "ubo-no-fetch-if"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-fetch",
          versionAdded: "1.3.18",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "responseBody",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "responseType",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "prevent-fetch.js",
          aliases: ["no-fetch-if.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#prevent-fetchjs-",
          versionAdded: "1.31.3b9",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "responseBody",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "responseType",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "prevent-popads-net",
          aliases: ["popads.net.js", "ubo-popads.net.js", "ubo-popads.net"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-popads-net",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "prevent-refresh",
          aliases: ["prevent-refresh.js", "refresh-defuser.js", "refresh-defuser", "ubo-prevent-refresh.js", "ubo-prevent-refresh", "ubo-refresh-defuser.js", "ubo-refresh-defuser"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-refresh",
          versionAdded: "1.6.2",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "delay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "prevent-refresh.js",
          aliases: ["refresh-defuser.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#prevent-refreshjs-",
          versionAdded: "1.38.7b3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "delay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "prevent-requestAnimationFrame",
          aliases: ["no-requestAnimationFrame-if.js", "ubo-no-requestAnimationFrame-if.js", "norafif.js", "ubo-norafif.js", "ubo-no-requestAnimationFrame-if", "ubo-norafif"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-requestAnimationFrame",
          versionAdded: "1.1.15",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "search",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "no-requestAnimationFrame-if.js",
          aliases: ["norafif.js", "prevent-requestAnimationFrame.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#no-requestAnimationFrame-ifjs-",
          versionAdded: "1.27.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "search",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "prevent-setInterval",
          aliases: ["no-setInterval-if.js", "ubo-no-setInterval-if.js", "setInterval-defuser.js", "ubo-setInterval-defuser.js", "nosiif.js", "ubo-nosiif.js", "sid.js", "ubo-sid.js", "ubo-no-setInterval-if", "ubo-setInterval-defuser", "ubo-nosiif", "ubo-sid"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-setInterval",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "matchCallback",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "matchDelay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "no-setInterval-if.js",
          aliases: ["nosiif.js", "prevent-setInterval.js", "setInterval-defuser.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#no-setInterval-ifjs-",
          versionAdded: "1.23.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "matchCallback",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "matchDelay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "prevent-setTimeout",
          aliases: ["no-setTimeout-if.js", "ubo-no-setTimeout-if.js", "nostif.js", "ubo-nostif.js", "ubo-no-setTimeout-if", "ubo-nostif", "setTimeout-defuser.js", "ubo-setTimeout-defuser.js", "ubo-setTimeout-defuser", "std.js", "ubo-std.js", "ubo-std"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-setTimeout",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "matchCallback",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "matchDelay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "no-setTimeout-if.js",
          aliases: ["nostif.js", "prevent-setTimeout.js", "setTimeout-defuser.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#no-setTimeout-ifjs-",
          versionAdded: "1.23.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "matchCallback",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "matchDelay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "prevent-window-open",
          aliases: ["window.open-defuser.js", "ubo-window.open-defuser.js", "ubo-window.open-defuser", "nowoif.js", "ubo-nowoif.js", "ubo-nowoif", "no-window-open-if.js", "ubo-no-window-open-if.js", "ubo-no-window-open-if"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-window-open",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "match",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "delay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "replacement",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "no-window-open-if.js",
          aliases: ["nowoif.js", "prevent-window-open.js", "window.open-defuser.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#no-window-open-ifjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "match",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "delay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "replacement",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "prevent-xhr",
          aliases: ["no-xhr-if.js", "ubo-no-xhr-if.js", "ubo-no-xhr-if"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-xhr",
          versionAdded: "1.5.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "randomize",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "no-xhr-if.js",
          aliases: ["prevent-xhr.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#no-xhr-ifjs-",
          versionAdded: "1.38.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "randomize",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "remove-attr",
          aliases: ["remove-attr.js", "ubo-remove-attr.js", "ra.js", "ubo-ra.js", "ubo-remove-attr", "ubo-ra"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#remove-attr",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "attrs",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "selector",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "applying",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "remove-attr.js",
          aliases: ["ra.js", "ra", "remove-attr"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#remove-attrjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "attrs",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "selector",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "applying",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "remove-class",
          aliases: ["remove-class.js", "ubo-remove-class.js", "rc.js", "ubo-rc.js", "ubo-remove-class", "ubo-rc"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#remove-class",
          versionAdded: "1.1.1",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "classes",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "selector",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "applying",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "remove-class.js",
          aliases: ["rc.js", "rc", "remove-class"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#remove-classjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "classes",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "selector",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "applying",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "remove-cookie",
          aliases: ["cookie-remover.js", "ubo-cookie-remover.js", "ubo-cookie-remover", "remove-cookie.js", "ubo-remove-cookie.js", "ubo-remove-cookie", "abp-cookie-remover"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#remove-cookie",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "match",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "remove-cookie.js",
          aliases: ["cookie-remover.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#remove-cookiejs-",
          versionAdded: "1.28.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "match",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "cookie-remover",
          aliases: null,
          description: null,
          docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
          versionAdded: "3.11.2",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "cookie",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "autoRemoveCookie",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "remove-in-shadow-dom",
          aliases: null,
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#remove-in-shadow-dom",
          versionAdded: "1.3.14",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "selector",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "baseSelector",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "remove-node-text",
          aliases: ["remove-node-text.js", "ubo-remove-node-text.js", "rmnt.js", "ubo-rmnt.js", "ubo-remove-node-text", "ubo-rmnt"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#remove-node-text",
          versionAdded: "1.9.37",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "nodeName",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "textMatch",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "remove-node-text.js",
          aliases: ["rmnt.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#remove-node-textjs-",
          versionAdded: "1.49.3rc15",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "nodeName",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "textMatch",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "scorecardresearch-beacon",
          aliases: ["ubo-scorecardresearch_beacon.js", "scorecardresearch_beacon.js"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#scorecardresearch-beacon",
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "set-attr",
          aliases: ["set-attr.js", "ubo-set-attr.js", "ubo-set-attr"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-attr",
          versionAdded: "1.5.0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "selector",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "attr",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "set-attr.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#set-attrjs-",
          versionAdded: "1.50.1b16",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "selector",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "attr",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "set-constant",
          aliases: ["set-constant.js", "ubo-set-constant.js", "set.js", "ubo-set.js", "ubo-set-constant", "ubo-set"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-constant",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "valueWrapper",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "setProxyTrap",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "set-constant.js",
          aliases: ["set.js"],
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#set-constantjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "chain",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "rawValue",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "runAt",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "override-property-read",
          aliases: null,
          description: null,
          docs: "https://help.adblockplus.org/hc/en-us/articles/1500002338501-Snippet-filters-tutorial#snippets-ref",
          versionAdded: "3.9.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "setConfigurable",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1,
          "16384": 2,
          "32768": 2,
          "65536": 2,
          "131072": 2
        }
      }, {
        shared: [{
          name: "set-cookie-reload",
          aliases: ["set-cookie-reload.js", "ubo-set-cookie-reload.js", "ubo-set-cookie-reload"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-cookie-reload",
          versionAdded: "1.3.14",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "name",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "path",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "domain",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "set-cookie-reload.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#set-cookie-reloadjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "name",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "path",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "domain",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "set-cookie",
          aliases: ["set-cookie.js", "ubo-set-cookie.js", "ubo-set-cookie"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-cookie",
          versionAdded: "1.2.3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "name",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "path",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "set-cookie.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#set-cookiejs-",
          versionAdded: "1.50.1b0",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "name",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "path",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "set-local-storage-item",
          aliases: ["set-local-storage-item.js", "ubo-set-local-storage-item.js", "ubo-set-local-storage-item"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-local-storage-item",
          versionAdded: "1.4.3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "key",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "set-local-storage-item.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#set-local-storage-itemjs-",
          versionAdded: "1.50.1b4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "key",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "set-popads-dummy",
          aliases: ["popads-dummy.js", "ubo-popads-dummy.js", "ubo-popads-dummy"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-popads-dummy",
          versionAdded: "1.0.4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "set-session-storage-item",
          aliases: ["set-session-storage-item.js", "ubo-set-session-storage-item.js", "ubo-set-session-storage-item"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-session-storage-item",
          versionAdded: "1.4.3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "key",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "set-session-storage-item.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#set-session-storage-itemjs-",
          versionAdded: "1.50.1b4",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "key",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "spoof-css",
          aliases: ["spoof-css.js", "ubo-spoof-css.js", "ubo-spoof-css"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#spoof-css",
          versionAdded: "1.10.1",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "selectors",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "cssPropertyName",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "cssPropertyValue",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "spoof-css.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#spoof-cssjs-",
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "selectors",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "cssPropertyName",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "cssPropertyValue",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "arguments",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }, {
        shared: [{
          name: "trusted-click-element",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: "1.7.3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "selectors",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "extraMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "delay",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "trusted-create-element",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: "1.10.1",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "parentSelector",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "tagName",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "attributePairs",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "textContent",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "cleanupDelayMs",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "trusted-dispatch-event",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: null,
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "event",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "target",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "trusted-prune-inbound-object",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: "1.9.91",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "functionName",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "propsToRemove",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "obligatoryProps",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "trusted-replace-fetch-response",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: "1.7.3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "pattern",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "replacement",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "propsToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "trusted-replace-node-text",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: "1.9.37",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "nodeName",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "textMatch",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "pattern",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "replacement",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "trusted-replace-xhr-response",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: "1.7.3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "pattern",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "replacement",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "propsToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "trusted-set-attr",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: "1.10.1",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "selector",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "attr",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "trusted-set-constant",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: "1.8.2",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "property",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "trusted-set-cookie-reload",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: "1.7.10",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "name",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "offsetExpiresSec",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "path",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "domain",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "trusted-set-cookie",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: "1.7.3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "name",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "offsetExpiresSec",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "path",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "domain",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "trusted-set-local-storage-item",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: "1.7.3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "key",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "value",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "trusted-suppress-native-method",
          aliases: null,
          description: null,
          docs: null,
          versionAdded: "1.10.25",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "methodPath",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "signatureStr",
            required: true,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "how",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "stack",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0
        }
      }, {
        shared: [{
          name: "xml-prune",
          aliases: ["xml-prune.js", "ubo-xml-prune.js", "ubo-xml-prune"],
          description: null,
          docs: "https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#xml-prune",
          versionAdded: "1.7.3",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "optionalProp",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "urlToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }, {
          name: "xml-prune.js",
          aliases: null,
          description: null,
          docs: "https://github.com/gorhill/uBlock/wiki/Resources-Library#xml-prunejs-",
          versionAdded: "1.49.3rc6",
          versionRemoved: null,
          deprecated: false,
          deprecationMessage: null,
          removed: false,
          removalMessage: null,
          parameters: [{
            name: "propsToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "optionalProp",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }, {
            name: "urlToMatch",
            required: false,
            description: null,
            pattern: null,
            "default": null,
            debug: false
          }]
        }],
        map: {
          "1": 0,
          "2": 0,
          "4": 0,
          "8": 0,
          "16": 0,
          "32": 0,
          "64": 0,
          "1024": 1,
          "2048": 1,
          "4096": 1,
          "8192": 1
        }
      }],
      map: {
        "abort-current-inline-script": 0,
        "abort-current-script.js": 0,
        "ubo-abort-current-script.js": 0,
        "acs.js": 0,
        "ubo-acs.js": 0,
        "ubo-abort-current-script": 0,
        "ubo-acs": 0,
        "abort-current-inline-script.js": 0,
        "ubo-abort-current-inline-script.js": 0,
        "acis.js": 0,
        "ubo-acis.js": 0,
        "ubo-abort-current-inline-script": 0,
        "ubo-acis": 0,
        "abp-abort-current-inline-script": 0,
        "abort-on-property-read": 1,
        "abort-on-property-read.js": 1,
        "ubo-abort-on-property-read.js": 1,
        "aopr.js": 1,
        "ubo-aopr.js": 1,
        "ubo-abort-on-property-read": 1,
        "ubo-aopr": 1,
        "abp-abort-on-property-read": 1,
        "abort-on-property-write": 2,
        "abort-on-property-write.js": 2,
        "ubo-abort-on-property-write.js": 2,
        "aopw.js": 2,
        "ubo-aopw.js": 2,
        "ubo-abort-on-property-write": 2,
        "ubo-aopw": 2,
        "abp-abort-on-property-write": 2,
        "abort-on-stack-trace": 3,
        "abort-on-stack-trace.js": 3,
        "ubo-abort-on-stack-trace.js": 3,
        "aost.js": 3,
        "ubo-aost.js": 3,
        "ubo-abort-on-stack-trace": 3,
        "ubo-aost": 3,
        "abp-abort-on-stack-trace": 3,
        "adjust-setInterval": 4,
        "nano-setInterval-booster.js": 4,
        "ubo-nano-setInterval-booster.js": 4,
        "nano-sib.js": 4,
        "ubo-nano-sib.js": 4,
        "adjust-setInterval.js": 4,
        "ubo-adjust-setInterval.js": 4,
        "ubo-nano-setInterval-booster": 4,
        "ubo-nano-sib": 4,
        "ubo-adjust-setInterval": 4,
        "adjust-setTimeout": 5,
        "adjust-setTimeout.js": 5,
        "ubo-adjust-setTimeout.js": 5,
        "nano-setTimeout-booster.js": 5,
        "ubo-nano-setTimeout-booster.js": 5,
        "nano-stb.js": 5,
        "ubo-nano-stb.js": 5,
        "ubo-adjust-setTimeout": 5,
        "ubo-nano-setTimeout-booster": 5,
        "ubo-nano-stb": 5,
        "amazon-apstag": 6,
        "ubo-amazon_apstag.js": 6,
        "amazon_apstag.js": 6,
        "call-nothrow": 7,
        "call-nothrow.js": 7,
        "ubo-call-nothrow.js": 7,
        "ubo-call-nothrow": 7,
        "close-window": 8,
        "window-close-if.js": 8,
        "ubo-window-close-if.js": 8,
        "ubo-window-close-if": 8,
        "close-window.js": 8,
        "ubo-close-window.js": 8,
        "ubo-close-window": 8,
        "debug-current-inline-script": 9,
        "debug-on-property-read": 10,
        "debug-on-property-write": 11,
        "didomi-loader": 12,
        "dir-string": 13,
        "disable-newtab-links": 14,
        "disable-newtab-links.js": 14,
        "ubo-disable-newtab-links.js": 14,
        "ubo-disable-newtab-links": 14,
        "evaldata-prune": 15,
        "evaldata-prune.js": 15,
        "ubo-evaldata-prune.js": 15,
        "ubo-evaldata-prune": 15,
        fingerprintjs2: 16,
        "ubo-fingerprint2.js": 16,
        "fingerprint2.js": 16,
        fingerprintjs3: 17,
        "ubo-fingerprint3.js": 17,
        "fingerprint3.js": 17,
        gemius: 18,
        "google-analytics-ga": 19,
        "ubo-google-analytics_ga.js": 19,
        "google-analytics_ga.js": 19,
        "google-analytics": 20,
        "ubo-google-analytics_analytics.js": 20,
        "google-analytics_analytics.js": 20,
        "googletagmanager-gtm": 20,
        "ubo-googletagmanager_gtm.js": 20,
        "googletagmanager_gtm.js": 20,
        "google-ima3": 21,
        "ubo-google-ima.js": 21,
        "google-ima.js": 21,
        "googlesyndication-adsbygoogle": 22,
        "ubo-googlesyndication_adsbygoogle.js": 22,
        "googlesyndication_adsbygoogle.js": 22,
        "googletagservices-gpt": 23,
        "ubo-googletagservices_gpt.js": 23,
        "googletagservices_gpt.js": 23,
        "hide-in-shadow-dom": 24,
        "href-sanitizer": 25,
        "href-sanitizer.js": 25,
        "ubo-href-sanitizer.js": 25,
        "ubo-href-sanitizer": 25,
        "inject-css-in-shadow-dom": 26,
        "json-prune-fetch-response": 27,
        "json-prune-fetch-response.js": 27,
        "ubo-json-prune-fetch-response.js": 27,
        "ubo-json-prune-fetch-response": 27,
        "json-prune-xhr-response": 28,
        "json-prune-xhr-response.js": 28,
        "ubo-json-prune-xhr-response.js": 28,
        "ubo-json-prune-xhr-response": 28,
        "json-prune": 29,
        "json-prune.js": 29,
        "ubo-json-prune.js": 29,
        "ubo-json-prune": 29,
        "abp-json-prune": 29,
        "log-addEventListener": 30,
        "addEventListener-logger.js": 30,
        "ubo-addEventListener-logger.js": 30,
        "aell.js": 30,
        "ubo-aell.js": 30,
        "ubo-addEventListener-logger": 30,
        "ubo-aell": 30,
        "log-eval": 31,
        "log-on-stack-trace": 32,
        log: 33,
        "abp-log": 33,
        "m3u-prune": 34,
        "m3u-prune.js": 34,
        "ubo-m3u-prune.js": 34,
        "ubo-m3u-prune": 34,
        matomo: 35,
        "metrika-yandex-tag": 36,
        "metrika-yandex-watch": 37,
        "naver-wcslog": 38,
        "no-protected-audience": 39,
        "no-topics": 40,
        noeval: 41,
        "noeval.js": 41,
        "silent-noeval.js": 41,
        "ubo-noeval.js": 41,
        "ubo-silent-noeval.js": 41,
        "ubo-noeval": 41,
        "ubo-silent-noeval": 41,
        nowebrtc: 42,
        "nowebrtc.js": 42,
        "ubo-nowebrtc.js": 42,
        "ubo-nowebrtc": 42,
        "pardot-1.0": 43,
        prebid: 44,
        "prevent-addEventListener": 45,
        "addEventListener-defuser.js": 45,
        "ubo-addEventListener-defuser.js": 45,
        "aeld.js": 45,
        "ubo-aeld.js": 45,
        "ubo-addEventListener-defuser": 45,
        "ubo-aeld": 45,
        "abp-prevent-listener": 45,
        "prevent-addEventListener.js": 45,
        "prevent-listener": 45,
        "prevent-adfly": 46,
        "adfly-defuser.js": 46,
        "ubo-adfly-defuser.js": 46,
        "ubo-adfly-defuser": 46,
        "prevent-bab": 47,
        "prevent-element-src-loading": 48,
        "prevent-eval-if": 49,
        "noeval-if.js": 49,
        "ubo-noeval-if.js": 49,
        "ubo-noeval-if": 49,
        "prevent-eval-if.js": 49,
        "prevent-fab-3.2.0": 50,
        "nofab.js": 50,
        "ubo-nofab.js": 50,
        "fuckadblock.js-3.2.0": 50,
        "ubo-fuckadblock.js-3.2.0": 50,
        "ubo-nofab": 50,
        "prevent-fetch": 51,
        "prevent-fetch.js": 51,
        "no-fetch-if.js": 51,
        "ubo-no-fetch-if.js": 51,
        "ubo-no-fetch-if": 51,
        "prevent-popads-net": 52,
        "popads.net.js": 52,
        "ubo-popads.net.js": 52,
        "ubo-popads.net": 52,
        "prevent-refresh": 53,
        "prevent-refresh.js": 53,
        "refresh-defuser.js": 53,
        "refresh-defuser": 53,
        "ubo-prevent-refresh.js": 53,
        "ubo-prevent-refresh": 53,
        "ubo-refresh-defuser.js": 53,
        "ubo-refresh-defuser": 53,
        "prevent-requestAnimationFrame": 54,
        "no-requestAnimationFrame-if.js": 54,
        "ubo-no-requestAnimationFrame-if.js": 54,
        "norafif.js": 54,
        "ubo-norafif.js": 54,
        "ubo-no-requestAnimationFrame-if": 54,
        "ubo-norafif": 54,
        "prevent-requestAnimationFrame.js": 54,
        "prevent-setInterval": 55,
        "no-setInterval-if.js": 55,
        "ubo-no-setInterval-if.js": 55,
        "setInterval-defuser.js": 55,
        "ubo-setInterval-defuser.js": 55,
        "nosiif.js": 55,
        "ubo-nosiif.js": 55,
        "sid.js": 55,
        "ubo-sid.js": 55,
        "ubo-no-setInterval-if": 55,
        "ubo-setInterval-defuser": 55,
        "ubo-nosiif": 55,
        "ubo-sid": 55,
        "prevent-setInterval.js": 55,
        "prevent-setTimeout": 56,
        "no-setTimeout-if.js": 56,
        "ubo-no-setTimeout-if.js": 56,
        "nostif.js": 56,
        "ubo-nostif.js": 56,
        "ubo-no-setTimeout-if": 56,
        "ubo-nostif": 56,
        "setTimeout-defuser.js": 56,
        "ubo-setTimeout-defuser.js": 56,
        "ubo-setTimeout-defuser": 56,
        "std.js": 56,
        "ubo-std.js": 56,
        "ubo-std": 56,
        "prevent-setTimeout.js": 56,
        "prevent-window-open": 57,
        "window.open-defuser.js": 57,
        "ubo-window.open-defuser.js": 57,
        "ubo-window.open-defuser": 57,
        "nowoif.js": 57,
        "ubo-nowoif.js": 57,
        "ubo-nowoif": 57,
        "no-window-open-if.js": 57,
        "ubo-no-window-open-if.js": 57,
        "ubo-no-window-open-if": 57,
        "prevent-window-open.js": 57,
        "prevent-xhr": 58,
        "no-xhr-if.js": 58,
        "ubo-no-xhr-if.js": 58,
        "ubo-no-xhr-if": 58,
        "prevent-xhr.js": 58,
        "remove-attr": 59,
        "remove-attr.js": 59,
        "ubo-remove-attr.js": 59,
        "ra.js": 59,
        "ubo-ra.js": 59,
        "ubo-remove-attr": 59,
        "ubo-ra": 59,
        ra: 59,
        "remove-class": 60,
        "remove-class.js": 60,
        "ubo-remove-class.js": 60,
        "rc.js": 60,
        "ubo-rc.js": 60,
        "ubo-remove-class": 60,
        "ubo-rc": 60,
        rc: 60,
        "remove-cookie": 61,
        "cookie-remover.js": 61,
        "ubo-cookie-remover.js": 61,
        "ubo-cookie-remover": 61,
        "remove-cookie.js": 61,
        "ubo-remove-cookie.js": 61,
        "ubo-remove-cookie": 61,
        "abp-cookie-remover": 61,
        "cookie-remover": 61,
        "remove-in-shadow-dom": 62,
        "remove-node-text": 63,
        "remove-node-text.js": 63,
        "ubo-remove-node-text.js": 63,
        "rmnt.js": 63,
        "ubo-rmnt.js": 63,
        "ubo-remove-node-text": 63,
        "ubo-rmnt": 63,
        "scorecardresearch-beacon": 64,
        "ubo-scorecardresearch_beacon.js": 64,
        "scorecardresearch_beacon.js": 64,
        "set-attr": 65,
        "set-attr.js": 65,
        "ubo-set-attr.js": 65,
        "ubo-set-attr": 65,
        "set-constant": 66,
        "set-constant.js": 66,
        "ubo-set-constant.js": 66,
        "set.js": 66,
        "ubo-set.js": 66,
        "ubo-set-constant": 66,
        "ubo-set": 66,
        "override-property-read": 66,
        "set-cookie-reload": 67,
        "set-cookie-reload.js": 67,
        "ubo-set-cookie-reload.js": 67,
        "ubo-set-cookie-reload": 67,
        "set-cookie": 68,
        "set-cookie.js": 68,
        "ubo-set-cookie.js": 68,
        "ubo-set-cookie": 68,
        "set-local-storage-item": 69,
        "set-local-storage-item.js": 69,
        "ubo-set-local-storage-item.js": 69,
        "ubo-set-local-storage-item": 69,
        "set-popads-dummy": 70,
        "popads-dummy.js": 70,
        "ubo-popads-dummy.js": 70,
        "ubo-popads-dummy": 70,
        "set-session-storage-item": 71,
        "set-session-storage-item.js": 71,
        "ubo-set-session-storage-item.js": 71,
        "ubo-set-session-storage-item": 71,
        "spoof-css": 72,
        "spoof-css.js": 72,
        "ubo-spoof-css.js": 72,
        "ubo-spoof-css": 72,
        "trusted-click-element": 73,
        "trusted-create-element": 74,
        "trusted-dispatch-event": 75,
        "trusted-prune-inbound-object": 76,
        "trusted-replace-fetch-response": 77,
        "trusted-replace-node-text": 78,
        "trusted-replace-xhr-response": 79,
        "trusted-set-attr": 80,
        "trusted-set-constant": 81,
        "trusted-set-cookie-reload": 82,
        "trusted-set-cookie": 83,
        "trusted-set-local-storage-item": 84,
        "trusted-suppress-native-method": 85,
        "xml-prune": 86,
        "xml-prune.js": 86,
        "ubo-xml-prune.js": 86,
        "ubo-xml-prune": 86
      }
    };
    var compatibilityTableData = {
      modifiersCompatibilityTableData: modifiersCompatibilityTableData,
      redirectsCompatibilityTableData: redirectsCompatibilityTableData,
      scriptletsCompatibilityTableData: scriptletsCompatibilityTableData
    };
    compatibilityTableData$1.default = compatibilityTableData;
    var modifiersCompatibilityTableData_1 = compatibilityTableData$1.modifiersCompatibilityTableData = modifiersCompatibilityTableData;
    var redirectsCompatibilityTableData_1 = compatibilityTableData$1.redirectsCompatibilityTableData = redirectsCompatibilityTableData;
    var scriptletsCompatibilityTableData_1 = compatibilityTableData$1.scriptletsCompatibilityTableData = scriptletsCompatibilityTableData;
    var util;
    (function (util) {
        util.assertEqual = (val) => val;
        function assertIs(_arg) { }
        util.assertIs = assertIs;
        function assertNever(_x) {
            throw new Error();
        }
        util.assertNever = assertNever;
        util.arrayToEnum = (items) => {
            const obj = {};
            for (const item of items) {
                obj[item] = item;
            }
            return obj;
        };
        util.getValidEnumValues = (obj) => {
            const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
            const filtered = {};
            for (const k of validKeys) {
                filtered[k] = obj[k];
            }
            return util.objectValues(filtered);
        };
        util.objectValues = (obj) => {
            return util.objectKeys(obj).map(function (e) {
                return obj[e];
            });
        };
        util.objectKeys = typeof Object.keys === "function"
            ? (obj) => Object.keys(obj)
            : (object) => {
                const keys = [];
                for (const key in object) {
                    if (Object.prototype.hasOwnProperty.call(object, key)) {
                        keys.push(key);
                    }
                }
                return keys;
            };
        util.find = (arr, checker) => {
            for (const item of arr) {
                if (checker(item))
                    return item;
            }
            return undefined;
        };
        util.isInteger = typeof Number.isInteger === "function"
            ? (val) => Number.isInteger(val)
            : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
        function joinValues(array, separator = " | ") {
            return array
                .map((val) => (typeof val === "string" ? `'${val}'` : val))
                .join(separator);
        }
        util.joinValues = joinValues;
        util.jsonStringifyReplacer = (_, value) => {
            if (typeof value === "bigint") {
                return value.toString();
            }
            return value;
        };
    })(util || (util = {}));
    var objectUtil;
    (function (objectUtil) {
        objectUtil.mergeShapes = (first, second) => {
            return {
                ...first,
                ...second,
            };
        };
    })(objectUtil || (objectUtil = {}));
    const ZodParsedType = util.arrayToEnum([
        "string",
        "nan",
        "number",
        "integer",
        "float",
        "boolean",
        "date",
        "bigint",
        "symbol",
        "function",
        "undefined",
        "null",
        "array",
        "object",
        "unknown",
        "promise",
        "void",
        "never",
        "map",
        "set",
    ]);
    const getParsedType = (data) => {
        const t = typeof data;
        switch (t) {
            case "undefined":
                return ZodParsedType.undefined;
            case "string":
                return ZodParsedType.string;
            case "number":
                return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
            case "boolean":
                return ZodParsedType.boolean;
            case "function":
                return ZodParsedType.function;
            case "bigint":
                return ZodParsedType.bigint;
            case "symbol":
                return ZodParsedType.symbol;
            case "object":
                if (Array.isArray(data)) {
                    return ZodParsedType.array;
                }
                if (data === null) {
                    return ZodParsedType.null;
                }
                if (data.then &&
                    typeof data.then === "function" &&
                    data.catch &&
                    typeof data.catch === "function") {
                    return ZodParsedType.promise;
                }
                if (typeof Map !== "undefined" && data instanceof Map) {
                    return ZodParsedType.map;
                }
                if (typeof Set !== "undefined" && data instanceof Set) {
                    return ZodParsedType.set;
                }
                if (typeof Date !== "undefined" && data instanceof Date) {
                    return ZodParsedType.date;
                }
                return ZodParsedType.object;
            default:
                return ZodParsedType.unknown;
        }
    };
    const ZodIssueCode = util.arrayToEnum([
        "invalid_type",
        "invalid_literal",
        "custom",
        "invalid_union",
        "invalid_union_discriminator",
        "invalid_enum_value",
        "unrecognized_keys",
        "invalid_arguments",
        "invalid_return_type",
        "invalid_date",
        "invalid_string",
        "too_small",
        "too_big",
        "invalid_intersection_types",
        "not_multiple_of",
        "not_finite",
    ]);
    const quotelessJson = (obj) => {
        const json = JSON.stringify(obj, null, 2);
        return json.replace(/"([^"]+)":/g, "$1:");
    };
    class ZodError extends Error {
        constructor(issues) {
            super();
            this.issues = [];
            this.addIssue = (sub) => {
                this.issues = [...this.issues, sub];
            };
            this.addIssues = (subs = []) => {
                this.issues = [...this.issues, ...subs];
            };
            const actualProto = new.target.prototype;
            if (Object.setPrototypeOf) {
                Object.setPrototypeOf(this, actualProto);
            }
            else {
                this.__proto__ = actualProto;
            }
            this.name = "ZodError";
            this.issues = issues;
        }
        get errors() {
            return this.issues;
        }
        format(_mapper) {
            const mapper = _mapper ||
                function (issue) {
                    return issue.message;
                };
            const fieldErrors = { _errors: [] };
            const processError = (error) => {
                for (const issue of error.issues) {
                    if (issue.code === "invalid_union") {
                        issue.unionErrors.map(processError);
                    }
                    else if (issue.code === "invalid_return_type") {
                        processError(issue.returnTypeError);
                    }
                    else if (issue.code === "invalid_arguments") {
                        processError(issue.argumentsError);
                    }
                    else if (issue.path.length === 0) {
                        fieldErrors._errors.push(mapper(issue));
                    }
                    else {
                        let curr = fieldErrors;
                        let i = 0;
                        while (i < issue.path.length) {
                            const el = issue.path[i];
                            const terminal = i === issue.path.length - 1;
                            if (!terminal) {
                                curr[el] = curr[el] || { _errors: [] };
                            }
                            else {
                                curr[el] = curr[el] || { _errors: [] };
                                curr[el]._errors.push(mapper(issue));
                            }
                            curr = curr[el];
                            i++;
                        }
                    }
                }
            };
            processError(this);
            return fieldErrors;
        }
        toString() {
            return this.message;
        }
        get message() {
            return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
        }
        get isEmpty() {
            return this.issues.length === 0;
        }
        flatten(mapper = (issue) => issue.message) {
            const fieldErrors = {};
            const formErrors = [];
            for (const sub of this.issues) {
                if (sub.path.length > 0) {
                    fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
                    fieldErrors[sub.path[0]].push(mapper(sub));
                }
                else {
                    formErrors.push(mapper(sub));
                }
            }
            return { formErrors, fieldErrors };
        }
        get formErrors() {
            return this.flatten();
        }
    }
    ZodError.create = (issues) => {
        const error = new ZodError(issues);
        return error;
    };
    const errorMap = (issue, _ctx) => {
        let message;
        switch (issue.code) {
            case ZodIssueCode.invalid_type:
                if (issue.received === ZodParsedType.undefined) {
                    message = "Required";
                }
                else {
                    message = `Expected ${issue.expected}, received ${issue.received}`;
                }
                break;
            case ZodIssueCode.invalid_literal:
                message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
                break;
            case ZodIssueCode.unrecognized_keys:
                message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
                break;
            case ZodIssueCode.invalid_union:
                message = `Invalid input`;
                break;
            case ZodIssueCode.invalid_union_discriminator:
                message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
                break;
            case ZodIssueCode.invalid_enum_value:
                message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
                break;
            case ZodIssueCode.invalid_arguments:
                message = `Invalid function arguments`;
                break;
            case ZodIssueCode.invalid_return_type:
                message = `Invalid function return type`;
                break;
            case ZodIssueCode.invalid_date:
                message = `Invalid date`;
                break;
            case ZodIssueCode.invalid_string:
                if (typeof issue.validation === "object") {
                    if ("includes" in issue.validation) {
                        message = `Invalid input: must include "${issue.validation.includes}"`;
                        if (typeof issue.validation.position === "number") {
                            message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
                        }
                    }
                    else if ("startsWith" in issue.validation) {
                        message = `Invalid input: must start with "${issue.validation.startsWith}"`;
                    }
                    else if ("endsWith" in issue.validation) {
                        message = `Invalid input: must end with "${issue.validation.endsWith}"`;
                    }
                    else {
                        util.assertNever(issue.validation);
                    }
                }
                else if (issue.validation !== "regex") {
                    message = `Invalid ${issue.validation}`;
                }
                else {
                    message = "Invalid";
                }
                break;
            case ZodIssueCode.too_small:
                if (issue.type === "array")
                    message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
                else if (issue.type === "string")
                    message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
                else if (issue.type === "number")
                    message = `Number must be ${issue.exact
                    ? `exactly equal to `
                    : issue.inclusive
                        ? `greater than or equal to `
                        : `greater than `}${issue.minimum}`;
                else if (issue.type === "date")
                    message = `Date must be ${issue.exact
                    ? `exactly equal to `
                    : issue.inclusive
                        ? `greater than or equal to `
                        : `greater than `}${new Date(Number(issue.minimum))}`;
                else
                    message = "Invalid input";
                break;
            case ZodIssueCode.too_big:
                if (issue.type === "array")
                    message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
                else if (issue.type === "string")
                    message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
                else if (issue.type === "number")
                    message = `Number must be ${issue.exact
                    ? `exactly`
                    : issue.inclusive
                        ? `less than or equal to`
                        : `less than`} ${issue.maximum}`;
                else if (issue.type === "bigint")
                    message = `BigInt must be ${issue.exact
                    ? `exactly`
                    : issue.inclusive
                        ? `less than or equal to`
                        : `less than`} ${issue.maximum}`;
                else if (issue.type === "date")
                    message = `Date must be ${issue.exact
                    ? `exactly`
                    : issue.inclusive
                        ? `smaller than or equal to`
                        : `smaller than`} ${new Date(Number(issue.maximum))}`;
                else
                    message = "Invalid input";
                break;
            case ZodIssueCode.custom:
                message = `Invalid input`;
                break;
            case ZodIssueCode.invalid_intersection_types:
                message = `Intersection results could not be merged`;
                break;
            case ZodIssueCode.not_multiple_of:
                message = `Number must be a multiple of ${issue.multipleOf}`;
                break;
            case ZodIssueCode.not_finite:
                message = "Number must be finite";
                break;
            default:
                message = _ctx.defaultError;
                util.assertNever(issue);
        }
        return { message };
    };
    let overrideErrorMap = errorMap;
    function setErrorMap(map) {
        overrideErrorMap = map;
    }
    function getErrorMap() {
        return overrideErrorMap;
    }
    const makeIssue = (params) => {
        const { data, path, errorMaps, issueData } = params;
        const fullPath = [...path, ...(issueData.path || [])];
        const fullIssue = {
            ...issueData,
            path: fullPath,
        };
        let errorMessage = "";
        const maps = errorMaps
            .filter((m) => !!m)
            .slice()
            .reverse();
        for (const map of maps) {
            errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
        }
        return {
            ...issueData,
            path: fullPath,
            message: issueData.message || errorMessage,
        };
    };
    const EMPTY_PATH = [];
    function addIssueToContext(ctx, issueData) {
        const issue = makeIssue({
            issueData: issueData,
            data: ctx.data,
            path: ctx.path,
            errorMaps: [
                ctx.common.contextualErrorMap,
                ctx.schemaErrorMap,
                getErrorMap(),
                errorMap,
            ].filter((x) => !!x),
        });
        ctx.common.issues.push(issue);
    }
    class ParseStatus {
        constructor() {
            this.value = "valid";
        }
        dirty() {
            if (this.value === "valid")
                this.value = "dirty";
        }
        abort() {
            if (this.value !== "aborted")
                this.value = "aborted";
        }
        static mergeArray(status, results) {
            const arrayValue = [];
            for (const s of results) {
                if (s.status === "aborted")
                    return INVALID;
                if (s.status === "dirty")
                    status.dirty();
                arrayValue.push(s.value);
            }
            return { status: status.value, value: arrayValue };
        }
        static async mergeObjectAsync(status, pairs) {
            const syncPairs = [];
            for (const pair of pairs) {
                syncPairs.push({
                    key: await pair.key,
                    value: await pair.value,
                });
            }
            return ParseStatus.mergeObjectSync(status, syncPairs);
        }
        static mergeObjectSync(status, pairs) {
            const finalObject = {};
            for (const pair of pairs) {
                const { key, value } = pair;
                if (key.status === "aborted")
                    return INVALID;
                if (value.status === "aborted")
                    return INVALID;
                if (key.status === "dirty")
                    status.dirty();
                if (value.status === "dirty")
                    status.dirty();
                if (typeof value.value !== "undefined" || pair.alwaysSet) {
                    finalObject[key.value] = value.value;
                }
            }
            return { status: status.value, value: finalObject };
        }
    }
    const INVALID = Object.freeze({
        status: "aborted",
    });
    const DIRTY = (value) => ({ status: "dirty", value });
    const OK = (value) => ({ status: "valid", value });
    const isAborted = (x) => x.status === "aborted";
    const isDirty = (x) => x.status === "dirty";
    const isValid = (x) => x.status === "valid";
    const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
    var errorUtil;
    (function (errorUtil) {
        errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
        errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
    })(errorUtil || (errorUtil = {}));
    class ParseInputLazyPath {
        constructor(parent, value, path, key) {
            this._cachedPath = [];
            this.parent = parent;
            this.data = value;
            this._path = path;
            this._key = key;
        }
        get path() {
            if (!this._cachedPath.length) {
                if (this._key instanceof Array) {
                    this._cachedPath.push(...this._path, ...this._key);
                }
                else {
                    this._cachedPath.push(...this._path, this._key);
                }
            }
            return this._cachedPath;
        }
    }
    const handleResult = (ctx, result) => {
        if (isValid(result)) {
            return { success: true, data: result.value };
        }
        else {
            if (!ctx.common.issues.length) {
                throw new Error("Validation failed but no issues detected.");
            }
            return {
                success: false,
                get error() {
                    if (this._error)
                        return this._error;
                    const error = new ZodError(ctx.common.issues);
                    this._error = error;
                    return this._error;
                },
            };
        }
    };
    function processCreateParams(params) {
        if (!params)
            return {};
        const { errorMap, invalid_type_error, required_error, description } = params;
        if (errorMap && (invalid_type_error || required_error)) {
            throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
        }
        if (errorMap)
            return { errorMap: errorMap, description };
        const customMap = (iss, ctx) => {
            if (iss.code !== "invalid_type")
                return { message: ctx.defaultError };
            if (typeof ctx.data === "undefined") {
                return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
            }
            return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
        };
        return { errorMap: customMap, description };
    }
    class ZodType {
        constructor(def) {
            this.spa = this.safeParseAsync;
            this._def = def;
            this.parse = this.parse.bind(this);
            this.safeParse = this.safeParse.bind(this);
            this.parseAsync = this.parseAsync.bind(this);
            this.safeParseAsync = this.safeParseAsync.bind(this);
            this.spa = this.spa.bind(this);
            this.refine = this.refine.bind(this);
            this.refinement = this.refinement.bind(this);
            this.superRefine = this.superRefine.bind(this);
            this.optional = this.optional.bind(this);
            this.nullable = this.nullable.bind(this);
            this.nullish = this.nullish.bind(this);
            this.array = this.array.bind(this);
            this.promise = this.promise.bind(this);
            this.or = this.or.bind(this);
            this.and = this.and.bind(this);
            this.transform = this.transform.bind(this);
            this.brand = this.brand.bind(this);
            this.default = this.default.bind(this);
            this.catch = this.catch.bind(this);
            this.describe = this.describe.bind(this);
            this.pipe = this.pipe.bind(this);
            this.isNullable = this.isNullable.bind(this);
            this.isOptional = this.isOptional.bind(this);
        }
        get description() {
            return this._def.description;
        }
        _getType(input) {
            return getParsedType(input.data);
        }
        _getOrReturnCtx(input, ctx) {
            return (ctx || {
                common: input.parent.common,
                data: input.data,
                parsedType: getParsedType(input.data),
                schemaErrorMap: this._def.errorMap,
                path: input.path,
                parent: input.parent,
            });
        }
        _processInputParams(input) {
            return {
                status: new ParseStatus(),
                ctx: {
                    common: input.parent.common,
                    data: input.data,
                    parsedType: getParsedType(input.data),
                    schemaErrorMap: this._def.errorMap,
                    path: input.path,
                    parent: input.parent,
                },
            };
        }
        _parseSync(input) {
            const result = this._parse(input);
            if (isAsync(result)) {
                throw new Error("Synchronous parse encountered promise.");
            }
            return result;
        }
        _parseAsync(input) {
            const result = this._parse(input);
            return Promise.resolve(result);
        }
        parse(data, params) {
            const result = this.safeParse(data, params);
            if (result.success)
                return result.data;
            throw result.error;
        }
        safeParse(data, params) {
            var _a;
            const ctx = {
                common: {
                    issues: [],
                    async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
                    contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
                },
                path: (params === null || params === void 0 ? void 0 : params.path) || [],
                schemaErrorMap: this._def.errorMap,
                parent: null,
                data,
                parsedType: getParsedType(data),
            };
            const result = this._parseSync({ data, path: ctx.path, parent: ctx });
            return handleResult(ctx, result);
        }
        async parseAsync(data, params) {
            const result = await this.safeParseAsync(data, params);
            if (result.success)
                return result.data;
            throw result.error;
        }
        async safeParseAsync(data, params) {
            const ctx = {
                common: {
                    issues: [],
                    contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
                    async: true,
                },
                path: (params === null || params === void 0 ? void 0 : params.path) || [],
                schemaErrorMap: this._def.errorMap,
                parent: null,
                data,
                parsedType: getParsedType(data),
            };
            const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
            const result = await (isAsync(maybeAsyncResult)
                ? maybeAsyncResult
                : Promise.resolve(maybeAsyncResult));
            return handleResult(ctx, result);
        }
        refine(check, message) {
            const getIssueProperties = (val) => {
                if (typeof message === "string" || typeof message === "undefined") {
                    return { message };
                }
                else if (typeof message === "function") {
                    return message(val);
                }
                else {
                    return message;
                }
            };
            return this._refinement((val, ctx) => {
                const result = check(val);
                const setError = () => ctx.addIssue({
                    code: ZodIssueCode.custom,
                    ...getIssueProperties(val),
                });
                if (typeof Promise !== "undefined" && result instanceof Promise) {
                    return result.then((data) => {
                        if (!data) {
                            setError();
                            return false;
                        }
                        else {
                            return true;
                        }
                    });
                }
                if (!result) {
                    setError();
                    return false;
                }
                else {
                    return true;
                }
            });
        }
        refinement(check, refinementData) {
            return this._refinement((val, ctx) => {
                if (!check(val)) {
                    ctx.addIssue(typeof refinementData === "function"
                        ? refinementData(val, ctx)
                        : refinementData);
                    return false;
                }
                else {
                    return true;
                }
            });
        }
        _refinement(refinement) {
            return new ZodEffects({
                schema: this,
                typeName: ZodFirstPartyTypeKind.ZodEffects,
                effect: { type: "refinement", refinement },
            });
        }
        superRefine(refinement) {
            return this._refinement(refinement);
        }
        optional() {
            return ZodOptional.create(this, this._def);
        }
        nullable() {
            return ZodNullable.create(this, this._def);
        }
        nullish() {
            return this.nullable().optional();
        }
        array() {
            return ZodArray.create(this, this._def);
        }
        promise() {
            return ZodPromise.create(this, this._def);
        }
        or(option) {
            return ZodUnion.create([this, option], this._def);
        }
        and(incoming) {
            return ZodIntersection.create(this, incoming, this._def);
        }
        transform(transform) {
            return new ZodEffects({
                ...processCreateParams(this._def),
                schema: this,
                typeName: ZodFirstPartyTypeKind.ZodEffects,
                effect: { type: "transform", transform },
            });
        }
        default(def) {
            const defaultValueFunc = typeof def === "function" ? def : () => def;
            return new ZodDefault({
                ...processCreateParams(this._def),
                innerType: this,
                defaultValue: defaultValueFunc,
                typeName: ZodFirstPartyTypeKind.ZodDefault,
            });
        }
        brand() {
            return new ZodBranded({
                typeName: ZodFirstPartyTypeKind.ZodBranded,
                type: this,
                ...processCreateParams(this._def),
            });
        }
        catch(def) {
            const catchValueFunc = typeof def === "function" ? def : () => def;
            return new ZodCatch({
                ...processCreateParams(this._def),
                innerType: this,
                catchValue: catchValueFunc,
                typeName: ZodFirstPartyTypeKind.ZodCatch,
            });
        }
        describe(description) {
            const This = this.constructor;
            return new This({
                ...this._def,
                description,
            });
        }
        pipe(target) {
            return ZodPipeline.create(this, target);
        }
        isOptional() {
            return this.safeParse(undefined).success;
        }
        isNullable() {
            return this.safeParse(null).success;
        }
    }
    const cuidRegex = /^c[^\s-]{8,}$/i;
    const cuid2Regex = /^[a-z][a-z0-9]*$/;
    const ulidRegex = /[0-9A-HJKMNP-TV-Z]{26}/;
    const uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
    const emailRegex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/;
    const emojiRegex = /^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u;
    const ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
    const ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
    const datetimeRegex = (args) => {
        if (args.precision) {
            if (args.offset) {
                return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
            }
            else {
                return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
            }
        }
        else if (args.precision === 0) {
            if (args.offset) {
                return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
            }
            else {
                return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
            }
        }
        else {
            if (args.offset) {
                return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
            }
            else {
                return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
            }
        }
    };
    function isValidIP(ip, version) {
        if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
            return true;
        }
        if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
            return true;
        }
        return false;
    }
    class ZodString extends ZodType {
        constructor() {
            super(...arguments);
            this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
                validation,
                code: ZodIssueCode.invalid_string,
                ...errorUtil.errToObj(message),
            });
            this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
            this.trim = () => new ZodString({
                ...this._def,
                checks: [...this._def.checks, { kind: "trim" }],
            });
            this.toLowerCase = () => new ZodString({
                ...this._def,
                checks: [...this._def.checks, { kind: "toLowerCase" }],
            });
            this.toUpperCase = () => new ZodString({
                ...this._def,
                checks: [...this._def.checks, { kind: "toUpperCase" }],
            });
        }
        _parse(input) {
            if (this._def.coerce) {
                input.data = String(input.data);
            }
            const parsedType = this._getType(input);
            if (parsedType !== ZodParsedType.string) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.string,
                    received: ctx.parsedType,
                }
                );
                return INVALID;
            }
            const status = new ParseStatus();
            let ctx = undefined;
            for (const check of this._def.checks) {
                if (check.kind === "min") {
                    if (input.data.length < check.value) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.too_small,
                            minimum: check.value,
                            type: "string",
                            inclusive: true,
                            exact: false,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "max") {
                    if (input.data.length > check.value) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.too_big,
                            maximum: check.value,
                            type: "string",
                            inclusive: true,
                            exact: false,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "length") {
                    const tooBig = input.data.length > check.value;
                    const tooSmall = input.data.length < check.value;
                    if (tooBig || tooSmall) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        if (tooBig) {
                            addIssueToContext(ctx, {
                                code: ZodIssueCode.too_big,
                                maximum: check.value,
                                type: "string",
                                inclusive: true,
                                exact: true,
                                message: check.message,
                            });
                        }
                        else if (tooSmall) {
                            addIssueToContext(ctx, {
                                code: ZodIssueCode.too_small,
                                minimum: check.value,
                                type: "string",
                                inclusive: true,
                                exact: true,
                                message: check.message,
                            });
                        }
                        status.dirty();
                    }
                }
                else if (check.kind === "email") {
                    if (!emailRegex.test(input.data)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            validation: "email",
                            code: ZodIssueCode.invalid_string,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "emoji") {
                    if (!emojiRegex.test(input.data)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            validation: "emoji",
                            code: ZodIssueCode.invalid_string,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "uuid") {
                    if (!uuidRegex.test(input.data)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            validation: "uuid",
                            code: ZodIssueCode.invalid_string,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "cuid") {
                    if (!cuidRegex.test(input.data)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            validation: "cuid",
                            code: ZodIssueCode.invalid_string,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "cuid2") {
                    if (!cuid2Regex.test(input.data)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            validation: "cuid2",
                            code: ZodIssueCode.invalid_string,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "ulid") {
                    if (!ulidRegex.test(input.data)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            validation: "ulid",
                            code: ZodIssueCode.invalid_string,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "url") {
                    try {
                        new URL(input.data);
                    }
                    catch (_a) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            validation: "url",
                            code: ZodIssueCode.invalid_string,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "regex") {
                    check.regex.lastIndex = 0;
                    const testResult = check.regex.test(input.data);
                    if (!testResult) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            validation: "regex",
                            code: ZodIssueCode.invalid_string,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "trim") {
                    input.data = input.data.trim();
                }
                else if (check.kind === "includes") {
                    if (!input.data.includes(check.value, check.position)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.invalid_string,
                            validation: { includes: check.value, position: check.position },
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "toLowerCase") {
                    input.data = input.data.toLowerCase();
                }
                else if (check.kind === "toUpperCase") {
                    input.data = input.data.toUpperCase();
                }
                else if (check.kind === "startsWith") {
                    if (!input.data.startsWith(check.value)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.invalid_string,
                            validation: { startsWith: check.value },
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "endsWith") {
                    if (!input.data.endsWith(check.value)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.invalid_string,
                            validation: { endsWith: check.value },
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "datetime") {
                    const regex = datetimeRegex(check);
                    if (!regex.test(input.data)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.invalid_string,
                            validation: "datetime",
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "ip") {
                    if (!isValidIP(input.data, check.version)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            validation: "ip",
                            code: ZodIssueCode.invalid_string,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else {
                    util.assertNever(check);
                }
            }
            return { status: status.value, value: input.data };
        }
        _addCheck(check) {
            return new ZodString({
                ...this._def,
                checks: [...this._def.checks, check],
            });
        }
        email(message) {
            return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
        }
        url(message) {
            return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
        }
        emoji(message) {
            return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
        }
        uuid(message) {
            return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
        }
        cuid(message) {
            return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
        }
        cuid2(message) {
            return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
        }
        ulid(message) {
            return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
        }
        ip(options) {
            return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
        }
        datetime(options) {
            var _a;
            if (typeof options === "string") {
                return this._addCheck({
                    kind: "datetime",
                    precision: null,
                    offset: false,
                    message: options,
                });
            }
            return this._addCheck({
                kind: "datetime",
                precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
                offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
                ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
            });
        }
        regex(regex, message) {
            return this._addCheck({
                kind: "regex",
                regex: regex,
                ...errorUtil.errToObj(message),
            });
        }
        includes(value, options) {
            return this._addCheck({
                kind: "includes",
                value: value,
                position: options === null || options === void 0 ? void 0 : options.position,
                ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
            });
        }
        startsWith(value, message) {
            return this._addCheck({
                kind: "startsWith",
                value: value,
                ...errorUtil.errToObj(message),
            });
        }
        endsWith(value, message) {
            return this._addCheck({
                kind: "endsWith",
                value: value,
                ...errorUtil.errToObj(message),
            });
        }
        min(minLength, message) {
            return this._addCheck({
                kind: "min",
                value: minLength,
                ...errorUtil.errToObj(message),
            });
        }
        max(maxLength, message) {
            return this._addCheck({
                kind: "max",
                value: maxLength,
                ...errorUtil.errToObj(message),
            });
        }
        length(len, message) {
            return this._addCheck({
                kind: "length",
                value: len,
                ...errorUtil.errToObj(message),
            });
        }
        get isDatetime() {
            return !!this._def.checks.find((ch) => ch.kind === "datetime");
        }
        get isEmail() {
            return !!this._def.checks.find((ch) => ch.kind === "email");
        }
        get isURL() {
            return !!this._def.checks.find((ch) => ch.kind === "url");
        }
        get isEmoji() {
            return !!this._def.checks.find((ch) => ch.kind === "emoji");
        }
        get isUUID() {
            return !!this._def.checks.find((ch) => ch.kind === "uuid");
        }
        get isCUID() {
            return !!this._def.checks.find((ch) => ch.kind === "cuid");
        }
        get isCUID2() {
            return !!this._def.checks.find((ch) => ch.kind === "cuid2");
        }
        get isULID() {
            return !!this._def.checks.find((ch) => ch.kind === "ulid");
        }
        get isIP() {
            return !!this._def.checks.find((ch) => ch.kind === "ip");
        }
        get minLength() {
            let min = null;
            for (const ch of this._def.checks) {
                if (ch.kind === "min") {
                    if (min === null || ch.value > min)
                        min = ch.value;
                }
            }
            return min;
        }
        get maxLength() {
            let max = null;
            for (const ch of this._def.checks) {
                if (ch.kind === "max") {
                    if (max === null || ch.value < max)
                        max = ch.value;
                }
            }
            return max;
        }
    }
    ZodString.create = (params) => {
        var _a;
        return new ZodString({
            checks: [],
            typeName: ZodFirstPartyTypeKind.ZodString,
            coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
            ...processCreateParams(params),
        });
    };
    function floatSafeRemainder(val, step) {
        const valDecCount = (val.toString().split(".")[1] || "").length;
        const stepDecCount = (step.toString().split(".")[1] || "").length;
        const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
        const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
        const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
        return (valInt % stepInt) / Math.pow(10, decCount);
    }
    class ZodNumber extends ZodType {
        constructor() {
            super(...arguments);
            this.min = this.gte;
            this.max = this.lte;
            this.step = this.multipleOf;
        }
        _parse(input) {
            if (this._def.coerce) {
                input.data = Number(input.data);
            }
            const parsedType = this._getType(input);
            if (parsedType !== ZodParsedType.number) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.number,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            let ctx = undefined;
            const status = new ParseStatus();
            for (const check of this._def.checks) {
                if (check.kind === "int") {
                    if (!util.isInteger(input.data)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.invalid_type,
                            expected: "integer",
                            received: "float",
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "min") {
                    const tooSmall = check.inclusive
                        ? input.data < check.value
                        : input.data <= check.value;
                    if (tooSmall) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.too_small,
                            minimum: check.value,
                            type: "number",
                            inclusive: check.inclusive,
                            exact: false,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "max") {
                    const tooBig = check.inclusive
                        ? input.data > check.value
                        : input.data >= check.value;
                    if (tooBig) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.too_big,
                            maximum: check.value,
                            type: "number",
                            inclusive: check.inclusive,
                            exact: false,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "multipleOf") {
                    if (floatSafeRemainder(input.data, check.value) !== 0) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.not_multiple_of,
                            multipleOf: check.value,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "finite") {
                    if (!Number.isFinite(input.data)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.not_finite,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else {
                    util.assertNever(check);
                }
            }
            return { status: status.value, value: input.data };
        }
        gte(value, message) {
            return this.setLimit("min", value, true, errorUtil.toString(message));
        }
        gt(value, message) {
            return this.setLimit("min", value, false, errorUtil.toString(message));
        }
        lte(value, message) {
            return this.setLimit("max", value, true, errorUtil.toString(message));
        }
        lt(value, message) {
            return this.setLimit("max", value, false, errorUtil.toString(message));
        }
        setLimit(kind, value, inclusive, message) {
            return new ZodNumber({
                ...this._def,
                checks: [
                    ...this._def.checks,
                    {
                        kind,
                        value,
                        inclusive,
                        message: errorUtil.toString(message),
                    },
                ],
            });
        }
        _addCheck(check) {
            return new ZodNumber({
                ...this._def,
                checks: [...this._def.checks, check],
            });
        }
        int(message) {
            return this._addCheck({
                kind: "int",
                message: errorUtil.toString(message),
            });
        }
        positive(message) {
            return this._addCheck({
                kind: "min",
                value: 0,
                inclusive: false,
                message: errorUtil.toString(message),
            });
        }
        negative(message) {
            return this._addCheck({
                kind: "max",
                value: 0,
                inclusive: false,
                message: errorUtil.toString(message),
            });
        }
        nonpositive(message) {
            return this._addCheck({
                kind: "max",
                value: 0,
                inclusive: true,
                message: errorUtil.toString(message),
            });
        }
        nonnegative(message) {
            return this._addCheck({
                kind: "min",
                value: 0,
                inclusive: true,
                message: errorUtil.toString(message),
            });
        }
        multipleOf(value, message) {
            return this._addCheck({
                kind: "multipleOf",
                value: value,
                message: errorUtil.toString(message),
            });
        }
        finite(message) {
            return this._addCheck({
                kind: "finite",
                message: errorUtil.toString(message),
            });
        }
        safe(message) {
            return this._addCheck({
                kind: "min",
                inclusive: true,
                value: Number.MIN_SAFE_INTEGER,
                message: errorUtil.toString(message),
            })._addCheck({
                kind: "max",
                inclusive: true,
                value: Number.MAX_SAFE_INTEGER,
                message: errorUtil.toString(message),
            });
        }
        get minValue() {
            let min = null;
            for (const ch of this._def.checks) {
                if (ch.kind === "min") {
                    if (min === null || ch.value > min)
                        min = ch.value;
                }
            }
            return min;
        }
        get maxValue() {
            let max = null;
            for (const ch of this._def.checks) {
                if (ch.kind === "max") {
                    if (max === null || ch.value < max)
                        max = ch.value;
                }
            }
            return max;
        }
        get isInt() {
            return !!this._def.checks.find((ch) => ch.kind === "int" ||
                (ch.kind === "multipleOf" && util.isInteger(ch.value)));
        }
        get isFinite() {
            let max = null, min = null;
            for (const ch of this._def.checks) {
                if (ch.kind === "finite" ||
                    ch.kind === "int" ||
                    ch.kind === "multipleOf") {
                    return true;
                }
                else if (ch.kind === "min") {
                    if (min === null || ch.value > min)
                        min = ch.value;
                }
                else if (ch.kind === "max") {
                    if (max === null || ch.value < max)
                        max = ch.value;
                }
            }
            return Number.isFinite(min) && Number.isFinite(max);
        }
    }
    ZodNumber.create = (params) => {
        return new ZodNumber({
            checks: [],
            typeName: ZodFirstPartyTypeKind.ZodNumber,
            coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
            ...processCreateParams(params),
        });
    };
    class ZodBigInt extends ZodType {
        constructor() {
            super(...arguments);
            this.min = this.gte;
            this.max = this.lte;
        }
        _parse(input) {
            if (this._def.coerce) {
                input.data = BigInt(input.data);
            }
            const parsedType = this._getType(input);
            if (parsedType !== ZodParsedType.bigint) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.bigint,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            let ctx = undefined;
            const status = new ParseStatus();
            for (const check of this._def.checks) {
                if (check.kind === "min") {
                    const tooSmall = check.inclusive
                        ? input.data < check.value
                        : input.data <= check.value;
                    if (tooSmall) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.too_small,
                            type: "bigint",
                            minimum: check.value,
                            inclusive: check.inclusive,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "max") {
                    const tooBig = check.inclusive
                        ? input.data > check.value
                        : input.data >= check.value;
                    if (tooBig) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.too_big,
                            type: "bigint",
                            maximum: check.value,
                            inclusive: check.inclusive,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "multipleOf") {
                    if (input.data % check.value !== BigInt(0)) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.not_multiple_of,
                            multipleOf: check.value,
                            message: check.message,
                        });
                        status.dirty();
                    }
                }
                else {
                    util.assertNever(check);
                }
            }
            return { status: status.value, value: input.data };
        }
        gte(value, message) {
            return this.setLimit("min", value, true, errorUtil.toString(message));
        }
        gt(value, message) {
            return this.setLimit("min", value, false, errorUtil.toString(message));
        }
        lte(value, message) {
            return this.setLimit("max", value, true, errorUtil.toString(message));
        }
        lt(value, message) {
            return this.setLimit("max", value, false, errorUtil.toString(message));
        }
        setLimit(kind, value, inclusive, message) {
            return new ZodBigInt({
                ...this._def,
                checks: [
                    ...this._def.checks,
                    {
                        kind,
                        value,
                        inclusive,
                        message: errorUtil.toString(message),
                    },
                ],
            });
        }
        _addCheck(check) {
            return new ZodBigInt({
                ...this._def,
                checks: [...this._def.checks, check],
            });
        }
        positive(message) {
            return this._addCheck({
                kind: "min",
                value: BigInt(0),
                inclusive: false,
                message: errorUtil.toString(message),
            });
        }
        negative(message) {
            return this._addCheck({
                kind: "max",
                value: BigInt(0),
                inclusive: false,
                message: errorUtil.toString(message),
            });
        }
        nonpositive(message) {
            return this._addCheck({
                kind: "max",
                value: BigInt(0),
                inclusive: true,
                message: errorUtil.toString(message),
            });
        }
        nonnegative(message) {
            return this._addCheck({
                kind: "min",
                value: BigInt(0),
                inclusive: true,
                message: errorUtil.toString(message),
            });
        }
        multipleOf(value, message) {
            return this._addCheck({
                kind: "multipleOf",
                value,
                message: errorUtil.toString(message),
            });
        }
        get minValue() {
            let min = null;
            for (const ch of this._def.checks) {
                if (ch.kind === "min") {
                    if (min === null || ch.value > min)
                        min = ch.value;
                }
            }
            return min;
        }
        get maxValue() {
            let max = null;
            for (const ch of this._def.checks) {
                if (ch.kind === "max") {
                    if (max === null || ch.value < max)
                        max = ch.value;
                }
            }
            return max;
        }
    }
    ZodBigInt.create = (params) => {
        var _a;
        return new ZodBigInt({
            checks: [],
            typeName: ZodFirstPartyTypeKind.ZodBigInt,
            coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
            ...processCreateParams(params),
        });
    };
    class ZodBoolean extends ZodType {
        _parse(input) {
            if (this._def.coerce) {
                input.data = Boolean(input.data);
            }
            const parsedType = this._getType(input);
            if (parsedType !== ZodParsedType.boolean) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.boolean,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            return OK(input.data);
        }
    }
    ZodBoolean.create = (params) => {
        return new ZodBoolean({
            typeName: ZodFirstPartyTypeKind.ZodBoolean,
            coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
            ...processCreateParams(params),
        });
    };
    class ZodDate extends ZodType {
        _parse(input) {
            if (this._def.coerce) {
                input.data = new Date(input.data);
            }
            const parsedType = this._getType(input);
            if (parsedType !== ZodParsedType.date) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.date,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            if (isNaN(input.data.getTime())) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_date,
                });
                return INVALID;
            }
            const status = new ParseStatus();
            let ctx = undefined;
            for (const check of this._def.checks) {
                if (check.kind === "min") {
                    if (input.data.getTime() < check.value) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.too_small,
                            message: check.message,
                            inclusive: true,
                            exact: false,
                            minimum: check.value,
                            type: "date",
                        });
                        status.dirty();
                    }
                }
                else if (check.kind === "max") {
                    if (input.data.getTime() > check.value) {
                        ctx = this._getOrReturnCtx(input, ctx);
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.too_big,
                            message: check.message,
                            inclusive: true,
                            exact: false,
                            maximum: check.value,
                            type: "date",
                        });
                        status.dirty();
                    }
                }
                else {
                    util.assertNever(check);
                }
            }
            return {
                status: status.value,
                value: new Date(input.data.getTime()),
            };
        }
        _addCheck(check) {
            return new ZodDate({
                ...this._def,
                checks: [...this._def.checks, check],
            });
        }
        min(minDate, message) {
            return this._addCheck({
                kind: "min",
                value: minDate.getTime(),
                message: errorUtil.toString(message),
            });
        }
        max(maxDate, message) {
            return this._addCheck({
                kind: "max",
                value: maxDate.getTime(),
                message: errorUtil.toString(message),
            });
        }
        get minDate() {
            let min = null;
            for (const ch of this._def.checks) {
                if (ch.kind === "min") {
                    if (min === null || ch.value > min)
                        min = ch.value;
                }
            }
            return min != null ? new Date(min) : null;
        }
        get maxDate() {
            let max = null;
            for (const ch of this._def.checks) {
                if (ch.kind === "max") {
                    if (max === null || ch.value < max)
                        max = ch.value;
                }
            }
            return max != null ? new Date(max) : null;
        }
    }
    ZodDate.create = (params) => {
        return new ZodDate({
            checks: [],
            coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
            typeName: ZodFirstPartyTypeKind.ZodDate,
            ...processCreateParams(params),
        });
    };
    class ZodSymbol extends ZodType {
        _parse(input) {
            const parsedType = this._getType(input);
            if (parsedType !== ZodParsedType.symbol) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.symbol,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            return OK(input.data);
        }
    }
    ZodSymbol.create = (params) => {
        return new ZodSymbol({
            typeName: ZodFirstPartyTypeKind.ZodSymbol,
            ...processCreateParams(params),
        });
    };
    class ZodUndefined extends ZodType {
        _parse(input) {
            const parsedType = this._getType(input);
            if (parsedType !== ZodParsedType.undefined) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.undefined,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            return OK(input.data);
        }
    }
    ZodUndefined.create = (params) => {
        return new ZodUndefined({
            typeName: ZodFirstPartyTypeKind.ZodUndefined,
            ...processCreateParams(params),
        });
    };
    class ZodNull extends ZodType {
        _parse(input) {
            const parsedType = this._getType(input);
            if (parsedType !== ZodParsedType.null) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.null,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            return OK(input.data);
        }
    }
    ZodNull.create = (params) => {
        return new ZodNull({
            typeName: ZodFirstPartyTypeKind.ZodNull,
            ...processCreateParams(params),
        });
    };
    class ZodAny extends ZodType {
        constructor() {
            super(...arguments);
            this._any = true;
        }
        _parse(input) {
            return OK(input.data);
        }
    }
    ZodAny.create = (params) => {
        return new ZodAny({
            typeName: ZodFirstPartyTypeKind.ZodAny,
            ...processCreateParams(params),
        });
    };
    class ZodUnknown extends ZodType {
        constructor() {
            super(...arguments);
            this._unknown = true;
        }
        _parse(input) {
            return OK(input.data);
        }
    }
    ZodUnknown.create = (params) => {
        return new ZodUnknown({
            typeName: ZodFirstPartyTypeKind.ZodUnknown,
            ...processCreateParams(params),
        });
    };
    class ZodNever extends ZodType {
        _parse(input) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.never,
                received: ctx.parsedType,
            });
            return INVALID;
        }
    }
    ZodNever.create = (params) => {
        return new ZodNever({
            typeName: ZodFirstPartyTypeKind.ZodNever,
            ...processCreateParams(params),
        });
    };
    class ZodVoid extends ZodType {
        _parse(input) {
            const parsedType = this._getType(input);
            if (parsedType !== ZodParsedType.undefined) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.void,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            return OK(input.data);
        }
    }
    ZodVoid.create = (params) => {
        return new ZodVoid({
            typeName: ZodFirstPartyTypeKind.ZodVoid,
            ...processCreateParams(params),
        });
    };
    class ZodArray extends ZodType {
        _parse(input) {
            const { ctx, status } = this._processInputParams(input);
            const def = this._def;
            if (ctx.parsedType !== ZodParsedType.array) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.array,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            if (def.exactLength !== null) {
                const tooBig = ctx.data.length > def.exactLength.value;
                const tooSmall = ctx.data.length < def.exactLength.value;
                if (tooBig || tooSmall) {
                    addIssueToContext(ctx, {
                        code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
                        minimum: (tooSmall ? def.exactLength.value : undefined),
                        maximum: (tooBig ? def.exactLength.value : undefined),
                        type: "array",
                        inclusive: true,
                        exact: true,
                        message: def.exactLength.message,
                    });
                    status.dirty();
                }
            }
            if (def.minLength !== null) {
                if (ctx.data.length < def.minLength.value) {
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.too_small,
                        minimum: def.minLength.value,
                        type: "array",
                        inclusive: true,
                        exact: false,
                        message: def.minLength.message,
                    });
                    status.dirty();
                }
            }
            if (def.maxLength !== null) {
                if (ctx.data.length > def.maxLength.value) {
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.too_big,
                        maximum: def.maxLength.value,
                        type: "array",
                        inclusive: true,
                        exact: false,
                        message: def.maxLength.message,
                    });
                    status.dirty();
                }
            }
            if (ctx.common.async) {
                return Promise.all([...ctx.data].map((item, i) => {
                    return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
                })).then((result) => {
                    return ParseStatus.mergeArray(status, result);
                });
            }
            const result = [...ctx.data].map((item, i) => {
                return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
            });
            return ParseStatus.mergeArray(status, result);
        }
        get element() {
            return this._def.type;
        }
        min(minLength, message) {
            return new ZodArray({
                ...this._def,
                minLength: { value: minLength, message: errorUtil.toString(message) },
            });
        }
        max(maxLength, message) {
            return new ZodArray({
                ...this._def,
                maxLength: { value: maxLength, message: errorUtil.toString(message) },
            });
        }
        length(len, message) {
            return new ZodArray({
                ...this._def,
                exactLength: { value: len, message: errorUtil.toString(message) },
            });
        }
        nonempty(message) {
            return this.min(1, message);
        }
    }
    ZodArray.create = (schema, params) => {
        return new ZodArray({
            type: schema,
            minLength: null,
            maxLength: null,
            exactLength: null,
            typeName: ZodFirstPartyTypeKind.ZodArray,
            ...processCreateParams(params),
        });
    };
    function deepPartialify(schema) {
        if (schema instanceof ZodObject) {
            const newShape = {};
            for (const key in schema.shape) {
                const fieldSchema = schema.shape[key];
                newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
            }
            return new ZodObject({
                ...schema._def,
                shape: () => newShape,
            });
        }
        else if (schema instanceof ZodArray) {
            return new ZodArray({
                ...schema._def,
                type: deepPartialify(schema.element),
            });
        }
        else if (schema instanceof ZodOptional) {
            return ZodOptional.create(deepPartialify(schema.unwrap()));
        }
        else if (schema instanceof ZodNullable) {
            return ZodNullable.create(deepPartialify(schema.unwrap()));
        }
        else if (schema instanceof ZodTuple) {
            return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
        }
        else {
            return schema;
        }
    }
    class ZodObject extends ZodType {
        constructor() {
            super(...arguments);
            this._cached = null;
            this.nonstrict = this.passthrough;
            this.augment = this.extend;
        }
        _getCached() {
            if (this._cached !== null)
                return this._cached;
            const shape = this._def.shape();
            const keys = util.objectKeys(shape);
            return (this._cached = { shape, keys });
        }
        _parse(input) {
            const parsedType = this._getType(input);
            if (parsedType !== ZodParsedType.object) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.object,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            const { status, ctx } = this._processInputParams(input);
            const { shape, keys: shapeKeys } = this._getCached();
            const extraKeys = [];
            if (!(this._def.catchall instanceof ZodNever &&
                this._def.unknownKeys === "strip")) {
                for (const key in ctx.data) {
                    if (!shapeKeys.includes(key)) {
                        extraKeys.push(key);
                    }
                }
            }
            const pairs = [];
            for (const key of shapeKeys) {
                const keyValidator = shape[key];
                const value = ctx.data[key];
                pairs.push({
                    key: { status: "valid", value: key },
                    value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
                    alwaysSet: key in ctx.data,
                });
            }
            if (this._def.catchall instanceof ZodNever) {
                const unknownKeys = this._def.unknownKeys;
                if (unknownKeys === "passthrough") {
                    for (const key of extraKeys) {
                        pairs.push({
                            key: { status: "valid", value: key },
                            value: { status: "valid", value: ctx.data[key] },
                        });
                    }
                }
                else if (unknownKeys === "strict") {
                    if (extraKeys.length > 0) {
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.unrecognized_keys,
                            keys: extraKeys,
                        });
                        status.dirty();
                    }
                }
                else if (unknownKeys === "strip") ;
                else {
                    throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
                }
            }
            else {
                const catchall = this._def.catchall;
                for (const key of extraKeys) {
                    const value = ctx.data[key];
                    pairs.push({
                        key: { status: "valid", value: key },
                        value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)
                        ),
                        alwaysSet: key in ctx.data,
                    });
                }
            }
            if (ctx.common.async) {
                return Promise.resolve()
                    .then(async () => {
                    const syncPairs = [];
                    for (const pair of pairs) {
                        const key = await pair.key;
                        syncPairs.push({
                            key,
                            value: await pair.value,
                            alwaysSet: pair.alwaysSet,
                        });
                    }
                    return syncPairs;
                })
                    .then((syncPairs) => {
                    return ParseStatus.mergeObjectSync(status, syncPairs);
                });
            }
            else {
                return ParseStatus.mergeObjectSync(status, pairs);
            }
        }
        get shape() {
            return this._def.shape();
        }
        strict(message) {
            errorUtil.errToObj;
            return new ZodObject({
                ...this._def,
                unknownKeys: "strict",
                ...(message !== undefined
                    ? {
                        errorMap: (issue, ctx) => {
                            var _a, _b, _c, _d;
                            const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
                            if (issue.code === "unrecognized_keys")
                                return {
                                    message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,
                                };
                            return {
                                message: defaultError,
                            };
                        },
                    }
                    : {}),
            });
        }
        strip() {
            return new ZodObject({
                ...this._def,
                unknownKeys: "strip",
            });
        }
        passthrough() {
            return new ZodObject({
                ...this._def,
                unknownKeys: "passthrough",
            });
        }
        extend(augmentation) {
            return new ZodObject({
                ...this._def,
                shape: () => ({
                    ...this._def.shape(),
                    ...augmentation,
                }),
            });
        }
        merge(merging) {
            const merged = new ZodObject({
                unknownKeys: merging._def.unknownKeys,
                catchall: merging._def.catchall,
                shape: () => ({
                    ...this._def.shape(),
                    ...merging._def.shape(),
                }),
                typeName: ZodFirstPartyTypeKind.ZodObject,
            });
            return merged;
        }
        setKey(key, schema) {
            return this.augment({ [key]: schema });
        }
        catchall(index) {
            return new ZodObject({
                ...this._def,
                catchall: index,
            });
        }
        pick(mask) {
            const shape = {};
            util.objectKeys(mask).forEach((key) => {
                if (mask[key] && this.shape[key]) {
                    shape[key] = this.shape[key];
                }
            });
            return new ZodObject({
                ...this._def,
                shape: () => shape,
            });
        }
        omit(mask) {
            const shape = {};
            util.objectKeys(this.shape).forEach((key) => {
                if (!mask[key]) {
                    shape[key] = this.shape[key];
                }
            });
            return new ZodObject({
                ...this._def,
                shape: () => shape,
            });
        }
        deepPartial() {
            return deepPartialify(this);
        }
        partial(mask) {
            const newShape = {};
            util.objectKeys(this.shape).forEach((key) => {
                const fieldSchema = this.shape[key];
                if (mask && !mask[key]) {
                    newShape[key] = fieldSchema;
                }
                else {
                    newShape[key] = fieldSchema.optional();
                }
            });
            return new ZodObject({
                ...this._def,
                shape: () => newShape,
            });
        }
        required(mask) {
            const newShape = {};
            util.objectKeys(this.shape).forEach((key) => {
                if (mask && !mask[key]) {
                    newShape[key] = this.shape[key];
                }
                else {
                    const fieldSchema = this.shape[key];
                    let newField = fieldSchema;
                    while (newField instanceof ZodOptional) {
                        newField = newField._def.innerType;
                    }
                    newShape[key] = newField;
                }
            });
            return new ZodObject({
                ...this._def,
                shape: () => newShape,
            });
        }
        keyof() {
            return createZodEnum(util.objectKeys(this.shape));
        }
    }
    ZodObject.create = (shape, params) => {
        return new ZodObject({
            shape: () => shape,
            unknownKeys: "strip",
            catchall: ZodNever.create(),
            typeName: ZodFirstPartyTypeKind.ZodObject,
            ...processCreateParams(params),
        });
    };
    ZodObject.strictCreate = (shape, params) => {
        return new ZodObject({
            shape: () => shape,
            unknownKeys: "strict",
            catchall: ZodNever.create(),
            typeName: ZodFirstPartyTypeKind.ZodObject,
            ...processCreateParams(params),
        });
    };
    ZodObject.lazycreate = (shape, params) => {
        return new ZodObject({
            shape,
            unknownKeys: "strip",
            catchall: ZodNever.create(),
            typeName: ZodFirstPartyTypeKind.ZodObject,
            ...processCreateParams(params),
        });
    };
    class ZodUnion extends ZodType {
        _parse(input) {
            const { ctx } = this._processInputParams(input);
            const options = this._def.options;
            function handleResults(results) {
                for (const result of results) {
                    if (result.result.status === "valid") {
                        return result.result;
                    }
                }
                for (const result of results) {
                    if (result.result.status === "dirty") {
                        ctx.common.issues.push(...result.ctx.common.issues);
                        return result.result;
                    }
                }
                const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_union,
                    unionErrors,
                });
                return INVALID;
            }
            if (ctx.common.async) {
                return Promise.all(options.map(async (option) => {
                    const childCtx = {
                        ...ctx,
                        common: {
                            ...ctx.common,
                            issues: [],
                        },
                        parent: null,
                    };
                    return {
                        result: await option._parseAsync({
                            data: ctx.data,
                            path: ctx.path,
                            parent: childCtx,
                        }),
                        ctx: childCtx,
                    };
                })).then(handleResults);
            }
            else {
                let dirty = undefined;
                const issues = [];
                for (const option of options) {
                    const childCtx = {
                        ...ctx,
                        common: {
                            ...ctx.common,
                            issues: [],
                        },
                        parent: null,
                    };
                    const result = option._parseSync({
                        data: ctx.data,
                        path: ctx.path,
                        parent: childCtx,
                    });
                    if (result.status === "valid") {
                        return result;
                    }
                    else if (result.status === "dirty" && !dirty) {
                        dirty = { result, ctx: childCtx };
                    }
                    if (childCtx.common.issues.length) {
                        issues.push(childCtx.common.issues);
                    }
                }
                if (dirty) {
                    ctx.common.issues.push(...dirty.ctx.common.issues);
                    return dirty.result;
                }
                const unionErrors = issues.map((issues) => new ZodError(issues));
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_union,
                    unionErrors,
                });
                return INVALID;
            }
        }
        get options() {
            return this._def.options;
        }
    }
    ZodUnion.create = (types, params) => {
        return new ZodUnion({
            options: types,
            typeName: ZodFirstPartyTypeKind.ZodUnion,
            ...processCreateParams(params),
        });
    };
    const getDiscriminator = (type) => {
        if (type instanceof ZodLazy) {
            return getDiscriminator(type.schema);
        }
        else if (type instanceof ZodEffects) {
            return getDiscriminator(type.innerType());
        }
        else if (type instanceof ZodLiteral) {
            return [type.value];
        }
        else if (type instanceof ZodEnum) {
            return type.options;
        }
        else if (type instanceof ZodNativeEnum) {
            return Object.keys(type.enum);
        }
        else if (type instanceof ZodDefault) {
            return getDiscriminator(type._def.innerType);
        }
        else if (type instanceof ZodUndefined) {
            return [undefined];
        }
        else if (type instanceof ZodNull) {
            return [null];
        }
        else {
            return null;
        }
    };
    class ZodDiscriminatedUnion extends ZodType {
        _parse(input) {
            const { ctx } = this._processInputParams(input);
            if (ctx.parsedType !== ZodParsedType.object) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.object,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            const discriminator = this.discriminator;
            const discriminatorValue = ctx.data[discriminator];
            const option = this.optionsMap.get(discriminatorValue);
            if (!option) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_union_discriminator,
                    options: Array.from(this.optionsMap.keys()),
                    path: [discriminator],
                });
                return INVALID;
            }
            if (ctx.common.async) {
                return option._parseAsync({
                    data: ctx.data,
                    path: ctx.path,
                    parent: ctx,
                });
            }
            else {
                return option._parseSync({
                    data: ctx.data,
                    path: ctx.path,
                    parent: ctx,
                });
            }
        }
        get discriminator() {
            return this._def.discriminator;
        }
        get options() {
            return this._def.options;
        }
        get optionsMap() {
            return this._def.optionsMap;
        }
        static create(discriminator, options, params) {
            const optionsMap = new Map();
            for (const type of options) {
                const discriminatorValues = getDiscriminator(type.shape[discriminator]);
                if (!discriminatorValues) {
                    throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
                }
                for (const value of discriminatorValues) {
                    if (optionsMap.has(value)) {
                        throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
                    }
                    optionsMap.set(value, type);
                }
            }
            return new ZodDiscriminatedUnion({
                typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
                discriminator,
                options,
                optionsMap,
                ...processCreateParams(params),
            });
        }
    }
    function mergeValues(a, b) {
        const aType = getParsedType(a);
        const bType = getParsedType(b);
        if (a === b) {
            return { valid: true, data: a };
        }
        else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
            const bKeys = util.objectKeys(b);
            const sharedKeys = util
                .objectKeys(a)
                .filter((key) => bKeys.indexOf(key) !== -1);
            const newObj = { ...a, ...b };
            for (const key of sharedKeys) {
                const sharedValue = mergeValues(a[key], b[key]);
                if (!sharedValue.valid) {
                    return { valid: false };
                }
                newObj[key] = sharedValue.data;
            }
            return { valid: true, data: newObj };
        }
        else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
            if (a.length !== b.length) {
                return { valid: false };
            }
            const newArray = [];
            for (let index = 0; index < a.length; index++) {
                const itemA = a[index];
                const itemB = b[index];
                const sharedValue = mergeValues(itemA, itemB);
                if (!sharedValue.valid) {
                    return { valid: false };
                }
                newArray.push(sharedValue.data);
            }
            return { valid: true, data: newArray };
        }
        else if (aType === ZodParsedType.date &&
            bType === ZodParsedType.date &&
            +a === +b) {
            return { valid: true, data: a };
        }
        else {
            return { valid: false };
        }
    }
    class ZodIntersection extends ZodType {
        _parse(input) {
            const { status, ctx } = this._processInputParams(input);
            const handleParsed = (parsedLeft, parsedRight) => {
                if (isAborted(parsedLeft) || isAborted(parsedRight)) {
                    return INVALID;
                }
                const merged = mergeValues(parsedLeft.value, parsedRight.value);
                if (!merged.valid) {
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.invalid_intersection_types,
                    });
                    return INVALID;
                }
                if (isDirty(parsedLeft) || isDirty(parsedRight)) {
                    status.dirty();
                }
                return { status: status.value, value: merged.data };
            };
            if (ctx.common.async) {
                return Promise.all([
                    this._def.left._parseAsync({
                        data: ctx.data,
                        path: ctx.path,
                        parent: ctx,
                    }),
                    this._def.right._parseAsync({
                        data: ctx.data,
                        path: ctx.path,
                        parent: ctx,
                    }),
                ]).then(([left, right]) => handleParsed(left, right));
            }
            else {
                return handleParsed(this._def.left._parseSync({
                    data: ctx.data,
                    path: ctx.path,
                    parent: ctx,
                }), this._def.right._parseSync({
                    data: ctx.data,
                    path: ctx.path,
                    parent: ctx,
                }));
            }
        }
    }
    ZodIntersection.create = (left, right, params) => {
        return new ZodIntersection({
            left: left,
            right: right,
            typeName: ZodFirstPartyTypeKind.ZodIntersection,
            ...processCreateParams(params),
        });
    };
    class ZodTuple extends ZodType {
        _parse(input) {
            const { status, ctx } = this._processInputParams(input);
            if (ctx.parsedType !== ZodParsedType.array) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.array,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            if (ctx.data.length < this._def.items.length) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.too_small,
                    minimum: this._def.items.length,
                    inclusive: true,
                    exact: false,
                    type: "array",
                });
                return INVALID;
            }
            const rest = this._def.rest;
            if (!rest && ctx.data.length > this._def.items.length) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.too_big,
                    maximum: this._def.items.length,
                    inclusive: true,
                    exact: false,
                    type: "array",
                });
                status.dirty();
            }
            const items = [...ctx.data]
                .map((item, itemIndex) => {
                const schema = this._def.items[itemIndex] || this._def.rest;
                if (!schema)
                    return null;
                return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
            })
                .filter((x) => !!x);
            if (ctx.common.async) {
                return Promise.all(items).then((results) => {
                    return ParseStatus.mergeArray(status, results);
                });
            }
            else {
                return ParseStatus.mergeArray(status, items);
            }
        }
        get items() {
            return this._def.items;
        }
        rest(rest) {
            return new ZodTuple({
                ...this._def,
                rest,
            });
        }
    }
    ZodTuple.create = (schemas, params) => {
        if (!Array.isArray(schemas)) {
            throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
        }
        return new ZodTuple({
            items: schemas,
            typeName: ZodFirstPartyTypeKind.ZodTuple,
            rest: null,
            ...processCreateParams(params),
        });
    };
    class ZodRecord extends ZodType {
        get keySchema() {
            return this._def.keyType;
        }
        get valueSchema() {
            return this._def.valueType;
        }
        _parse(input) {
            const { status, ctx } = this._processInputParams(input);
            if (ctx.parsedType !== ZodParsedType.object) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.object,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            const pairs = [];
            const keyType = this._def.keyType;
            const valueType = this._def.valueType;
            for (const key in ctx.data) {
                pairs.push({
                    key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
                    value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
                });
            }
            if (ctx.common.async) {
                return ParseStatus.mergeObjectAsync(status, pairs);
            }
            else {
                return ParseStatus.mergeObjectSync(status, pairs);
            }
        }
        get element() {
            return this._def.valueType;
        }
        static create(first, second, third) {
            if (second instanceof ZodType) {
                return new ZodRecord({
                    keyType: first,
                    valueType: second,
                    typeName: ZodFirstPartyTypeKind.ZodRecord,
                    ...processCreateParams(third),
                });
            }
            return new ZodRecord({
                keyType: ZodString.create(),
                valueType: first,
                typeName: ZodFirstPartyTypeKind.ZodRecord,
                ...processCreateParams(second),
            });
        }
    }
    class ZodMap extends ZodType {
        _parse(input) {
            const { status, ctx } = this._processInputParams(input);
            if (ctx.parsedType !== ZodParsedType.map) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.map,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            const keyType = this._def.keyType;
            const valueType = this._def.valueType;
            const pairs = [...ctx.data.entries()].map(([key, value], index) => {
                return {
                    key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
                    value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"])),
                };
            });
            if (ctx.common.async) {
                const finalMap = new Map();
                return Promise.resolve().then(async () => {
                    for (const pair of pairs) {
                        const key = await pair.key;
                        const value = await pair.value;
                        if (key.status === "aborted" || value.status === "aborted") {
                            return INVALID;
                        }
                        if (key.status === "dirty" || value.status === "dirty") {
                            status.dirty();
                        }
                        finalMap.set(key.value, value.value);
                    }
                    return { status: status.value, value: finalMap };
                });
            }
            else {
                const finalMap = new Map();
                for (const pair of pairs) {
                    const key = pair.key;
                    const value = pair.value;
                    if (key.status === "aborted" || value.status === "aborted") {
                        return INVALID;
                    }
                    if (key.status === "dirty" || value.status === "dirty") {
                        status.dirty();
                    }
                    finalMap.set(key.value, value.value);
                }
                return { status: status.value, value: finalMap };
            }
        }
    }
    ZodMap.create = (keyType, valueType, params) => {
        return new ZodMap({
            valueType,
            keyType,
            typeName: ZodFirstPartyTypeKind.ZodMap,
            ...processCreateParams(params),
        });
    };
    class ZodSet extends ZodType {
        _parse(input) {
            const { status, ctx } = this._processInputParams(input);
            if (ctx.parsedType !== ZodParsedType.set) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.set,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            const def = this._def;
            if (def.minSize !== null) {
                if (ctx.data.size < def.minSize.value) {
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.too_small,
                        minimum: def.minSize.value,
                        type: "set",
                        inclusive: true,
                        exact: false,
                        message: def.minSize.message,
                    });
                    status.dirty();
                }
            }
            if (def.maxSize !== null) {
                if (ctx.data.size > def.maxSize.value) {
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.too_big,
                        maximum: def.maxSize.value,
                        type: "set",
                        inclusive: true,
                        exact: false,
                        message: def.maxSize.message,
                    });
                    status.dirty();
                }
            }
            const valueType = this._def.valueType;
            function finalizeSet(elements) {
                const parsedSet = new Set();
                for (const element of elements) {
                    if (element.status === "aborted")
                        return INVALID;
                    if (element.status === "dirty")
                        status.dirty();
                    parsedSet.add(element.value);
                }
                return { status: status.value, value: parsedSet };
            }
            const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
            if (ctx.common.async) {
                return Promise.all(elements).then((elements) => finalizeSet(elements));
            }
            else {
                return finalizeSet(elements);
            }
        }
        min(minSize, message) {
            return new ZodSet({
                ...this._def,
                minSize: { value: minSize, message: errorUtil.toString(message) },
            });
        }
        max(maxSize, message) {
            return new ZodSet({
                ...this._def,
                maxSize: { value: maxSize, message: errorUtil.toString(message) },
            });
        }
        size(size, message) {
            return this.min(size, message).max(size, message);
        }
        nonempty(message) {
            return this.min(1, message);
        }
    }
    ZodSet.create = (valueType, params) => {
        return new ZodSet({
            valueType,
            minSize: null,
            maxSize: null,
            typeName: ZodFirstPartyTypeKind.ZodSet,
            ...processCreateParams(params),
        });
    };
    class ZodFunction extends ZodType {
        constructor() {
            super(...arguments);
            this.validate = this.implement;
        }
        _parse(input) {
            const { ctx } = this._processInputParams(input);
            if (ctx.parsedType !== ZodParsedType.function) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.function,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            function makeArgsIssue(args, error) {
                return makeIssue({
                    data: args,
                    path: ctx.path,
                    errorMaps: [
                        ctx.common.contextualErrorMap,
                        ctx.schemaErrorMap,
                        getErrorMap(),
                        errorMap,
                    ].filter((x) => !!x),
                    issueData: {
                        code: ZodIssueCode.invalid_arguments,
                        argumentsError: error,
                    },
                });
            }
            function makeReturnsIssue(returns, error) {
                return makeIssue({
                    data: returns,
                    path: ctx.path,
                    errorMaps: [
                        ctx.common.contextualErrorMap,
                        ctx.schemaErrorMap,
                        getErrorMap(),
                        errorMap,
                    ].filter((x) => !!x),
                    issueData: {
                        code: ZodIssueCode.invalid_return_type,
                        returnTypeError: error,
                    },
                });
            }
            const params = { errorMap: ctx.common.contextualErrorMap };
            const fn = ctx.data;
            if (this._def.returns instanceof ZodPromise) {
                return OK(async (...args) => {
                    const error = new ZodError([]);
                    const parsedArgs = await this._def.args
                        .parseAsync(args, params)
                        .catch((e) => {
                        error.addIssue(makeArgsIssue(args, e));
                        throw error;
                    });
                    const result = await fn(...parsedArgs);
                    const parsedReturns = await this._def.returns._def.type
                        .parseAsync(result, params)
                        .catch((e) => {
                        error.addIssue(makeReturnsIssue(result, e));
                        throw error;
                    });
                    return parsedReturns;
                });
            }
            else {
                return OK((...args) => {
                    const parsedArgs = this._def.args.safeParse(args, params);
                    if (!parsedArgs.success) {
                        throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
                    }
                    const result = fn(...parsedArgs.data);
                    const parsedReturns = this._def.returns.safeParse(result, params);
                    if (!parsedReturns.success) {
                        throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
                    }
                    return parsedReturns.data;
                });
            }
        }
        parameters() {
            return this._def.args;
        }
        returnType() {
            return this._def.returns;
        }
        args(...items) {
            return new ZodFunction({
                ...this._def,
                args: ZodTuple.create(items).rest(ZodUnknown.create()),
            });
        }
        returns(returnType) {
            return new ZodFunction({
                ...this._def,
                returns: returnType,
            });
        }
        implement(func) {
            const validatedFunc = this.parse(func);
            return validatedFunc;
        }
        strictImplement(func) {
            const validatedFunc = this.parse(func);
            return validatedFunc;
        }
        static create(args, returns, params) {
            return new ZodFunction({
                args: (args
                    ? args
                    : ZodTuple.create([]).rest(ZodUnknown.create())),
                returns: returns || ZodUnknown.create(),
                typeName: ZodFirstPartyTypeKind.ZodFunction,
                ...processCreateParams(params),
            });
        }
    }
    class ZodLazy extends ZodType {
        get schema() {
            return this._def.getter();
        }
        _parse(input) {
            const { ctx } = this._processInputParams(input);
            const lazySchema = this._def.getter();
            return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
        }
    }
    ZodLazy.create = (getter, params) => {
        return new ZodLazy({
            getter: getter,
            typeName: ZodFirstPartyTypeKind.ZodLazy,
            ...processCreateParams(params),
        });
    };
    class ZodLiteral extends ZodType {
        _parse(input) {
            if (input.data !== this._def.value) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    received: ctx.data,
                    code: ZodIssueCode.invalid_literal,
                    expected: this._def.value,
                });
                return INVALID;
            }
            return { status: "valid", value: input.data };
        }
        get value() {
            return this._def.value;
        }
    }
    ZodLiteral.create = (value, params) => {
        return new ZodLiteral({
            value: value,
            typeName: ZodFirstPartyTypeKind.ZodLiteral,
            ...processCreateParams(params),
        });
    };
    function createZodEnum(values, params) {
        return new ZodEnum({
            values: values,
            typeName: ZodFirstPartyTypeKind.ZodEnum,
            ...processCreateParams(params),
        });
    }
    class ZodEnum extends ZodType {
        _parse(input) {
            if (typeof input.data !== "string") {
                const ctx = this._getOrReturnCtx(input);
                const expectedValues = this._def.values;
                addIssueToContext(ctx, {
                    expected: util.joinValues(expectedValues),
                    received: ctx.parsedType,
                    code: ZodIssueCode.invalid_type,
                });
                return INVALID;
            }
            if (this._def.values.indexOf(input.data) === -1) {
                const ctx = this._getOrReturnCtx(input);
                const expectedValues = this._def.values;
                addIssueToContext(ctx, {
                    received: ctx.data,
                    code: ZodIssueCode.invalid_enum_value,
                    options: expectedValues,
                });
                return INVALID;
            }
            return OK(input.data);
        }
        get options() {
            return this._def.values;
        }
        get enum() {
            const enumValues = {};
            for (const val of this._def.values) {
                enumValues[val] = val;
            }
            return enumValues;
        }
        get Values() {
            const enumValues = {};
            for (const val of this._def.values) {
                enumValues[val] = val;
            }
            return enumValues;
        }
        get Enum() {
            const enumValues = {};
            for (const val of this._def.values) {
                enumValues[val] = val;
            }
            return enumValues;
        }
        extract(values) {
            return ZodEnum.create(values);
        }
        exclude(values) {
            return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
        }
    }
    ZodEnum.create = createZodEnum;
    class ZodNativeEnum extends ZodType {
        _parse(input) {
            const nativeEnumValues = util.getValidEnumValues(this._def.values);
            const ctx = this._getOrReturnCtx(input);
            if (ctx.parsedType !== ZodParsedType.string &&
                ctx.parsedType !== ZodParsedType.number) {
                const expectedValues = util.objectValues(nativeEnumValues);
                addIssueToContext(ctx, {
                    expected: util.joinValues(expectedValues),
                    received: ctx.parsedType,
                    code: ZodIssueCode.invalid_type,
                });
                return INVALID;
            }
            if (nativeEnumValues.indexOf(input.data) === -1) {
                const expectedValues = util.objectValues(nativeEnumValues);
                addIssueToContext(ctx, {
                    received: ctx.data,
                    code: ZodIssueCode.invalid_enum_value,
                    options: expectedValues,
                });
                return INVALID;
            }
            return OK(input.data);
        }
        get enum() {
            return this._def.values;
        }
    }
    ZodNativeEnum.create = (values, params) => {
        return new ZodNativeEnum({
            values: values,
            typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
            ...processCreateParams(params),
        });
    };
    class ZodPromise extends ZodType {
        unwrap() {
            return this._def.type;
        }
        _parse(input) {
            const { ctx } = this._processInputParams(input);
            if (ctx.parsedType !== ZodParsedType.promise &&
                ctx.common.async === false) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.promise,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            const promisified = ctx.parsedType === ZodParsedType.promise
                ? ctx.data
                : Promise.resolve(ctx.data);
            return OK(promisified.then((data) => {
                return this._def.type.parseAsync(data, {
                    path: ctx.path,
                    errorMap: ctx.common.contextualErrorMap,
                });
            }));
        }
    }
    ZodPromise.create = (schema, params) => {
        return new ZodPromise({
            type: schema,
            typeName: ZodFirstPartyTypeKind.ZodPromise,
            ...processCreateParams(params),
        });
    };
    class ZodEffects extends ZodType {
        innerType() {
            return this._def.schema;
        }
        sourceType() {
            return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects
                ? this._def.schema.sourceType()
                : this._def.schema;
        }
        _parse(input) {
            const { status, ctx } = this._processInputParams(input);
            const effect = this._def.effect || null;
            if (effect.type === "preprocess") {
                const processed = effect.transform(ctx.data);
                if (ctx.common.async) {
                    return Promise.resolve(processed).then((processed) => {
                        return this._def.schema._parseAsync({
                            data: processed,
                            path: ctx.path,
                            parent: ctx,
                        });
                    });
                }
                else {
                    return this._def.schema._parseSync({
                        data: processed,
                        path: ctx.path,
                        parent: ctx,
                    });
                }
            }
            const checkCtx = {
                addIssue: (arg) => {
                    addIssueToContext(ctx, arg);
                    if (arg.fatal) {
                        status.abort();
                    }
                    else {
                        status.dirty();
                    }
                },
                get path() {
                    return ctx.path;
                },
            };
            checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
            if (effect.type === "refinement") {
                const executeRefinement = (acc
                ) => {
                    const result = effect.refinement(acc, checkCtx);
                    if (ctx.common.async) {
                        return Promise.resolve(result);
                    }
                    if (result instanceof Promise) {
                        throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
                    }
                    return acc;
                };
                if (ctx.common.async === false) {
                    const inner = this._def.schema._parseSync({
                        data: ctx.data,
                        path: ctx.path,
                        parent: ctx,
                    });
                    if (inner.status === "aborted")
                        return INVALID;
                    if (inner.status === "dirty")
                        status.dirty();
                    executeRefinement(inner.value);
                    return { status: status.value, value: inner.value };
                }
                else {
                    return this._def.schema
                        ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
                        .then((inner) => {
                        if (inner.status === "aborted")
                            return INVALID;
                        if (inner.status === "dirty")
                            status.dirty();
                        return executeRefinement(inner.value).then(() => {
                            return { status: status.value, value: inner.value };
                        });
                    });
                }
            }
            if (effect.type === "transform") {
                if (ctx.common.async === false) {
                    const base = this._def.schema._parseSync({
                        data: ctx.data,
                        path: ctx.path,
                        parent: ctx,
                    });
                    if (!isValid(base))
                        return base;
                    const result = effect.transform(base.value, checkCtx);
                    if (result instanceof Promise) {
                        throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
                    }
                    return { status: status.value, value: result };
                }
                else {
                    return this._def.schema
                        ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
                        .then((base) => {
                        if (!isValid(base))
                            return base;
                        return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
                    });
                }
            }
            util.assertNever(effect);
        }
    }
    ZodEffects.create = (schema, effect, params) => {
        return new ZodEffects({
            schema,
            typeName: ZodFirstPartyTypeKind.ZodEffects,
            effect,
            ...processCreateParams(params),
        });
    };
    ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
        return new ZodEffects({
            schema,
            effect: { type: "preprocess", transform: preprocess },
            typeName: ZodFirstPartyTypeKind.ZodEffects,
            ...processCreateParams(params),
        });
    };
    class ZodOptional extends ZodType {
        _parse(input) {
            const parsedType = this._getType(input);
            if (parsedType === ZodParsedType.undefined) {
                return OK(undefined);
            }
            return this._def.innerType._parse(input);
        }
        unwrap() {
            return this._def.innerType;
        }
    }
    ZodOptional.create = (type, params) => {
        return new ZodOptional({
            innerType: type,
            typeName: ZodFirstPartyTypeKind.ZodOptional,
            ...processCreateParams(params),
        });
    };
    class ZodNullable extends ZodType {
        _parse(input) {
            const parsedType = this._getType(input);
            if (parsedType === ZodParsedType.null) {
                return OK(null);
            }
            return this._def.innerType._parse(input);
        }
        unwrap() {
            return this._def.innerType;
        }
    }
    ZodNullable.create = (type, params) => {
        return new ZodNullable({
            innerType: type,
            typeName: ZodFirstPartyTypeKind.ZodNullable,
            ...processCreateParams(params),
        });
    };
    class ZodDefault extends ZodType {
        _parse(input) {
            const { ctx } = this._processInputParams(input);
            let data = ctx.data;
            if (ctx.parsedType === ZodParsedType.undefined) {
                data = this._def.defaultValue();
            }
            return this._def.innerType._parse({
                data,
                path: ctx.path,
                parent: ctx,
            });
        }
        removeDefault() {
            return this._def.innerType;
        }
    }
    ZodDefault.create = (type, params) => {
        return new ZodDefault({
            innerType: type,
            typeName: ZodFirstPartyTypeKind.ZodDefault,
            defaultValue: typeof params.default === "function"
                ? params.default
                : () => params.default,
            ...processCreateParams(params),
        });
    };
    class ZodCatch extends ZodType {
        _parse(input) {
            const { ctx } = this._processInputParams(input);
            const newCtx = {
                ...ctx,
                common: {
                    ...ctx.common,
                    issues: [],
                },
            };
            const result = this._def.innerType._parse({
                data: newCtx.data,
                path: newCtx.path,
                parent: {
                    ...newCtx,
                },
            });
            if (isAsync(result)) {
                return result.then((result) => {
                    return {
                        status: "valid",
                        value: result.status === "valid"
                            ? result.value
                            : this._def.catchValue({
                                get error() {
                                    return new ZodError(newCtx.common.issues);
                                },
                                input: newCtx.data,
                            }),
                    };
                });
            }
            else {
                return {
                    status: "valid",
                    value: result.status === "valid"
                        ? result.value
                        : this._def.catchValue({
                            get error() {
                                return new ZodError(newCtx.common.issues);
                            },
                            input: newCtx.data,
                        }),
                };
            }
        }
        removeCatch() {
            return this._def.innerType;
        }
    }
    ZodCatch.create = (type, params) => {
        return new ZodCatch({
            innerType: type,
            typeName: ZodFirstPartyTypeKind.ZodCatch,
            catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
            ...processCreateParams(params),
        });
    };
    class ZodNaN extends ZodType {
        _parse(input) {
            const parsedType = this._getType(input);
            if (parsedType !== ZodParsedType.nan) {
                const ctx = this._getOrReturnCtx(input);
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_type,
                    expected: ZodParsedType.nan,
                    received: ctx.parsedType,
                });
                return INVALID;
            }
            return { status: "valid", value: input.data };
        }
    }
    ZodNaN.create = (params) => {
        return new ZodNaN({
            typeName: ZodFirstPartyTypeKind.ZodNaN,
            ...processCreateParams(params),
        });
    };
    const BRAND = Symbol("zod_brand");
    class ZodBranded extends ZodType {
        _parse(input) {
            const { ctx } = this._processInputParams(input);
            const data = ctx.data;
            return this._def.type._parse({
                data,
                path: ctx.path,
                parent: ctx,
            });
        }
        unwrap() {
            return this._def.type;
        }
    }
    class ZodPipeline extends ZodType {
        _parse(input) {
            const { status, ctx } = this._processInputParams(input);
            if (ctx.common.async) {
                const handleAsync = async () => {
                    const inResult = await this._def.in._parseAsync({
                        data: ctx.data,
                        path: ctx.path,
                        parent: ctx,
                    });
                    if (inResult.status === "aborted")
                        return INVALID;
                    if (inResult.status === "dirty") {
                        status.dirty();
                        return DIRTY(inResult.value);
                    }
                    else {
                        return this._def.out._parseAsync({
                            data: inResult.value,
                            path: ctx.path,
                            parent: ctx,
                        });
                    }
                };
                return handleAsync();
            }
            else {
                const inResult = this._def.in._parseSync({
                    data: ctx.data,
                    path: ctx.path,
                    parent: ctx,
                });
                if (inResult.status === "aborted")
                    return INVALID;
                if (inResult.status === "dirty") {
                    status.dirty();
                    return {
                        status: "dirty",
                        value: inResult.value,
                    };
                }
                else {
                    return this._def.out._parseSync({
                        data: inResult.value,
                        path: ctx.path,
                        parent: ctx,
                    });
                }
            }
        }
        static create(a, b) {
            return new ZodPipeline({
                in: a,
                out: b,
                typeName: ZodFirstPartyTypeKind.ZodPipeline,
            });
        }
    }
    const custom = (check, params = {},
    fatal) => {
        if (check)
            return ZodAny.create().superRefine((data, ctx) => {
                var _a, _b;
                if (!check(data)) {
                    const p = typeof params === "function"
                        ? params(data)
                        : typeof params === "string"
                            ? { message: params }
                            : params;
                    const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
                    const p2 = typeof p === "string" ? { message: p } : p;
                    ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
                }
            });
        return ZodAny.create();
    };
    const late = {
        object: ZodObject.lazycreate,
    };
    var ZodFirstPartyTypeKind;
    (function (ZodFirstPartyTypeKind) {
        ZodFirstPartyTypeKind["ZodString"] = "ZodString";
        ZodFirstPartyTypeKind["ZodNumber"] = "ZodNumber";
        ZodFirstPartyTypeKind["ZodNaN"] = "ZodNaN";
        ZodFirstPartyTypeKind["ZodBigInt"] = "ZodBigInt";
        ZodFirstPartyTypeKind["ZodBoolean"] = "ZodBoolean";
        ZodFirstPartyTypeKind["ZodDate"] = "ZodDate";
        ZodFirstPartyTypeKind["ZodSymbol"] = "ZodSymbol";
        ZodFirstPartyTypeKind["ZodUndefined"] = "ZodUndefined";
        ZodFirstPartyTypeKind["ZodNull"] = "ZodNull";
        ZodFirstPartyTypeKind["ZodAny"] = "ZodAny";
        ZodFirstPartyTypeKind["ZodUnknown"] = "ZodUnknown";
        ZodFirstPartyTypeKind["ZodNever"] = "ZodNever";
        ZodFirstPartyTypeKind["ZodVoid"] = "ZodVoid";
        ZodFirstPartyTypeKind["ZodArray"] = "ZodArray";
        ZodFirstPartyTypeKind["ZodObject"] = "ZodObject";
        ZodFirstPartyTypeKind["ZodUnion"] = "ZodUnion";
        ZodFirstPartyTypeKind["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
        ZodFirstPartyTypeKind["ZodIntersection"] = "ZodIntersection";
        ZodFirstPartyTypeKind["ZodTuple"] = "ZodTuple";
        ZodFirstPartyTypeKind["ZodRecord"] = "ZodRecord";
        ZodFirstPartyTypeKind["ZodMap"] = "ZodMap";
        ZodFirstPartyTypeKind["ZodSet"] = "ZodSet";
        ZodFirstPartyTypeKind["ZodFunction"] = "ZodFunction";
        ZodFirstPartyTypeKind["ZodLazy"] = "ZodLazy";
        ZodFirstPartyTypeKind["ZodLiteral"] = "ZodLiteral";
        ZodFirstPartyTypeKind["ZodEnum"] = "ZodEnum";
        ZodFirstPartyTypeKind["ZodEffects"] = "ZodEffects";
        ZodFirstPartyTypeKind["ZodNativeEnum"] = "ZodNativeEnum";
        ZodFirstPartyTypeKind["ZodOptional"] = "ZodOptional";
        ZodFirstPartyTypeKind["ZodNullable"] = "ZodNullable";
        ZodFirstPartyTypeKind["ZodDefault"] = "ZodDefault";
        ZodFirstPartyTypeKind["ZodCatch"] = "ZodCatch";
        ZodFirstPartyTypeKind["ZodPromise"] = "ZodPromise";
        ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
        ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
    })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
    const instanceOfType = (
    cls, params = {
        message: `Input not instance of ${cls.name}`,
    }) => custom((data) => data instanceof cls, params);
    const stringType = ZodString.create;
    const numberType = ZodNumber.create;
    const nanType = ZodNaN.create;
    const bigIntType = ZodBigInt.create;
    const booleanType = ZodBoolean.create;
    const dateType = ZodDate.create;
    const symbolType = ZodSymbol.create;
    const undefinedType = ZodUndefined.create;
    const nullType = ZodNull.create;
    const anyType = ZodAny.create;
    const unknownType = ZodUnknown.create;
    const neverType = ZodNever.create;
    const voidType = ZodVoid.create;
    const arrayType = ZodArray.create;
    const objectType = ZodObject.create;
    const strictObjectType = ZodObject.strictCreate;
    const unionType = ZodUnion.create;
    const discriminatedUnionType = ZodDiscriminatedUnion.create;
    const intersectionType = ZodIntersection.create;
    const tupleType = ZodTuple.create;
    const recordType = ZodRecord.create;
    const mapType = ZodMap.create;
    const setType = ZodSet.create;
    const functionType = ZodFunction.create;
    const lazyType = ZodLazy.create;
    const literalType = ZodLiteral.create;
    const enumType = ZodEnum.create;
    const nativeEnumType = ZodNativeEnum.create;
    const promiseType = ZodPromise.create;
    const effectsType = ZodEffects.create;
    const optionalType = ZodOptional.create;
    const nullableType = ZodNullable.create;
    const preprocessType = ZodEffects.createWithPreprocess;
    const pipelineType = ZodPipeline.create;
    const ostring = () => stringType().optional();
    const onumber = () => numberType().optional();
    const oboolean = () => booleanType().optional();
    const coerce = {
        string: ((arg) => ZodString.create({ ...arg, coerce: true })),
        number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
        boolean: ((arg) => ZodBoolean.create({
            ...arg,
            coerce: true,
        })),
        bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
        date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
    };
    const NEVER = INVALID;
    var z = Object.freeze({
        __proto__: null,
        defaultErrorMap: errorMap,
        setErrorMap: setErrorMap,
        getErrorMap: getErrorMap,
        makeIssue: makeIssue,
        EMPTY_PATH: EMPTY_PATH,
        addIssueToContext: addIssueToContext,
        ParseStatus: ParseStatus,
        INVALID: INVALID,
        DIRTY: DIRTY,
        OK: OK,
        isAborted: isAborted,
        isDirty: isDirty,
        isValid: isValid,
        isAsync: isAsync,
        get util () { return util; },
        get objectUtil () { return objectUtil; },
        ZodParsedType: ZodParsedType,
        getParsedType: getParsedType,
        ZodType: ZodType,
        ZodString: ZodString,
        ZodNumber: ZodNumber,
        ZodBigInt: ZodBigInt,
        ZodBoolean: ZodBoolean,
        ZodDate: ZodDate,
        ZodSymbol: ZodSymbol,
        ZodUndefined: ZodUndefined,
        ZodNull: ZodNull,
        ZodAny: ZodAny,
        ZodUnknown: ZodUnknown,
        ZodNever: ZodNever,
        ZodVoid: ZodVoid,
        ZodArray: ZodArray,
        ZodObject: ZodObject,
        ZodUnion: ZodUnion,
        ZodDiscriminatedUnion: ZodDiscriminatedUnion,
        ZodIntersection: ZodIntersection,
        ZodTuple: ZodTuple,
        ZodRecord: ZodRecord,
        ZodMap: ZodMap,
        ZodSet: ZodSet,
        ZodFunction: ZodFunction,
        ZodLazy: ZodLazy,
        ZodLiteral: ZodLiteral,
        ZodEnum: ZodEnum,
        ZodNativeEnum: ZodNativeEnum,
        ZodPromise: ZodPromise,
        ZodEffects: ZodEffects,
        ZodTransformer: ZodEffects,
        ZodOptional: ZodOptional,
        ZodNullable: ZodNullable,
        ZodDefault: ZodDefault,
        ZodCatch: ZodCatch,
        ZodNaN: ZodNaN,
        BRAND: BRAND,
        ZodBranded: ZodBranded,
        ZodPipeline: ZodPipeline,
        custom: custom,
        Schema: ZodType,
        ZodSchema: ZodType,
        late: late,
        get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },
        coerce: coerce,
        any: anyType,
        array: arrayType,
        bigint: bigIntType,
        boolean: booleanType,
        date: dateType,
        discriminatedUnion: discriminatedUnionType,
        effect: effectsType,
        'enum': enumType,
        'function': functionType,
        'instanceof': instanceOfType,
        intersection: intersectionType,
        lazy: lazyType,
        literal: literalType,
        map: mapType,
        nan: nanType,
        nativeEnum: nativeEnumType,
        never: neverType,
        'null': nullType,
        nullable: nullableType,
        number: numberType,
        object: objectType,
        oboolean: oboolean,
        onumber: onumber,
        optional: optionalType,
        ostring: ostring,
        pipeline: pipelineType,
        preprocess: preprocessType,
        promise: promiseType,
        record: recordType,
        set: setType,
        strictObject: strictObjectType,
        string: stringType,
        symbol: symbolType,
        transformer: effectsType,
        tuple: tupleType,
        'undefined': undefinedType,
        union: unionType,
        unknown: unknownType,
        'void': voidType,
        NEVER: NEVER,
        ZodIssueCode: ZodIssueCode,
        quotelessJson: quotelessJson,
        ZodError: ZodError
    });
    var AdblockSyntax;
    (function (AdblockSyntax) {
        AdblockSyntax["Common"] = "Common";
        AdblockSyntax["Abp"] = "AdblockPlus";
        AdblockSyntax["Ubo"] = "UblockOrigin";
        AdblockSyntax["Adg"] = "AdGuard";
    })(AdblockSyntax || (AdblockSyntax = {}));
    const EMPTY = '';
    const SPACE = ' ';
    const TAB = '\t';
    const COLON = ':';
    const COMMA = ',';
    const DOT = '.';
    const SEMICOLON = ';';
    const AMPERSAND = '&';
    const ASTERISK = '*';
    const AT_SIGN = '@';
    const CARET = '^';
    const DOLLAR_SIGN = '$';
    const EQUALS = '=';
    const EXCLAMATION_MARK = '!';
    const HASHMARK = '#';
    const PIPE = '|';
    const PLUS = '+';
    const QUESTION_MARK = '?';
    const SLASH = '/';
    const UNDERSCORE = '_';
    const BACKSLASH = '\\';
    const ESCAPE_CHARACTER = BACKSLASH;
    const CR = '\r';
    const FF = '\f';
    const LF = '\n';
    const CRLF = CR + LF;
    const BACKTICK_QUOTE = '`';
    const DOUBLE_QUOTE = '"';
    const SINGLE_QUOTE = '\'';
    const OPEN_PARENTHESIS = '(';
    const CLOSE_PARENTHESIS = ')';
    const OPEN_SQUARE_BRACKET = '[';
    const CLOSE_SQUARE_BRACKET = ']';
    const OPEN_CURLY_BRACKET = '{';
    const CLOSE_CURLY_BRACKET = '}';
    const SMALL_LETTER_A = 'a';
    const SMALL_LETTER_B = 'b';
    const SMALL_LETTER_C = 'c';
    const SMALL_LETTER_D = 'd';
    const SMALL_LETTER_E = 'e';
    const SMALL_LETTER_F = 'f';
    const SMALL_LETTER_G = 'g';
    const SMALL_LETTER_H = 'h';
    const SMALL_LETTER_I = 'i';
    const SMALL_LETTER_J = 'j';
    const SMALL_LETTER_K = 'k';
    const SMALL_LETTER_L = 'l';
    const SMALL_LETTER_M = 'm';
    const SMALL_LETTER_N = 'n';
    const SMALL_LETTER_O = 'o';
    const SMALL_LETTER_P = 'p';
    const SMALL_LETTER_Q = 'q';
    const SMALL_LETTER_R = 'r';
    const SMALL_LETTER_S = 's';
    const SMALL_LETTER_T = 't';
    const SMALL_LETTER_U = 'u';
    const SMALL_LETTER_V = 'v';
    const SMALL_LETTER_W = 'w';
    const SMALL_LETTER_X = 'x';
    const SMALL_LETTER_Y = 'y';
    const SMALL_LETTER_Z = 'z';
    const SMALL_LETTERS = new Set([
        SMALL_LETTER_A,
        SMALL_LETTER_B,
        SMALL_LETTER_C,
        SMALL_LETTER_D,
        SMALL_LETTER_E,
        SMALL_LETTER_F,
        SMALL_LETTER_G,
        SMALL_LETTER_H,
        SMALL_LETTER_I,
        SMALL_LETTER_J,
        SMALL_LETTER_K,
        SMALL_LETTER_L,
        SMALL_LETTER_M,
        SMALL_LETTER_N,
        SMALL_LETTER_O,
        SMALL_LETTER_P,
        SMALL_LETTER_Q,
        SMALL_LETTER_R,
        SMALL_LETTER_S,
        SMALL_LETTER_T,
        SMALL_LETTER_U,
        SMALL_LETTER_V,
        SMALL_LETTER_W,
        SMALL_LETTER_X,
        SMALL_LETTER_Y,
        SMALL_LETTER_Z,
    ]);
    const CAPITAL_LETTER_A = 'A';
    const CAPITAL_LETTER_B = 'B';
    const CAPITAL_LETTER_C = 'C';
    const CAPITAL_LETTER_D = 'D';
    const CAPITAL_LETTER_E = 'E';
    const CAPITAL_LETTER_F = 'F';
    const CAPITAL_LETTER_G = 'G';
    const CAPITAL_LETTER_H = 'H';
    const CAPITAL_LETTER_I = 'I';
    const CAPITAL_LETTER_J = 'J';
    const CAPITAL_LETTER_K = 'K';
    const CAPITAL_LETTER_L = 'L';
    const CAPITAL_LETTER_M = 'M';
    const CAPITAL_LETTER_N = 'N';
    const CAPITAL_LETTER_O = 'O';
    const CAPITAL_LETTER_P = 'P';
    const CAPITAL_LETTER_Q = 'Q';
    const CAPITAL_LETTER_R = 'R';
    const CAPITAL_LETTER_S = 'S';
    const CAPITAL_LETTER_T = 'T';
    const CAPITAL_LETTER_U = 'U';
    const CAPITAL_LETTER_V = 'V';
    const CAPITAL_LETTER_W = 'W';
    const CAPITAL_LETTER_X = 'X';
    const CAPITAL_LETTER_Y = 'Y';
    const CAPITAL_LETTER_Z = 'Z';
    const CAPITAL_LETTERS = new Set([
        CAPITAL_LETTER_A,
        CAPITAL_LETTER_B,
        CAPITAL_LETTER_C,
        CAPITAL_LETTER_D,
        CAPITAL_LETTER_E,
        CAPITAL_LETTER_F,
        CAPITAL_LETTER_G,
        CAPITAL_LETTER_H,
        CAPITAL_LETTER_I,
        CAPITAL_LETTER_J,
        CAPITAL_LETTER_K,
        CAPITAL_LETTER_L,
        CAPITAL_LETTER_M,
        CAPITAL_LETTER_N,
        CAPITAL_LETTER_O,
        CAPITAL_LETTER_P,
        CAPITAL_LETTER_Q,
        CAPITAL_LETTER_R,
        CAPITAL_LETTER_S,
        CAPITAL_LETTER_T,
        CAPITAL_LETTER_U,
        CAPITAL_LETTER_V,
        CAPITAL_LETTER_W,
        CAPITAL_LETTER_X,
        CAPITAL_LETTER_Y,
        CAPITAL_LETTER_Z,
    ]);
    const NUMBER_0 = '0';
    const NUMBER_1 = '1';
    const NUMBER_2 = '2';
    const NUMBER_3 = '3';
    const NUMBER_4 = '4';
    const NUMBER_5 = '5';
    const NUMBER_6 = '6';
    const NUMBER_7 = '7';
    const NUMBER_8 = '8';
    const NUMBER_9 = '9';
    const NUMBERS = new Set([
        NUMBER_0,
        NUMBER_1,
        NUMBER_2,
        NUMBER_3,
        NUMBER_4,
        NUMBER_5,
        NUMBER_6,
        NUMBER_7,
        NUMBER_8,
        NUMBER_9,
    ]);
    const REGEX_MARKER = '/';
    const ADG_SCRIPTLET_MASK = '//scriptlet';
    const UBO_SCRIPTLET_MASK = '+js';
    const UBO_SCRIPTLET_MASK_LEGACY = 'script:inject';
    const UBO_HTML_MASK = '^';
    const MODIFIERS_SEPARATOR = ',';
    const MODIFIER_ASSIGN_OPERATOR = '=';
    const NEGATION_MARKER = '~';
    const WILDCARD = ASTERISK;
    const CSS_MEDIA_MARKER = '@media';
    const CSS_NOT_PSEUDO = 'not';
    const HINT_MARKER = '!+';
    const HINT_MARKER_LEN = HINT_MARKER.length;
    const NETWORK_RULE_EXCEPTION_MARKER = '@@';
    const NETWORK_RULE_EXCEPTION_MARKER_LEN = NETWORK_RULE_EXCEPTION_MARKER.length;
    const NETWORK_RULE_SEPARATOR = '$';
    const AGLINT_COMMAND_PREFIX = 'aglint';
    const AGLINT_CONFIG_COMMENT_MARKER = '--';
    const PREPROCESSOR_MARKER = '!#';
    const PREPROCESSOR_MARKER_LEN = PREPROCESSOR_MARKER.length;
    const PREPROCESSOR_SEPARATOR = ' ';
    const SAFARI_CB_AFFINITY = 'safari_cb_affinity';
    const IF = 'if';
    const INCLUDE = 'include';
    const NULL = 0;
    const UINT8_MAX = 255;
    const UINT16_MAX = 65535;
    const SINGLE_QUOTE_MARKER = "'";
    const DOUBLE_QUOTE_MARKER = '"';
    class StringUtils {
        static findNextUnescapedCharacter(pattern, searchedCharacter, start = 0, escapeCharacter = ESCAPE_CHARACTER) {
            for (let i = start; i < pattern.length; i += 1) {
                if (pattern[i] === searchedCharacter && pattern[i - 1] !== escapeCharacter) {
                    return i;
                }
            }
            return -1;
        }
        static findNextUnescapedCharacterBackwards(pattern, searchedCharacter, start = pattern.length - 1, escapeCharacter = ESCAPE_CHARACTER) {
            for (let i = start; i >= 0; i -= 1) {
                if (pattern[i] === searchedCharacter && pattern[i - 1] !== escapeCharacter) {
                    return i;
                }
            }
            return -1;
        }
        static findLastUnescapedCharacter(pattern, searchedCharacter, escapeCharacter = ESCAPE_CHARACTER) {
            for (let i = pattern.length - 1; i >= 0; i -= 1) {
                if (pattern[i] === searchedCharacter && pattern[i - 1] !== escapeCharacter) {
                    return i;
                }
            }
            return -1;
        }
        static findNextUnescapedCharacterThatNotFollowedBy(pattern, start, searchedCharacter, notFollowedBy, escapeCharacter = ESCAPE_CHARACTER) {
            for (let i = start; i < pattern.length; i += 1) {
                if (pattern[i] === searchedCharacter
                    && pattern[i + 1] !== notFollowedBy
                    && pattern[i - 1] !== escapeCharacter) {
                    return i;
                }
            }
            return -1;
        }
        static findLastUnescapedCharacterThatNotFollowedBy(pattern, searchedCharacter, notFollowedBy, escapeCharacter = ESCAPE_CHARACTER) {
            for (let i = pattern.length - 1; i >= 0; i -= 1) {
                if (pattern[i] === searchedCharacter
                    && pattern[i + 1] !== notFollowedBy
                    && pattern[i - 1] !== escapeCharacter) {
                    return i;
                }
            }
            return -1;
        }
        static findUnescapedNonStringNonRegexChar(pattern, searchedCharacter, start = 0) {
            let open = null;
            for (let i = start; i < pattern.length; i += 1) {
                if ((pattern[i] === SINGLE_QUOTE_MARKER
                    || pattern[i] === DOUBLE_QUOTE_MARKER
                    || pattern[i] === REGEX_MARKER)
                    && pattern[i - 1] !== ESCAPE_CHARACTER) {
                    if (open === pattern[i]) {
                        open = null;
                    }
                    else if (open === null) {
                        open = pattern[i];
                    }
                }
                else if (open === null && pattern[i] === searchedCharacter && pattern[i - 1] !== ESCAPE_CHARACTER) {
                    return i;
                }
            }
            return -1;
        }
        static findNextUnquotedUnescapedCharacter(pattern, searchedCharacter, start = 0, escapeCharacter = ESCAPE_CHARACTER) {
            let openQuote = null;
            for (let i = start; i < pattern.length; i += 1) {
                if ((pattern[i] === SINGLE_QUOTE_MARKER || pattern[i] === DOUBLE_QUOTE_MARKER)
                    && pattern[i - 1] !== escapeCharacter) {
                    if (!openQuote)
                        openQuote = pattern[i];
                    else if (openQuote === pattern[i])
                        openQuote = null;
                }
                else if (pattern[i] === searchedCharacter && pattern[i - 1] !== escapeCharacter) {
                    if (!openQuote) {
                        return i;
                    }
                }
            }
            return -1;
        }
        static findNextNotBracketedUnescapedCharacter(pattern, searchedCharacter, start = 0, escapeCharacter = ESCAPE_CHARACTER, openBracket = '(', closeBracket = ')') {
            if (openBracket === closeBracket) {
                throw new Error('Open and close bracket cannot be the same');
            }
            let depth = 0;
            for (let i = start; i < pattern.length; i += 1) {
                if (pattern[i] === openBracket) {
                    depth += 1;
                }
                else if (pattern[i] === closeBracket) {
                    depth -= 1;
                }
                else if (depth < 1 && pattern[i] === searchedCharacter && pattern[i - 1] !== escapeCharacter) {
                    return i;
                }
            }
            return -1;
        }
        static splitStringByUnquotedUnescapedCharacter(pattern, delimeterCharacter) {
            const parts = [];
            let delimeterIndex = -1;
            do {
                const prevDelimeterIndex = delimeterIndex;
                delimeterIndex = StringUtils.findNextUnquotedUnescapedCharacter(pattern, delimeterCharacter, delimeterIndex + 1);
                if (delimeterIndex !== -1) {
                    parts.push(pattern.substring(prevDelimeterIndex + 1, delimeterIndex));
                }
                else {
                    parts.push(pattern.substring(prevDelimeterIndex + 1, pattern.length));
                }
            } while (delimeterIndex !== -1);
            return parts;
        }
        static splitStringByUnescapedNonStringNonRegexChar(pattern, delimeterCharacter) {
            const parts = [];
            let delimeterIndex = -1;
            do {
                const prevDelimeterIndex = delimeterIndex;
                delimeterIndex = StringUtils.findUnescapedNonStringNonRegexChar(pattern, delimeterCharacter, delimeterIndex + 1);
                if (delimeterIndex !== -1) {
                    parts.push(pattern.substring(prevDelimeterIndex + 1, delimeterIndex));
                }
                else {
                    parts.push(pattern.substring(prevDelimeterIndex + 1, pattern.length));
                }
            } while (delimeterIndex !== -1);
            return parts;
        }
        static splitStringByUnescapedCharacter(pattern, delimeterCharacter) {
            const parts = [];
            let delimeterIndex = -1;
            do {
                const prevDelimeterIndex = delimeterIndex;
                delimeterIndex = StringUtils.findNextUnescapedCharacter(pattern, delimeterCharacter, delimeterIndex + 1);
                if (delimeterIndex !== -1) {
                    parts.push(pattern.substring(prevDelimeterIndex + 1, delimeterIndex));
                }
                else {
                    parts.push(pattern.substring(prevDelimeterIndex + 1, pattern.length));
                }
            } while (delimeterIndex !== -1);
            return parts;
        }
        static isWhitespace(char) {
            return char === SPACE || char === TAB;
        }
        static isDigit(char) {
            return char >= NUMBER_0 && char <= NUMBER_9;
        }
        static isSmallLetter(char) {
            return char >= SMALL_LETTER_A && char <= SMALL_LETTER_Z;
        }
        static isCapitalLetter(char) {
            return char >= CAPITAL_LETTER_A && char <= CAPITAL_LETTER_Z;
        }
        static isLetter(char) {
            return StringUtils.isSmallLetter(char) || StringUtils.isCapitalLetter(char);
        }
        static isAlphaNumeric(char) {
            return StringUtils.isLetter(char) || StringUtils.isDigit(char);
        }
        static findFirstNonWhitespaceCharacter(pattern, start = 0) {
            for (let i = start; i < pattern.length; i += 1) {
                if (!StringUtils.isWhitespace(pattern[i])) {
                    return i;
                }
            }
            return -1;
        }
        static findLastNonWhitespaceCharacter(pattern) {
            for (let i = pattern.length - 1; i >= 0; i -= 1) {
                if (!StringUtils.isWhitespace(pattern[i])) {
                    return i;
                }
            }
            return -1;
        }
        static findNextWhitespaceCharacter(pattern, start = 0) {
            for (let i = start; i < pattern.length; i += 1) {
                if (StringUtils.isWhitespace(pattern[i])) {
                    return i;
                }
            }
            return pattern.length;
        }
        static escapeCharacter(pattern, character, escapeCharacter = ESCAPE_CHARACTER) {
            let result = EMPTY;
            for (let i = 0; i < pattern.length; i += 1) {
                if (pattern[i] === character && pattern[i - 1] !== escapeCharacter) {
                    result += escapeCharacter;
                }
                result += pattern[i];
            }
            return result;
        }
        static skipWS(pattern, start = 0) {
            let i = start;
            while (i < pattern.length && StringUtils.isWhitespace(pattern[i])) {
                i += 1;
            }
            return Math.min(i, pattern.length);
        }
        static skipWSBack(pattern, start = pattern.length - 1) {
            let i = start;
            while (i >= 0 && StringUtils.isWhitespace(pattern[i])) {
                i -= 1;
            }
            return Math.max(i, -1);
        }
        static isEOL(char) {
            return char === CR || char === LF || char === FF;
        }
        static splitStringByNewLines(input) {
            return input.split(/\r?\n/);
        }
        static splitStringByNewLinesEx(input) {
            const result = [];
            let currentLine = EMPTY;
            let newLineType = null;
            for (let i = 0; i < input.length; i += 1) {
                const char = input[i];
                if (char === CR) {
                    if (input[i + 1] === LF) {
                        newLineType = 'crlf';
                        i += 1;
                    }
                    else {
                        newLineType = 'cr';
                    }
                    result.push([currentLine, newLineType]);
                    currentLine = EMPTY;
                    newLineType = null;
                }
                else if (char === LF) {
                    newLineType = 'lf';
                    result.push([currentLine, newLineType]);
                    currentLine = EMPTY;
                    newLineType = null;
                }
                else {
                    currentLine += char;
                }
            }
            if (result.length === 0 || currentLine !== EMPTY) {
                result.push([currentLine, newLineType]);
            }
            return result;
        }
        static mergeStringByNewLines(input) {
            let result = EMPTY;
            for (let i = 0; i < input.length; i += 1) {
                const [line, newLineType] = input[i];
                result += line;
                if (newLineType !== null) {
                    if (newLineType === 'crlf') {
                        result += CRLF;
                    }
                    else if (newLineType === 'cr') {
                        result += CR;
                    }
                    else {
                        result += LF;
                    }
                }
            }
            return result;
        }
        static parseNumber(raw) {
            const result = parseInt(raw, 10);
            if (Number.isNaN(result)) {
                throw new Error('Expected a number');
            }
            return result;
        }
        static isString(value) {
            return typeof value === 'string';
        }
        static escapeCharacters(input, characters = new Set()) {
            let result = EMPTY;
            for (let i = 0; i < input.length; i += 1) {
                if (characters.has(input[i])) {
                    result += ESCAPE_CHARACTER;
                }
                result += input[i];
            }
            return result;
        }
    }
    var OperatorValue;
    (function (OperatorValue) {
        OperatorValue["Not"] = "!";
        OperatorValue["And"] = "&&";
        OperatorValue["Or"] = "||";
    })(OperatorValue || (OperatorValue = {}));
    var CommentMarker;
    (function (CommentMarker) {
        CommentMarker["Regular"] = "!";
        CommentMarker["Hashmark"] = "#";
    })(CommentMarker || (CommentMarker = {}));
    var RuleCategory;
    (function (RuleCategory) {
        RuleCategory["Empty"] = "Empty";
        RuleCategory["Invalid"] = "Invalid";
        RuleCategory["Comment"] = "Comment";
        RuleCategory["Cosmetic"] = "Cosmetic";
        RuleCategory["Network"] = "Network";
    })(RuleCategory || (RuleCategory = {}));
    var ListNodeType;
    (function (ListNodeType) {
        ListNodeType["Unknown"] = "Unknown";
        ListNodeType["AppList"] = "AppList";
        ListNodeType["DomainList"] = "DomainList";
        ListNodeType["MethodList"] = "MethodList";
        ListNodeType["StealthOptionList"] = "StealthOptionList";
    })(ListNodeType || (ListNodeType = {}));
    var ListItemNodeType;
    (function (ListItemNodeType) {
        ListItemNodeType["Unknown"] = "Unknown";
        ListItemNodeType["App"] = "App";
        ListItemNodeType["Domain"] = "Domain";
        ListItemNodeType["Method"] = "Method";
        ListItemNodeType["StealthOption"] = "StealthOption";
    })(ListItemNodeType || (ListItemNodeType = {}));
    var CommentRuleType;
    (function (CommentRuleType) {
        CommentRuleType["AgentCommentRule"] = "AgentCommentRule";
        CommentRuleType["CommentRule"] = "CommentRule";
        CommentRuleType["ConfigCommentRule"] = "ConfigCommentRule";
        CommentRuleType["HintCommentRule"] = "HintCommentRule";
        CommentRuleType["MetadataCommentRule"] = "MetadataCommentRule";
        CommentRuleType["PreProcessorCommentRule"] = "PreProcessorCommentRule";
    })(CommentRuleType || (CommentRuleType = {}));
    var CosmeticRuleType;
    (function (CosmeticRuleType) {
        CosmeticRuleType["ElementHidingRule"] = "ElementHidingRule";
        CosmeticRuleType["CssInjectionRule"] = "CssInjectionRule";
        CosmeticRuleType["ScriptletInjectionRule"] = "ScriptletInjectionRule";
        CosmeticRuleType["HtmlFilteringRule"] = "HtmlFilteringRule";
        CosmeticRuleType["JsInjectionRule"] = "JsInjectionRule";
    })(CosmeticRuleType || (CosmeticRuleType = {}));
    var CosmeticRuleSeparator;
    (function (CosmeticRuleSeparator) {
        CosmeticRuleSeparator["ElementHiding"] = "##";
        CosmeticRuleSeparator["ElementHidingException"] = "#@#";
        CosmeticRuleSeparator["ExtendedElementHiding"] = "#?#";
        CosmeticRuleSeparator["ExtendedElementHidingException"] = "#@?#";
        CosmeticRuleSeparator["AbpSnippet"] = "#$#";
        CosmeticRuleSeparator["AbpSnippetException"] = "#@$#";
        CosmeticRuleSeparator["AdgCssInjection"] = "#$#";
        CosmeticRuleSeparator["AdgCssInjectionException"] = "#@$#";
        CosmeticRuleSeparator["AdgExtendedCssInjection"] = "#$?#";
        CosmeticRuleSeparator["AdgExtendedCssInjectionException"] = "#@$?#";
        CosmeticRuleSeparator["AdgJsInjection"] = "#%#";
        CosmeticRuleSeparator["AdgJsInjectionException"] = "#@%#";
        CosmeticRuleSeparator["AdgHtmlFiltering"] = "$$";
        CosmeticRuleSeparator["AdgHtmlFilteringException"] = "$@$";
    })(CosmeticRuleSeparator || (CosmeticRuleSeparator = {}));
    var BinaryTypeMap;
    (function (BinaryTypeMap) {
        BinaryTypeMap[BinaryTypeMap["Null"] = 1] = "Null";
        BinaryTypeMap[BinaryTypeMap["Undefined"] = 2] = "Undefined";
        BinaryTypeMap[BinaryTypeMap["Boolean"] = 3] = "Boolean";
        BinaryTypeMap[BinaryTypeMap["Int"] = 4] = "Int";
        BinaryTypeMap[BinaryTypeMap["Float"] = 5] = "Float";
        BinaryTypeMap[BinaryTypeMap["NotANumber"] = 6] = "NotANumber";
        BinaryTypeMap[BinaryTypeMap["String"] = 7] = "String";
        BinaryTypeMap[BinaryTypeMap["FilterListNode"] = 8] = "FilterListNode";
        BinaryTypeMap[BinaryTypeMap["EmptyRule"] = 9] = "EmptyRule";
        BinaryTypeMap[BinaryTypeMap["InvalidRule"] = 10] = "InvalidRule";
        BinaryTypeMap[BinaryTypeMap["CommentRuleNode"] = 11] = "CommentRuleNode";
        BinaryTypeMap[BinaryTypeMap["AgentNode"] = 12] = "AgentNode";
        BinaryTypeMap[BinaryTypeMap["AgentRuleNode"] = 13] = "AgentRuleNode";
        BinaryTypeMap[BinaryTypeMap["HintNode"] = 14] = "HintNode";
        BinaryTypeMap[BinaryTypeMap["HintRuleNode"] = 15] = "HintRuleNode";
        BinaryTypeMap[BinaryTypeMap["MetadataCommentRuleNode"] = 16] = "MetadataCommentRuleNode";
        BinaryTypeMap[BinaryTypeMap["ConfigCommentRuleNode"] = 17] = "ConfigCommentRuleNode";
        BinaryTypeMap[BinaryTypeMap["PreProcessorCommentRuleNode"] = 18] = "PreProcessorCommentRuleNode";
        BinaryTypeMap[BinaryTypeMap["ConfigNode"] = 19] = "ConfigNode";
        BinaryTypeMap[BinaryTypeMap["NetworkRuleNode"] = 20] = "NetworkRuleNode";
        BinaryTypeMap[BinaryTypeMap["HostRuleNode"] = 21] = "HostRuleNode";
        BinaryTypeMap[BinaryTypeMap["ElementHidingRule"] = 22] = "ElementHidingRule";
        BinaryTypeMap[BinaryTypeMap["CssInjectionRule"] = 23] = "CssInjectionRule";
        BinaryTypeMap[BinaryTypeMap["ScriptletInjectionRule"] = 24] = "ScriptletInjectionRule";
        BinaryTypeMap[BinaryTypeMap["JsInjectionRule"] = 25] = "JsInjectionRule";
        BinaryTypeMap[BinaryTypeMap["HtmlFilteringRule"] = 26] = "HtmlFilteringRule";
        BinaryTypeMap[BinaryTypeMap["ScriptletInjectionRuleBodyNode"] = 27] = "ScriptletInjectionRuleBodyNode";
        BinaryTypeMap[BinaryTypeMap["ElementHidingRuleBody"] = 28] = "ElementHidingRuleBody";
        BinaryTypeMap[BinaryTypeMap["CssInjectionRuleBody"] = 29] = "CssInjectionRuleBody";
        BinaryTypeMap[BinaryTypeMap["HtmlFilteringRuleBody"] = 30] = "HtmlFilteringRuleBody";
        BinaryTypeMap[BinaryTypeMap["JsInjectionRuleBody"] = 31] = "JsInjectionRuleBody";
        BinaryTypeMap[BinaryTypeMap["ValueNode"] = 32] = "ValueNode";
        BinaryTypeMap[BinaryTypeMap["RawNode"] = 33] = "RawNode";
        BinaryTypeMap[BinaryTypeMap["ModifierNode"] = 34] = "ModifierNode";
        BinaryTypeMap[BinaryTypeMap["ModifierListNode"] = 35] = "ModifierListNode";
        BinaryTypeMap[BinaryTypeMap["ParameterListNode"] = 36] = "ParameterListNode";
        BinaryTypeMap[BinaryTypeMap["DomainListNode"] = 37] = "DomainListNode";
        BinaryTypeMap[BinaryTypeMap["DomainNode"] = 38] = "DomainNode";
        BinaryTypeMap[BinaryTypeMap["MethodListNode"] = 39] = "MethodListNode";
        BinaryTypeMap[BinaryTypeMap["MethodNode"] = 40] = "MethodNode";
        BinaryTypeMap[BinaryTypeMap["StealthOptionListNode"] = 41] = "StealthOptionListNode";
        BinaryTypeMap[BinaryTypeMap["StealthOptionNode"] = 42] = "StealthOptionNode";
        BinaryTypeMap[BinaryTypeMap["AppListNode"] = 43] = "AppListNode";
        BinaryTypeMap[BinaryTypeMap["AppNode"] = 44] = "AppNode";
        BinaryTypeMap[BinaryTypeMap["HostnameListNode"] = 45] = "HostnameListNode";
        BinaryTypeMap[BinaryTypeMap["InvalidRuleErrorNode"] = 46] = "InvalidRuleErrorNode";
        BinaryTypeMap[BinaryTypeMap["ExpressionVariableNode"] = 47] = "ExpressionVariableNode";
        BinaryTypeMap[BinaryTypeMap["ExpressionOperatorNode"] = 48] = "ExpressionOperatorNode";
        BinaryTypeMap[BinaryTypeMap["ExpressionParenthesisNode"] = 49] = "ExpressionParenthesisNode";
    })(BinaryTypeMap || (BinaryTypeMap = {}));
    const SYNTAX_SERIALIZATION_MAP = new Map([
        [AdblockSyntax.Common, 0],
        [AdblockSyntax.Abp, 1],
        [AdblockSyntax.Adg, 2],
        [AdblockSyntax.Ubo, 3],
    ]);
    const SYNTAX_DESERIALIZATION_MAP = new Map(Array.from(SYNTAX_SERIALIZATION_MAP, ([key, value]) => [value, key]));
    var NetworkRuleType;
    (function (NetworkRuleType) {
        NetworkRuleType["NetworkRule"] = "NetworkRule";
        NetworkRuleType["HostRule"] = "HostRule";
    })(NetworkRuleType || (NetworkRuleType = {}));
    const ERROR_NAME$3 = 'AdblockSyntaxError';
    class AdblockSyntaxError extends SyntaxError {
        start;
        end;
        constructor(message, start, end) {
            super(message);
            this.name = ERROR_NAME$3;
            this.start = start;
            this.end = end;
        }
    }
    const ERROR_NAME$2 = 'NotImplementedError';
    const BASE_MESSAGE = 'Not implemented';
    class NotImplementedError extends Error {
        constructor(message = undefined) {
            const fullMessage = message
                ? `${BASE_MESSAGE}: ${message}`
                : BASE_MESSAGE;
            super(fullMessage);
            this.name = ERROR_NAME$2;
        }
    }
    class ParserBase {
        static parse(input, options, baseOffset, ...args) {
            throw new NotImplementedError();
        }
        static generate(node) {
            throw new NotImplementedError();
        }
        static serialize(node, buffer, ...args) {
            throw new NotImplementedError();
        }
        static deserialize(buffer, node, ...args) {
            throw new NotImplementedError();
        }
    }
    const defaultParserOptions = Object.freeze({
        tolerant: false,
        isLocIncluded: true,
        parseAbpSpecificRules: true,
        parseUboSpecificRules: true,
        includeRaws: true,
        ignoreComments: false,
        parseHostRules: false,
    });
    const isUndefined$1 = (value) => {
        return typeof value === 'undefined';
    };
    const isNull$1 = (value) => {
        return value === null;
    };
    const isString = (value) => {
        return typeof value === 'string';
    };
    var ValueNodeSerializationMap;
    (function (ValueNodeSerializationMap) {
        ValueNodeSerializationMap[ValueNodeSerializationMap["Value"] = 1] = "Value";
        ValueNodeSerializationMap[ValueNodeSerializationMap["FrequentValue"] = 2] = "FrequentValue";
        ValueNodeSerializationMap[ValueNodeSerializationMap["Start"] = 3] = "Start";
        ValueNodeSerializationMap[ValueNodeSerializationMap["End"] = 4] = "End";
    })(ValueNodeSerializationMap || (ValueNodeSerializationMap = {}));
    class ValueParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            const result = {
                type: 'Value',
                value: raw,
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
        static generate(node) {
            return node.value;
        }
        static serialize(node, buffer, frequentValuesMap, toLower = false) {
            buffer.writeUint8(BinaryTypeMap.ValueNode);
            const frequentValue = frequentValuesMap?.get(toLower ? node.value.toLowerCase() : node.value);
            if (!isUndefined$1(frequentValue)) {
                buffer.writeUint8(ValueNodeSerializationMap.FrequentValue);
                buffer.writeUint8(frequentValue);
            }
            else {
                buffer.writeUint8(ValueNodeSerializationMap.Value);
                buffer.writeString(node.value);
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(ValueNodeSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(ValueNodeSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node, frequentValuesMap) {
            buffer.assertUint8(BinaryTypeMap.ValueNode);
            node.type = 'Value';
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case ValueNodeSerializationMap.Value:
                        node.value = buffer.readString();
                        break;
                    case ValueNodeSerializationMap.FrequentValue:
                        node.value = frequentValuesMap?.get(buffer.readUint8()) ?? EMPTY;
                        break;
                    case ValueNodeSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case ValueNodeSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var AgentNodeSerializationMap;
    (function (AgentNodeSerializationMap) {
        AgentNodeSerializationMap[AgentNodeSerializationMap["Adblock"] = 1] = "Adblock";
        AgentNodeSerializationMap[AgentNodeSerializationMap["Version"] = 2] = "Version";
        AgentNodeSerializationMap[AgentNodeSerializationMap["Start"] = 3] = "Start";
        AgentNodeSerializationMap[AgentNodeSerializationMap["End"] = 4] = "End";
    })(AgentNodeSerializationMap || (AgentNodeSerializationMap = {}));
    const ADG_NAME_MARKERS = new Set([
        'adguard',
        'adg',
    ]);
    const UBO_NAME_MARKERS = new Set([
        'ublock',
        'ublock origin',
        'ubo',
    ]);
    const ABP_NAME_MARKERS = new Set([
        'adblock',
        'adblock plus',
        'adblockplus',
        'abp',
    ]);
    const FREQUENT_AGENTS_DESERIALIZATION_MAP = new Map([
        [0, 'AdGuard'],
        [1, 'ADG'],
        [2, 'uBlock Origin'],
        [3, 'uBlock'],
        [4, 'uBO'],
        [5, 'Adblock Plus'],
        [6, 'AdblockPlus'],
        [7, 'ABP'],
        [8, 'AdBlock'],
    ]);
    const FREQUENT_AGENTS_SERIALIZATION_MAP = new Map(Array.from(FREQUENT_AGENTS_DESERIALIZATION_MAP).map(([key, value]) => [value.toLowerCase(), key]));
    const getAdblockSyntax = (name) => {
        let syntax = AdblockSyntax.Common;
        const lowerCaseName = name.toLowerCase();
        if (ADG_NAME_MARKERS.has(lowerCaseName)) {
            syntax = AdblockSyntax.Adg;
        }
        else if (UBO_NAME_MARKERS.has(lowerCaseName)) {
            syntax = AdblockSyntax.Ubo;
        }
        else if (ABP_NAME_MARKERS.has(lowerCaseName)) {
            syntax = AdblockSyntax.Abp;
        }
        return syntax;
    };
    class AgentParser extends ParserBase {
        static isValidVersion(str) {
            return valid$1(coerce$2(str)) !== null;
        }
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            let offset = 0;
            const nameStartIndex = offset;
            let nameEndIndex = offset;
            let name;
            let version;
            let syntax = AdblockSyntax.Common;
            while (offset < raw.length) {
                offset = StringUtils.skipWS(raw, offset);
                const partEnd = StringUtils.findNextWhitespaceCharacter(raw, offset);
                const part = raw.slice(offset, partEnd);
                if (AgentParser.isValidVersion(part)) {
                    if (!isUndefined$1(version)) {
                        throw new AdblockSyntaxError('Duplicated versions are not allowed', baseOffset + offset, baseOffset + partEnd);
                    }
                    const parsedNamePart = raw.slice(nameStartIndex, nameEndIndex);
                    name = ValueParser.parse(parsedNamePart, options, baseOffset + nameStartIndex);
                    version = ValueParser.parse(part, options, baseOffset + offset);
                    syntax = getAdblockSyntax(parsedNamePart);
                }
                else {
                    nameEndIndex = partEnd;
                }
                offset = StringUtils.skipWS(raw, partEnd);
            }
            if (isUndefined$1(name)) {
                const parsedNamePart = raw.slice(nameStartIndex, nameEndIndex);
                name = ValueParser.parse(parsedNamePart, options, baseOffset + nameStartIndex);
                syntax = getAdblockSyntax(parsedNamePart);
            }
            if (name.value.length === 0) {
                throw new AdblockSyntaxError('Agent name cannot be empty', baseOffset, baseOffset + raw.length);
            }
            const result = {
                type: 'Agent',
                adblock: name,
                syntax,
            };
            if (version) {
                result.version = version;
            }
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
        static generate(value) {
            let result = EMPTY;
            result += value.adblock.value;
            if (!isUndefined$1(value.version)) {
                result += SPACE;
                result += value.version.value;
            }
            return result;
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.AgentNode);
            buffer.writeUint8(AgentNodeSerializationMap.Adblock);
            ValueParser.serialize(node.adblock, buffer, FREQUENT_AGENTS_SERIALIZATION_MAP, true);
            if (!isUndefined$1(node.version)) {
                buffer.writeUint8(AgentNodeSerializationMap.Version);
                ValueParser.serialize(node.version, buffer);
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(AgentNodeSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(AgentNodeSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.AgentNode);
            node.type = 'Agent';
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case AgentNodeSerializationMap.Adblock:
                        ValueParser.deserialize(buffer, node.adblock = {}, FREQUENT_AGENTS_DESERIALIZATION_MAP);
                        if (node.adblock) {
                            node.syntax = getAdblockSyntax(node.adblock.value);
                        }
                        break;
                    case AgentNodeSerializationMap.Version:
                        ValueParser.deserialize(buffer, node.version = {});
                        break;
                    case AgentNodeSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case AgentNodeSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    class CosmeticRuleSeparatorUtils {
        static isException(separator) {
            return separator[1] === AT_SIGN;
        }
        static isExtendedCssMarker(separator) {
            return (separator === CosmeticRuleSeparator.ExtendedElementHiding
                || separator === CosmeticRuleSeparator.ExtendedElementHidingException
                || separator === CosmeticRuleSeparator.AdgExtendedCssInjection
                || separator === CosmeticRuleSeparator.AdgExtendedCssInjectionException);
        }
        static find(rule) {
            function createResult(start, separator) {
                return {
                    separator,
                    start,
                    end: start + separator.length,
                };
            }
            for (let i = 0; i < rule.length; i += 1) {
                if (rule[i] === '#') {
                    if (rule[i + 1] === '#' && rule[i - 1] !== SPACE) {
                        return createResult(i, CosmeticRuleSeparator.ElementHiding);
                    }
                    if (rule[i + 1] === '?' && rule[i + 2] === '#') {
                        return createResult(i, CosmeticRuleSeparator.ExtendedElementHiding);
                    }
                    if (rule[i + 1] === '%' && rule[i + 2] === '#') {
                        return createResult(i, CosmeticRuleSeparator.AdgJsInjection);
                    }
                    if (rule[i + 1] === '$') {
                        if (rule[i + 2] === '#') {
                            return createResult(i, CosmeticRuleSeparator.AdgCssInjection);
                        }
                        if (rule[i + 2] === '?' && rule[i + 3] === '#') {
                            return createResult(i, CosmeticRuleSeparator.AdgExtendedCssInjection);
                        }
                    }
                    if (rule[i + 1] === '@') {
                        if (rule[i + 2] === '#' && rule[i - 1] !== SPACE) {
                            return createResult(i, CosmeticRuleSeparator.ElementHidingException);
                        }
                        if (rule[i + 2] === '?' && rule[i + 3] === '#') {
                            return createResult(i, CosmeticRuleSeparator.ExtendedElementHidingException);
                        }
                        if (rule[i + 2] === '%' && rule[i + 3] === '#') {
                            return createResult(i, CosmeticRuleSeparator.AdgJsInjectionException);
                        }
                        if (rule[i + 2] === '$') {
                            if (rule[i + 3] === '#') {
                                return createResult(i, CosmeticRuleSeparator.AdgCssInjectionException);
                            }
                            if (rule[i + 3] === '?' && rule[i + 4] === '#') {
                                return createResult(i, CosmeticRuleSeparator.AdgExtendedCssInjectionException);
                            }
                        }
                    }
                }
                if (rule[i] === '$') {
                    if (rule[i + 1] === '$') {
                        return createResult(i, CosmeticRuleSeparator.AdgHtmlFiltering);
                    }
                    if (rule[i + 1] === '@' && rule[i + 2] === '$') {
                        return createResult(i, CosmeticRuleSeparator.AdgHtmlFilteringException);
                    }
                }
            }
            return null;
        }
    }
    var AgentRuleSerializationMap;
    (function (AgentRuleSerializationMap) {
        AgentRuleSerializationMap[AgentRuleSerializationMap["Children"] = 1] = "Children";
        AgentRuleSerializationMap[AgentRuleSerializationMap["Start"] = 2] = "Start";
        AgentRuleSerializationMap[AgentRuleSerializationMap["End"] = 3] = "End";
    })(AgentRuleSerializationMap || (AgentRuleSerializationMap = {}));
    class AgentCommentRuleParser extends ParserBase {
        static isAgentRule(raw) {
            const rawTrimmed = raw.trim();
            if (rawTrimmed.startsWith(OPEN_SQUARE_BRACKET) && rawTrimmed.endsWith(CLOSE_SQUARE_BRACKET)) {
                return isNull$1(CosmeticRuleSeparatorUtils.find(rawTrimmed));
            }
            return false;
        }
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            if (!AgentCommentRuleParser.isAgentRule(raw)) {
                return null;
            }
            let offset = 0;
            offset = StringUtils.skipWS(raw, offset);
            offset += 1;
            const closingBracketIndex = StringUtils.skipWSBack(raw, raw.length - 1);
            if (closingBracketIndex === -1 || raw[closingBracketIndex] !== CLOSE_SQUARE_BRACKET) {
                throw new AdblockSyntaxError('Missing closing bracket', offset, offset + raw.length);
            }
            const result = {
                type: CommentRuleType.AgentCommentRule,
                syntax: AdblockSyntax.Common,
                category: RuleCategory.Comment,
                children: [],
            };
            if (options.includeRaws) {
                result.raws = {
                    text: raw,
                };
            }
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            while (offset < closingBracketIndex) {
                offset = StringUtils.skipWS(raw, offset);
                let separatorIndex = raw.indexOf(SEMICOLON, offset);
                if (separatorIndex === -1) {
                    separatorIndex = closingBracketIndex;
                }
                const agentEndIndex = StringUtils.findLastNonWhitespaceCharacter(raw.slice(offset, separatorIndex)) + offset + 1;
                result.children.push(AgentParser.parse(raw.slice(offset, agentEndIndex), options, baseOffset + offset));
                offset = separatorIndex + 1;
            }
            if (result.children.length === 0) {
                throw new AdblockSyntaxError('Empty agent list', baseOffset, baseOffset + raw.length);
            }
            return result;
        }
        static generate(ast) {
            let result = OPEN_SQUARE_BRACKET;
            result += ast.children
                .map(AgentParser.generate)
                .join(SEMICOLON + SPACE);
            result += CLOSE_SQUARE_BRACKET;
            return result;
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.AgentRuleNode);
            const count = node.children.length;
            if (count) {
                buffer.writeUint8(AgentRuleSerializationMap.Children);
                if (count > UINT8_MAX) {
                    throw new Error(`Too many children: ${count}, the limit is ${UINT8_MAX}`);
                }
                buffer.writeUint8(count);
                for (let i = 0; i < count; i += 1) {
                    AgentParser.serialize(node.children[i], buffer);
                }
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(AgentRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(AgentRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.AgentRuleNode);
            node.type = CommentRuleType.AgentCommentRule;
            node.syntax = AdblockSyntax.Common;
            node.category = RuleCategory.Comment;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case AgentRuleSerializationMap.Children:
                        node.children = new Array(buffer.readUint8());
                        for (let i = 0; i < node.children.length; i += 1) {
                            AgentParser.deserialize(buffer, node.children[i] = {});
                        }
                        break;
                    case AgentRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case AgentRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var ParameterListNodeSerializationMap;
    (function (ParameterListNodeSerializationMap) {
        ParameterListNodeSerializationMap[ParameterListNodeSerializationMap["Children"] = 1] = "Children";
        ParameterListNodeSerializationMap[ParameterListNodeSerializationMap["Start"] = 2] = "Start";
        ParameterListNodeSerializationMap[ParameterListNodeSerializationMap["End"] = 3] = "End";
    })(ParameterListNodeSerializationMap || (ParameterListNodeSerializationMap = {}));
    class ParameterListParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0, separator = COMMA) {
            const params = {
                type: 'ParameterList',
                children: [],
            };
            const { length } = raw;
            if (options.isLocIncluded) {
                params.start = baseOffset;
                params.end = baseOffset + length;
            }
            let offset = 0;
            while (offset < length) {
                offset = StringUtils.skipWS(raw, offset);
                if (raw[offset] === separator || offset === length) {
                    params.children.push(null);
                    offset += 1;
                }
                else {
                    const paramStart = offset;
                    const nextSeparator = StringUtils.findUnescapedNonStringNonRegexChar(raw, separator, offset);
                    const paramEnd = nextSeparator !== -1
                        ? StringUtils.skipWSBack(raw, nextSeparator - 1)
                        : StringUtils.skipWSBack(raw);
                    const param = ValueParser.parse(raw.slice(paramStart, paramEnd + 1), options, baseOffset + paramStart);
                    params.children.push(param);
                    offset = nextSeparator !== -1 ? nextSeparator + 1 : length;
                }
            }
            if (raw[length - 1] === separator) {
                params.children.push(null);
            }
            return params;
        }
        static generate(params, separator = COMMA) {
            const collection = [];
            let i = 0;
            for (; i < params.children.length; i += 1) {
                const param = params.children[i];
                if (param === null) {
                    collection.push(EMPTY);
                }
                else {
                    collection.push(ValueParser.generate(param));
                }
            }
            const result = collection.join(separator === SPACE ? separator : `${separator}${SPACE}`);
            return result;
        }
        static serialize(node, buffer, frequentValuesMap, toLower = false) {
            buffer.writeUint8(BinaryTypeMap.ParameterListNode);
            const count = node.children.length;
            buffer.writeUint8(ParameterListNodeSerializationMap.Children);
            buffer.writeUint32(count);
            for (let i = 0; i < count; i += 1) {
                const child = node.children[i];
                if (isNull$1(child)) {
                    buffer.writeUint8(BinaryTypeMap.Null);
                    continue;
                }
                ValueParser.serialize(child, buffer, frequentValuesMap, toLower);
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(ParameterListNodeSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(ParameterListNodeSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node, frequentValuesMap) {
            buffer.assertUint8(BinaryTypeMap.ParameterListNode);
            node.type = 'ParameterList';
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case ParameterListNodeSerializationMap.Children:
                        node.children = new Array(buffer.readUint32());
                        for (let i = 0; i < node.children.length; i += 1) {
                            switch (buffer.peekUint8()) {
                                case BinaryTypeMap.Null:
                                    buffer.readUint8();
                                    node.children[i] = null;
                                    break;
                                case BinaryTypeMap.ValueNode:
                                    ValueParser.deserialize(buffer, node.children[i] = {}, frequentValuesMap);
                                    break;
                                default:
                                    throw new Error(`Invalid child type: ${buffer.peekUint8()}`);
                            }
                        }
                        break;
                    case ParameterListNodeSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case ParameterListNodeSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var ConfigCommentRuleSerializationMap;
    (function (ConfigCommentRuleSerializationMap) {
        ConfigCommentRuleSerializationMap[ConfigCommentRuleSerializationMap["Marker"] = 1] = "Marker";
        ConfigCommentRuleSerializationMap[ConfigCommentRuleSerializationMap["Command"] = 2] = "Command";
        ConfigCommentRuleSerializationMap[ConfigCommentRuleSerializationMap["Params"] = 3] = "Params";
        ConfigCommentRuleSerializationMap[ConfigCommentRuleSerializationMap["Comment"] = 4] = "Comment";
        ConfigCommentRuleSerializationMap[ConfigCommentRuleSerializationMap["Start"] = 5] = "Start";
        ConfigCommentRuleSerializationMap[ConfigCommentRuleSerializationMap["End"] = 6] = "End";
    })(ConfigCommentRuleSerializationMap || (ConfigCommentRuleSerializationMap = {}));
    var ConfigNodeSerializationMap;
    (function (ConfigNodeSerializationMap) {
        ConfigNodeSerializationMap[ConfigNodeSerializationMap["Value"] = 1] = "Value";
        ConfigNodeSerializationMap[ConfigNodeSerializationMap["Start"] = 2] = "Start";
        ConfigNodeSerializationMap[ConfigNodeSerializationMap["End"] = 3] = "End";
    })(ConfigNodeSerializationMap || (ConfigNodeSerializationMap = {}));
    const FREQUENT_COMMANDS_SERIALIZATION_MAP = new Map([
        ['aglint', 0],
        ['aglint-disable', 1],
        ['aglint-enable', 2],
        ['aglint-disable-next-line', 3],
        ['aglint-enable-next-line', 4],
    ]);
    const FREQUENT_COMMANDS_DESERIALIZATION_MAP = new Map(Array.from(FREQUENT_COMMANDS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
    class ConfigCommentRuleParser extends ParserBase {
        static isConfigComment(raw) {
            const trimmed = raw.trim();
            if (trimmed[0] === CommentMarker.Regular || trimmed[0] === CommentMarker.Hashmark) {
                const text = raw.slice(1).trim();
                return ((text[0] === 'a' || text[0] === 'A')
                    && (text[1] === 'g' || text[1] === 'G')
                    && (text[2] === 'l' || text[2] === 'L')
                    && (text[3] === 'i' || text[3] === 'I')
                    && (text[4] === 'n' || text[4] === 'N')
                    && (text[5] === 't' || text[5] === 'T'));
            }
            return false;
        }
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            if (!ConfigCommentRuleParser.isConfigComment(raw)) {
                return null;
            }
            let offset = 0;
            offset = StringUtils.skipWS(raw, offset);
            const marker = ValueParser.parse(raw[offset], options, baseOffset + offset);
            offset += 1;
            offset = StringUtils.skipWS(raw, offset);
            const commandStart = offset;
            offset = StringUtils.findNextWhitespaceCharacter(raw, offset);
            const command = ValueParser.parse(raw.slice(commandStart, offset), options, baseOffset + commandStart);
            offset = StringUtils.skipWS(raw, offset);
            const commentStart = raw.indexOf(AGLINT_CONFIG_COMMENT_MARKER, offset);
            const commentEnd = commentStart !== -1 ? StringUtils.skipWSBack(raw) + 1 : -1;
            let comment;
            if (commentStart !== -1) {
                comment = ValueParser.parse(raw.slice(commentStart, commentEnd), options, baseOffset + commentStart);
            }
            const paramsStart = offset;
            const paramsEnd = commentStart !== -1
                ? StringUtils.skipWSBack(raw, commentStart - 1) + 1
                : StringUtils.skipWSBack(raw) + 1;
            let params;
            if (command.value === AGLINT_COMMAND_PREFIX) {
                params = {
                    type: 'ConfigNode',
                    value: lib.parse(`{${raw.slice(paramsStart, paramsEnd)}}`),
                };
                if (options.isLocIncluded) {
                    params.start = paramsStart;
                    params.end = paramsEnd;
                }
                if (Object.keys(params.value).length === 0) {
                    throw new Error('Empty AGLint config');
                }
            }
            else if (paramsStart < paramsEnd) {
                params = ParameterListParser.parse(raw.slice(paramsStart, paramsEnd), options, baseOffset + paramsStart, COMMA);
            }
            const result = {
                type: CommentRuleType.ConfigCommentRule,
                category: RuleCategory.Comment,
                syntax: AdblockSyntax.Common,
                marker,
                command,
                params,
                comment,
            };
            if (options.includeRaws) {
                result.raws = {
                    text: raw,
                };
            }
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
        static generate(node) {
            let result = EMPTY;
            result += node.marker.value;
            result += SPACE;
            result += node.command.value;
            if (node.params) {
                result += SPACE;
                if (node.params.type === 'ParameterList') {
                    result += ParameterListParser.generate(node.params, COMMA);
                }
                else {
                    result += JSON.stringify(node.params.value).slice(1, -1).trim();
                }
            }
            if (node.comment) {
                result += SPACE;
                result += node.comment.value;
            }
            return result;
        }
        static serializeConfigNode(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.ConfigNode);
            buffer.writeUint8(ConfigNodeSerializationMap.Value);
            buffer.writeString(JSON.stringify(node.value));
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(ConfigNodeSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(ConfigNodeSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserializeConfigNode(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.ConfigNode);
            node.type = 'ConfigNode';
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case ConfigNodeSerializationMap.Value:
                        node.value = JSON.parse(buffer.readString());
                        break;
                    case ConfigNodeSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case ConfigNodeSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}.`);
                }
                prop = buffer.readUint8();
            }
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.ConfigCommentRuleNode);
            buffer.writeUint8(ConfigCommentRuleSerializationMap.Marker);
            ValueParser.serialize(node.marker, buffer);
            buffer.writeUint8(ConfigCommentRuleSerializationMap.Command);
            ValueParser.serialize(node.command, buffer, FREQUENT_COMMANDS_SERIALIZATION_MAP, true);
            if (!isUndefined$1(node.params)) {
                buffer.writeUint8(ConfigCommentRuleSerializationMap.Params);
                if (node.params.type === 'ParameterList') {
                    ParameterListParser.serialize(node.params, buffer);
                }
                else {
                    ConfigCommentRuleParser.serializeConfigNode(node.params, buffer);
                }
            }
            if (!isUndefined$1(node.comment)) {
                buffer.writeUint8(ConfigCommentRuleSerializationMap.Comment);
                ValueParser.serialize(node.comment, buffer);
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(ConfigCommentRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(ConfigCommentRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.ConfigCommentRuleNode);
            node.type = CommentRuleType.ConfigCommentRule;
            node.category = RuleCategory.Comment;
            node.syntax = AdblockSyntax.Common;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case ConfigCommentRuleSerializationMap.Marker:
                        ValueParser.deserialize(buffer, node.marker = {});
                        break;
                    case ConfigCommentRuleSerializationMap.Command:
                        ValueParser.deserialize(buffer, node.command = {}, FREQUENT_COMMANDS_DESERIALIZATION_MAP);
                        break;
                    case ConfigCommentRuleSerializationMap.Params:
                        if (buffer.peekUint8() === BinaryTypeMap.ConfigNode) {
                            ConfigCommentRuleParser.deserializeConfigNode(buffer, node.params = {});
                        }
                        else {
                            ParameterListParser.deserialize(buffer, node.params = {});
                        }
                        break;
                    case ConfigCommentRuleSerializationMap.Comment:
                        ValueParser.deserialize(buffer, node.comment = {});
                        break;
                    case ConfigCommentRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case ConfigCommentRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var HintNodeSerializationMap;
    (function (HintNodeSerializationMap) {
        HintNodeSerializationMap[HintNodeSerializationMap["Name"] = 1] = "Name";
        HintNodeSerializationMap[HintNodeSerializationMap["Params"] = 2] = "Params";
        HintNodeSerializationMap[HintNodeSerializationMap["Start"] = 3] = "Start";
        HintNodeSerializationMap[HintNodeSerializationMap["End"] = 4] = "End";
    })(HintNodeSerializationMap || (HintNodeSerializationMap = {}));
    const FREQUENT_HINTS_SERIALIZATION_MAP = new Map([
        ['NOT_OPTIMIZED', 0],
        ['PLATFORM', 1],
        ['NOT_PLATFORM', 2],
    ]);
    const FREQUENT_HINTS_DESERIALIZATION_MAP = new Map(Array.from(FREQUENT_HINTS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
    const FREQUENT_PLATFORMS_SERIALIZATION_MAP = new Map([
        ['windows', 0],
        ['mac', 1],
        ['android', 2],
        ['ios', 3],
        ['ext_chromium', 4],
        ['ext_ff', 5],
        ['ext_edge', 6],
        ['ext_opera', 7],
        ['ext_safari', 8],
        ['ext_android_cb', 9],
        ['ext_ublock', 10],
    ]);
    const FREQUENT_PLATFORMS_DESERIALIZATION_MAP = new Map(Array.from(FREQUENT_PLATFORMS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
    class HintParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            let offset = 0;
            offset = StringUtils.skipWS(raw);
            const nameStartIndex = offset;
            for (; offset < raw.length; offset += 1) {
                const char = raw[offset];
                if (char === OPEN_PARENTHESIS || char === SPACE) {
                    break;
                }
                if (!StringUtils.isAlphaNumeric(char) && char !== UNDERSCORE) {
                    throw new AdblockSyntaxError(`Invalid character "${char}" in hint name: "${char}"`, baseOffset + nameStartIndex, baseOffset + offset);
                }
            }
            const nameEndIndex = offset;
            const name = raw.slice(nameStartIndex, nameEndIndex);
            if (name === EMPTY) {
                throw new AdblockSyntaxError('Empty hint name', baseOffset, baseOffset + nameEndIndex);
            }
            offset = StringUtils.skipWS(raw, offset);
            if (offset > nameEndIndex && raw[offset] === OPEN_PARENTHESIS) {
                throw new AdblockSyntaxError('Unexpected whitespace(s) between hint name and opening parenthesis', baseOffset + nameEndIndex, baseOffset + offset);
            }
            const nameNode = ValueParser.parse(name, options, baseOffset + nameStartIndex);
            if (raw[offset] !== OPEN_PARENTHESIS) {
                const result = {
                    type: 'Hint',
                    name: nameNode,
                };
                if (options.isLocIncluded) {
                    result.start = baseOffset;
                    result.end = baseOffset + offset;
                }
                return result;
            }
            offset += 1;
            const closeParenthesisIndex = raw.lastIndexOf(CLOSE_PARENTHESIS);
            if (closeParenthesisIndex === -1) {
                throw new AdblockSyntaxError(`Missing closing parenthesis for hint "${name}"`, baseOffset + nameStartIndex, baseOffset + raw.length);
            }
            const paramsStartIndex = offset;
            const paramsEndIndex = closeParenthesisIndex;
            const params = ParameterListParser.parse(raw.slice(paramsStartIndex, paramsEndIndex), options, baseOffset + paramsStartIndex, COMMA);
            offset = closeParenthesisIndex + 1;
            offset = StringUtils.skipWS(raw, offset);
            if (offset !== raw.length) {
                throw new AdblockSyntaxError(
                `Unexpected input after closing parenthesis for hint "${name}": "${raw.slice(closeParenthesisIndex + 1, offset + 1)}"`, baseOffset + closeParenthesisIndex + 1, baseOffset + offset + 1);
            }
            const result = {
                type: 'Hint',
                name: nameNode,
                params,
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + offset;
            }
            return result;
        }
        static generate(hint) {
            let result = EMPTY;
            result += hint.name.value;
            if (hint.params && hint.params.children.length > 0) {
                result += OPEN_PARENTHESIS;
                result += ParameterListParser.generate(hint.params, COMMA);
                result += CLOSE_PARENTHESIS;
            }
            return result;
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.HintNode);
            buffer.writeUint8(HintNodeSerializationMap.Name);
            ValueParser.serialize(node.name, buffer, FREQUENT_HINTS_SERIALIZATION_MAP);
            if (!isUndefined$1(node.params)) {
                buffer.writeUint8(HintNodeSerializationMap.Params);
                ParameterListParser.serialize(node.params, buffer, FREQUENT_PLATFORMS_SERIALIZATION_MAP);
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(HintNodeSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(HintNodeSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.HintNode);
            node.type = 'Hint';
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case HintNodeSerializationMap.Name:
                        ValueParser.deserialize(buffer, node.name = {}, FREQUENT_HINTS_DESERIALIZATION_MAP);
                        break;
                    case HintNodeSerializationMap.Params:
                        ParameterListParser.deserialize(buffer, node.params = {}, FREQUENT_PLATFORMS_DESERIALIZATION_MAP);
                        break;
                    case HintNodeSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case HintNodeSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var HintRuleSerializationMap;
    (function (HintRuleSerializationMap) {
        HintRuleSerializationMap[HintRuleSerializationMap["Syntax"] = 1] = "Syntax";
        HintRuleSerializationMap[HintRuleSerializationMap["Children"] = 2] = "Children";
        HintRuleSerializationMap[HintRuleSerializationMap["Start"] = 3] = "Start";
        HintRuleSerializationMap[HintRuleSerializationMap["End"] = 4] = "End";
    })(HintRuleSerializationMap || (HintRuleSerializationMap = {}));
    class HintCommentRuleParser extends ParserBase {
        static isHintRule(raw) {
            return raw.trim().startsWith(HINT_MARKER);
        }
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            if (!HintCommentRuleParser.isHintRule(raw)) {
                return null;
            }
            let offset = 0;
            offset = StringUtils.skipWS(raw);
            offset += HINT_MARKER_LEN;
            const hints = [];
            while (offset < raw.length) {
                offset = StringUtils.skipWS(raw, offset);
                const hintStartIndex = offset;
                let hintEndIndex = offset;
                let balance = 0;
                while (hintEndIndex < raw.length) {
                    if (raw[hintEndIndex] === OPEN_PARENTHESIS && raw[hintEndIndex - 1] !== BACKSLASH) {
                        balance += 1;
                        if (balance > 1) {
                            throw new AdblockSyntaxError('Invalid hint: nested parentheses are not allowed', baseOffset + hintStartIndex, baseOffset + hintEndIndex);
                        }
                    }
                    else if (raw[hintEndIndex] === CLOSE_PARENTHESIS && raw[hintEndIndex - 1] !== BACKSLASH) {
                        balance -= 1;
                    }
                    else if (StringUtils.isWhitespace(raw[hintEndIndex]) && balance === 0) {
                        break;
                    }
                    hintEndIndex += 1;
                }
                offset = hintEndIndex;
                offset = StringUtils.skipWS(raw, offset);
                const hint = HintParser.parse(raw.slice(hintStartIndex, hintEndIndex), options, baseOffset + hintStartIndex);
                hints.push(hint);
            }
            if (hints.length === 0) {
                throw new AdblockSyntaxError('Empty hint rule', baseOffset, baseOffset + offset);
            }
            const result = {
                type: CommentRuleType.HintCommentRule,
                category: RuleCategory.Comment,
                syntax: AdblockSyntax.Adg,
                children: hints,
            };
            if (options.includeRaws) {
                result.raws = {
                    text: raw,
                };
            }
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + offset;
            }
            return result;
        }
        static generate(node) {
            let result = HINT_MARKER + SPACE;
            result += node.children.map(HintParser.generate).join(SPACE);
            return result;
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.HintRuleNode);
            if (node.syntax === AdblockSyntax.Adg) {
                buffer.writeUint8(HintRuleSerializationMap.Syntax);
                buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(AdblockSyntax.Adg) ?? 0);
            }
            const count = node.children.length;
            if (count) {
                buffer.writeUint8(HintRuleSerializationMap.Children);
                buffer.writeUint8(count);
                for (let i = 0; i < count; i += 1) {
                    HintParser.serialize(node.children[i], buffer);
                }
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(HintRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(HintRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.HintRuleNode);
            node.category = RuleCategory.Comment;
            node.type = CommentRuleType.HintCommentRule;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case HintRuleSerializationMap.Syntax:
                        node.syntax = SYNTAX_DESERIALIZATION_MAP.get(buffer.readUint8()) ?? AdblockSyntax.Common;
                        break;
                    case HintRuleSerializationMap.Children:
                        node.children = new Array(buffer.readUint8());
                        for (let i = 0; i < node.children.length; i += 1) {
                            HintParser.deserialize(buffer, node.children[i] = {});
                        }
                        break;
                    case HintRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case HintRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var MetadataCommentRuleSerializationMap;
    (function (MetadataCommentRuleSerializationMap) {
        MetadataCommentRuleSerializationMap[MetadataCommentRuleSerializationMap["Marker"] = 1] = "Marker";
        MetadataCommentRuleSerializationMap[MetadataCommentRuleSerializationMap["Header"] = 2] = "Header";
        MetadataCommentRuleSerializationMap[MetadataCommentRuleSerializationMap["Value"] = 3] = "Value";
        MetadataCommentRuleSerializationMap[MetadataCommentRuleSerializationMap["Start"] = 4] = "Start";
        MetadataCommentRuleSerializationMap[MetadataCommentRuleSerializationMap["End"] = 5] = "End";
    })(MetadataCommentRuleSerializationMap || (MetadataCommentRuleSerializationMap = {}));
    const FREQUENT_HEADERS_DESERIALIZATION_MAP = new Map([
        [1, 'Checksum'],
        [2, 'Description'],
        [3, 'Expires'],
        [4, 'Homepage'],
        [5, 'Last Modified'],
        [6, 'LastModified'],
        [7, 'Licence'],
        [8, 'License'],
        [9, 'Time Updated'],
        [10, 'TimeUpdated'],
        [11, 'Version'],
        [12, 'Title'],
    ]);
    const FREQUENT_HEADERS_SERIALIZATION_MAP = new Map(Array.from(FREQUENT_HEADERS_DESERIALIZATION_MAP.entries()).map(([key, value]) => [value.toLowerCase(), key]));
    const KNOWN_METADATA_HEADERS = Array.from(FREQUENT_HEADERS_SERIALIZATION_MAP.keys());
    class MetadataCommentRuleParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            if (raw.indexOf(COLON) === -1) {
                return null;
            }
            let offset = 0;
            offset = StringUtils.skipWS(raw, offset);
            if (raw[offset] !== CommentMarker.Regular && raw[offset] !== CommentMarker.Hashmark) {
                return null;
            }
            const marker = ValueParser.parse(raw[offset], options, baseOffset + offset);
            offset += 1;
            offset = StringUtils.skipWS(raw, offset);
            const headerStart = offset;
            const text = raw.slice(offset);
            for (let i = 0; i < KNOWN_METADATA_HEADERS.length; i += 1) {
                if (text.toLocaleLowerCase().startsWith(KNOWN_METADATA_HEADERS[i].toLocaleLowerCase())) {
                    offset += KNOWN_METADATA_HEADERS[i].length;
                    const header = ValueParser.parse(raw.slice(headerStart, offset), options, baseOffset + headerStart);
                    offset = StringUtils.skipWS(raw, offset);
                    if (raw[offset] !== COLON) {
                        return null;
                    }
                    offset += 1;
                    offset = StringUtils.skipWS(raw, offset);
                    const valueStart = offset;
                    if (offset >= raw.length) {
                        return null;
                    }
                    const valueEnd = StringUtils.skipWSBack(raw, raw.length - 1) + 1;
                    const value = ValueParser.parse(raw.slice(valueStart, valueEnd), options, baseOffset + valueStart);
                    const result = {
                        type: CommentRuleType.MetadataCommentRule,
                        category: RuleCategory.Comment,
                        syntax: AdblockSyntax.Common,
                        marker,
                        header,
                        value,
                    };
                    if (options.includeRaws) {
                        result.raws = {
                            text: raw,
                        };
                    }
                    if (options.isLocIncluded) {
                        result.start = baseOffset;
                        result.end = baseOffset + raw.length;
                    }
                    return result;
                }
            }
            return null;
        }
        static generate(node) {
            let result = EMPTY;
            result += ValueParser.generate(node.marker);
            result += SPACE;
            result += ValueParser.generate(node.header);
            result += COLON;
            result += SPACE;
            result += ValueParser.generate(node.value);
            return result;
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.MetadataCommentRuleNode);
            buffer.writeUint8(MetadataCommentRuleSerializationMap.Marker);
            ValueParser.serialize(node.marker, buffer);
            buffer.writeUint8(MetadataCommentRuleSerializationMap.Header);
            ValueParser.serialize(node.header, buffer, FREQUENT_HEADERS_SERIALIZATION_MAP, true);
            buffer.writeUint8(MetadataCommentRuleSerializationMap.Value);
            ValueParser.serialize(node.value, buffer);
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(MetadataCommentRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(MetadataCommentRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.MetadataCommentRuleNode);
            node.type = CommentRuleType.MetadataCommentRule;
            node.category = RuleCategory.Comment;
            node.syntax = AdblockSyntax.Common;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case MetadataCommentRuleSerializationMap.Marker:
                        ValueParser.deserialize(buffer, node.marker = {});
                        break;
                    case MetadataCommentRuleSerializationMap.Header:
                        ValueParser.deserialize(buffer, node.header = {}, FREQUENT_HEADERS_DESERIALIZATION_MAP);
                        break;
                    case MetadataCommentRuleSerializationMap.Value:
                        ValueParser.deserialize(buffer, node.value = {});
                        break;
                    case MetadataCommentRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case MetadataCommentRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var VariableNodeBinaryPropMap;
    (function (VariableNodeBinaryPropMap) {
        VariableNodeBinaryPropMap[VariableNodeBinaryPropMap["Name"] = 1] = "Name";
        VariableNodeBinaryPropMap[VariableNodeBinaryPropMap["FrequentName"] = 2] = "FrequentName";
        VariableNodeBinaryPropMap[VariableNodeBinaryPropMap["Start"] = 3] = "Start";
        VariableNodeBinaryPropMap[VariableNodeBinaryPropMap["End"] = 4] = "End";
    })(VariableNodeBinaryPropMap || (VariableNodeBinaryPropMap = {}));
    var OperatorNodeBinaryPropMap;
    (function (OperatorNodeBinaryPropMap) {
        OperatorNodeBinaryPropMap[OperatorNodeBinaryPropMap["Operator"] = 1] = "Operator";
        OperatorNodeBinaryPropMap[OperatorNodeBinaryPropMap["Left"] = 2] = "Left";
        OperatorNodeBinaryPropMap[OperatorNodeBinaryPropMap["Right"] = 3] = "Right";
        OperatorNodeBinaryPropMap[OperatorNodeBinaryPropMap["Start"] = 4] = "Start";
        OperatorNodeBinaryPropMap[OperatorNodeBinaryPropMap["End"] = 5] = "End";
    })(OperatorNodeBinaryPropMap || (OperatorNodeBinaryPropMap = {}));
    var ParenthesisNodeBinaryPropMap;
    (function (ParenthesisNodeBinaryPropMap) {
        ParenthesisNodeBinaryPropMap[ParenthesisNodeBinaryPropMap["Expression"] = 1] = "Expression";
        ParenthesisNodeBinaryPropMap[ParenthesisNodeBinaryPropMap["Start"] = 2] = "Start";
        ParenthesisNodeBinaryPropMap[ParenthesisNodeBinaryPropMap["End"] = 3] = "End";
    })(ParenthesisNodeBinaryPropMap || (ParenthesisNodeBinaryPropMap = {}));
    var TokenType;
    (function (TokenType) {
        TokenType[TokenType["Variable"] = 0] = "Variable";
        TokenType[TokenType["Operator"] = 1] = "Operator";
        TokenType[TokenType["Parenthesis"] = 2] = "Parenthesis";
    })(TokenType || (TokenType = {}));
    var NodeType;
    (function (NodeType) {
        NodeType["Variable"] = "Variable";
        NodeType["Operator"] = "Operator";
        NodeType["Parenthesis"] = "Parenthesis";
    })(NodeType || (NodeType = {}));
    const OPERATOR_PRECEDENCE = {
        [OperatorValue.Not]: 3,
        [OperatorValue.And]: 2,
        [OperatorValue.Or]: 1,
    };
    const OPERATOR_BINARY_MAP = new Map([
        [OperatorValue.Not, 0],
        [OperatorValue.And, 1],
        [OperatorValue.Or, 2],
    ]);
    const OPERATOR_BINARY_MAP_REVERSE = new Map(Array.from(OPERATOR_BINARY_MAP).map(([key, value]) => [value, key]));
    const getOperatorOrFail = (binary) => {
        const operator = OPERATOR_BINARY_MAP_REVERSE.get(binary);
        if (isUndefined$1(operator)) {
            throw new Error(`Unknown operator: ${binary}`);
        }
        return operator;
    };
    const KNOWN_VARIABLES_MAP = new Map([
        ['ext_abp', 0],
        ['ext_ublock', 1],
        ['ext_ubol', 2],
        ['ext_devbuild', 3],
        ['env_chromium', 4],
        ['env_edge', 5],
        ['env_firefox', 6],
        ['env_mobile', 7],
        ['env_safari', 8],
        ['env_mv3', 9],
        ['false', 10],
        ['cap_html_filtering', 11],
        ['cap_user_stylesheet', 12],
        ['adguard', 13],
        ['adguard_app_windows', 14],
        ['adguard_app_mac', 15],
        ['adguard_app_android', 16],
        ['adguard_app_ios', 17],
        ['adguard_ext_safari', 18],
        ['adguard_ext_chromium', 19],
        ['adguard_ext_firefox', 20],
        ['adguard_ext_edge', 21],
        ['adguard_ext_opera', 22],
        ['adguard_ext_android_cb', 23],
    ]);
    const KNOWN_VARIABLES_MAP_REVERSE = new Map(Array.from(KNOWN_VARIABLES_MAP).map(([key, value]) => [value, key]));
    const getFrequentNameOrFail = (binary) => {
        const name = KNOWN_VARIABLES_MAP_REVERSE.get(binary);
        if (isUndefined$1(name)) {
            throw new Error(`Unknown frequent name: ${binary}`);
        }
        return name;
    };
    class LogicalExpressionParser extends ParserBase {
        static tokenize(raw, baseOffset = 0) {
            const tokens = [];
            let offset = 0;
            while (offset < raw.length) {
                const char = raw[offset];
                if (StringUtils.isWhitespace(char)) {
                    offset += 1;
                }
                else if (StringUtils.isLetter(char)) {
                    const nameStart = offset;
                    while (offset + 1 < raw.length
                        && (StringUtils.isAlphaNumeric(raw[offset + 1]) || raw[offset + 1] === UNDERSCORE)) {
                        offset += 1;
                    }
                    tokens.push({
                        type: TokenType.Variable,
                        start: nameStart,
                        end: offset + 1,
                    });
                    offset += 1;
                }
                else if (char === OPEN_PARENTHESIS || char === CLOSE_PARENTHESIS) {
                    tokens.push({
                        type: TokenType.Parenthesis,
                        start: offset,
                        end: offset + 1,
                    });
                    offset += 1;
                }
                else if (char === AMPERSAND || char === PIPE) {
                    if (offset + 1 < raw.length && raw[offset + 1] === char) {
                        tokens.push({
                            type: TokenType.Operator,
                            start: offset,
                            end: offset + 2,
                        });
                        offset += 2;
                    }
                    else {
                        throw new AdblockSyntaxError(`Unexpected character "${char}"`, baseOffset + offset, baseOffset + offset + 1);
                    }
                }
                else if (char === EXCLAMATION_MARK) {
                    tokens.push({
                        type: TokenType.Operator,
                        start: offset,
                        end: offset + 1,
                    });
                    offset += 1;
                }
                else {
                    throw new AdblockSyntaxError(`Unexpected character "${char}"`, baseOffset + offset, baseOffset + offset + 1);
                }
            }
            return tokens;
        }
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            const tokens = LogicalExpressionParser.tokenize(raw, baseOffset);
            let tokenIndex = 0;
            function consume(type) {
                const token = tokens[tokenIndex];
                if (!token) {
                    throw new AdblockSyntaxError(`Expected token of type "${type}", but reached end of input`, baseOffset, baseOffset + raw.length);
                }
                if (token.type !== type) {
                    throw new AdblockSyntaxError(`Expected token of type "${type}", but got "${token.type}"`, baseOffset + token.start, baseOffset + token.end);
                }
                tokenIndex += 1;
                return token;
            }
            function parseVariable() {
                const token = consume(TokenType.Variable);
                const result = {
                    type: NodeType.Variable,
                    name: raw.slice(token.start, token.end),
                };
                if (options.isLocIncluded) {
                    result.start = baseOffset + token.start;
                    result.end = baseOffset + token.end;
                }
                return result;
            }
            function parseBinaryExpression(left, minPrecedence = 0) {
                let node = left;
                let operatorToken;
                while (tokens[tokenIndex]) {
                    operatorToken = tokens[tokenIndex];
                    if (!operatorToken || operatorToken.type !== TokenType.Operator) {
                        break;
                    }
                    const operator = raw.slice(operatorToken.start, operatorToken.end);
                    const precedence = OPERATOR_PRECEDENCE[operator];
                    if (precedence < minPrecedence) {
                        break;
                    }
                    tokenIndex += 1;
                    const right = parseExpression(precedence + 1);
                    const newNode = {
                        type: NodeType.Operator,
                        operator,
                        left: node,
                        right,
                    };
                    if (options.isLocIncluded) {
                        newNode.start = node.start ?? baseOffset + operatorToken.start;
                        newNode.end = right.end ?? baseOffset + operatorToken.end;
                    }
                    node = newNode;
                }
                return node;
            }
            function parseParenthesizedExpression() {
                consume(TokenType.Parenthesis);
                const expression = parseExpression();
                consume(TokenType.Parenthesis);
                const result = {
                    type: NodeType.Parenthesis,
                    expression,
                };
                if (options.isLocIncluded) {
                    result.start = expression.start;
                    result.end = expression.end;
                }
                return result;
            }
            function parseExpression(minPrecedence = 0) {
                let node;
                const token = tokens[tokenIndex];
                const value = raw.slice(token.start, token.end);
                if (token.type === TokenType.Variable) {
                    node = parseVariable();
                }
                else if (token.type === TokenType.Operator && value === OperatorValue.Not) {
                    tokenIndex += 1;
                    const expression = parseExpression(OPERATOR_PRECEDENCE[OperatorValue.Not]);
                    node = {
                        type: NodeType.Operator,
                        operator: OperatorValue.Not,
                        left: expression,
                    };
                    if (options.isLocIncluded) {
                        if (expression.end) {
                            node.start = baseOffset + token.start;
                            node.end = expression.end;
                        }
                        else {
                            node.start = baseOffset + token.start;
                            node.end = baseOffset + token.end;
                        }
                    }
                }
                else if (token.type === TokenType.Parenthesis && value === OPEN_PARENTHESIS) {
                    node = parseParenthesizedExpression();
                }
                else {
                    throw new AdblockSyntaxError(`Unexpected token "${value}"`, baseOffset + token.start, baseOffset + token.end);
                }
                return parseBinaryExpression(node, minPrecedence);
            }
            const expression = parseExpression();
            if (tokenIndex !== tokens.length) {
                throw new AdblockSyntaxError(`Unexpected token "${tokens[tokenIndex].type}"`, baseOffset + tokens[tokenIndex].start, baseOffset + tokens[tokenIndex].end);
            }
            return expression;
        }
        static generate(node) {
            if (node.type === NodeType.Variable) {
                return node.name;
            }
            if (node.type === NodeType.Operator) {
                const left = LogicalExpressionParser.generate(node.left);
                const right = node.right ? LogicalExpressionParser.generate(node.right) : undefined;
                const { operator } = node;
                if (operator === OperatorValue.Not) {
                    return `${operator}${left}`;
                }
                if (!right) {
                    throw new Error('Expected right operand');
                }
                return `${left} ${operator} ${right}`;
            }
            if (node.type === NodeType.Parenthesis) {
                const expressionString = LogicalExpressionParser.generate(node.expression);
                return `(${expressionString})`;
            }
            throw new Error('Unexpected node type');
        }
        static serializeVariableNode(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.ExpressionVariableNode);
            const frequentName = KNOWN_VARIABLES_MAP.get(node.name);
            if (!isUndefined$1(frequentName)) {
                buffer.writeUint8(VariableNodeBinaryPropMap.FrequentName);
                buffer.writeUint8(frequentName);
            }
            else {
                buffer.writeUint8(VariableNodeBinaryPropMap.Name);
                buffer.writeString(node.name);
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(VariableNodeBinaryPropMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(VariableNodeBinaryPropMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static serializeParenthesisNode(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.ExpressionParenthesisNode);
            buffer.writeUint8(ParenthesisNodeBinaryPropMap.Expression);
            LogicalExpressionParser.serialize(node.expression, buffer);
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(ParenthesisNodeBinaryPropMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(ParenthesisNodeBinaryPropMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static serializeOperatorNode(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.ExpressionOperatorNode);
            buffer.writeUint8(OperatorNodeBinaryPropMap.Operator);
            const operatorBinary = OPERATOR_BINARY_MAP.get(node.operator);
            if (isUndefined$1(operatorBinary)) {
                throw new Error(`Unknown operator: ${node.operator}`);
            }
            buffer.writeUint8(operatorBinary);
            buffer.writeUint8(OperatorNodeBinaryPropMap.Left);
            LogicalExpressionParser.serialize(node.left, buffer);
            if (node.right) {
                buffer.writeUint8(OperatorNodeBinaryPropMap.Right);
                LogicalExpressionParser.serialize(node.right, buffer);
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(OperatorNodeBinaryPropMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(OperatorNodeBinaryPropMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static serialize(node, buffer) {
            switch (node.type) {
                case NodeType.Variable:
                    LogicalExpressionParser.serializeVariableNode(node, buffer);
                    break;
                case NodeType.Operator:
                    LogicalExpressionParser.serializeOperatorNode(node, buffer);
                    break;
                case NodeType.Parenthesis:
                    LogicalExpressionParser.serializeParenthesisNode(node, buffer);
                    break;
                default:
                    throw new Error(`Unexpected node type: ${node.type}`);
            }
            buffer.writeUint8(NULL);
        }
        static deserializeVariableNode(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.ExpressionVariableNode);
            node.type = NodeType.Variable;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case VariableNodeBinaryPropMap.Name:
                        node.name = buffer.readString();
                        break;
                    case VariableNodeBinaryPropMap.FrequentName:
                        node.name = getFrequentNameOrFail(buffer.readUint8());
                        break;
                    case VariableNodeBinaryPropMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case VariableNodeBinaryPropMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
        static deserializeParenthesisNode(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.ExpressionParenthesisNode);
            node.type = NodeType.Parenthesis;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case ParenthesisNodeBinaryPropMap.Expression:
                        LogicalExpressionParser.deserialize(buffer, node.expression = {});
                        break;
                    case ParenthesisNodeBinaryPropMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case ParenthesisNodeBinaryPropMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
        static deserializeOperatorNode(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.ExpressionOperatorNode);
            node.type = NodeType.Operator;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case OperatorNodeBinaryPropMap.Operator:
                        node.operator = getOperatorOrFail(buffer.readUint8());
                        break;
                    case OperatorNodeBinaryPropMap.Left:
                        LogicalExpressionParser.deserialize(buffer, node.left = {});
                        break;
                    case OperatorNodeBinaryPropMap.Right:
                        LogicalExpressionParser.deserialize(buffer, node.right = {});
                        break;
                    case OperatorNodeBinaryPropMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case OperatorNodeBinaryPropMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
        static deserialize(buffer, node) {
            let type = buffer.peekUint8();
            while (type !== NULL) {
                switch (type) {
                    case BinaryTypeMap.ExpressionVariableNode:
                        LogicalExpressionParser.deserializeVariableNode(buffer, node);
                        break;
                    case BinaryTypeMap.ExpressionOperatorNode:
                        LogicalExpressionParser.deserializeOperatorNode(buffer, node);
                        break;
                    case BinaryTypeMap.ExpressionParenthesisNode:
                        LogicalExpressionParser.deserializeParenthesisNode(buffer, node);
                        break;
                    default:
                        throw new Error(`Unexpected node type: ${type}`);
                }
                type = buffer.peekUint8();
            }
            buffer.readUint8();
        }
    }
    var PreProcessorRuleSerializationMap;
    (function (PreProcessorRuleSerializationMap) {
        PreProcessorRuleSerializationMap[PreProcessorRuleSerializationMap["Name"] = 1] = "Name";
        PreProcessorRuleSerializationMap[PreProcessorRuleSerializationMap["Params"] = 2] = "Params";
        PreProcessorRuleSerializationMap[PreProcessorRuleSerializationMap["Syntax"] = 3] = "Syntax";
        PreProcessorRuleSerializationMap[PreProcessorRuleSerializationMap["Start"] = 4] = "Start";
        PreProcessorRuleSerializationMap[PreProcessorRuleSerializationMap["End"] = 5] = "End";
    })(PreProcessorRuleSerializationMap || (PreProcessorRuleSerializationMap = {}));
    const FREQUENT_DIRECTIVES_SERIALIZATION_MAP = new Map([
        ['if', 0],
        ['else', 1],
        ['endif', 2],
        ['include', 3],
        ['safari_cb_affinity', 4],
    ]);
    const FREQUENT_DIRECTIVES_DESERIALIZATION_MAP = new Map(Array.from(FREQUENT_DIRECTIVES_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
    const FREQUENT_PARAMS_SERIALIZATION_MAP = new Map([
        ['general', 0],
        ['privacy', 1],
        ['social', 2],
        ['security', 3],
        ['other', 4],
        ['custom', 5],
        ['all', 6],
    ]);
    const FREQUENT_PARAMS_DESERIALIZATION_MAP = new Map(Array.from(FREQUENT_PARAMS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
    class PreProcessorCommentRuleParser extends ParserBase {
        static isPreProcessorRule(raw) {
            const trimmed = raw.trim();
            return trimmed.startsWith(PREPROCESSOR_MARKER) && trimmed[PREPROCESSOR_MARKER_LEN] !== HASHMARK;
        }
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            if (!PreProcessorCommentRuleParser.isPreProcessorRule(raw)) {
                return null;
            }
            let offset = 0;
            offset = StringUtils.skipWS(raw, offset);
            offset += PREPROCESSOR_MARKER_LEN;
            offset = StringUtils.skipWS(raw, offset);
            const nameStart = offset;
            while (offset < raw.length) {
                const ch = raw[offset];
                if (ch === PREPROCESSOR_SEPARATOR || ch === OPEN_PARENTHESIS) {
                    break;
                }
                offset += 1;
            }
            const nameEnd = offset;
            const name = ValueParser.parse(raw.slice(nameStart, nameEnd), options, baseOffset + nameStart);
            offset = StringUtils.skipWS(raw, offset);
            if (name.value === SAFARI_CB_AFFINITY) {
                if (offset > nameEnd) {
                    throw new AdblockSyntaxError(`Unexpected whitespace after "${SAFARI_CB_AFFINITY}" directive name`, baseOffset + nameEnd, baseOffset + offset);
                }
                if (StringUtils.skipWS(raw, offset) !== raw.length) {
                    if (raw[offset] !== OPEN_PARENTHESIS) {
                        throw new AdblockSyntaxError(`Unexpected character '${raw[offset]}' after '${SAFARI_CB_AFFINITY}' directive name`, baseOffset + offset, baseOffset + offset + 1);
                    }
                    offset += 1;
                    const parameterListStart = offset;
                    const closingParenthesesIndex = StringUtils.skipWSBack(raw);
                    if (closingParenthesesIndex === -1 || raw[closingParenthesesIndex] !== CLOSE_PARENTHESIS) {
                        throw new AdblockSyntaxError(`Missing closing parenthesis for '${SAFARI_CB_AFFINITY}' directive`, baseOffset + offset, baseOffset + raw.length);
                    }
                    const parameterListEnd = closingParenthesesIndex;
                    const result = {
                        type: CommentRuleType.PreProcessorCommentRule,
                        category: RuleCategory.Comment,
                        syntax: AdblockSyntax.Adg,
                        name,
                        params: ParameterListParser.parse(raw.slice(parameterListStart, parameterListEnd), options, baseOffset + parameterListStart, COMMA),
                    };
                    if (options.includeRaws) {
                        result.raws = {
                            text: raw,
                        };
                    }
                    if (options.isLocIncluded) {
                        result.start = baseOffset;
                        result.end = baseOffset + raw.length;
                    }
                    return result;
                }
            }
            if (offset === raw.length) {
                if (name.value === IF || name.value === INCLUDE) {
                    throw new AdblockSyntaxError(`Directive "${name.value}" requires parameters`, baseOffset, baseOffset + raw.length);
                }
                const result = {
                    type: CommentRuleType.PreProcessorCommentRule,
                    category: RuleCategory.Comment,
                    syntax: AdblockSyntax.Common,
                    name,
                };
                if (options.includeRaws) {
                    result.raws = {
                        text: raw,
                    };
                }
                if (options.isLocIncluded) {
                    result.start = baseOffset;
                    result.end = baseOffset + raw.length;
                }
                return result;
            }
            const paramsStart = offset;
            const paramsEnd = StringUtils.skipWSBack(raw) + 1;
            let params;
            if (name.value === IF) {
                params = LogicalExpressionParser.parse(raw.slice(paramsStart, paramsEnd), options, baseOffset + paramsStart);
            }
            else {
                params = ValueParser.parse(raw.slice(paramsStart, paramsEnd), options, baseOffset + paramsStart);
            }
            const result = {
                type: CommentRuleType.PreProcessorCommentRule,
                category: RuleCategory.Comment,
                syntax: AdblockSyntax.Common,
                name,
                params,
            };
            if (options.includeRaws) {
                result.raws = {
                    text: raw,
                };
            }
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
        static generate(node) {
            let result = EMPTY;
            result += PREPROCESSOR_MARKER;
            result += node.name.value;
            if (node.params) {
                if (node.name.value !== SAFARI_CB_AFFINITY) {
                    result += SPACE;
                }
                if (node.params.type === 'Value') {
                    result += ValueParser.generate(node.params);
                }
                else if (node.params.type === 'ParameterList') {
                    result += OPEN_PARENTHESIS;
                    result += ParameterListParser.generate(node.params);
                    result += CLOSE_PARENTHESIS;
                }
                else {
                    result += LogicalExpressionParser.generate(node.params);
                }
            }
            return result;
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.PreProcessorCommentRuleNode);
            buffer.writeUint8(PreProcessorRuleSerializationMap.Name);
            ValueParser.serialize(node.name, buffer, FREQUENT_DIRECTIVES_SERIALIZATION_MAP);
            buffer.writeUint8(PreProcessorRuleSerializationMap.Syntax);
            buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
            if (!isUndefined$1(node.params)) {
                buffer.writeUint8(PreProcessorRuleSerializationMap.Params);
                if (node.params.type === 'Value') {
                    ValueParser.serialize(node.params, buffer);
                }
                else if (node.params.type === 'ParameterList') {
                    ParameterListParser.serialize(node.params, buffer, FREQUENT_PARAMS_SERIALIZATION_MAP, true);
                }
                else {
                    LogicalExpressionParser.serialize(node.params, buffer);
                }
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(PreProcessorRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(PreProcessorRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.PreProcessorCommentRuleNode);
            node.type = CommentRuleType.PreProcessorCommentRule;
            node.category = RuleCategory.Comment;
            node.syntax = AdblockSyntax.Common;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case PreProcessorRuleSerializationMap.Name:
                        ValueParser.deserialize(buffer, node.name = {}, FREQUENT_DIRECTIVES_DESERIALIZATION_MAP);
                        break;
                    case PreProcessorRuleSerializationMap.Syntax:
                        node.syntax = SYNTAX_DESERIALIZATION_MAP.get(buffer.readUint8()) ?? AdblockSyntax.Common;
                        break;
                    case PreProcessorRuleSerializationMap.Params:
                        switch (buffer.peekUint8()) {
                            case BinaryTypeMap.ValueNode:
                                ValueParser.deserialize(buffer, node.params = {});
                                break;
                            case BinaryTypeMap.ParameterListNode:
                                ParameterListParser.deserialize(buffer, node.params = {}, FREQUENT_PARAMS_DESERIALIZATION_MAP);
                                break;
                            case BinaryTypeMap.ExpressionOperatorNode:
                            case BinaryTypeMap.ExpressionParenthesisNode:
                            case BinaryTypeMap.ExpressionVariableNode:
                                LogicalExpressionParser.deserialize(buffer, node.params = {});
                                break;
                            default:
                                throw new Error(`Invalid binary type: ${prop}`);
                        }
                        break;
                    case PreProcessorRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case PreProcessorRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var SimpleCommentRuleSerializationMap;
    (function (SimpleCommentRuleSerializationMap) {
        SimpleCommentRuleSerializationMap[SimpleCommentRuleSerializationMap["Marker"] = 1] = "Marker";
        SimpleCommentRuleSerializationMap[SimpleCommentRuleSerializationMap["Text"] = 2] = "Text";
        SimpleCommentRuleSerializationMap[SimpleCommentRuleSerializationMap["Start"] = 3] = "Start";
        SimpleCommentRuleSerializationMap[SimpleCommentRuleSerializationMap["End"] = 4] = "End";
    })(SimpleCommentRuleSerializationMap || (SimpleCommentRuleSerializationMap = {}));
    class SimpleCommentParser extends ParserBase {
        static isSimpleComment(raw) {
            const trimmed = raw.trim();
            if (trimmed.startsWith(CommentMarker.Regular)) {
                return true;
            }
            if (trimmed.startsWith(CommentMarker.Hashmark)) {
                const result = CosmeticRuleSeparatorUtils.find(trimmed);
                if (result === null) {
                    return true;
                }
                const { end } = result;
                if (!trimmed[end + 1]
                    || StringUtils.isWhitespace(trimmed[end + 1])
                    || (trimmed[end + 1] === CommentMarker.Hashmark && trimmed[end + 2] === CommentMarker.Hashmark)) {
                    return true;
                }
            }
            return false;
        }
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            if (!this.isSimpleComment(raw)) {
                return null;
            }
            let offset = 0;
            offset = StringUtils.skipWS(raw, offset);
            const marker = ValueParser.parse(raw[offset], options, baseOffset + offset);
            offset += 1;
            const text = ValueParser.parse(raw.slice(offset), options, baseOffset + offset);
            const result = {
                category: RuleCategory.Comment,
                type: CommentRuleType.CommentRule,
                syntax: AdblockSyntax.Common,
                marker,
                text,
            };
            if (options.includeRaws) {
                result.raws = {
                    text: raw,
                };
            }
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
        static generate(node) {
            let result = EMPTY;
            result += ValueParser.generate(node.marker);
            result += ValueParser.generate(node.text);
            return result;
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.CommentRuleNode);
            buffer.writeUint8(SimpleCommentRuleSerializationMap.Marker);
            ValueParser.serialize(node.marker, buffer);
            buffer.writeUint8(SimpleCommentRuleSerializationMap.Text);
            ValueParser.serialize(node.text, buffer);
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(SimpleCommentRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(SimpleCommentRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.CommentRuleNode);
            node.type = CommentRuleType.CommentRule;
            node.category = RuleCategory.Comment;
            node.syntax = AdblockSyntax.Common;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case SimpleCommentRuleSerializationMap.Marker:
                        ValueParser.deserialize(buffer, node.marker = {});
                        break;
                    case SimpleCommentRuleSerializationMap.Text:
                        ValueParser.deserialize(buffer, node.text = {});
                        break;
                    case SimpleCommentRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case SimpleCommentRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    class CommentRuleParser extends ParserBase {
        static isCommentRule(raw) {
            const trimmed = raw.trim();
            return SimpleCommentParser.isSimpleComment(trimmed) || AgentCommentRuleParser.isAgentRule(trimmed);
        }
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            if (!CommentRuleParser.isCommentRule(raw)) {
                return null;
            }
            return AgentCommentRuleParser.parse(raw, options, baseOffset)
                || HintCommentRuleParser.parse(raw, options, baseOffset)
                || PreProcessorCommentRuleParser.parse(raw, options, baseOffset)
                || MetadataCommentRuleParser.parse(raw, options, baseOffset)
                || ConfigCommentRuleParser.parse(raw, options, baseOffset)
                || SimpleCommentParser.parse(raw, options, baseOffset);
        }
        static generate(node) {
            switch (node.type) {
                case CommentRuleType.AgentCommentRule:
                    return AgentCommentRuleParser.generate(node);
                case CommentRuleType.HintCommentRule:
                    return HintCommentRuleParser.generate(node);
                case CommentRuleType.PreProcessorCommentRule:
                    return PreProcessorCommentRuleParser.generate(node);
                case CommentRuleType.MetadataCommentRule:
                    return MetadataCommentRuleParser.generate(node);
                case CommentRuleType.ConfigCommentRule:
                    return ConfigCommentRuleParser.generate(node);
                case CommentRuleType.CommentRule:
                    return SimpleCommentParser.generate(node);
                default:
                    throw new Error('Unknown comment rule type');
            }
        }
        static serialize(node, buffer) {
            switch (node.type) {
                case CommentRuleType.AgentCommentRule:
                    AgentCommentRuleParser.serialize(node, buffer);
                    return;
                case CommentRuleType.HintCommentRule:
                    HintCommentRuleParser.serialize(node, buffer);
                    return;
                case CommentRuleType.PreProcessorCommentRule:
                    PreProcessorCommentRuleParser.serialize(node, buffer);
                    return;
                case CommentRuleType.MetadataCommentRule:
                    MetadataCommentRuleParser.serialize(node, buffer);
                    return;
                case CommentRuleType.ConfigCommentRule:
                    ConfigCommentRuleParser.serialize(node, buffer);
                    return;
                case CommentRuleType.CommentRule:
                    SimpleCommentParser.serialize(node, buffer);
                    break;
                default:
                    throw new Error('Unknown comment rule type');
            }
        }
        static deserialize(buffer, node) {
            const type = buffer.peekUint8();
            switch (type) {
                case BinaryTypeMap.AgentRuleNode:
                    AgentCommentRuleParser.deserialize(buffer, node);
                    return;
                case BinaryTypeMap.HintRuleNode:
                    HintCommentRuleParser.deserialize(buffer, node);
                    return;
                case BinaryTypeMap.PreProcessorCommentRuleNode:
                    PreProcessorCommentRuleParser.deserialize(buffer, node);
                    return;
                case BinaryTypeMap.MetadataCommentRuleNode:
                    MetadataCommentRuleParser.deserialize(buffer, node);
                    return;
                case BinaryTypeMap.ConfigCommentRuleNode:
                    ConfigCommentRuleParser.deserialize(buffer, node);
                    return;
                case BinaryTypeMap.CommentRuleNode:
                    SimpleCommentParser.deserialize(buffer, node);
                    return;
                default:
                    throw new Error(`Unknown comment rule type: ${type}`);
            }
        }
    }
    var ListItemSerializationMap;
    (function (ListItemSerializationMap) {
        ListItemSerializationMap[ListItemSerializationMap["Exception"] = 1] = "Exception";
        ListItemSerializationMap[ListItemSerializationMap["Value"] = 2] = "Value";
        ListItemSerializationMap[ListItemSerializationMap["Start"] = 3] = "Start";
        ListItemSerializationMap[ListItemSerializationMap["End"] = 4] = "End";
    })(ListItemSerializationMap || (ListItemSerializationMap = {}));
    const LIST_PARSE_ERROR_PREFIX = {
        EMPTY_ITEM: 'Empty value specified in the list',
        NO_MULTIPLE_NEGATION: 'Exception marker cannot be followed by another exception marker',
        NO_SEPARATOR_AFTER_NEGATION: 'Exception marker cannot be followed by a separator',
        NO_SEPARATOR_AT_THE_BEGINNING: 'Value list cannot start with a separator',
        NO_SEPARATOR_AT_THE_END: 'Value list cannot end with a separator',
        NO_WHITESPACE_AFTER_NEGATION: 'Exception marker cannot be followed by whitespace',
    };
    const parseListItems = (raw, options = defaultParserOptions, baseOffset = 0, separator = COMMA, type = ListItemNodeType.Unknown) => {
        const rawListItems = [];
        let offset = 0;
        offset = StringUtils.skipWS(raw, offset);
        if (raw[offset] === separator) {
            throw new AdblockSyntaxError(LIST_PARSE_ERROR_PREFIX.NO_SEPARATOR_AT_THE_BEGINNING, baseOffset + offset, baseOffset + raw.length);
        }
        const realEndIndex = StringUtils.skipWSBack(raw);
        if (raw[realEndIndex] === separator) {
            throw new AdblockSyntaxError(LIST_PARSE_ERROR_PREFIX.NO_SEPARATOR_AT_THE_END, baseOffset + realEndIndex, baseOffset + realEndIndex + 1);
        }
        while (offset < raw.length) {
            offset = StringUtils.skipWS(raw, offset);
            let itemStart = offset;
            const separatorStartIndex = StringUtils.findNextUnescapedCharacter(raw, separator, offset);
            const itemEnd = separatorStartIndex === -1
                ? StringUtils.skipWSBack(raw) + 1
                : StringUtils.skipWSBack(raw, separatorStartIndex - 1) + 1;
            const exception = raw[itemStart] === NEGATION_MARKER;
            if (exception) {
                itemStart += 1;
                const item = raw[itemStart];
                if (item === NEGATION_MARKER) {
                    throw new AdblockSyntaxError(LIST_PARSE_ERROR_PREFIX.NO_MULTIPLE_NEGATION, baseOffset + itemStart, baseOffset + itemStart + 1);
                }
                if (item === separator) {
                    throw new AdblockSyntaxError(LIST_PARSE_ERROR_PREFIX.NO_SEPARATOR_AFTER_NEGATION, baseOffset + itemStart, baseOffset + itemStart + 1);
                }
                if (StringUtils.isWhitespace(item)) {
                    throw new AdblockSyntaxError(LIST_PARSE_ERROR_PREFIX.NO_WHITESPACE_AFTER_NEGATION, baseOffset + itemStart, baseOffset + itemStart + 1);
                }
            }
            if (itemEnd <= itemStart) {
                throw new AdblockSyntaxError(LIST_PARSE_ERROR_PREFIX.EMPTY_ITEM, baseOffset + itemStart, baseOffset + raw.length);
            }
            const listItem = {
                type,
                value: raw.slice(itemStart, itemEnd),
                exception,
            };
            if (options.isLocIncluded) {
                listItem.start = baseOffset + itemStart;
                listItem.end = baseOffset + itemEnd;
            }
            rawListItems.push(listItem);
            offset = separatorStartIndex === -1 ? raw.length : separatorStartIndex + 1;
        }
        return rawListItems;
    };
    const generateListItem = (item) => {
        return `${item.exception ? NEGATION_MARKER : EMPTY}${item.value}`;
    };
    const generateListItems = (items, separator) => {
        return items.map(generateListItem).join(separator);
    };
    const serializeListItem = (item, buffer) => {
        switch (item.type) {
            case ListItemNodeType.App:
                buffer.writeUint8(BinaryTypeMap.AppNode);
                break;
            case ListItemNodeType.Domain:
                buffer.writeUint8(BinaryTypeMap.DomainNode);
                break;
            case ListItemNodeType.Method:
                buffer.writeUint8(BinaryTypeMap.MethodNode);
                break;
            case ListItemNodeType.StealthOption:
                buffer.writeUint8(BinaryTypeMap.StealthOptionNode);
                break;
            default:
                throw new Error(`Invalid list item type: ${item.type}`);
        }
        buffer.writeUint8(ListItemSerializationMap.Exception);
        buffer.writeUint8(item.exception ? 1 : 0);
        buffer.writeUint8(ListItemSerializationMap.Value);
        buffer.writeString(item.value);
        if (!isUndefined$1(item.start)) {
            buffer.writeUint8(ListItemSerializationMap.Start);
            buffer.writeUint32(item.start);
        }
        if (!isUndefined$1(item.end)) {
            buffer.writeUint8(ListItemSerializationMap.End);
            buffer.writeUint32(item.end);
        }
        buffer.writeUint8(NULL);
    };
    const deserializeListItem = (buffer, node) => {
        const type = buffer.readUint8();
        switch (type) {
            case BinaryTypeMap.AppNode:
                node.type = ListItemNodeType.App;
                break;
            case BinaryTypeMap.DomainNode:
                node.type = ListItemNodeType.Domain;
                break;
            case BinaryTypeMap.MethodNode:
                node.type = ListItemNodeType.Method;
                break;
            case BinaryTypeMap.StealthOptionNode:
                node.type = ListItemNodeType.StealthOption;
                break;
            default:
                throw new Error(`Invalid list item type: ${type}`);
        }
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case ListItemSerializationMap.Exception:
                    node.exception = buffer.readUint8() === 1;
                    break;
                case ListItemSerializationMap.Value:
                    node.value = buffer.readString();
                    break;
                case ListItemSerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case ListItemSerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${type}`);
            }
            prop = buffer.readUint8();
        }
    };
    const serializeListItems = (items, buffer) => {
        const { length } = items;
        buffer.writeUint16(length);
        for (let i = 0; i < length; i += 1) {
            serializeListItem(items[i], buffer);
        }
    };
    const deserializeListItems = (buffer, items) => {
        const length = buffer.readUint16();
        items.length = length;
        for (let i = 0; i < length; i += 1) {
            deserializeListItem(buffer, items[i] = {});
        }
    };
    var DomainListSerializationMap;
    (function (DomainListSerializationMap) {
        DomainListSerializationMap[DomainListSerializationMap["Separator"] = 1] = "Separator";
        DomainListSerializationMap[DomainListSerializationMap["Children"] = 2] = "Children";
        DomainListSerializationMap[DomainListSerializationMap["Start"] = 3] = "Start";
        DomainListSerializationMap[DomainListSerializationMap["End"] = 4] = "End";
    })(DomainListSerializationMap || (DomainListSerializationMap = {}));
    const SEPARATOR_SERIALIZATION_MAP$1 = new Map([
        [COMMA, 0],
        [PIPE, 1],
    ]);
    const SEPARATOR_DESERIALIZATION_MAP$1 = new Map(Array.from(SEPARATOR_SERIALIZATION_MAP$1).map(([key, value]) => [value, key]));
    class DomainListParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0, separator = COMMA) {
            if (separator !== COMMA && separator !== PIPE) {
                throw new Error(`Invalid separator: ${separator}`);
            }
            const result = {
                type: ListNodeType.DomainList,
                separator,
                children: parseListItems(raw, options, baseOffset, separator, ListItemNodeType.Domain),
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
        static generate(node) {
            return generateListItems(node.children, node.separator);
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.DomainListNode);
            const separator = SEPARATOR_SERIALIZATION_MAP$1.get(node.separator);
            if (isUndefined$1(separator)) {
                throw new Error(`Invalid separator: ${node.separator}`);
            }
            buffer.writeUint8(DomainListSerializationMap.Separator);
            buffer.writeUint8(separator);
            buffer.writeUint8(DomainListSerializationMap.Children);
            serializeListItems(node.children, buffer);
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(DomainListSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(DomainListSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.DomainListNode);
            node.type = ListNodeType.DomainList;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case DomainListSerializationMap.Separator:
                        node.separator = (SEPARATOR_DESERIALIZATION_MAP$1.get(buffer.readUint8()) ?? COMMA);
                        break;
                    case DomainListSerializationMap.Children:
                        deserializeListItems(buffer, node.children = []);
                        break;
                    case DomainListSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case DomainListSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}.`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var ModifierNodeSerializationMap;
    (function (ModifierNodeSerializationMap) {
        ModifierNodeSerializationMap[ModifierNodeSerializationMap["Name"] = 1] = "Name";
        ModifierNodeSerializationMap[ModifierNodeSerializationMap["Value"] = 2] = "Value";
        ModifierNodeSerializationMap[ModifierNodeSerializationMap["Exception"] = 3] = "Exception";
        ModifierNodeSerializationMap[ModifierNodeSerializationMap["Start"] = 4] = "Start";
        ModifierNodeSerializationMap[ModifierNodeSerializationMap["End"] = 5] = "End";
    })(ModifierNodeSerializationMap || (ModifierNodeSerializationMap = {}));
    const FREQUENT_MODIFIERS_SERIALIZATION_MAP = new Map([
        ['_', 0],
        ['all', 1],
        ['app', 2],
        ['badfilter', 3],
        ['cname', 4],
        ['content', 5],
        ['cookie', 6],
        ['csp', 7],
        ['denyallow', 8],
        ['document', 9],
        ['doc', 10],
        ['domain', 11],
        ['from', 12],
        ['elemhide', 13],
        ['ehide', 14],
        ['empty', 15],
        ['first-party', 16],
        ['1p', 17],
        ['extension', 18],
        ['font', 19],
        ['genericblock', 20],
        ['generichide', 21],
        ['ghide', 22],
        ['header', 23],
        ['hls', 24],
        ['image', 25],
        ['important', 26],
        ['inline-font', 27],
        ['inline-script', 28],
        ['jsinject', 29],
        ['jsonprune', 30],
        ['match-case', 31],
        ['media', 32],
        ['method', 33],
        ['mp4', 34],
        ['network', 35],
        ['object-subrequest', 36],
        ['object', 37],
        ['other', 38],
        ['permissions', 39],
        ['ping', 40],
        ['popunder', 41],
        ['popup', 42],
        ['redirect-rule', 43],
        ['redirect', 44],
        ['rewrite', 45],
        ['referrerpolicy', 46],
        ['removeheader', 47],
        ['removeparam', 48],
        ['replace', 49],
        ['script', 50],
        ['specifichide', 51],
        ['shide', 52],
        ['stealth', 53],
        ['strict1p', 54],
        ['strict3p', 55],
        ['stylesheet', 56],
        ['css', 57],
        ['subdocument', 58],
        ['frame', 59],
        ['third-party', 60],
        ['3p', 61],
        ['to', 62],
        ['urlblock', 63],
        ['webrtc', 64],
        ['websocket', 65],
        ['xmlhttprequest', 66],
        ['xhr', 67],
    ]);
    const FREQUENT_MODIFIERS_DESERIALIZATION_MAP = new Map(Array.from(FREQUENT_MODIFIERS_SERIALIZATION_MAP, ([key, value]) => [value, key]));
    const FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP = new Map([
        ['1x1-transparent.gif', 0],
        ['2x2-transparent.png', 1],
        ['3x2-transparent.png', 2],
        ['32x32-transparent.png', 3],
        ['amazon-apstag', 4],
        ['ati-smarttag', 5],
        ['didomi-loader', 6],
        ['click2load.html', 7],
        ['fingerprintjs2', 8],
        ['fingerprintjs3', 9],
        ['google-analytics', 10],
        ['google-analytics-ga', 11],
        ['googlesyndication-adsbygoogle', 12],
        ['googlesyndication-adsbygoogle', 13],
        ['googletagmanager-gtm', 14],
        ['googletagmanager-gtm', 15],
        ['googletagservices-gpt', 16],
        ['google-ima3', 17],
        ['gemius', 18],
        ['matomo', 19],
        ['metrika-yandex-watch', 20],
        ['metrika-yandex-tag', 21],
        ['naver-wcslog', 22],
        ['noeval', 23],
        ['noopcss', 24],
        ['noopframe', 25],
        ['noopjs', 26],
        ['noopjson', 27],
        ['nooptext', 28],
        ['noopmp3-0.1s', 29],
        ['noopmp4-1s', 30],
        ['noopvmap-1.0', 31],
        ['noopvast-2.0', 32],
        ['noopvast-3.0', 33],
        ['noopvast-4.0', 34],
        ['prebid', 35],
        ['pardot-1.0', 36],
        ['prevent-bab', 37],
        ['prevent-bab2', 38],
        ['prevent-fab-3.2.0', 39],
        ['prevent-fab-3.2.0', 40],
        ['prevent-popads-net', 41],
        ['scorecardresearch-beacon', 42],
        ['set-popads-dummy', 43],
        ['empty', 44],
        ['prebid-ads', 45],
        ['1x1.gif', 60],
        ['2x2.png', 61],
        ['3x2.png', 62],
        ['32x32.png', 63],
        ['amazon_apstag.js', 64],
        ['click2load.html', 65],
        ['fingerprint2.js', 66],
        ['fingerprint3.js', 67],
        ['google-analytics_analytics.js', 68],
        ['google-analytics_ga.js', 69],
        ['googlesyndication_adsbygoogle.js', 70],
        ['googlesyndication.com/adsbygoogle.js', 71],
        ['google-analytics_ga.js', 72],
        ['googletagmanager_gtm.js', 73],
        ['googletagservices_gpt.js', 74],
        ['google-ima.js', 75],
        ['noeval-silent.js', 76],
        ['noop.css', 77],
        ['noop.html', 78],
        ['noop.js', 79],
        ['noop.json', 80],
        ['noop.txt', 81],
        ['noop-0.1s.mp3', 82],
        ['noop-1s.mp4', 83],
        ['noop-vmap1.0.xml', 84],
        ['nobab.js', 85],
        ['nobab2.js', 86],
        ['nofab.js', 87],
        ['fuckadblock.js-3.2.0', 88],
        ['popads.js', 89],
        ['scorecardresearch_beacon.js', 90],
        ['popads-dummy.js', 91],
        ['empty', 92],
        ['prebid-ads.js', 93],
        ['1x1-transparent-gif', 105],
        ['2x2-transparent-png', 106],
        ['3x2-transparent-png', 107],
        ['32x32-transparent-png', 108],
        ['blank-css', 109],
        ['blank-html', 110],
        ['blank-js', 111],
        ['blank-text', 112],
        ['blank-mp3', 113],
        ['blank-mp4', 114],
        ['abp-resource:1x1-transparent-gif', 120],
        ['abp-resource:2x2-transparent-png', 121],
        ['abp-resource:3x2-transparent-png', 122],
        ['abp-resource:32x32-transparent-png', 123],
        ['abp-resource:blank-css', 124],
        ['abp-resource:blank-html', 125],
        ['abp-resource:blank-js', 126],
        ['abp-resource:blank-text', 127],
        ['abp-resource:blank-mp3', 128],
        ['abp-resource:blank-mp4', 129],
    ]);
    const FREQUENT_VALUES_SERIALIZATION_MAPS = new Map([
        ['redirect', FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP],
        ['redirect-rule', FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP],
        ['rewrite', FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP],
    ]);
    const FREQUENT_VALUES_DESERIALIZATION_MAPS = new Map(Array.from(FREQUENT_VALUES_SERIALIZATION_MAPS, ([modifier, valueMap]) => [modifier, new Map(Array.from(valueMap, ([key, value]) => [value, key]))]));
    class ModifierParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            let offset = 0;
            offset = StringUtils.skipWS(raw, offset);
            const modifierStart = offset;
            let exception = false;
            if (raw[offset] === NEGATION_MARKER) {
                offset += NEGATION_MARKER.length;
                exception = true;
            }
            offset = StringUtils.skipWS(raw, offset);
            const modifierNameStart = offset;
            const assignmentIndex = StringUtils.findNextUnescapedCharacter(raw, MODIFIER_ASSIGN_OPERATOR);
            const modifierEnd = Math.max(StringUtils.skipWSBack(raw) + 1, modifierNameStart);
            if (modifierNameStart === modifierEnd) {
                throw new AdblockSyntaxError('Modifier name cannot be empty', baseOffset, baseOffset + raw.length);
            }
            let modifier;
            let value;
            if (assignmentIndex === -1) {
                modifier = ValueParser.parse(raw.slice(modifierNameStart, modifierEnd), options, baseOffset + modifierNameStart);
            }
            else {
                const modifierNameEnd = StringUtils.skipWSBack(raw, assignmentIndex - 1) + 1;
                modifier = ValueParser.parse(raw.slice(modifierNameStart, modifierNameEnd), options, baseOffset + modifierNameStart);
                if (assignmentIndex + 1 === modifierEnd) {
                    throw new AdblockSyntaxError('Modifier value cannot be empty', baseOffset, baseOffset + raw.length);
                }
                const valueStart = StringUtils.skipWS(raw, assignmentIndex + MODIFIER_ASSIGN_OPERATOR.length);
                value = ValueParser.parse(raw.slice(valueStart, modifierEnd), options, baseOffset + valueStart);
            }
            const result = {
                type: 'Modifier',
                name: modifier,
                value,
                exception,
            };
            if (options.isLocIncluded) {
                result.start = baseOffset + modifierStart;
                result.end = baseOffset + modifierEnd;
            }
            return result;
        }
        static generate(modifier) {
            let result = EMPTY;
            if (modifier.exception) {
                result += NEGATION_MARKER;
            }
            result += modifier.name.value;
            if (modifier.value !== undefined) {
                result += MODIFIER_ASSIGN_OPERATOR;
                result += modifier.value.value;
            }
            return result;
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.ModifierNode);
            buffer.writeUint8(ModifierNodeSerializationMap.Name);
            ValueParser.serialize(node.name, buffer, FREQUENT_MODIFIERS_SERIALIZATION_MAP);
            if (!isUndefined$1(node.value)) {
                buffer.writeUint8(ModifierNodeSerializationMap.Value);
                ValueParser.serialize(node.value, buffer, FREQUENT_VALUES_SERIALIZATION_MAPS.get(node.name.value));
            }
            buffer.writeUint8(ModifierNodeSerializationMap.Exception);
            buffer.writeUint8(node.exception ? 1 : 0);
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(ModifierNodeSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(ModifierNodeSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.ModifierNode);
            node.type = 'Modifier';
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case ModifierNodeSerializationMap.Name:
                        ValueParser.deserialize(buffer, node.name = {}, FREQUENT_MODIFIERS_DESERIALIZATION_MAP);
                        break;
                    case ModifierNodeSerializationMap.Value:
                        if (node.name) {
                            ValueParser.deserialize(buffer, node.value = {}, FREQUENT_VALUES_DESERIALIZATION_MAPS.get(node.name.value));
                        }
                        else {
                            ValueParser.deserialize(buffer, node.value = {});
                        }
                        break;
                    case ModifierNodeSerializationMap.Exception:
                        node.exception = buffer.readUint8() === 1;
                        break;
                    case ModifierNodeSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case ModifierNodeSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}.`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var ModifierListNodeSerializationMap;
    (function (ModifierListNodeSerializationMap) {
        ModifierListNodeSerializationMap[ModifierListNodeSerializationMap["Children"] = 1] = "Children";
        ModifierListNodeSerializationMap[ModifierListNodeSerializationMap["Start"] = 2] = "Start";
        ModifierListNodeSerializationMap[ModifierListNodeSerializationMap["End"] = 3] = "End";
    })(ModifierListNodeSerializationMap || (ModifierListNodeSerializationMap = {}));
    class ModifierListParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            const result = {
                type: 'ModifierList',
                children: [],
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            let offset = StringUtils.skipWS(raw);
            let separatorIndex = -1;
            while (offset < raw.length) {
                offset = StringUtils.skipWS(raw, offset);
                const modifierStart = offset;
                separatorIndex = StringUtils.findNextUnescapedCharacter(raw, MODIFIERS_SEPARATOR, offset);
                const modifierEnd = separatorIndex === -1
                    ? raw.length
                    : StringUtils.skipWSBack(raw, separatorIndex - 1) + 1;
                const modifier = ModifierParser.parse(raw.slice(modifierStart, modifierEnd), options, baseOffset + modifierStart);
                result.children.push(modifier);
                offset = separatorIndex === -1 ? raw.length : separatorIndex + 1;
            }
            if (separatorIndex !== -1) {
                const modifierStart = StringUtils.skipWS(raw, separatorIndex + 1);
                result.children.push(ModifierParser.parse(raw.slice(modifierStart, raw.length), options, baseOffset + modifierStart));
            }
            return result;
        }
        static generate(ast) {
            const result = ast.children
                .map(ModifierParser.generate)
                .join(MODIFIERS_SEPARATOR);
            return result;
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.ModifierListNode);
            const count = node.children.length;
            if (count) {
                buffer.writeUint8(ModifierListNodeSerializationMap.Children);
                if (count > UINT16_MAX) {
                    throw new Error(`Too many modifiers: ${count}, the limit is ${UINT16_MAX}`);
                }
                buffer.writeUint16(count);
                for (let i = 0; i < count; i += 1) {
                    ModifierParser.serialize(node.children[i], buffer);
                }
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(ModifierListNodeSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(ModifierListNodeSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.ModifierListNode);
            node.type = 'ModifierList';
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case ModifierListNodeSerializationMap.Children:
                        node.children = new Array(buffer.readUint16());
                        for (let i = 0; i < node.children.length; i += 1) {
                            ModifierParser.deserialize(buffer, node.children[i] = {});
                        }
                        break;
                    case ModifierListNodeSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case ModifierListNodeSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}.`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    const END_OF_INPUT = 'end of input';
    const ERROR_MESSAGES$6 = {
        EXPECTED_ANY_TOKEN_BUT_GOT: "Expected a token, but got '%s'",
        EXPECTED_TOKEN_BUT_GOT: "Expected '%s', but got '%s'",
        EXPECTED_TOKEN_WITH_BALANCE_BUT_GOT: "Expected '%s' with balance '%d', but got '%d'",
        EXPECTED_TOKEN_WITH_VALUE_BUT_GOT: "Expected '%s' with value '%s', but got '%s'",
    };
    const standardTokenPairs = new Map([
        [TokenType$1.Function, TokenType$1.CloseParenthesis],
        [TokenType$1.OpenParenthesis, TokenType$1.CloseParenthesis],
        [TokenType$1.OpenSquareBracket, TokenType$1.CloseSquareBracket],
        [TokenType$1.OpenCurlyBracket, TokenType$1.CloseCurlyBracket],
    ]);
    const functionTokenPairs = new Map([
        [TokenType$1.Function, TokenType$1.CloseParenthesis],
        [TokenType$1.OpenParenthesis, TokenType$1.CloseParenthesis],
    ]);
    const tokenizeWithBalancedPairs = (raw, onToken, onError = () => { }, functionHandlers, tokenPairs = standardTokenPairs) => {
        const stack = [];
        const values = new Set(tokenPairs.values());
        tokenizeExtended(raw, (type, start, end, props) => {
            if (tokenPairs.has(type)) {
                stack.push(tokenPairs.get(type));
            }
            else if (values.has(type)) {
                if (stack[stack.length - 1] === type) {
                    stack.pop();
                }
                else {
                    throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_TOKEN_BUT_GOT, getFormattedTokenName(stack[stack.length - 1]), getFormattedTokenName(type)), start, raw.length);
                }
            }
            onToken(type, start, end, props, stack.length);
        }, onError, functionHandlers);
        if (stack.length > 0) {
            throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_TOKEN_BUT_GOT, getFormattedTokenName(stack[stack.length - 1]), END_OF_INPUT), raw.length - 1, raw.length);
        }
    };
    const tokenizeBalanced = (raw, onToken, onError = () => { }, functionHandlers) => {
        tokenizeWithBalancedPairs(raw, onToken, onError, functionHandlers);
    };
    const tokenizeFnBalanced = (raw, onToken, onError = () => { }, functionHandlers) => {
        tokenizeWithBalancedPairs(raw, onToken, onError, functionHandlers, functionTokenPairs);
    };
    const ERROR_MESSAGES$5 = {
        DUPLICATED_UBO_MODIFIER: "uBO modifier '%s' cannot be used more than once",
        EXPECTED_BUT_GOT_BEFORE: "Expected '%s' but got '%s' before '%s'",
        NEGATED_UBO_MODIFIER_CANNOT_BE_FOLLOWED_BY: "Negated uBO modifier '%s' cannot be followed by anything else than a closing parenthesis or a whitespace",
        NEGATED_UBO_MODIFIER_CANNOT_BE_PRECEDED_BY: "Negated uBO modifier '%s' cannot be preceded by '%s'",
        PSEUDO_CANNOT_BE_NESTED: "uBO modifier '%s' cannot be nested inside '%s', only '%s' is allowed as a wrapper",
        UBO_MODIFIER_CANNOT_BE_NESTED: "uBO modifier '%s' cannot be nested",
        UBO_STYLE_CANNOT_BE_FOLLOWED: 'uBO style injection cannot be followed by anything else than a whitespace',
    };
    const DUMMY_PARAM = '...';
    var UboPseudoName;
    (function (UboPseudoName) {
        UboPseudoName["MatchesMedia"] = "matches-media";
        UboPseudoName["MatchesPath"] = "matches-path";
        UboPseudoName["Remove"] = "remove";
        UboPseudoName["Style"] = "style";
    })(UboPseudoName || (UboPseudoName = {}));
    const KNOWN_UBO_MODIFIERS = new Set([
        UboPseudoName.MatchesMedia,
        UboPseudoName.MatchesPath,
        UboPseudoName.Remove,
        UboPseudoName.Style,
    ]);
    const hasAnyUboModifier = (raw) => {
        let colonIndex = raw.indexOf(COLON);
        while (colonIndex !== -1) {
            const openingParenthesisIndex = raw.indexOf(OPEN_PARENTHESIS, colonIndex + 1);
            if (openingParenthesisIndex === -1) {
                return false;
            }
            if (KNOWN_UBO_MODIFIERS.has(raw.slice(colonIndex + 1, openingParenthesisIndex))) {
                return true;
            }
            colonIndex = raw.indexOf(COLON, openingParenthesisIndex + 1);
        }
        return false;
    };
    const formatPseudoName = (name, wrapper) => {
        const result = [];
        if (wrapper) {
            result.push(COLON, wrapper, OPEN_PARENTHESIS);
        }
        result.push(COLON, name, OPEN_PARENTHESIS, DUMMY_PARAM, CLOSE_PARENTHESIS);
        if (wrapper) {
            result.push(CLOSE_PARENTHESIS);
        }
        return result.join(EMPTY);
    };
    class UboSelectorParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            const modifiers = {
                type: 'ModifierList',
                children: [],
            };
            if (options.isLocIncluded) {
                modifiers.start = baseOffset;
                modifiers.end = baseOffset + raw.length;
            }
            if (!hasAnyUboModifier(raw)) {
                const selector = {
                    type: 'Value',
                    value: raw,
                };
                if (options.isLocIncluded) {
                    selector.start = baseOffset;
                    selector.end = baseOffset + raw.length;
                }
                const result = {
                    type: 'UboSelector',
                    selector,
                    modifiers,
                };
                if (options.isLocIncluded) {
                    result.start = baseOffset;
                    result.end = baseOffset + raw.length;
                }
                return result;
            }
            const processedModifiers = new Set();
            const tokens = [];
            const uboIndexes = new Array(raw.length);
            const uboModifierStack = [];
            let i = 0;
            const stackModifier = (modifier) => {
                if (processedModifiers.has(modifier.name)) {
                    throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.DUPLICATED_UBO_MODIFIER, formatPseudoName(modifier.name)), baseOffset + modifier.modifierStart, baseOffset + raw.length);
                }
                uboModifierStack.push(modifier);
            };
            tokenizeFnBalanced(raw, (type, start, end, _, balance) => {
                if ((processedModifiers.has(UboPseudoName.Style)
                    || processedModifiers.has(UboPseudoName.Remove))
                    && type !== TokenType$1.Whitespace) {
                    throw new AdblockSyntaxError(ERROR_MESSAGES$5.UBO_STYLE_CANNOT_BE_FOLLOWED, baseOffset + start, baseOffset + raw.length);
                }
                if (tokens[i - 1]?.type === TokenType$1.Colon && type === TokenType$1.Function) {
                    const fn = raw.slice(start, end - 1);
                    if (KNOWN_UBO_MODIFIERS.has(fn)) {
                        if (balance > 1) {
                            if (fn === UboPseudoName.MatchesPath) {
                                if (uboModifierStack.length > 0) {
                                    throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.PSEUDO_CANNOT_BE_NESTED, formatPseudoName(UboPseudoName.MatchesPath), formatPseudoName(uboModifierStack[uboModifierStack.length - 1].name), formatPseudoName(CSS_NOT_PSEUDO)), baseOffset + start - 1, baseOffset + raw.length);
                                }
                                let isException = false;
                                let modifierBalance = balance;
                                let modifierStart = start;
                                for (let j = i - 1; j >= 0; j -= 1) {
                                    if (tokens[j].balance === 0) {
                                        modifierStart = tokens[j].start;
                                        modifierBalance = tokens[j].balance;
                                        break;
                                    }
                                    else if (tokens[j].type === TokenType$1.Colon
                                        || tokens[j].type === TokenType$1.Whitespace) {
                                        continue;
                                    }
                                    else if (tokens[j].type === TokenType$1.Function) {
                                        const wrapperFnName = raw.slice(tokens[j].start, tokens[j].end - 1);
                                        if (wrapperFnName !== CSS_NOT_PSEUDO) {
                                            throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.PSEUDO_CANNOT_BE_NESTED, formatPseudoName(UboPseudoName.MatchesPath), formatPseudoName(wrapperFnName), formatPseudoName(CSS_NOT_PSEUDO)), baseOffset + tokens[j].start - 1, baseOffset + raw.length);
                                        }
                                        if (tokens[j - 1]?.type !== TokenType$1.Colon) {
                                            const got = tokens[j - 1]?.type
                                                ? getFormattedTokenName(tokens[j - 1]?.type)
                                                : 'nothing';
                                            throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.EXPECTED_BUT_GOT_BEFORE, getFormattedTokenName(TokenType$1.Colon), got, formatPseudoName(UboPseudoName.MatchesPath, CSS_NOT_PSEUDO)),
                                            baseOffset + tokens[j - 1]?.start || 0, baseOffset + raw.length);
                                        }
                                        isException = !isException;
                                        continue;
                                    }
                                    else {
                                        throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.NEGATED_UBO_MODIFIER_CANNOT_BE_PRECEDED_BY, formatPseudoName(UboPseudoName.MatchesPath), getFormattedTokenName(tokens[j].type)), baseOffset + tokens[j].start, baseOffset + raw.length);
                                    }
                                }
                                stackModifier({
                                    name: fn,
                                    modifierStart,
                                    modifierBalance,
                                    nameStart: start,
                                    nameEnd: end - 1,
                                    valueStart: end,
                                    valueBalance: balance,
                                    isException,
                                });
                            }
                            else {
                                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.UBO_MODIFIER_CANNOT_BE_NESTED, formatPseudoName(fn)), baseOffset + start - 1, baseOffset + raw.length);
                            }
                        }
                        else {
                            stackModifier({
                                name: fn,
                                modifierStart: start - 1,
                                modifierBalance: balance,
                                nameStart: start,
                                nameEnd: end - 1,
                                valueStart: end,
                                valueBalance: balance,
                                isException: false,
                            });
                        }
                    }
                }
                else {
                    const lastStackedModifier = uboModifierStack[uboModifierStack.length - 1];
                    if (lastStackedModifier?.name === UboPseudoName.MatchesPath && lastStackedModifier?.isException) {
                        if (!(type === TokenType$1.CloseParenthesis || type === TokenType$1.Whitespace)
                            && balance < lastStackedModifier.valueBalance) {
                            throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$5.NEGATED_UBO_MODIFIER_CANNOT_BE_FOLLOWED_BY, formatPseudoName(UboPseudoName.MatchesPath), getFormattedTokenName(type)), baseOffset + start, baseOffset + raw.length);
                        }
                    }
                    if (type === TokenType$1.CloseParenthesis && lastStackedModifier) {
                        if (balance === Math.max(0, lastStackedModifier.valueBalance - 1)) {
                            lastStackedModifier.valueEnd = start;
                        }
                        if (balance === Math.max(0, lastStackedModifier.modifierBalance - 1)) {
                            const modifierName = {
                                type: 'Value',
                                value: lastStackedModifier.name,
                            };
                            if (options.isLocIncluded) {
                                modifierName.start = baseOffset + lastStackedModifier.nameStart;
                                modifierName.end = baseOffset + lastStackedModifier.nameEnd;
                            }
                            const value = {
                                type: 'Value',
                                value: raw.slice(lastStackedModifier.valueStart, lastStackedModifier.valueEnd),
                            };
                            if (options.isLocIncluded) {
                                value.start = baseOffset + lastStackedModifier.valueStart;
                                value.end = baseOffset + lastStackedModifier.valueEnd;
                            }
                            const modifier = {
                                type: 'Modifier',
                                name: modifierName,
                                value,
                                exception: lastStackedModifier.isException,
                            };
                            if (options.isLocIncluded) {
                                modifier.start = baseOffset + lastStackedModifier.modifierStart;
                                modifier.end = baseOffset + end;
                            }
                            modifiers.children.push(modifier);
                            processedModifiers.add(lastStackedModifier.name);
                            uboModifierStack.pop();
                            uboIndexes.fill(true, lastStackedModifier.modifierStart, end);
                        }
                    }
                }
                tokens.push({
                    type,
                    start,
                    end,
                    balance,
                });
                i += 1;
            });
            const selector = {
                type: 'Value',
                value: raw
                    .split(EMPTY)
                    .map((char, p) => (uboIndexes[p] ? EMPTY : char))
                    .join(EMPTY)
                    .trim(),
            };
            if (options.isLocIncluded) {
                selector.start = baseOffset;
                selector.end = baseOffset + raw.length;
            }
            const result = {
                type: 'UboSelector',
                selector,
                modifiers,
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
        static generate(node) {
            const prefix = [];
            const suffix = [];
            if (node.modifiers) {
                for (const modifier of node.modifiers.children) {
                    switch (modifier.name.value) {
                        case UboPseudoName.Remove:
                        case UboPseudoName.Style:
                            suffix.push(COLON, modifier.name.value, OPEN_PARENTHESIS, modifier.value?.value || EMPTY, CLOSE_PARENTHESIS);
                            break;
                        default:
                            if (modifier.exception) {
                                prefix.push(COLON, CSS_NOT_PSEUDO, OPEN_PARENTHESIS);
                            }
                            prefix.push(COLON, modifier.name.value, OPEN_PARENTHESIS, modifier.value?.value || EMPTY, CLOSE_PARENTHESIS);
                            if (modifier.exception) {
                                prefix.push(CLOSE_PARENTHESIS);
                            }
                            break;
                    }
                }
            }
            let result = EMPTY;
            if (prefix.length > 0) {
                result += prefix.join(EMPTY);
                if (node.selector?.value) {
                    result += SPACE;
                }
            }
            result += node.selector?.value || EMPTY;
            result += suffix.join(EMPTY);
            return result;
        }
    }
    const LEGACY_EXT_CSS_ATTRIBUTE_PREFIX = '-ext-';
    const ABP_EXT_CSS_PREFIX = '-abp';
    const EXT_CSS_PSEUDO_CLASSES_STRICT = new Set([
        'contains',
        'if-not',
        'matches-attr',
        'matches-css',
        'matches-property',
        'nth-ancestor',
        'remove',
        'upward',
        'xpath',
        'has-text',
        'matches-css-after',
        'matches-css-before',
        'matches-path',
        'min-text-length',
        'watch-attr',
        '-abp-contains',
        '-abp-has',
        '-abp-properties',
    ]);
    const EXT_CSS_PSEUDO_CLASSES = new Set([
        ...EXT_CSS_PSEUDO_CLASSES_STRICT,
        'has',
        'is',
    ]);
    class CssTokenStream {
        tokens = [];
        source = EMPTY;
        index = 0;
        baseOffset;
        constructor(source, baseOffset = 0) {
            this.source = source;
            tokenizeBalanced(source, (type, start, end, _, balance) => {
                this.tokens.push({
                    type,
                    start,
                    end,
                    balance,
                });
            });
            this.index = 0;
            this.baseOffset = baseOffset;
        }
        get length() {
            return this.tokens.length;
        }
        isEof() {
            return this.index >= this.tokens.length;
        }
        get(index = this.index) {
            return this.tokens[index];
        }
        getOrFail(index = this.index) {
            const token = this.get(index);
            if (!token) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_ANY_TOKEN_BUT_GOT, END_OF_INPUT), this.baseOffset + this.source.length - 1, this.baseOffset + this.source.length);
            }
            return token;
        }
        fragment(index = this.index) {
            const token = this.get(index);
            if (token) {
                return this.source.slice(token.start, token.end);
            }
            return EMPTY;
        }
        advance() {
            if (this.isEof()) {
                return undefined;
            }
            this.index += 1;
            return this.tokens[this.index];
        }
        lookahead(index = 1) {
            return this.tokens[this.index + Math.max(1, index)];
        }
        lookbehind(index = 1) {
            if (this.index === 0) {
                return undefined;
            }
            return this.tokens[this.index - Math.max(1, index)];
        }
        lookbehindForNonWs() {
            for (let i = this.index - 1; i >= 0; i -= 1) {
                if (this.tokens[i].type !== TokenType$1.Whitespace) {
                    return this.tokens[i];
                }
            }
            return undefined;
        }
        skipWhitespace() {
            while (this.get()?.type === TokenType$1.Whitespace) {
                this.index += 1;
            }
        }
        skipUntilBalanced() {
            if (this.isEof()) {
                return 0;
            }
            const currentBalance = this.get().balance;
            if (currentBalance === 0) {
                return 0;
            }
            let skipped = 0;
            while (!this.isEof() && this.get()?.balance !== currentBalance - 1) {
                this.index += 1;
                skipped += 1;
            }
            return skipped;
        }
        skipUntil(type, balance) {
            let skipped = 0;
            while (!this.isEof()
                && (this.get()?.type !== type || (balance !== undefined && this.get()?.balance !== balance))) {
                this.index += 1;
                skipped += 1;
            }
            return skipped;
        }
        skipUntilExt(type, balance) {
            let i = this.index;
            let firstNonWsToken = -1;
            let lastNonWsToken = -1;
            while (i < this.tokens.length) {
                const currentToken = this.tokens[i];
                if (currentToken.type === TokenType$1.Whitespace) {
                    i += 1;
                    continue;
                }
                else if (currentToken.type === type && currentToken.balance === balance) {
                    break;
                }
                if (firstNonWsToken === -1) {
                    firstNonWsToken = i;
                }
                lastNonWsToken = i;
                i += 1;
            }
            const skipped = i - this.index;
            this.index = i;
            return {
                skipped,
                skippedTrimmed: firstNonWsToken === -1 ? 0 : lastNonWsToken - firstNonWsToken + 1,
            };
        }
        expectNotEof() {
            if (this.isEof()) {
                throw new AdblockSyntaxError('Unexpected end of input', this.baseOffset + this.source.length - 1, this.baseOffset + this.source.length);
            }
        }
        expect(type, data) {
            const token = this.get();
            if (!token) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_TOKEN_BUT_GOT, getFormattedTokenName(type), END_OF_INPUT), this.baseOffset + this.source.length - 1, this.baseOffset + this.source.length);
            }
            if (token.type !== type) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_TOKEN_BUT_GOT, getFormattedTokenName(type), getFormattedTokenName(token.type)), this.baseOffset + token.start, this.baseOffset + token.end);
            }
            if (data?.balance !== undefined && token.balance !== data.balance) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_TOKEN_WITH_BALANCE_BUT_GOT, getFormattedTokenName(type), data.balance, token.balance), this.baseOffset + token.start, this.baseOffset + token.end);
            }
            if (data?.value && this.fragment() !== data.value) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$6.EXPECTED_TOKEN_WITH_VALUE_BUT_GOT, getFormattedTokenName(type), data.value, this.fragment()), this.baseOffset + token.start, this.baseOffset + token.end);
            }
        }
        getBalance(index = this.index) {
            return this.tokens[index]?.balance || 0;
        }
        hasAnySelectorExtendedCssNode() {
            return this.hasAnySelectorExtendedCssNodeInternal(EXT_CSS_PSEUDO_CLASSES);
        }
        hasAnySelectorExtendedCssNodeStrict() {
            return this.hasAnySelectorExtendedCssNodeInternal(EXT_CSS_PSEUDO_CLASSES_STRICT);
        }
        hasAnySelectorExtendedCssNodeInternal(pseudos) {
            for (let i = 0; i < this.tokens.length; i += 1) {
                const token = this.tokens[i];
                if (token.type === TokenType$1.Function) {
                    const name = this.source.slice(token.start, token.end - 1);
                    if (pseudos.has(name)) {
                        return true;
                    }
                }
                else if (token.type === TokenType$1.OpenSquareBracket) {
                    let j = i + 1;
                    while (j < this.tokens.length && this.tokens[j].type === TokenType$1.Whitespace) {
                        j += 1;
                    }
                    if (j < this.tokens.length && this.tokens[j].type === TokenType$1.Ident) {
                        const attr = this.source.slice(this.tokens[j].start, this.tokens[j].end);
                        if (attr.startsWith(LEGACY_EXT_CSS_ATTRIBUTE_PREFIX) || attr.startsWith(ABP_EXT_CSS_PREFIX)) {
                            return true;
                        }
                    }
                    i = j;
                }
            }
            return false;
        }
    }
    const REMOVE_PROPERTY = 'remove';
    const REMOVE_VALUE = 'true';
    const removeDeclaration = `${REMOVE_PROPERTY}${COLON}${SPACE}${REMOVE_VALUE}${SEMICOLON}`;
    const ERROR_MESSAGES$4 = {
        MEDIA_QUERY_LIST_IS_EMPTY: 'Media query list is empty',
        SELECTOR_LIST_IS_EMPTY: 'Selector list is empty',
        DECLARATION_LIST_IS_EMPTY: 'Declaration list is empty',
    };
    class AdgCssInjectionParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            let mediaQueryList;
            const selectorList = { type: 'Value', value: EMPTY };
            const declarationList = { type: 'Value', value: EMPTY };
            const stream = new CssTokenStream(raw, baseOffset);
            stream.skipWhitespace();
            let balanceShift = 0;
            if (stream.getOrFail().type === TokenType$1.AtKeyword) {
                stream.expect(TokenType$1.AtKeyword, { value: CSS_MEDIA_MARKER, balance: 0 });
                stream.advance();
                stream.skipWhitespace();
                const mediaQueryListStart = stream.getOrFail().start;
                let lastNonWsIndex = -1;
                while (!stream.isEof()) {
                    const token = stream.getOrFail();
                    if (token.type === TokenType$1.OpenCurlyBracket && token.balance === 1) {
                        break;
                    }
                    if (token.type !== TokenType$1.Whitespace) {
                        lastNonWsIndex = token.end;
                    }
                    stream.advance();
                }
                if (lastNonWsIndex === -1) {
                    throw new AdblockSyntaxError(ERROR_MESSAGES$4.MEDIA_QUERY_LIST_IS_EMPTY, baseOffset + mediaQueryListStart, baseOffset + raw.length);
                }
                const mediaQueryListEnd = lastNonWsIndex;
                mediaQueryList = {
                    type: 'Value',
                    value: raw.slice(mediaQueryListStart, mediaQueryListEnd),
                };
                if (options.isLocIncluded) {
                    mediaQueryList.start = baseOffset + mediaQueryListStart;
                    mediaQueryList.end = baseOffset + mediaQueryListEnd;
                }
                stream.expect(TokenType$1.OpenCurlyBracket);
                stream.advance();
                balanceShift = 1;
            }
            stream.skipWhitespace();
            const selectorStart = stream.getOrFail().start;
            const { skippedTrimmed: selectorTokensLength } = stream.skipUntilExt(TokenType$1.OpenCurlyBracket, balanceShift + 1);
            stream.expect(TokenType$1.OpenCurlyBracket);
            if (selectorTokensLength === 0) {
                throw new AdblockSyntaxError(ERROR_MESSAGES$4.SELECTOR_LIST_IS_EMPTY, baseOffset + selectorStart, baseOffset + raw.length);
            }
            const selectorEnd = stream.lookbehindForNonWs().end;
            selectorList.value = raw.slice(selectorStart, selectorEnd);
            if (options.isLocIncluded) {
                selectorList.start = baseOffset + selectorStart;
                selectorList.end = baseOffset + selectorEnd;
            }
            stream.advance();
            stream.skipWhitespace();
            const declarationsStart = stream.getOrFail().start;
            const declarations = new Set();
            let declarationsEnd = -1;
            let remove = false;
            let lastNonWsIndex = -1;
            while (!stream.isEof()) {
                const token = stream.getOrFail();
                if (token.type === TokenType$1.CloseCurlyBracket && stream.getBalance() === balanceShift) {
                    declarationsEnd = lastNonWsIndex;
                    break;
                }
                if (token.type !== TokenType$1.Whitespace) {
                    lastNonWsIndex = token.end;
                }
                if (token.type === TokenType$1.Ident && stream.lookahead()?.type === TokenType$1.Colon) {
                    const ident = raw.slice(token.start, token.end);
                    declarations.add(ident);
                    stream.advance();
                    stream.advance();
                    if (ident === REMOVE_PROPERTY) {
                        stream.skipWhitespace();
                        stream.expect(TokenType$1.Ident, { value: REMOVE_VALUE });
                        stream.advance();
                        remove = true;
                    }
                }
                else {
                    stream.advance();
                }
            }
            if (declarationsEnd === -1) {
                throw new AdblockSyntaxError(ERROR_MESSAGES$4.DECLARATION_LIST_IS_EMPTY, baseOffset + declarationsStart, baseOffset + raw.length);
            }
            declarationList.value = raw.slice(declarationsStart, declarationsEnd);
            if (options.isLocIncluded) {
                declarationList.start = baseOffset + declarationsStart;
                declarationList.end = baseOffset + declarationsEnd;
            }
            stream.expect(TokenType$1.CloseCurlyBracket);
            stream.advance();
            stream.skipWhitespace();
            if (balanceShift === 1) {
                stream.expect(TokenType$1.CloseCurlyBracket);
                stream.advance();
            }
            const result = {
                type: 'CssInjectionRuleBody',
                selectorList,
                declarationList,
                remove,
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            if (mediaQueryList) {
                result.mediaQueryList = mediaQueryList;
            }
            return result;
        }
        static generate(node) {
            const result = [];
            if (node.mediaQueryList) {
                result.push(CSS_MEDIA_MARKER, SPACE, node.mediaQueryList.value, SPACE, OPEN_CURLY_BRACKET, SPACE);
            }
            result.push(node.selectorList.value, SPACE, OPEN_CURLY_BRACKET, SPACE);
            if (node.remove) {
                result.push(removeDeclaration);
            }
            else if (node.declarationList?.value) {
                result.push(node.declarationList.value);
            }
            result.push(SPACE, CLOSE_CURLY_BRACKET);
            if (node.mediaQueryList) {
                result.push(SPACE, CLOSE_CURLY_BRACKET);
            }
            return result.join(EMPTY);
        }
    }
    var AbpSnippetBodySerializationMap;
    (function (AbpSnippetBodySerializationMap) {
        AbpSnippetBodySerializationMap[AbpSnippetBodySerializationMap["Children"] = 1] = "Children";
        AbpSnippetBodySerializationMap[AbpSnippetBodySerializationMap["Start"] = 2] = "Start";
        AbpSnippetBodySerializationMap[AbpSnippetBodySerializationMap["End"] = 3] = "End";
    })(AbpSnippetBodySerializationMap || (AbpSnippetBodySerializationMap = {}));
    const serializeScriptletBody = (node, buffer, frequentScriptletArgs) => {
        buffer.writeUint8(BinaryTypeMap.ScriptletInjectionRuleBodyNode);
        const { length } = node.children;
        buffer.writeUint8(AbpSnippetBodySerializationMap.Children);
        if (length > UINT8_MAX) {
            throw new Error(`Too many scriptlet children: ${length}, the limit is ${UINT8_MAX}`);
        }
        buffer.writeUint8(length);
        for (let i = 0; i < length; i += 1) {
            ParameterListParser.serialize(node.children[i], buffer, frequentScriptletArgs);
        }
        if (!isUndefined$1(node.start)) {
            buffer.writeUint8(AbpSnippetBodySerializationMap.Start);
            buffer.writeUint32(node.start);
        }
        if (!isUndefined$1(node.end)) {
            buffer.writeUint8(AbpSnippetBodySerializationMap.End);
            buffer.writeUint32(node.end);
        }
        buffer.writeUint8(NULL);
    };
    const deserializeScriptletBody = (buffer, node, frequentScriptletArgs) => {
        buffer.assertUint8(BinaryTypeMap.ScriptletInjectionRuleBodyNode);
        node.type = 'ScriptletInjectionRuleBody';
        let prop = buffer.readUint8();
        while (prop !== NULL) {
            switch (prop) {
                case AbpSnippetBodySerializationMap.Children:
                    node.children = new Array(buffer.readUint8());
                    for (let i = 0; i < node.children.length; i += 1) {
                        ParameterListParser.deserialize(buffer, node.children[i] = {}, frequentScriptletArgs);
                    }
                    break;
                case AbpSnippetBodySerializationMap.Start:
                    node.start = buffer.readUint32();
                    break;
                case AbpSnippetBodySerializationMap.End:
                    node.end = buffer.readUint32();
                    break;
                default:
                    throw new Error(`Invalid property: ${prop}`);
            }
            prop = buffer.readUint8();
        }
    };
    class AbpSnippetInjectionBodyParser extends ParserBase {
        static ERROR_MESSAGES = {
            EMPTY_SCRIPTLET_CALL: 'Empty ABP snippet call',
        };
        static FREQUENT_ARGS_SERIALIZATION_MAP = new Map([
            ['abort-current-inline-script', 0],
            ['abort-on-property-read', 1],
            ['abort-on-property-write', 2],
            ['json-prune', 3],
            ['log', 4],
            ['prevent-listener', 5],
            ['cookie-remover', 6],
            ['override-property-read', 7],
            ['abort-on-iframe-property-read', 8],
            ['abort-on-iframe-property-write', 9],
            ['freeze-element', 10],
            ['json-override', 11],
            ['simulate-mouse-event', 12],
            ['strip-fetch-query-parameter', 13],
            ['hide-if-contains', 14],
            ['hide-if-contains-image', 15],
            ['hide-if-contains-image-hash', 16],
            ['hide-if-contains-similar-text', 17],
            ['hide-if-contains-visible-text', 18],
            ['hide-if-contains-and-matches-style', 19],
            ['hide-if-graph-matches', 20],
            ['hide-if-has-and-matches-style', 21],
            ['hide-if-labelled-by', 22],
            ['hide-if-matches-xpath', 23],
            ['hide-if-matches-computed-xpath', 24],
            ['hide-if-shadow-contains', 25],
            ['debug', 26],
            ['trace', 27],
            ['race', 28],
        ]);
        static FREQUENT_ARGS_DESERIALIZATION_MAP = new Map(Array.from(this.FREQUENT_ARGS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            const result = {
                type: 'ScriptletInjectionRuleBody',
                children: [],
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            let offset = 0;
            offset = StringUtils.skipWS(raw, offset);
            while (offset < raw.length) {
                offset = StringUtils.skipWS(raw, offset);
                const scriptletCallStart = offset;
                let semicolonIndex = StringUtils.findUnescapedNonStringNonRegexChar(raw, SEMICOLON, offset);
                if (semicolonIndex === -1) {
                    semicolonIndex = raw.length;
                }
                const scriptletCallEnd = Math.max(StringUtils.skipWSBack(raw, semicolonIndex - 1) + 1, scriptletCallStart);
                const params = ParameterListParser.parse(raw.slice(scriptletCallStart, scriptletCallEnd), options, baseOffset + scriptletCallStart, SPACE);
                result.children.push(params);
                offset = semicolonIndex + 1;
            }
            if (result.children.length === 0) {
                throw new AdblockSyntaxError(this.ERROR_MESSAGES.EMPTY_SCRIPTLET_CALL, baseOffset, baseOffset + raw.length);
            }
            return result;
        }
        static generate(node) {
            const result = [];
            if (node.children.length === 0) {
                throw new Error(this.ERROR_MESSAGES.EMPTY_SCRIPTLET_CALL);
            }
            for (const scriptletCall of node.children) {
                if (scriptletCall.children.length === 0) {
                    throw new Error(this.ERROR_MESSAGES.EMPTY_SCRIPTLET_CALL);
                }
                result.push(ParameterListParser.generate(scriptletCall, SPACE));
            }
            return result.join(SEMICOLON + SPACE);
        }
        static serialize(node, buffer) {
            serializeScriptletBody(node, buffer, this.FREQUENT_ARGS_SERIALIZATION_MAP);
        }
        static deserialize(buffer, node) {
            deserializeScriptletBody(buffer, node, this.FREQUENT_ARGS_DESERIALIZATION_MAP);
        }
    }
    const QUOTE_SET = new Set([
        SINGLE_QUOTE,
        DOUBLE_QUOTE,
        BACKTICK_QUOTE,
    ]);
    var QuoteType;
    (function (QuoteType) {
        QuoteType["None"] = "none";
        QuoteType["Single"] = "single";
        QuoteType["Double"] = "double";
        QuoteType["Backtick"] = "backtick";
    })(QuoteType || (QuoteType = {}));
    class QuoteUtils {
        static escapeUnescapedOccurrences(string, char) {
            let result = EMPTY;
            for (let i = 0; i < string.length; i += 1) {
                if (string[i] === char && (i === 0 || string[i - 1] !== ESCAPE_CHARACTER)) {
                    result += ESCAPE_CHARACTER;
                }
                result += string[i];
            }
            return result;
        }
        static unescapeSingleEscapedOccurrences(string, char) {
            let result = EMPTY;
            for (let i = 0; i < string.length; i += 1) {
                if (string[i] === char
                    && string[i - 1] === ESCAPE_CHARACTER
                    && (i === 1 || string[i - 2] !== ESCAPE_CHARACTER)) {
                    result = result.slice(0, -1);
                }
                result += string[i];
            }
            return result;
        }
        static getStringQuoteType(string) {
            if (string.length > 1) {
                if (string.startsWith(SINGLE_QUOTE) && string.endsWith(SINGLE_QUOTE)) {
                    return QuoteType.Single;
                }
                if (string.startsWith(DOUBLE_QUOTE) && string.endsWith(DOUBLE_QUOTE)) {
                    return QuoteType.Double;
                }
                if (string.startsWith(BACKTICK_QUOTE) && string.endsWith(BACKTICK_QUOTE)) {
                    return QuoteType.Backtick;
                }
            }
            return QuoteType.None;
        }
        static setStringQuoteType(string, quoteType) {
            const actualQuoteType = QuoteUtils.getStringQuoteType(string);
            switch (quoteType) {
                case QuoteType.None:
                    if (actualQuoteType === QuoteType.Single) {
                        return QuoteUtils.escapeUnescapedOccurrences(string.slice(1, -1), SINGLE_QUOTE);
                    }
                    if (actualQuoteType === QuoteType.Double) {
                        return QuoteUtils.escapeUnescapedOccurrences(string.slice(1, -1), DOUBLE_QUOTE);
                    }
                    if (actualQuoteType === QuoteType.Backtick) {
                        return QuoteUtils.escapeUnescapedOccurrences(string.slice(1, -1), BACKTICK_QUOTE);
                    }
                    return string;
                case QuoteType.Single:
                    if (actualQuoteType === QuoteType.None) {
                        return SINGLE_QUOTE + QuoteUtils.escapeUnescapedOccurrences(string, SINGLE_QUOTE) + SINGLE_QUOTE;
                    }
                    if (actualQuoteType === QuoteType.Double) {
                        return SINGLE_QUOTE
                            + QuoteUtils.escapeUnescapedOccurrences(QuoteUtils.unescapeSingleEscapedOccurrences(string.slice(1, -1), DOUBLE_QUOTE), SINGLE_QUOTE) + SINGLE_QUOTE;
                    }
                    if (actualQuoteType === QuoteType.Backtick) {
                        return SINGLE_QUOTE
                            + QuoteUtils.escapeUnescapedOccurrences(QuoteUtils.unescapeSingleEscapedOccurrences(string.slice(1, -1), BACKTICK_QUOTE), SINGLE_QUOTE) + SINGLE_QUOTE;
                    }
                    return string;
                case QuoteType.Double:
                    if (actualQuoteType === QuoteType.None) {
                        return DOUBLE_QUOTE + QuoteUtils.escapeUnescapedOccurrences(string, DOUBLE_QUOTE) + DOUBLE_QUOTE;
                    }
                    if (actualQuoteType !== QuoteType.Double) {
                        return DOUBLE_QUOTE
                            + QuoteUtils.escapeUnescapedOccurrences(QuoteUtils.unescapeSingleEscapedOccurrences(string.slice(1, -1), SINGLE_QUOTE), DOUBLE_QUOTE) + DOUBLE_QUOTE;
                    }
                    return string;
                case QuoteType.Backtick:
                    if (actualQuoteType === QuoteType.None) {
                        return BACKTICK_QUOTE + QuoteUtils.escapeUnescapedOccurrences(string, BACKTICK_QUOTE) + BACKTICK_QUOTE;
                    }
                    if (actualQuoteType !== QuoteType.Backtick) {
                        return BACKTICK_QUOTE
                            + QuoteUtils.escapeUnescapedOccurrences(QuoteUtils.unescapeSingleEscapedOccurrences(string.slice(1, -1), SINGLE_QUOTE), BACKTICK_QUOTE) + BACKTICK_QUOTE;
                    }
                    return string;
                default:
                    return string;
            }
        }
        static removeQuotes(string) {
            if (
            string.length > 1
                && (string[0] === SINGLE_QUOTE || string[0] === DOUBLE_QUOTE || string[0] === BACKTICK_QUOTE)
                && string[0] === string[string.length - 1]) {
                return string.slice(1, -1);
            }
            return string;
        }
        static removeQuotesAndUnescape(string) {
            if (
            string.length > 1
                && (string[0] === SINGLE_QUOTE || string[0] === DOUBLE_QUOTE || string[0] === BACKTICK_QUOTE)
                && string[0] === string[string.length - 1]) {
                return QuoteUtils.unescapeSingleEscapedOccurrences(string.slice(1, -1), string[0]);
            }
            return string;
        }
        static quoteAndJoinStrings(strings, quoteType = QuoteType.Single, separator = `${COMMA}${SPACE}`) {
            return strings
                .map((s) => QuoteUtils.setStringQuoteType(s, quoteType))
                .join(separator);
        }
    }
    class UboParameterListParser extends ParameterListParser {
        static parse(raw, options = defaultParserOptions, baseOffset = 0, separator = COMMA, requireQuotes = false, supportedQuotes = QUOTE_SET) {
            const params = {
                type: 'ParameterList',
                children: [],
            };
            const { length } = raw;
            if (options.isLocIncluded) {
                params.start = baseOffset;
                params.end = baseOffset + length;
            }
            let offset = 0;
            let extraNull = false;
            while (offset < length) {
                offset = StringUtils.skipWS(raw, offset);
                const paramStart = offset;
                let paramEnd = offset;
                if (supportedQuotes.has(raw[offset])) {
                    const possibleClosingQuoteIndex = StringUtils.findNextUnescapedCharacter(raw, raw[offset], offset + 1);
                    if (possibleClosingQuoteIndex !== -1) {
                        const nextSeparatorIndex = StringUtils.skipWS(raw, possibleClosingQuoteIndex + 1);
                        if (nextSeparatorIndex === length) {
                            if (requireQuotes) {
                                throw new AdblockSyntaxError('Expected separator, got end of string', baseOffset + nextSeparatorIndex, baseOffset + length);
                            }
                            paramEnd = StringUtils.skipWSBack(raw, length - 1) + 1;
                            offset = length;
                        }
                        else if (raw[nextSeparatorIndex] === separator) {
                            paramEnd = possibleClosingQuoteIndex + 1;
                            offset = nextSeparatorIndex + 1;
                        }
                        else {
                            if (requireQuotes) {
                                throw new AdblockSyntaxError(`Expected separator, got: '${raw[nextSeparatorIndex]}'`, baseOffset + nextSeparatorIndex, baseOffset + length);
                            }
                            offset = StringUtils.findNextUnescapedCharacterBackwards(raw, separator, possibleClosingQuoteIndex) + 1;
                            paramEnd = StringUtils.skipWSBack(raw, offset - 2) + 1;
                        }
                    }
                    else {
                        if (requireQuotes) {
                            throw new AdblockSyntaxError('Expected closing quote, got end of string', baseOffset + offset, baseOffset + length);
                        }
                        paramEnd = StringUtils.skipWSBack(raw, length - 1) + 1;
                        offset = length;
                    }
                }
                else {
                    if (requireQuotes) {
                        throw new AdblockSyntaxError(`Expected quote, got: '${raw[offset]}'`, baseOffset + offset, baseOffset + length);
                    }
                    const nextSeparator = StringUtils.findNextUnescapedCharacter(raw, separator, offset);
                    if (nextSeparator === -1) {
                        paramEnd = StringUtils.skipWSBack(raw, length - 1) + 1;
                        offset = length;
                    }
                    else {
                        paramEnd = StringUtils.skipWSBack(raw, nextSeparator - 1) + 1;
                        offset = nextSeparator + 1;
                        if (StringUtils.skipWS(raw, length - 1) === nextSeparator) {
                            extraNull = true;
                        }
                    }
                }
                if (paramStart < paramEnd) {
                    params.children.push(ValueParser.parse(raw.slice(paramStart, paramEnd), options, baseOffset + paramStart));
                }
                else {
                    params.children.push(null);
                }
            }
            if (extraNull) {
                params.children.push(null);
            }
            return params;
        }
    }
    class UboScriptletInjectionBodyParser extends ParserBase {
        static ERROR_MESSAGES = {
            NO_SCRIPTLET_MASK: `Invalid uBO scriptlet call, no scriptlet call mask '${UBO_SCRIPTLET_MASK}' found`,
            NO_OPENING_PARENTHESIS: `Invalid uBO scriptlet call, no opening parentheses '${OPEN_PARENTHESIS}' found`,
            NO_CLOSING_PARENTHESIS: `Invalid uBO scriptlet call, no closing parentheses '${CLOSE_PARENTHESIS}' found`,
            NO_SCRIPTLET_NAME: 'Invalid uBO scriptlet call, no scriptlet name specified',
            WHITESPACE_AFTER_MASK: 'Invalid uBO scriptlet call, whitespace is not allowed after the scriptlet call mask',
            NO_MULTIPLE_SCRIPTLET_CALLS: 'uBO syntaxes does not support multiple scriptlet calls within one single rule',
        };
        static FREQUENT_ARGS_SERIALIZATION_MAP = new Map([
            ['abort-current-script.js', 0],
            ['acs.js', 1],
            ['abort-current-inline-script.js', 2],
            ['acis.js', 3],
            ['abort-on-property-read.js', 4],
            ['aopr.js', 5],
            ['abort-on-property-write.js', 6],
            ['aopw.js', 7],
            ['abort-on-stack-trace.js', 8],
            ['aost.js', 9],
            ['adjust-setInterval.js', 10],
            ['nano-setInterval-booster.js', 11],
            ['nano-sib.js', 12],
            ['adjust-setTimeout.js', 13],
            ['nano-setTimeout-booster.js', 14],
            ['nano-stb.js', 15],
            ['close-window.js', 16],
            ['window-close-if.js', 17],
            ['disable-newtab-links.js', 18],
            ['evaldata-prune.js', 19],
            ['json-prune.js', 20],
            ['addEventListener-logger.js', 21],
            ['aell.js', 22],
            ['m3u-prune.js', 23],
            ['nowebrtc.js', 24],
            ['addEventListener-defuser.js', 25],
            ['aeld.js', 26],
            ['prevent-addEventListener.js', 27],
            ['adfly-defuser.js', 28],
            ['noeval-if.js', 29],
            ['prevent-eval-if.js', 30],
            ['no-fetch-if.js', 31],
            ['prevent-fetch.js', 32],
            ['no-xhr-if.js', 33],
            ['prevent-xhr.js', 34],
            ['prevent-refresh.js', 35],
            ['refresh-defuser.js', 36],
            ['no-requestAnimationFrame-if.js', 37],
            ['norafif.js', 38],
            ['prevent-requestAnimationFrame.js', 39],
            ['no-setInterval-if.js', 40],
            ['nosiif.js', 41],
            ['prevent-setInterval.js', 42],
            ['setInterval-defuser.js', 43],
            ['no-setTimeout-if.js', 44],
            ['nostif.js', 45],
            ['prevent-setTimeout.js', 46],
            ['setTimeout-defuser.js', 47],
            ['no-window-open-if.js', 48],
            ['nowoif.js', 49],
            ['prevent-window-open.js', 50],
            ['window.open-defuser.js', 51],
            ['remove-attr.js', 52],
            ['ra.js', 53],
            ['remove-class.js', 54],
            ['rc.js', 55],
            ['remove-cookie.js', 56],
            ['cookie-remover.js', 57],
            ['remove-node-text.js', 58],
            ['rmnt.js', 59],
            ['set-attr.js', 60],
            ['set-constant.js', 61],
            ['set.js', 62],
            ['set-cookie.js', 63],
            ['set-local-storage-item.js', 64],
            ['set-session-storage-item.js', 65],
            ['xml-prune.js', 66],
            ['webrtc-if.js', 67],
            ['overlay-buster.js', 68],
            ['alert-buster.js', 69],
            ['golem.de.js', 70],
            ['href-sanitizer.js', 71],
            ['call-nothrow.js', 72],
            ['window.name-defuser.js', 73],
            ['spoof-css.js', 74],
            ['trusted-set-constant.js', 75],
            ['trusted-set.js', 76],
            ['trusted-set-cookie.js', 77],
            ['trusted-set-local-storage-item.js', 78],
            ['trusted-replace-fetch-response.js', 79],
            ['json-prune-fetch-response.js', 80],
            ['json-prune-xhr-response.js', 81],
            ['trusted-replace-xhr-response.js', 82],
            ['multiup.js', 83],
            ['prevent-canvas.js', 84],
            ['set-cookie-reload.js', 85],
            ['trusted-set-cookie-reload.js', 86],
            ['trusted-click-element.js', 87],
            ['trusted-prune-inbound-object.js', 88],
            ['trusted-prune-outbound-object.js', 89],
            ['trusted-set-session-storage-item.js', 90],
            ['trusted-replace-node-text.js', 91],
            ['trusted-rpnt.js', 92],
            ['replace-node-text.js', 93],
            ['rpnt.js', 94],
        ]);
        static FREQUENT_ARGS_DESERIALIZATION_MAP = new Map(Array.from(this.FREQUENT_ARGS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            let offset = 0;
            offset = StringUtils.skipWS(raw, offset);
            let scriptletMaskLength = 0;
            if (raw.startsWith(UBO_SCRIPTLET_MASK, offset)) {
                scriptletMaskLength = UBO_SCRIPTLET_MASK.length;
            }
            else if (raw.startsWith(UBO_SCRIPTLET_MASK_LEGACY, offset)) {
                scriptletMaskLength = UBO_SCRIPTLET_MASK_LEGACY.length;
            }
            if (!scriptletMaskLength) {
                throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_SCRIPTLET_MASK, baseOffset + offset, baseOffset + raw.length);
            }
            offset += scriptletMaskLength;
            if (raw[offset] === SPACE) {
                throw new AdblockSyntaxError(this.ERROR_MESSAGES.WHITESPACE_AFTER_MASK, baseOffset + offset, baseOffset + raw.length);
            }
            if (raw[offset] !== OPEN_PARENTHESIS) {
                throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_OPENING_PARENTHESIS, baseOffset + offset, baseOffset + raw.length);
            }
            const openingParenthesesIndex = offset;
            const closingParenthesesIndex = StringUtils.skipWSBack(raw, raw.length - 1);
            if (raw[closingParenthesesIndex] !== CLOSE_PARENTHESIS
                || raw[closingParenthesesIndex - 1] === ESCAPE_CHARACTER) {
                throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_CLOSING_PARENTHESIS, baseOffset + offset, baseOffset + raw.length);
            }
            const result = {
                type: 'ScriptletInjectionRuleBody',
                children: [],
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            if (StringUtils.skipWS(raw, openingParenthesesIndex + 1) === closingParenthesesIndex) {
                return result;
            }
            const params = UboParameterListParser.parse(raw.slice(openingParenthesesIndex + 1, closingParenthesesIndex), options, baseOffset + openingParenthesesIndex + 1, COMMA);
            if (params.children.length > 0 && params.children[0] === null) {
                throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_SCRIPTLET_NAME, baseOffset + offset, baseOffset + raw.length);
            }
            result.children.push(params);
            return result;
        }
        static generate(node) {
            const result = [];
            if (node.children.length > 1) {
                throw new Error(this.ERROR_MESSAGES.NO_MULTIPLE_SCRIPTLET_CALLS);
            }
            result.push(UBO_SCRIPTLET_MASK);
            result.push(OPEN_PARENTHESIS);
            if (node.children.length > 0) {
                const [parameterListNode] = node.children;
                result.push(ParameterListParser.generate(parameterListNode));
            }
            result.push(CLOSE_PARENTHESIS);
            return result.join(EMPTY);
        }
        static serialize(node, buffer) {
            serializeScriptletBody(node, buffer, this.FREQUENT_ARGS_SERIALIZATION_MAP);
        }
        static deserialize(buffer, node) {
            deserializeScriptletBody(buffer, node, this.FREQUENT_ARGS_DESERIALIZATION_MAP);
        }
    }
    class AdgScriptletInjectionBodyParser extends ParserBase {
        static ERROR_MESSAGES = {
            NO_SCRIPTLET_MASK: `Invalid ADG scriptlet call, no scriptlet call mask '${ADG_SCRIPTLET_MASK}' found`,
            NO_OPENING_PARENTHESIS: `Invalid ADG scriptlet call, no opening parentheses '${OPEN_PARENTHESIS}' found`,
            NO_CLOSING_PARENTHESIS: `Invalid ADG scriptlet call, no closing parentheses '${CLOSE_PARENTHESIS}' found`,
            WHITESPACE_AFTER_MASK: 'Invalid ADG scriptlet call, whitespace is not allowed after the scriptlet call mask',
            NO_MULTIPLE_SCRIPTLET_CALLS: 'ADG syntaxes does not support multiple scriptlet calls within one single rule',
            NO_INCONSISTENT_QUOTES: 'Invalid ADG scriptlet call, inconsistent quotes',
            NO_UNCLOSED_PARAMETER: 'Invalid ADG scriptlet call, unclosed parameter',
            EXPECTED_QUOTE: "Invalid ADG scriptlet call, expected quote, got '%s'",
            EXPECTED_COMMA: "Invalid ADG scriptlet call, expected comma, got '%s'",
        };
        static FREQUENT_ARGS_SERIALIZATION_MAP = new Map([
            ['abort-current-inline-script', 0],
            ['abort-on-property-read', 1],
            ['abort-on-property-write', 2],
            ['abort-on-stack-trace', 3],
            ['adjust-setInterval', 4],
            ['adjust-setTimeout', 5],
            ['close-window', 6],
            ['debug-current-inline-script', 7],
            ['debug-on-property-read', 8],
            ['debug-on-property-write', 9],
            ['dir-string', 10],
            ['disable-newtab-links', 11],
            ['evaldata-prune', 12],
            ['json-prune', 13],
            ['log', 14],
            ['log-addEventListener', 15],
            ['log-eval', 16],
            ['log-on-stack-trace', 17],
            ['m3u-prune', 18],
            ['noeval', 19],
            ['nowebrtc', 20],
            ['no-topics', 21],
            ['prevent-addEventListener', 22],
            ['prevent-adfly', 23],
            ['prevent-bab', 24],
            ['prevent-eval-if', 25],
            ['prevent-fab-3.2.0', 26],
            ['prevent-fetch', 27],
            ['prevent-xhr', 28],
            ['prevent-popads-net', 29],
            ['prevent-refresh', 30],
            ['prevent-requestAnimationFrame', 31],
            ['prevent-setInterval', 32],
            ['prevent-setTimeout', 33],
            ['prevent-window-open', 34],
            ['remove-attr', 35],
            ['remove-class', 36],
            ['remove-cookie', 37],
            ['remove-node-text', 38],
            ['set-attr', 39],
            ['set-constant', 40],
            ['set-cookie', 41],
            ['set-cookie-reload', 42],
            ['set-local-storage-item', 43],
            ['set-popads-dummy', 44],
            ['set-session-storage-item', 45],
            ['xml-prune', 46],
        ]);
        static FREQUENT_ARGS_DESERIALIZATION_MAP = new Map(Array.from(this.FREQUENT_ARGS_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            let offset = 0;
            offset = StringUtils.skipWS(raw, offset);
            if (!raw.startsWith(ADG_SCRIPTLET_MASK, offset)) {
                throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_SCRIPTLET_MASK, baseOffset + offset, baseOffset + raw.length);
            }
            offset += ADG_SCRIPTLET_MASK.length;
            if (raw[offset] === SPACE) {
                throw new AdblockSyntaxError(this.ERROR_MESSAGES.WHITESPACE_AFTER_MASK, baseOffset + offset, baseOffset + raw.length);
            }
            if (raw[offset] !== OPEN_PARENTHESIS) {
                throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_OPENING_PARENTHESIS, baseOffset + offset, baseOffset + raw.length);
            }
            const openingParenthesesIndex = offset;
            const closingParenthesesIndex = StringUtils.skipWSBack(raw, raw.length - 1);
            if (raw[closingParenthesesIndex] !== CLOSE_PARENTHESIS
                || raw[closingParenthesesIndex - 1] === ESCAPE_CHARACTER) {
                throw new AdblockSyntaxError(this.ERROR_MESSAGES.NO_CLOSING_PARENTHESIS, baseOffset + offset, baseOffset + raw.length);
            }
            offset = StringUtils.skipWS(raw, offset + 1);
            const result = {
                type: 'ScriptletInjectionRuleBody',
                children: [],
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            if (StringUtils.skipWS(raw, openingParenthesesIndex + 1) === closingParenthesesIndex) {
                return result;
            }
            let detectedQuote = null;
            const parameterList = {
                type: 'ParameterList',
                children: [],
            };
            if (options.isLocIncluded) {
                parameterList.start = baseOffset + openingParenthesesIndex + 1;
                parameterList.end = baseOffset + closingParenthesesIndex;
            }
            while (offset < closingParenthesesIndex) {
                offset = StringUtils.skipWS(raw, offset);
                if (parameterList.children.length > 0) {
                    if (raw[offset] !== COMMA) {
                        throw new AdblockSyntaxError(sprintf.sprintf(AdgScriptletInjectionBodyParser.ERROR_MESSAGES.EXPECTED_COMMA, raw[offset]), baseOffset + offset, baseOffset + raw.length);
                    }
                    offset += 1;
                    offset = StringUtils.skipWS(raw, offset);
                }
                if (raw[offset] === SINGLE_QUOTE || raw[offset] === DOUBLE_QUOTE) {
                    if (isNull$1(detectedQuote)) {
                        detectedQuote = raw[offset];
                    }
                    else if (detectedQuote !== raw[offset]) {
                        throw new AdblockSyntaxError(AdgScriptletInjectionBodyParser.ERROR_MESSAGES.NO_INCONSISTENT_QUOTES, baseOffset + offset, baseOffset + raw.length);
                    }
                    const closingQuoteIndex = StringUtils.findNextUnescapedCharacter(raw, detectedQuote, offset + 1);
                    if (closingQuoteIndex === -1) {
                        throw new AdblockSyntaxError(AdgScriptletInjectionBodyParser.ERROR_MESSAGES.NO_UNCLOSED_PARAMETER, baseOffset + offset, baseOffset + raw.length);
                    }
                    const parameter = ValueParser.parse(raw.slice(offset, closingQuoteIndex + 1), options, baseOffset + offset);
                    parameterList.children.push(parameter);
                    offset = StringUtils.skipWS(raw, closingQuoteIndex + 1);
                }
                else {
                    throw new AdblockSyntaxError(sprintf.sprintf(AdgScriptletInjectionBodyParser.ERROR_MESSAGES.EXPECTED_QUOTE, raw[offset]), baseOffset + offset, baseOffset + raw.length);
                }
            }
            result.children.push(parameterList);
            return result;
        }
        static generate(node) {
            const result = [];
            if (node.children.length > 1) {
                throw new Error(this.ERROR_MESSAGES.NO_MULTIPLE_SCRIPTLET_CALLS);
            }
            result.push(ADG_SCRIPTLET_MASK);
            result.push(OPEN_PARENTHESIS);
            if (node.children.length > 0) {
                result.push(ParameterListParser.generate(node.children[0]));
            }
            result.push(CLOSE_PARENTHESIS);
            return result.join(EMPTY);
        }
        static serialize(node, buffer) {
            serializeScriptletBody(node, buffer, this.FREQUENT_ARGS_SERIALIZATION_MAP);
        }
        static deserialize(buffer, node) {
            deserializeScriptletBody(buffer, node, this.FREQUENT_ARGS_DESERIALIZATION_MAP);
        }
    }
    const SEPARATOR_SERIALIZATION_MAP = new Map([
        ['##', 0],
        ['#@#', 1],
        ['#?#', 2],
        ['#@?#', 3],
        ['#$#', 4],
        ['#$?#', 5],
        ['#@$#', 6],
        ['#@$?#', 7],
        ['#%#', 8],
        ['#@%#', 9],
        ['$$', 10],
        ['$@$', 11],
    ]);
    const SEPARATOR_DESERIALIZATION_MAP = new Map(Array.from(SEPARATOR_SERIALIZATION_MAP).map(([key, value]) => [value, key]));
    const COSMETIC_RULE_TYPE_DESERIALIZATION_MAP = new Map([
        [BinaryTypeMap.ElementHidingRule, CosmeticRuleType.ElementHidingRule],
        [BinaryTypeMap.CssInjectionRule, CosmeticRuleType.CssInjectionRule],
        [BinaryTypeMap.ScriptletInjectionRule, CosmeticRuleType.ScriptletInjectionRule],
        [BinaryTypeMap.JsInjectionRule, CosmeticRuleType.JsInjectionRule],
        [BinaryTypeMap.HtmlFilteringRule, CosmeticRuleType.HtmlFilteringRule],
    ]);
    var ElementHidingRuleSerializationMap;
    (function (ElementHidingRuleSerializationMap) {
        ElementHidingRuleSerializationMap[ElementHidingRuleSerializationMap["SelectorList"] = 1] = "SelectorList";
        ElementHidingRuleSerializationMap[ElementHidingRuleSerializationMap["Start"] = 2] = "Start";
        ElementHidingRuleSerializationMap[ElementHidingRuleSerializationMap["End"] = 3] = "End";
    })(ElementHidingRuleSerializationMap || (ElementHidingRuleSerializationMap = {}));
    var CssInjectionRuleSerializationMap;
    (function (CssInjectionRuleSerializationMap) {
        CssInjectionRuleSerializationMap[CssInjectionRuleSerializationMap["SelectorList"] = 1] = "SelectorList";
        CssInjectionRuleSerializationMap[CssInjectionRuleSerializationMap["DeclarationList"] = 2] = "DeclarationList";
        CssInjectionRuleSerializationMap[CssInjectionRuleSerializationMap["MediaQueryList"] = 3] = "MediaQueryList";
        CssInjectionRuleSerializationMap[CssInjectionRuleSerializationMap["Remove"] = 4] = "Remove";
        CssInjectionRuleSerializationMap[CssInjectionRuleSerializationMap["Start"] = 5] = "Start";
        CssInjectionRuleSerializationMap[CssInjectionRuleSerializationMap["End"] = 6] = "End";
    })(CssInjectionRuleSerializationMap || (CssInjectionRuleSerializationMap = {}));
    var CosmeticRuleSerializationMap;
    (function (CosmeticRuleSerializationMap) {
        CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Syntax"] = 1] = "Syntax";
        CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Exception"] = 2] = "Exception";
        CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Separator"] = 3] = "Separator";
        CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Modifiers"] = 4] = "Modifiers";
        CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Domains"] = 5] = "Domains";
        CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Body"] = 6] = "Body";
        CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["Start"] = 7] = "Start";
        CosmeticRuleSerializationMap[CosmeticRuleSerializationMap["End"] = 8] = "End";
    })(CosmeticRuleSerializationMap || (CosmeticRuleSerializationMap = {}));
    const ERROR_MESSAGES$3 = {
        EMPTY_RULE_BODY: 'Empty rule body',
        INVALID_BODY_FOR_SEPARATOR: "Body '%s' is not valid for the '%s' cosmetic rule separator",
        MISSING_ADGUARD_MODIFIER_LIST_END: "Missing '%s' at the end of the AdGuard modifier list in pattern '%s'",
        MISSING_ADGUARD_MODIFIER_LIST_MARKER: "Missing '%s' at the beginning of the AdGuard modifier list in pattern '%s'",
        SYNTAXES_CANNOT_BE_MIXED: "'%s' syntax cannot be mixed with '%s' syntax",
        SYNTAX_DISABLED: "Parsing '%s' syntax is disabled, but the rule uses it",
    };
    const ADG_CSS_INJECTION_PATTERN = /^(?:.+){(?:.+)}$/;
    class CosmeticRuleParser extends ParserBase {
        static isCosmeticRule(raw) {
            const trimmed = raw.trim();
            if (CommentRuleParser.isCommentRule(trimmed)) {
                return false;
            }
            return CosmeticRuleSeparatorUtils.find(trimmed) !== null;
        }
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            const separatorResult = CosmeticRuleSeparatorUtils.find(raw);
            if (!separatorResult) {
                return null;
            }
            let syntax = AdblockSyntax.Common;
            let modifiers;
            const patternStart = StringUtils.skipWS(raw);
            const patternEnd = StringUtils.skipWSBack(raw, separatorResult.start - 1) + 1;
            const bodyStart = StringUtils.skipWS(raw, separatorResult.end);
            const bodyEnd = StringUtils.skipWSBack(raw) + 1;
            if (bodyEnd <= bodyStart) {
                throw new AdblockSyntaxError(ERROR_MESSAGES$3.EMPTY_RULE_BODY, baseOffset, baseOffset + raw.length);
            }
            const rawPattern = raw.slice(patternStart, patternEnd);
            let patternOffset = patternStart;
            if (rawPattern[patternOffset] === OPEN_SQUARE_BRACKET) {
                const modifierListStart = patternOffset;
                patternOffset += 1;
                patternOffset = StringUtils.skipWS(rawPattern, patternOffset);
                if (rawPattern[patternOffset] !== DOLLAR_SIGN) {
                    throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.MISSING_ADGUARD_MODIFIER_LIST_MARKER, DOLLAR_SIGN, rawPattern), baseOffset + patternOffset, baseOffset + rawPattern.length);
                }
                patternOffset += 1;
                patternOffset = StringUtils.skipWS(rawPattern, patternOffset);
                const modifierListEnd = StringUtils.findLastUnescapedCharacter(rawPattern, CLOSE_SQUARE_BRACKET);
                if (modifierListEnd === -1) {
                    throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.MISSING_ADGUARD_MODIFIER_LIST_END, CLOSE_SQUARE_BRACKET, rawPattern), baseOffset + patternOffset, baseOffset + rawPattern.length);
                }
                modifiers = ModifierListParser.parse(raw.slice(patternOffset, modifierListEnd), options, baseOffset + patternOffset);
                if (options.isLocIncluded) {
                    modifiers.start = baseOffset + modifierListStart;
                    modifiers.end = baseOffset + modifierListEnd + 1;
                }
                patternOffset = modifierListEnd + 1;
                syntax = AdblockSyntax.Adg;
            }
            patternOffset = StringUtils.skipWS(rawPattern, patternOffset);
            const domains = DomainListParser.parse(rawPattern.slice(patternOffset), options, baseOffset + patternOffset);
            const separator = {
                type: 'Value',
                value: separatorResult.separator,
            };
            if (options.isLocIncluded) {
                separator.start = baseOffset + separatorResult.start;
                separator.end = baseOffset + separatorResult.end;
            }
            const exception = CosmeticRuleSeparatorUtils.isException(separatorResult.separator);
            let rawBody = raw.slice(bodyStart, bodyEnd);
            const expectCommonOrSpecificSyntax = (expectedSyntax) => {
                if (syntax !== AdblockSyntax.Common && syntax !== expectedSyntax) {
                    throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.SYNTAXES_CANNOT_BE_MIXED, expectedSyntax, syntax), baseOffset + patternStart, baseOffset + bodyEnd);
                }
            };
            let uboSelector;
            if (options.parseUboSpecificRules) {
                uboSelector = UboSelectorParser.parse(rawBody, options, baseOffset + bodyStart);
                rawBody = uboSelector.selector.value;
                if (uboSelector.modifiers && uboSelector.modifiers.children.length > 0) {
                    expectCommonOrSpecificSyntax(AdblockSyntax.Ubo);
                    syntax = AdblockSyntax.Ubo;
                    for (const modifier of uboSelector.modifiers.children) {
                        if (modifier.name.value === UboPseudoName.MatchesPath) {
                            if (!modifiers) {
                                modifiers = {
                                    type: 'ModifierList',
                                    children: [],
                                };
                                if (options.isLocIncluded) {
                                    modifiers.start = baseOffset + bodyStart;
                                    modifiers.end = baseOffset + bodyEnd;
                                }
                            }
                            modifiers.children.push(modifier);
                        }
                    }
                }
            }
            const raws = {
                text: raw,
            };
            const baseRule = {
                category: RuleCategory.Cosmetic,
                exception,
                modifiers,
                domains,
                separator,
            };
            if (options.includeRaws) {
                baseRule.raws = raws;
            }
            if (options.isLocIncluded) {
                baseRule.start = baseOffset;
                baseRule.end = baseOffset + raw.length;
            }
            const parseUboCssInjection = () => {
                if (!uboSelector || !uboSelector.modifiers || uboSelector.modifiers.children?.length < 1) {
                    return null;
                }
                expectCommonOrSpecificSyntax(AdblockSyntax.Ubo);
                const selectorList = uboSelector.selector;
                let declarationList;
                let mediaQueryList;
                let remove = false;
                for (const modifier of uboSelector.modifiers.children) {
                    switch (modifier.name.value) {
                        case UboPseudoName.Style:
                            declarationList = modifier.value;
                            break;
                        case UboPseudoName.Remove:
                            declarationList = {
                                type: 'Value',
                                value: '',
                            };
                            remove = true;
                            break;
                        case UboPseudoName.MatchesMedia:
                            mediaQueryList = modifier.value;
                            break;
                    }
                }
                if (!declarationList) {
                    return null;
                }
                const body = {
                    type: 'CssInjectionRuleBody',
                    selectorList,
                    declarationList,
                    mediaQueryList,
                    remove,
                };
                if (options.isLocIncluded) {
                    body.start = baseOffset + bodyStart;
                    body.end = baseOffset + bodyEnd;
                }
                return {
                    syntax: AdblockSyntax.Ubo,
                    type: CosmeticRuleType.CssInjectionRule,
                    body,
                };
            };
            const parseElementHiding = () => {
                const selectorList = {
                    type: 'Value',
                    value: rawBody,
                };
                if (options.isLocIncluded) {
                    selectorList.start = baseOffset + bodyStart;
                    selectorList.end = baseOffset + bodyEnd;
                }
                const body = {
                    type: 'ElementHidingRuleBody',
                    selectorList,
                };
                if (options.isLocIncluded) {
                    body.start = baseOffset + bodyStart;
                    body.end = baseOffset + bodyEnd;
                }
                return {
                    syntax,
                    type: CosmeticRuleType.ElementHidingRule,
                    body,
                };
            };
            const parseAdgCssInjection = () => {
                if (!ADG_CSS_INJECTION_PATTERN.test(rawBody)) {
                    return null;
                }
                expectCommonOrSpecificSyntax(AdblockSyntax.Adg);
                return {
                    syntax: AdblockSyntax.Adg,
                    type: CosmeticRuleType.CssInjectionRule,
                    body: AdgCssInjectionParser.parse(rawBody, options, baseOffset + bodyStart),
                };
            };
            const parseAbpSnippetInjection = () => {
                if (!options.parseAbpSpecificRules) {
                    throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.SYNTAX_DISABLED, AdblockSyntax.Abp), baseOffset + bodyStart, baseOffset + bodyEnd);
                }
                expectCommonOrSpecificSyntax(AdblockSyntax.Abp);
                const body = AbpSnippetInjectionBodyParser.parse(rawBody, options, baseOffset + bodyStart);
                if (options.isLocIncluded) {
                    body.start = baseOffset + bodyStart;
                    body.end = baseOffset + bodyEnd;
                }
                return {
                    syntax: AdblockSyntax.Abp,
                    type: CosmeticRuleType.ScriptletInjectionRule,
                    body,
                };
            };
            const parseUboScriptletInjection = () => {
                if (!rawBody.startsWith(UBO_SCRIPTLET_MASK) && !rawBody.startsWith(UBO_SCRIPTLET_MASK_LEGACY)) {
                    return null;
                }
                if (!options.parseUboSpecificRules) {
                    throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.SYNTAX_DISABLED, AdblockSyntax.Ubo), baseOffset + bodyStart, baseOffset + bodyEnd);
                }
                expectCommonOrSpecificSyntax(AdblockSyntax.Ubo);
                const body = UboScriptletInjectionBodyParser.parse(rawBody, options, baseOffset + bodyStart);
                if (options.isLocIncluded) {
                    body.start = baseOffset + bodyStart;
                    body.end = baseOffset + bodyEnd;
                }
                return {
                    syntax: AdblockSyntax.Ubo,
                    type: CosmeticRuleType.ScriptletInjectionRule,
                    body,
                };
            };
            const parseAdgScriptletInjection = () => {
                if (!rawBody.startsWith(ADG_SCRIPTLET_MASK)) {
                    return null;
                }
                expectCommonOrSpecificSyntax(AdblockSyntax.Adg);
                const body = AdgScriptletInjectionBodyParser.parse(rawBody, options, baseOffset + bodyStart);
                if (options.isLocIncluded) {
                    body.start = baseOffset + bodyStart;
                    body.end = baseOffset + bodyEnd;
                }
                return {
                    syntax: AdblockSyntax.Adg,
                    type: CosmeticRuleType.ScriptletInjectionRule,
                    body,
                };
            };
            const parseAdgJsInjection = () => {
                expectCommonOrSpecificSyntax(AdblockSyntax.Adg);
                const body = {
                    type: 'Value',
                    value: rawBody,
                };
                if (options.isLocIncluded) {
                    body.start = baseOffset + bodyStart;
                    body.end = baseOffset + bodyEnd;
                }
                return {
                    syntax: AdblockSyntax.Adg,
                    type: CosmeticRuleType.JsInjectionRule,
                    body,
                };
            };
            const parseUboHtmlFiltering = () => {
                if (!rawBody.startsWith(UBO_HTML_MASK)) {
                    return null;
                }
                if (!options.parseUboSpecificRules) {
                    throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.SYNTAX_DISABLED, AdblockSyntax.Ubo), baseOffset + bodyStart, baseOffset + bodyEnd);
                }
                expectCommonOrSpecificSyntax(AdblockSyntax.Ubo);
                const body = {
                    type: 'Value',
                    value: rawBody,
                };
                if (options.isLocIncluded) {
                    body.start = baseOffset + bodyStart;
                    body.end = baseOffset + bodyEnd;
                }
                return {
                    syntax: AdblockSyntax.Ubo,
                    type: CosmeticRuleType.HtmlFilteringRule,
                    body,
                };
            };
            const parseAdgHtmlFiltering = () => {
                expectCommonOrSpecificSyntax(AdblockSyntax.Adg);
                const body = {
                    type: 'Value',
                    value: rawBody,
                };
                if (options.isLocIncluded) {
                    body.start = baseOffset + bodyStart;
                    body.end = baseOffset + bodyEnd;
                }
                return {
                    syntax: AdblockSyntax.Adg,
                    type: CosmeticRuleType.HtmlFilteringRule,
                    body,
                };
            };
            const separatorMap = {
                '##': [parseUboHtmlFiltering, parseUboScriptletInjection, parseUboCssInjection, parseElementHiding],
                '#@#': [parseUboHtmlFiltering, parseUboScriptletInjection, parseUboCssInjection, parseElementHiding],
                '#?#': [parseUboCssInjection, parseElementHiding],
                '#@?#': [parseUboCssInjection, parseElementHiding],
                '#$#': [parseAdgCssInjection, parseAbpSnippetInjection],
                '#@$#': [parseAdgCssInjection, parseAbpSnippetInjection],
                '#$?#': [parseAdgCssInjection],
                '#@$?#': [parseAdgCssInjection],
                '#%#': [parseAdgScriptletInjection, parseAdgJsInjection],
                '#@%#': [parseAdgScriptletInjection, parseAdgJsInjection],
                $$: [parseAdgHtmlFiltering],
                '$@$': [parseAdgHtmlFiltering],
            };
            const parseFunctions = separatorMap[separatorResult.separator];
            let restProps;
            for (const parseFunction of parseFunctions) {
                restProps = parseFunction();
                if (restProps) {
                    break;
                }
            }
            if (!restProps) {
                throw new AdblockSyntaxError(sprintf.sprintf(ERROR_MESSAGES$3.INVALID_BODY_FOR_SEPARATOR, rawBody, separatorResult.separator), baseOffset + bodyStart, baseOffset + bodyEnd);
            }
            return {
                ...baseRule,
                ...restProps,
            };
        }
        static generatePattern(node) {
            let result = EMPTY;
            if (node.syntax === AdblockSyntax.Adg && node.modifiers && node.modifiers.children.length > 0) {
                result += OPEN_SQUARE_BRACKET;
                result += DOLLAR_SIGN;
                result += ModifierListParser.generate(node.modifiers);
                result += CLOSE_SQUARE_BRACKET;
            }
            result += DomainListParser.generate(node.domains);
            return result;
        }
        static generateBody(node) {
            let result = EMPTY;
            switch (node.type) {
                case CosmeticRuleType.ElementHidingRule:
                    result = node.body.selectorList.value;
                    break;
                case CosmeticRuleType.CssInjectionRule:
                    if (node.syntax === AdblockSyntax.Adg) {
                        result = AdgCssInjectionParser.generate(node.body);
                    }
                    else if (node.syntax === AdblockSyntax.Ubo) {
                        if (node.body.mediaQueryList) {
                            result += COLON;
                            result += UboPseudoName.MatchesMedia;
                            result += OPEN_PARENTHESIS;
                            result += node.body.mediaQueryList.value;
                            result += CLOSE_PARENTHESIS;
                            result += SPACE;
                        }
                        result += node.body.selectorList.value;
                        if (node.body.remove) {
                            result += COLON;
                            result += UboPseudoName.Remove;
                            result += OPEN_PARENTHESIS;
                            result += CLOSE_PARENTHESIS;
                        }
                        else if (node.body.declarationList) {
                            result += COLON;
                            result += UboPseudoName.Style;
                            result += OPEN_PARENTHESIS;
                            result += node.body.declarationList.value;
                            result += CLOSE_PARENTHESIS;
                        }
                    }
                    break;
                case CosmeticRuleType.HtmlFilteringRule:
                case CosmeticRuleType.JsInjectionRule:
                    result = node.body.value;
                    break;
                case CosmeticRuleType.ScriptletInjectionRule:
                    switch (node.syntax) {
                        case AdblockSyntax.Adg:
                            result = AdgScriptletInjectionBodyParser.generate(node.body);
                            break;
                        case AdblockSyntax.Abp:
                            result = AbpSnippetInjectionBodyParser.generate(node.body);
                            break;
                        case AdblockSyntax.Ubo:
                            result = UboScriptletInjectionBodyParser.generate(node.body);
                            break;
                        default:
                            throw new Error('Scriptlet rule should have an explicit syntax');
                    }
                    break;
                default:
                    throw new Error('Unknown cosmetic rule type');
            }
            return result;
        }
        static generate(node) {
            let result = EMPTY;
            result += CosmeticRuleParser.generatePattern(node);
            result += node.separator.value;
            if (node.syntax === AdblockSyntax.Ubo && node.modifiers) {
                node.modifiers.children.forEach((modifier) => {
                    result += COLON;
                    result += modifier.name.value;
                    if (modifier.value) {
                        result += OPEN_PARENTHESIS;
                        result += modifier.value.value;
                        result += CLOSE_PARENTHESIS;
                    }
                });
                if (node.modifiers.children.length) {
                    result += SPACE;
                }
            }
            result += CosmeticRuleParser.generateBody(node);
            return result;
        }
        static serializeElementHidingBody(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.ElementHidingRuleBody);
            buffer.writeUint8(ElementHidingRuleSerializationMap.SelectorList);
            ValueParser.serialize(node.selectorList, buffer);
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(ElementHidingRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(ElementHidingRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserializeElementHidingBody(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.ElementHidingRuleBody);
            node.type = 'ElementHidingRuleBody';
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case ElementHidingRuleSerializationMap.SelectorList:
                        ValueParser.deserialize(buffer, node.selectorList = {});
                        break;
                    case ElementHidingRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case ElementHidingRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Unknown property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
        static serializeCssInjectionBody(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.CssInjectionRuleBody);
            if (node.mediaQueryList) {
                buffer.writeUint8(CssInjectionRuleSerializationMap.MediaQueryList);
                ValueParser.serialize(node.mediaQueryList, buffer);
            }
            buffer.writeUint8(CssInjectionRuleSerializationMap.SelectorList);
            ValueParser.serialize(node.selectorList, buffer);
            if (node.declarationList) {
                buffer.writeUint8(CssInjectionRuleSerializationMap.DeclarationList);
                ValueParser.serialize(node.declarationList, buffer);
            }
            if (node.remove) {
                buffer.writeUint8(CssInjectionRuleSerializationMap.Remove);
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(CssInjectionRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(CssInjectionRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserializeCssInjectionBody(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.CssInjectionRuleBody);
            node.type = 'CssInjectionRuleBody';
            node.remove = false;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case CssInjectionRuleSerializationMap.MediaQueryList:
                        ValueParser.deserialize(buffer, node.mediaQueryList = {});
                        break;
                    case CssInjectionRuleSerializationMap.SelectorList:
                        ValueParser.deserialize(buffer, node.selectorList = {});
                        break;
                    case CssInjectionRuleSerializationMap.DeclarationList:
                        ValueParser.deserialize(buffer, node.declarationList = {});
                        break;
                    case CssInjectionRuleSerializationMap.Remove:
                        node.remove = true;
                        break;
                    case CssInjectionRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case CssInjectionRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Unknown property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
        static serialize(node, buffer) {
            switch (node.type) {
                case CosmeticRuleType.ElementHidingRule:
                    buffer.writeUint8(BinaryTypeMap.ElementHidingRule);
                    buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
                    CosmeticRuleParser.serializeElementHidingBody(node.body, buffer);
                    break;
                case CosmeticRuleType.CssInjectionRule:
                    buffer.writeUint8(BinaryTypeMap.CssInjectionRule);
                    buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
                    CosmeticRuleParser.serializeCssInjectionBody(node.body, buffer);
                    break;
                case CosmeticRuleType.JsInjectionRule:
                    buffer.writeUint8(BinaryTypeMap.JsInjectionRule);
                    buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
                    ValueParser.serialize(node.body, buffer);
                    break;
                case CosmeticRuleType.HtmlFilteringRule:
                    buffer.writeUint8(BinaryTypeMap.HtmlFilteringRule);
                    buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
                    ValueParser.serialize(node.body, buffer);
                    break;
                case CosmeticRuleType.ScriptletInjectionRule:
                    buffer.writeUint8(BinaryTypeMap.ScriptletInjectionRule);
                    buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
                    switch (node.syntax) {
                        case AdblockSyntax.Adg:
                            AdgScriptletInjectionBodyParser.serialize(node.body, buffer);
                            break;
                        case AdblockSyntax.Abp:
                            AbpSnippetInjectionBodyParser.serialize(node.body, buffer);
                            break;
                        case AdblockSyntax.Ubo:
                            UboScriptletInjectionBodyParser.serialize(node.body, buffer);
                            break;
                        default:
                            throw new Error('Scriptlet rule should have an explicit syntax');
                    }
                    break;
                default:
                    throw new Error('Unknown cosmetic rule type');
            }
            buffer.writeUint8(CosmeticRuleSerializationMap.Exception);
            buffer.writeUint8(node.exception ? 1 : 0);
            buffer.writeUint8(CosmeticRuleSerializationMap.Separator);
            ValueParser.serialize(node.separator, buffer, SEPARATOR_SERIALIZATION_MAP);
            if (node.modifiers) {
                buffer.writeUint8(CosmeticRuleSerializationMap.Modifiers);
                ModifierListParser.serialize(node.modifiers, buffer);
            }
            buffer.writeUint8(CosmeticRuleSerializationMap.Domains);
            DomainListParser.serialize(node.domains, buffer);
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(CosmeticRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(CosmeticRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            const type = COSMETIC_RULE_TYPE_DESERIALIZATION_MAP.get(buffer.readUint8());
            if (isUndefined$1(type)) {
                throw new Error(`Unknown rule type: ${type}`);
            }
            node.type = type;
            node.category = RuleCategory.Cosmetic;
            const syntax = SYNTAX_DESERIALIZATION_MAP.get(buffer.readUint8()) ?? AdblockSyntax.Common;
            node.syntax = syntax;
            node.modifiers = undefined;
            switch (type) {
                case CosmeticRuleType.ElementHidingRule:
                    CosmeticRuleParser.deserializeElementHidingBody(buffer, node.body = {});
                    break;
                case CosmeticRuleType.CssInjectionRule:
                    CosmeticRuleParser.deserializeCssInjectionBody(buffer, node.body = {});
                    break;
                case CosmeticRuleType.JsInjectionRule:
                    ValueParser.deserialize(buffer, node.body = {});
                    break;
                case CosmeticRuleType.HtmlFilteringRule:
                    ValueParser.deserialize(buffer, node.body = {});
                    break;
                case CosmeticRuleType.ScriptletInjectionRule:
                    switch (syntax) {
                        case AdblockSyntax.Adg:
                            AdgScriptletInjectionBodyParser.deserialize(buffer, node.body = {});
                            break;
                        case AdblockSyntax.Abp:
                            AbpSnippetInjectionBodyParser.deserialize(buffer, node.body = {});
                            break;
                        case AdblockSyntax.Ubo:
                            UboScriptletInjectionBodyParser.deserialize(buffer, node.body = {});
                            break;
                        default:
                            throw new Error('Scriptlet rule should have an explicit syntax');
                    }
                    break;
                default:
                    throw new Error('Unknown cosmetic rule type');
            }
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case CosmeticRuleSerializationMap.Exception:
                        node.exception = buffer.readUint8() === 1;
                        break;
                    case CosmeticRuleSerializationMap.Separator:
                        ValueParser.deserialize(buffer, node.separator = {}, SEPARATOR_DESERIALIZATION_MAP);
                        break;
                    case CosmeticRuleSerializationMap.Modifiers:
                        node.modifiers = {};
                        ModifierListParser.deserialize(buffer, node.modifiers);
                        break;
                    case CosmeticRuleSerializationMap.Domains:
                        DomainListParser.deserialize(buffer, node.domains = {});
                        break;
                    case CosmeticRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case CosmeticRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Unknown property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var NetworkRuleSerializationMap;
    (function (NetworkRuleSerializationMap) {
        NetworkRuleSerializationMap[NetworkRuleSerializationMap["Syntax"] = 1] = "Syntax";
        NetworkRuleSerializationMap[NetworkRuleSerializationMap["Raws"] = 2] = "Raws";
        NetworkRuleSerializationMap[NetworkRuleSerializationMap["Exception"] = 3] = "Exception";
        NetworkRuleSerializationMap[NetworkRuleSerializationMap["Pattern"] = 4] = "Pattern";
        NetworkRuleSerializationMap[NetworkRuleSerializationMap["ModifierList"] = 5] = "ModifierList";
        NetworkRuleSerializationMap[NetworkRuleSerializationMap["Start"] = 6] = "Start";
        NetworkRuleSerializationMap[NetworkRuleSerializationMap["End"] = 7] = "End";
    })(NetworkRuleSerializationMap || (NetworkRuleSerializationMap = {}));
    class NetworkRuleParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            let offset = 0;
            offset = StringUtils.skipWS(raw, offset);
            let exception = false;
            if (raw.startsWith(NETWORK_RULE_EXCEPTION_MARKER, offset)) {
                offset += NETWORK_RULE_EXCEPTION_MARKER_LEN;
                exception = true;
            }
            const patternStart = offset;
            const separatorIndex = NetworkRuleParser.findNetworkRuleSeparatorIndex(raw);
            const patternEnd = separatorIndex === -1
                ? StringUtils.skipWSBack(raw) + 1
                : StringUtils.skipWSBack(raw, separatorIndex - 1) + 1;
            const pattern = ValueParser.parse(raw.slice(patternStart, patternEnd), options, baseOffset + patternStart);
            let modifiers;
            const modifiersStart = separatorIndex + 1;
            const modifiersEnd = StringUtils.skipWSBack(raw) + 1;
            if (separatorIndex !== -1) {
                modifiers = ModifierListParser.parse(raw.slice(modifiersStart, modifiersEnd), options, baseOffset + modifiersStart);
            }
            if (pattern.value.length === 0 && (modifiers === undefined || modifiers.children.length === 0)) {
                throw new AdblockSyntaxError('Network rule must have a pattern or modifiers', baseOffset, baseOffset + raw.length);
            }
            const result = {
                type: NetworkRuleType.NetworkRule,
                category: RuleCategory.Network,
                syntax: AdblockSyntax.Common,
                exception,
                pattern,
                modifiers,
            };
            if (options.includeRaws) {
                result.raws = {
                    text: raw,
                };
            }
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
        static findNetworkRuleSeparatorIndex(rule) {
            for (let i = rule.length - 1; i >= 0; i -= 1) {
                if (rule[i] === NETWORK_RULE_SEPARATOR && rule[i + 1] !== REGEX_MARKER && rule[i - 1] !== ESCAPE_CHARACTER) {
                    return i;
                }
            }
            return -1;
        }
        static generate(node) {
            let result = EMPTY;
            if (node.exception) {
                result += NETWORK_RULE_EXCEPTION_MARKER;
            }
            result += node.pattern.value;
            if (node.modifiers && node.modifiers.children.length > 0) {
                result += NETWORK_RULE_SEPARATOR;
                result += ModifierListParser.generate(node.modifiers);
            }
            return result;
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.NetworkRuleNode);
            buffer.writeUint8(NetworkRuleSerializationMap.Syntax);
            buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
            buffer.writeUint8(NetworkRuleSerializationMap.Exception);
            buffer.writeUint8(node.exception ? 1 : 0);
            buffer.writeUint8(NetworkRuleSerializationMap.Pattern);
            ValueParser.serialize(node.pattern, buffer);
            if (!isUndefined$1(node.modifiers)) {
                buffer.writeUint8(NetworkRuleSerializationMap.ModifierList);
                ModifierListParser.serialize(node.modifiers, buffer);
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(NetworkRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(NetworkRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.NetworkRuleNode);
            node.type = NetworkRuleType.NetworkRule;
            node.category = RuleCategory.Network;
            node.modifiers = undefined;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case NetworkRuleSerializationMap.Syntax:
                        node.syntax = SYNTAX_DESERIALIZATION_MAP.get(buffer.readUint8()) ?? AdblockSyntax.Common;
                        break;
                    case NetworkRuleSerializationMap.Exception:
                        node.exception = buffer.readUint8() === 1;
                        break;
                    case NetworkRuleSerializationMap.Pattern:
                        ValueParser.deserialize(buffer, node.pattern = {});
                        break;
                    case NetworkRuleSerializationMap.ModifierList:
                        ModifierListParser.deserialize(buffer, node.modifiers = {});
                        break;
                    case NetworkRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case NetworkRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}.`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var HostRuleSerializationMap;
    (function (HostRuleSerializationMap) {
        HostRuleSerializationMap[HostRuleSerializationMap["Syntax"] = 1] = "Syntax";
        HostRuleSerializationMap[HostRuleSerializationMap["Raws"] = 2] = "Raws";
        HostRuleSerializationMap[HostRuleSerializationMap["Ip"] = 3] = "Ip";
        HostRuleSerializationMap[HostRuleSerializationMap["HostnameList"] = 4] = "HostnameList";
        HostRuleSerializationMap[HostRuleSerializationMap["Comment"] = 5] = "Comment";
        HostRuleSerializationMap[HostRuleSerializationMap["Start"] = 6] = "Start";
        HostRuleSerializationMap[HostRuleSerializationMap["End"] = 7] = "End";
    })(HostRuleSerializationMap || (HostRuleSerializationMap = {}));
    var HostnameListNodeSerializationMap;
    (function (HostnameListNodeSerializationMap) {
        HostnameListNodeSerializationMap[HostnameListNodeSerializationMap["Children"] = 1] = "Children";
        HostnameListNodeSerializationMap[HostnameListNodeSerializationMap["Start"] = 2] = "Start";
        HostnameListNodeSerializationMap[HostnameListNodeSerializationMap["End"] = 3] = "End";
    })(HostnameListNodeSerializationMap || (HostnameListNodeSerializationMap = {}));
    class HostRuleParser extends ParserBase {
        static NULL_IP = '0.0.0.0';
        static COMMENT_MARKER = '#';
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            let offset = StringUtils.skipWS(raw, 0);
            const parts = [];
            let lastPartStartIndex = offset;
            let comment = null;
            const rawLength = raw.length;
            const parsePartIfNeeded = (startIndex, endIndex) => {
                if (startIndex < endIndex) {
                    parts.push(ValueParser.parse(raw.slice(startIndex, endIndex), options, baseOffset + startIndex));
                }
            };
            while (offset < rawLength) {
                if (StringUtils.isWhitespace(raw[offset])) {
                    parsePartIfNeeded(lastPartStartIndex, offset);
                    offset = StringUtils.skipWS(raw, offset);
                    lastPartStartIndex = offset;
                }
                else if (raw[offset] === HostRuleParser.COMMENT_MARKER) {
                    const commentStart = offset;
                    offset = StringUtils.skipWS(raw, offset + 1);
                    comment = ValueParser.parse(raw.slice(offset), options, baseOffset + commentStart);
                    offset = rawLength;
                    lastPartStartIndex = offset;
                }
                else {
                    offset += 1;
                }
            }
            parsePartIfNeeded(lastPartStartIndex, offset);
            const partsLength = parts.length;
            if (partsLength < 1) {
                throw new Error('Host rule must have at least one domain name or an IP address and a domain name');
            }
            const result = {
                category: RuleCategory.Network,
                type: NetworkRuleType.HostRule,
                syntax: AdblockSyntax.Common,
            };
            if (partsLength === 1) {
                if (getDomain(parts[0].value) !== parts[0].value) {
                    throw new Error(`Not a valid domain: ${parts[0].value}`);
                }
                result.ip = {
                    type: 'Value',
                    value: HostRuleParser.NULL_IP,
                };
                result.hostnames = {
                    type: 'HostnameList',
                    children: parts,
                };
            }
            else if (partsLength > 1) {
                const [ip, ...hostnames] = parts;
                if (!isIp$1(ip.value)) {
                    throw new Error(`Invalid IP address: ${ip.value}`);
                }
                for (const { value } of hostnames) {
                    if (getHostname(value) !== value) {
                        throw new Error(`Not a valid hostname: ${value}`);
                    }
                }
                result.ip = ip;
                result.hostnames = {
                    type: 'HostnameList',
                    children: hostnames,
                };
            }
            if (comment) {
                result.comment = comment;
            }
            if (options.includeRaws) {
                result.raws = {
                    text: raw,
                };
            }
            return result;
        }
        static generate(node) {
            const result = [];
            if (node.ip) {
                result.push(node.ip.value);
            }
            if (node.hostnames) {
                result.push(SPACE);
                result.push(node.hostnames.children.map(({ value }) => value).join(SPACE));
            }
            if (node.comment) {
                result.push(SPACE);
                result.push(HostRuleParser.COMMENT_MARKER);
                result.push(SPACE);
                result.push(node.comment.value);
            }
            return result.join(EMPTY);
        }
        static serializeHostnameList(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.HostnameListNode);
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(HostnameListNodeSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(HostnameListNodeSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            const count = node.children.length;
            if (count) {
                if (count > UINT16_MAX) {
                    throw new Error(`Too many children: ${count}, the limit is ${UINT16_MAX}`);
                }
                buffer.writeUint8(HostnameListNodeSerializationMap.Children);
                buffer.writeUint16(count);
                for (let i = 0; i < count; i += 1) {
                    ValueParser.serialize(node.children[i], buffer);
                }
            }
            buffer.writeUint8(NULL);
        }
        static deserializeHostnameList(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.HostnameListNode);
            node.type = 'HostnameList';
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case HostnameListNodeSerializationMap.Children:
                        node.children = new Array(buffer.readUint16());
                        for (let i = 0; i < node.children.length; i += 1) {
                            ValueParser.deserialize(buffer, node.children[i] = {});
                        }
                        break;
                    case HostnameListNodeSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case HostnameListNodeSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Unknown property: ${prop}`);
                }
                prop = buffer.readUint8();
            }
        }
        static serialize(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.HostRuleNode);
            buffer.writeUint8(HostRuleSerializationMap.Syntax);
            buffer.writeUint8(SYNTAX_SERIALIZATION_MAP.get(node.syntax) ?? 0);
            if (node.ip) {
                buffer.writeUint8(HostRuleSerializationMap.Ip);
                ValueParser.serialize(node.ip, buffer);
            }
            if (node.hostnames) {
                buffer.writeUint8(HostRuleSerializationMap.HostnameList);
                HostRuleParser.serializeHostnameList(node.hostnames, buffer);
            }
            if (node.comment) {
                buffer.writeUint8(HostRuleSerializationMap.Comment);
                ValueParser.serialize(node.comment, buffer);
            }
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(HostRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(HostRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserialize(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.HostRuleNode);
            node.category = RuleCategory.Network;
            node.type = NetworkRuleType.HostRule;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case HostRuleSerializationMap.Syntax:
                        node.syntax = SYNTAX_DESERIALIZATION_MAP.get(buffer.readUint8()) ?? AdblockSyntax.Common;
                        break;
                    case HostRuleSerializationMap.Ip:
                        node.ip = {};
                        ValueParser.deserialize(buffer, node.ip);
                        break;
                    case HostRuleSerializationMap.HostnameList:
                        node.hostnames = {};
                        HostRuleParser.deserializeHostnameList(buffer, node.hostnames);
                        break;
                    case HostRuleSerializationMap.Comment:
                        node.comment = {};
                        ValueParser.deserialize(buffer, node.comment);
                        break;
                    case HostRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case HostRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}.`);
                }
                prop = buffer.readUint8();
            }
        }
    }
    var EmptyRuleSerializationMap;
    (function (EmptyRuleSerializationMap) {
        EmptyRuleSerializationMap[EmptyRuleSerializationMap["Start"] = 1] = "Start";
        EmptyRuleSerializationMap[EmptyRuleSerializationMap["End"] = 2] = "End";
    })(EmptyRuleSerializationMap || (EmptyRuleSerializationMap = {}));
    var InvalidRuleErrorNodeSerializationMap;
    (function (InvalidRuleErrorNodeSerializationMap) {
        InvalidRuleErrorNodeSerializationMap[InvalidRuleErrorNodeSerializationMap["Name"] = 1] = "Name";
        InvalidRuleErrorNodeSerializationMap[InvalidRuleErrorNodeSerializationMap["Message"] = 2] = "Message";
        InvalidRuleErrorNodeSerializationMap[InvalidRuleErrorNodeSerializationMap["Start"] = 3] = "Start";
        InvalidRuleErrorNodeSerializationMap[InvalidRuleErrorNodeSerializationMap["End"] = 4] = "End";
    })(InvalidRuleErrorNodeSerializationMap || (InvalidRuleErrorNodeSerializationMap = {}));
    var InvalidRuleSerializationMap;
    (function (InvalidRuleSerializationMap) {
        InvalidRuleSerializationMap[InvalidRuleSerializationMap["Error"] = 1] = "Error";
        InvalidRuleSerializationMap[InvalidRuleSerializationMap["Start"] = 2] = "Start";
        InvalidRuleSerializationMap[InvalidRuleSerializationMap["End"] = 3] = "End";
    })(InvalidRuleSerializationMap || (InvalidRuleSerializationMap = {}));
    class RuleParser extends ParserBase {
        static parseHostOrNetworkRule(raw, options, baseOffset) {
            if (options.parseHostRules) {
                try {
                    return HostRuleParser.parse(raw, options, baseOffset);
                }
                catch (error) {
                }
            }
            return NetworkRuleParser.parse(raw, options, baseOffset);
        }
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            try {
                if (raw.trim().length === 0) {
                    const result = {
                        type: 'EmptyRule',
                        category: RuleCategory.Empty,
                        syntax: AdblockSyntax.Common,
                    };
                    if (options.includeRaws) {
                        result.raws = {
                            text: raw,
                        };
                    }
                    if (options.isLocIncluded) {
                        result.start = baseOffset;
                        result.end = baseOffset + raw.length;
                    }
                    return result;
                }
                if (options.ignoreComments) {
                    if (CommentRuleParser.isCommentRule(raw)) {
                        const result = {
                            type: 'EmptyRule',
                            category: RuleCategory.Empty,
                            syntax: AdblockSyntax.Common,
                        };
                        if (options.includeRaws) {
                            result.raws = {
                                text: raw,
                            };
                        }
                        if (options.isLocIncluded) {
                            result.start = baseOffset;
                            result.end = baseOffset + raw.length;
                        }
                        return result;
                    }
                    return CosmeticRuleParser.parse(raw, options, baseOffset)
                        || RuleParser.parseHostOrNetworkRule(raw, options, baseOffset);
                }
                return CommentRuleParser.parse(raw, options, baseOffset)
                    || CosmeticRuleParser.parse(raw, options, baseOffset)
                    || RuleParser.parseHostOrNetworkRule(raw, options, baseOffset);
            }
            catch (error) {
                if (!options.tolerant || !(error instanceof Error)) {
                    throw error;
                }
                const errorNode = {
                    type: 'InvalidRuleError',
                    name: error.name,
                    message: error.message,
                };
                if (error instanceof AdblockSyntaxError) {
                    errorNode.start = error.start;
                    errorNode.end = error.end;
                }
                const result = {
                    type: 'InvalidRule',
                    category: RuleCategory.Invalid,
                    syntax: AdblockSyntax.Common,
                    raw,
                    error: errorNode,
                };
                if (options.includeRaws) {
                    result.raws = {
                        text: raw,
                    };
                }
                if (options.isLocIncluded) {
                    result.start = baseOffset;
                    result.end = baseOffset + raw.length;
                }
                return result;
            }
        }
        static generate(ast) {
            switch (ast.category) {
                case RuleCategory.Empty:
                    return EMPTY;
                case RuleCategory.Invalid:
                    return ast.raw;
                case RuleCategory.Comment:
                    return CommentRuleParser.generate(ast);
                case RuleCategory.Cosmetic:
                    return CosmeticRuleParser.generate(ast);
                case RuleCategory.Network:
                    switch (ast.type) {
                        case NetworkRuleType.HostRule:
                            return HostRuleParser.generate(ast);
                        case NetworkRuleType.NetworkRule:
                            return NetworkRuleParser.generate(ast);
                        default:
                            throw new Error('Unknown network rule type');
                    }
                default:
                    throw new Error('Unknown rule category');
            }
        }
        static serializeEmptyRule(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.EmptyRule);
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(EmptyRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(EmptyRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserializeEmptyRule(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.EmptyRule);
            node.type = 'EmptyRule';
            node.category = RuleCategory.Empty;
            node.syntax = AdblockSyntax.Common;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case EmptyRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case EmptyRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}.`);
                }
                prop = buffer.readUint8();
            }
        }
        static serializeInvalidRuleErrorNode(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.InvalidRuleErrorNode);
            buffer.writeUint8(InvalidRuleErrorNodeSerializationMap.Name);
            buffer.writeString(node.name);
            buffer.writeUint8(InvalidRuleErrorNodeSerializationMap.Message);
            buffer.writeString(node.message);
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(InvalidRuleErrorNodeSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(InvalidRuleErrorNodeSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserializeInvalidRuleErrorNode(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.InvalidRuleErrorNode);
            node.type = 'InvalidRuleError';
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case InvalidRuleErrorNodeSerializationMap.Name:
                        node.name = buffer.readString();
                        break;
                    case InvalidRuleErrorNodeSerializationMap.Message:
                        node.message = buffer.readString();
                        break;
                    case InvalidRuleErrorNodeSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case InvalidRuleErrorNodeSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}.`);
                }
                prop = buffer.readUint8();
            }
        }
        static serializeInvalidRule(node, buffer) {
            buffer.writeUint8(BinaryTypeMap.InvalidRule);
            buffer.writeUint8(InvalidRuleSerializationMap.Error);
            RuleParser.serializeInvalidRuleErrorNode(node.error, buffer);
            if (!isUndefined$1(node.start)) {
                buffer.writeUint8(InvalidRuleSerializationMap.Start);
                buffer.writeUint32(node.start);
            }
            if (!isUndefined$1(node.end)) {
                buffer.writeUint8(InvalidRuleSerializationMap.End);
                buffer.writeUint32(node.end);
            }
            buffer.writeUint8(NULL);
        }
        static deserializeInvalidRule(buffer, node) {
            buffer.assertUint8(BinaryTypeMap.InvalidRule);
            node.type = 'InvalidRule';
            node.category = RuleCategory.Invalid;
            let prop = buffer.readUint8();
            while (prop !== NULL) {
                switch (prop) {
                    case InvalidRuleSerializationMap.Error:
                        RuleParser.deserializeInvalidRuleErrorNode(buffer, node.error = {});
                        break;
                    case InvalidRuleSerializationMap.Start:
                        node.start = buffer.readUint32();
                        break;
                    case InvalidRuleSerializationMap.End:
                        node.end = buffer.readUint32();
                        break;
                    default:
                        throw new Error(`Invalid property: ${prop}.`);
                }
                prop = buffer.readUint8();
            }
        }
        static serialize(node, buffer) {
            switch (node.category) {
                case RuleCategory.Comment:
                    CommentRuleParser.serialize(node, buffer);
                    break;
                case RuleCategory.Cosmetic:
                    CosmeticRuleParser.serialize(node, buffer);
                    break;
                case RuleCategory.Network:
                    switch (node.type) {
                        case NetworkRuleType.HostRule:
                            HostRuleParser.serialize(node, buffer);
                            break;
                        case NetworkRuleType.NetworkRule:
                            NetworkRuleParser.serialize(node, buffer);
                            break;
                        default:
                            throw new Error('Unknown network rule type');
                    }
                    break;
                case RuleCategory.Empty:
                    RuleParser.serializeEmptyRule(node, buffer);
                    break;
                case RuleCategory.Invalid:
                    RuleParser.serializeInvalidRule(node, buffer);
                    break;
                default:
                    throw new Error('Unknown rule category');
            }
        }
        static deserialize(buffer, node) {
            const type = buffer.peekUint8();
            switch (type) {
                case BinaryTypeMap.AgentRuleNode:
                case BinaryTypeMap.HintRuleNode:
                case BinaryTypeMap.PreProcessorCommentRuleNode:
                case BinaryTypeMap.MetadataCommentRuleNode:
                case BinaryTypeMap.ConfigCommentRuleNode:
                case BinaryTypeMap.CommentRuleNode:
                    CommentRuleParser.deserialize(buffer, node);
                    break;
                case BinaryTypeMap.ElementHidingRule:
                case BinaryTypeMap.CssInjectionRule:
                case BinaryTypeMap.ScriptletInjectionRule:
                case BinaryTypeMap.HtmlFilteringRule:
                case BinaryTypeMap.JsInjectionRule:
                    CosmeticRuleParser.deserialize(buffer, node);
                    break;
                case BinaryTypeMap.NetworkRuleNode:
                    NetworkRuleParser.deserialize(buffer, node);
                    break;
                case BinaryTypeMap.HostRuleNode:
                    HostRuleParser.deserialize(buffer, node);
                    break;
                case BinaryTypeMap.EmptyRule:
                    RuleParser.deserializeEmptyRule(buffer, node);
                    break;
                case BinaryTypeMap.InvalidRule:
                    RuleParser.deserializeInvalidRule(buffer, node);
                    break;
                default:
                    throw new Error('Unknown rule category');
            }
        }
    }
    const APP_LIST_SEPARATOR = PIPE;
    class AppListParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            const result = {
                type: ListNodeType.AppList,
                separator: APP_LIST_SEPARATOR,
                children: parseListItems(raw, options, baseOffset, APP_LIST_SEPARATOR, ListItemNodeType.App),
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
    }
    const METHOD_LIST_SEPARATOR = PIPE;
    class MethodListParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            const result = {
                type: ListNodeType.MethodList,
                separator: METHOD_LIST_SEPARATOR,
                children: parseListItems(raw, options, baseOffset, METHOD_LIST_SEPARATOR, ListItemNodeType.Method),
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
    }
    const STEALTH_OPTION_LIST_SEPARATOR = PIPE;
    class StealthOptionListParser extends ParserBase {
        static parse(raw, options = defaultParserOptions, baseOffset = 0) {
            const result = {
                type: ListNodeType.StealthOptionList,
                separator: STEALTH_OPTION_LIST_SEPARATOR,
                children: parseListItems(raw, options, baseOffset, STEALTH_OPTION_LIST_SEPARATOR, ListItemNodeType.StealthOption),
            };
            if (options.isLocIncluded) {
                result.start = baseOffset;
                result.end = baseOffset + raw.length;
            }
            return result;
        }
    }
    var FilterListNodeSerializationMap;
    (function (FilterListNodeSerializationMap) {
        FilterListNodeSerializationMap[FilterListNodeSerializationMap["Children"] = 1] = "Children";
        FilterListNodeSerializationMap[FilterListNodeSerializationMap["Start"] = 2] = "Start";
        FilterListNodeSerializationMap[FilterListNodeSerializationMap["End"] = 3] = "End";
    })(FilterListNodeSerializationMap || (FilterListNodeSerializationMap = {}));
    const ERROR_NAME$1 = 'RuleConversionError';
    class RuleConversionError extends Error {
        constructor(message) {
            super(message);
            this.name = ERROR_NAME$1;
        }
    }
    ({
        [AdblockSyntax.Adg]: 'adg_',
        [AdblockSyntax.Ubo]: 'ubo_',
        [AdblockSyntax.Abp]: 'abp_',
    });
    const APP_NAME_ALLOWED_CHARS = new Set([
        ...CAPITAL_LETTERS,
        ...SMALL_LETTERS,
        ...NUMBERS,
        UNDERSCORE,
    ]);
    const ALLOWED_METHODS = new Set([
        'connect',
        'delete',
        'get',
        'head',
        'options',
        'patch',
        'post',
        'put',
        'trace',
    ]);
    const ALLOWED_STEALTH_OPTIONS = new Set([
        'searchqueries',
        'donottrack',
        '3p-cookie',
        '1p-cookie',
        '3p-cache',
        '3p-auth',
        'webrtc',
        'push',
        'location',
        'flash',
        'java',
        'referrer',
        'useragent',
        'ip',
        'xclientdata',
        'dpi',
    ]);
    const ALLOWED_CSP_DIRECTIVES = new Set([
        'base-uri',
        'child-src',
        'connect-src',
        'default-src',
        'fenced-frame-src',
        'font-src',
        'form-action',
        'frame-ancestors',
        'frame-src',
        'img-src',
        'manifest-src',
        'media-src',
        'navigate-to',
        'object-src',
        'plugin-types',
        'prefetch-src',
        'referrer',
        'report-to',
        'report-uri',
        'require-trusted-types-for',
        'sandbox',
        'script-src',
        'script-src-attr',
        'script-src-elem',
        'style-src',
        'style-src-attr',
        'style-src-elem',
        'trusted-types',
        'upgrade-insecure-requests',
        'worker-src',
    ]);
    const ALLOWED_PERMISSION_DIRECTIVES = new Set([
        'accelerometer',
        'ambient-light-sensor',
        'autoplay',
        'battery',
        'browsing-topics',
        'camera',
        'display-capture',
        'document-domain',
        'encrypted-media',
        'execution-while-not-rendered',
        'execution-while-out-of-viewport',
        'fullscreen',
        'gamepad',
        'geolocation',
        'gyroscope',
        'hid',
        'identity-credentials-get',
        'idle-detection',
        'join-ad-interest-group',
        'local-fonts',
        'magnetometer',
        'microphone',
        'midi',
        'payment',
        'picture-in-picture',
        'publickey-credentials-create',
        'publickey-credentials-get',
        'run-ad-auction',
        'screen-wake-lock',
        'serial',
        'speaker-selection',
        'storage-access',
        'usb',
        'web-share',
        'xr-spatial-tracking',
    ]);
    const PERMISSIONS_TOKEN_SELF = 'self';
    const EMPTY_PERMISSIONS_ALLOWLIST = `${OPEN_PARENTHESIS}${CLOSE_PARENTHESIS}`;
    const REFERRER_POLICY_DIRECTIVES = new Set([
        'no-referrer',
        'no-referrer-when-downgrade',
        'origin',
        'origin-when-cross-origin',
        'same-origin',
        'strict-origin',
        'strict-origin-when-cross-origin',
        'unsafe-url',
    ]);
    const VALIDATION_ERROR_PREFIX = {
        BLOCK_ONLY: 'Only blocking rules may contain the modifier',
        EXCEPTION_ONLY: 'Only exception rules may contain the modifier',
        INVALID_CSP_DIRECTIVES: 'Invalid CSP directives for the modifier',
        INVALID_LIST_VALUES: 'Invalid values for the modifier',
        INVALID_NOOP: 'Invalid noop modifier',
        INVALID_PERMISSION_DIRECTIVE: 'Invalid Permissions-Policy directive for the modifier',
        INVALID_PERMISSION_ORIGINS: 'Origins in the value is invalid for the modifier and the directive',
        INVALID_PERMISSION_ORIGIN_QUOTES: 'Double quotes should be used for origins in the value of the modifier',
        INVALID_REFERRER_POLICY_DIRECTIVE: 'Invalid Referrer-Policy directive for the modifier',
        MIXED_NEGATIONS: 'Simultaneous usage of negated and not negated values is forbidden for the modifier',
        NO_CSP_VALUE: 'No CSP value for the modifier and the directive',
        NO_CSP_DIRECTIVE_QUOTE: 'CSP directives should no be quoted for the modifier',
        NO_UNESCAPED_PERMISSION_COMMA: 'Unescaped comma in the value is not allowed for the modifier',
        NOT_EXISTENT: 'Non-existent modifier',
        NOT_NEGATABLE_MODIFIER: 'Non-negatable modifier',
        NOT_NEGATABLE_VALUE: 'Values cannot be negated for the modifier',
        NOT_SUPPORTED: 'The adblocker does not support the modifier',
        REMOVED: 'Removed and no longer supported modifier',
        VALUE_FORBIDDEN: 'Value is not allowed for the modifier',
        VALUE_INVALID: 'Value is invalid for the modifier',
        VALUE_REQUIRED: 'Value is required for the modifier',
    };
    const getInvalidValidationResult = (error) => {
        return {
            valid: false,
            error,
        };
    };
    const getValueRequiredValidationResult = (modifierName) => {
        return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.VALUE_REQUIRED}: '${modifierName}'`);
    };
    const WILDCARD_TLD = DOT + WILDCARD;
    const WILDCARD_SUBDOMAIN = WILDCARD + DOT;
    class DomainUtils {
        static isValidDomainOrHostname(domain) {
            let domainToCheck = domain;
            if (domainToCheck === WILDCARD) {
                return true;
            }
            if (domainToCheck.endsWith(WILDCARD_TLD)) {
                domainToCheck = domainToCheck.substring(0, domainToCheck.length - WILDCARD_TLD.length);
            }
            if (domainToCheck.startsWith(WILDCARD_SUBDOMAIN)) {
                domainToCheck = domainToCheck.substring(WILDCARD_SUBDOMAIN.length);
            }
            const tldtsResult = parse(domainToCheck);
            return domainToCheck === tldtsResult.domain || domainToCheck === tldtsResult.hostname;
        }
    }
    var CustomValueFormatValidatorName;
    (function (CustomValueFormatValidatorName) {
        CustomValueFormatValidatorName["App"] = "pipe_separated_apps";
        CustomValueFormatValidatorName["Csp"] = "csp_value";
        CustomValueFormatValidatorName["DenyAllow"] = "pipe_separated_denyallow_domains";
        CustomValueFormatValidatorName["Domain"] = "pipe_separated_domains";
        CustomValueFormatValidatorName["Method"] = "pipe_separated_methods";
        CustomValueFormatValidatorName["Permissions"] = "permissions_value";
        CustomValueFormatValidatorName["ReferrerPolicy"] = "referrerpolicy_value";
        CustomValueFormatValidatorName["StealthOption"] = "pipe_separated_stealth_options";
    })(CustomValueFormatValidatorName || (CustomValueFormatValidatorName = {}));
    const isValidAppNameChunk = (chunk) => {
        if (chunk.length === 0) {
            return false;
        }
        for (let i = 0; i < chunk.length; i += 1) {
            const char = chunk[i];
            if (!APP_NAME_ALLOWED_CHARS.has(char)) {
                return false;
            }
        }
        return true;
    };
    const isValidAppModifierValue = (value) => {
        if (value.includes(WILDCARD)) {
            return false;
        }
        return value
            .split(DOT)
            .every((chunk) => isValidAppNameChunk(chunk));
    };
    const isValidMethodModifierValue = (value) => {
        return ALLOWED_METHODS.has(value);
    };
    const isValidStealthModifierValue = (value) => {
        return ALLOWED_STEALTH_OPTIONS.has(value);
    };
    const isValidPermissionsOrigin = (rawOrigin) => {
        const actualQuoteType = QuoteUtils.getStringQuoteType(rawOrigin);
        if (actualQuoteType !== QuoteType.Double) {
            return false;
        }
        const origin = QuoteUtils.removeQuotes(rawOrigin);
        try {
            new URL(origin);
        }
        catch (e) {
            return false;
        }
        return true;
    };
    const isValidDenyAllowModifierValue = (value) => {
        if (value.includes(WILDCARD)) {
            return false;
        }
        return DomainUtils.isValidDomainOrHostname(value);
    };
    const isValidDomainModifierValue = (value) => {
        return DomainUtils.isValidDomainOrHostname(value);
    };
    const customNoNegatedListItemsValidator = (modifierName, listItems) => {
        const negatedValues = [];
        listItems.forEach((listItem) => {
            if (listItem.exception) {
                negatedValues.push(listItem.value);
            }
        });
        if (negatedValues.length > 0) {
            const valuesToStr = QuoteUtils.quoteAndJoinStrings(negatedValues);
            return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.NOT_NEGATABLE_VALUE}: '${modifierName}': ${valuesToStr}`);
        }
        return { valid: true };
    };
    const customConsistentExceptionsValidator = (modifierName, listItems) => {
        const firstException = listItems[0].exception;
        const nonConsistentItemValues = [];
        listItems.forEach((listItem) => {
            if (listItem.exception !== firstException) {
                nonConsistentItemValues.push(listItem.value);
            }
        });
        if (nonConsistentItemValues.length > 0) {
            const valuesToStr = QuoteUtils.quoteAndJoinStrings(nonConsistentItemValues);
            return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.MIXED_NEGATIONS}: '${modifierName}': ${valuesToStr}`);
        }
        return { valid: true };
    };
    const validateListItemsModifier = (modifier, listParser, isValidListItem, customListValidator) => {
        const modifierName = modifier.name.value;
        const defaultInvalidValueResult = getValueRequiredValidationResult(modifierName);
        if (!modifier.value?.value) {
            return defaultInvalidValueResult;
        }
        let theList;
        try {
            theList = listParser(modifier.value.value, defaultParserOptions, 0, PIPE);
        }
        catch (e) {
            if (e instanceof AdblockSyntaxError) {
                return {
                    valid: false,
                    error: e.message,
                };
            }
            return defaultInvalidValueResult;
        }
        const invalidListItems = [];
        theList.children.forEach((item) => {
            if (!isValidListItem(item.value)) {
                invalidListItems.push(item.value);
            }
        });
        if (invalidListItems.length > 0) {
            const itemsToStr = QuoteUtils.quoteAndJoinStrings(invalidListItems);
            return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.INVALID_LIST_VALUES}: '${modifierName}': ${itemsToStr}`);
        }
        if (customListValidator) {
            return customListValidator(modifierName, theList.children);
        }
        return { valid: true };
    };
    const validatePipeSeparatedApps = (modifier) => {
        return validateListItemsModifier(modifier, (raw) => AppListParser.parse(raw), isValidAppModifierValue);
    };
    const validatePipeSeparatedDenyAllowDomains = (modifier) => {
        return validateListItemsModifier(modifier, DomainListParser.parse, isValidDenyAllowModifierValue, customNoNegatedListItemsValidator);
    };
    const validatePipeSeparatedDomains = (modifier) => {
        return validateListItemsModifier(modifier, DomainListParser.parse, isValidDomainModifierValue);
    };
    const validatePipeSeparatedMethods = (modifier) => {
        return validateListItemsModifier(modifier, (raw) => MethodListParser.parse(raw), isValidMethodModifierValue, customConsistentExceptionsValidator);
    };
    const validatePipeSeparatedStealthOptions = (modifier) => {
        return validateListItemsModifier(modifier, (raw) => StealthOptionListParser.parse(raw), isValidStealthModifierValue, customNoNegatedListItemsValidator);
    };
    const validateCspValue = (modifier) => {
        const modifierName = modifier.name.value;
        if (!modifier.value?.value) {
            return getValueRequiredValidationResult(modifierName);
        }
        const policyDirectives = modifier.value.value
            .split(SEMICOLON)
            .filter((i) => !!i);
        const invalidValueValidationResult = getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.VALUE_INVALID}: '${modifierName}': "${modifier.value.value}"`);
        if (policyDirectives.length === 0) {
            return invalidValueValidationResult;
        }
        const invalidDirectives = [];
        for (let i = 0; i < policyDirectives.length; i += 1) {
            const policyDirective = policyDirectives[i].trim();
            if (!policyDirective) {
                return invalidValueValidationResult;
            }
            const chunks = policyDirective.split(SPACE);
            const [directive, ...valueChunks] = chunks;
            if (!directive) {
                return invalidValueValidationResult;
            }
            if (!ALLOWED_CSP_DIRECTIVES.has(directive)) {
                if (ALLOWED_CSP_DIRECTIVES.has(QuoteUtils.removeQuotes(directive))) {
                    return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.NO_CSP_DIRECTIVE_QUOTE}: '${modifierName}': ${directive}`);
                }
                invalidDirectives.push(directive);
                continue;
            }
            if (valueChunks.length === 0) {
                return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.NO_CSP_VALUE}: '${modifierName}': '${directive}'`);
            }
        }
        if (invalidDirectives.length > 0) {
            const directivesToStr = QuoteUtils.quoteAndJoinStrings(invalidDirectives, QuoteType.Double);
            return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.INVALID_CSP_DIRECTIVES}: '${modifierName}': ${directivesToStr}`);
        }
        return { valid: true };
    };
    const validatePermissionAllowlistOrigins = (allowlistChunks, directive, modifierName) => {
        const invalidOrigins = [];
        for (let i = 0; i < allowlistChunks.length; i += 1) {
            const chunk = allowlistChunks[i].trim();
            if (chunk.length === 0) {
                continue;
            }
            if (chunk.toLowerCase() === PERMISSIONS_TOKEN_SELF) {
                continue;
            }
            if (QuoteUtils.getStringQuoteType(chunk) !== QuoteType.Double) {
                return getInvalidValidationResult(
                `${VALIDATION_ERROR_PREFIX.INVALID_PERMISSION_ORIGIN_QUOTES}: '${modifierName}': '${directive}': '${QuoteUtils.removeQuotes(chunk)}'`);
            }
            if (!isValidPermissionsOrigin(chunk)) {
                invalidOrigins.push(chunk);
            }
        }
        if (invalidOrigins.length > 0) {
            const originsToStr = QuoteUtils.quoteAndJoinStrings(invalidOrigins);
            return getInvalidValidationResult(
            `${VALIDATION_ERROR_PREFIX.INVALID_PERMISSION_ORIGINS}: '${modifierName}': '${directive}': ${originsToStr}`);
        }
        return { valid: true };
    };
    const validatePermissionAllowlist = (allowlist, directive, modifierName) => {
        if (allowlist === WILDCARD
            || allowlist === EMPTY_PERMISSIONS_ALLOWLIST) {
            return { valid: true };
        }
        if (!(allowlist.startsWith(OPEN_PARENTHESIS) && allowlist.endsWith(CLOSE_PARENTHESIS))) {
            return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.VALUE_INVALID}: '${modifierName}'`);
        }
        const allowlistChunks = allowlist.slice(1, -1).split(SPACE);
        return validatePermissionAllowlistOrigins(allowlistChunks, directive, modifierName);
    };
    const validateSinglePermission = (permission, modifierName, modifierValue) => {
        if (!permission) {
            return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.VALUE_INVALID}: '${modifierName}'`);
        }
        if (permission.includes(COMMA)) {
            return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.NO_UNESCAPED_PERMISSION_COMMA}: '${modifierName}': '${modifierValue}'`);
        }
        const [directive, allowlist] = permission.split(EQUALS);
        if (!ALLOWED_PERMISSION_DIRECTIVES.has(directive)) {
            return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.INVALID_PERMISSION_DIRECTIVE}: '${modifierName}': '${directive}'`);
        }
        return validatePermissionAllowlist(allowlist, directive, modifierName);
    };
    const validatePermissions = (modifier) => {
        if (!modifier.value?.value) {
            return getValueRequiredValidationResult(modifier.name.value);
        }
        const modifierName = modifier.name.value;
        const modifierValue = modifier.value.value;
        const permissions = modifier.value.value.split(`${BACKSLASH}${COMMA}`);
        for (let i = 0; i < permissions.length; i += 1) {
            const permission = permissions[i].trim();
            const singlePermissionValidationResult = validateSinglePermission(permission, modifierName, modifierValue);
            if (!singlePermissionValidationResult.valid) {
                return singlePermissionValidationResult;
            }
        }
        return { valid: true };
    };
    const validateReferrerPolicy = (modifier) => {
        if (!modifier.value?.value) {
            return getValueRequiredValidationResult(modifier.name.value);
        }
        const modifierName = modifier.name.value;
        const modifierValue = modifier.value.value;
        if (!REFERRER_POLICY_DIRECTIVES.has(modifierValue)) {
            return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.INVALID_REFERRER_POLICY_DIRECTIVE}: '${modifierName}': '${modifierValue}'`);
        }
        return { valid: true };
    };
    ({
        [CustomValueFormatValidatorName.App]: validatePipeSeparatedApps,
        [CustomValueFormatValidatorName.Csp]: validateCspValue,
        [CustomValueFormatValidatorName.DenyAllow]: validatePipeSeparatedDenyAllowDomains,
        [CustomValueFormatValidatorName.Domain]: validatePipeSeparatedDomains,
        [CustomValueFormatValidatorName.Method]: validatePipeSeparatedMethods,
        [CustomValueFormatValidatorName.Permissions]: validatePermissions,
        [CustomValueFormatValidatorName.ReferrerPolicy]: validateReferrerPolicy,
        [CustomValueFormatValidatorName.StealthOption]: validatePipeSeparatedStealthOptions,
    });
    function clone(value) {
        return cloneDeep$1(value);
    }
    var SpecificPlatform;
    (function (SpecificPlatform) {
        SpecificPlatform[SpecificPlatform["AdgOsWindows"] = 1] = "AdgOsWindows";
        SpecificPlatform[SpecificPlatform["AdgOsMac"] = 2] = "AdgOsMac";
        SpecificPlatform[SpecificPlatform["AdgOsAndroid"] = 4] = "AdgOsAndroid";
        SpecificPlatform[SpecificPlatform["AdgExtChrome"] = 8] = "AdgExtChrome";
        SpecificPlatform[SpecificPlatform["AdgExtOpera"] = 16] = "AdgExtOpera";
        SpecificPlatform[SpecificPlatform["AdgExtEdge"] = 32] = "AdgExtEdge";
        SpecificPlatform[SpecificPlatform["AdgExtFirefox"] = 64] = "AdgExtFirefox";
        SpecificPlatform[SpecificPlatform["AdgCbAndroid"] = 128] = "AdgCbAndroid";
        SpecificPlatform[SpecificPlatform["AdgCbIos"] = 256] = "AdgCbIos";
        SpecificPlatform[SpecificPlatform["AdgCbSafari"] = 512] = "AdgCbSafari";
        SpecificPlatform[SpecificPlatform["UboExtChrome"] = 1024] = "UboExtChrome";
        SpecificPlatform[SpecificPlatform["UboExtOpera"] = 2048] = "UboExtOpera";
        SpecificPlatform[SpecificPlatform["UboExtEdge"] = 4096] = "UboExtEdge";
        SpecificPlatform[SpecificPlatform["UboExtFirefox"] = 8192] = "UboExtFirefox";
        SpecificPlatform[SpecificPlatform["AbpExtChrome"] = 16384] = "AbpExtChrome";
        SpecificPlatform[SpecificPlatform["AbpExtOpera"] = 32768] = "AbpExtOpera";
        SpecificPlatform[SpecificPlatform["AbpExtEdge"] = 65536] = "AbpExtEdge";
        SpecificPlatform[SpecificPlatform["AbpExtFirefox"] = 131072] = "AbpExtFirefox";
    })(SpecificPlatform || (SpecificPlatform = {}));
    var GenericPlatform;
    (function (GenericPlatform) {
        GenericPlatform[GenericPlatform["AdgOsAny"] = 7] = "AdgOsAny";
        GenericPlatform[GenericPlatform["AdgSafariAny"] = 768] = "AdgSafariAny";
        GenericPlatform[GenericPlatform["AdgExtChromium"] = 56] = "AdgExtChromium";
        GenericPlatform[GenericPlatform["AdgExtAny"] = 120] = "AdgExtAny";
        GenericPlatform[GenericPlatform["AdgAny"] = 1023] = "AdgAny";
        GenericPlatform[GenericPlatform["UboExtChromium"] = 7168] = "UboExtChromium";
        GenericPlatform[GenericPlatform["UboExtAny"] = 15360] = "UboExtAny";
        GenericPlatform[GenericPlatform["UboAny"] = 15360] = "UboAny";
        GenericPlatform[GenericPlatform["AbpExtChromium"] = 114688] = "AbpExtChromium";
        GenericPlatform[GenericPlatform["AbpExtAny"] = 245760] = "AbpExtAny";
        GenericPlatform[GenericPlatform["AbpAny"] = 245760] = "AbpAny";
        GenericPlatform[GenericPlatform["Any"] = 262143] = "Any";
    })(GenericPlatform || (GenericPlatform = {}));
    const SPECIFIC_PLATFORM_MAP = new Map([
        ['adg_os_windows', SpecificPlatform.AdgOsWindows],
        ['adg_os_mac', SpecificPlatform.AdgOsMac],
        ['adg_os_android', SpecificPlatform.AdgOsAndroid],
        ['adg_ext_chrome', SpecificPlatform.AdgExtChrome],
        ['adg_ext_opera', SpecificPlatform.AdgExtOpera],
        ['adg_ext_edge', SpecificPlatform.AdgExtEdge],
        ['adg_ext_firefox', SpecificPlatform.AdgExtFirefox],
        ['adg_cb_android', SpecificPlatform.AdgCbAndroid],
        ['adg_cb_ios', SpecificPlatform.AdgCbIos],
        ['adg_cb_safari', SpecificPlatform.AdgCbSafari],
        ['ubo_ext_chrome', SpecificPlatform.UboExtChrome],
        ['ubo_ext_opera', SpecificPlatform.UboExtOpera],
        ['ubo_ext_edge', SpecificPlatform.UboExtEdge],
        ['ubo_ext_firefox', SpecificPlatform.UboExtFirefox],
        ['abp_ext_chrome', SpecificPlatform.AbpExtChrome],
        ['abp_ext_opera', SpecificPlatform.AbpExtOpera],
        ['abp_ext_edge', SpecificPlatform.AbpExtEdge],
        ['abp_ext_firefox', SpecificPlatform.AbpExtFirefox],
    ]);
    new Map([...SPECIFIC_PLATFORM_MAP].map(([key, value]) => [value, key]));
    const GENERIC_PLATFORM_MAP = new Map([
        ['adg_os_any', GenericPlatform.AdgOsAny],
        ['adg_safari_any', GenericPlatform.AdgSafariAny],
        ['adg_ext_chromium', GenericPlatform.AdgExtChromium],
        ['adg_ext_any', GenericPlatform.AdgExtAny],
        ['adg_any', GenericPlatform.AdgAny],
        ['ubo_ext_chromium', GenericPlatform.UboExtChromium],
        ['ubo_ext_any', GenericPlatform.UboExtAny],
        ['ubo_any', GenericPlatform.UboAny],
        ['abp_ext_chromium', GenericPlatform.AbpExtChromium],
        ['abp_ext_any', GenericPlatform.AbpExtAny],
        ['abp_any', GenericPlatform.AbpAny],
        ['any', GenericPlatform.Any],
    ]);
    const isGenericPlatform = (platform) => {
        return !!(platform & (platform - 1));
    };
    class CompatibilityTableBase {
        data;
        nameTransformer;
        constructor(data, nameTransformer = null) {
            this.data = data;
            this.nameTransformer = nameTransformer;
        }
        getRowStorage(name) {
            const idx = this.data.map[name];
            if (isUndefined$1(idx)) {
                return null;
            }
            return this.data.shared[idx];
        }
        existsAny(name) {
            const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
            return !isUndefined$1(this.data.map[normalizedName]);
        }
        exists(name, platform) {
            const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
            const data = this.getRowStorage(normalizedName);
            if (!data) {
                return false;
            }
            const isMatch = (idx) => {
                const el = data.shared[idx];
                return !isUndefined$1(el) && (el.name === normalizedName || !!el.aliases?.includes(normalizedName));
            };
            if (isGenericPlatform(platform)) {
                const keys = Object.keys(data.map);
                for (let i = 0; i < keys.length; i += 1) {
                    const key = Number(keys[i]);
                    if (platform & key) {
                        const idx = data.map[key];
                        if (isMatch(idx)) {
                            return true;
                        }
                    }
                }
                return false;
            }
            const idx = data.map[platform];
            return isMatch(idx);
        }
        getSingle(name, platform) {
            const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
            const data = this.getRowStorage(normalizedName);
            if (!data) {
                return null;
            }
            const idx = data.map[platform];
            return isUndefined$1(idx) ? null : data.shared[idx];
        }
        getMultiple(name, platform) {
            const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
            const data = this.getRowStorage(normalizedName);
            if (!data) {
                return null;
            }
            if (isGenericPlatform(platform)) {
                const result = {};
                const keys = Object.keys(data.map);
                for (let i = 0; i < keys.length; i += 1) {
                    const key = Number(keys[i]);
                    if (platform & key) {
                        const idx = data.map[key];
                        if (!isUndefined$1(idx)) {
                            result[key] = data.shared[idx];
                        }
                    }
                }
                return result;
            }
            const idx = data.map[platform];
            if (isUndefined$1(idx)) {
                return null;
            }
            return { key: data.shared[idx] };
        }
        getAllMultiple(platform) {
            const result = [];
            for (let i = 0; i < this.data.shared.length; i += 1) {
                const data = this.data.shared[i];
                const names = new Set(data.shared.map(({ name }) => name));
                names.forEach((name) => {
                    const multipleRecords = this.getMultiple(name, platform);
                    if (multipleRecords) {
                        result.push(multipleRecords);
                    }
                });
            }
            return result;
        }
        getFirst(name, platform) {
            const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
            const data = this.getRowStorage(normalizedName);
            if (!data) {
                return null;
            }
            if (isGenericPlatform(platform)) {
                const keys = Object.keys(data.map);
                for (let i = 0; i < keys.length; i += 1) {
                    const key = Number(keys[i]);
                    if (platform & key) {
                        const idx = data.map[key];
                        if (!isUndefined$1(idx)) {
                            return data.shared[idx];
                        }
                    }
                }
                return null;
            }
            const idx = data.map[platform];
            if (isUndefined$1(idx)) {
                return null;
            }
            return data.shared[idx];
        }
        getRow(name) {
            const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
            const data = this.getRowStorage(normalizedName);
            if (!data) {
                return [];
            }
            return data.shared;
        }
        getRowsByProduct() {
            const result = [];
            for (let i = 0; i < this.data.shared.length; i += 1) {
                const data = this.data.shared[i];
                const keys = Object.keys(data.map);
                const row = {
                    [AdblockSyntax.Adg]: {},
                    [AdblockSyntax.Ubo]: {},
                    [AdblockSyntax.Abp]: {},
                };
                for (let j = 0; j < keys.length; j += 1) {
                    const key = Number(keys[j]);
                    if (key & GenericPlatform.AdgAny) {
                        row[AdblockSyntax.Adg][key] = data.shared[data.map[key]];
                    }
                    else if (key & GenericPlatform.UboAny) {
                        row[AdblockSyntax.Ubo][key] = data.shared[data.map[key]];
                    }
                    else if (key & GenericPlatform.AbpAny) {
                        row[AdblockSyntax.Abp][key] = data.shared[data.map[key]];
                    }
                }
                result.push(row);
            }
            return result;
        }
    }
    const deepFreeze = (object) => {
        const propNames = Reflect.ownKeys(object);
        for (const name of propNames) {
            const value = object[name];
            if ((value && typeof value === 'object') || typeof value === 'function') {
                deepFreeze(value);
            }
        }
        return Object.freeze(object);
    };
    const noopModifierNameNormalizer = (name) => {
        if (name.startsWith(UNDERSCORE)) {
            if (name.split(EMPTY).every((char) => char === UNDERSCORE)) {
                return UNDERSCORE;
            }
        }
        return name;
    };
    class ModifiersCompatibilityTable extends CompatibilityTableBase {
        constructor(data) {
            super(data, noopModifierNameNormalizer);
        }
    }
    deepFreeze(modifiersCompatibilityTableData_1);
    const modifiersCompatibilityTable = new ModifiersCompatibilityTable(modifiersCompatibilityTableData_1);
    class ConverterBase {
        static convertToAdg(data) {
            throw new NotImplementedError();
        }
        static convertToAbp(data) {
            throw new NotImplementedError();
        }
        static convertToUbo(data) {
            throw new NotImplementedError();
        }
    }
    class RuleConverterBase extends ConverterBase {
        static convertToAdg(rule) {
            throw new NotImplementedError();
        }
        static convertToAbp(rule) {
            throw new NotImplementedError();
        }
        static convertToUbo(rule) {
            throw new NotImplementedError();
        }
    }
    function createConversionResult(result, isConverted) {
        return {
            result,
            isConverted,
        };
    }
    function createNodeConversionResult(nodes, isConverted) {
        return createConversionResult(nodes, isConverted);
    }
    class CommentRuleConverter extends RuleConverterBase {
        static convertToAdg(rule) {
            switch (rule.type) {
                case CommentRuleType.CommentRule:
                    if (rule.type === CommentRuleType.CommentRule && rule.marker.value === CommentMarker.Hashmark) {
                        const ruleClone = clone(rule);
                        ruleClone.marker.value = CommentMarker.Regular;
                        ruleClone.text.value = `${SPACE}${CommentMarker.Hashmark}${ruleClone.text.value}`;
                        return createNodeConversionResult([ruleClone], true);
                    }
                    return createNodeConversionResult([rule], false);
                default:
                    return createNodeConversionResult([rule], false);
            }
        }
    }
    const REGEX_START = CARET;
    const REGEX_END = DOLLAR_SIGN;
    const REGEX_ANY_CHARACTERS = DOT + ASTERISK;
    const ADBLOCK_URL_START = PIPE + PIPE;
    const ADBLOCK_URL_START_REGEX = '^(http|https|ws|wss)://([a-z0-9-_.]+\\.)?';
    const ADBLOCK_URL_SEPARATOR = CARET;
    const ADBLOCK_URL_SEPARATOR_REGEX = '([^ a-zA-Z0-9.%_-]|$)';
    const ADBLOCK_WILDCARD = ASTERISK;
    const ADBLOCK_WILDCARD_REGEX = REGEX_ANY_CHARACTERS;
    const REGEX_NEGATION_PREFIX = '^((?!';
    const REGEX_NEGATION_SUFFIX = ').)*$';
    const SPECIAL_REGEX_SYMBOLS = new Set([
        ASTERISK,
        CARET,
        CLOSE_CURLY_BRACKET,
        CLOSE_PARENTHESIS,
        CLOSE_SQUARE_BRACKET,
        DOLLAR_SIGN,
        DOT,
        ESCAPE_CHARACTER,
        OPEN_CURLY_BRACKET,
        OPEN_PARENTHESIS,
        OPEN_SQUARE_BRACKET,
        PIPE,
        PLUS,
        QUESTION_MARK,
        SLASH,
    ]);
    class RegExpUtils {
        static isRegexPattern(pattern) {
            const trimmedPattern = pattern.trim();
            return trimmedPattern.length > REGEX_MARKER.length * 2
                && trimmedPattern.startsWith(REGEX_MARKER)
                && trimmedPattern.endsWith(REGEX_MARKER)
                && trimmedPattern[REGEX_MARKER.length - 2] !== ESCAPE_CHARACTER;
        }
        static negateRegexPattern(pattern) {
            let result = pattern.trim();
            let slashes = false;
            if (RegExpUtils.isRegexPattern(result)) {
                result = result.substring(REGEX_MARKER.length, result.length - REGEX_MARKER.length);
                slashes = true;
            }
            if (!(result.startsWith(REGEX_NEGATION_PREFIX) && result.endsWith(REGEX_NEGATION_SUFFIX))) {
                if (result.startsWith(REGEX_START)) {
                    result = result.substring(REGEX_START.length);
                }
                if (result.endsWith(REGEX_END)) {
                    result = result.substring(0, result.length - REGEX_END.length);
                }
                result = `${REGEX_NEGATION_PREFIX}${result}${REGEX_NEGATION_SUFFIX}`;
            }
            if (slashes) {
                result = `${REGEX_MARKER}${result}${REGEX_MARKER}`;
            }
            return result;
        }
        static patternToRegexp(pattern) {
            const trimmed = pattern.trim();
            if (trimmed === ADBLOCK_URL_START
                || trimmed === PIPE
                || trimmed === ADBLOCK_WILDCARD
                || trimmed === EMPTY) {
                return REGEX_ANY_CHARACTERS;
            }
            if (RegExpUtils.isRegexPattern(pattern)) {
                return pattern.substring(REGEX_MARKER.length, pattern.length - REGEX_MARKER.length);
            }
            let result = EMPTY;
            let offset = 0;
            let len = trimmed.length;
            if (trimmed[0] === PIPE) {
                if (trimmed[1] === PIPE) {
                    result += ADBLOCK_URL_START_REGEX;
                    offset = ADBLOCK_URL_START.length;
                }
                else {
                    result += REGEX_START;
                    offset = REGEX_START.length;
                }
            }
            let trailingPipe = false;
            if (trimmed.endsWith(PIPE)) {
                trailingPipe = true;
                len -= PIPE.length;
            }
            for (; offset < len; offset += 1) {
                if (trimmed[offset] === ADBLOCK_WILDCARD) {
                    result += ADBLOCK_WILDCARD_REGEX;
                }
                else if (trimmed[offset] === ADBLOCK_URL_SEPARATOR) {
                    result += ADBLOCK_URL_SEPARATOR_REGEX;
                }
                else if (SPECIAL_REGEX_SYMBOLS.has(trimmed[offset])) {
                    result += ESCAPE_CHARACTER + trimmed[offset];
                }
                else {
                    result += trimmed[offset];
                }
            }
            if (trailingPipe) {
                result += REGEX_END;
            }
            return result;
        }
    }
    function cloneScriptletRuleNode(node) {
        return {
            type: node.type,
            children: node.children.map((child) => (isNull$1(child) ? null : { ...child })),
        };
    }
    function cloneDomainListNode(node) {
        return {
            type: node.type,
            separator: node.separator,
            children: node.children.map((domain) => ({ ...domain })),
        };
    }
    function cloneModifierListNode(node) {
        return {
            type: node.type,
            children: node.children.map((modifier) => {
                const res = {
                    type: modifier.type,
                    exception: modifier.exception,
                    name: { ...modifier.name },
                };
                if (modifier.value) {
                    res.value = { ...modifier.value };
                }
                return res;
            }),
        };
    }
    const ADG_HTML_DEFAULT_MAX_LENGTH = 8192;
    const ADG_HTML_CONVERSION_MAX_LENGTH = ADG_HTML_DEFAULT_MAX_LENGTH * 32;
    const NOT_SPECIFIED = -1;
    var PseudoClasses$1;
    (function (PseudoClasses) {
        PseudoClasses["Contains"] = "contains";
        PseudoClasses["HasText"] = "has-text";
        PseudoClasses["MinTextLength"] = "min-text-length";
    })(PseudoClasses$1 || (PseudoClasses$1 = {}));
    var AttributeSelectors;
    (function (AttributeSelectors) {
        AttributeSelectors["MaxLength"] = "max-length";
        AttributeSelectors["MinLength"] = "min-length";
        AttributeSelectors["TagContent"] = "tag-content";
        AttributeSelectors["Wildcard"] = "wildcard";
    })(AttributeSelectors || (AttributeSelectors = {}));
    const SUPPORTED_UBO_PSEUDO_CLASSES = new Set([
        PseudoClasses$1.Contains,
        PseudoClasses$1.HasText,
        PseudoClasses$1.MinTextLength,
    ]);
    const ERROR_MESSAGES$2 = {
        ABP_NOT_SUPPORTED: 'Invalid rule, ABP does not support HTML filtering rules',
        TAG_SHOULD_BE_FIRST_CHILD: "Unexpected token '%s' with value '%s', tag selector should be the first child",
        EXPECTED_BUT_GOT_WITH_VALUE: "Expected '%s', but got '%s' with value '%s'",
        INVALID_ATTRIBUTE_NAME: "Attribute name should be an identifier, but got '%s' with value '%s'",
        INVALID_ATTRIBUTE_VALUE: `Expected '${getFormattedTokenName(TokenType$1.Ident)}' or '${getFormattedTokenName(TokenType$1.String)}' as attribute value, but got '%s' with value '%s`,
        INVALID_FLAG: "Unsupported attribute selector flag '%s'",
        INVALID_OPERATOR_FOR_ATTR: "Unsupported operator '%s' for '%s' attribute",
        VALUE_FOR_ATTR_SHOULD_BE_INT: "Value for '%s' attribute should be an integer, but got '%s'",
        INVALID_PSEUDO_CLASS: "Unsupported pseudo class '%s'",
        VALUE_FOR_PSEUDO_CLASS_SHOULD_BE_INT: "Value for '%s' pseudo class should be an integer, but got '%s'",
        REGEXP_NOT_SUPPORTED: "Cannot convert RegExp parameter '%s' from '%s' pseudo class, because converting RegExp patterns are not supported yet",
        ATTRIBUTE_SELECTOR_REQUIRES_VALUE: "Attribute selector '%s' requires a value",
        INVALID_ATTRIBUTE_SELECTOR_OPERATOR: "Unsupported attribute selector operator '%s'",
        VALUE_SHOULD_BE_SPECIFIED: 'Value should be specified if operator is specified',
        OPERATOR_SHOULD_BE_SPECIFIED: 'Operator should be specified if value is specified',
        UNEXPECTED_TOKEN_WITH_VALUE: "Unexpected token '%s' with value '%s'",
        FLAGS_NOT_SUPPORTED: 'Flags are not supported for attribute selectors',
    };
    function escapeDoubleQuotes(selector) {
        let withinString = false;
        const buffer = [];
        for (let i = 0; i < selector.length; i += 1) {
            if (!withinString && selector[i] === DOUBLE_QUOTE_MARKER) {
                withinString = true;
                buffer.push(selector[i]);
            }
            else if (withinString && selector[i] === DOUBLE_QUOTE_MARKER && selector[i + 1] === DOUBLE_QUOTE_MARKER) {
                buffer.push(ESCAPE_CHARACTER);
                buffer.push(DOUBLE_QUOTE_MARKER);
                i += 1;
            }
            else if (withinString && selector[i] === DOUBLE_QUOTE_MARKER && selector[i + 1] !== DOUBLE_QUOTE_MARKER) {
                buffer.push(DOUBLE_QUOTE_MARKER);
                withinString = false;
            }
            else {
                buffer.push(selector[i]);
            }
        }
        return buffer.join(EMPTY);
    }
    function unescapeDoubleQuotes(selector) {
        let withinString = false;
        const buffer = [];
        for (let i = 0; i < selector.length; i += 1) {
            if (selector[i] === DOUBLE_QUOTE_MARKER && selector[i - 1] !== ESCAPE_CHARACTER) {
                withinString = !withinString;
                buffer.push(selector[i]);
            }
            else if (withinString && selector[i] === ESCAPE_CHARACTER && selector[i + 1] === DOUBLE_QUOTE_MARKER) {
                buffer.push(DOUBLE_QUOTE_MARKER);
            }
            else {
                buffer.push(selector[i]);
            }
        }
        return buffer.join(EMPTY);
    }
    function renderAttrSelector(attr, op, value, flags) {
        const result = [];
        result.push(OPEN_SQUARE_BRACKET);
        result.push(attr);
        if (op !== undefined) {
            if (value === undefined) {
                throw new Error(ERROR_MESSAGES$2.VALUE_SHOULD_BE_SPECIFIED);
            }
            result.push(op);
        }
        if (value !== undefined) {
            if (!op) {
                throw new Error(ERROR_MESSAGES$2.OPERATOR_SHOULD_BE_SPECIFIED);
            }
            result.push(DOUBLE_QUOTE_MARKER);
            result.push(value);
            result.push(DOUBLE_QUOTE_MARKER);
        }
        if (flags !== undefined) {
            result.push(SPACE);
            result.push(flags);
        }
        result.push(CLOSE_SQUARE_BRACKET);
        return result.join(EMPTY);
    }
    class HtmlRuleConverter extends RuleConverterBase {
        static convertToAdg(rule) {
            if (rule.syntax === AdblockSyntax.Adg) {
                return createNodeConversionResult([rule], false);
            }
            if (rule.syntax === AdblockSyntax.Abp) {
                throw new RuleConversionError(ERROR_MESSAGES$2.ABP_NOT_SUPPORTED);
            }
            const source = escapeDoubleQuotes(rule.body.value);
            const stream = new CssTokenStream(source);
            const convertedSelector = [];
            const convertedSelectorList = [];
            let minLen = NOT_SPECIFIED;
            let maxLen = NOT_SPECIFIED;
            stream.skipWhitespace();
            stream.expect(TokenType$1.Delim, { value: UBO_HTML_MASK });
            stream.advance();
            while (!stream.isEof()) {
                const token = stream.getOrFail();
                if (token.type === TokenType$1.Ident) {
                    if (convertedSelector.length !== 0 && stream.lookbehindForNonWs() !== undefined) {
                        throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.TAG_SHOULD_BE_FIRST_CHILD, getFormattedTokenName(token.type), source.slice(token.start, token.end)));
                    }
                    convertedSelector.push(source.slice(token.start, token.end));
                    stream.advance();
                }
                else if (token.type === TokenType$1.OpenSquareBracket) {
                    const { start } = token;
                    let tempToken;
                    stream.advance();
                    stream.skipWhitespace();
                    tempToken = stream.getOrFail();
                    if (tempToken.type !== TokenType$1.Ident) {
                        throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.INVALID_ATTRIBUTE_NAME, getFormattedTokenName(tempToken.type), source.slice(tempToken.start, tempToken.end)));
                    }
                    const attr = source.slice(tempToken.start, tempToken.end);
                    stream.advance();
                    stream.skipWhitespace();
                    tempToken = stream.getOrFail();
                    if (tempToken.type === TokenType$1.CloseSquareBracket) {
                        const { end } = tempToken;
                        stream.advance();
                        if (attr === AttributeSelectors.MinLength || attr === AttributeSelectors.MaxLength) {
                            throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.ATTRIBUTE_SELECTOR_REQUIRES_VALUE, attr));
                        }
                        convertedSelector.push(source.slice(start, end));
                        continue;
                    }
                    stream.expect(TokenType$1.Delim, { value: EQUALS });
                    stream.advance();
                    stream.skipWhitespace();
                    tempToken = stream.getOrFail();
                    if (tempToken.type !== TokenType$1.Ident && tempToken.type !== TokenType$1.String) {
                        throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.INVALID_ATTRIBUTE_VALUE, getFormattedTokenName(tempToken.type), source.slice(tempToken.start, tempToken.end)));
                    }
                    const value = source.slice(tempToken.start, tempToken.end);
                    stream.advance();
                    stream.skipWhitespace();
                    tempToken = stream.getOrFail();
                    if (tempToken.type === TokenType$1.Ident) {
                        throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.FLAGS_NOT_SUPPORTED));
                    }
                    stream.expect(TokenType$1.CloseSquareBracket);
                    const { end } = stream.getOrFail();
                    stream.advance();
                    if (attr === AttributeSelectors.MinLength) {
                        const parsed = parseInt(value, 10);
                        if (Number.isNaN(parsed)) {
                            throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.VALUE_FOR_ATTR_SHOULD_BE_INT, attr, value));
                        }
                        minLen = parsed;
                    }
                    else if (attr === AttributeSelectors.MaxLength) {
                        const parsed = parseInt(value, 10);
                        if (Number.isNaN(parsed)) {
                            throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.VALUE_FOR_ATTR_SHOULD_BE_INT, attr, value));
                        }
                        maxLen = parsed;
                    }
                    else {
                        convertedSelector.push(source.slice(start, end));
                    }
                }
                else if (token.type === TokenType$1.Colon) {
                    let tempToken;
                    stream.advance();
                    stream.expect(TokenType$1.Function);
                    tempToken = stream.getOrFail();
                    const fn = source.slice(tempToken.start, tempToken.end - 1);
                    if (!SUPPORTED_UBO_PSEUDO_CLASSES.has(fn)) {
                        throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.INVALID_PSEUDO_CLASS, fn));
                    }
                    const paramStart = tempToken.end;
                    stream.skipUntilBalanced();
                    tempToken = stream.getOrFail();
                    const paramEnd = tempToken.end;
                    const param = source.slice(paramStart, paramEnd - 1);
                    if (fn === PseudoClasses$1.MinTextLength) {
                        const parsed = parseInt(param, 10);
                        if (Number.isNaN(parsed)) {
                            throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.VALUE_FOR_PSEUDO_CLASS_SHOULD_BE_INT, fn, param));
                        }
                        minLen = parsed;
                    }
                    else if (fn === PseudoClasses$1.Contains || fn === PseudoClasses$1.HasText) {
                        if (RegExpUtils.isRegexPattern(param)) {
                            throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.REGEXP_NOT_SUPPORTED, param, fn));
                        }
                        const paramEscaped = StringUtils.escapeCharacter(param, DOUBLE_QUOTE_MARKER);
                        convertedSelector.push(renderAttrSelector(AttributeSelectors.TagContent, EQUALS, paramEscaped));
                    }
                    stream.advance();
                }
                else if (token.type === TokenType$1.Comma && token.balance === 0) {
                    if (minLen !== NOT_SPECIFIED) {
                        convertedSelector.push(renderAttrSelector(AttributeSelectors.MinLength, EQUALS, minLen.toString()));
                    }
                    convertedSelector.push(renderAttrSelector(AttributeSelectors.MaxLength, EQUALS, maxLen !== NOT_SPECIFIED ? maxLen.toString() : ADG_HTML_CONVERSION_MAX_LENGTH.toString()));
                    convertedSelectorList.push(convertedSelector.join(EMPTY));
                    convertedSelector.length = 0;
                    stream.advance();
                }
                else if (token.type === TokenType$1.Whitespace) {
                    stream.advance();
                }
                else {
                    throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES$2.UNEXPECTED_TOKEN_WITH_VALUE, getFormattedTokenName(token.type), source.slice(token.start, token.end)));
                }
            }
            if (convertedSelector.length !== 0) {
                if (minLen !== NOT_SPECIFIED) {
                    convertedSelector.push(renderAttrSelector(AttributeSelectors.MinLength, EQUALS, minLen.toString()));
                }
                convertedSelector.push(renderAttrSelector(AttributeSelectors.MaxLength, EQUALS, maxLen !== NOT_SPECIFIED ? maxLen.toString() : ADG_HTML_CONVERSION_MAX_LENGTH.toString()));
                convertedSelectorList.push(convertedSelector.join(EMPTY));
            }
            return createNodeConversionResult(
            convertedSelectorList.map((selector) => ({
                category: RuleCategory.Cosmetic,
                type: CosmeticRuleType.HtmlFilteringRule,
                syntax: AdblockSyntax.Adg,
                exception: rule.exception,
                domains: cloneDomainListNode(rule.domains),
                separator: {
                    type: 'Value',
                    value: rule.exception
                        ? CosmeticRuleSeparator.AdgHtmlFilteringException
                        : CosmeticRuleSeparator.AdgHtmlFiltering,
                },
                body: {
                    type: 'Value',
                    value: unescapeDoubleQuotes(selector),
                },
            })), true);
        }
    }
    function getScriptletName(scriptletNode) {
        if (scriptletNode.children.length === 0) {
            throw new Error('Empty scriptlet');
        }
        return scriptletNode.children[0]?.value ?? EMPTY;
    }
    function transformNthScriptletArgument(scriptletNode, index, transform) {
        const child = scriptletNode.children[index];
        if (!isUndefined$1(child)) {
            const transformed = transform(child?.value ?? null);
            if (isNull$1(transformed)) {
                scriptletNode.children[index] = null;
                return;
            }
            if (isNull$1(child)) {
                scriptletNode.children[index] = {
                    type: 'Value',
                    value: transformed,
                };
                return;
            }
            child.value = transformed;
        }
    }
    function transformAllScriptletArguments(scriptletNode, transform) {
        for (let i = 0; i < scriptletNode.children.length; i += 1) {
            transformNthScriptletArgument(scriptletNode, i, transform);
        }
    }
    function setScriptletName(scriptletNode, name) {
        transformNthScriptletArgument(scriptletNode, 0, () => name);
    }
    function setScriptletQuoteType(scriptletNode, quoteType) {
        transformAllScriptletArguments(scriptletNode, (value) => QuoteUtils.setStringQuoteType(value ?? EMPTY, quoteType));
    }
    var ResourceType;
    (function (ResourceType) {
        ResourceType["MainFrame"] = "main_frame";
        ResourceType["SubFrame"] = "sub_frame";
        ResourceType["Stylesheet"] = "stylesheet";
        ResourceType["Script"] = "script";
        ResourceType["Image"] = "image";
        ResourceType["Font"] = "font";
        ResourceType["Object"] = "object";
        ResourceType["XmlHttpRequest"] = "xmlhttprequest";
        ResourceType["Ping"] = "ping";
        ResourceType["Media"] = "media";
        ResourceType["WebSocket"] = "websocket";
        ResourceType["Other"] = "other";
    })(ResourceType || (ResourceType = {}));
    const resourceTypeSchema = z.nativeEnum(ResourceType);
    const RESOURCE_TYPE_MODIFIER_MAP = Object.freeze({
        [ResourceType.MainFrame]: 'document',
        [ResourceType.SubFrame]: 'subdocument',
        [ResourceType.Stylesheet]: 'stylesheet',
        [ResourceType.Script]: 'script',
        [ResourceType.Image]: 'image',
        [ResourceType.Font]: 'font',
        [ResourceType.Object]: 'object',
        [ResourceType.XmlHttpRequest]: 'xmlhttprequest',
        [ResourceType.Ping]: 'ping',
        [ResourceType.Media]: 'media',
        [ResourceType.WebSocket]: 'websocket',
        [ResourceType.Other]: 'other',
    });
    const getResourceTypeModifier = (resourceType, platform) => {
        const modifierName = RESOURCE_TYPE_MODIFIER_MAP[resourceType];
        if (!modifierName) {
            return null;
        }
        const modifierData = modifiersCompatibilityTable.getFirst(modifierName, platform);
        if (isNull$1(modifierData)) {
            return null;
        }
        return modifierData.name;
    };
    const isValidResourceType = (resourceType) => {
        return Object.values(ResourceType).includes(resourceType);
    };
    const ABP_RESOURCE_PREFIX = 'abp-resource:';
    const ABP_RESOURCE_PREFIX_LENGTH = ABP_RESOURCE_PREFIX.length;
    const redirectNameNormalizer = (name) => {
        if (name.startsWith(ABP_RESOURCE_PREFIX)) {
            return name.slice(ABP_RESOURCE_PREFIX_LENGTH);
        }
        const colonIndex = name.lastIndexOf(COLON);
        if (colonIndex !== -1 && /^\d+$/.test(name.slice(colonIndex + 1))) {
            return name.slice(0, colonIndex);
        }
        return name;
    };
    class RedirectsCompatibilityTable extends CompatibilityTableBase {
        constructor(data) {
            super(data, redirectNameNormalizer);
        }
        getResourceTypeModifiers(redirect, platform) {
            let redirectData = null;
            if (isString(redirect)) {
                redirectData = this.getFirst(redirect, platform);
            }
            else {
                redirectData = redirect;
            }
            const modifierNames = new Set();
            if (isNull$1(redirectData) || isUndefined$1(redirectData.resourceTypes)) {
                return modifierNames;
            }
            for (const resourceType of redirectData.resourceTypes) {
                const modifierName = getResourceTypeModifier(resourceType, platform);
                if (isNull$1(modifierName)) {
                    continue;
                }
                modifierNames.add(modifierName);
            }
            return modifierNames;
        }
    }
    deepFreeze(redirectsCompatibilityTableData_1);
    const redirectsCompatibilityTable = new RedirectsCompatibilityTable(redirectsCompatibilityTableData_1);
    class ScriptletsCompatibilityTable extends CompatibilityTableBase {
    }
    deepFreeze(scriptletsCompatibilityTableData_1);
    const scriptletsCompatibilityTable = new ScriptletsCompatibilityTable(scriptletsCompatibilityTableData_1);
    const PLATFORM_SEPARATOR = '|';
    const PLATFORM_NEGATION = '~';
    const parseRawPlatforms = (rawPlatforms) => {
        const rawPlatformList = rawPlatforms
            .split(PLATFORM_SEPARATOR)
            .map((rawPlatform) => rawPlatform.trim());
        let result = 0;
        for (let rawPlatform of rawPlatformList) {
            let negated = false;
            if (rawPlatform.startsWith(PLATFORM_NEGATION)) {
                negated = true;
                rawPlatform = rawPlatform.slice(1).trim();
            }
            const platform = SPECIFIC_PLATFORM_MAP.get(rawPlatform) ?? GENERIC_PLATFORM_MAP.get(rawPlatform);
            if (isUndefined$1(platform)) {
                throw new Error(`Unknown platform: ${rawPlatform}`);
            }
            if (negated) {
                result &= ~platform;
            }
            else {
                result |= platform;
            }
        }
        if (result === 0) {
            throw new Error('No platforms specified');
        }
        return result;
    };
    z
        .string()
        .min(1)
        .transform((value) => parseRawPlatforms(value));
    function getDefaultExportFromCjs (x) {
    	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
    }
    var mapObj$1 = {exports: {}};
    const isObject$1 = value => typeof value === 'object' && value !== null;
    const mapObjectSkip = Symbol('skip');
    const isObjectCustom = value =>
    	isObject$1(value) &&
    	!(value instanceof RegExp) &&
    	!(value instanceof Error) &&
    	!(value instanceof Date);
    const mapObject = (object, mapper, options, isSeen = new WeakMap()) => {
    	options = {
    		deep: false,
    		target: {},
    		...options
    	};
    	if (isSeen.has(object)) {
    		return isSeen.get(object);
    	}
    	isSeen.set(object, options.target);
    	const {target} = options;
    	delete options.target;
    	const mapArray = array => array.map(element => isObjectCustom(element) ? mapObject(element, mapper, options, isSeen) : element);
    	if (Array.isArray(object)) {
    		return mapArray(object);
    	}
    	for (const [key, value] of Object.entries(object)) {
    		const mapResult = mapper(key, value, object);
    		if (mapResult === mapObjectSkip) {
    			continue;
    		}
    		let [newKey, newValue, {shouldRecurse = true} = {}] = mapResult;
    		if (newKey === '__proto__') {
    			continue;
    		}
    		if (options.deep && shouldRecurse && isObjectCustom(newValue)) {
    			newValue = Array.isArray(newValue) ?
    				mapArray(newValue) :
    				mapObject(newValue, mapper, options, isSeen);
    		}
    		target[newKey] = newValue;
    	}
    	return target;
    };
    mapObj$1.exports = (object, mapper, options) => {
    	if (!isObject$1(object)) {
    		throw new TypeError(`Expected an object, got \`${object}\` (${typeof object})`);
    	}
    	return mapObject(object, mapper, options);
    };
    mapObj$1.exports.mapObjectSkip = mapObjectSkip;
    var mapObjExports = mapObj$1.exports;
    var camelcase = {exports: {}};
    const UPPERCASE = /[\p{Lu}]/u;
    const LOWERCASE = /[\p{Ll}]/u;
    const LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
    const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
    const SEPARATORS = /[_.\- ]+/;
    const LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source);
    const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu');
    const NUMBERS_AND_IDENTIFIER = new RegExp('\\d+' + IDENTIFIER.source, 'gu');
    const preserveCamelCase = (string, toLowerCase, toUpperCase) => {
    	let isLastCharLower = false;
    	let isLastCharUpper = false;
    	let isLastLastCharUpper = false;
    	for (let i = 0; i < string.length; i++) {
    		const character = string[i];
    		if (isLastCharLower && UPPERCASE.test(character)) {
    			string = string.slice(0, i) + '-' + string.slice(i);
    			isLastCharLower = false;
    			isLastLastCharUpper = isLastCharUpper;
    			isLastCharUpper = true;
    			i++;
    		} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character)) {
    			string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
    			isLastLastCharUpper = isLastCharUpper;
    			isLastCharUpper = false;
    			isLastCharLower = true;
    		} else {
    			isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
    			isLastLastCharUpper = isLastCharUpper;
    			isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
    		}
    	}
    	return string;
    };
    const preserveConsecutiveUppercase = (input, toLowerCase) => {
    	LEADING_CAPITAL.lastIndex = 0;
    	return input.replace(LEADING_CAPITAL, m1 => toLowerCase(m1));
    };
    const postProcess = (input, toUpperCase) => {
    	SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
    	NUMBERS_AND_IDENTIFIER.lastIndex = 0;
    	return input.replace(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier))
    		.replace(NUMBERS_AND_IDENTIFIER, m => toUpperCase(m));
    };
    const camelCase$1 = (input, options) => {
    	if (!(typeof input === 'string' || Array.isArray(input))) {
    		throw new TypeError('Expected the input to be `string | string[]`');
    	}
    	options = {
    		pascalCase: false,
    		preserveConsecutiveUppercase: false,
    		...options
    	};
    	if (Array.isArray(input)) {
    		input = input.map(x => x.trim())
    			.filter(x => x.length)
    			.join('-');
    	} else {
    		input = input.trim();
    	}
    	if (input.length === 0) {
    		return '';
    	}
    	const toLowerCase = options.locale === false ?
    		string => string.toLowerCase() :
    		string => string.toLocaleLowerCase(options.locale);
    	const toUpperCase = options.locale === false ?
    		string => string.toUpperCase() :
    		string => string.toLocaleUpperCase(options.locale);
    	if (input.length === 1) {
    		return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
    	}
    	const hasUpperCase = input !== toLowerCase(input);
    	if (hasUpperCase) {
    		input = preserveCamelCase(input, toLowerCase, toUpperCase);
    	}
    	input = input.replace(LEADING_SEPARATORS, '');
    	if (options.preserveConsecutiveUppercase) {
    		input = preserveConsecutiveUppercase(input, toLowerCase);
    	} else {
    		input = toLowerCase(input);
    	}
    	if (options.pascalCase) {
    		input = toUpperCase(input.charAt(0)) + input.slice(1);
    	}
    	return postProcess(input, toUpperCase);
    };
    camelcase.exports = camelCase$1;
    camelcase.exports.default = camelCase$1;
    var camelcaseExports = camelcase.exports;
    class QuickLRU {
    	constructor(options = {}) {
    		if (!(options.maxSize && options.maxSize > 0)) {
    			throw new TypeError('`maxSize` must be a number greater than 0');
    		}
    		this.maxSize = options.maxSize;
    		this.onEviction = options.onEviction;
    		this.cache = new Map();
    		this.oldCache = new Map();
    		this._size = 0;
    	}
    	_set(key, value) {
    		this.cache.set(key, value);
    		this._size++;
    		if (this._size >= this.maxSize) {
    			this._size = 0;
    			if (typeof this.onEviction === 'function') {
    				for (const [key, value] of this.oldCache.entries()) {
    					this.onEviction(key, value);
    				}
    			}
    			this.oldCache = this.cache;
    			this.cache = new Map();
    		}
    	}
    	get(key) {
    		if (this.cache.has(key)) {
    			return this.cache.get(key);
    		}
    		if (this.oldCache.has(key)) {
    			const value = this.oldCache.get(key);
    			this.oldCache.delete(key);
    			this._set(key, value);
    			return value;
    		}
    	}
    	set(key, value) {
    		if (this.cache.has(key)) {
    			this.cache.set(key, value);
    		} else {
    			this._set(key, value);
    		}
    		return this;
    	}
    	has(key) {
    		return this.cache.has(key) || this.oldCache.has(key);
    	}
    	peek(key) {
    		if (this.cache.has(key)) {
    			return this.cache.get(key);
    		}
    		if (this.oldCache.has(key)) {
    			return this.oldCache.get(key);
    		}
    	}
    	delete(key) {
    		const deleted = this.cache.delete(key);
    		if (deleted) {
    			this._size--;
    		}
    		return this.oldCache.delete(key) || deleted;
    	}
    	clear() {
    		this.cache.clear();
    		this.oldCache.clear();
    		this._size = 0;
    	}
    	* keys() {
    		for (const [key] of this) {
    			yield key;
    		}
    	}
    	* values() {
    		for (const [, value] of this) {
    			yield value;
    		}
    	}
    	* [Symbol.iterator]() {
    		for (const item of this.cache) {
    			yield item;
    		}
    		for (const item of this.oldCache) {
    			const [key] = item;
    			if (!this.cache.has(key)) {
    				yield item;
    			}
    		}
    	}
    	get size() {
    		let oldCacheSize = 0;
    		for (const key of this.oldCache.keys()) {
    			if (!this.cache.has(key)) {
    				oldCacheSize++;
    			}
    		}
    		return Math.min(this._size + oldCacheSize, this.maxSize);
    	}
    }
    var quickLru = QuickLRU;
    const mapObj = mapObjExports;
    const camelCase = camelcaseExports;
    const QuickLru = quickLru;
    const has = (array, key) => array.some(x => {
    	if (typeof x === 'string') {
    		return x === key;
    	}
    	x.lastIndex = 0;
    	return x.test(key);
    });
    const cache = new QuickLru({maxSize: 100000});
    const isObject$2 = value =>
    	typeof value === 'object' &&
    	value !== null &&
    	!(value instanceof RegExp) &&
    	!(value instanceof Error) &&
    	!(value instanceof Date);
    const camelCaseConvert = (input, options) => {
    	if (!isObject$2(input)) {
    		return input;
    	}
    	options = {
    		deep: false,
    		pascalCase: false,
    		...options
    	};
    	const {exclude, pascalCase, stopPaths, deep} = options;
    	const stopPathsSet = new Set(stopPaths);
    	const makeMapper = parentPath => (key, value) => {
    		if (deep && isObject$2(value)) {
    			const path = parentPath === undefined ? key : `${parentPath}.${key}`;
    			if (!stopPathsSet.has(path)) {
    				value = mapObj(value, makeMapper(path));
    			}
    		}
    		if (!(exclude && has(exclude, key))) {
    			const cacheKey = pascalCase ? `${key}_` : key;
    			if (cache.has(cacheKey)) {
    				key = cache.get(cacheKey);
    			} else {
    				const returnValue = camelCase(key, {pascalCase, locale: false});
    				if (key.length < 100) {
    					cache.set(cacheKey, returnValue);
    				}
    				key = returnValue;
    			}
    		}
    		return [key, value];
    	};
    	return mapObj(input, makeMapper(undefined));
    };
    var camelcaseKeys = (input, options) => {
    	if (Array.isArray(input)) {
    		return Object.keys(input).map(key => camelCaseConvert(input[key], options));
    	}
    	return camelCaseConvert(input, options);
    };
    var camelCaseKeys = getDefaultExportFromCjs(camelcaseKeys);
    const zodToCamelCase = (zod) => {
        return zod.transform((val) => camelCaseKeys(val));
    };
    const booleanSchema = z.union([
        z.string().transform((val) => val.trim().toLowerCase() === 'true'),
        z.boolean(),
    ]);
    const nonEmptyStringSchema = z
        .string()
        .transform((val) => val.trim())
        .pipe(z.string().min(1));
    const baseCompatibilityDataSchema = z.object({
        name: nonEmptyStringSchema,
        aliases: z.array(nonEmptyStringSchema).nullable().default(null),
        description: nonEmptyStringSchema.nullable().default(null),
        docs: nonEmptyStringSchema.nullable().default(null),
        version_added: nonEmptyStringSchema.nullable().default(null),
        version_removed: nonEmptyStringSchema.nullable().default(null),
        deprecated: booleanSchema.default(false),
        deprecation_message: nonEmptyStringSchema.nullable().default(null),
        removed: booleanSchema.default(false),
        removal_message: nonEmptyStringSchema.nullable().default(null),
    });
    zodToCamelCase(baseCompatibilityDataSchema);
    const baseRefineLogic = (data, ctx) => {
        if (data.deprecated && !data.deprecation_message) {
            ctx.addIssue({
                code: z.ZodIssueCode.custom,
                message: 'deprecation_message is required for deprecated modifiers',
            });
        }
        if (!data.deprecated && data.deprecation_message) {
            ctx.addIssue({
                code: z.ZodIssueCode.custom,
                message: 'deprecation_message is only allowed for deprecated modifiers',
            });
        }
        if (data.aliases && data.aliases.length !== new Set(data.aliases).size) {
            ctx.addIssue({
                code: z.ZodIssueCode.custom,
                message: 'Aliases must be unique',
            });
        }
    };
    function isErrorWithMessage(error) {
        return (typeof error === 'object'
            && error !== null
            && 'message' in error
            && typeof error.message === 'string');
    }
    function toErrorWithMessage(maybeError) {
        if (isErrorWithMessage(maybeError)) {
            return maybeError;
        }
        try {
            return new Error(JSON.stringify(maybeError));
        }
        catch {
            return new Error(String(maybeError));
        }
    }
    function getErrorMessage$1(error) {
        return toErrorWithMessage(error).message;
    }
    const KNOWN_VALIDATORS = new Set([
        'domain',
        'pipe_separated_domains',
        'regexp',
        'url',
    ]);
    zodToCamelCase(baseCompatibilityDataSchema.extend({
        conflicts: z.array(nonEmptyStringSchema).nullable().default(null),
        inverse_conflicts: booleanSchema.default(false),
        assignable: booleanSchema.default(false),
        negatable: booleanSchema.default(true),
        block_only: booleanSchema.default(false),
        exception_only: booleanSchema.default(false),
        value_optional: booleanSchema.default(false),
        value_format: nonEmptyStringSchema.nullable().default(null),
    }).superRefine((data, ctx) => {
        baseRefineLogic(data, ctx);
        if (data.block_only && data.exception_only) {
            ctx.addIssue({
                code: z.ZodIssueCode.custom,
                message: 'block_only and exception_only are mutually exclusive',
            });
        }
        if (data.assignable && !data.value_format) {
            ctx.addIssue({
                code: z.ZodIssueCode.custom,
                message: 'value_format is required for assignable modifiers',
            });
        }
        if (data.value_format) {
            const valueFormat = data.value_format.trim();
            if (KNOWN_VALIDATORS.has(valueFormat)) {
                return;
            }
            try {
                XRegExp(valueFormat);
            }
            catch (error) {
                ctx.addIssue({
                    code: z.ZodIssueCode.custom,
                    message: getErrorMessage$1(error),
                });
            }
        }
    }));
    zodToCamelCase(baseCompatibilityDataSchema.extend({
        is_blocking: booleanSchema.default(false),
        resource_types: z.array(resourceTypeSchema).default([]),
    }).superRefine(baseRefineLogic));
    const scriptletParameterSchema = z.object({
        name: nonEmptyStringSchema,
        required: booleanSchema,
        description: nonEmptyStringSchema.nullable().default(null),
        pattern: nonEmptyStringSchema.nullable().default(null),
        default: nonEmptyStringSchema.nullable().default(null),
        debug: booleanSchema.default(false),
    });
    const scriptletParametersSchema = z.array(scriptletParameterSchema);
    zodToCamelCase(baseCompatibilityDataSchema.extend({
        parameters: scriptletParametersSchema.optional(),
    }).superRefine((data, ctx) => {
        baseRefineLogic(data, ctx);
        if (!data.parameters) {
            return;
        }
        let optionalFound = false;
        for (const parameter of data.parameters) {
            if (optionalFound && parameter.required) {
                ctx.addIssue({
                    code: z.ZodIssueCode.custom,
                    message: 'Required parameters must be before optional ones',
                });
            }
            if (!parameter.required) {
                optionalFound = true;
            }
        }
    }));
    const ABP_SCRIPTLET_PREFIX = 'abp-';
    const UBO_SCRIPTLET_PREFIX = 'ubo-';
    const UBO_SCRIPTLET_PREFIX_LENGTH = UBO_SCRIPTLET_PREFIX.length;
    const UBO_SCRIPTLET_JS_SUFFIX = '.js';
    const UBO_SCRIPTLET_JS_SUFFIX_LENGTH = UBO_SCRIPTLET_JS_SUFFIX.length;
    const COMMA_SEPARATOR = ',';
    const ADG_SET_CONSTANT_NAME = 'set-constant';
    const ADG_SET_CONSTANT_EMPTY_STRING = '';
    const ADG_SET_CONSTANT_EMPTY_ARRAY = 'emptyArr';
    const ADG_SET_CONSTANT_EMPTY_OBJECT = 'emptyObj';
    const UBO_SET_CONSTANT_EMPTY_STRING = '\'\'';
    const UBO_SET_CONSTANT_EMPTY_ARRAY = '[]';
    const UBO_SET_CONSTANT_EMPTY_OBJECT = '{}';
    const ADG_PREVENT_FETCH_NAME = 'prevent-fetch';
    const ADG_PREVENT_FETCH_EMPTY_STRING = '';
    const ADG_PREVENT_FETCH_WILDCARD = '*';
    const UBO_NO_FETCH_IF_WILDCARD = '/^/';
    const UBO_REMOVE_CLASS_NAME = 'remove-class.js';
    const UBO_REMOVE_ATTR_NAME = 'remove-attr.js';
    const setConstantAdgToUboMap = {
        [ADG_SET_CONSTANT_EMPTY_STRING]: UBO_SET_CONSTANT_EMPTY_STRING,
        [ADG_SET_CONSTANT_EMPTY_ARRAY]: UBO_SET_CONSTANT_EMPTY_ARRAY,
        [ADG_SET_CONSTANT_EMPTY_OBJECT]: UBO_SET_CONSTANT_EMPTY_OBJECT,
    };
    const REMOVE_ATTR_CLASS_APPLYING = new Set([
        'asap',
        'stay',
        'complete',
    ]);
    class ScriptletRuleConverter extends RuleConverterBase {
        static convertToAdg(rule) {
            if (rule.syntax === AdblockSyntax.Adg) {
                return createNodeConversionResult([rule], false);
            }
            const separator = rule.separator.value;
            let convertedSeparator = separator;
            convertedSeparator = rule.exception
                ? CosmeticRuleSeparator.AdgJsInjectionException
                : CosmeticRuleSeparator.AdgJsInjection;
            const convertedScriptlets = [];
            for (const scriptlet of rule.body.children) {
                const scriptletClone = cloneScriptletRuleNode(scriptlet);
                const scriptletName = QuoteUtils.setStringQuoteType(getScriptletName(scriptletClone), QuoteType.None);
                let prefix;
                let charToUnescape;
                switch (rule.syntax) {
                    case AdblockSyntax.Abp:
                        prefix = ABP_SCRIPTLET_PREFIX;
                        charToUnescape = SPACE;
                        break;
                    case AdblockSyntax.Ubo:
                        prefix = UBO_SCRIPTLET_PREFIX;
                        charToUnescape = COMMA_SEPARATOR;
                        break;
                    default:
                        prefix = EMPTY;
                }
                if (!scriptletName.startsWith(prefix)) {
                    setScriptletName(scriptletClone, `${prefix}${scriptletName}`);
                }
                if (!isUndefined$1(charToUnescape)) {
                    transformAllScriptletArguments(scriptletClone, (value) => {
                        if (!isNull$1(value)) {
                            return QuoteUtils.unescapeSingleEscapedOccurrences(value, charToUnescape);
                        }
                        return value;
                    });
                }
                if (rule.syntax === AdblockSyntax.Ubo) {
                    const scriptletData = scriptletsCompatibilityTable.getFirst(scriptletName, GenericPlatform.UboAny);
                    if (scriptletData
                        && (scriptletData.name === UBO_REMOVE_CLASS_NAME
                            || scriptletData.name === UBO_REMOVE_ATTR_NAME)
                        && scriptletClone.children.length > 2) {
                        const selectors = [];
                        let applying = null;
                        let lastArg = scriptletClone.children.pop();
                        if (lastArg) {
                            if (REMOVE_ATTR_CLASS_APPLYING.has(lastArg.value)) {
                                applying = lastArg.value;
                            }
                            else {
                                selectors.push(lastArg.value);
                            }
                        }
                        while (scriptletClone.children.length > 2) {
                            lastArg = scriptletClone.children.pop();
                            if (lastArg) {
                                selectors.push(lastArg.value.trim());
                            }
                        }
                        if (selectors.length > 0) {
                            scriptletClone.children.push({
                                type: 'Value',
                                value: selectors.reverse().join(', '),
                            });
                        }
                        if (!isNull$1(applying)) {
                            if (selectors.length === 0) {
                                scriptletClone.children.push({
                                    type: 'Value',
                                    value: EMPTY,
                                });
                            }
                            scriptletClone.children.push({
                                type: 'Value',
                                value: applying,
                            });
                        }
                    }
                }
                setScriptletQuoteType(scriptletClone, QuoteType.Single);
                convertedScriptlets.push(scriptletClone);
            }
            if (rule.body.children.length === 0) {
                const convertedScriptletNode = {
                    category: rule.category,
                    type: rule.type,
                    syntax: AdblockSyntax.Adg,
                    exception: rule.exception,
                    domains: cloneDomainListNode(rule.domains),
                    separator: {
                        type: 'Value',
                        value: convertedSeparator,
                    },
                    body: {
                        type: rule.body.type,
                        children: [],
                    },
                };
                if (rule.modifiers) {
                    convertedScriptletNode.modifiers = cloneModifierListNode(rule.modifiers);
                }
                return createNodeConversionResult([convertedScriptletNode], true);
            }
            return createNodeConversionResult(convertedScriptlets.map((scriptlet) => {
                const res = {
                    category: rule.category,
                    type: rule.type,
                    syntax: AdblockSyntax.Adg,
                    exception: rule.exception,
                    domains: cloneDomainListNode(rule.domains),
                    separator: {
                        type: 'Value',
                        value: convertedSeparator,
                    },
                    body: {
                        type: rule.body.type,
                        children: [scriptlet],
                    },
                };
                if (rule.modifiers) {
                    res.modifiers = cloneModifierListNode(rule.modifiers);
                }
                return res;
            }), true);
        }
        static convertToUbo(rule) {
            if (rule.syntax === AdblockSyntax.Ubo) {
                return createNodeConversionResult([rule], false);
            }
            const separator = rule.separator.value;
            let convertedSeparator = separator;
            convertedSeparator = rule.exception
                ? CosmeticRuleSeparator.ElementHidingException
                : CosmeticRuleSeparator.ElementHiding;
            const convertedScriptlets = [];
            for (const scriptlet of rule.body.children) {
                const scriptletClone = cloneScriptletRuleNode(scriptlet);
                const scriptletName = QuoteUtils.setStringQuoteType(getScriptletName(scriptletClone), QuoteType.None);
                let uboScriptletName;
                if (rule.syntax === AdblockSyntax.Adg && scriptletName.startsWith(UBO_SCRIPTLET_PREFIX)) {
                    uboScriptletName = scriptletName.slice(UBO_SCRIPTLET_PREFIX_LENGTH);
                }
                else {
                    const uboScriptlet = scriptletsCompatibilityTable.getFirst(scriptletName, GenericPlatform.UboAny);
                    uboScriptletName = uboScriptlet?.name ?? scriptletName;
                }
                if (uboScriptletName.endsWith(UBO_SCRIPTLET_JS_SUFFIX)) {
                    uboScriptletName = uboScriptletName.slice(0, -UBO_SCRIPTLET_JS_SUFFIX_LENGTH);
                }
                setScriptletName(scriptletClone, uboScriptletName);
                setScriptletQuoteType(scriptletClone, QuoteType.None);
                transformAllScriptletArguments(scriptletClone, (value) => {
                    if (!isNull$1(value)) {
                        return QuoteUtils.escapeUnescapedOccurrences(value, COMMA_SEPARATOR);
                    }
                    return value;
                });
                if (rule.syntax === AdblockSyntax.Abp) {
                    transformAllScriptletArguments(scriptletClone, (value) => {
                        if (!isNull$1(value)) {
                            return QuoteUtils.unescapeSingleEscapedOccurrences(value, SPACE);
                        }
                        return value;
                    });
                }
                switch (scriptletName) {
                    case ADG_SET_CONSTANT_NAME:
                        transformNthScriptletArgument(scriptletClone, 2, (value) => {
                            if (!isNull$1(value)) {
                                return setConstantAdgToUboMap[value] ?? value;
                            }
                            return value;
                        });
                        break;
                    case ADG_PREVENT_FETCH_NAME:
                        transformNthScriptletArgument(scriptletClone, 1, (value) => {
                            if (value === ADG_PREVENT_FETCH_EMPTY_STRING || value === ADG_PREVENT_FETCH_WILDCARD) {
                                return UBO_NO_FETCH_IF_WILDCARD;
                            }
                            return value;
                        });
                        break;
                }
                convertedScriptlets.push(scriptletClone);
            }
            if (rule.body.children.length === 0) {
                const convertedScriptletNode = {
                    category: rule.category,
                    type: rule.type,
                    syntax: AdblockSyntax.Ubo,
                    exception: rule.exception,
                    domains: cloneDomainListNode(rule.domains),
                    separator: {
                        type: 'Value',
                        value: convertedSeparator,
                    },
                    body: {
                        type: rule.body.type,
                        children: [],
                    },
                };
                if (rule.modifiers) {
                    convertedScriptletNode.modifiers = cloneModifierListNode(rule.modifiers);
                }
                return createNodeConversionResult([convertedScriptletNode], true);
            }
            return createNodeConversionResult(convertedScriptlets.map((scriptlet) => {
                const res = {
                    category: rule.category,
                    type: rule.type,
                    syntax: AdblockSyntax.Ubo,
                    exception: rule.exception,
                    domains: cloneDomainListNode(rule.domains),
                    separator: {
                        type: 'Value',
                        value: convertedSeparator,
                    },
                    body: {
                        type: rule.body.type,
                        children: [scriptlet],
                    },
                };
                if (rule.modifiers) {
                    res.modifiers = cloneModifierListNode(rule.modifiers);
                }
                return res;
            }), true);
        }
    }
    function createModifierNode(name, value = undefined, exception = false) {
        const result = {
            type: 'Modifier',
            exception,
            name: {
                type: 'Value',
                value: name,
            },
        };
        if (!isUndefined$1(value)) {
            result.value = {
                type: 'Value',
                value,
            };
        }
        return result;
    }
    function createModifierListNode(modifiers = []) {
        const result = {
            type: 'ModifierList',
            children: modifiers.length ? clone(modifiers) : [],
        };
        return result;
    }
    class MultiValueMap extends Map {
        add(key, ...values) {
            let currentValues = super.get(key);
            if (isUndefined$1(currentValues)) {
                currentValues = [];
                super.set(key, values);
            }
            currentValues.push(...values);
        }
    }
    const UBO_MATCHES_PATH_OPERATOR = 'matches-path';
    const ADG_PATH_MODIFIER = 'path';
    const SPECIAL_MODIFIER_REGEX_CHARS = new Set([
        OPEN_SQUARE_BRACKET,
        CLOSE_SQUARE_BRACKET,
        COMMA,
        ESCAPE_CHARACTER,
    ]);
    class AdgCosmeticRuleModifierConverter {
        static convertFromUbo(modifierList) {
            const conversionMap = new MultiValueMap();
            modifierList.children.forEach((modifier, index) => {
                if (modifier.name.value === UBO_MATCHES_PATH_OPERATOR) {
                    if (!modifier.value) {
                        throw new RuleConversionError(`'${UBO_MATCHES_PATH_OPERATOR}' operator requires a value`);
                    }
                    const value = RegExpUtils.isRegexPattern(modifier.value.value)
                        ? StringUtils.escapeCharacters(modifier.value.value, SPECIAL_MODIFIER_REGEX_CHARS)
                        : modifier.value.value;
                    conversionMap.add(index, createModifierNode(ADG_PATH_MODIFIER,
                    modifier.exception
                        ? `${REGEX_MARKER}${RegExpUtils.negateRegexPattern(RegExpUtils.patternToRegexp(value))}${REGEX_MARKER}`
                        : value));
                }
            });
            if (conversionMap.size) {
                const modifierListClone = clone(modifierList);
                modifierListClone.children = modifierListClone.children.map((modifier, index) => {
                    const convertedModifier = conversionMap.get(index);
                    return convertedModifier ?? modifier;
                }).flat();
                return createConversionResult(modifierListClone, true);
            }
            return createConversionResult(modifierList, false);
        }
    }
    const ERROR_MESSAGES$1 = {
        INVALID_ATTRIBUTE_VALUE: `Expected '${getFormattedTokenName(TokenType$1.Ident)}' or '${getFormattedTokenName(TokenType$1.String)}' as attribute value, but got '%s' with value '%s`,
    };
    var PseudoClasses;
    (function (PseudoClasses) {
        PseudoClasses["AbpContains"] = "-abp-contains";
        PseudoClasses["AbpHas"] = "-abp-has";
        PseudoClasses["Contains"] = "contains";
        PseudoClasses["Has"] = "has";
        PseudoClasses["HasText"] = "has-text";
        PseudoClasses["MatchesCss"] = "matches-css";
        PseudoClasses["MatchesCssAfter"] = "matches-css-after";
        PseudoClasses["MatchesCssBefore"] = "matches-css-before";
        PseudoClasses["Not"] = "not";
    })(PseudoClasses || (PseudoClasses = {}));
    var PseudoElements;
    (function (PseudoElements) {
        PseudoElements["After"] = "after";
        PseudoElements["Before"] = "before";
    })(PseudoElements || (PseudoElements = {}));
    const PSEUDO_ELEMENT_NAMES = new Set([
        PseudoElements.After,
        PseudoElements.Before,
    ]);
    class CssSelectorConverter extends ConverterBase {
        static convertToAdg(selectorList) {
            const stream = selectorList instanceof CssTokenStream
                ? selectorList
                : new CssTokenStream(selectorList);
            const converted = [];
            const convertAndPushPseudo = (pseudo) => {
                switch (pseudo) {
                    case PseudoClasses.AbpContains:
                    case PseudoClasses.HasText:
                        converted.push(PseudoClasses.Contains);
                        converted.push(OPEN_PARENTHESIS);
                        break;
                    case PseudoClasses.AbpHas:
                        converted.push(PseudoClasses.Has);
                        converted.push(OPEN_PARENTHESIS);
                        break;
                    case PseudoClasses.MatchesCssBefore:
                    case PseudoClasses.MatchesCssAfter:
                        converted.push(PseudoClasses.MatchesCss);
                        converted.push(OPEN_PARENTHESIS);
                        converted.push(pseudo.substring(PseudoClasses.MatchesCss.length + 1));
                        converted.push(COMMA);
                        break;
                    default:
                        converted.push(pseudo);
                        converted.push(OPEN_PARENTHESIS);
                        break;
                }
            };
            while (!stream.isEof()) {
                const token = stream.getOrFail();
                if (token.type === TokenType$1.Colon) {
                    stream.advance();
                    converted.push(COLON);
                    const tempToken = stream.getOrFail();
                    if (tempToken.type === TokenType$1.Colon) {
                        stream.advance();
                        converted.push(COLON);
                        continue;
                    }
                    if (tempToken.type === TokenType$1.Ident) {
                        const name = stream.source.slice(tempToken.start, tempToken.end);
                        if (PSEUDO_ELEMENT_NAMES.has(name)) {
                            converted.push(COLON);
                            converted.push(name);
                        }
                        else {
                            converted.push(name);
                        }
                        stream.advance();
                    }
                    else if (tempToken.type === TokenType$1.Function) {
                        const name = stream.source.slice(tempToken.start, tempToken.end - 1);
                        convertAndPushPseudo(name);
                        stream.advance();
                    }
                }
                else if (token.type === TokenType$1.OpenSquareBracket) {
                    let tempToken;
                    const { start } = token;
                    stream.advance();
                    stream.skipWhitespace();
                    stream.expect(TokenType$1.Ident);
                    tempToken = stream.getOrFail();
                    let attr = stream.source.slice(tempToken.start, tempToken.end);
                    if (!(attr.startsWith(LEGACY_EXT_CSS_ATTRIBUTE_PREFIX) || attr.startsWith(ABP_EXT_CSS_PREFIX))) {
                        converted.push(stream.source.slice(start, tempToken.end));
                        stream.advance();
                        continue;
                    }
                    if (attr.startsWith(LEGACY_EXT_CSS_ATTRIBUTE_PREFIX)) {
                        attr = attr.slice(LEGACY_EXT_CSS_ATTRIBUTE_PREFIX.length);
                    }
                    stream.advance();
                    stream.skipWhitespace();
                    stream.expect(TokenType$1.Delim, { value: EQUALS });
                    stream.advance();
                    stream.skipWhitespace();
                    tempToken = stream.getOrFail();
                    if (tempToken.type !== TokenType$1.Ident && tempToken.type !== TokenType$1.String) {
                        throw new Error(sprintf.sprintf(ERROR_MESSAGES$1.INVALID_ATTRIBUTE_VALUE, getFormattedTokenName(tempToken.type), stream.source.slice(tempToken.start, tempToken.end)));
                    }
                    const value = stream.source.slice(tempToken.start, tempToken.end);
                    stream.advance();
                    stream.skipWhitespace();
                    stream.expect(TokenType$1.CloseSquareBracket);
                    stream.advance();
                    converted.push(COLON);
                    convertAndPushPseudo(attr);
                    let processedValue = value.slice(1, -1);
                    if (attr === PseudoClasses.Has) {
                        processedValue = CssSelectorConverter.convertToAdg(processedValue).result;
                    }
                    converted.push(processedValue);
                    converted.push(CLOSE_PARENTHESIS);
                }
                else {
                    converted.push(stream.source.slice(token.start, token.end));
                    stream.advance();
                }
            }
            const convertedSelectorList = converted.join(EMPTY);
            return createConversionResult(convertedSelectorList, stream.source !== convertedSelectorList);
        }
    }
    class CssInjectionRuleConverter extends RuleConverterBase {
        static convertToAdg(rule) {
            const separator = rule.separator.value;
            let convertedSeparator = separator;
            const stream = new CssTokenStream(rule.body.selectorList.value);
            const convertedSelectorList = CssSelectorConverter.convertToAdg(stream);
            if (stream.hasAnySelectorExtendedCssNodeStrict() || rule.body.remove) {
                convertedSeparator = rule.exception
                    ? CosmeticRuleSeparator.AdgExtendedCssInjectionException
                    : CosmeticRuleSeparator.AdgExtendedCssInjection;
            }
            else if (rule.syntax !== AdblockSyntax.Adg) {
                convertedSeparator = rule.exception
                    ? CosmeticRuleSeparator.AdgCssInjectionException
                    : CosmeticRuleSeparator.AdgCssInjection;
            }
            if (!(rule.syntax === AdblockSyntax.Common || rule.syntax === AdblockSyntax.Adg)
                || separator !== convertedSeparator
                || convertedSelectorList.isConverted) {
                const ruleClone = clone(rule);
                ruleClone.syntax = AdblockSyntax.Adg;
                ruleClone.separator.value = convertedSeparator;
                ruleClone.body.selectorList.value = convertedSelectorList.result;
                return createNodeConversionResult([ruleClone], true);
            }
            return createNodeConversionResult([rule], false);
        }
    }
    class ElementHidingRuleConverter extends RuleConverterBase {
        static convertToAdg(rule) {
            const separator = rule.separator.value;
            let convertedSeparator = separator;
            const stream = new CssTokenStream(rule.body.selectorList.value);
            const convertedSelectorList = CssSelectorConverter.convertToAdg(stream);
            if (stream.hasAnySelectorExtendedCssNodeStrict()) {
                convertedSeparator = rule.exception
                    ? CosmeticRuleSeparator.ExtendedElementHidingException
                    : CosmeticRuleSeparator.ExtendedElementHiding;
            }
            if (!(rule.syntax === AdblockSyntax.Common || rule.syntax === AdblockSyntax.Adg)
                || separator !== convertedSeparator
                || convertedSelectorList.isConverted) {
                const ruleClone = clone(rule);
                ruleClone.syntax = AdblockSyntax.Adg;
                ruleClone.separator.value = convertedSeparator;
                ruleClone.body.selectorList.value = convertedSelectorList.result;
                return createNodeConversionResult([ruleClone], true);
            }
            return createNodeConversionResult([rule], false);
        }
    }
    function createNetworkRuleNode(pattern, modifiers = undefined, exception = false, syntax = AdblockSyntax.Common) {
        const result = {
            category: RuleCategory.Network,
            type: NetworkRuleType.NetworkRule,
            syntax,
            exception,
            pattern: {
                type: 'Value',
                value: pattern,
            },
        };
        if (!isUndefined$1(modifiers)) {
            result.modifiers = clone(modifiers);
        }
        return result;
    }
    const UBO_RESPONSEHEADER_FN = 'responseheader';
    const ADG_REMOVEHEADER_MODIFIER = 'removeheader';
    const ERROR_MESSAGES = {
        EMPTY_PARAMETER: `Empty parameter for '${UBO_RESPONSEHEADER_FN}' function`,
        EXPECTED_END_OF_RULE: "Expected end of rule, but got '%s'",
        MULTIPLE_DOMAINS_NOT_SUPPORTED: 'Multiple domains are not supported yet',
    };
    class HeaderRemovalRuleConverter extends RuleConverterBase {
        static convertToAdg(rule) {
            if (rule.category !== RuleCategory.Cosmetic || rule.type !== CosmeticRuleType.HtmlFilteringRule) {
                return createNodeConversionResult([rule], false);
            }
            const stream = new CssTokenStream(rule.body.value);
            let token;
            stream.skipWhitespace();
            token = stream.get();
            if (!token || token.type !== TokenType$1.Delim || rule.body.value[token.start] !== UBO_HTML_MASK) {
                return createNodeConversionResult([rule], false);
            }
            stream.advance();
            token = stream.get();
            if (!token) {
                return createNodeConversionResult([rule], false);
            }
            const functionName = rule.body.value.slice(token.start, token.end - 1);
            if (functionName !== UBO_RESPONSEHEADER_FN) {
                return createNodeConversionResult([rule], false);
            }
            const paramStart = token.end;
            stream.skipUntilBalanced();
            const paramEnd = stream.getOrFail().end;
            const param = rule.body.value.slice(paramStart, paramEnd - 1).trim();
            if (param.length === 0) {
                throw new RuleConversionError(ERROR_MESSAGES.EMPTY_PARAMETER);
            }
            stream.expect(TokenType$1.CloseParenthesis);
            stream.advance();
            stream.skipWhitespace();
            if (!stream.isEof()) {
                token = stream.getOrFail();
                throw new RuleConversionError(sprintf.sprintf(ERROR_MESSAGES.EXPECTED_END_OF_RULE, getFormattedTokenName(token.type)));
            }
            const pattern = [];
            if (rule.domains.children.length === 1) {
                pattern.push(ADBLOCK_URL_START, rule.domains.children[0].value, ADBLOCK_URL_SEPARATOR);
            }
            else if (rule.domains.children.length > 1) {
                throw new RuleConversionError(ERROR_MESSAGES.MULTIPLE_DOMAINS_NOT_SUPPORTED);
            }
            const modifiers = createModifierListNode();
            modifiers.children.push(createModifierNode(ADG_REMOVEHEADER_MODIFIER, param));
            return createNodeConversionResult([
                createNetworkRuleNode(pattern.join(EMPTY), modifiers,
                rule.exception, AdblockSyntax.Adg),
            ], true);
        }
    }
    class CosmeticRuleConverter extends RuleConverterBase {
        static convertToAdg(rule) {
            let subconverterResult;
            switch (rule.type) {
                case CosmeticRuleType.ElementHidingRule:
                    subconverterResult = ElementHidingRuleConverter.convertToAdg(rule);
                    break;
                case CosmeticRuleType.ScriptletInjectionRule:
                    subconverterResult = ScriptletRuleConverter.convertToAdg(rule);
                    break;
                case CosmeticRuleType.CssInjectionRule:
                    subconverterResult = CssInjectionRuleConverter.convertToAdg(rule);
                    break;
                case CosmeticRuleType.HtmlFilteringRule:
                    subconverterResult = HeaderRemovalRuleConverter.convertToAdg(rule);
                    if (subconverterResult.isConverted) {
                        break;
                    }
                    subconverterResult = HtmlRuleConverter.convertToAdg(rule);
                    break;
                case CosmeticRuleType.JsInjectionRule:
                    subconverterResult = createNodeConversionResult([rule], false);
                    break;
                default:
                    throw new RuleConversionError('Unsupported cosmetic rule type');
            }
            let convertedModifiers;
            if (rule.modifiers) {
                if (rule.syntax === AdblockSyntax.Ubo) {
                    if (rule.type === CosmeticRuleType.ScriptletInjectionRule) {
                        throw new RuleConversionError('uBO scriptlet injection rules don\'t support cosmetic rule modifiers');
                    }
                    convertedModifiers = AdgCosmeticRuleModifierConverter.convertFromUbo(rule.modifiers);
                }
                else if (rule.syntax === AdblockSyntax.Abp) {
                    throw new RuleConversionError('ABP don\'t support cosmetic rule modifiers');
                }
            }
            if ((subconverterResult.result.length > 1 || subconverterResult.isConverted)
                || (convertedModifiers && convertedModifiers.isConverted)) {
                subconverterResult.result.forEach((subconverterRule) => {
                    if (convertedModifiers && subconverterRule.category === RuleCategory.Cosmetic) {
                        subconverterRule.modifiers = convertedModifiers.result;
                    }
                });
                return subconverterResult;
            }
            return createNodeConversionResult([rule], false);
        }
        static convertToUbo(rule) {
            if (rule.type === CosmeticRuleType.ScriptletInjectionRule) {
                if (rule.syntax === AdblockSyntax.Adg && rule.modifiers?.children.length) {
                    throw new RuleConversionError('uBO scriptlet injection rules do not support cosmetic rule modifiers');
                }
                return ScriptletRuleConverter.convertToUbo(rule);
            }
            return createNodeConversionResult([rule], false);
        }
    }
    const CSP_MODIFIER = 'csp';
    const CSP_SEPARATOR = SEMICOLON + SPACE;
    const COMMON_CSP_PARAMS = '\'self\' \'unsafe-eval\' http: https: data: blob: mediastream: filesystem:';
    const ABP_REWRITE_MODIFIER = 'rewrite';
    const REDIRECT_MODIFIER = 'redirect';
    const REDIRECT_RULE_MODIFIER = 'redirect-rule';
    const UBO_NOOP_TEXT_RESOURCE = 'noop.txt';
    const REDIRECT_MODIFIERS = new Set([
        ABP_REWRITE_MODIFIER,
        REDIRECT_MODIFIER,
        REDIRECT_RULE_MODIFIER,
    ]);
    const ADG_CONVERSION_MAP = new Map([
        ['1p', [{ name: () => 'third-party', exception: (actual) => !actual }]],
        ['3p', [{ name: () => 'third-party' }]],
        ['css', [{ name: () => 'stylesheet' }]],
        ['doc', [{ name: () => 'document' }]],
        ['ehide', [{ name: () => 'elemhide' }]],
        ['empty', [{ name: () => 'redirect', value: () => 'nooptext' }]],
        ['first-party', [{ name: () => 'third-party', exception: (actual) => !actual }]],
        ['frame', [{ name: () => 'subdocument' }]],
        ['ghide', [{ name: () => 'generichide' }]],
        ['inline-font', [{ name: () => CSP_MODIFIER, value: () => `font-src ${COMMON_CSP_PARAMS}` }]],
        ['inline-script', [{ name: () => CSP_MODIFIER, value: () => `script-src ${COMMON_CSP_PARAMS}` }]],
        ['mp4', [{ name: () => 'redirect', value: () => 'noopmp4-1s' }, { name: () => 'media', value: () => undefined }]],
        ['queryprune', [{ name: () => 'removeparam' }]],
        ['shide', [{ name: () => 'specifichide' }]],
        ['xhr', [{ name: () => 'xmlhttprequest' }]],
    ]);
    class NetworkRuleModifierListConverter extends ConverterBase {
        static convertToAdg(modifierList, isException = false) {
            const conversionMap = new MultiValueMap();
            let cspCount = 0;
            modifierList.children.forEach((modifierNode, index) => {
                const modifierConversions = ADG_CONVERSION_MAP.get(modifierNode.name.value);
                if (modifierConversions) {
                    for (const modifierConversion of modifierConversions) {
                        const name = modifierConversion.name(modifierNode.name.value);
                        const exception = modifierConversion.exception
                            ? modifierConversion.exception(modifierNode.exception || false)
                            : modifierNode.exception;
                        const value = modifierConversion.value
                            ? modifierConversion.value(modifierNode.value?.value)
                            : modifierNode.value?.value;
                        if (name !== modifierNode.name.value || value !== modifierNode.value?.value) {
                            conversionMap.add(index, createModifierNode(name, value, exception));
                        }
                        if (name === CSP_MODIFIER) {
                            cspCount += 1;
                        }
                    }
                    return;
                }
                if (REDIRECT_MODIFIERS.has(modifierNode.name.value)) {
                    if (modifierNode.exception === true) {
                        throw new RuleConversionError(`Modifier '${modifierNode.name.value}' cannot be negated`);
                    }
                    const redirectResource = modifierNode.value?.value;
                    if (!redirectResource && !isException) {
                        throw new RuleConversionError(`No redirect resource specified for '${modifierNode.name.value}' modifier`);
                    }
                    const modifierName = modifierNode.name.value === ABP_REWRITE_MODIFIER
                        ? REDIRECT_MODIFIER
                        : modifierNode.name.value;
                    const convertedRedirectResource = redirectResource
                        ? redirectsCompatibilityTable.getFirst(redirectResource, GenericPlatform.AdgAny)?.name
                        : undefined;
                    if (modifierName !== modifierNode.name.value
                        || (convertedRedirectResource !== undefined && convertedRedirectResource !== redirectResource)) {
                        conversionMap.add(index, createModifierNode(modifierName,
                        convertedRedirectResource || redirectResource, modifierNode.exception));
                    }
                }
            });
            if (conversionMap.size || cspCount) {
                const modifierListClone = cloneModifierListNode(modifierList);
                modifierListClone.children = modifierListClone.children.map((modifierNode, index) => {
                    const conversionRecord = conversionMap.get(index);
                    if (conversionRecord) {
                        return conversionRecord;
                    }
                    return modifierNode;
                }).flat();
                if (cspCount) {
                    const cspValues = [];
                    modifierListClone.children = modifierListClone.children.filter((modifierNode) => {
                        if (modifierNode.name.value === CSP_MODIFIER) {
                            if (!modifierNode.value?.value) {
                                throw new RuleConversionError('$csp modifier value is missing');
                            }
                            cspValues.push(modifierNode.value?.value);
                            return false;
                        }
                        return true;
                    });
                    modifierListClone.children.push(createModifierNode(CSP_MODIFIER, cspValues.join(CSP_SEPARATOR)));
                }
                modifierListClone.children = modifierListClone.children.filter((modifierNode, index, self) => self.findIndex((m) => m.name.value === modifierNode.name.value
                    && m.exception === modifierNode.exception
                    && m.value?.value === modifierNode.value?.value) === index);
                return createConversionResult(modifierListClone, true);
            }
            return createConversionResult(modifierList, false);
        }
        static convertToUbo(modifierList, isException = false) {
            const conversionMap = new MultiValueMap();
            const resourceTypeModifiersToAdd = new Set();
            modifierList.children.forEach((modifierNode, index) => {
                const originalModifierName = modifierNode.name.value;
                const modifierData = modifiersCompatibilityTable.getFirst(originalModifierName, GenericPlatform.UboAny);
                if (REDIRECT_MODIFIERS.has(originalModifierName)) {
                    if (modifierNode.exception === true) {
                        throw new RuleConversionError(`Modifier '${modifierNode.name.value}' cannot be negated`);
                    }
                    const redirectResourceName = modifierNode.value?.value;
                    if (!redirectResourceName && !isException) {
                        throw new RuleConversionError(`No redirect resource specified for '${modifierNode.name.value}' modifier`);
                    }
                    if (!redirectResourceName) {
                        return;
                    }
                    const modifierName = modifierNode.name.value === ABP_REWRITE_MODIFIER
                        ? REDIRECT_MODIFIER
                        : modifierNode.name.value;
                    const convertedRedirectResourceData = redirectsCompatibilityTable.getFirst(redirectResourceName, GenericPlatform.UboAny);
                    const convertedRedirectResourceName = convertedRedirectResourceData?.name ?? redirectResourceName;
                    if (convertedRedirectResourceData?.resourceTypes?.length) {
                        const uboResourceTypeModifiers = redirectsCompatibilityTable.getResourceTypeModifiers(convertedRedirectResourceData, GenericPlatform.UboAny);
                        const isNoopTextResource = convertedRedirectResourceName === UBO_NOOP_TEXT_RESOURCE;
                        const hasValidResourceType = modifierList.children.some((modifier) => {
                            const name = modifier.name.value;
                            if (!isValidResourceType(name)) {
                                return false;
                            }
                            const convertedModifierData = modifiersCompatibilityTable.getFirst(name, GenericPlatform.UboAny);
                            return uboResourceTypeModifiers.has(convertedModifierData?.name ?? name);
                        });
                        if (!isNoopTextResource || !hasValidResourceType) {
                            uboResourceTypeModifiers.forEach((resourceType) => {
                                resourceTypeModifiersToAdd.add(resourceType);
                            });
                        }
                    }
                    if (modifierName !== originalModifierName
                        || (!isUndefined$1(convertedRedirectResourceName)
                            && convertedRedirectResourceName !== redirectResourceName)) {
                        conversionMap.add(index, createModifierNode(modifierName,
                        convertedRedirectResourceName || redirectResourceName, modifierNode.exception));
                    }
                    return;
                }
                if (modifierData && modifierData.name !== originalModifierName) {
                    conversionMap.add(index, createModifierNode(modifierData.name, modifierNode.value?.value, modifierNode.exception));
                }
            });
            if (conversionMap.size || resourceTypeModifiersToAdd.size) {
                const modifierListClone = cloneModifierListNode(modifierList);
                modifierListClone.children = modifierListClone.children.map((modifierNode, index) => {
                    const conversionRecord = conversionMap.get(index);
                    if (conversionRecord) {
                        return conversionRecord;
                    }
                    return modifierNode;
                }).flat();
                modifierListClone.children = modifierListClone.children.filter((modifierNode, index, self) => self.findIndex((m) => m.name.value === modifierNode.name.value
                    && m.exception === modifierNode.exception
                    && m.value?.value === modifierNode.value?.value) === index);
                if (resourceTypeModifiersToAdd.size) {
                    const modifierNameSet = new Set(modifierList.children.map((m) => m.name.value));
                    resourceTypeModifiersToAdd.forEach((resourceType) => {
                        if (!modifierNameSet.has(resourceType)) {
                            modifierListClone.children.push(createModifierNode(resourceType));
                        }
                    });
                }
                return createConversionResult(modifierListClone, true);
            }
            return createConversionResult(modifierList, false);
        }
    }
    class NetworkRuleConverter extends RuleConverterBase {
        static convertToAdg(rule) {
            if (rule.type !== NetworkRuleType.NetworkRule) {
                throw new Error(`Invalid rule type: ${rule.type}`);
            }
            if (rule.modifiers) {
                const modifiers = NetworkRuleModifierListConverter.convertToAdg(rule.modifiers, rule.exception);
                if (modifiers.isConverted) {
                    return {
                        result: [{
                                category: RuleCategory.Network,
                                type: NetworkRuleType.NetworkRule,
                                syntax: rule.syntax,
                                exception: rule.exception,
                                pattern: {
                                    type: 'Value',
                                    value: rule.pattern.value,
                                },
                                modifiers: modifiers.result,
                            }],
                        isConverted: true,
                    };
                }
            }
            return createNodeConversionResult([rule], false);
        }
        static convertToUbo(rule) {
            if (rule.type !== NetworkRuleType.NetworkRule) {
                throw new Error(`Invalid rule type: ${rule.type}`);
            }
            if (rule.modifiers) {
                const modifiers = NetworkRuleModifierListConverter.convertToUbo(rule.modifiers, rule.exception);
                if (modifiers.isConverted) {
                    return {
                        result: [{
                                category: RuleCategory.Network,
                                type: NetworkRuleType.NetworkRule,
                                syntax: rule.syntax,
                                exception: rule.exception,
                                pattern: {
                                    type: 'Value',
                                    value: rule.pattern.value,
                                },
                                modifiers: modifiers.result,
                            }],
                        isConverted: true,
                    };
                }
            }
            return createNodeConversionResult([rule], false);
        }
    }
    class RuleConverter extends RuleConverterBase {
        static convertToAdg(rule) {
            switch (rule.category) {
                case RuleCategory.Comment:
                    return CommentRuleConverter.convertToAdg(rule);
                case RuleCategory.Cosmetic:
                    return CosmeticRuleConverter.convertToAdg(rule);
                case RuleCategory.Network:
                    if (rule.type === NetworkRuleType.HostRule) {
                        return createConversionResult([rule], false);
                    }
                    return NetworkRuleConverter.convertToAdg(rule);
                case RuleCategory.Invalid:
                case RuleCategory.Empty:
                    return createConversionResult([rule], false);
                default:
                    throw new RuleConversionError('Unknown rule category');
            }
        }
        static convertToUbo(rule) {
            if (rule.category === RuleCategory.Cosmetic) {
                return CosmeticRuleConverter.convertToUbo(rule);
            }
            if (rule.category === RuleCategory.Network) {
                return NetworkRuleConverter.convertToUbo(rule);
            }
            return createConversionResult([rule], false);
        }
    }
    var validateType = function validateType(type) {
      return typeof type !== 'undefined';
    };
    var validateListener = function validateListener(listener) {
      return typeof listener !== 'undefined' && (typeof listener === 'function' || typeof listener === 'object'
      && listener !== null && 'handleEvent' in listener && typeof listener.handleEvent === 'function');
    };
    var listenerToString = function listenerToString(listener) {
      return typeof listener === 'function' ? listener.toString() : listener.handleEvent.toString();
    };
    var nativeIsNaN = function nativeIsNaN(num) {
      var native = Number.isNaN || window.isNaN;
      return native(num);
    };
    var nativeIsFinite = function nativeIsFinite(num) {
      var native = Number.isFinite || window.isFinite;
      return native(num);
    };
    var getNumberFromString = function getNumberFromString(rawString) {
      var parsedDelay = parseInt(rawString, 10);
      var validDelay = nativeIsNaN(parsedDelay) ? null : parsedDelay;
      return validDelay;
    };
    function getRandomIntInclusive(min, max) {
      min = Math.ceil(min);
      max = Math.floor(max);
      return Math.floor(Math.random() * (max - min + 1) + min);
    }
    var shouldMatchAnyDelay = function shouldMatchAnyDelay(delay) {
      return delay === '*';
    };
    var getMatchDelay = function getMatchDelay(delay) {
      var DEFAULT_DELAY = 1000;
      var parsedDelay = parseInt(delay, 10);
      var delayMatch = nativeIsNaN(parsedDelay) ? DEFAULT_DELAY
      : parsedDelay;
      return delayMatch;
    };
    var isDelayMatched = function isDelayMatched(inputDelay, realDelay) {
      return shouldMatchAnyDelay(inputDelay) || realDelay === getMatchDelay(inputDelay);
    };
    var getBoostMultiplier = function getBoostMultiplier(boost) {
      var DEFAULT_MULTIPLIER = 0.05;
      var MIN_MULTIPLIER = 0.001;
      var MAX_MULTIPLIER = 50;
      var parsedBoost = parseFloat(boost);
      var boostMultiplier = nativeIsNaN(parsedBoost) || !nativeIsFinite(parsedBoost) ? DEFAULT_MULTIPLIER
      : parsedBoost;
      if (boostMultiplier < MIN_MULTIPLIER) {
        boostMultiplier = MIN_MULTIPLIER;
      }
      if (boostMultiplier > MAX_MULTIPLIER) {
        boostMultiplier = MAX_MULTIPLIER;
      }
      return boostMultiplier;
    };
    var flatten = function flatten(input) {
      var stack = [];
      input.forEach(function (el) {
        return stack.push(el);
      });
      var res = [];
      while (stack.length) {
        var next = stack.pop();
        if (Array.isArray(next)) {
          next.forEach(function (el) {
            return stack.push(el);
          });
        } else {
          res.push(next);
        }
      }
      return res.reverse();
    };
    var nodeListToArray = function nodeListToArray(nodeList) {
      var nodes = [];
      for (var i = 0; i < nodeList.length; i += 1) {
        nodes.push(nodeList[i]);
      }
      return nodes;
    };
    var logMessage = function logMessage(source, message) {
      var forced = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
      var convertMessageToString = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
      var name = source.name,
        verbose = source.verbose;
      if (!forced && !verbose) {
        return;
      }
      var nativeConsole = console.log;
      if (!convertMessageToString) {
        nativeConsole("".concat(name, ":"), message);
        return;
      }
      nativeConsole("".concat(name, ": ").concat(message));
    };
    var hit = function hit(source) {
      var ADGUARD_PREFIX = '[AdGuard]';
      if (!source.verbose) {
        return;
      }
      try {
        var trace = console.trace.bind(console);
        var label = "".concat(ADGUARD_PREFIX, " ");
        if (source.engine === 'corelibs') {
          label += source.ruleText;
        } else {
          if (source.domainName) {
            label += "".concat(source.domainName);
          }
          if (source.args) {
            label += "#%#//scriptlet('".concat(source.name, "', '").concat(source.args.join("', '"), "')");
          } else {
            label += "#%#//scriptlet('".concat(source.name, "')");
          }
        }
        if (trace) {
          trace(label);
        }
      } catch (e) {
      }
      if (typeof window.__debug === 'function') {
        window.__debug(source);
      }
    };
    var defaultAttributeSetter = function defaultAttributeSetter(elem, attribute, value) {
      return elem.setAttribute(attribute, value);
    };
    var setAttributeBySelector = function setAttributeBySelector(source, selector, attribute, value) {
      var attributeSetter = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : defaultAttributeSetter;
      var elements;
      try {
        elements = document.querySelectorAll(selector);
      } catch (_unused) {
        logMessage(source, "Failed to find elements matching selector \"".concat(selector, "\""));
        return;
      }
      if (!elements || elements.length === 0) {
        return;
      }
      try {
        elements.forEach(function (elem) {
          return attributeSetter(elem, attribute, value);
        });
        hit(source);
      } catch (_unused2) {
        logMessage(source, "Failed to set [".concat(attribute, "=\"").concat(value, "\"] to each of selected elements."));
      }
    };
    var parseAttributePairs = function parseAttributePairs(input) {
      if (!input) {
        return [];
      }
      var NAME_VALUE_SEPARATOR = '=';
      var PAIRS_SEPARATOR = ' ';
      var SINGLE_QUOTE = "'";
      var DOUBLE_QUOTE = '"';
      var BACKSLASH = '\\';
      var pairs = [];
      for (var i = 0; i < input.length; i += 1) {
        var name = '';
        var value = '';
        while (i < input.length && input[i] !== NAME_VALUE_SEPARATOR && input[i] !== PAIRS_SEPARATOR) {
          name += input[i];
          i += 1;
        }
        if (i < input.length && input[i] === NAME_VALUE_SEPARATOR) {
          i += 1;
          var quote = null;
          if (input[i] === SINGLE_QUOTE || input[i] === DOUBLE_QUOTE) {
            quote = input[i];
            i += 1;
            for (; i < input.length; i += 1) {
              if (input[i] === quote) {
                if (input[i - 1] === BACKSLASH) {
                  value = "".concat(value.slice(0, -1)).concat(quote);
                } else {
                  i += 1;
                  quote = null;
                  break;
                }
              } else {
                value += input[i];
              }
            }
            if (quote !== null) {
              throw new Error("Unbalanced quote for attribute value: '".concat(input, "'"));
            }
          } else {
            throw new Error("Attribute value should be quoted: \"".concat(input.slice(i), "\""));
          }
        }
        name = name.trim();
        value = value.trim();
        if (!name) {
          if (!value) {
            continue;
          }
          throw new Error("Attribute name before '=' should be specified: '".concat(input, "'"));
        }
        pairs.push({
          name,
          value
        });
        if (input[i] && input[i] !== PAIRS_SEPARATOR) {
          throw new Error("No space before attribute: '".concat(input.slice(i), "'"));
        }
      }
      return pairs;
    };
    var isValidCookiePath = function isValidCookiePath(rawPath) {
      return rawPath === '/' || rawPath === 'none';
    };
    var getCookiePath = function getCookiePath(rawPath) {
      if (rawPath === '/') {
        return 'path=/';
      }
      return '';
    };
    var serializeCookie = function serializeCookie(name, rawValue, rawPath) {
      var domainValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      var shouldEncodeValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
      var HOST_PREFIX = '__Host-';
      var SECURE_PREFIX = '__Secure-';
      var COOKIE_BREAKER = ';';
      if (!shouldEncodeValue && "".concat(rawValue).includes(COOKIE_BREAKER) || name.includes(COOKIE_BREAKER)) {
        return null;
      }
      var value = shouldEncodeValue ? encodeURIComponent(rawValue) : rawValue;
      var resultCookie = "".concat(name, "=").concat(value);
      if (name.startsWith(HOST_PREFIX)) {
        resultCookie += '; path=/; secure';
        if (domainValue) {
          console.debug("Domain value: \"".concat(domainValue, "\" has been ignored, because is not allowed for __Host- prefixed cookies"));
        }
        return resultCookie;
      }
      var path = getCookiePath(rawPath);
      if (path) {
        resultCookie += "; ".concat(path);
      }
      if (name.startsWith(SECURE_PREFIX)) {
        resultCookie += '; secure';
      }
      if (domainValue) {
        resultCookie += "; domain=".concat(domainValue);
      }
      return resultCookie;
    };
    var getLimitedCookieValue = function getLimitedCookieValue(value) {
      if (!value) {
        return null;
      }
      var allowedCookieValues = new Set(['true', 't', 'false', 'f', 'yes', 'y', 'no', 'n', 'ok', 'on', 'off', 'accept', 'accepted', 'notaccepted', 'reject', 'rejected', 'allow', 'allowed', 'disallow', 'deny', 'enable', 'enabled', 'disable', 'disabled', 'necessary', 'required', 'hide', 'hidden', 'essential', 'nonessential', 'checked', 'unchecked']);
      var validValue;
      if (allowedCookieValues.has(value.toLowerCase())) {
        validValue = value;
      } else if (/^\d+$/.test(value)) {
        validValue = parseFloat(value);
        if (nativeIsNaN(validValue)) {
          return null;
        }
        if (Math.abs(validValue) < 0 || Math.abs(validValue) > 32767) {
          return null;
        }
      } else {
        return null;
      }
      return validValue;
    };
    var parseCookieString = function parseCookieString(cookieString) {
      var COOKIE_DELIMITER = '=';
      var COOKIE_PAIRS_DELIMITER = ';';
      var cookieChunks = cookieString.split(COOKIE_PAIRS_DELIMITER);
      var cookieData = {};
      cookieChunks.forEach(function (singleCookie) {
        var cookieKey;
        var cookieValue = '';
        var delimiterIndex = singleCookie.indexOf(COOKIE_DELIMITER);
        if (delimiterIndex === -1) {
          cookieKey = singleCookie.trim();
        } else {
          cookieKey = singleCookie.slice(0, delimiterIndex).trim();
          cookieValue = singleCookie.slice(delimiterIndex + 1);
        }
        cookieData[cookieKey] = cookieValue || null;
      });
      return cookieData;
    };
    var isCookieSetWithValue = function isCookieSetWithValue(cookieString, name, value) {
      return cookieString.split(';').some(function (cookieStr) {
        var pos = cookieStr.indexOf('=');
        if (pos === -1) {
          return false;
        }
        var cookieName = cookieStr.slice(0, pos).trim();
        var cookieValue = cookieStr.slice(pos + 1).trim();
        return name === cookieName && value === cookieValue;
      });
    };
    var getTrustedCookieOffsetMs = function getTrustedCookieOffsetMs(offsetExpiresSec) {
      var ONE_YEAR_EXPIRATION_KEYWORD = '1year';
      var ONE_DAY_EXPIRATION_KEYWORD = '1day';
      var MS_IN_SEC = 1000;
      var SECONDS_IN_YEAR = 365 * 24 * 60 * 60;
      var SECONDS_IN_DAY = 24 * 60 * 60;
      var parsedSec;
      if (offsetExpiresSec === ONE_YEAR_EXPIRATION_KEYWORD) {
        parsedSec = SECONDS_IN_YEAR;
      } else if (offsetExpiresSec === ONE_DAY_EXPIRATION_KEYWORD) {
        parsedSec = SECONDS_IN_DAY;
      } else {
        parsedSec = Number.parseInt(offsetExpiresSec, 10);
        if (Number.isNaN(parsedSec)) {
          return null;
        }
      }
      return parsedSec * MS_IN_SEC;
    };
    var noopFunc = function noopFunc() {};
    var noopCallbackFunc = function noopCallbackFunc() {
      return noopFunc;
    };
    var noopNull = function noopNull() {
      return null;
    };
    var trueFunc = function trueFunc() {
      return true;
    };
    var falseFunc = function falseFunc() {
      return false;
    };
    function noopThis() {
      return this;
    }
    var noopStr = function noopStr() {
      return '';
    };
    var noopArray = function noopArray() {
      return [];
    };
    var noopObject = function noopObject() {
      return {};
    };
    var throwFunc = function throwFunc() {
      throw new Error();
    };
    var noopResolveVoid = function noopResolveVoid() {
      return Promise.resolve(undefined);
    };
    var noopResolveNull = function noopResolveNull() {
      return Promise.resolve(null);
    };
    var noopPromiseReject = function noopPromiseReject() {
      return Promise.reject();
    };
    var noopPromiseResolve = function noopPromiseResolve() {
      var responseBody = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '{}';
      var responseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
      var responseType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'basic';
      if (typeof Response === 'undefined') {
        return;
      }
      var response = new Response(responseBody, {
        status: 200,
        statusText: 'OK'
      });
      if (responseType === 'opaque') {
        Object.defineProperties(response, {
          body: {
            value: null
          },
          status: {
            value: 0
          },
          statusText: {
            value: ''
          },
          url: {
            value: ''
          },
          type: {
            value: responseType
          }
        });
      } else {
        Object.defineProperties(response, {
          url: {
            value: responseUrl
          },
          type: {
            value: responseType
          }
        });
      }
      return Promise.resolve(response);
    };
    var isEmptyObject = function isEmptyObject(obj) {
      return Object.keys(obj).length === 0 && !obj.prototype;
    };
    var safeGetDescriptor = function safeGetDescriptor(obj, prop) {
      var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
      if (descriptor && descriptor.configurable) {
        return descriptor;
      }
      return null;
    };
    function setPropertyAccess(object, property, descriptor) {
      var currentDescriptor = Object.getOwnPropertyDescriptor(object, property);
      if (currentDescriptor && !currentDescriptor.configurable) {
        return false;
      }
      Object.defineProperty(object, property, descriptor);
      return true;
    }
    function isArbitraryObject(value) {
      return value !== null && typeof value === 'object' && !Array.isArray(value) && !(value instanceof RegExp);
    }
    var escapeRegExp = function escapeRegExp(str) {
      return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    };
    var toRegExp = function toRegExp(rawInput) {
      var input = rawInput || '';
      var DEFAULT_VALUE = '.?';
      var FORWARD_SLASH = '/';
      if (input === '') {
        return new RegExp(DEFAULT_VALUE);
      }
      var delimiterIndex = input.lastIndexOf(FORWARD_SLASH);
      var flagsPart = input.substring(delimiterIndex + 1);
      var regExpPart = input.substring(0, delimiterIndex + 1);
      var isValidRegExpFlag = function isValidRegExpFlag(flag) {
        if (!flag) {
          return false;
        }
        try {
          new RegExp('', flag);
          return true;
        } catch (ex) {
          return false;
        }
      };
      var getRegExpFlags = function getRegExpFlags(regExpStr, flagsStr) {
        if (regExpStr.startsWith(FORWARD_SLASH) && regExpStr.endsWith(FORWARD_SLASH)
        && !regExpStr.endsWith('\\/') && isValidRegExpFlag(flagsStr)) {
          return flagsStr;
        }
        return '';
      };
      var flags = getRegExpFlags(regExpPart, flagsPart);
      if (input.startsWith(FORWARD_SLASH) && input.endsWith(FORWARD_SLASH) || flags) {
        var regExpInput = flags ? regExpPart : input;
        return new RegExp(regExpInput.slice(1, -1), flags);
      }
      var escaped = input
      .replace(/\\'/g, '\'').replace(/\\"/g, '"')
      .replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
      return new RegExp(escaped);
    };
    var isValidStrPattern = function isValidStrPattern(input) {
      var FORWARD_SLASH = '/';
      var str = escapeRegExp(input);
      if (input[0] === FORWARD_SLASH && input[input.length - 1] === FORWARD_SLASH) {
        str = input.slice(1, -1);
      }
      var isValid;
      try {
        isValid = new RegExp(str);
        isValid = true;
      } catch (e) {
        isValid = false;
      }
      return isValid;
    };
    var substringAfter = function substringAfter(str, separator) {
      if (!str) {
        return str;
      }
      var index = str.indexOf(separator);
      return index < 0 ? '' : str.substring(index + separator.length);
    };
    var substringBefore = function substringBefore(str, separator) {
      if (!str || !separator) {
        return str;
      }
      var index = str.indexOf(separator);
      return index < 0 ? str : str.substring(0, index);
    };
    var convertRtcConfigToString = function convertRtcConfigToString(config) {
      var UNDEF_STR = 'undefined';
      var str = UNDEF_STR;
      if (config === null) {
        str = 'null';
      } else if (config instanceof Object) {
        var SERVERS_PROP_NAME = 'iceServers';
        var URLS_PROP_NAME = 'urls';
        if (Object.prototype.hasOwnProperty.call(config, SERVERS_PROP_NAME) && config[SERVERS_PROP_NAME] && Object.prototype.hasOwnProperty.call(config[SERVERS_PROP_NAME][0], URLS_PROP_NAME) && !!config[SERVERS_PROP_NAME][0][URLS_PROP_NAME]) {
          str = config[SERVERS_PROP_NAME][0][URLS_PROP_NAME].toString();
        }
      }
      return str;
    };
    var isValidMatchStr = function isValidMatchStr(match) {
      var INVERT_MARKER = '!';
      var str = match;
      if (match !== null && match !== void 0 && match.startsWith(INVERT_MARKER)) {
        str = match.slice(1);
      }
      return isValidStrPattern(str);
    };
    var isValidMatchNumber = function isValidMatchNumber(match) {
      var INVERT_MARKER = '!';
      var str = match;
      if (match !== null && match !== void 0 && match.startsWith(INVERT_MARKER)) {
        str = match.slice(1);
      }
      var num = parseFloat(str);
      return !nativeIsNaN(num) && nativeIsFinite(num);
    };
    var parseMatchArg = function parseMatchArg(match) {
      var INVERT_MARKER = '!';
      var isInvertedMatch = match ? match === null || match === void 0 ? void 0 : match.startsWith(INVERT_MARKER) : false;
      var matchValue = isInvertedMatch ? match.slice(1) : match;
      var matchRegexp = toRegExp(matchValue);
      return {
        isInvertedMatch,
        matchRegexp,
        matchValue
      };
    };
    var parseDelayArg = function parseDelayArg(delay) {
      var INVERT_MARKER = '!';
      var isInvertedDelayMatch = delay === null || delay === void 0 ? void 0 : delay.startsWith(INVERT_MARKER);
      var delayValue = isInvertedDelayMatch ? delay.slice(1) : delay;
      var parsedDelay = parseInt(delayValue, 10);
      var delayMatch = nativeIsNaN(parsedDelay) ? null : parsedDelay;
      return {
        isInvertedDelayMatch,
        delayMatch
      };
    };
    var objectToString$1 = function objectToString(obj) {
      if (!obj || typeof obj !== 'object') {
        return String(obj);
      }
      if (isEmptyObject(obj)) {
        return '{}';
      }
      return Object.entries(obj).map(function (pair) {
        var key = pair[0];
        var value = pair[1];
        var recordValueStr = value;
        if (value instanceof Object) {
          recordValueStr = "{ ".concat(objectToString(value), " }");
        }
        return "".concat(key, ":\"").concat(recordValueStr, "\"");
      }).join(' ');
    };
    var convertTypeToString = function convertTypeToString(value) {
      var output;
      if (typeof value === 'undefined') {
        output = 'undefined';
      } else if (typeof value === 'object') {
        if (value === null) {
          output = 'null';
        } else {
          output = objectToString$1(value);
        }
      } else {
        output = String(value);
      }
      return output;
    };
    function getRandomStrByLength(length) {
      var result = '';
      var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+=~';
      var charactersLength = characters.length;
      for (var i = 0; i < length; i += 1) {
        result += characters.charAt(Math.floor(Math.random() * charactersLength));
      }
      return result;
    }
    function generateRandomResponse(customResponseText) {
      var customResponse = customResponseText;
      if (customResponse === 'true') {
        customResponse = Math.random().toString(36).slice(-10);
        return customResponse;
      }
      customResponse = customResponse.replace('length:', '');
      var rangeRegex = /^\d+-\d+$/;
      if (!rangeRegex.test(customResponse)) {
        return null;
      }
      var rangeMin = getNumberFromString(customResponse.split('-')[0]);
      var rangeMax = getNumberFromString(customResponse.split('-')[1]);
      if (!nativeIsFinite(rangeMin) || !nativeIsFinite(rangeMax)) {
        return null;
      }
      if (rangeMin > rangeMax) {
        var temp = rangeMin;
        rangeMin = rangeMax;
        rangeMax = temp;
      }
      var LENGTH_RANGE_LIMIT = 500 * 1000;
      if (rangeMax > LENGTH_RANGE_LIMIT) {
        return null;
      }
      var length = getRandomIntInclusive(rangeMin, rangeMax);
      customResponse = getRandomStrByLength(length);
      return customResponse;
    }
    function inferValue(value) {
      if (value === 'undefined') {
        return undefined;
      }
      if (value === 'false') {
        return false;
      }
      if (value === 'true') {
        return true;
      }
      if (value === 'null') {
        return null;
      }
      if (value === 'NaN') {
        return NaN;
      }
      if (value.startsWith('/') && value.endsWith('/')) {
        return toRegExp(value);
      }
      var MAX_ALLOWED_NUM = 32767;
      var numVal = Number(value);
      if (!nativeIsNaN(numVal)) {
        if (Math.abs(numVal) > MAX_ALLOWED_NUM) {
          throw new Error('number values bigger than 32767 are not allowed');
        }
        return numVal;
      }
      var errorMessage = "'".concat(value, "' value type can't be inferred");
      try {
        var parsableVal = JSON.parse(value);
        if (parsableVal instanceof Object || typeof parsableVal === 'string') {
          return parsableVal;
        }
      } catch (e) {
        errorMessage += ": ".concat(e);
      }
      throw new TypeError(errorMessage);
    }
    var shouldAbortInlineOrInjectedScript = function shouldAbortInlineOrInjectedScript(stackMatch, stackTrace) {
      var INLINE_SCRIPT_STRING = 'inlineScript';
      var INJECTED_SCRIPT_STRING = 'injectedScript';
      var INJECTED_SCRIPT_MARKER = '<anonymous>';
      var isInlineScript = function isInlineScript(match) {
        return match.includes(INLINE_SCRIPT_STRING);
      };
      var isInjectedScript = function isInjectedScript(match) {
        return match.includes(INJECTED_SCRIPT_STRING);
      };
      if (!(isInlineScript(stackMatch) || isInjectedScript(stackMatch))) {
        return false;
      }
      var documentURL = window.location.href;
      var pos = documentURL.indexOf('#');
      if (pos !== -1) {
        documentURL = documentURL.slice(0, pos);
      }
      var stackSteps = stackTrace.split('\n').slice(2).map(function (line) {
        return line.trim();
      });
      var stackLines = stackSteps.map(function (line) {
        var stack;
        var getStackTraceValues = /(.*?@)?(\S+)(:\d+)(:\d+)\)?$/.exec(line);
        if (getStackTraceValues) {
          var _stackURL, _stackURL2;
          var stackURL = getStackTraceValues[2];
          var stackLine = getStackTraceValues[3];
          var stackCol = getStackTraceValues[4];
          if ((_stackURL = stackURL) !== null && _stackURL !== void 0 && _stackURL.startsWith('(')) {
            stackURL = stackURL.slice(1);
          }
          if ((_stackURL2 = stackURL) !== null && _stackURL2 !== void 0 && _stackURL2.startsWith(INJECTED_SCRIPT_MARKER)) {
            var _stackFunction;
            stackURL = INJECTED_SCRIPT_STRING;
            var stackFunction = getStackTraceValues[1] !== undefined ? getStackTraceValues[1].slice(0, -1) : line.slice(0, getStackTraceValues.index).trim();
            if ((_stackFunction = stackFunction) !== null && _stackFunction !== void 0 && _stackFunction.startsWith('at')) {
              stackFunction = stackFunction.slice(2).trim();
            }
            stack = "".concat(stackFunction, " ").concat(stackURL).concat(stackLine).concat(stackCol).trim();
          } else if (stackURL === documentURL) {
            stack = "".concat(INLINE_SCRIPT_STRING).concat(stackLine).concat(stackCol).trim();
          } else {
            stack = "".concat(stackURL).concat(stackLine).concat(stackCol).trim();
          }
        } else {
          stack = line;
        }
        return stack;
      });
      if (stackLines) {
        for (var index = 0; index < stackLines.length; index += 1) {
          if (isInlineScript(stackMatch) && stackLines[index].startsWith(INLINE_SCRIPT_STRING) && stackLines[index].match(toRegExp(stackMatch))) {
            return true;
          }
          if (isInjectedScript(stackMatch) && stackLines[index].startsWith(INJECTED_SCRIPT_STRING) && stackLines[index].match(toRegExp(stackMatch))) {
            return true;
          }
        }
      }
      return false;
    };
    var findHostElements = function findHostElements(rootElement) {
      var hosts = [];
      if (rootElement) {
        var domElems = rootElement.querySelectorAll('*');
        domElems.forEach(function (el) {
          if (el.shadowRoot) {
            hosts.push(el);
          }
        });
      }
      return hosts;
    };
    var pierceShadowDom = function pierceShadowDom(selector, hostElements) {
      var targets = [];
      var innerHostsAcc = [];
      hostElements.forEach(function (host) {
        var simpleElems = host.querySelectorAll(selector);
        targets = targets.concat([].slice.call(simpleElems));
        var shadowRootElem = host.shadowRoot;
        var shadowChildren = shadowRootElem.querySelectorAll(selector);
        targets = targets.concat([].slice.call(shadowChildren));
        innerHostsAcc.push(findHostElements(shadowRootElem));
      });
      var innerHosts = flatten(innerHostsAcc);
      return {
        targets,
        innerHosts
      };
    };
    function queryShadowSelector(selector) {
      var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.documentElement;
      var SHADOW_COMBINATOR = ' >>> ';
      var pos = selector.indexOf(SHADOW_COMBINATOR);
      if (pos === -1) {
        return context.querySelector(selector);
      }
      var shadowHostSelector = selector.slice(0, pos).trim();
      var elem = context.querySelector(shadowHostSelector);
      if (!elem || !elem.shadowRoot) {
        return null;
      }
      var shadowRootSelector = selector.slice(pos + SHADOW_COMBINATOR.length).trim();
      return queryShadowSelector(shadowRootSelector, elem.shadowRoot);
    }
    var isValidCallback = function isValidCallback(callback) {
      return callback instanceof Function
      || typeof callback === 'string';
    };
    var parseRawDelay = function parseRawDelay(delay) {
      var parsedDelay = Math.floor(parseInt(delay, 10));
      return typeof parsedDelay === 'number' && !nativeIsNaN(parsedDelay) ? parsedDelay : delay;
    };
    var isPreventionNeeded = function isPreventionNeeded(_ref) {
      var callback = _ref.callback,
        delay = _ref.delay,
        matchCallback = _ref.matchCallback,
        matchDelay = _ref.matchDelay;
      if (!isValidCallback(callback)) {
        return false;
      }
      if (!isValidMatchStr(matchCallback) || matchDelay && !isValidMatchNumber(matchDelay)) {
        return false;
      }
      var _parseMatchArg = parseMatchArg(matchCallback),
        isInvertedMatch = _parseMatchArg.isInvertedMatch,
        matchRegexp = _parseMatchArg.matchRegexp;
      var _parseDelayArg = parseDelayArg(matchDelay),
        isInvertedDelayMatch = _parseDelayArg.isInvertedDelayMatch,
        delayMatch = _parseDelayArg.delayMatch;
      var parsedDelay = parseRawDelay(delay);
      var shouldPrevent = false;
      var callbackStr = String(callback);
      if (delayMatch === null) {
        shouldPrevent = matchRegexp.test(callbackStr) !== isInvertedMatch;
      } else if (!matchCallback) {
        shouldPrevent = parsedDelay === delayMatch !== isInvertedDelayMatch;
      } else {
        shouldPrevent = matchRegexp.test(callbackStr) !== isInvertedMatch && parsedDelay === delayMatch !== isInvertedDelayMatch;
      }
      return shouldPrevent;
    };
    var handleOldReplacement = function handleOldReplacement(replacement) {
      var result;
      if (!replacement) {
        result = noopFunc;
      } else if (replacement === 'trueFunc') {
        result = trueFunc;
      } else if (replacement.includes('=')) {
        var isProp = replacement.startsWith('{') && replacement.endsWith('}');
        if (isProp) {
          var propertyPart = replacement.slice(1, -1);
          var propertyName = substringBefore(propertyPart, '=');
          var propertyValue = substringAfter(propertyPart, '=');
          if (propertyValue === 'noopFunc') {
            result = {};
            result[propertyName] = noopFunc;
          }
        }
      }
      return result;
    };
    var createDecoy = function createDecoy(args) {
      var UrlPropNameOf = function (UrlPropNameOf) {
        UrlPropNameOf["Object"] = "data";
        UrlPropNameOf["Iframe"] = "src";
        return UrlPropNameOf;
      }({});
      var replacement = args.replacement,
        url = args.url,
        delay = args.delay;
      var tag;
      if (replacement === 'obj') {
        tag = "object";
      } else {
        tag = "iframe";
      }
      var decoy = document.createElement(tag);
      if (decoy instanceof HTMLObjectElement) {
        decoy[UrlPropNameOf.Object] = url;
      } else if (decoy instanceof HTMLIFrameElement) {
        decoy[UrlPropNameOf.Iframe] = url;
      }
      decoy.style.setProperty('height', '1px', 'important');
      decoy.style.setProperty('position', 'fixed', 'important');
      decoy.style.setProperty('top', '-1px', 'important');
      decoy.style.setProperty('width', '1px', 'important');
      document.body.appendChild(decoy);
      setTimeout(function () {
        return decoy.remove();
      }, delay * 1000);
      return decoy;
    };
    var getPreventGetter = function getPreventGetter(nativeGetter) {
      var preventGetter = function preventGetter(target, prop) {
        if (prop && prop === 'closed') {
          return false;
        }
        if (typeof nativeGetter === 'function') {
          return noopFunc;
        }
        return prop && target[prop];
      };
      return preventGetter;
    };
    function getWildcardPropertyInChain(base, chain) {
      var lookThrough = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
      var output = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
      var pos = chain.indexOf('.');
      if (pos === -1) {
        if (chain === '*' || chain === '[]') {
          for (var key in base) {
            if (Object.prototype.hasOwnProperty.call(base, key)) {
              output.push({
                base,
                prop: key
              });
            }
          }
        } else {
          output.push({
            base,
            prop: chain
          });
        }
        return output;
      }
      var prop = chain.slice(0, pos);
      var shouldLookThrough = prop === '[]' && Array.isArray(base) || prop === '*' && base instanceof Object;
      if (shouldLookThrough) {
        var nextProp = chain.slice(pos + 1);
        var baseKeys = Object.keys(base);
        baseKeys.forEach(function (key) {
          var item = base[key];
          getWildcardPropertyInChain(item, nextProp, lookThrough, output);
        });
      }
      if (Array.isArray(base)) {
        base.forEach(function (key) {
          var nextBase = key;
          if (nextBase !== undefined) {
            getWildcardPropertyInChain(nextBase, chain, lookThrough, output);
          }
        });
      }
      var nextBase = base[prop];
      chain = chain.slice(pos + 1);
      if (nextBase !== undefined) {
        getWildcardPropertyInChain(nextBase, chain, lookThrough, output);
      }
      return output;
    }
    var getNativeRegexpTest = function getNativeRegexpTest() {
      var descriptor = Object.getOwnPropertyDescriptor(RegExp.prototype, 'test');
      var nativeRegexTest = descriptor === null || descriptor === void 0 ? void 0 : descriptor.value;
      if (descriptor && typeof descriptor.value === 'function') {
        return nativeRegexTest;
      }
      throw new Error('RegExp.prototype.test is not a function');
    };
    var backupRegExpValues = function backupRegExpValues() {
      try {
        var arrayOfRegexpValues = [];
        for (var index = 1; index < 10; index += 1) {
          var value = "$".concat(index);
          if (!RegExp[value]) {
            break;
          }
          arrayOfRegexpValues.push(RegExp[value]);
        }
        return arrayOfRegexpValues;
      } catch (error) {
        return [];
      }
    };
    var restoreRegExpValues = function restoreRegExpValues(array) {
      if (!array.length) {
        return;
      }
      try {
        var stringPattern = '';
        if (array.length === 1) {
          stringPattern = "(".concat(array[0], ")");
        } else {
          stringPattern = array.reduce(function (accumulator, currentValue, currentIndex) {
            if (currentIndex === 1) {
              return "(".concat(accumulator, "),(").concat(currentValue, ")");
            }
            return "".concat(accumulator, ",(").concat(currentValue, ")");
          });
        }
        var regExpGroup = new RegExp(stringPattern);
        array.toString().replace(regExpGroup, '');
      } catch (error) {
        var message = "Failed to restore RegExp values: ".concat(error);
        console.log(message);
      }
    };
    var matchStackTrace = function matchStackTrace(stackMatch, stackTrace) {
      if (!stackMatch || stackMatch === '') {
        return true;
      }
      var regExpValues = backupRegExpValues();
      if (shouldAbortInlineOrInjectedScript(stackMatch, stackTrace)) {
        if (regExpValues.length && regExpValues[0] !== RegExp.$1) {
          restoreRegExpValues(regExpValues);
        }
        return true;
      }
      var stackRegexp = toRegExp(stackMatch);
      var refinedStackTrace = stackTrace.split('\n').slice(2)
      .map(function (line) {
        return line.trim();
      })
      .join('\n');
      if (regExpValues.length && regExpValues[0] !== RegExp.$1) {
        restoreRegExpValues(regExpValues);
      }
      return getNativeRegexpTest().call(stackRegexp, refinedStackTrace);
    };
    function isPruningNeeded(source, root, prunePaths, requiredPaths, stack, nativeObjects) {
      if (!root) {
        return false;
      }
      var nativeStringify = nativeObjects.nativeStringify;
      var shouldProcess;
      if (prunePaths.length === 0 && requiredPaths.length > 0) {
        var rootString = nativeStringify(root);
        var matchRegex = toRegExp(requiredPaths.join(''));
        var shouldLog = matchRegex.test(rootString);
        if (shouldLog) {
          logMessage(source, "".concat(window.location.hostname, "\n").concat(nativeStringify(root, null, 2), "\nStack trace:\n").concat(new Error().stack), true);
          if (root && typeof root === 'object') {
            logMessage(source, root, true, false);
          }
          shouldProcess = false;
          return shouldProcess;
        }
      }
      if (stack && !matchStackTrace(stack, new Error().stack || '')) {
        shouldProcess = false;
        return shouldProcess;
      }
      var wildcardSymbols = ['.*.', '*.', '.*', '.[].', '[].', '.[]'];
      var _loop = function _loop() {
        var requiredPath = requiredPaths[i];
        var lastNestedPropName = requiredPath.split('.').pop();
        var hasWildcard = wildcardSymbols.some(function (symbol) {
          return requiredPath.includes(symbol);
        });
        var details = getWildcardPropertyInChain(root, requiredPath, hasWildcard);
        if (!details.length) {
          shouldProcess = false;
          return {
            v: shouldProcess
          };
        }
        shouldProcess = !hasWildcard;
        for (var j = 0; j < details.length; j += 1) {
          var hasRequiredProp = typeof lastNestedPropName === 'string' && details[j].base[lastNestedPropName] !== undefined;
          if (hasWildcard) {
            shouldProcess = hasRequiredProp || shouldProcess;
          } else {
            shouldProcess = hasRequiredProp && shouldProcess;
          }
        }
      };
      for (var i = 0; i < requiredPaths.length; i += 1) {
        var _ret = _loop();
        if (typeof _ret === "object") return _ret.v;
      }
      return shouldProcess;
    }
    var jsonPruner = function jsonPruner(source, root, prunePaths, requiredPaths, stack, nativeObjects) {
      var nativeStringify = nativeObjects.nativeStringify;
      if (prunePaths.length === 0 && requiredPaths.length === 0) {
        logMessage(source, "".concat(window.location.hostname, "\n").concat(nativeStringify(root, null, 2), "\nStack trace:\n").concat(new Error().stack), true);
        if (root && typeof root === 'object') {
          logMessage(source, root, true, false);
        }
        return root;
      }
      try {
        if (isPruningNeeded(source, root, prunePaths, requiredPaths, stack, nativeObjects) === false) {
          return root;
        }
        prunePaths.forEach(function (path) {
          var ownerObjArr = getWildcardPropertyInChain(root, path, true);
          ownerObjArr.forEach(function (ownerObj) {
            if (ownerObj !== undefined && ownerObj.base) {
              delete ownerObj.base[ownerObj.prop];
              hit(source);
            }
          });
        });
      } catch (e) {
        logMessage(source, e);
      }
      return root;
    };
    var getPrunePath = function getPrunePath(props) {
      var validPropsString = typeof props === 'string' && props !== undefined && props !== '';
      return validPropsString ? props.split(/ +/) : [];
    };
    var modifyResponse = function modifyResponse(origResponse) {
      var _origResponse$headers;
      var replacement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
        body: '{}'
      };
      var headers = {};
      origResponse === null || origResponse === void 0 ? void 0 : (_origResponse$headers = origResponse.headers) === null || _origResponse$headers === void 0 ? void 0 : _origResponse$headers.forEach(function (value, key) {
        headers[key] = value;
      });
      var modifiedResponse = new Response(replacement.body, {
        status: origResponse.status,
        statusText: origResponse.statusText,
        headers
      });
      Object.defineProperties(modifiedResponse, {
        url: {
          value: origResponse.url
        },
        type: {
          value: replacement.type || origResponse.type
        }
      });
      return modifiedResponse;
    };
    var forgeResponse = function forgeResponse(response, textContent) {
      var bodyUsed = response.bodyUsed,
        headers = response.headers,
        ok = response.ok,
        redirected = response.redirected,
        status = response.status,
        statusText = response.statusText,
        type = response.type,
        url = response.url;
      var forgedResponse = new Response(textContent, {
        status,
        statusText,
        headers
      });
      Object.defineProperties(forgedResponse, {
        url: {
          value: url
        },
        type: {
          value: type
        },
        ok: {
          value: ok
        },
        bodyUsed: {
          value: bodyUsed
        },
        redirected: {
          value: redirected
        }
      });
      return forgedResponse;
    };
    var getRequestProps = function getRequestProps() {
      return ['url', 'method', 'headers', 'body', 'credentials', 'cache', 'redirect', 'referrer', 'referrerPolicy', 'integrity', 'keepalive', 'signal', 'mode'];
    };
    var getRequestData = function getRequestData(request) {
      var requestInitOptions = getRequestProps();
      var entries = requestInitOptions.map(function (key) {
        var value = request[key];
        return [key, value];
      });
      return Object.fromEntries(entries);
    };
    var getFetchData = function getFetchData(args, nativeRequestClone) {
      var fetchPropsObj = {};
      var resource = args[0];
      var fetchUrl;
      var fetchInit;
      if (resource instanceof Request) {
        var realData = nativeRequestClone.call(resource);
        var requestData = getRequestData(realData);
        fetchUrl = requestData.url;
        fetchInit = requestData;
      } else {
        fetchUrl = resource;
        fetchInit = args[1];
      }
      fetchPropsObj.url = fetchUrl;
      if (fetchInit instanceof Object) {
        var props = Object.keys(fetchInit);
        props.forEach(function (prop) {
          fetchPropsObj[prop] = fetchInit[prop];
        });
      }
      return fetchPropsObj;
    };
    var getXhrData = function getXhrData(method, url, async, user, password) {
      return {
        method,
        url,
        async,
        user,
        password
      };
    };
    var parseMatchProps = function parseMatchProps(propsToMatchStr) {
      var PROPS_DIVIDER = ' ';
      var PAIRS_MARKER = ':';
      var isRequestProp = function isRequestProp(prop) {
        return getRequestProps().includes(prop);
      };
      var propsObj = {};
      var props = propsToMatchStr.split(PROPS_DIVIDER);
      props.forEach(function (prop) {
        var dividerInd = prop.indexOf(PAIRS_MARKER);
        var key = prop.slice(0, dividerInd);
        if (isRequestProp(key)) {
          var value = prop.slice(dividerInd + 1);
          propsObj[key] = value;
        } else {
          propsObj.url = prop;
        }
      });
      return propsObj;
    };
    var isValidParsedData = function isValidParsedData(data) {
      return Object.values(data).every(function (value) {
        return isValidStrPattern(value);
      });
    };
    var getMatchPropsData = function getMatchPropsData(data) {
      var matchData = {};
      var dataKeys = Object.keys(data);
      dataKeys.forEach(function (key) {
        matchData[key] = toRegExp(data[key]);
      });
      return matchData;
    };
    var setStorageItem = function setStorageItem(source, storage, key, value) {
      try {
        storage.setItem(key, value);
      } catch (e) {
        var message = "Unable to set sessionStorage item due to: ".concat(e.message);
        logMessage(source, message);
      }
    };
    var removeStorageItem = function removeStorageItem(source, storage, key) {
      try {
        if (key.startsWith('/') && (key.endsWith('/') || key.endsWith('/i')) && isValidStrPattern(key)) {
          var regExpKey = toRegExp(key);
          var storageKeys = Object.keys(storage);
          storageKeys.forEach(function (storageKey) {
            if (regExpKey.test(storageKey)) {
              storage.removeItem(storageKey);
            }
          });
        } else {
          storage.removeItem(key);
        }
      } catch (e) {
        var message = "Unable to remove storage item due to: ".concat(e.message);
        logMessage(source, message);
      }
    };
    var getLimitedStorageItemValue = function getLimitedStorageItemValue(value) {
      if (typeof value !== 'string') {
        throw new Error('Invalid value');
      }
      var allowedStorageValues = new Set(['undefined', 'false', 'true', 'null', '', 'yes', 'no', 'on', 'off', 'accept', 'accepted', 'reject', 'rejected', 'allowed', 'denied']);
      var validValue;
      if (allowedStorageValues.has(value.toLowerCase())) {
        validValue = value;
      } else if (value === 'emptyArr') {
        validValue = '[]';
      } else if (value === 'emptyObj') {
        validValue = '{}';
      } else if (/^\d+$/.test(value)) {
        validValue = parseFloat(value);
        if (nativeIsNaN(validValue)) {
          throw new Error('Invalid value');
        }
        if (Math.abs(validValue) > 32767) {
          throw new Error('Invalid value');
        }
      } else if (value === '$remove$') {
        validValue = '$remove$';
      } else {
        throw new Error('Invalid value');
      }
      return validValue;
    };
    function randomId() {
      return Math.random().toString(36).slice(2, 9);
    }
    function createOnErrorHandler(rid) {
      var nativeOnError = window.onerror;
      return function onError(error) {
        if (typeof error === 'string' && error.includes(rid)) {
          return true;
        }
        if (nativeOnError instanceof Function) {
          for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            args[_key - 1] = arguments[_key];
          }
          return nativeOnError.apply(window, [error, ...args]);
        }
        return false;
      };
    }
    function getAbortFunc() {
      var rid = randomId();
      var isErrorHandlerSet = false;
      return function abort() {
        if (!isErrorHandlerSet) {
          window.onerror = createOnErrorHandler(rid);
          isErrorHandlerSet = true;
        }
        throw new ReferenceError(rid);
      };
    }
    function getDescriptorAddon() {
      return {
        isAbortingSuspended: false,
        isolateCallback(cb) {
          this.isAbortingSuspended = true;
          try {
            for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
              args[_key - 1] = arguments[_key];
            }
            var result = cb(...args);
            this.isAbortingSuspended = false;
            return result;
          } catch (_unused) {
            var rid = randomId();
            this.isAbortingSuspended = false;
            throw new ReferenceError(rid);
          }
        }
      };
    }
    var getErrorMessage = function getErrorMessage(error) {
      var isErrorWithMessage = function isErrorWithMessage(e) {
        return typeof e === 'object' && e !== null && 'message' in e && typeof e.message === 'string';
      };
      if (isErrorWithMessage(error)) {
        return error.message;
      }
      try {
        return new Error(JSON.stringify(error)).message;
      } catch (_unused) {
        return new Error(String(error)).message;
      }
    };
    function getPropertyInChain(base, chain) {
      var pos = chain.indexOf('.');
      if (pos === -1) {
        return {
          base,
          prop: chain
        };
      }
      var prop = chain.slice(0, pos);
      if (base === null) {
        return {
          base,
          prop,
          chain
        };
      }
      var nextBase = base[prop];
      chain = chain.slice(pos + 1);
      if ((base instanceof Object || typeof base === 'object') && isEmptyObject(base)) {
        return {
          base,
          prop,
          chain
        };
      }
      if (nextBase === null) {
        return {
          base,
          prop,
          chain
        };
      }
      if (nextBase !== undefined) {
        return getPropertyInChain(nextBase, chain);
      }
      Object.defineProperty(base, prop, {
        configurable: true
      });
      return {
        base,
        prop,
        chain
      };
    }
    var matchRequestProps = function matchRequestProps(source, propsToMatch, requestData) {
      if (propsToMatch === '' || propsToMatch === '*') {
        return true;
      }
      var isMatched;
      var parsedData = parseMatchProps(propsToMatch);
      if (!isValidParsedData(parsedData)) {
        logMessage(source, "Invalid parameter: ".concat(propsToMatch));
        isMatched = false;
      } else {
        var matchData = getMatchPropsData(parsedData);
        var matchKeys = Object.keys(matchData);
        isMatched = matchKeys.every(function (matchKey) {
          var matchValue = matchData[matchKey];
          var dataValue = requestData[matchKey];
          return Object.prototype.hasOwnProperty.call(requestData, matchKey) && typeof dataValue === 'string' && (matchValue === null || matchValue === void 0 ? void 0 : matchValue.test(dataValue));
        });
      }
      return isMatched;
    };
    var throttle = function throttle(cb, delay) {
      var wait = false;
      var savedArgs;
      var wrapper = function wrapper() {
        for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
          args[_key] = arguments[_key];
        }
        if (wait) {
          savedArgs = args;
          return;
        }
        cb(...args);
        wait = true;
        setTimeout(function () {
          wait = false;
          if (savedArgs) {
            wrapper(...savedArgs);
            savedArgs = null;
          }
        }, delay);
      };
      return wrapper;
    };
    var observeDOMChanges = function observeDOMChanges(callback) {
      var observeAttrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
      var attrsToObserve = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
      var THROTTLE_DELAY_MS = 20;
      var observer = new MutationObserver(throttle(callbackWrapper, THROTTLE_DELAY_MS));
      var connect = function connect() {
        if (attrsToObserve.length > 0) {
          observer.observe(document.documentElement, {
            childList: true,
            subtree: true,
            attributes: observeAttrs,
            attributeFilter: attrsToObserve
          });
        } else {
          observer.observe(document.documentElement, {
            childList: true,
            subtree: true,
            attributes: observeAttrs
          });
        }
      };
      var disconnect = function disconnect() {
        observer.disconnect();
      };
      function callbackWrapper() {
        disconnect();
        callback();
        connect();
      }
      connect();
    };
    var getAddedNodes = function getAddedNodes(mutations) {
      var nodes = [];
      for (var i = 0; i < mutations.length; i += 1) {
        var addedNodes = mutations[i].addedNodes;
        for (var j = 0; j < addedNodes.length; j += 1) {
          nodes.push(addedNodes[j]);
        }
      }
      return nodes;
    };
    var observeDocumentWithTimeout = function observeDocumentWithTimeout(callback) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
        subtree: true,
        childList: true
      };
      var timeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10000;
      var documentObserver = new MutationObserver(function (mutations, observer) {
        observer.disconnect();
        callback(mutations, observer);
        observer.observe(document.documentElement, options);
      });
      documentObserver.observe(document.documentElement, options);
      if (typeof timeout === 'number') {
        setTimeout(function () {
          return documentObserver.disconnect();
        }, timeout);
      }
    };
    var parseFlags = function parseFlags(flags) {
      var FLAGS_DIVIDER = ' ';
      var ASAP_FLAG = 'asap';
      var COMPLETE_FLAG = 'complete';
      var STAY_FLAG = 'stay';
      var VALID_FLAGS = new Set([ASAP_FLAG, COMPLETE_FLAG, STAY_FLAG]);
      var passedFlags = new Set(flags.trim().split(FLAGS_DIVIDER).filter(function (flag) {
        return VALID_FLAGS.has(flag);
      }));
      return {
        ASAP: ASAP_FLAG,
        COMPLETE: COMPLETE_FLAG,
        STAY: STAY_FLAG,
        hasFlag: function hasFlag(flag) {
          return passedFlags.has(flag);
        }
      };
    };
    var parseKeywordValue = function parseKeywordValue(rawValue) {
      var NOW_VALUE_KEYWORD = '$now$';
      var CURRENT_DATE_KEYWORD = '$currentDate$';
      var CURRENT_ISO_DATE_KEYWORD = '$currentISODate$';
      var parsedValue = rawValue;
      if (rawValue === NOW_VALUE_KEYWORD) {
        parsedValue = Date.now().toString();
      } else if (rawValue === CURRENT_DATE_KEYWORD) {
        parsedValue = Date();
      } else if (rawValue === CURRENT_ISO_DATE_KEYWORD) {
        parsedValue = new Date().toISOString();
      }
      return parsedValue;
    };
    var hijackAttachShadow = function hijackAttachShadow(context, hostSelector, callback) {
      var handlerWrapper = function handlerWrapper(target, thisArg, args) {
        var shadowRoot = Reflect.apply(target, thisArg, args);
        if (thisArg && thisArg.matches(hostSelector || '*')) {
          callback(shadowRoot);
        }
        return shadowRoot;
      };
      var attachShadowHandler = {
        apply: handlerWrapper
      };
      context.Element.prototype.attachShadow = new Proxy(context.Element.prototype.attachShadow, attachShadowHandler);
    };
    var handleExistingNodes = function handleExistingNodes(selector, handler) {
      var nodeList = document.querySelectorAll(selector);
      var nodes = nodeListToArray(nodeList);
      handler(nodes);
    };
    var handleMutations = function handleMutations(mutations, handler) {
      var addedNodes = getAddedNodes(mutations);
      handler(addedNodes);
    };
    var isTargetNode = function isTargetNode(node, nodeNameMatch, textContentMatch) {
      var nodeName = node.nodeName,
        textContent = node.textContent;
      var nodeNameLowerCase = nodeName.toLowerCase();
      return textContent !== null && textContent !== '' && (nodeNameMatch instanceof RegExp ? nodeNameMatch.test(nodeNameLowerCase) : nodeNameMatch === nodeNameLowerCase) && (textContentMatch instanceof RegExp ? textContentMatch.test(textContent) : textContent.includes(textContentMatch));
    };
    var replaceNodeText = function replaceNodeText(source, node, pattern, replacement) {
      var textContent = node.textContent;
      if (textContent) {
        node.textContent = textContent.replace(pattern, replacement);
        hit(source);
      }
    };
    var parseNodeTextParams = function parseNodeTextParams(nodeName, textMatch) {
      var pattern = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
      var REGEXP_START_MARKER = '/';
      var isStringNameMatch = !(nodeName.startsWith(REGEXP_START_MARKER) && nodeName.endsWith(REGEXP_START_MARKER));
      var selector = isStringNameMatch ? nodeName : '*';
      var nodeNameMatch = isStringNameMatch ? nodeName : toRegExp(nodeName);
      var textContentMatch = !textMatch.startsWith(REGEXP_START_MARKER) ? textMatch : toRegExp(textMatch);
      var patternMatch;
      if (pattern) {
        patternMatch = !pattern.startsWith(REGEXP_START_MARKER) ? pattern : toRegExp(pattern);
      }
      return {
        selector,
        nodeNameMatch,
        textContentMatch,
        patternMatch
      };
    };
    function isValueMatched(value, matcher) {
      if (typeof value === 'function') {
        return false;
      }
      if (nativeIsNaN(value)) {
        return nativeIsNaN(matcher);
      }
      if (value === null || typeof value === 'undefined' || typeof value === 'number' || typeof value === 'boolean') {
        return value === matcher;
      }
      if (typeof value === 'string') {
        if (typeof matcher === 'string' || matcher instanceof RegExp) {
          return isStringMatched(value, matcher);
        }
        return false;
      }
      if (Array.isArray(value) && Array.isArray(matcher)) {
        return isArrayMatched(value, matcher);
      }
      if (isArbitraryObject(value) && isArbitraryObject(matcher)) {
        return isObjectMatched(value, matcher);
      }
      return false;
    }
    function isStringMatched(str, matcher) {
      if (typeof matcher === 'string') {
        if (matcher === '') {
          return str === matcher;
        }
        return str.includes(matcher);
      }
      if (matcher instanceof RegExp) {
        return matcher.test(str);
      }
      return false;
    }
    function isObjectMatched(obj, matcher) {
      var matcherKeys = Object.keys(matcher);
      for (var i = 0; i < matcherKeys.length; i += 1) {
        var key = matcherKeys[i];
        var value = obj[key];
        if (!isValueMatched(value, matcher[key])) {
          return false;
        }
        continue;
      }
      return true;
    }
    function isArrayMatched(array, matcher) {
      if (array.length === 0) {
        return matcher.length === 0;
      }
      if (matcher.length === 0) {
        return false;
      }
      var _loop = function _loop() {
        var matcherValue = matcher[i];
        var isMatching = array.some(function (arrItem) {
          return isValueMatched(arrItem, matcherValue);
        });
        if (!isMatching) {
          return {
            v: false
          };
        }
        return "continue";
      };
      for (var i = 0; i < matcher.length; i += 1) {
        var _ret = _loop();
        if (_ret === "continue") continue;
        if (typeof _ret === "object") return _ret.v;
      }
      return true;
    }
    function trustedClickElement$1(source, selectors) {
      var extraMatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
      var delay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : NaN;
      var reload = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
      if (!selectors) {
        return;
      }
      var SHADOW_COMBINATOR = ' >>> ';
      var OBSERVER_TIMEOUT_MS = 10000;
      var THROTTLE_DELAY_MS = 20;
      var STATIC_CLICK_DELAY_MS = 150;
      var STATIC_RELOAD_DELAY_MS = 500;
      var COOKIE_MATCH_MARKER = 'cookie:';
      var LOCAL_STORAGE_MATCH_MARKER = 'localStorage:';
      var TEXT_MATCH_MARKER = 'containsText:';
      var RELOAD_ON_FINAL_CLICK_MARKER = 'reloadAfterClick';
      var SELECTORS_DELIMITER = ',';
      var COOKIE_STRING_DELIMITER = ';';
      var COLON = ':';
      var EXTRA_MATCH_DELIMITER = /(,\s*){1}(?=!?cookie:|!?localStorage:|containsText:)/;
      var sleep = function sleep(delayMs) {
        return new Promise(function (resolve) {
          return setTimeout(resolve, delayMs);
        });
      };
      if (selectors.includes(SHADOW_COMBINATOR)) {
        var attachShadowWrapper = function attachShadowWrapper(target, thisArg, argumentsList) {
          var _argumentsList$;
          var mode = (_argumentsList$ = argumentsList[0]) === null || _argumentsList$ === void 0 ? void 0 : _argumentsList$.mode;
          if (mode === 'closed') {
            argumentsList[0].mode = 'open';
          }
          return Reflect.apply(target, thisArg, argumentsList);
        };
        var attachShadowHandler = {
          apply: attachShadowWrapper
        };
        window.Element.prototype.attachShadow = new Proxy(window.Element.prototype.attachShadow, attachShadowHandler);
      }
      var parsedDelay;
      if (delay) {
        parsedDelay = parseInt(String(delay), 10);
        var isValidDelay = !Number.isNaN(parsedDelay) || parsedDelay < OBSERVER_TIMEOUT_MS;
        if (!isValidDelay) {
          var message = "Passed delay '".concat(delay, "' is invalid or bigger than ").concat(OBSERVER_TIMEOUT_MS, " ms");
          logMessage(source, message);
          return;
        }
      }
      var canClick = !parsedDelay;
      var cookieMatches = [];
      var localStorageMatches = [];
      var textMatches = '';
      var isInvertedMatchCookie = false;
      var isInvertedMatchLocalStorage = false;
      if (extraMatch) {
        var parsedExtraMatch = extraMatch.split(EXTRA_MATCH_DELIMITER).map(function (matchStr) {
          return matchStr.trim();
        });
        parsedExtraMatch.forEach(function (matchStr) {
          if (matchStr.includes(COOKIE_MATCH_MARKER)) {
            var _parseMatchArg = parseMatchArg(matchStr),
              isInvertedMatch = _parseMatchArg.isInvertedMatch,
              matchValue = _parseMatchArg.matchValue;
            isInvertedMatchCookie = isInvertedMatch;
            var cookieMatch = matchValue.replace(COOKIE_MATCH_MARKER, '');
            cookieMatches.push(cookieMatch);
          }
          if (matchStr.includes(LOCAL_STORAGE_MATCH_MARKER)) {
            var _parseMatchArg2 = parseMatchArg(matchStr),
              _isInvertedMatch = _parseMatchArg2.isInvertedMatch,
              _matchValue = _parseMatchArg2.matchValue;
            isInvertedMatchLocalStorage = _isInvertedMatch;
            var localStorageMatch = _matchValue.replace(LOCAL_STORAGE_MATCH_MARKER, '');
            localStorageMatches.push(localStorageMatch);
          }
          if (matchStr.includes(TEXT_MATCH_MARKER)) {
            var _parseMatchArg3 = parseMatchArg(matchStr),
              _matchValue2 = _parseMatchArg3.matchValue;
            var textMatch = _matchValue2.replace(TEXT_MATCH_MARKER, '');
            textMatches = textMatch;
          }
        });
      }
      if (cookieMatches.length > 0) {
        var parsedCookieMatches = parseCookieString(cookieMatches.join(COOKIE_STRING_DELIMITER));
        var parsedCookies = parseCookieString(document.cookie);
        var cookieKeys = Object.keys(parsedCookies);
        if (cookieKeys.length === 0) {
          return;
        }
        var cookiesMatched = Object.keys(parsedCookieMatches).every(function (key) {
          var valueMatch = parsedCookieMatches[key] ? toRegExp(parsedCookieMatches[key]) : null;
          var keyMatch = toRegExp(key);
          return cookieKeys.some(function (cookieKey) {
            var keysMatched = keyMatch.test(cookieKey);
            if (!keysMatched) {
              return false;
            }
            if (!valueMatch) {
              return true;
            }
            var parsedCookieValue = parsedCookies[cookieKey];
            if (!parsedCookieValue) {
              return false;
            }
            return valueMatch.test(parsedCookieValue);
          });
        });
        var shouldRun = cookiesMatched !== isInvertedMatchCookie;
        if (!shouldRun) {
          return;
        }
      }
      if (localStorageMatches.length > 0) {
        var localStorageMatched = localStorageMatches.every(function (str) {
          var itemValue = window.localStorage.getItem(str);
          return itemValue || itemValue === '';
        });
        var _shouldRun = localStorageMatched !== isInvertedMatchLocalStorage;
        if (!_shouldRun) {
          return;
        }
      }
      var textMatchRegexp = textMatches ? toRegExp(textMatches) : null;
      var doesElementContainText = function doesElementContainText(element, matchRegexp) {
        var textContent = element.textContent;
        if (!textContent) {
          return false;
        }
        return matchRegexp.test(textContent);
      };
      var selectorsSequence = selectors.split(SELECTORS_DELIMITER).map(function (selector) {
        return selector.trim();
      });
      var createElementObj = function createElementObj(element) {
        return {
          element: element || null,
          clicked: false
        };
      };
      var elementsSequence = Array(selectorsSequence.length).fill(createElementObj(null));
      var shouldReloadAfterClick = false;
      var reloadDelayMs = STATIC_RELOAD_DELAY_MS;
      if (reload) {
        var _reload$split = reload.split(COLON),
          _reload$split2 = _slicedToArray$1(_reload$split, 2),
          reloadMarker = _reload$split2[0],
          reloadValue = _reload$split2[1];
        if (reloadMarker !== RELOAD_ON_FINAL_CLICK_MARKER) {
          logMessage(source, "Passed reload option '".concat(reload, "' is invalid"));
          return;
        }
        if (reloadValue) {
          var passedReload = Number(reloadValue);
          if (Number.isNaN(passedReload)) {
            logMessage(source, "Passed reload delay value '".concat(passedReload, "' is invalid"));
            return;
          }
          if (passedReload > OBSERVER_TIMEOUT_MS) {
            logMessage(source, "Passed reload delay value '".concat(passedReload, "' is bigger than maximum ").concat(OBSERVER_TIMEOUT_MS, " ms"));
            return;
          }
          reloadDelayMs = passedReload;
        }
        shouldReloadAfterClick = true;
      }
      var canReload = true;
      var clickElementsBySequence = async function clickElementsBySequence() {
        for (var i = 0; i < elementsSequence.length; i += 1) {
          var elementObj = elementsSequence[i];
          if (i >= 1) {
            await sleep(STATIC_CLICK_DELAY_MS);
          }
          if (!elementObj.element) {
            break;
          }
          if (!elementObj.clicked) {
            if (textMatchRegexp && !doesElementContainText(elementObj.element, textMatchRegexp)) {
              continue;
            }
            elementObj.element.click();
            elementObj.clicked = true;
          }
        }
        var allElementsClicked = elementsSequence.every(function (elementObj) {
          return elementObj.clicked === true;
        });
        if (allElementsClicked) {
          if (shouldReloadAfterClick && canReload) {
            canReload = false;
            setTimeout(function () {
              window.location.reload();
            }, reloadDelayMs);
          }
          hit(source);
        }
      };
      var handleElement = function handleElement(element, i) {
        var elementObj = createElementObj(element);
        elementsSequence[i] = elementObj;
        if (canClick) {
          clickElementsBySequence();
        }
      };
      var fulfillAndHandleSelectors = function fulfillAndHandleSelectors() {
        var fulfilledSelectors = [];
        selectorsSequence.forEach(function (selector, i) {
          if (!selector) {
            return;
          }
          var element = queryShadowSelector(selector);
          if (!element) {
            return;
          }
          handleElement(element, i);
          fulfilledSelectors.push(selector);
        });
        selectorsSequence = selectorsSequence.map(function (selector) {
          return selector && fulfilledSelectors.includes(selector) ? null : selector;
        });
        return selectorsSequence;
      };
      var findElements = function findElements(mutations, observer) {
        selectorsSequence = fulfillAndHandleSelectors();
        var allSelectorsFulfilled = selectorsSequence.every(function (selector) {
          return selector === null;
        });
        if (allSelectorsFulfilled) {
          observer.disconnect();
        }
      };
      var initializeMutationObserver = function initializeMutationObserver() {
        var observer = new MutationObserver(throttle(findElements, THROTTLE_DELAY_MS));
        observer.observe(document.documentElement, {
          attributes: true,
          childList: true,
          subtree: true
        });
        setTimeout(function () {
          return observer.disconnect();
        }, OBSERVER_TIMEOUT_MS);
      };
      var checkInitialElements = function checkInitialElements() {
        var foundElements = selectorsSequence.every(function (selector) {
          if (!selector) {
            return false;
          }
          var element = queryShadowSelector(selector);
          return !!element;
        });
        if (foundElements) {
          fulfillAndHandleSelectors();
        } else {
          initializeMutationObserver();
        }
      };
      checkInitialElements();
      if (parsedDelay) {
        setTimeout(function () {
          clickElementsBySequence();
          canClick = true;
        }, parsedDelay);
      }
    }
    trustedClickElement$1.names = ['trusted-click-element'
    ];
    trustedClickElement$1.injections = [hit, toRegExp, parseCookieString, throttle, logMessage, parseMatchArg, queryShadowSelector];
    function abortOnPropertyRead$1(source, property) {
      if (!property) {
        return;
      }
      var rid = randomId();
      var abort = function abort() {
        hit(source);
        throw new ReferenceError(rid);
      };
      var setChainPropAccess = function setChainPropAccess(owner, property) {
        var chainInfo = getPropertyInChain(owner, property);
        var base = chainInfo.base;
        var prop = chainInfo.prop,
          chain = chainInfo.chain;
        if (chain) {
          var setter = function setter(a) {
            base = a;
            if (a instanceof Object) {
              setChainPropAccess(a, chain);
            }
          };
          Object.defineProperty(owner, prop, {
            get: function get() {
              return base;
            },
            set: setter
          });
          return;
        }
        setPropertyAccess(base, prop, {
          get: abort,
          set: function set() {}
        });
      };
      setChainPropAccess(window, property);
      window.onerror = createOnErrorHandler(rid).bind();
    }
    abortOnPropertyRead$1.names = ['abort-on-property-read',
    'abort-on-property-read.js', 'ubo-abort-on-property-read.js', 'aopr.js', 'ubo-aopr.js', 'ubo-abort-on-property-read', 'ubo-aopr', 'abp-abort-on-property-read'];
    abortOnPropertyRead$1.injections = [randomId, setPropertyAccess, getPropertyInChain, createOnErrorHandler, hit, isEmptyObject];
    function abortOnPropertyWrite$1(source, property) {
      if (!property) {
        return;
      }
      var rid = randomId();
      var abort = function abort() {
        hit(source);
        throw new ReferenceError(rid);
      };
      var setChainPropAccess = function setChainPropAccess(owner, property) {
        var chainInfo = getPropertyInChain(owner, property);
        var base = chainInfo.base;
        var prop = chainInfo.prop,
          chain = chainInfo.chain;
        if (chain) {
          var setter = function setter(a) {
            base = a;
            if (a instanceof Object) {
              setChainPropAccess(a, chain);
            }
          };
          Object.defineProperty(owner, prop, {
            get: function get() {
              return base;
            },
            set: setter
          });
          return;
        }
        setPropertyAccess(base, prop, {
          set: abort
        });
      };
      setChainPropAccess(window, property);
      window.onerror = createOnErrorHandler(rid).bind();
    }
    abortOnPropertyWrite$1.names = ['abort-on-property-write',
    'abort-on-property-write.js', 'ubo-abort-on-property-write.js', 'aopw.js', 'ubo-aopw.js', 'ubo-abort-on-property-write', 'ubo-aopw', 'abp-abort-on-property-write'];
    abortOnPropertyWrite$1.injections = [randomId, setPropertyAccess, getPropertyInChain, createOnErrorHandler, hit, isEmptyObject];
    function preventSetTimeout$1(source, matchCallback, matchDelay) {
      var shouldLog = typeof matchCallback === 'undefined' && typeof matchDelay === 'undefined';
      var handlerWrapper = function handlerWrapper(target, thisArg, args) {
        var callback = args[0];
        var delay = args[1];
        var shouldPrevent = false;
        if (shouldLog) {
          hit(source);
          logMessage(source, "setTimeout(".concat(String(callback), ", ").concat(delay, ")"), true);
        } else {
          shouldPrevent = isPreventionNeeded({
            callback,
            delay,
            matchCallback,
            matchDelay
          });
        }
        if (shouldPrevent) {
          hit(source);
          args[0] = noopFunc;
        }
        return target.apply(thisArg, args);
      };
      var setTimeoutHandler = {
        apply: handlerWrapper
      };
      window.setTimeout = new Proxy(window.setTimeout, setTimeoutHandler);
    }
    preventSetTimeout$1.names = ['prevent-setTimeout',
    'no-setTimeout-if.js',
    'ubo-no-setTimeout-if.js', 'nostif.js',
    'ubo-nostif.js', 'ubo-no-setTimeout-if', 'ubo-nostif',
    'setTimeout-defuser.js', 'ubo-setTimeout-defuser.js', 'ubo-setTimeout-defuser', 'std.js', 'ubo-std.js', 'ubo-std'];
    preventSetTimeout$1.injections = [hit, noopFunc, isPreventionNeeded, logMessage,
    parseMatchArg, parseDelayArg, toRegExp, nativeIsNaN, isValidCallback, isValidMatchStr, escapeRegExp, isValidStrPattern, nativeIsFinite, isValidMatchNumber, parseRawDelay];
    function preventSetInterval$1(source, matchCallback, matchDelay) {
      var shouldLog = typeof matchCallback === 'undefined' && typeof matchDelay === 'undefined';
      var handlerWrapper = function handlerWrapper(target, thisArg, args) {
        var callback = args[0];
        var delay = args[1];
        var shouldPrevent = false;
        if (shouldLog) {
          hit(source);
          logMessage(source, "setInterval(".concat(String(callback), ", ").concat(delay, ")"), true);
        } else {
          shouldPrevent = isPreventionNeeded({
            callback,
            delay,
            matchCallback,
            matchDelay
          });
        }
        if (shouldPrevent) {
          hit(source);
          args[0] = noopFunc;
        }
        return target.apply(thisArg, args);
      };
      var setIntervalHandler = {
        apply: handlerWrapper
      };
      window.setInterval = new Proxy(window.setInterval, setIntervalHandler);
    }
    preventSetInterval$1.names = ['prevent-setInterval',
    'no-setInterval-if.js',
    'ubo-no-setInterval-if.js', 'setInterval-defuser.js',
    'ubo-setInterval-defuser.js', 'nosiif.js',
    'ubo-nosiif.js', 'sid.js',
    'ubo-sid.js', 'ubo-no-setInterval-if', 'ubo-setInterval-defuser', 'ubo-nosiif', 'ubo-sid'];
    preventSetInterval$1.injections = [hit, noopFunc, isPreventionNeeded, logMessage,
    toRegExp, nativeIsNaN, parseMatchArg, parseDelayArg, isValidCallback, isValidMatchStr, isValidStrPattern, escapeRegExp, nativeIsFinite, isValidMatchNumber, parseRawDelay];
    function preventWindowOpen$1(source) {
      var match = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '*';
      var delay = arguments.length > 2 ? arguments[2] : undefined;
      var replacement = arguments.length > 3 ? arguments[3] : undefined;
      var nativeOpen = window.open;
      var isNewSyntax = match !== '0' && match !== '1';
      var oldOpenWrapper = function oldOpenWrapper(str) {
        match = Number(match) > 0;
        for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
          args[_key - 1] = arguments[_key];
        }
        if (!isValidStrPattern(delay)) {
          logMessage(source, "Invalid parameter: ".concat(delay));
          return nativeOpen.apply(window, [str, ...args]);
        }
        var searchRegexp = toRegExp(delay);
        if (match !== searchRegexp.test(str)) {
          return nativeOpen.apply(window, [str, ...args]);
        }
        hit(source);
        return handleOldReplacement(replacement);
      };
      var newOpenWrapper = function newOpenWrapper(url) {
        var shouldLog = replacement && replacement.includes('log');
        for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
          args[_key2 - 1] = arguments[_key2];
        }
        if (shouldLog) {
          var argsStr = args && args.length > 0 ? ", ".concat(args.join(', ')) : '';
          var message = "".concat(url).concat(argsStr);
          logMessage(source, message, true);
          hit(source);
        }
        var shouldPrevent = false;
        if (match === '*') {
          shouldPrevent = true;
        } else if (isValidMatchStr(match)) {
          var _parseMatchArg = parseMatchArg(match),
            isInvertedMatch = _parseMatchArg.isInvertedMatch,
            matchRegexp = _parseMatchArg.matchRegexp;
          shouldPrevent = matchRegexp.test(url) !== isInvertedMatch;
        } else {
          logMessage(source, "Invalid parameter: ".concat(match));
          shouldPrevent = false;
        }
        if (shouldPrevent) {
          var parsedDelay = parseInt(delay, 10);
          var result;
          if (nativeIsNaN(parsedDelay)) {
            result = noopNull();
          } else {
            var decoyArgs = {
              replacement,
              url,
              delay: parsedDelay
            };
            var decoy = createDecoy(decoyArgs);
            var popup = decoy.contentWindow;
            if (typeof popup === 'object' && popup !== null) {
              Object.defineProperty(popup, 'closed', {
                value: false
              });
              Object.defineProperty(popup, 'opener', {
                value: window
              });
              Object.defineProperty(popup, 'frameElement', {
                value: null
              });
            } else {
              var nativeGetter = decoy.contentWindow && decoy.contentWindow.get;
              Object.defineProperty(decoy, 'contentWindow', {
                get: getPreventGetter(nativeGetter)
              });
              popup = decoy.contentWindow;
            }
            result = popup;
          }
          hit(source);
          return result;
        }
        return nativeOpen.apply(window, [url, ...args]);
      };
      window.open = isNewSyntax ? newOpenWrapper : oldOpenWrapper;
      window.open.toString = nativeOpen.toString.bind(nativeOpen);
    }
    preventWindowOpen$1.names = ['prevent-window-open',
    'window.open-defuser.js', 'ubo-window.open-defuser.js', 'ubo-window.open-defuser', 'nowoif.js', 'ubo-nowoif.js', 'ubo-nowoif', 'no-window-open-if.js', 'ubo-no-window-open-if.js', 'ubo-no-window-open-if'];
    preventWindowOpen$1.injections = [hit, isValidStrPattern, escapeRegExp, isValidMatchStr, toRegExp, nativeIsNaN, parseMatchArg, handleOldReplacement, createDecoy, getPreventGetter, noopNull, logMessage, noopFunc, trueFunc, substringBefore, substringAfter];
    function abortCurrentInlineScript$1(source, property, search) {
      var searchRegexp = toRegExp(search);
      var rid = randomId();
      var SRC_DATA_MARKER = 'data:text/javascript;base64,';
      var getCurrentScript = function getCurrentScript() {
        if ('currentScript' in document) {
          return document.currentScript;
        }
        var scripts = document.getElementsByTagName('script');
        return scripts[scripts.length - 1];
      };
      var ourScript = getCurrentScript();
      var abort = function abort() {
        var _scriptEl$src;
        var scriptEl = getCurrentScript();
        if (!scriptEl) {
          return;
        }
        var content = scriptEl.textContent;
        try {
          var textContentGetter = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent').get;
          content = textContentGetter.call(scriptEl);
        } catch (e) {}
        if (content.length === 0 && typeof scriptEl.src !== 'undefined' && (_scriptEl$src = scriptEl.src) !== null && _scriptEl$src !== void 0 && _scriptEl$src.startsWith(SRC_DATA_MARKER)) {
          var encodedContent = scriptEl.src.slice(SRC_DATA_MARKER.length);
          content = window.atob(encodedContent);
        }
        if (scriptEl instanceof HTMLScriptElement && content.length > 0 && scriptEl !== ourScript && searchRegexp.test(content)) {
          hit(source);
          throw new ReferenceError(rid);
        }
      };
      var setChainPropAccess = function setChainPropAccess(owner, property) {
        var chainInfo = getPropertyInChain(owner, property);
        var base = chainInfo.base;
        var prop = chainInfo.prop,
          chain = chainInfo.chain;
        if (base instanceof Object === false && base === null) {
          var props = property.split('.');
          var propIndex = props.indexOf(prop);
          var baseName = props[propIndex - 1];
          var message = "The scriptlet had been executed before the ".concat(baseName, " was loaded.");
          logMessage(source, message);
          return;
        }
        if (chain) {
          var setter = function setter(a) {
            base = a;
            if (a instanceof Object) {
              setChainPropAccess(a, chain);
            }
          };
          Object.defineProperty(owner, prop, {
            get: function get() {
              return base;
            },
            set: setter
          });
          return;
        }
        var currentValue = base[prop];
        var origDescriptor = Object.getOwnPropertyDescriptor(base, prop);
        if (origDescriptor instanceof Object === false || origDescriptor.get instanceof Function === false) {
          currentValue = base[prop];
          origDescriptor = undefined;
        }
        var descriptorWrapper = Object.assign(getDescriptorAddon(), {
          currentValue,
          get() {
            if (!this.isAbortingSuspended) {
              this.isolateCallback(abort);
            }
            if (origDescriptor instanceof Object) {
              return origDescriptor.get.call(base);
            }
            return this.currentValue;
          },
          set(newValue) {
            if (!this.isAbortingSuspended) {
              this.isolateCallback(abort);
            }
            if (origDescriptor instanceof Object) {
              origDescriptor.set.call(base, newValue);
            } else {
              this.currentValue = newValue;
            }
          }
        });
        setPropertyAccess(base, prop, {
          get() {
            return descriptorWrapper.get.call(descriptorWrapper);
          },
          set(newValue) {
            descriptorWrapper.set.call(descriptorWrapper, newValue);
          }
        });
      };
      setChainPropAccess(window, property);
      window.onerror = createOnErrorHandler(rid).bind();
    }
    abortCurrentInlineScript$1.names = ['abort-current-inline-script',
    'abort-current-script.js', 'ubo-abort-current-script.js', 'acs.js', 'ubo-acs.js',
    'ubo-abort-current-script', 'ubo-acs',
    'abort-current-inline-script.js', 'ubo-abort-current-inline-script.js', 'acis.js', 'ubo-acis.js', 'ubo-abort-current-inline-script', 'ubo-acis', 'abp-abort-current-inline-script'];
    abortCurrentInlineScript$1.injections = [randomId, setPropertyAccess, getPropertyInChain, toRegExp, createOnErrorHandler, hit, logMessage, isEmptyObject, getDescriptorAddon];
    function setConstant$1(source, property, value) {
      var stack = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      var valueWrapper = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
      var setProxyTrap = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
      var uboAliases = ['set-constant.js', 'ubo-set-constant.js', 'set.js', 'ubo-set.js', 'ubo-set-constant', 'ubo-set'];
      if (uboAliases.includes(source.name)) {
        if (stack.length !== 1 && !getNumberFromString(stack)) {
          valueWrapper = stack;
        }
        stack = undefined;
      }
      if (!property || !matchStackTrace(stack, new Error().stack)) {
        return;
      }
      var isProxyTrapSet = false;
      var emptyArr = noopArray();
      var emptyObj = noopObject();
      var constantValue;
      if (value === 'undefined') {
        constantValue = undefined;
      } else if (value === 'false') {
        constantValue = false;
      } else if (value === 'true') {
        constantValue = true;
      } else if (value === 'null') {
        constantValue = null;
      } else if (value === 'emptyArr') {
        constantValue = emptyArr;
      } else if (value === 'emptyObj') {
        constantValue = emptyObj;
      } else if (value === 'noopFunc') {
        constantValue = noopFunc;
      } else if (value === 'noopCallbackFunc') {
        constantValue = noopCallbackFunc;
      } else if (value === 'trueFunc') {
        constantValue = trueFunc;
      } else if (value === 'falseFunc') {
        constantValue = falseFunc;
      } else if (value === 'throwFunc') {
        constantValue = throwFunc;
      } else if (value === 'noopPromiseResolve') {
        constantValue = noopPromiseResolve;
      } else if (value === 'noopPromiseReject') {
        constantValue = noopPromiseReject;
      } else if (/^\d+$/.test(value)) {
        constantValue = parseFloat(value);
        if (nativeIsNaN(constantValue)) {
          return;
        }
        if (Math.abs(constantValue) > 32767) {
          return;
        }
      } else if (value === '-1') {
        constantValue = -1;
      } else if (value === '') {
        constantValue = '';
      } else if (value === 'yes') {
        constantValue = 'yes';
      } else if (value === 'no') {
        constantValue = 'no';
      } else {
        return;
      }
      var valueWrapperNames = ['asFunction', 'asCallback', 'asResolved', 'asRejected'];
      if (valueWrapperNames.includes(valueWrapper)) {
        var valueWrappersMap = {
          asFunction(v) {
            return function () {
              return v;
            };
          },
          asCallback(v) {
            return function () {
              return function () {
                return v;
              };
            };
          },
          asResolved(v) {
            return Promise.resolve(v);
          },
          asRejected(v) {
            return Promise.reject(v);
          }
        };
        constantValue = valueWrappersMap[valueWrapper](constantValue);
      }
      var canceled = false;
      var mustCancel = function mustCancel(value) {
        if (canceled) {
          return canceled;
        }
        canceled = value !== undefined && constantValue !== undefined && typeof value !== typeof constantValue && value !== null;
        return canceled;
      };
      var trapProp = function trapProp(base, prop, configurable, handler) {
        if (!handler.init(base[prop])) {
          return false;
        }
        var origDescriptor = Object.getOwnPropertyDescriptor(base, prop);
        var prevSetter;
        if (origDescriptor instanceof Object) {
          if (!origDescriptor.configurable) {
            var message = "Property '".concat(prop, "' is not configurable");
            logMessage(source, message);
            return false;
          }
          if (base[prop]) {
            base[prop] = constantValue;
          }
          if (origDescriptor.set instanceof Function) {
            prevSetter = origDescriptor.set;
          }
        }
        Object.defineProperty(base, prop, {
          configurable,
          get() {
            return handler.get();
          },
          set(a) {
            if (prevSetter !== undefined) {
              prevSetter(a);
            }
            if (a instanceof Object) {
              var propertiesToCheck = property.split('.').slice(1);
              if (setProxyTrap && !isProxyTrapSet) {
                isProxyTrapSet = true;
                a = new Proxy(a, {
                  get: function get(target, propertyKey, val) {
                    propertiesToCheck.reduce(function (object, currentProp, index, array) {
                      var currentObj = object === null || object === void 0 ? void 0 : object[currentProp];
                      if (index === array.length - 1 && currentObj !== constantValue) {
                        object[currentProp] = constantValue;
                      }
                      return currentObj || object;
                    }, target);
                    return Reflect.get(target, propertyKey, val);
                  }
                });
              }
            }
            handler.set(a);
          }
        });
        return true;
      };
      var setChainPropAccess = function setChainPropAccess(owner, property) {
        var chainInfo = getPropertyInChain(owner, property);
        var base = chainInfo.base;
        var prop = chainInfo.prop,
          chain = chainInfo.chain;
        var inChainPropHandler = {
          factValue: undefined,
          init(a) {
            this.factValue = a;
            return true;
          },
          get() {
            return this.factValue;
          },
          set(a) {
            if (this.factValue === a) {
              return;
            }
            this.factValue = a;
            if (a instanceof Object) {
              setChainPropAccess(a, chain);
            }
          }
        };
        var endPropHandler = {
          init(a) {
            if (mustCancel(a)) {
              return false;
            }
            return true;
          },
          get() {
            return constantValue;
          },
          set(a) {
            if (!mustCancel(a)) {
              return;
            }
            constantValue = a;
          }
        };
        if (!chain) {
          var isTrapped = trapProp(base, prop, false, endPropHandler);
          if (isTrapped) {
            hit(source);
          }
          return;
        }
        if (base !== undefined && base[prop] === null) {
          trapProp(base, prop, true, inChainPropHandler);
          return;
        }
        if ((base instanceof Object || typeof base === 'object') && isEmptyObject(base)) {
          trapProp(base, prop, true, inChainPropHandler);
        }
        var propValue = owner[prop];
        if (propValue instanceof Object || typeof propValue === 'object' && propValue !== null) {
          setChainPropAccess(propValue, chain);
        }
        trapProp(base, prop, true, inChainPropHandler);
      };
      setChainPropAccess(window, property);
    }
    setConstant$1.names = ['set-constant',
    'set-constant.js', 'ubo-set-constant.js', 'set.js', 'ubo-set.js', 'ubo-set-constant', 'ubo-set', 'abp-override-property-read'];
    setConstant$1.injections = [hit, logMessage, getNumberFromString, noopArray, noopObject, noopFunc, noopCallbackFunc, trueFunc, falseFunc, throwFunc, noopPromiseReject, noopPromiseResolve, getPropertyInChain, matchStackTrace, nativeIsNaN, isEmptyObject,
    shouldAbortInlineOrInjectedScript, getNativeRegexpTest, setPropertyAccess, toRegExp, backupRegExpValues, restoreRegExpValues];
    function removeCookie$1(source, match) {
      var matchRegexp = toRegExp(match);
      var removeCookieFromHost = function removeCookieFromHost(cookieName, hostName) {
        var cookieSpec = "".concat(cookieName, "=");
        var domain1 = "; domain=".concat(hostName);
        var domain2 = "; domain=.".concat(hostName);
        var path = '; path=/';
        var expiration = '; expires=Thu, 01 Jan 1970 00:00:00 GMT';
        document.cookie = cookieSpec + expiration;
        document.cookie = cookieSpec + domain1 + expiration;
        document.cookie = cookieSpec + domain2 + expiration;
        document.cookie = cookieSpec + path + expiration;
        document.cookie = cookieSpec + domain1 + path + expiration;
        document.cookie = cookieSpec + domain2 + path + expiration;
        hit(source);
      };
      var rmCookie = function rmCookie() {
        document.cookie.split(';').forEach(function (cookieStr) {
          var pos = cookieStr.indexOf('=');
          if (pos === -1) {
            return;
          }
          var cookieName = cookieStr.slice(0, pos).trim();
          if (!matchRegexp.test(cookieName)) {
            return;
          }
          var hostParts = document.location.hostname.split('.');
          for (var i = 0; i <= hostParts.length - 1; i += 1) {
            var hostName = hostParts.slice(i).join('.');
            if (hostName) {
              removeCookieFromHost(cookieName, hostName);
            }
          }
        });
      };
      rmCookie();
      window.addEventListener('beforeunload', rmCookie);
    }
    removeCookie$1.names = ['remove-cookie',
    'cookie-remover.js', 'ubo-cookie-remover.js', 'ubo-cookie-remover', 'remove-cookie.js', 'ubo-remove-cookie.js', 'ubo-remove-cookie', 'abp-cookie-remover'];
    removeCookie$1.injections = [toRegExp, hit];
    function preventAddEventListener$1(source, typeSearch, listenerSearch) {
      var typeSearchRegexp = toRegExp(typeSearch);
      var listenerSearchRegexp = toRegExp(listenerSearch);
      var nativeAddEventListener = window.EventTarget.prototype.addEventListener;
      function addEventListenerWrapper(type, listener) {
        var _this$constructor;
        var shouldPrevent = false;
        if (validateType(type) && validateListener(listener)) {
          shouldPrevent = typeSearchRegexp.test(type.toString()) && listenerSearchRegexp.test(listenerToString(listener));
        }
        if (shouldPrevent) {
          hit(source);
          return undefined;
        }
        var context = this;
        if (this && ((_this$constructor = this.constructor) === null || _this$constructor === void 0 ? void 0 : _this$constructor.name) === 'Window' && this !== window) {
          context = window;
        }
        for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
          args[_key - 2] = arguments[_key];
        }
        return nativeAddEventListener.apply(context, [type, listener, ...args]);
      }
      var descriptor = {
        configurable: true,
        set: function set() {},
        get: function get() {
          return addEventListenerWrapper;
        }
      };
      Object.defineProperty(window.EventTarget.prototype, 'addEventListener', descriptor);
      Object.defineProperty(window, 'addEventListener', descriptor);
      Object.defineProperty(document, 'addEventListener', descriptor);
    }
    preventAddEventListener$1.names = ['prevent-addEventListener',
    'addEventListener-defuser.js', 'ubo-addEventListener-defuser.js', 'aeld.js', 'ubo-aeld.js', 'ubo-addEventListener-defuser', 'ubo-aeld', 'abp-prevent-listener'];
    preventAddEventListener$1.injections = [hit, toRegExp, validateType, validateListener, listenerToString];
    function preventBab$2(source) {
      var nativeSetTimeout = window.setTimeout;
      var babRegex = /\.bab_elementid.$/;
      var timeoutWrapper = function timeoutWrapper(callback) {
        if (typeof callback !== 'string' || !babRegex.test(callback)) {
          for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            args[_key - 1] = arguments[_key];
          }
          return nativeSetTimeout.apply(window, [callback, ...args]);
        }
        hit(source);
      };
      window.setTimeout = timeoutWrapper;
      var signatures = [['blockadblock'], ['babasbm'], [/getItem\('babn'\)/], ['getElementById', 'String.fromCharCode', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'charAt', 'DOMContentLoaded', 'AdBlock', 'addEventListener', 'doScroll', 'fromCharCode', '<<2|r>>4', 'sessionStorage', 'clientWidth', 'localStorage', 'Math', 'random']];
      var check = function check(str) {
        if (typeof str !== 'string') {
          return false;
        }
        for (var i = 0; i < signatures.length; i += 1) {
          var tokens = signatures[i];
          var match = 0;
          for (var j = 0; j < tokens.length; j += 1) {
            var token = tokens[j];
            var found = token instanceof RegExp ? token.test(str) : str.includes(token);
            if (found) {
              match += 1;
            }
          }
          if (match / tokens.length >= 0.8) {
            return true;
          }
        }
        return false;
      };
      var nativeEval = window.eval;
      var evalWrapper = function evalWrapper(str) {
        if (!check(str)) {
          return nativeEval(str);
        }
        hit(source);
        var bodyEl = document.body;
        if (bodyEl) {
          bodyEl.style.removeProperty('visibility');
        }
        var el = document.getElementById('babasbmsgx');
        if (el) {
          el.parentNode.removeChild(el);
        }
      };
      window.eval = evalWrapper.bind(window);
    }
    preventBab$2.names = ['prevent-bab'
    ];
    preventBab$2.injections = [hit];
    function nowebrtc$1(source) {
      var propertyName = '';
      if (window.RTCPeerConnection) {
        propertyName = 'RTCPeerConnection';
      } else if (window.webkitRTCPeerConnection) {
        propertyName = 'webkitRTCPeerConnection';
      }
      if (propertyName === '') {
        return;
      }
      var rtcReplacement = function rtcReplacement(config) {
        var message = "Document tried to create an RTCPeerConnection: ".concat(convertRtcConfigToString(config));
        logMessage(source, message);
        hit(source);
      };
      rtcReplacement.prototype = {
        close: noopFunc,
        createDataChannel: noopFunc,
        createOffer: noopFunc,
        setRemoteDescription: noopFunc
      };
      var rtc = window[propertyName];
      window[propertyName] = rtcReplacement;
      if (rtc.prototype) {
        rtc.prototype.createDataChannel = function (a, b) {
          return {
            close: noopFunc,
            send: noopFunc
          };
        }.bind(null);
      }
    }
    nowebrtc$1.names = ['nowebrtc',
    'nowebrtc.js', 'ubo-nowebrtc.js', 'ubo-nowebrtc'];
    nowebrtc$1.injections = [hit, noopFunc, logMessage, convertRtcConfigToString];
    function logAddEventListener$1(source) {
      var nativeAddEventListener = window.EventTarget.prototype.addEventListener;
      function addEventListenerWrapper(type, listener) {
        var _this$constructor;
        if (validateType(type) && validateListener(listener)) {
          var message = "addEventListener(\"".concat(type, "\", ").concat(listenerToString(listener), ")");
          logMessage(source, message, true);
          hit(source);
        } else {
          var _message = "Invalid event type or listener passed to addEventListener:\n        type: ".concat(convertTypeToString(type), "\n        listener: ").concat(convertTypeToString(listener));
          logMessage(source, _message, true);
        }
        var context = this;
        if (this && ((_this$constructor = this.constructor) === null || _this$constructor === void 0 ? void 0 : _this$constructor.name) === 'Window' && this !== window) {
          context = window;
        }
        for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
          args[_key - 2] = arguments[_key];
        }
        return nativeAddEventListener.apply(context, [type, listener, ...args]);
      }
      var descriptor = {
        configurable: true,
        set: function set() {},
        get: function get() {
          return addEventListenerWrapper;
        }
      };
      Object.defineProperty(window.EventTarget.prototype, 'addEventListener', descriptor);
      Object.defineProperty(window, 'addEventListener', descriptor);
      Object.defineProperty(document, 'addEventListener', descriptor);
    }
    logAddEventListener$1.names = ['log-addEventListener',
    'addEventListener-logger.js', 'ubo-addEventListener-logger.js', 'aell.js', 'ubo-aell.js', 'ubo-addEventListener-logger', 'ubo-aell'];
    logAddEventListener$1.injections = [hit, validateType, validateListener, listenerToString, convertTypeToString, logMessage, objectToString$1, isEmptyObject];
    function logEval$1(source) {
      var nativeEval = window.eval;
      function evalWrapper(str) {
        hit(source);
        logMessage(source, "eval(\"".concat(str, "\")"), true);
        return nativeEval(str);
      }
      window.eval = evalWrapper;
      var nativeFunction = window.Function;
      function FunctionWrapper() {
        hit(source);
        for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
          args[_key] = arguments[_key];
        }
        logMessage(source, "new Function(".concat(args.join(', '), ")"), true);
        return nativeFunction.apply(this, [...args]);
      }
      FunctionWrapper.prototype = Object.create(nativeFunction.prototype);
      FunctionWrapper.prototype.constructor = FunctionWrapper;
      window.Function = FunctionWrapper;
    }
    logEval$1.names = ['log-eval'];
    logEval$1.injections = [hit, logMessage];
    function log$1() {
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      console.log(args);
    }
    log$1.names = ['log', 'abp-log'];
    function noeval$1(source) {
      window.eval = function evalWrapper(s) {
        hit(source);
        logMessage(source, "AdGuard has prevented eval:\n".concat(s), true);
      }.bind();
    }
    noeval$1.names = ['noeval',
    'noeval.js', 'silent-noeval.js', 'ubo-noeval.js', 'ubo-silent-noeval.js', 'ubo-noeval', 'ubo-silent-noeval'];
    noeval$1.injections = [hit, logMessage];
    function preventEvalIf$1(source, search) {
      var searchRegexp = toRegExp(search);
      var nativeEval = window.eval;
      window.eval = function (payload) {
        if (!searchRegexp.test(payload.toString())) {
          return nativeEval.call(window, payload);
        }
        hit(source);
        return undefined;
      }.bind(window);
    }
    preventEvalIf$1.names = ['prevent-eval-if',
    'noeval-if.js', 'ubo-noeval-if.js', 'ubo-noeval-if'];
    preventEvalIf$1.injections = [toRegExp, hit];
    function preventFab$1(source) {
      hit(source);
      var Fab = function Fab() {};
      Fab.prototype.check = noopFunc;
      Fab.prototype.clearEvent = noopFunc;
      Fab.prototype.emitEvent = noopFunc;
      Fab.prototype.on = function (a, b) {
        if (!a) {
          b();
        }
        return this;
      };
      Fab.prototype.onDetected = noopThis;
      Fab.prototype.onNotDetected = function (a) {
        a();
        return this;
      };
      Fab.prototype.setOption = noopFunc;
      Fab.prototype.options = {
        set: noopFunc,
        get: noopFunc
      };
      var fab = new Fab();
      var getSetFab = {
        get() {
          return Fab;
        },
        set() {}
      };
      var getsetfab = {
        get() {
          return fab;
        },
        set() {}
      };
      if (Object.prototype.hasOwnProperty.call(window, 'FuckAdBlock')) {
        window.FuckAdBlock = Fab;
      } else {
        Object.defineProperty(window, 'FuckAdBlock', getSetFab);
      }
      if (Object.prototype.hasOwnProperty.call(window, 'BlockAdBlock')) {
        window.BlockAdBlock = Fab;
      } else {
        Object.defineProperty(window, 'BlockAdBlock', getSetFab);
      }
      if (Object.prototype.hasOwnProperty.call(window, 'SniffAdBlock')) {
        window.SniffAdBlock = Fab;
      } else {
        Object.defineProperty(window, 'SniffAdBlock', getSetFab);
      }
      if (Object.prototype.hasOwnProperty.call(window, 'fuckAdBlock')) {
        window.fuckAdBlock = fab;
      } else {
        Object.defineProperty(window, 'fuckAdBlock', getsetfab);
      }
      if (Object.prototype.hasOwnProperty.call(window, 'blockAdBlock')) {
        window.blockAdBlock = fab;
      } else {
        Object.defineProperty(window, 'blockAdBlock', getsetfab);
      }
      if (Object.prototype.hasOwnProperty.call(window, 'sniffAdBlock')) {
        window.sniffAdBlock = fab;
      } else {
        Object.defineProperty(window, 'sniffAdBlock', getsetfab);
      }
    }
    preventFab$1.names = ['prevent-fab-3.2.0',
    'nofab.js', 'ubo-nofab.js', 'fuckadblock.js-3.2.0', 'ubo-fuckadblock.js-3.2.0', 'ubo-nofab'];
    preventFab$1.injections = [hit, noopFunc, noopThis];
    function setPopadsDummy$1(source) {
      delete window.PopAds;
      delete window.popns;
      Object.defineProperties(window, {
        PopAds: {
          get: function get() {
            hit(source);
            return {};
          }
        },
        popns: {
          get: function get() {
            hit(source);
            return {};
          }
        }
      });
    }
    setPopadsDummy$1.names = ['set-popads-dummy',
    'popads-dummy.js', 'ubo-popads-dummy.js', 'ubo-popads-dummy'];
    setPopadsDummy$1.injections = [hit];
    function preventPopadsNet$1(source) {
      var rid = randomId();
      var throwError = function throwError() {
        throw new ReferenceError(rid);
      };
      delete window.PopAds;
      delete window.popns;
      Object.defineProperties(window, {
        PopAds: {
          set: throwError
        },
        popns: {
          set: throwError
        }
      });
      window.onerror = createOnErrorHandler(rid).bind();
      hit(source);
    }
    preventPopadsNet$1.names = ['prevent-popads-net',
    'popads.net.js', 'ubo-popads.net.js', 'ubo-popads.net'];
    preventPopadsNet$1.injections = [createOnErrorHandler, randomId, hit];
    function preventAdfly$1(source) {
      var isDigit = function isDigit(data) {
        return /^\d$/.test(data);
      };
      var handler = function handler(encodedURL) {
        var evenChars = '';
        var oddChars = '';
        for (var i = 0; i < encodedURL.length; i += 1) {
          if (i % 2 === 0) {
            evenChars += encodedURL.charAt(i);
          } else {
            oddChars = encodedURL.charAt(i) + oddChars;
          }
        }
        var data = (evenChars + oddChars).split('');
        for (var _i = 0; _i < data.length; _i += 1) {
          if (isDigit(data[_i])) {
            for (var ii = _i + 1; ii < data.length; ii += 1) {
              if (isDigit(data[ii])) {
                var temp = parseInt(data[_i], 10) ^ parseInt(data[ii], 10);
                if (temp < 10) {
                  data[_i] = temp.toString();
                }
                _i = ii;
                break;
              }
            }
          }
        }
        data = data.join('');
        var decodedURL = window.atob(data).slice(16, -16);
        if (window.stop) {
          window.stop();
        }
        window.onbeforeunload = null;
        window.location.href = decodedURL;
      };
      var val;
      var applyHandler = true;
      var result = setPropertyAccess(window, 'ysmm', {
        configurable: false,
        set: function set(value) {
          if (applyHandler) {
            applyHandler = false;
            try {
              if (typeof value === 'string') {
                handler(value);
              }
            } catch (err) {}
          }
          val = value;
        },
        get: function get() {
          return val;
        }
      });
      if (result) {
        hit(source);
      } else {
        logMessage(source, 'Failed to set up prevent-adfly scriptlet');
      }
    }
    preventAdfly$1.names = ['prevent-adfly'
    ];
    preventAdfly$1.injections = [setPropertyAccess, hit, logMessage];
    function debugOnPropertyRead$1(source, property) {
      if (!property) {
        return;
      }
      var rid = randomId();
      var abort = function abort() {
        hit(source);
        debugger;
      };
      var setChainPropAccess = function setChainPropAccess(owner, property) {
        var chainInfo = getPropertyInChain(owner, property);
        var base = chainInfo.base;
        var prop = chainInfo.prop,
          chain = chainInfo.chain;
        if (chain) {
          var setter = function setter(a) {
            base = a;
            if (a instanceof Object) {
              setChainPropAccess(a, chain);
            }
          };
          Object.defineProperty(owner, prop, {
            get: function get() {
              return base;
            },
            set: setter
          });
          return;
        }
        setPropertyAccess(base, prop, {
          get: abort,
          set: noopFunc
        });
      };
      setChainPropAccess(window, property);
      window.onerror = createOnErrorHandler(rid).bind();
    }
    debugOnPropertyRead$1.names = ['debug-on-property-read'];
    debugOnPropertyRead$1.injections = [randomId, setPropertyAccess, getPropertyInChain, createOnErrorHandler, hit, noopFunc, isEmptyObject];
    function debugOnPropertyWrite$1(source, property) {
      if (!property) {
        return;
      }
      var rid = randomId();
      var abort = function abort() {
        hit(source);
        debugger;
      };
      var setChainPropAccess = function setChainPropAccess(owner, property) {
        var chainInfo = getPropertyInChain(owner, property);
        var base = chainInfo.base;
        var prop = chainInfo.prop,
          chain = chainInfo.chain;
        if (chain) {
          var setter = function setter(a) {
            base = a;
            if (a instanceof Object) {
              setChainPropAccess(a, chain);
            }
          };
          Object.defineProperty(owner, prop, {
            get: function get() {
              return base;
            },
            set: setter
          });
          return;
        }
        setPropertyAccess(base, prop, {
          set: abort
        });
      };
      setChainPropAccess(window, property);
      window.onerror = createOnErrorHandler(rid).bind();
    }
    debugOnPropertyWrite$1.names = ['debug-on-property-write'];
    debugOnPropertyWrite$1.injections = [randomId, setPropertyAccess, getPropertyInChain, createOnErrorHandler, hit, isEmptyObject];
    function debugCurrentInlineScript$1(source, property, search) {
      var searchRegexp = toRegExp(search);
      var rid = randomId();
      var getCurrentScript = function getCurrentScript() {
        if ('currentScript' in document) {
          return document.currentScript;
        }
        var scripts = document.getElementsByTagName('script');
        return scripts[scripts.length - 1];
      };
      var ourScript = getCurrentScript();
      var abort = function abort() {
        var scriptEl = getCurrentScript();
        if (!scriptEl) {
          return;
        }
        var content = scriptEl.textContent;
        try {
          var textContentGetter = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent').get;
          content = textContentGetter.call(scriptEl);
        } catch (e) {}
        if (scriptEl instanceof HTMLScriptElement && content.length > 0 && scriptEl !== ourScript && searchRegexp.test(content)) {
          hit(source);
          debugger;
        }
      };
      var setChainPropAccess = function setChainPropAccess(owner, property) {
        var chainInfo = getPropertyInChain(owner, property);
        var base = chainInfo.base;
        var prop = chainInfo.prop,
          chain = chainInfo.chain;
        if (base instanceof Object === false && base === null) {
          var props = property.split('.');
          var propIndex = props.indexOf(prop);
          var baseName = props[propIndex - 1];
          var message = "The scriptlet had been executed before the ".concat(baseName, " was loaded.");
          logMessage(message, source.verbose);
          return;
        }
        if (chain) {
          var setter = function setter(a) {
            base = a;
            if (a instanceof Object) {
              setChainPropAccess(a, chain);
            }
          };
          Object.defineProperty(owner, prop, {
            get: function get() {
              return base;
            },
            set: setter
          });
          return;
        }
        var currentValue = base[prop];
        setPropertyAccess(base, prop, {
          set: function set(value) {
            abort();
            currentValue = value;
          },
          get: function get() {
            abort();
            return currentValue;
          }
        });
      };
      setChainPropAccess(window, property);
      window.onerror = createOnErrorHandler(rid).bind();
    }
    debugCurrentInlineScript$1.names = ['debug-current-inline-script'];
    debugCurrentInlineScript$1.injections = [randomId, setPropertyAccess, getPropertyInChain, toRegExp, createOnErrorHandler, hit, logMessage, isEmptyObject];
    function removeAttr$1(source, attrs, selector) {
      var applying = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'asap stay';
      if (!attrs) {
        return;
      }
      attrs = attrs.split(/\s*\|\s*/);
      if (!selector) {
        selector = "[".concat(attrs.join('],['), "]");
      }
      var rmattr = function rmattr() {
        var nodes = [];
        try {
          nodes = [].slice.call(document.querySelectorAll(selector));
        } catch (e) {
          logMessage(source, "Invalid selector arg: '".concat(selector, "'"));
        }
        var removed = false;
        nodes.forEach(function (node) {
          attrs.forEach(function (attr) {
            node.removeAttribute(attr);
            removed = true;
          });
        });
        if (removed) {
          hit(source);
        }
      };
      var flags = parseFlags(applying);
      var run = function run() {
        rmattr();
        if (!flags.hasFlag(flags.STAY)) {
          return;
        }
        observeDOMChanges(rmattr, true);
      };
      if (flags.hasFlag(flags.ASAP)) {
        if (document.readyState === 'loading') {
          window.addEventListener('DOMContentLoaded', rmattr, {
            once: true
          });
        } else {
          rmattr();
        }
      }
      if (document.readyState !== 'complete' && flags.hasFlag(flags.COMPLETE)) {
        window.addEventListener('load', run, {
          once: true
        });
      } else if (flags.hasFlag(flags.STAY)) {
        if (!applying.includes(' ')) {
          rmattr();
        }
        observeDOMChanges(rmattr, true);
      }
    }
    removeAttr$1.names = ['remove-attr',
    'remove-attr.js', 'ubo-remove-attr.js', 'ra.js', 'ubo-ra.js', 'ubo-remove-attr', 'ubo-ra'];
    removeAttr$1.injections = [hit, observeDOMChanges, parseFlags, logMessage,
    throttle];
    function setAttr$1(source, selector, attr) {
      var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      if (!selector || !attr) {
        return;
      }
      var allowedValues = ['true', 'false'];
      var shouldCopyValue = value.startsWith('[') && value.endsWith(']');
      var isValidValue = value.length === 0 || !nativeIsNaN(parseInt(value, 10)) && parseInt(value, 10) >= 0 && parseInt(value, 10) <= 32767 || allowedValues.includes(value.toLowerCase());
      if (!shouldCopyValue && !isValidValue) {
        logMessage(source, "Invalid attribute value provided: '".concat(convertTypeToString(value), "'"));
        return;
      }
      var attributeHandler;
      if (shouldCopyValue) {
        attributeHandler = function attributeHandler(elem, attr, value) {
          var valueToCopy = elem.getAttribute(value.slice(1, -1));
          if (valueToCopy === null) {
            logMessage(source, "No element attribute found to copy value from: ".concat(value));
          }
          elem.setAttribute(attr, valueToCopy);
        };
      }
      setAttributeBySelector(source, selector, attr, value, attributeHandler);
      observeDOMChanges(function () {
        return setAttributeBySelector(source, selector, attr, value, attributeHandler);
      }, true);
    }
    setAttr$1.names = ['set-attr',
    'set-attr.js', 'ubo-set-attr.js', 'ubo-set-attr'];
    setAttr$1.injections = [setAttributeBySelector, observeDOMChanges, nativeIsNaN, convertTypeToString,
    defaultAttributeSetter, logMessage, throttle, hit];
    function removeClass$1(source, classNames, selector) {
      var applying = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'asap stay';
      if (!classNames) {
        return;
      }
      classNames = classNames.split(/\s*\|\s*/);
      var selectors = [];
      if (!selector) {
        selectors = classNames.map(function (className) {
          return ".".concat(className);
        });
      }
      var removeClassHandler = function removeClassHandler() {
        var nodes = new Set();
        if (selector) {
          var foundNodes = [];
          try {
            foundNodes = [].slice.call(document.querySelectorAll(selector));
          } catch (e) {
            logMessage(source, "Invalid selector arg: '".concat(selector, "'"));
          }
          foundNodes.forEach(function (n) {
            return nodes.add(n);
          });
        } else if (selectors.length > 0) {
          selectors.forEach(function (s) {
            var elements = document.querySelectorAll(s);
            for (var i = 0; i < elements.length; i += 1) {
              var element = elements[i];
              nodes.add(element);
            }
          });
        }
        var removed = false;
        nodes.forEach(function (node) {
          classNames.forEach(function (className) {
            if (node.classList.contains(className)) {
              node.classList.remove(className);
              removed = true;
            }
          });
        });
        if (removed) {
          hit(source);
        }
      };
      var CLASS_ATTR_NAME = ['class'];
      var flags = parseFlags(applying);
      var run = function run() {
        removeClassHandler();
        if (!flags.hasFlag(flags.STAY)) {
          return;
        }
        observeDOMChanges(removeClassHandler, true, CLASS_ATTR_NAME);
      };
      if (flags.hasFlag(flags.ASAP)) {
        if (document.readyState === 'loading') {
          window.addEventListener('DOMContentLoaded', removeClassHandler, {
            once: true
          });
        } else {
          removeClassHandler();
        }
      }
      if (document.readyState !== 'complete' && flags.hasFlag(flags.COMPLETE)) {
        window.addEventListener('load', run, {
          once: true
        });
      } else if (flags.hasFlag(flags.STAY)) {
        if (!applying.includes(' ')) {
          removeClassHandler();
        }
        observeDOMChanges(removeClassHandler, true, CLASS_ATTR_NAME);
      }
    }
    removeClass$1.names = ['remove-class',
    'remove-class.js', 'ubo-remove-class.js', 'rc.js', 'ubo-rc.js', 'ubo-remove-class', 'ubo-rc'];
    removeClass$1.injections = [hit, logMessage, observeDOMChanges, parseFlags,
    throttle];
    function disableNewtabLinks$1(source) {
      document.addEventListener('click', function (ev) {
        var target = ev.target;
        while (target !== null) {
          if (target.localName === 'a' && target.hasAttribute('target')) {
            ev.stopPropagation();
            ev.preventDefault();
            hit(source);
            break;
          }
          target = target.parentNode;
        }
      });
    }
    disableNewtabLinks$1.names = ['disable-newtab-links',
    'disable-newtab-links.js', 'ubo-disable-newtab-links.js', 'ubo-disable-newtab-links'];
    disableNewtabLinks$1.injections = [hit];
    function adjustSetInterval$1(source, matchCallback, matchDelay, boost) {
      var nativeSetInterval = window.setInterval;
      var matchRegexp = toRegExp(matchCallback);
      var intervalWrapper = function intervalWrapper(callback, delay) {
        if (!isValidCallback(callback)) {
          var message = "Scriptlet can't be applied because of invalid callback: '".concat(String(callback), "'");
          logMessage(source, message);
        } else if (matchRegexp.test(callback.toString()) && isDelayMatched(matchDelay, delay)) {
          delay *= getBoostMultiplier(boost);
          hit(source);
        }
        for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
          args[_key - 2] = arguments[_key];
        }
        return nativeSetInterval.apply(window, [callback, delay, ...args]);
      };
      window.setInterval = intervalWrapper;
    }
    adjustSetInterval$1.names = ['adjust-setInterval',
    'nano-setInterval-booster.js', 'ubo-nano-setInterval-booster.js', 'nano-sib.js', 'ubo-nano-sib.js', 'adjust-setInterval.js', 'ubo-adjust-setInterval.js', 'ubo-nano-setInterval-booster', 'ubo-nano-sib', 'ubo-adjust-setInterval'];
    adjustSetInterval$1.injections = [hit, isValidCallback, toRegExp, getBoostMultiplier, isDelayMatched, logMessage,
    nativeIsNaN, nativeIsFinite, getMatchDelay, shouldMatchAnyDelay];
    function adjustSetTimeout$1(source, matchCallback, matchDelay, boost) {
      var nativeSetTimeout = window.setTimeout;
      var matchRegexp = toRegExp(matchCallback);
      var timeoutWrapper = function timeoutWrapper(callback, delay) {
        if (!isValidCallback(callback)) {
          var message = "Scriptlet can't be applied because of invalid callback: '".concat(String(callback), "'");
          logMessage(source, message);
        } else if (matchRegexp.test(callback.toString()) && isDelayMatched(matchDelay, delay)) {
          delay *= getBoostMultiplier(boost);
          hit(source);
        }
        for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
          args[_key - 2] = arguments[_key];
        }
        return nativeSetTimeout.apply(window, [callback, delay, ...args]);
      };
      window.setTimeout = timeoutWrapper;
    }
    adjustSetTimeout$1.names = ['adjust-setTimeout',
    'adjust-setTimeout.js', 'ubo-adjust-setTimeout.js', 'nano-setTimeout-booster.js', 'ubo-nano-setTimeout-booster.js', 'nano-stb.js', 'ubo-nano-stb.js', 'ubo-adjust-setTimeout', 'ubo-nano-setTimeout-booster', 'ubo-nano-stb'];
    adjustSetTimeout$1.injections = [hit, isValidCallback, toRegExp, getBoostMultiplier, isDelayMatched, logMessage,
    nativeIsNaN, nativeIsFinite, getMatchDelay, shouldMatchAnyDelay];
    function dirString$1(source, times) {
      var _console = console,
        dir = _console.dir;
      function dirWrapper(object) {
        if (typeof dir === 'function') {
          dir.call(this, object);
        }
        hit(source);
      }
      console.dir = dirWrapper;
    }
    dirString$1.names = ['dir-string'];
    dirString$1.injections = [hit];
    function jsonPrune$1(source, propsToRemove, requiredInitialProps) {
      var stack = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      var prunePaths = getPrunePath(propsToRemove);
      var requiredPaths = getPrunePath(requiredInitialProps);
      var nativeObjects = {
        nativeStringify: window.JSON.stringify
      };
      var nativeJSONParse = JSON.parse;
      var jsonParseWrapper = function jsonParseWrapper() {
        for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
          args[_key] = arguments[_key];
        }
        var root = nativeJSONParse.apply(JSON, args);
        return jsonPruner(source, root, prunePaths, requiredPaths, stack, nativeObjects);
      };
      jsonParseWrapper.toString = nativeJSONParse.toString.bind(nativeJSONParse);
      JSON.parse = jsonParseWrapper;
      var nativeResponseJson = Response.prototype.json;
      var responseJsonWrapper = function responseJsonWrapper() {
        var promise = nativeResponseJson.apply(this);
        return promise.then(function (obj) {
          return jsonPruner(source, obj, prunePaths, requiredPaths, stack, nativeObjects);
        });
      };
      if (typeof Response === 'undefined') {
        return;
      }
      Response.prototype.json = responseJsonWrapper;
    }
    jsonPrune$1.names = ['json-prune',
    'json-prune.js', 'ubo-json-prune.js', 'ubo-json-prune', 'abp-json-prune'];
    jsonPrune$1.injections = [hit, matchStackTrace, getWildcardPropertyInChain, logMessage, isPruningNeeded, jsonPruner, getPrunePath,
    toRegExp, getNativeRegexpTest, shouldAbortInlineOrInjectedScript, backupRegExpValues, restoreRegExpValues];
    function preventRequestAnimationFrame$1(source, match) {
      var nativeRequestAnimationFrame = window.requestAnimationFrame;
      var shouldLog = typeof match === 'undefined';
      var _parseMatchArg = parseMatchArg(match),
        isInvertedMatch = _parseMatchArg.isInvertedMatch,
        matchRegexp = _parseMatchArg.matchRegexp;
      var rafWrapper = function rafWrapper(callback) {
        var shouldPrevent = false;
        if (shouldLog) {
          hit(source);
          logMessage(source, "requestAnimationFrame(".concat(String(callback), ")"), true);
        } else if (isValidCallback(callback) && isValidStrPattern(match)) {
          shouldPrevent = matchRegexp.test(callback.toString()) !== isInvertedMatch;
        }
        if (shouldPrevent) {
          hit(source);
          return nativeRequestAnimationFrame(noopFunc);
        }
        for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
          args[_key - 1] = arguments[_key];
        }
        return nativeRequestAnimationFrame.apply(window, [callback, ...args]);
      };
      window.requestAnimationFrame = rafWrapper;
    }
    preventRequestAnimationFrame$1.names = ['prevent-requestAnimationFrame',
    'no-requestAnimationFrame-if.js', 'ubo-no-requestAnimationFrame-if.js', 'norafif.js', 'ubo-norafif.js', 'ubo-no-requestAnimationFrame-if', 'ubo-norafif'];
    preventRequestAnimationFrame$1.injections = [hit, noopFunc, parseMatchArg, isValidStrPattern, isValidCallback, logMessage,
    escapeRegExp, toRegExp];
    function setCookie$1(source, name, value) {
      var path = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
      var domain = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
      var validValue = getLimitedCookieValue(value);
      if (validValue === null) {
        logMessage(source, "Invalid cookie value: '".concat(validValue, "'"));
        return;
      }
      if (!isValidCookiePath(path)) {
        logMessage(source, "Invalid cookie path: '".concat(path, "'"));
        return;
      }
      if (!document.location.origin.includes(domain)) {
        logMessage(source, "Cookie domain not matched by origin: '".concat(domain, "'"));
        return;
      }
      var cookieToSet = serializeCookie(name, validValue, path, domain);
      if (!cookieToSet) {
        logMessage(source, 'Invalid cookie name or value');
        return;
      }
      hit(source);
      document.cookie = cookieToSet;
    }
    setCookie$1.names = ['set-cookie',
    'set-cookie.js', 'ubo-set-cookie.js', 'ubo-set-cookie'];
    setCookie$1.injections = [hit, logMessage, nativeIsNaN, isCookieSetWithValue, getLimitedCookieValue, serializeCookie, isValidCookiePath, getCookiePath];
    function setCookieReload$1(source, name, value) {
      var path = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
      var domain = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
      if (isCookieSetWithValue(document.cookie, name, value)) {
        return;
      }
      var validValue = getLimitedCookieValue(value);
      if (validValue === null) {
        logMessage(source, "Invalid cookie value: '".concat(value, "'"));
        return;
      }
      if (!isValidCookiePath(path)) {
        logMessage(source, "Invalid cookie path: '".concat(path, "'"));
        return;
      }
      if (!document.location.origin.includes(domain)) {
        logMessage(source, "Cookie domain not matched by origin: '".concat(domain, "'"));
        return;
      }
      var cookieToSet = serializeCookie(name, validValue, path, domain);
      if (!cookieToSet) {
        logMessage(source, 'Invalid cookie name or value');
        return;
      }
      document.cookie = cookieToSet;
      hit(source);
      if (isCookieSetWithValue(document.cookie, name, value)) {
        window.location.reload();
      }
    }
    setCookieReload$1.names = ['set-cookie-reload',
    'set-cookie-reload.js', 'ubo-set-cookie-reload.js', 'ubo-set-cookie-reload'];
    setCookieReload$1.injections = [hit, logMessage, nativeIsNaN, isCookieSetWithValue, getLimitedCookieValue, serializeCookie, isValidCookiePath, getCookiePath];
    function hideInShadowDom$1(source, selector, baseSelector) {
      if (!Element.prototype.attachShadow) {
        return;
      }
      var hideElement = function hideElement(targetElement) {
        var DISPLAY_NONE_CSS = 'display:none!important;';
        targetElement.style.cssText = DISPLAY_NONE_CSS;
      };
      var hideHandler = function hideHandler() {
        var hostElements = !baseSelector ? findHostElements(document.documentElement) : document.querySelectorAll(baseSelector);
        var _loop = function _loop() {
          var isHidden = false;
          var _pierceShadowDom = pierceShadowDom(selector, hostElements),
            targets = _pierceShadowDom.targets,
            innerHosts = _pierceShadowDom.innerHosts;
          targets.forEach(function (targetEl) {
            hideElement(targetEl);
            isHidden = true;
          });
          if (isHidden) {
            hit(source);
          }
          hostElements = innerHosts;
        };
        while (hostElements.length !== 0) {
          _loop();
        }
      };
      hideHandler();
      observeDOMChanges(hideHandler, true);
    }
    hideInShadowDom$1.names = ['hide-in-shadow-dom'];
    hideInShadowDom$1.injections = [hit, observeDOMChanges, findHostElements, pierceShadowDom,
    flatten, throttle];
    function removeInShadowDom$1(source, selector, baseSelector) {
      if (!Element.prototype.attachShadow) {
        return;
      }
      var removeElement = function removeElement(targetElement) {
        targetElement.remove();
      };
      var removeHandler = function removeHandler() {
        var hostElements = !baseSelector ? findHostElements(document.documentElement) : document.querySelectorAll(baseSelector);
        var _loop = function _loop() {
          var isRemoved = false;
          var _pierceShadowDom = pierceShadowDom(selector, hostElements),
            targets = _pierceShadowDom.targets,
            innerHosts = _pierceShadowDom.innerHosts;
          targets.forEach(function (targetEl) {
            removeElement(targetEl);
            isRemoved = true;
          });
          if (isRemoved) {
            hit(source);
          }
          hostElements = innerHosts;
        };
        while (hostElements.length !== 0) {
          _loop();
        }
      };
      removeHandler();
      observeDOMChanges(removeHandler, true);
    }
    removeInShadowDom$1.names = ['remove-in-shadow-dom'];
    removeInShadowDom$1.injections = [hit, observeDOMChanges, findHostElements, pierceShadowDom,
    flatten, throttle];
    function preventFetch$1(source, propsToMatch) {
      var responseBody = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'emptyObj';
      var responseType = arguments.length > 3 ? arguments[3] : undefined;
      if (typeof fetch === 'undefined' || typeof Proxy === 'undefined' || typeof Response === 'undefined') {
        return;
      }
      var nativeRequestClone = Request.prototype.clone;
      var strResponseBody;
      if (responseBody === '' || responseBody === 'emptyObj') {
        strResponseBody = '{}';
      } else if (responseBody === 'emptyArr') {
        strResponseBody = '[]';
      } else if (responseBody === 'emptyStr') {
        strResponseBody = '';
      } else {
        logMessage(source, "Invalid responseBody parameter: '".concat(responseBody, "'"));
        return;
      }
      var isResponseTypeSpecified = typeof responseType !== 'undefined';
      var isResponseTypeSupported = function isResponseTypeSupported(responseType) {
        var SUPPORTED_TYPES = ['basic', 'cors', 'opaque'];
        return SUPPORTED_TYPES.includes(responseType);
      };
      if (isResponseTypeSpecified && !isResponseTypeSupported(responseType)) {
        logMessage(source, "Invalid responseType parameter: '".concat(responseType, "'"));
        return;
      }
      var getResponseType = function getResponseType(request) {
        try {
          var mode = request.mode;
          if (mode === undefined || mode === 'cors' || mode === 'no-cors') {
            var fetchURL = new URL(request.url);
            if (fetchURL.origin === document.location.origin) {
              return 'basic';
            }
            return mode === 'no-cors' ? 'opaque' : 'cors';
          }
        } catch (error) {
          logMessage(source, "Could not determine response type: ".concat(error));
        }
        return undefined;
      };
      var handlerWrapper = async function handlerWrapper(target, thisArg, args) {
        var shouldPrevent = false;
        var fetchData = getFetchData(args, nativeRequestClone);
        if (typeof propsToMatch === 'undefined') {
          logMessage(source, "fetch( ".concat(objectToString$1(fetchData), " )"), true);
          hit(source);
          return Reflect.apply(target, thisArg, args);
        }
        shouldPrevent = matchRequestProps(source, propsToMatch, fetchData);
        if (shouldPrevent) {
          hit(source);
          var finalResponseType;
          try {
            finalResponseType = responseType || getResponseType(fetchData);
            var origResponse = await Reflect.apply(target, thisArg, args);
            if (!origResponse.ok) {
              return noopPromiseResolve(strResponseBody, fetchData.url, finalResponseType);
            }
            return modifyResponse(origResponse, {
              body: strResponseBody,
              type: finalResponseType
            });
          } catch (ex) {
            return noopPromiseResolve(strResponseBody, fetchData.url, finalResponseType);
          }
        }
        return Reflect.apply(target, thisArg, args);
      };
      var fetchHandler = {
        apply: handlerWrapper
      };
      fetch = new Proxy(fetch, fetchHandler);
    }
    preventFetch$1.names = ['prevent-fetch',
    'prevent-fetch.js', 'ubo-prevent-fetch.js', 'ubo-prevent-fetch', 'no-fetch-if.js', 'ubo-no-fetch-if.js', 'ubo-no-fetch-if'];
    preventFetch$1.injections = [hit, getFetchData, objectToString$1, matchRequestProps, logMessage, noopPromiseResolve, modifyResponse, toRegExp, isValidStrPattern, escapeRegExp, isEmptyObject, getRequestData, getRequestProps, parseMatchProps, isValidParsedData, getMatchPropsData];
    function setLocalStorageItem$1(source, key, value) {
      if (typeof key === 'undefined') {
        logMessage(source, 'Item key should be specified.');
        return;
      }
      var validValue;
      try {
        validValue = getLimitedStorageItemValue(value);
      } catch (_unused) {
        logMessage(source, "Invalid storage item value: '".concat(value, "'"));
        return;
      }
      var _window = window,
        localStorage = _window.localStorage;
      if (validValue === '$remove$') {
        removeStorageItem(source, localStorage, key);
      } else {
        setStorageItem(source, localStorage, key, validValue);
      }
      hit(source);
    }
    setLocalStorageItem$1.names = ['set-local-storage-item',
    'set-local-storage-item.js', 'ubo-set-local-storage-item.js', 'ubo-set-local-storage-item'];
    setLocalStorageItem$1.injections = [hit, logMessage, nativeIsNaN, setStorageItem, removeStorageItem, getLimitedStorageItemValue,
    isValidStrPattern, toRegExp, escapeRegExp];
    function setSessionStorageItem$1(source, key, value) {
      if (typeof key === 'undefined') {
        logMessage(source, 'Item key should be specified.');
        return;
      }
      var validValue;
      try {
        validValue = getLimitedStorageItemValue(value);
      } catch (_unused) {
        logMessage(source, "Invalid storage item value: '".concat(value, "'"));
        return;
      }
      var _window = window,
        sessionStorage = _window.sessionStorage;
      if (validValue === '$remove$') {
        removeStorageItem(source, sessionStorage, key);
      } else {
        setStorageItem(source, sessionStorage, key, validValue);
      }
      hit(source);
    }
    setSessionStorageItem$1.names = ['set-session-storage-item',
    'set-session-storage-item.js', 'ubo-set-session-storage-item.js', 'ubo-set-session-storage-item'];
    setSessionStorageItem$1.injections = [hit, logMessage, nativeIsNaN, setStorageItem, removeStorageItem, getLimitedStorageItemValue,
    isValidStrPattern, toRegExp, escapeRegExp];
    function abortOnStackTrace$1(source, property, stack) {
      if (!property || !stack) {
        return;
      }
      var rid = randomId();
      var abort = function abort() {
        hit(source);
        throw new ReferenceError(rid);
      };
      var setChainPropAccess = function setChainPropAccess(owner, property) {
        var chainInfo = getPropertyInChain(owner, property);
        var base = chainInfo.base;
        var prop = chainInfo.prop,
          chain = chainInfo.chain;
        if (chain) {
          var setter = function setter(a) {
            base = a;
            if (a instanceof Object) {
              setChainPropAccess(a, chain);
            }
          };
          Object.defineProperty(owner, prop, {
            get: function get() {
              return base;
            },
            set: setter
          });
          return;
        }
        if (!stack.match(/^(inlineScript|injectedScript)$/) && !isValidStrPattern(stack)) {
          logMessage(source, "Invalid parameter: ".concat(stack));
          return;
        }
        var descriptorWrapper = Object.assign(getDescriptorAddon(), {
          value: base[prop],
          get() {
            if (!this.isAbortingSuspended && this.isolateCallback(matchStackTrace, stack, new Error().stack)) {
              abort();
            }
            return this.value;
          },
          set(newValue) {
            if (!this.isAbortingSuspended && this.isolateCallback(matchStackTrace, stack, new Error().stack)) {
              abort();
            }
            this.value = newValue;
          }
        });
        setPropertyAccess(base, prop, {
          get() {
            return descriptorWrapper.get.call(descriptorWrapper);
          },
          set(newValue) {
            descriptorWrapper.set.call(descriptorWrapper, newValue);
          }
        });
      };
      setChainPropAccess(window, property);
      window.onerror = createOnErrorHandler(rid).bind();
    }
    abortOnStackTrace$1.names = ['abort-on-stack-trace',
    'abort-on-stack-trace.js', 'ubo-abort-on-stack-trace.js', 'aost.js', 'ubo-aost.js', 'ubo-abort-on-stack-trace', 'ubo-aost', 'abp-abort-on-stack-trace'];
    abortOnStackTrace$1.injections = [randomId, setPropertyAccess, getPropertyInChain, createOnErrorHandler, hit, isValidStrPattern, escapeRegExp, matchStackTrace, getDescriptorAddon, logMessage, toRegExp, isEmptyObject, getNativeRegexpTest, shouldAbortInlineOrInjectedScript, backupRegExpValues, restoreRegExpValues];
    function logOnStacktrace$1(source, property) {
      if (!property) {
        return;
      }
      var refineStackTrace = function refineStackTrace(stackString) {
        var regExpValues = backupRegExpValues();
        var stackSteps = stackString.split('\n').slice(2).map(function (line) {
          return line.replace(/ {4}at /, '');
        });
        var logInfoArray = stackSteps.map(function (line) {
          var funcName;
          var funcFullPath;
          var reg = /\(([^\)]+)\)/;
          var regFirefox = /(.*?@)(\S+)(:\d+):\d+\)?$/;
          if (line.match(reg)) {
            funcName = line.split(' ').slice(0, -1).join(' ');
            funcFullPath = line.match(reg)[1];
          } else if (line.match(regFirefox)) {
            funcName = line.split('@').slice(0, -1).join(' ');
            funcFullPath = line.match(regFirefox)[2];
          } else {
            funcName = 'function name is not available';
            funcFullPath = line;
          }
          return [funcName, funcFullPath];
        });
        var logInfoObject = {};
        logInfoArray.forEach(function (pair) {
          logInfoObject[pair[0]] = pair[1];
        });
        if (regExpValues.length && regExpValues[0] !== RegExp.$1) {
          restoreRegExpValues(regExpValues);
        }
        return logInfoObject;
      };
      var setChainPropAccess = function setChainPropAccess(owner, property) {
        var chainInfo = getPropertyInChain(owner, property);
        var base = chainInfo.base;
        var prop = chainInfo.prop,
          chain = chainInfo.chain;
        if (chain) {
          var setter = function setter(a) {
            base = a;
            if (a instanceof Object) {
              setChainPropAccess(a, chain);
            }
          };
          Object.defineProperty(owner, prop, {
            get: function get() {
              return base;
            },
            set: setter
          });
          return;
        }
        var value = base[prop];
        setPropertyAccess(base, prop, {
          get() {
            hit(source);
            logMessage(source, "Get ".concat(prop), true);
            console.table(refineStackTrace(new Error().stack));
            return value;
          },
          set(newValue) {
            hit(source);
            logMessage(source, "Set ".concat(prop), true);
            console.table(refineStackTrace(new Error().stack));
            value = newValue;
          }
        });
      };
      setChainPropAccess(window, property);
    }
    logOnStacktrace$1.names = ['log-on-stack-trace'];
    logOnStacktrace$1.injections = [getPropertyInChain, setPropertyAccess, hit, logMessage, isEmptyObject, backupRegExpValues, restoreRegExpValues];
    function preventXHR$1(source, propsToMatch, customResponseText) {
      if (typeof Proxy === 'undefined') {
        return;
      }
      var nativeOpen = window.XMLHttpRequest.prototype.open;
      var nativeSend = window.XMLHttpRequest.prototype.send;
      var nativeGetResponseHeader = window.XMLHttpRequest.prototype.getResponseHeader;
      var nativeGetAllResponseHeaders = window.XMLHttpRequest.prototype.getAllResponseHeaders;
      var xhrData;
      var modifiedResponse = '';
      var modifiedResponseText = '';
      var openWrapper = function openWrapper(target, thisArg, args) {
        xhrData = getXhrData.apply(null, args);
        if (typeof propsToMatch === 'undefined') {
          logMessage(source, "xhr( ".concat(objectToString$1(xhrData), " )"), true);
          hit(source);
        } else if (matchRequestProps(source, propsToMatch, xhrData)) {
          thisArg.shouldBePrevented = true;
          thisArg.xhrData = xhrData;
        }
        if (thisArg.shouldBePrevented) {
          thisArg.collectedHeaders = [];
          var setRequestHeaderWrapper = function setRequestHeaderWrapper(target, thisArg, args) {
            thisArg.collectedHeaders.push(args);
            return Reflect.apply(target, thisArg, args);
          };
          var setRequestHeaderHandler = {
            apply: setRequestHeaderWrapper
          };
          thisArg.setRequestHeader = new Proxy(thisArg.setRequestHeader, setRequestHeaderHandler);
        }
        return Reflect.apply(target, thisArg, args);
      };
      var sendWrapper = function sendWrapper(target, thisArg, args) {
        if (!thisArg.shouldBePrevented) {
          return Reflect.apply(target, thisArg, args);
        }
        if (thisArg.responseType === 'blob') {
          modifiedResponse = new Blob();
        }
        if (thisArg.responseType === 'arraybuffer') {
          modifiedResponse = new ArrayBuffer();
        }
        if (customResponseText) {
          var randomText = generateRandomResponse(customResponseText);
          if (randomText) {
            modifiedResponseText = randomText;
          } else {
            logMessage(source, "Invalid randomize parameter: '".concat(customResponseText, "'"));
          }
        }
        var forgedRequest = new XMLHttpRequest();
        forgedRequest.addEventListener('readystatechange', function () {
          if (forgedRequest.readyState !== 4) {
            return;
          }
          var readyState = forgedRequest.readyState,
            responseURL = forgedRequest.responseURL,
            responseXML = forgedRequest.responseXML,
            statusText = forgedRequest.statusText;
          Object.defineProperties(thisArg, {
            readyState: {
              value: readyState,
              writable: false
            },
            statusText: {
              value: statusText,
              writable: false
            },
            responseURL: {
              value: responseURL || thisArg.xhrData.url,
              writable: false
            },
            responseXML: {
              value: responseXML,
              writable: false
            },
            status: {
              value: 200,
              writable: false
            },
            response: {
              value: modifiedResponse,
              writable: false
            },
            responseText: {
              value: modifiedResponseText,
              writable: false
            }
          });
          setTimeout(function () {
            var stateEvent = new Event('readystatechange');
            thisArg.dispatchEvent(stateEvent);
            var loadEvent = new Event('load');
            thisArg.dispatchEvent(loadEvent);
            var loadEndEvent = new Event('loadend');
            thisArg.dispatchEvent(loadEndEvent);
          }, 1);
          hit(source);
        });
        nativeOpen.apply(forgedRequest, [thisArg.xhrData.method, thisArg.xhrData.url]);
        thisArg.collectedHeaders.forEach(function (header) {
          var name = header[0];
          var value = header[1];
          forgedRequest.setRequestHeader(name, value);
        });
        try {
          nativeSend.call(forgedRequest, args);
        } catch (_unused) {
          return Reflect.apply(target, thisArg, args);
        }
        return undefined;
      };
      var getHeaderWrapper = function getHeaderWrapper(target, thisArg, args) {
        if (!thisArg.shouldBePrevented) {
          return nativeGetResponseHeader.apply(thisArg, args);
        }
        if (!thisArg.collectedHeaders.length) {
          return null;
        }
        var searchHeaderName = args[0].toLowerCase();
        var matchedHeader = thisArg.collectedHeaders.find(function (header) {
          var headerName = header[0].toLowerCase();
          return headerName === searchHeaderName;
        });
        return matchedHeader ? matchedHeader[1] : null;
      };
      var getAllHeadersWrapper = function getAllHeadersWrapper(target, thisArg) {
        if (!thisArg.shouldBePrevented) {
          return nativeGetAllResponseHeaders.call(thisArg);
        }
        if (!thisArg.collectedHeaders.length) {
          return '';
        }
        var allHeadersStr = thisArg.collectedHeaders.map(function (header) {
          var headerName = header[0];
          var headerValue = header[1];
          return "".concat(headerName.toLowerCase(), ": ").concat(headerValue);
        }).join('\r\n');
        return allHeadersStr;
      };
      var openHandler = {
        apply: openWrapper
      };
      var sendHandler = {
        apply: sendWrapper
      };
      var getHeaderHandler = {
        apply: getHeaderWrapper
      };
      var getAllHeadersHandler = {
        apply: getAllHeadersWrapper
      };
      XMLHttpRequest.prototype.open = new Proxy(XMLHttpRequest.prototype.open, openHandler);
      XMLHttpRequest.prototype.send = new Proxy(XMLHttpRequest.prototype.send, sendHandler);
      XMLHttpRequest.prototype.getResponseHeader = new Proxy(XMLHttpRequest.prototype.getResponseHeader, getHeaderHandler);
      XMLHttpRequest.prototype.getAllResponseHeaders = new Proxy(XMLHttpRequest.prototype.getAllResponseHeaders, getAllHeadersHandler);
    }
    preventXHR$1.names = ['prevent-xhr',
    'no-xhr-if.js', 'ubo-no-xhr-if.js', 'ubo-no-xhr-if'];
    preventXHR$1.injections = [hit, objectToString$1, generateRandomResponse, matchRequestProps, getXhrData, logMessage, toRegExp, isValidStrPattern, escapeRegExp, isEmptyObject, getNumberFromString, nativeIsFinite, nativeIsNaN, parseMatchProps, isValidParsedData, getMatchPropsData, getRequestProps, getRandomIntInclusive, getRandomStrByLength];
    function forceWindowClose$1(source) {
      var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
      if (typeof window.close !== 'function') {
        var message = 'window.close() is not a function so \'close-window\' scriptlet is unavailable';
        logMessage(source, message);
        return;
      }
      var closeImmediately = function closeImmediately() {
        try {
          hit(source);
          window.close();
        } catch (e) {
          logMessage(source, e);
        }
      };
      var closeByExtension = function closeByExtension() {
        var extCall = function extCall() {
          dispatchEvent(new Event('adguard:scriptlet-close-window'));
        };
        window.addEventListener('adguard:subscribed-to-close-window', extCall, {
          once: true
        });
        setTimeout(function () {
          window.removeEventListener('adguard:subscribed-to-close-window', extCall, {
            once: true
          });
        }, 5000);
      };
      var shouldClose = function shouldClose() {
        if (path === '') {
          return true;
        }
        var pathRegexp = toRegExp(path);
        var currentPath = "".concat(window.location.pathname).concat(window.location.search);
        return pathRegexp.test(currentPath);
      };
      if (shouldClose()) {
        closeImmediately();
        if (navigator.userAgent.includes('Chrome')) {
          closeByExtension();
        }
      }
    }
    forceWindowClose$1.names = ['close-window',
    'window-close-if.js', 'ubo-window-close-if.js', 'ubo-window-close-if', 'close-window.js', 'ubo-close-window.js', 'ubo-close-window'];
    forceWindowClose$1.injections = [hit, toRegExp, logMessage];
    function preventRefresh$1(source, delaySec) {
      var getMetaElements = function getMetaElements() {
        var metaNodes = [];
        try {
          metaNodes = document.querySelectorAll('meta[http-equiv="refresh" i][content]');
        } catch (e) {
          try {
            metaNodes = document.querySelectorAll('meta[http-equiv="refresh"][content]');
          } catch (e) {
            logMessage(source, e);
          }
        }
        return Array.from(metaNodes);
      };
      var getMetaContentDelay = function getMetaContentDelay(metaElements) {
        var delays = metaElements.map(function (meta) {
          var contentString = meta.getAttribute('content');
          if (contentString.length === 0) {
            return null;
          }
          var contentDelay;
          var limiterIndex = contentString.indexOf(';');
          if (limiterIndex !== -1) {
            var delaySubstring = contentString.substring(0, limiterIndex);
            contentDelay = getNumberFromString(delaySubstring);
          } else {
            contentDelay = getNumberFromString(contentString);
          }
          return contentDelay;
        }).filter(function (delay) {
          return delay !== null;
        });
        if (!delays.length) {
          return null;
        }
        var minDelay = delays.reduce(function (a, b) {
          return Math.min(a, b);
        });
        return minDelay;
      };
      var stop = function stop() {
        var metaElements = getMetaElements();
        if (metaElements.length === 0) {
          return;
        }
        var secondsToRun = getNumberFromString(delaySec);
        if (secondsToRun === null) {
          secondsToRun = getMetaContentDelay(metaElements);
        }
        if (secondsToRun === null) {
          return;
        }
        var delayMs = secondsToRun * 1000;
        setTimeout(function () {
          window.stop();
          hit(source);
        }, delayMs);
      };
      if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', stop, {
          once: true
        });
      } else {
        stop();
      }
    }
    preventRefresh$1.names = ['prevent-refresh',
    'prevent-refresh.js', 'refresh-defuser.js', 'refresh-defuser',
    'ubo-prevent-refresh.js', 'ubo-prevent-refresh', 'ubo-refresh-defuser.js', 'ubo-refresh-defuser'];
    preventRefresh$1.injections = [hit, getNumberFromString, logMessage, nativeIsNaN];
    function preventElementSrcLoading$1(source, tagName, match) {
      if (typeof Proxy === 'undefined' || typeof Reflect === 'undefined') {
        return;
      }
      var srcMockData = {
        script: 'data:text/javascript;base64,KCk9Pnt9',
        img: 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==',
        iframe: 'data:text/html;base64, PGRpdj48L2Rpdj4=',
        link: 'data:text/plain;base64,'
      };
      var instance;
      if (tagName === 'script') {
        instance = HTMLScriptElement;
      } else if (tagName === 'img') {
        instance = HTMLImageElement;
      } else if (tagName === 'iframe') {
        instance = HTMLIFrameElement;
      } else if (tagName === 'link') {
        instance = HTMLLinkElement;
      } else {
        return;
      }
      var hasTrustedTypes = window.trustedTypes && typeof window.trustedTypes.createPolicy === 'function';
      var policy;
      if (hasTrustedTypes) {
        policy = window.trustedTypes.createPolicy('AGPolicy', {
          createScriptURL: function createScriptURL(arg) {
            return arg;
          }
        });
      }
      var SOURCE_PROPERTY_NAME = tagName === 'link' ? 'href' : 'src';
      var ONERROR_PROPERTY_NAME = 'onerror';
      var searchRegexp = toRegExp(match);
      var setMatchedAttribute = function setMatchedAttribute(elem) {
        return elem.setAttribute(source.name, 'matched');
      };
      var setAttributeWrapper = function setAttributeWrapper(target, thisArg, args) {
        if (!args[0] || !args[1]) {
          return Reflect.apply(target, thisArg, args);
        }
        var nodeName = thisArg.nodeName.toLowerCase();
        var attrName = args[0].toLowerCase();
        var attrValue = args[1];
        var isMatched = attrName === SOURCE_PROPERTY_NAME && tagName.toLowerCase() === nodeName && srcMockData[nodeName] && searchRegexp.test(attrValue);
        if (!isMatched) {
          return Reflect.apply(target, thisArg, args);
        }
        hit(source);
        setMatchedAttribute(thisArg);
        return Reflect.apply(target, thisArg, [attrName, srcMockData[nodeName]]);
      };
      var setAttributeHandler = {
        apply: setAttributeWrapper
      };
      instance.prototype.setAttribute = new Proxy(Element.prototype.setAttribute, setAttributeHandler);
      var origSrcDescriptor = safeGetDescriptor(instance.prototype, SOURCE_PROPERTY_NAME);
      if (!origSrcDescriptor) {
        return;
      }
      Object.defineProperty(instance.prototype, SOURCE_PROPERTY_NAME, {
        enumerable: true,
        configurable: true,
        get() {
          return origSrcDescriptor.get.call(this);
        },
        set(urlValue) {
          var nodeName = this.nodeName.toLowerCase();
          var isMatched = tagName.toLowerCase() === nodeName && srcMockData[nodeName] && searchRegexp.test(urlValue);
          if (!isMatched) {
            origSrcDescriptor.set.call(this, urlValue);
            return true;
          }
          if (policy && urlValue instanceof TrustedScriptURL) {
            var trustedSrc = policy.createScriptURL(urlValue);
            origSrcDescriptor.set.call(this, trustedSrc);
            hit(source);
            return;
          }
          setMatchedAttribute(this);
          origSrcDescriptor.set.call(this, srcMockData[nodeName]);
          hit(source);
        }
      });
      var origOnerrorDescriptor = safeGetDescriptor(HTMLElement.prototype, ONERROR_PROPERTY_NAME);
      if (!origOnerrorDescriptor) {
        return;
      }
      Object.defineProperty(HTMLElement.prototype, ONERROR_PROPERTY_NAME, {
        enumerable: true,
        configurable: true,
        get() {
          return origOnerrorDescriptor.get.call(this);
        },
        set(cb) {
          var isMatched = this.getAttribute(source.name) === 'matched';
          if (!isMatched) {
            origOnerrorDescriptor.set.call(this, cb);
            return true;
          }
          origOnerrorDescriptor.set.call(this, noopFunc);
          return true;
        }
      });
      var addEventListenerWrapper = function addEventListenerWrapper(target, thisArg, args) {
        if (!args[0] || !args[1] || !thisArg) {
          return Reflect.apply(target, thisArg, args);
        }
        var eventName = args[0];
        var isMatched = typeof thisArg.getAttribute === 'function' && thisArg.getAttribute(source.name) === 'matched' && eventName === 'error';
        if (isMatched) {
          return Reflect.apply(target, thisArg, [eventName, noopFunc]);
        }
        return Reflect.apply(target, thisArg, args);
      };
      var addEventListenerHandler = {
        apply: addEventListenerWrapper
      };
      EventTarget.prototype.addEventListener = new Proxy(EventTarget.prototype.addEventListener, addEventListenerHandler);
      var preventInlineOnerror = function preventInlineOnerror(tagName, src) {
        window.addEventListener('error', function (event) {
          if (!event.target || !event.target.nodeName || event.target.nodeName.toLowerCase() !== tagName || !event.target.src || !src.test(event.target.src)) {
            return;
          }
          hit(source);
          if (typeof event.target.onload === 'function') {
            event.target.onerror = event.target.onload;
            return;
          }
          event.target.onerror = noopFunc;
        }, true);
      };
      preventInlineOnerror(tagName, searchRegexp);
    }
    preventElementSrcLoading$1.names = ['prevent-element-src-loading'];
    preventElementSrcLoading$1.injections = [hit, toRegExp, safeGetDescriptor, noopFunc];
    function noTopics$1(source) {
      var TOPICS_PROPERTY_NAME = 'browsingTopics';
      if (Document instanceof Object === false) {
        return;
      }
      if (!Object.prototype.hasOwnProperty.call(Document.prototype, TOPICS_PROPERTY_NAME) || Document.prototype[TOPICS_PROPERTY_NAME] instanceof Function === false) {
        return;
      }
      Document.prototype[TOPICS_PROPERTY_NAME] = function () {
        return noopPromiseResolve('[]');
      };
      hit(source);
    }
    noTopics$1.names = ['no-topics'];
    noTopics$1.injections = [hit, noopPromiseResolve];
    function trustedReplaceXhrResponse$1(source) {
      var pattern = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
      var replacement = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
      var propsToMatch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      var verbose = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
      if (typeof Proxy === 'undefined') {
        return;
      }
      if (pattern === '' && replacement !== '') {
        var message = 'Pattern argument should not be empty string.';
        logMessage(source, message);
        return;
      }
      var shouldLog = pattern === '' && replacement === '';
      var shouldLogContent = verbose === 'true';
      var nativeOpen = window.XMLHttpRequest.prototype.open;
      var nativeSend = window.XMLHttpRequest.prototype.send;
      var xhrData;
      var openWrapper = function openWrapper(target, thisArg, args) {
        xhrData = getXhrData.apply(null, args);
        if (shouldLog) {
          var _message = "xhr( ".concat(objectToString$1(xhrData), " )");
          logMessage(source, _message, true);
          hit(source);
          return Reflect.apply(target, thisArg, args);
        }
        if (matchRequestProps(source, propsToMatch, xhrData)) {
          thisArg.shouldBePrevented = true;
          thisArg.headersReceived = !!thisArg.headersReceived;
        }
        if (thisArg.shouldBePrevented && !thisArg.headersReceived) {
          thisArg.headersReceived = true;
          thisArg.collectedHeaders = [];
          var setRequestHeaderWrapper = function setRequestHeaderWrapper(target, thisArg, args) {
            thisArg.collectedHeaders.push(args);
            return Reflect.apply(target, thisArg, args);
          };
          var setRequestHeaderHandler = {
            apply: setRequestHeaderWrapper
          };
          thisArg.setRequestHeader = new Proxy(thisArg.setRequestHeader, setRequestHeaderHandler);
        }
        return Reflect.apply(target, thisArg, args);
      };
      var sendWrapper = function sendWrapper(target, thisArg, args) {
        if (!thisArg.shouldBePrevented) {
          return Reflect.apply(target, thisArg, args);
        }
        var forgedRequest = new XMLHttpRequest();
        forgedRequest.addEventListener('readystatechange', function () {
          if (forgedRequest.readyState !== 4) {
            return;
          }
          var readyState = forgedRequest.readyState,
            response = forgedRequest.response,
            responseText = forgedRequest.responseText,
            responseURL = forgedRequest.responseURL,
            responseXML = forgedRequest.responseXML,
            status = forgedRequest.status,
            statusText = forgedRequest.statusText;
          var content = responseText || response;
          if (typeof content !== 'string') {
            return;
          }
          var patternRegexp = pattern === '*' ? /(\n|.)*/ : toRegExp(pattern);
          if (shouldLogContent) {
            logMessage(source, "Original text content: ".concat(content));
          }
          var modifiedContent = content.replace(patternRegexp, replacement);
          if (shouldLogContent) {
            logMessage(source, "Modified text content: ".concat(modifiedContent));
          }
          Object.defineProperties(thisArg, {
            readyState: {
              value: readyState,
              writable: false
            },
            responseURL: {
              value: responseURL,
              writable: false
            },
            responseXML: {
              value: responseXML,
              writable: false
            },
            status: {
              value: status,
              writable: false
            },
            statusText: {
              value: statusText,
              writable: false
            },
            response: {
              value: modifiedContent,
              writable: false
            },
            responseText: {
              value: modifiedContent,
              writable: false
            }
          });
          setTimeout(function () {
            var stateEvent = new Event('readystatechange');
            thisArg.dispatchEvent(stateEvent);
            var loadEvent = new Event('load');
            thisArg.dispatchEvent(loadEvent);
            var loadEndEvent = new Event('loadend');
            thisArg.dispatchEvent(loadEndEvent);
          }, 1);
          hit(source);
        });
        nativeOpen.apply(forgedRequest, [xhrData.method, xhrData.url]);
        thisArg.collectedHeaders.forEach(function (header) {
          var name = header[0];
          var value = header[1];
          forgedRequest.setRequestHeader(name, value);
        });
        thisArg.collectedHeaders = [];
        try {
          nativeSend.call(forgedRequest, args);
        } catch (_unused) {
          return Reflect.apply(target, thisArg, args);
        }
        return undefined;
      };
      var openHandler = {
        apply: openWrapper
      };
      var sendHandler = {
        apply: sendWrapper
      };
      XMLHttpRequest.prototype.open = new Proxy(XMLHttpRequest.prototype.open, openHandler);
      XMLHttpRequest.prototype.send = new Proxy(XMLHttpRequest.prototype.send, sendHandler);
    }
    trustedReplaceXhrResponse$1.names = ['trusted-replace-xhr-response'
    ];
    trustedReplaceXhrResponse$1.injections = [hit, logMessage, toRegExp, objectToString$1, matchRequestProps, getXhrData, getMatchPropsData, getRequestProps, isValidParsedData, parseMatchProps, isValidStrPattern, escapeRegExp, isEmptyObject];
    function xmlPrune$1(source, propsToRemove) {
      var optionalProp = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
      var urlToMatch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      var verbose = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
      if (typeof Reflect === 'undefined' || typeof fetch === 'undefined' || typeof Proxy === 'undefined' || typeof Response === 'undefined') {
        return;
      }
      var shouldPruneResponse = false;
      var shouldLogContent = verbose === 'true';
      var urlMatchRegexp = toRegExp(urlToMatch);
      var XPATH_MARKER = 'xpath(';
      var isXpath = propsToRemove && propsToRemove.startsWith(XPATH_MARKER);
      var getXPathElements = function getXPathElements(contextNode) {
        var matchedElements = [];
        try {
          var elementsToRemove = propsToRemove.slice(XPATH_MARKER.length, -1);
          var xpathResult = contextNode.evaluate(elementsToRemove, contextNode, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          for (var i = 0; i < xpathResult.snapshotLength; i += 1) {
            matchedElements.push(xpathResult.snapshotItem(i));
          }
        } catch (ex) {
          var message = "Invalid XPath parameter: ".concat(propsToRemove, "\n").concat(ex);
          logMessage(source, message);
        }
        return matchedElements;
      };
      var xPathPruning = function xPathPruning(xPathElements) {
        xPathElements.forEach(function (element) {
          if (element.nodeType === 1) {
            element.remove();
          } else if (element.nodeType === 2) {
            element.ownerElement.removeAttribute(element.nodeName);
          }
        });
      };
      var isXML = function isXML(text) {
        if (typeof text === 'string') {
          var trimmedText = text.trim();
          if (trimmedText.startsWith('<') && trimmedText.endsWith('>')) {
            return true;
          }
        }
        return false;
      };
      var createXMLDocument = function createXMLDocument(text) {
        var xmlParser = new DOMParser();
        var xmlDocument = xmlParser.parseFromString(text, 'text/xml');
        return xmlDocument;
      };
      var isPruningNeeded = function isPruningNeeded(response, propsToRemove) {
        if (!isXML(response)) {
          return false;
        }
        var docXML = createXMLDocument(response);
        return isXpath ? getXPathElements(docXML) : !!docXML.querySelector(propsToRemove);
      };
      var pruneXML = function pruneXML(text) {
        if (!isXML(text)) {
          shouldPruneResponse = false;
          return text;
        }
        var xmlDoc = createXMLDocument(text);
        var errorNode = xmlDoc.querySelector('parsererror');
        if (errorNode) {
          return text;
        }
        if (optionalProp !== '' && xmlDoc.querySelector(optionalProp) === null) {
          shouldPruneResponse = false;
          return text;
        }
        var elements = isXpath ? getXPathElements(xmlDoc) : xmlDoc.querySelectorAll(propsToRemove);
        if (!elements.length) {
          shouldPruneResponse = false;
          return text;
        }
        if (shouldLogContent) {
          var cloneXmlDoc = xmlDoc.cloneNode(true);
          logMessage(source, 'Original xml:');
          logMessage(source, cloneXmlDoc, true, false);
        }
        if (isXpath) {
          xPathPruning(elements);
        } else {
          elements.forEach(function (elem) {
            elem.remove();
          });
        }
        if (shouldLogContent) {
          logMessage(source, 'Modified xml:');
          logMessage(source, xmlDoc, true, false);
        }
        var serializer = new XMLSerializer();
        text = serializer.serializeToString(xmlDoc);
        return text;
      };
      var nativeOpen = window.XMLHttpRequest.prototype.open;
      var nativeSend = window.XMLHttpRequest.prototype.send;
      var xhrData;
      var openWrapper = function openWrapper(target, thisArg, args) {
        xhrData = getXhrData.apply(null, args);
        if (matchRequestProps(source, urlToMatch, xhrData)) {
          thisArg.shouldBePruned = true;
        }
        if (thisArg.shouldBePruned) {
          thisArg.collectedHeaders = [];
          var setRequestHeaderWrapper = function setRequestHeaderWrapper(target, thisArg, args) {
            thisArg.collectedHeaders.push(args);
            return Reflect.apply(target, thisArg, args);
          };
          var setRequestHeaderHandler = {
            apply: setRequestHeaderWrapper
          };
          thisArg.setRequestHeader = new Proxy(thisArg.setRequestHeader, setRequestHeaderHandler);
        }
        return Reflect.apply(target, thisArg, args);
      };
      var sendWrapper = function sendWrapper(target, thisArg, args) {
        var allowedResponseTypeValues = ['', 'text'];
        if (!thisArg.shouldBePruned || !allowedResponseTypeValues.includes(thisArg.responseType)) {
          return Reflect.apply(target, thisArg, args);
        }
        var forgedRequest = new XMLHttpRequest();
        forgedRequest.addEventListener('readystatechange', function () {
          if (forgedRequest.readyState !== 4) {
            return;
          }
          var readyState = forgedRequest.readyState,
            response = forgedRequest.response,
            responseText = forgedRequest.responseText,
            responseURL = forgedRequest.responseURL,
            responseXML = forgedRequest.responseXML,
            status = forgedRequest.status,
            statusText = forgedRequest.statusText;
          var content = responseText || response;
          if (typeof content !== 'string') {
            return;
          }
          if (!propsToRemove) {
            if (isXML(response)) {
              var message = "XMLHttpRequest.open() URL: ".concat(responseURL, "\nresponse: ").concat(response);
              logMessage(source, message);
              logMessage(source, createXMLDocument(response), true, false);
            }
          } else {
            shouldPruneResponse = isPruningNeeded(response, propsToRemove);
          }
          var responseContent = shouldPruneResponse ? pruneXML(response) : response;
          Object.defineProperties(thisArg, {
            readyState: {
              value: readyState,
              writable: false
            },
            responseURL: {
              value: responseURL,
              writable: false
            },
            responseXML: {
              value: responseXML,
              writable: false
            },
            status: {
              value: status,
              writable: false
            },
            statusText: {
              value: statusText,
              writable: false
            },
            response: {
              value: responseContent,
              writable: false
            },
            responseText: {
              value: responseContent,
              writable: false
            }
          });
          setTimeout(function () {
            var stateEvent = new Event('readystatechange');
            thisArg.dispatchEvent(stateEvent);
            var loadEvent = new Event('load');
            thisArg.dispatchEvent(loadEvent);
            var loadEndEvent = new Event('loadend');
            thisArg.dispatchEvent(loadEndEvent);
          }, 1);
          hit(source);
        });
        nativeOpen.apply(forgedRequest, [xhrData.method, xhrData.url]);
        thisArg.collectedHeaders.forEach(function (header) {
          var name = header[0];
          var value = header[1];
          forgedRequest.setRequestHeader(name, value);
        });
        thisArg.collectedHeaders = [];
        try {
          nativeSend.call(forgedRequest, args);
        } catch (_unused) {
          return Reflect.apply(target, thisArg, args);
        }
        return undefined;
      };
      var openHandler = {
        apply: openWrapper
      };
      var sendHandler = {
        apply: sendWrapper
      };
      XMLHttpRequest.prototype.open = new Proxy(XMLHttpRequest.prototype.open, openHandler);
      XMLHttpRequest.prototype.send = new Proxy(XMLHttpRequest.prototype.send, sendHandler);
      var nativeFetch = window.fetch;
      var fetchWrapper = async function fetchWrapper(target, thisArg, args) {
        var fetchURL = args[0] instanceof Request ? args[0].url : args[0];
        if (typeof fetchURL !== 'string' || fetchURL.length === 0) {
          return Reflect.apply(target, thisArg, args);
        }
        if (urlMatchRegexp.test(fetchURL)) {
          var response = await nativeFetch(...args);
          var clonedResponse = response.clone();
          var responseText = await response.text();
          shouldPruneResponse = isPruningNeeded(responseText, propsToRemove);
          if (!shouldPruneResponse) {
            var message = "fetch URL: ".concat(fetchURL, "\nresponse text: ").concat(responseText);
            logMessage(source, message);
            logMessage(source, createXMLDocument(responseText), true, false);
            return clonedResponse;
          }
          var prunedText = pruneXML(responseText);
          if (shouldPruneResponse) {
            hit(source);
            return new Response(prunedText, {
              status: response.status,
              statusText: response.statusText,
              headers: response.headers
            });
          }
          return clonedResponse;
        }
        return Reflect.apply(target, thisArg, args);
      };
      var fetchHandler = {
        apply: fetchWrapper
      };
      window.fetch = new Proxy(window.fetch, fetchHandler);
    }
    xmlPrune$1.names = ['xml-prune',
    'xml-prune.js', 'ubo-xml-prune.js', 'ubo-xml-prune'];
    xmlPrune$1.injections = [hit, logMessage, toRegExp, getXhrData, objectToString$1, matchRequestProps, getMatchPropsData, getRequestProps, isValidParsedData, parseMatchProps, isValidStrPattern, escapeRegExp, isEmptyObject];
    function m3uPrune$1(source, propsToRemove) {
      var urlToMatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
      var verbose = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
      if (typeof Reflect === 'undefined' || typeof fetch === 'undefined' || typeof Proxy === 'undefined' || typeof Response === 'undefined') {
        return;
      }
      var shouldPruneResponse = false;
      var shouldLogContent = verbose === 'true';
      var urlMatchRegexp = toRegExp(urlToMatch);
      var SEGMENT_MARKER = '#';
      var AD_MARKER = {
        ASSET: '#EXT-X-ASSET:',
        CUE: '#EXT-X-CUE:',
        CUE_IN: '#EXT-X-CUE-IN',
        DISCONTINUITY: '#EXT-X-DISCONTINUITY',
        EXTINF: '#EXTINF',
        EXTM3U: '#EXTM3U',
        SCTE35: '#EXT-X-SCTE35:'
      };
      var COMCAST_AD_MARKER = {
        AD: '-AD-',
        VAST: '-VAST-',
        VMAP_AD: '-VMAP-AD-',
        VMAP_AD_BREAK: '#EXT-X-VMAP-AD-BREAK:'
      };
      var TAGS_ALLOWLIST = ['#EXT-X-TARGETDURATION', '#EXT-X-MEDIA-SEQUENCE', '#EXT-X-DISCONTINUITY-SEQUENCE', '#EXT-X-ENDLIST', '#EXT-X-PLAYLIST-TYPE', '#EXT-X-I-FRAMES-ONLY', '#EXT-X-MEDIA', '#EXT-X-STREAM-INF', '#EXT-X-I-FRAME-STREAM-INF', '#EXT-X-SESSION-DATA', '#EXT-X-SESSION-KEY', '#EXT-X-INDEPENDENT-SEGMENTS', '#EXT-X-START'];
      var isAllowedTag = function isAllowedTag(str) {
        return TAGS_ALLOWLIST.some(function (el) {
          return str.startsWith(el);
        });
      };
      var pruneExtinfFromVmapBlock = function pruneExtinfFromVmapBlock(lines, i) {
        var array = lines.slice();
        var index = i;
        if (array[index].includes(AD_MARKER.EXTINF)) {
          array[index] = undefined;
          index += 1;
          if (array[index].includes(AD_MARKER.DISCONTINUITY)) {
            array[index] = undefined;
            index += 1;
            var prunedExtinf = pruneExtinfFromVmapBlock(array, index);
            array = prunedExtinf.array;
            index = prunedExtinf.index;
          }
        }
        return {
          array,
          index
        };
      };
      var pruneVmapBlock = function pruneVmapBlock(lines) {
        var array = lines.slice();
        for (var i = 0; i < array.length - 1; i += 1) {
          if (array[i].includes(COMCAST_AD_MARKER.VMAP_AD) || array[i].includes(COMCAST_AD_MARKER.VAST) || array[i].includes(COMCAST_AD_MARKER.AD)) {
            array[i] = undefined;
            if (array[i + 1].includes(AD_MARKER.EXTINF)) {
              i += 1;
              var prunedExtinf = pruneExtinfFromVmapBlock(array, i);
              array = prunedExtinf.array;
              i = prunedExtinf.index - 1;
            }
          }
        }
        return array;
      };
      var pruneSpliceoutBlock = function pruneSpliceoutBlock(line, index, array) {
        if (!line.startsWith(AD_MARKER.CUE)) {
          return line;
        }
        line = undefined;
        index += 1;
        if (array[index].startsWith(AD_MARKER.ASSET)) {
          array[index] = undefined;
          index += 1;
        }
        if (array[index].startsWith(AD_MARKER.SCTE35)) {
          array[index] = undefined;
          index += 1;
        }
        if (array[index].startsWith(AD_MARKER.CUE_IN)) {
          array[index] = undefined;
          index += 1;
        }
        if (array[index].startsWith(AD_MARKER.SCTE35)) {
          array[index] = undefined;
        }
        return line;
      };
      var removeM3ULineRegexp = toRegExp(propsToRemove);
      var pruneInfBlock = function pruneInfBlock(line, index, array) {
        if (!line.startsWith(AD_MARKER.EXTINF)) {
          return line;
        }
        if (!removeM3ULineRegexp.test(array[index + 1])) {
          return line;
        }
        if (!isAllowedTag(array[index])) {
          array[index] = undefined;
        }
        index += 1;
        if (!isAllowedTag(array[index])) {
          array[index] = undefined;
        }
        index += 1;
        if (array[index].startsWith(AD_MARKER.DISCONTINUITY)) {
          array[index] = undefined;
        }
        return line;
      };
      var pruneSegments = function pruneSegments(lines) {
        for (var i = 0; i < lines.length - 1; i += 1) {
          var _lines$i;
          if ((_lines$i = lines[i]) !== null && _lines$i !== void 0 && _lines$i.startsWith(SEGMENT_MARKER) && removeM3ULineRegexp.test(lines[i])) {
            var segmentName = lines[i].substring(0, lines[i].indexOf(':'));
            if (!segmentName) {
              return lines;
            }
            lines[i] = undefined;
            i += 1;
            for (var j = i; j < lines.length; j += 1) {
              if (!lines[j].includes(segmentName) && !isAllowedTag(lines[j])) {
                lines[j] = undefined;
              } else {
                i = j - 1;
                break;
              }
            }
          }
        }
        return lines;
      };
      var isM3U = function isM3U(text) {
        if (typeof text === 'string') {
          var trimmedText = text.trim();
          return trimmedText.startsWith(AD_MARKER.EXTM3U) || trimmedText.startsWith(COMCAST_AD_MARKER.VMAP_AD_BREAK);
        }
        return false;
      };
      var isPruningNeeded = function isPruningNeeded(text, regexp) {
        return isM3U(text) && regexp.test(text);
      };
      var pruneM3U = function pruneM3U(text) {
        if (shouldLogContent) {
          logMessage(source, "Original M3U content:\n".concat(text));
        }
        var lines = text.split(/\r?\n/);
        if (text.includes(COMCAST_AD_MARKER.VMAP_AD_BREAK)) {
          lines = pruneVmapBlock(lines);
          lines = lines.filter(function (l) {
            return !!l;
          }).join('\n');
          if (shouldLogContent) {
            logMessage(source, "Modified M3U content:\n".concat(lines));
          }
          return lines;
        }
        lines = pruneSegments(lines);
        lines = lines.map(function (line, index, array) {
          if (typeof line === 'undefined') {
            return line;
          }
          line = pruneSpliceoutBlock(line, index, array);
          if (typeof line !== 'undefined') {
            line = pruneInfBlock(line, index, array);
          }
          return line;
        }).filter(function (l) {
          return !!l;
        }).join('\n');
        if (shouldLogContent) {
          logMessage(source, "Modified M3U content:\n".concat(lines));
        }
        return lines;
      };
      var nativeOpen = window.XMLHttpRequest.prototype.open;
      var nativeSend = window.XMLHttpRequest.prototype.send;
      var xhrData;
      var openWrapper = function openWrapper(target, thisArg, args) {
        xhrData = getXhrData.apply(null, args);
        if (matchRequestProps(source, urlToMatch, xhrData)) {
          thisArg.shouldBePruned = true;
        }
        if (thisArg.shouldBePruned) {
          thisArg.collectedHeaders = [];
          var setRequestHeaderWrapper = function setRequestHeaderWrapper(target, thisArg, args) {
            thisArg.collectedHeaders.push(args);
            return Reflect.apply(target, thisArg, args);
          };
          var setRequestHeaderHandler = {
            apply: setRequestHeaderWrapper
          };
          thisArg.setRequestHeader = new Proxy(thisArg.setRequestHeader, setRequestHeaderHandler);
        }
        return Reflect.apply(target, thisArg, args);
      };
      var sendWrapper = function sendWrapper(target, thisArg, args) {
        var allowedResponseTypeValues = ['', 'text'];
        if (!thisArg.shouldBePruned || !allowedResponseTypeValues.includes(thisArg.responseType)) {
          return Reflect.apply(target, thisArg, args);
        }
        var forgedRequest = new XMLHttpRequest();
        forgedRequest.addEventListener('readystatechange', function () {
          if (forgedRequest.readyState !== 4) {
            return;
          }
          var readyState = forgedRequest.readyState,
            response = forgedRequest.response,
            responseText = forgedRequest.responseText,
            responseURL = forgedRequest.responseURL,
            responseXML = forgedRequest.responseXML,
            status = forgedRequest.status,
            statusText = forgedRequest.statusText;
          var content = responseText || response;
          if (typeof content !== 'string') {
            return;
          }
          if (!propsToRemove) {
            if (isM3U(response)) {
              var message = "XMLHttpRequest.open() URL: ".concat(responseURL, "\nresponse: ").concat(response);
              logMessage(source, message);
            }
          } else {
            shouldPruneResponse = isPruningNeeded(response, removeM3ULineRegexp);
          }
          var responseContent = shouldPruneResponse ? pruneM3U(response) : response;
          Object.defineProperties(thisArg, {
            readyState: {
              value: readyState,
              writable: false
            },
            responseURL: {
              value: responseURL,
              writable: false
            },
            responseXML: {
              value: responseXML,
              writable: false
            },
            status: {
              value: status,
              writable: false
            },
            statusText: {
              value: statusText,
              writable: false
            },
            response: {
              value: responseContent,
              writable: false
            },
            responseText: {
              value: responseContent,
              writable: false
            }
          });
          setTimeout(function () {
            var stateEvent = new Event('readystatechange');
            thisArg.dispatchEvent(stateEvent);
            var loadEvent = new Event('load');
            thisArg.dispatchEvent(loadEvent);
            var loadEndEvent = new Event('loadend');
            thisArg.dispatchEvent(loadEndEvent);
          }, 1);
          hit(source);
        });
        nativeOpen.apply(forgedRequest, [xhrData.method, xhrData.url]);
        thisArg.collectedHeaders.forEach(function (header) {
          var name = header[0];
          var value = header[1];
          forgedRequest.setRequestHeader(name, value);
        });
        thisArg.collectedHeaders = [];
        try {
          nativeSend.call(forgedRequest, args);
        } catch (_unused) {
          return Reflect.apply(target, thisArg, args);
        }
        return undefined;
      };
      var openHandler = {
        apply: openWrapper
      };
      var sendHandler = {
        apply: sendWrapper
      };
      XMLHttpRequest.prototype.open = new Proxy(XMLHttpRequest.prototype.open, openHandler);
      XMLHttpRequest.prototype.send = new Proxy(XMLHttpRequest.prototype.send, sendHandler);
      var nativeFetch = window.fetch;
      var fetchWrapper = async function fetchWrapper(target, thisArg, args) {
        var fetchURL = args[0] instanceof Request ? args[0].url : args[0];
        if (typeof fetchURL !== 'string' || fetchURL.length === 0) {
          return Reflect.apply(target, thisArg, args);
        }
        if (urlMatchRegexp.test(fetchURL)) {
          var response = await nativeFetch(...args);
          var clonedResponse = response.clone();
          var responseText = await response.text();
          if (!propsToRemove && isM3U(responseText)) {
            var message = "fetch URL: ".concat(fetchURL, "\nresponse text: ").concat(responseText);
            logMessage(source, message);
            return clonedResponse;
          }
          if (isPruningNeeded(responseText, removeM3ULineRegexp)) {
            var prunedText = pruneM3U(responseText);
            hit(source);
            return new Response(prunedText, {
              status: response.status,
              statusText: response.statusText,
              headers: response.headers
            });
          }
          return clonedResponse;
        }
        return Reflect.apply(target, thisArg, args);
      };
      var fetchHandler = {
        apply: fetchWrapper
      };
      window.fetch = new Proxy(window.fetch, fetchHandler);
    }
    m3uPrune$1.names = ['m3u-prune',
    'm3u-prune.js', 'ubo-m3u-prune.js', 'ubo-m3u-prune'];
    m3uPrune$1.injections = [hit, toRegExp, logMessage, getXhrData, objectToString$1, matchRequestProps, getMatchPropsData, getRequestProps, isValidParsedData, parseMatchProps, isValidStrPattern, escapeRegExp, isEmptyObject];
    function trustedSetCookie$1(source, name, value) {
      var offsetExpiresSec = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      var path = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '/';
      var domain = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
      if (typeof name === 'undefined') {
        logMessage(source, 'Cookie name should be specified');
        return;
      }
      if (typeof value === 'undefined') {
        logMessage(source, 'Cookie value should be specified');
        return;
      }
      var parsedValue = parseKeywordValue(value);
      if (!isValidCookiePath(path)) {
        logMessage(source, "Invalid cookie path: '".concat(path, "'"));
        return;
      }
      if (!document.location.origin.includes(domain)) {
        logMessage(source, "Cookie domain not matched by origin: '".concat(domain, "'"));
        return;
      }
      var cookieToSet = serializeCookie(name, parsedValue, path, domain, false);
      if (!cookieToSet) {
        logMessage(source, 'Invalid cookie name or value');
        return;
      }
      if (offsetExpiresSec) {
        var parsedOffsetMs = getTrustedCookieOffsetMs(offsetExpiresSec);
        if (!parsedOffsetMs) {
          logMessage(source, "Invalid offsetExpiresSec value: ".concat(offsetExpiresSec));
          return;
        }
        var expires = Date.now() + parsedOffsetMs;
        cookieToSet += "; expires=".concat(new Date(expires).toUTCString());
      }
      document.cookie = cookieToSet;
      hit(source);
    }
    trustedSetCookie$1.names = ['trusted-set-cookie'
    ];
    trustedSetCookie$1.injections = [hit, logMessage, nativeIsNaN, isCookieSetWithValue, serializeCookie, isValidCookiePath, getTrustedCookieOffsetMs, parseKeywordValue, getCookiePath];
    function trustedSetCookieReload$1(source, name, value) {
      var offsetExpiresSec = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      var path = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '/';
      var domain = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
      if (typeof name === 'undefined') {
        logMessage(source, 'Cookie name should be specified');
        return;
      }
      if (typeof value === 'undefined') {
        logMessage(source, 'Cookie value should be specified');
        return;
      }
      if (isCookieSetWithValue(document.cookie, name, value)) {
        return;
      }
      var parsedValue = parseKeywordValue(value);
      if (!isValidCookiePath(path)) {
        logMessage(source, "Invalid cookie path: '".concat(path, "'"));
        return;
      }
      if (!document.location.origin.includes(domain)) {
        logMessage(source, "Cookie domain not matched by origin: '".concat(domain, "'"));
        return;
      }
      var cookieToSet = serializeCookie(name, parsedValue, path, domain, false);
      if (!cookieToSet) {
        logMessage(source, 'Invalid cookie name or value');
        return;
      }
      if (offsetExpiresSec) {
        var parsedOffsetMs = getTrustedCookieOffsetMs(offsetExpiresSec);
        if (!parsedOffsetMs) {
          logMessage(source, "Invalid offsetExpiresSec value: ".concat(offsetExpiresSec));
          return;
        }
        var expires = Date.now() + parsedOffsetMs;
        cookieToSet += "; expires=".concat(new Date(expires).toUTCString());
      }
      document.cookie = cookieToSet;
      hit(source);
      var cookieValueToCheck = parseCookieString(document.cookie)[name];
      if (isCookieSetWithValue(document.cookie, name, cookieValueToCheck)) {
        window.location.reload();
      }
    }
    trustedSetCookieReload$1.names = ['trusted-set-cookie-reload'
    ];
    trustedSetCookieReload$1.injections = [hit, logMessage, nativeIsNaN, isCookieSetWithValue, serializeCookie, isValidCookiePath, getTrustedCookieOffsetMs, parseKeywordValue, parseCookieString, getCookiePath];
    function trustedReplaceFetchResponse$1(source) {
      var pattern = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
      var replacement = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
      var propsToMatch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      var verbose = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
      if (typeof fetch === 'undefined' || typeof Proxy === 'undefined' || typeof Response === 'undefined') {
        return;
      }
      if (pattern === '' && replacement !== '') {
        logMessage(source, 'Pattern argument should not be empty string');
        return;
      }
      var shouldLog = pattern === '' && replacement === '';
      var shouldLogContent = verbose === 'true';
      var nativeRequestClone = Request.prototype.clone;
      var nativeFetch = fetch;
      var shouldReplace = false;
      var fetchData;
      var handlerWrapper = function handlerWrapper(target, thisArg, args) {
        fetchData = getFetchData(args, nativeRequestClone);
        if (shouldLog) {
          logMessage(source, "fetch( ".concat(objectToString$1(fetchData), " )"), true);
          hit(source);
          return Reflect.apply(target, thisArg, args);
        }
        shouldReplace = matchRequestProps(source, propsToMatch, fetchData);
        if (!shouldReplace) {
          return Reflect.apply(target, thisArg, args);
        }
        return nativeFetch.apply(null, args).then(function (response) {
          return response.text().then(function (bodyText) {
            var patternRegexp = pattern === '*' ? /(\n|.)*/ : toRegExp(pattern);
            if (shouldLogContent) {
              logMessage(source, "Original text content: ".concat(bodyText));
            }
            var modifiedTextContent = bodyText.replace(patternRegexp, replacement);
            if (shouldLogContent) {
              logMessage(source, "Modified text content: ".concat(modifiedTextContent));
            }
            var forgedResponse = forgeResponse(response, modifiedTextContent);
            hit(source);
            return forgedResponse;
          }).catch(function () {
            var fetchDataStr = objectToString$1(fetchData);
            var message = "Response body can't be converted to text: ".concat(fetchDataStr);
            logMessage(source, message);
            return Reflect.apply(target, thisArg, args);
          });
        }).catch(function () {
          return Reflect.apply(target, thisArg, args);
        });
      };
      var fetchHandler = {
        apply: handlerWrapper
      };
      fetch = new Proxy(fetch, fetchHandler);
    }
    trustedReplaceFetchResponse$1.names = ['trusted-replace-fetch-response'
    ];
    trustedReplaceFetchResponse$1.injections = [hit, logMessage, getFetchData, objectToString$1, matchRequestProps, forgeResponse, toRegExp, isValidStrPattern, escapeRegExp, isEmptyObject, getRequestData, getRequestProps, parseMatchProps, isValidParsedData, getMatchPropsData];
    function trustedSetLocalStorageItem$1(source, key, value) {
      if (typeof key === 'undefined') {
        logMessage(source, 'Item key should be specified');
        return;
      }
      if (typeof value === 'undefined') {
        logMessage(source, 'Item value should be specified');
        return;
      }
      var parsedValue = parseKeywordValue(value);
      var _window = window,
        localStorage = _window.localStorage;
      setStorageItem(source, localStorage, key, parsedValue);
      hit(source);
    }
    trustedSetLocalStorageItem$1.names = ['trusted-set-local-storage-item'
    ];
    trustedSetLocalStorageItem$1.injections = [hit, logMessage, nativeIsNaN, setStorageItem, parseKeywordValue];
    function trustedSetSessionStorageItem$1(source, key, value) {
      if (typeof key === 'undefined') {
        logMessage(source, 'Item key should be specified');
        return;
      }
      if (typeof value === 'undefined') {
        logMessage(source, 'Item value should be specified');
        return;
      }
      var parsedValue = parseKeywordValue(value);
      var _window = window,
        sessionStorage = _window.sessionStorage;
      setStorageItem(source, sessionStorage, key, parsedValue);
      hit(source);
    }
    trustedSetSessionStorageItem$1.names = ['trusted-set-session-storage-item'
    ];
    trustedSetSessionStorageItem$1.injections = [hit, logMessage, nativeIsNaN, setStorageItem, parseKeywordValue];
    function trustedSetConstant$1(source, property, value, stack) {
      if (!property || !matchStackTrace(stack, new Error().stack)) {
        return;
      }
      var constantValue;
      try {
        constantValue = inferValue(value);
      } catch (e) {
        logMessage(source, e);
        return;
      }
      var canceled = false;
      var mustCancel = function mustCancel(value) {
        if (canceled) {
          return canceled;
        }
        canceled = value !== undefined && constantValue !== undefined && typeof value !== typeof constantValue && value !== null;
        return canceled;
      };
      var trapProp = function trapProp(base, prop, configurable, handler) {
        if (!handler.init(base[prop])) {
          return false;
        }
        var origDescriptor = Object.getOwnPropertyDescriptor(base, prop);
        var prevSetter;
        if (origDescriptor instanceof Object) {
          if (!origDescriptor.configurable) {
            var message = "Property '".concat(prop, "' is not configurable");
            logMessage(source, message);
            return false;
          }
          base[prop] = constantValue;
          if (origDescriptor.set instanceof Function) {
            prevSetter = origDescriptor.set;
          }
        }
        Object.defineProperty(base, prop, {
          configurable,
          get() {
            return handler.get();
          },
          set(a) {
            if (prevSetter !== undefined) {
              prevSetter(a);
            }
            handler.set(a);
          }
        });
        return true;
      };
      var setChainPropAccess = function setChainPropAccess(owner, property) {
        var chainInfo = getPropertyInChain(owner, property);
        var base = chainInfo.base;
        var prop = chainInfo.prop,
          chain = chainInfo.chain;
        var inChainPropHandler = {
          factValue: undefined,
          init(a) {
            this.factValue = a;
            return true;
          },
          get() {
            return this.factValue;
          },
          set(a) {
            if (this.factValue === a) {
              return;
            }
            this.factValue = a;
            if (a instanceof Object) {
              setChainPropAccess(a, chain);
            }
          }
        };
        var endPropHandler = {
          init(a) {
            if (mustCancel(a)) {
              return false;
            }
            return true;
          },
          get() {
            return constantValue;
          },
          set(a) {
            if (!mustCancel(a)) {
              return;
            }
            constantValue = a;
          }
        };
        if (!chain) {
          var isTrapped = trapProp(base, prop, false, endPropHandler);
          if (isTrapped) {
            hit(source);
          }
          return;
        }
        if (base !== undefined && base[prop] === null) {
          trapProp(base, prop, true, inChainPropHandler);
          return;
        }
        if ((base instanceof Object || typeof base === 'object') && isEmptyObject(base)) {
          trapProp(base, prop, true, inChainPropHandler);
        }
        var propValue = owner[prop];
        if (propValue instanceof Object || typeof propValue === 'object' && propValue !== null) {
          setChainPropAccess(propValue, chain);
        }
        trapProp(base, prop, true, inChainPropHandler);
      };
      setChainPropAccess(window, property);
    }
    trustedSetConstant$1.names = ['trusted-set-constant'
    ];
    trustedSetConstant$1.injections = [hit, inferValue, logMessage, noopArray, noopObject, noopFunc, noopCallbackFunc, trueFunc, falseFunc, throwFunc, noopPromiseReject, noopPromiseResolve, getPropertyInChain, setPropertyAccess, toRegExp, matchStackTrace, nativeIsNaN, isEmptyObject, getNativeRegexpTest,
    shouldAbortInlineOrInjectedScript, backupRegExpValues, restoreRegExpValues];
    function injectCssInShadowDom$1(source, cssRule) {
      var hostSelector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
      if (!Element.prototype.attachShadow || typeof Proxy === 'undefined' || typeof Reflect === 'undefined') {
        return;
      }
      if (cssRule.match(/(url|image-set)\(.*\)/i)) {
        logMessage(source, '"url()" function is not allowed for css rules');
        return;
      }
      var callback = function callback(shadowRoot) {
        try {
          var stylesheet = new CSSStyleSheet();
          try {
            stylesheet.insertRule(cssRule);
          } catch (e) {
            logMessage(source, "Unable to apply the rule '".concat(cssRule, "' due to: \n'").concat(e.message, "'"));
            return;
          }
          shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, stylesheet];
        } catch (_unused) {
          var styleTag = document.createElement('style');
          styleTag.innerText = cssRule;
          shadowRoot.appendChild(styleTag);
        }
        hit(source);
      };
      hijackAttachShadow(window, hostSelector, callback);
    }
    injectCssInShadowDom$1.names = ['inject-css-in-shadow-dom'];
    injectCssInShadowDom$1.injections = [hit, logMessage, hijackAttachShadow];
    function removeNodeText$1(source, nodeName, textMatch) {
      var _parseNodeTextParams = parseNodeTextParams(nodeName, textMatch),
        selector = _parseNodeTextParams.selector,
        nodeNameMatch = _parseNodeTextParams.nodeNameMatch,
        textContentMatch = _parseNodeTextParams.textContentMatch;
      var handleNodes = function handleNodes(nodes) {
        return nodes.forEach(function (node) {
          var shouldReplace = isTargetNode(node, nodeNameMatch, textContentMatch);
          if (shouldReplace) {
            var ALL_TEXT_PATTERN = /^[\s\S]*$/;
            var REPLACEMENT = '';
            replaceNodeText(source, node, ALL_TEXT_PATTERN, REPLACEMENT);
          }
        });
      };
      if (document.documentElement) {
        handleExistingNodes(selector, handleNodes);
      }
      observeDocumentWithTimeout(function (mutations) {
        return handleMutations(mutations, handleNodes);
      });
    }
    removeNodeText$1.names = ['remove-node-text',
    'remove-node-text.js', 'ubo-remove-node-text.js', 'rmnt.js', 'ubo-rmnt.js', 'ubo-remove-node-text', 'ubo-rmnt'];
    removeNodeText$1.injections = [observeDocumentWithTimeout, handleExistingNodes, handleMutations, replaceNodeText, isTargetNode, parseNodeTextParams,
    hit, nodeListToArray, getAddedNodes, toRegExp];
    function trustedReplaceNodeText$1(source, nodeName, textMatch, pattern, replacement) {
      var _parseNodeTextParams = parseNodeTextParams(nodeName, textMatch, pattern),
        selector = _parseNodeTextParams.selector,
        nodeNameMatch = _parseNodeTextParams.nodeNameMatch,
        textContentMatch = _parseNodeTextParams.textContentMatch,
        patternMatch = _parseNodeTextParams.patternMatch;
      for (var _len = arguments.length, extraArgs = new Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
        extraArgs[_key - 5] = arguments[_key];
      }
      var shouldLog = extraArgs.includes('verbose');
      var handleNodes = function handleNodes(nodes) {
        return nodes.forEach(function (node) {
          var shouldReplace = isTargetNode(node, nodeNameMatch, textContentMatch);
          if (shouldReplace) {
            if (shouldLog) {
              var originalText = node.textContent;
              if (originalText) {
                logMessage(source, "Original text content: ".concat(originalText));
              }
            }
            replaceNodeText(source, node, patternMatch, replacement);
            if (shouldLog) {
              var modifiedText = node.textContent;
              if (modifiedText) {
                logMessage(source, "Modified text content: ".concat(modifiedText));
              }
            }
          }
        });
      };
      if (document.documentElement) {
        handleExistingNodes(selector, handleNodes);
      }
      observeDocumentWithTimeout(function (mutations) {
        return handleMutations(mutations, handleNodes);
      });
    }
    trustedReplaceNodeText$1.names = ['trusted-replace-node-text'
    ];
    trustedReplaceNodeText$1.injections = [observeDocumentWithTimeout, handleExistingNodes, handleMutations, replaceNodeText, isTargetNode, parseNodeTextParams, logMessage,
    hit, nodeListToArray, getAddedNodes, toRegExp];
    function evalDataPrune$1(source, propsToRemove, requiredInitialProps, stack) {
      var prunePaths = getPrunePath(propsToRemove);
      var requiredPaths = getPrunePath(requiredInitialProps);
      var nativeObjects = {
        nativeStringify: window.JSON.stringify
      };
      var evalWrapper = function evalWrapper(target, thisArg, args) {
        var data = Reflect.apply(target, thisArg, args);
        if (typeof data === 'object') {
          data = jsonPruner(source, data, prunePaths, requiredPaths, stack, nativeObjects);
        }
        return data;
      };
      var evalHandler = {
        apply: evalWrapper
      };
      window.eval = new Proxy(window.eval, evalHandler);
    }
    evalDataPrune$1.names = ['evaldata-prune',
    'evaldata-prune.js', 'ubo-evaldata-prune.js', 'ubo-evaldata-prune'];
    evalDataPrune$1.injections = [hit, matchStackTrace, getWildcardPropertyInChain, logMessage, toRegExp, isPruningNeeded, jsonPruner, getPrunePath,
    getNativeRegexpTest, shouldAbortInlineOrInjectedScript, backupRegExpValues, restoreRegExpValues];
    function trustedPruneInboundObject$1(source, functionName, propsToRemove, requiredInitialProps) {
      var stack = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
      if (!functionName) {
        return;
      }
      var nativeObjects = {
        nativeStringify: window.JSON.stringify
      };
      var _getPropertyInChain = getPropertyInChain(window, functionName),
        base = _getPropertyInChain.base,
        prop = _getPropertyInChain.prop;
      if (!base || !prop || typeof base[prop] !== 'function') {
        var message = "".concat(functionName, " is not a function");
        logMessage(source, message);
        return;
      }
      var prunePaths = getPrunePath(propsToRemove);
      var requiredPaths = getPrunePath(requiredInitialProps);
      var objectWrapper = function objectWrapper(target, thisArg, args) {
        var data = args[0];
        if (typeof data === 'object') {
          data = jsonPruner(source, data, prunePaths, requiredPaths, stack, nativeObjects);
          args[0] = data;
        }
        return Reflect.apply(target, thisArg, args);
      };
      var objectHandler = {
        apply: objectWrapper
      };
      base[prop] = new Proxy(base[prop], objectHandler);
    }
    trustedPruneInboundObject$1.names = ['trusted-prune-inbound-object'
    ];
    trustedPruneInboundObject$1.injections = [hit, matchStackTrace, getPropertyInChain, getWildcardPropertyInChain, logMessage, isPruningNeeded, jsonPruner, getPrunePath,
    toRegExp, getNativeRegexpTest, shouldAbortInlineOrInjectedScript, isEmptyObject, backupRegExpValues, restoreRegExpValues];
    function trustedSetAttr$1(source, selector, attr) {
      var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      if (!selector || !attr) {
        return;
      }
      setAttributeBySelector(source, selector, attr, value);
      observeDOMChanges(function () {
        return setAttributeBySelector(source, selector, attr, value);
      }, true);
    }
    trustedSetAttr$1.names = ['trusted-set-attr'
    ];
    trustedSetAttr$1.injections = [setAttributeBySelector, observeDOMChanges, nativeIsNaN,
    defaultAttributeSetter, logMessage, throttle, hit];
    function spoofCSS$1(source, selectors, cssPropertyName, cssPropertyValue) {
      if (!selectors) {
        return;
      }
      var uboAliases = ['spoof-css.js', 'ubo-spoof-css.js', 'ubo-spoof-css'];
      function convertToCamelCase(cssProperty) {
        if (!cssProperty.includes('-')) {
          return cssProperty;
        }
        var splittedProperty = cssProperty.split('-');
        var firstPart = splittedProperty[0];
        var secondPart = splittedProperty[1];
        return "".concat(firstPart).concat(secondPart[0].toUpperCase()).concat(secondPart.slice(1));
      }
      var shouldDebug = !!(cssPropertyName === 'debug' && cssPropertyValue);
      var propToValueMap = new Map();
      if (uboAliases.includes(source.name)) {
        var args = source.args;
        var arrayOfProperties = [];
        var isDebug = args.at(-2);
        if (isDebug === 'debug') {
          arrayOfProperties = args.slice(1, -2);
        } else {
          arrayOfProperties = args.slice(1);
        }
        for (var i = 0; i < arrayOfProperties.length; i += 2) {
          if (arrayOfProperties[i] === '') {
            break;
          }
          propToValueMap.set(convertToCamelCase(arrayOfProperties[i]), arrayOfProperties[i + 1]);
        }
      } else if (cssPropertyName && cssPropertyValue && !shouldDebug) {
        propToValueMap.set(convertToCamelCase(cssPropertyName), cssPropertyValue);
      }
      var spoofStyle = function spoofStyle(cssProperty, realCssValue) {
        return propToValueMap.has(cssProperty) ? propToValueMap.get(cssProperty) : realCssValue;
      };
      var setRectValue = function setRectValue(rect, prop, value) {
        Object.defineProperty(rect, prop, {
          value: parseFloat(value)
        });
      };
      var getter = function getter(target, prop, receiver) {
        hit(source);
        if (prop === 'toString') {
          return target.toString.bind(target);
        }
        return Reflect.get(target, prop, receiver);
      };
      var getComputedStyleWrapper = function getComputedStyleWrapper(target, thisArg, args) {
        if (shouldDebug) {
          debugger;
        }
        var style = Reflect.apply(target, thisArg, args);
        if (!args[0].matches(selectors)) {
          return style;
        }
        var proxiedStyle = new Proxy(style, {
          get(target, prop) {
            var CSSStyleProp = target[prop];
            if (typeof CSSStyleProp !== 'function') {
              return spoofStyle(prop, CSSStyleProp || '');
            }
            if (prop !== 'getPropertyValue') {
              return CSSStyleProp.bind(target);
            }
            var getPropertyValueFunc = new Proxy(CSSStyleProp, {
              apply(target, thisArg, args) {
                var cssName = args[0];
                var cssValue = thisArg[cssName];
                return spoofStyle(cssName, cssValue);
              },
              get: getter
            });
            return getPropertyValueFunc;
          },
          getOwnPropertyDescriptor(target, prop) {
            if (propToValueMap.has(prop)) {
              return {
                configurable: true,
                enumerable: true,
                value: propToValueMap.get(prop),
                writable: true
              };
            }
            return Reflect.getOwnPropertyDescriptor(target, prop);
          }
        });
        hit(source);
        return proxiedStyle;
      };
      var getComputedStyleHandler = {
        apply: getComputedStyleWrapper,
        get: getter
      };
      window.getComputedStyle = new Proxy(window.getComputedStyle, getComputedStyleHandler);
      var getBoundingClientRectWrapper = function getBoundingClientRectWrapper(target, thisArg, args) {
        if (shouldDebug) {
          debugger;
        }
        var rect = Reflect.apply(target, thisArg, args);
        if (!thisArg.matches(selectors)) {
          return rect;
        }
        var top = rect.top,
          bottom = rect.bottom,
          height = rect.height,
          width = rect.width,
          left = rect.left,
          right = rect.right;
        var newDOMRect = new window.DOMRect(rect.x, rect.y, top, bottom, width, height, left, right);
        if (propToValueMap.has('top')) {
          setRectValue(newDOMRect, 'top', propToValueMap.get('top'));
        }
        if (propToValueMap.has('bottom')) {
          setRectValue(newDOMRect, 'bottom', propToValueMap.get('bottom'));
        }
        if (propToValueMap.has('left')) {
          setRectValue(newDOMRect, 'left', propToValueMap.get('left'));
        }
        if (propToValueMap.has('right')) {
          setRectValue(newDOMRect, 'right', propToValueMap.get('right'));
        }
        if (propToValueMap.has('height')) {
          setRectValue(newDOMRect, 'height', propToValueMap.get('height'));
        }
        if (propToValueMap.has('width')) {
          setRectValue(newDOMRect, 'width', propToValueMap.get('width'));
        }
        hit(source);
        return newDOMRect;
      };
      var getBoundingClientRectHandler = {
        apply: getBoundingClientRectWrapper,
        get: getter
      };
      window.Element.prototype.getBoundingClientRect = new Proxy(window.Element.prototype.getBoundingClientRect, getBoundingClientRectHandler);
    }
    spoofCSS$1.names = ['spoof-css',
    'spoof-css.js', 'ubo-spoof-css.js', 'ubo-spoof-css'];
    spoofCSS$1.injections = [hit];
    function callNoThrow$1(source, functionName) {
      if (!functionName) {
        return;
      }
      var _getPropertyInChain = getPropertyInChain(window, functionName),
        base = _getPropertyInChain.base,
        prop = _getPropertyInChain.prop;
      if (!base || !prop || typeof base[prop] !== 'function') {
        var message = "".concat(functionName, " is not a function");
        logMessage(source, message);
        return;
      }
      var objectWrapper = function objectWrapper() {
        var result;
        try {
          result = Reflect.apply(...arguments);
        } catch (e) {
          var _message = "Error calling ".concat(functionName, ": ").concat(e.message);
          logMessage(source, _message);
        }
        hit(source);
        return result;
      };
      var objectHandler = {
        apply: objectWrapper
      };
      base[prop] = new Proxy(base[prop], objectHandler);
    }
    callNoThrow$1.names = ['call-nothrow',
    'call-nothrow.js', 'ubo-call-nothrow.js', 'ubo-call-nothrow'];
    callNoThrow$1.injections = [hit, getPropertyInChain, logMessage,
    isEmptyObject];
    function trustedCreateElement$1(source, parentSelector, tagName) {
      var attributePairs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      var textContent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
      var cleanupDelayMs = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : NaN;
      if (!parentSelector || !tagName) {
        return;
      }
      var IFRAME_WINDOW_NAME = 'trusted-create-element-window';
      if (window.name === IFRAME_WINDOW_NAME) {
        return;
      }
      var logError = function logError(prefix, error) {
        logMessage(source, "".concat(prefix, " due to ").concat(getErrorMessage(error)));
      };
      var element;
      try {
        element = document.createElement(tagName);
        element.textContent = textContent;
      } catch (e) {
        logError("Cannot create element with tag name '".concat(tagName, "'"), e);
        return;
      }
      var attributes = [];
      try {
        attributes = parseAttributePairs(attributePairs);
      } catch (e) {
        logError("Cannot parse attributePairs param: '".concat(attributePairs, "'"), e);
        return;
      }
      attributes.forEach(function (attr) {
        try {
          element.setAttribute(attr.name, attr.value);
        } catch (e) {
          logError("Cannot set attribute '".concat(attr.name, "' with value '").concat(attr.value, "'"), e);
        }
      });
      var timerId;
      var elementCreated = false;
      var elementRemoved = false;
      var findParentAndAppendEl = function findParentAndAppendEl(parentElSelector, el, removeElDelayMs) {
        var parentEl;
        try {
          parentEl = document.querySelector(parentElSelector);
        } catch (e) {
          logError("Cannot find parent element by selector '".concat(parentElSelector, "'"), e);
          return false;
        }
        if (!parentEl) {
          logMessage(source, "No parent element found by selector: '".concat(parentElSelector, "'"));
          return false;
        }
        try {
          if (!parentEl.contains(el)) {
            parentEl.append(el);
          }
          if (el instanceof HTMLIFrameElement && el.contentWindow) {
            el.contentWindow.name = IFRAME_WINDOW_NAME;
          }
          elementCreated = true;
          hit(source);
        } catch (e) {
          logError("Cannot append child to parent by selector '".concat(parentElSelector, "'"), e);
          return false;
        }
        if (!nativeIsNaN(removeElDelayMs)) {
          timerId = setTimeout(function () {
            el.remove();
            elementRemoved = true;
            clearTimeout(timerId);
          }, removeElDelayMs);
        }
        return true;
      };
      if (!findParentAndAppendEl(parentSelector, element, cleanupDelayMs)) {
        observeDocumentWithTimeout(function (mutations, observer) {
          if (elementRemoved || elementCreated || findParentAndAppendEl(parentSelector, element, cleanupDelayMs)) {
            observer.disconnect();
          }
        });
      }
    }
    trustedCreateElement$1.names = ['trusted-create-element'
    ];
    trustedCreateElement$1.injections = [hit, logMessage, observeDocumentWithTimeout, nativeIsNaN, parseAttributePairs, getErrorMessage];
    function hrefSanitizer$1(source, selector) {
      var attribute = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'text';
      if (!selector) {
        logMessage(source, 'Selector is required.');
        return;
      }
      var regexpNotValidAtStart = /^(?:[\0- \x7F-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87B-\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+/;
      var regexpNotValidAtEnd = /(?:[\0- \x7F-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87B-\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+$/;
      var extractNewHref = function extractNewHref(anchor, attr) {
        if (attr === 'text') {
          if (!anchor.textContent) {
            return '';
          }
          return anchor.textContent.replace(regexpNotValidAtStart, '').replace(regexpNotValidAtEnd, '');
        }
        if (attr.startsWith('?')) {
          try {
            var url = new URL(anchor.href, document.location.href);
            return url.searchParams.get(attr.slice(1)) || '';
          } catch (ex) {
            logMessage(source, "Cannot retrieve the parameter '".concat(attr.slice(1), "' from the URL '").concat(anchor.href));
            return '';
          }
        }
        if (attr.startsWith('[') && attr.endsWith(']')) {
          return anchor.getAttribute(attr.slice(1, -1)) || '';
        }
        return '';
      };
      var getValidURL = function getValidURL(text) {
        if (!text) {
          return null;
        }
        try {
          var _URL = new URL(text, document.location.href),
            href = _URL.href,
            protocol = _URL.protocol;
          if (protocol !== 'http:' && protocol !== 'https:') {
            logMessage(source, "Protocol not allowed: \"".concat(protocol, "\", from URL: \"").concat(href, "\""));
            return null;
          }
          return href;
        } catch (_unused) {
          return null;
        }
      };
      var isSanitizableAnchor = function isSanitizableAnchor(element) {
        return element.nodeName.toLowerCase() === 'a' && element.hasAttribute('href');
      };
      var sanitize = function sanitize(elementSelector) {
        var elements;
        try {
          elements = document.querySelectorAll(elementSelector);
        } catch (e) {
          logMessage(source, "Invalid selector \"".concat(elementSelector, "\""));
          return;
        }
        elements.forEach(function (elem) {
          try {
            if (!isSanitizableAnchor(elem)) {
              return;
            }
            var newHref = extractNewHref(elem, attribute);
            var newValidHref = getValidURL(newHref);
            if (!newValidHref) {
              logMessage(source, "Invalid URL: ".concat(newHref));
              return;
            }
            var oldHref = elem.href;
            elem.setAttribute('href', newValidHref);
            if (newValidHref !== oldHref) {
              logMessage(source, "Sanitized \"".concat(oldHref, "\" to \"").concat(newValidHref, "\"."));
            }
          } catch (ex) {
            logMessage(source, "Failed to sanitize ".concat(elem, "."));
          }
        });
        hit(source);
      };
      var run = function run() {
        sanitize(selector);
        observeDOMChanges(function () {
          return sanitize(selector);
        }, true);
      };
      if (document.readyState === 'loading') {
        window.addEventListener('DOMContentLoaded', run, {
          once: true
        });
      } else {
        run();
      }
    }
    hrefSanitizer$1.names = ['href-sanitizer',
    'href-sanitizer.js', 'ubo-href-sanitizer.js', 'ubo-href-sanitizer'];
    hrefSanitizer$1.injections = [observeDOMChanges, hit, logMessage,
    throttle];
    function jsonPruneFetchResponse$1(source, propsToRemove, obligatoryProps) {
      var propsToMatch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      var stack = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
      if (typeof fetch === 'undefined' || typeof Proxy === 'undefined' || typeof Response === 'undefined') {
        return;
      }
      var prunePaths = getPrunePath(propsToRemove);
      var requiredPaths = getPrunePath(obligatoryProps);
      var nativeStringify = window.JSON.stringify;
      var nativeRequestClone = window.Request.prototype.clone;
      var nativeResponseClone = window.Response.prototype.clone;
      var nativeFetch = window.fetch;
      var fetchHandlerWrapper = async function fetchHandlerWrapper(target, thisArg, args) {
        var fetchData = getFetchData(args, nativeRequestClone);
        if (!matchRequestProps(source, propsToMatch, fetchData)) {
          return Reflect.apply(target, thisArg, args);
        }
        var originalResponse;
        var clonedResponse;
        try {
          originalResponse = await nativeFetch.apply(null, args);
          clonedResponse = nativeResponseClone.call(originalResponse);
        } catch (_unused) {
          logMessage(source, "Could not make an original fetch request: ".concat(fetchData.url));
          return Reflect.apply(target, thisArg, args);
        }
        var json;
        try {
          json = await originalResponse.json();
        } catch (e) {
          var message = "Response body can't be converted to json: ".concat(objectToString$1(fetchData));
          logMessage(source, message);
          return clonedResponse;
        }
        var modifiedJson = jsonPruner(source, json, prunePaths, requiredPaths, stack, {
          nativeStringify,
          nativeRequestClone,
          nativeResponseClone,
          nativeFetch
        });
        var forgedResponse = forgeResponse(originalResponse, nativeStringify(modifiedJson));
        hit(source);
        return forgedResponse;
      };
      var fetchHandler = {
        apply: fetchHandlerWrapper
      };
      window.fetch = new Proxy(window.fetch, fetchHandler);
    }
    jsonPruneFetchResponse$1.names = ['json-prune-fetch-response',
    'json-prune-fetch-response.js', 'ubo-json-prune-fetch-response.js', 'ubo-json-prune-fetch-response'];
    jsonPruneFetchResponse$1.injections = [hit, logMessage, getFetchData, objectToString$1, matchRequestProps, jsonPruner, getPrunePath, forgeResponse, isPruningNeeded, matchStackTrace, toRegExp, isValidStrPattern, escapeRegExp, isEmptyObject, getRequestData, getRequestProps, parseMatchProps, isValidParsedData, getMatchPropsData, getWildcardPropertyInChain, shouldAbortInlineOrInjectedScript, getNativeRegexpTest, backupRegExpValues, restoreRegExpValues];
    function noProtectedAudience$1(source) {
      if (Document instanceof Object === false) {
        return;
      }
      var protectedAudienceMethods = {
        joinAdInterestGroup: noopResolveVoid,
        runAdAuction: noopResolveNull,
        leaveAdInterestGroup: noopResolveVoid,
        clearOriginJoinedAdInterestGroups: noopResolveVoid,
        createAuctionNonce: noopStr,
        updateAdInterestGroups: noopFunc
      };
      for (var _i = 0, _Object$keys = Object.keys(protectedAudienceMethods); _i < _Object$keys.length; _i++) {
        var key = _Object$keys[_i];
        var methodName = key;
        var prototype = Navigator.prototype;
        if (!Object.prototype.hasOwnProperty.call(prototype, methodName) || prototype[methodName] instanceof Function === false) {
          continue;
        }
        prototype[methodName] = protectedAudienceMethods[methodName];
      }
      hit(source);
    }
    noProtectedAudience$1.names = ['no-protected-audience'];
    noProtectedAudience$1.injections = [hit, noopStr, noopFunc, noopResolveVoid, noopResolveNull];
    function trustedSuppressNativeMethod$1(source, methodPath, signatureStr) {
      var how = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'abort';
      var stack = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
      if (!methodPath || !signatureStr) {
        return;
      }
      var IGNORE_ARG_SYMBOL = ' ';
      var suppress = how === 'abort' ? getAbortFunc() : function () {};
      var signatureMatcher;
      try {
        signatureMatcher = signatureStr.split('|').map(function (value) {
          return value === IGNORE_ARG_SYMBOL ? value : inferValue(value);
        });
      } catch (e) {
        logMessage(source, "Could not parse the signature matcher: ".concat(getErrorMessage(e)));
        return;
      }
      var getPathParts = getPropertyInChain;
      var _getPathParts = getPathParts(window, methodPath),
        base = _getPathParts.base,
        chain = _getPathParts.chain,
        prop = _getPathParts.prop;
      if (typeof chain !== 'undefined') {
        logMessage(source, "Could not reach the end of the prop chain: ".concat(methodPath));
        return;
      }
      var nativeMethod = base[prop];
      if (!nativeMethod || typeof nativeMethod !== 'function') {
        logMessage(source, "Could not retrieve the method: ".concat(methodPath));
        return;
      }
      function matchMethodCall(nativeArguments, matchArguments) {
        return matchArguments.every(function (matcher, i) {
          if (matcher === IGNORE_ARG_SYMBOL) {
            return true;
          }
          var argument = nativeArguments[i];
          return isValueMatched(argument, matcher);
        });
      }
      var isMatchingSuspended = false;
      function apply(target, thisArg, argumentsList) {
        if (isMatchingSuspended) {
          return Reflect.apply(target, thisArg, argumentsList);
        }
        isMatchingSuspended = true;
        if (stack && !matchStackTrace(stack, new Error().stack || '')) {
          return Reflect.apply(target, thisArg, argumentsList);
        }
        var isMatching = matchMethodCall(argumentsList, signatureMatcher);
        isMatchingSuspended = false;
        if (isMatching) {
          hit(source);
          return suppress();
        }
        return Reflect.apply(target, thisArg, argumentsList);
      }
      base[prop] = new Proxy(nativeMethod, {
        apply
      });
    }
    trustedSuppressNativeMethod$1.names = ['trusted-suppress-native-method'];
    trustedSuppressNativeMethod$1.injections = [hit, logMessage, getPropertyInChain, inferValue, isValueMatched, getAbortFunc, matchStackTrace, getErrorMessage,
    shouldAbortInlineOrInjectedScript, getNativeRegexpTest, toRegExp, nativeIsNaN, randomId, createOnErrorHandler, isEmptyObject, isArbitraryObject, isStringMatched, isArrayMatched, isObjectMatched, backupRegExpValues, restoreRegExpValues];
    function jsonPruneXhrResponse$1(source, propsToRemove, obligatoryProps) {
      var propsToMatch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      var stack = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
      if (typeof Proxy === 'undefined') {
        return;
      }
      var shouldLog = !propsToRemove && !obligatoryProps;
      var prunePaths = getPrunePath(propsToRemove);
      var requiredPaths = getPrunePath(obligatoryProps);
      var nativeParse = window.JSON.parse;
      var nativeStringify = window.JSON.stringify;
      var nativeOpen = window.XMLHttpRequest.prototype.open;
      var nativeSend = window.XMLHttpRequest.prototype.send;
      var setRequestHeaderWrapper = function setRequestHeaderWrapper(setRequestHeader, thisArgument, argsList) {
        thisArgument.collectedHeaders.push(argsList);
        return Reflect.apply(setRequestHeader, thisArgument, argsList);
      };
      var setRequestHeaderHandler = {
        apply: setRequestHeaderWrapper
      };
      var xhrData;
      var openWrapper = function openWrapper(target, thisArg, args) {
        xhrData = getXhrData.apply(null, args);
        if (matchRequestProps(source, propsToMatch, xhrData) || shouldLog) {
          thisArg.xhrShouldBePruned = true;
          thisArg.headersReceived = !!thisArg.headersReceived;
        }
        if (thisArg.xhrShouldBePruned && !thisArg.headersReceived) {
          thisArg.headersReceived = true;
          thisArg.collectedHeaders = [];
          thisArg.setRequestHeader = new Proxy(thisArg.setRequestHeader, setRequestHeaderHandler);
        }
        return Reflect.apply(target, thisArg, args);
      };
      var sendWrapper = function sendWrapper(target, thisArg, args) {
        var stackTrace = new Error().stack || '';
        if (!thisArg.xhrShouldBePruned || stack && !matchStackTrace(stack, stackTrace)) {
          return Reflect.apply(target, thisArg, args);
        }
        var forgedRequest = new XMLHttpRequest();
        forgedRequest.addEventListener('readystatechange', function () {
          if (forgedRequest.readyState !== 4) {
            return;
          }
          var readyState = forgedRequest.readyState,
            response = forgedRequest.response,
            responseText = forgedRequest.responseText,
            responseURL = forgedRequest.responseURL,
            responseXML = forgedRequest.responseXML,
            status = forgedRequest.status,
            statusText = forgedRequest.statusText;
          var content = responseText || response;
          if (typeof content !== 'string' && typeof content !== 'object') {
            return;
          }
          var modifiedContent;
          if (typeof content === 'string') {
            try {
              var jsonContent = nativeParse(content);
              if (shouldLog) {
                logMessage(source, "".concat(window.location.hostname, "\n").concat(nativeStringify(jsonContent, null, 2), "\nStack trace:\n").concat(stackTrace), true);
                logMessage(source, jsonContent, true, false);
                modifiedContent = content;
              } else {
                modifiedContent = jsonPruner(source, jsonContent, prunePaths, requiredPaths, stack = '', {
                  nativeStringify
                });
                try {
                  var responseType = thisArg.responseType;
                  switch (responseType) {
                    case '':
                    case 'text':
                      modifiedContent = nativeStringify(modifiedContent);
                      break;
                    case 'arraybuffer':
                      modifiedContent = new TextEncoder().encode(nativeStringify(modifiedContent)).buffer;
                      break;
                    case 'blob':
                      modifiedContent = new Blob([nativeStringify(modifiedContent)]);
                      break;
                    default:
                      break;
                  }
                } catch (error) {
                  var message = "Response body cannot be converted to reponse type: '".concat(content, "'");
                  logMessage(source, message);
                  modifiedContent = content;
                }
              }
            } catch (error) {
              var _message = "Response body cannot be converted to json: '".concat(content, "'");
              logMessage(source, _message);
              modifiedContent = content;
            }
          }
          Object.defineProperties(thisArg, {
            readyState: {
              value: readyState,
              writable: false
            },
            responseURL: {
              value: responseURL,
              writable: false
            },
            responseXML: {
              value: responseXML,
              writable: false
            },
            status: {
              value: status,
              writable: false
            },
            statusText: {
              value: statusText,
              writable: false
            },
            response: {
              value: modifiedContent,
              writable: false
            },
            responseText: {
              value: modifiedContent,
              writable: false
            }
          });
          setTimeout(function () {
            var stateEvent = new Event('readystatechange');
            thisArg.dispatchEvent(stateEvent);
            var loadEvent = new Event('load');
            thisArg.dispatchEvent(loadEvent);
            var loadEndEvent = new Event('loadend');
            thisArg.dispatchEvent(loadEndEvent);
          }, 1);
          hit(source);
        });
        nativeOpen.apply(forgedRequest, [xhrData.method, xhrData.url, Boolean(xhrData.async)]);
        thisArg.collectedHeaders.forEach(function (header) {
          forgedRequest.setRequestHeader(header[0], header[1]);
        });
        thisArg.collectedHeaders = [];
        try {
          nativeSend.call(forgedRequest, args);
        } catch (_unused) {
          return Reflect.apply(target, thisArg, args);
        }
        return undefined;
      };
      var openHandler = {
        apply: openWrapper
      };
      var sendHandler = {
        apply: sendWrapper
      };
      XMLHttpRequest.prototype.open = new Proxy(XMLHttpRequest.prototype.open, openHandler);
      XMLHttpRequest.prototype.send = new Proxy(XMLHttpRequest.prototype.send, sendHandler);
    }
    jsonPruneXhrResponse$1.names = ['json-prune-xhr-response',
    'json-prune-xhr-response.js', 'ubo-json-prune-xhr-response.js', 'ubo-json-prune-xhr-response'];
    jsonPruneXhrResponse$1.injections = [hit, logMessage, toRegExp, jsonPruner, getPrunePath, objectToString$1, matchRequestProps, getXhrData, isPruningNeeded, matchStackTrace, getMatchPropsData, getRequestProps, isValidParsedData, parseMatchProps, isValidStrPattern, escapeRegExp, isEmptyObject, getWildcardPropertyInChain, shouldAbortInlineOrInjectedScript, getNativeRegexpTest, backupRegExpValues, restoreRegExpValues];
    function trustedDispatchEvent$1(source, event, target) {
      if (!event) {
        return;
      }
      var hasBeenDispatched = false;
      var eventTarget = document;
      if (target === 'window') {
        eventTarget = window;
      }
      var events = new Set();
      var dispatch = function dispatch() {
        var customEvent = new Event(event);
        if (typeof target === 'string' && target !== 'window') {
          eventTarget = document.querySelector(target);
        }
        var isEventAdded = events.has(event);
        if (!hasBeenDispatched && isEventAdded && eventTarget) {
          hasBeenDispatched = true;
          hit(source);
          eventTarget.dispatchEvent(customEvent);
        }
      };
      var wrapper = function wrapper(eventListener, thisArg, args) {
        var eventName = args[0];
        if (thisArg && eventName) {
          events.add(eventName);
          setTimeout(function () {
            dispatch();
          }, 1);
        }
        return Reflect.apply(eventListener, thisArg, args);
      };
      var handler = {
        apply: wrapper
      };
      EventTarget.prototype.addEventListener = new Proxy(EventTarget.prototype.addEventListener, handler);
    }
    trustedDispatchEvent$1.names = ['trusted-dispatch-event'];
    trustedDispatchEvent$1.injections = [hit];
    function trustedReplaceOutboundText$1(source, methodPath) {
      var textToReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
      var replacement = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
      var decodeMethod = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
      var stack = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '';
      var logContent = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
      if (!methodPath) {
        return;
      }
      var getPathParts = getPropertyInChain;
      var _getPathParts = getPathParts(window, methodPath),
        base = _getPathParts.base,
        chain = _getPathParts.chain,
        prop = _getPathParts.prop;
      if (typeof chain !== 'undefined') {
        logMessage(source, "Could not reach the end of the prop chain: ".concat(methodPath));
        return;
      }
      var nativeMethod = base[prop];
      if (!nativeMethod || typeof nativeMethod !== 'function') {
        logMessage(source, "Could not retrieve the method: ".concat(methodPath));
        return;
      }
      var isValidBase64 = function isValidBase64(str) {
        try {
          if (str === '') {
            return false;
          }
          var decodedString = atob(str);
          var encodedString = btoa(decodedString);
          var stringWithoutPadding = str.replace(/=+$/, '');
          var encodedStringWithoutPadding = encodedString.replace(/=+$/, '');
          return encodedStringWithoutPadding === stringWithoutPadding;
        } catch (e) {
          return false;
        }
      };
      var decodeAndReplaceContent = function decodeAndReplaceContent(content, pattern, textReplacement, decode, log) {
        switch (decode) {
          case 'base64':
            try {
              if (!isValidBase64(content)) {
                logMessage(source, "Text content is not a valid base64 encoded string: ".concat(content));
                return content;
              }
              var decodedContent = atob(content);
              if (log) {
                logMessage(source, "Decoded text content: ".concat(decodedContent));
              }
              var modifiedContent = textToReplace ? decodedContent.replace(pattern, textReplacement) : decodedContent;
              if (log) {
                var message = modifiedContent !== decodedContent ? "Modified decoded text content: ".concat(modifiedContent) : 'Decoded text content was not modified';
                logMessage(source, message);
              }
              var encodedContent = btoa(modifiedContent);
              return encodedContent;
            } catch (e) {
              return content;
            }
          default:
            return content.replace(pattern, textReplacement);
        }
      };
      var logOriginalContent = !textToReplace || !!logContent;
      var logModifiedContent = !!logContent;
      var logDecodedContent = !!decodeMethod && !!logContent;
      var isMatchingSuspended = false;
      var objectWrapper = function objectWrapper(target, thisArg, argumentsList) {
        if (isMatchingSuspended) {
          return Reflect.apply(target, thisArg, argumentsList);
        }
        isMatchingSuspended = true;
        hit(source);
        var result = Reflect.apply(target, thisArg, argumentsList);
        if (stack && !matchStackTrace(stack, new Error().stack || '')) {
          return result;
        }
        if (typeof result === 'string') {
          if (logOriginalContent) {
            logMessage(source, "Original text content: ".concat(result));
          }
          var patternRegexp = toRegExp(textToReplace);
          var modifiedContent = textToReplace || logDecodedContent ? decodeAndReplaceContent(result, patternRegexp, replacement, decodeMethod, logContent) : result;
          if (logModifiedContent) {
            var message = modifiedContent !== result ? "Modified text content: ".concat(modifiedContent) : 'Text content was not modified';
            logMessage(source, message);
          }
          isMatchingSuspended = false;
          return modifiedContent;
        }
        isMatchingSuspended = false;
        logMessage(source, 'Content is not a string');
        return result;
      };
      var objectHandler = {
        apply: objectWrapper
      };
      base[prop] = new Proxy(nativeMethod, objectHandler);
    }
    trustedReplaceOutboundText$1.names = ['trusted-replace-outbound-text'
    ];
    trustedReplaceOutboundText$1.injections = [hit, matchStackTrace, getPropertyInChain, getWildcardPropertyInChain, logMessage,
    shouldAbortInlineOrInjectedScript, getNativeRegexpTest, toRegExp, isEmptyObject, backupRegExpValues, restoreRegExpValues];
    function AmazonApstag$1(source) {
      var apstagWrapper = {
        fetchBids(a, b) {
          if (typeof b === 'function') {
            b([]);
          }
        },
        init: noopFunc,
        setDisplayBids: noopFunc,
        targetingKeys: noopFunc
      };
      window.apstag = apstagWrapper;
      hit(source);
    }
    AmazonApstag$1.names = ['amazon-apstag', 'ubo-amazon_apstag.js', 'amazon_apstag.js'];
    AmazonApstag$1.injections = [hit, noopFunc];
    function DidomiLoader$1(source) {
      function UserConsentStatusForVendorSubscribe() {}
      UserConsentStatusForVendorSubscribe.prototype.filter = function () {
        return new UserConsentStatusForVendorSubscribe();
      };
      UserConsentStatusForVendorSubscribe.prototype.subscribe = noopFunc;
      function UserConsentStatusForVendor() {}
      UserConsentStatusForVendor.prototype.first = function () {
        return new UserConsentStatusForVendorSubscribe();
      };
      UserConsentStatusForVendor.prototype.filter = function () {
        return new UserConsentStatusForVendorSubscribe();
      };
      UserConsentStatusForVendor.prototype.subscribe = noopFunc;
      var DidomiWrapper = {
        isConsentRequired: falseFunc,
        getUserConsentStatusForPurpose: trueFunc,
        getUserConsentStatus: trueFunc,
        getUserStatus: noopFunc,
        getRequiredPurposes: noopArray,
        getUserConsentStatusForVendor: trueFunc,
        Purposes: {
          Cookies: 'cookies'
        },
        notice: {
          configure: noopFunc,
          hide: noopFunc,
          isVisible: falseFunc,
          show: noopFunc,
          showDataProcessing: trueFunc
        },
        isUserConsentStatusPartial: falseFunc,
        on() {
          return {
            actions: {},
            emitter: {},
            services: {},
            store: {}
          };
        },
        shouldConsentBeCollected: falseFunc,
        getUserConsentStatusForAll: noopFunc,
        getObservableOnUserConsentStatusForVendor() {
          return new UserConsentStatusForVendor();
        }
      };
      window.Didomi = DidomiWrapper;
      var didomiStateWrapper = {
        didomiExperimentId: '',
        didomiExperimentUserGroup: '',
        didomiGDPRApplies: 1,
        didomiIABConsent: '',
        didomiPurposesConsent: '',
        didomiPurposesConsentDenied: '',
        didomiPurposesConsentUnknown: '',
        didomiVendorsConsent: '',
        didomiVendorsConsentDenied: '',
        didomiVendorsConsentUnknown: '',
        didomiVendorsRawConsent: '',
        didomiVendorsRawConsentDenied: '',
        didomiVendorsRawConsentUnknown: ''
      };
      window.didomiState = didomiStateWrapper;
      var tcData = {
        eventStatus: 'tcloaded',
        gdprApplies: false,
        listenerId: noopFunc,
        vendor: {
          consents: []
        },
        purpose: {
          consents: []
        }
      };
      var __tcfapiWrapper = function __tcfapiWrapper(command, version, callback) {
        if (typeof callback !== 'function' || command === 'removeEventListener') {
          return;
        }
        callback(tcData, true);
      };
      window.__tcfapi = __tcfapiWrapper;
      var didomiEventListenersWrapper = {
        stub: true,
        push: noopFunc
      };
      window.didomiEventListeners = didomiEventListenersWrapper;
      var didomiOnReadyWrapper = {
        stub: true,
        push(arg) {
          if (typeof arg !== 'function') {
            return;
          }
          if (document.readyState !== 'complete') {
            window.addEventListener('load', function () {
              setTimeout(arg(window.Didomi));
            });
          } else {
            setTimeout(arg(window.Didomi));
          }
        }
      };
      window.didomiOnReady = window.didomiOnReady || didomiOnReadyWrapper;
      if (Array.isArray(window.didomiOnReady)) {
        window.didomiOnReady.forEach(function (arg) {
          if (typeof arg === 'function') {
            try {
              setTimeout(arg(window.Didomi));
            } catch (e) {
            }
          }
        });
      }
      hit(source);
    }
    DidomiLoader$1.names = ['didomi-loader'];
    DidomiLoader$1.injections = [hit, noopFunc, noopArray, trueFunc, falseFunc];
    function Fingerprintjs2$1(source) {
      var browserId = '';
      for (var i = 0; i < 8; i += 1) {
        browserId += (Math.random() * 0x10000 + 0x1000).toString(16).slice(-4);
      }
      var Fingerprint2 = function Fingerprint2() {};
      Fingerprint2.get = function (options, callback) {
        if (!callback) {
          callback = options;
        }
        setTimeout(function () {
          if (callback) {
            callback(browserId, []);
          }
        }, 1);
      };
      Fingerprint2.prototype = {
        get: Fingerprint2.get
      };
      window.Fingerprint2 = Fingerprint2;
      hit(source);
    }
    Fingerprintjs2$1.names = ['fingerprintjs2',
    'ubo-fingerprint2.js',
    'fingerprint2.js'];
    Fingerprintjs2$1.injections = [hit];
    function Fingerprintjs3$1(source) {
      var visitorId = function () {
        var id = '';
        for (var i = 0; i < 8; i += 1) {
          id += (Math.random() * 0x10000 + 0x1000).toString(16).slice(-4);
        }
        return id;
      }();
      var FingerprintJS = function FingerprintJS() {};
      FingerprintJS.prototype = {
        load() {
          return Promise.resolve(new FingerprintJS());
        },
        get() {
          return Promise.resolve({
            visitorId
          });
        },
        hashComponents: noopStr
      };
      window.FingerprintJS = new FingerprintJS();
      hit(source);
    }
    Fingerprintjs3$1.names = ['fingerprintjs3',
    'ubo-fingerprint3.js',
    'fingerprint3.js'];
    Fingerprintjs3$1.injections = [hit, noopStr];
    function Gemius$1(source) {
      var GemiusPlayer = function GemiusPlayer() {};
      GemiusPlayer.prototype = {
        setVideoObject: noopFunc,
        newProgram: noopFunc,
        programEvent: noopFunc,
        newAd: noopFunc,
        adEvent: noopFunc
      };
      window.GemiusPlayer = GemiusPlayer;
      hit(source);
    }
    Gemius$1.names = ['gemius'];
    Gemius$1.injections = [hit, noopFunc];
    function GoogleAnalytics$1(source) {
      var _window$googleAnalyti;
      var Tracker = function Tracker() {};
      var proto = Tracker.prototype;
      proto.get = noopFunc;
      proto.set = noopFunc;
      proto.send = noopFunc;
      var googleAnalyticsName = window.GoogleAnalyticsObject || 'ga';
      var queue = (_window$googleAnalyti = window[googleAnalyticsName]) === null || _window$googleAnalyti === void 0 ? void 0 : _window$googleAnalyti.q;
      function ga(a) {
        var len = arguments.length;
        if (len === 0) {
          return;
        }
        var lastArg = arguments[len - 1];
        var replacer;
        if (lastArg instanceof Object && lastArg !== null && typeof lastArg.hitCallback === 'function') {
          replacer = lastArg.hitCallback;
        } else if (typeof lastArg === 'function') {
          replacer = function replacer() {
            lastArg(ga.create());
          };
        }
        try {
          setTimeout(replacer, 1);
        } catch (ex) {}
      }
      ga.create = function () {
        return new Tracker();
      };
      ga.getByName = function () {
        return new Tracker();
      };
      ga.getAll = function () {
        return [new Tracker()];
      };
      ga.remove = noopFunc;
      ga.loaded = true;
      window[googleAnalyticsName] = ga;
      if (Array.isArray(queue)) {
        var push = function push(arg) {
          ga(...arg);
        };
        queue.push = push;
        queue.forEach(push);
      }
      var _window = window,
        dataLayer = _window.dataLayer,
        google_optimize = _window.google_optimize;
      if (dataLayer instanceof Object === false) {
        return;
      }
      if (dataLayer.hide instanceof Object && typeof dataLayer.hide.end === 'function') {
        dataLayer.hide.end();
      }
      var handleCallback = function handleCallback(dataObj, funcName) {
        if (dataObj && typeof dataObj[funcName] === 'function') {
          setTimeout(dataObj[funcName]);
        }
      };
      if (typeof dataLayer.push === 'function') {
        dataLayer.push = function (data) {
          if (data instanceof Object) {
            handleCallback(data, 'eventCallback');
            for (var key in data) {
              handleCallback(data[key], 'event_callback');
            }
            if (!data.hasOwnProperty('eventCallback') && !data.hasOwnProperty('eventCallback')) {
              [].push.call(window.dataLayer, data);
            }
          }
          if (Array.isArray(data)) {
            data.forEach(function (arg) {
              handleCallback(arg, 'callback');
            });
          }
          return noopFunc;
        };
      }
      if (google_optimize instanceof Object && typeof google_optimize.get === 'function') {
        var googleOptimizeWrapper = {
          get: noopFunc
        };
        window.google_optimize = googleOptimizeWrapper;
      }
      hit(source);
    }
    GoogleAnalytics$1.names = ['google-analytics', 'ubo-google-analytics_analytics.js', 'google-analytics_analytics.js',
    'googletagmanager-gtm', 'ubo-googletagmanager_gtm.js', 'googletagmanager_gtm.js'];
    GoogleAnalytics$1.injections = [hit, noopFunc, noopNull, noopArray];
    function GoogleAnalyticsGa$1(source) {
      function Gaq() {}
      Gaq.prototype.Na = noopFunc;
      Gaq.prototype.O = noopFunc;
      Gaq.prototype.Sa = noopFunc;
      Gaq.prototype.Ta = noopFunc;
      Gaq.prototype.Va = noopFunc;
      Gaq.prototype._createAsyncTracker = noopFunc;
      Gaq.prototype._getAsyncTracker = noopFunc;
      Gaq.prototype._getPlugin = noopFunc;
      Gaq.prototype.push = function (data) {
        if (typeof data === 'function') {
          data();
          return;
        }
        if (Array.isArray(data) === false) {
          return;
        }
        if (typeof data[0] === 'string' && /(^|\.)_link$/.test(data[0]) && typeof data[1] === 'string') {
          window.location.assign(data[1]);
        }
        if (data[0] === '_set' && data[1] === 'hitCallback' && typeof data[2] === 'function') {
          data[2]();
        }
      };
      var gaq = new Gaq();
      var asyncTrackers = window._gaq || [];
      if (Array.isArray(asyncTrackers)) {
        while (asyncTrackers[0]) {
          gaq.push(asyncTrackers.shift());
        }
      }
      window._gaq = gaq.qf = gaq;
      function Gat() {}
      var api = ['_addIgnoredOrganic', '_addIgnoredRef', '_addItem', '_addOrganic', '_addTrans', '_clearIgnoredOrganic', '_clearIgnoredRef', '_clearOrganic', '_cookiePathCopy', '_deleteCustomVar', '_getName', '_setAccount', '_getAccount', '_getClientInfo', '_getDetectFlash', '_getDetectTitle', '_getLinkerUrl', '_getLocalGifPath', '_getServiceMode', '_getVersion', '_getVisitorCustomVar', '_initData', '_link', '_linkByPost', '_setAllowAnchor', '_setAllowHash', '_setAllowLinker', '_setCampContentKey', '_setCampMediumKey', '_setCampNameKey', '_setCampNOKey', '_setCampSourceKey', '_setCampTermKey', '_setCampaignCookieTimeout', '_setCampaignTrack', '_setClientInfo', '_setCookiePath', '_setCookiePersistence', '_setCookieTimeout', '_setCustomVar', '_setDetectFlash', '_setDetectTitle', '_setDomainName', '_setLocalGifPath', '_setLocalRemoteServerMode', '_setLocalServerMode', '_setReferrerOverride', '_setRemoteServerMode', '_setSampleRate', '_setSessionTimeout', '_setSiteSpeedSampleRate', '_setSessionCookieTimeout', '_setVar', '_setVisitorCookieTimeout', '_trackEvent', '_trackPageLoadTime', '_trackPageview', '_trackSocial', '_trackTiming', '_trackTrans', '_visitCode'];
      var tracker = api.reduce(function (res, funcName) {
        res[funcName] = noopFunc;
        return res;
      }, {});
      tracker._getLinkerUrl = function (a) {
        return a;
      };
      tracker._link = function (url) {
        if (typeof url !== 'string') {
          return;
        }
        try {
          window.location.assign(url);
        } catch (e) {
          logMessage(source, e);
        }
      };
      Gat.prototype._anonymizeIP = noopFunc;
      Gat.prototype._createTracker = noopFunc;
      Gat.prototype._forceSSL = noopFunc;
      Gat.prototype._getPlugin = noopFunc;
      Gat.prototype._getTracker = function () {
        return tracker;
      };
      Gat.prototype._getTrackerByName = function () {
        return tracker;
      };
      Gat.prototype._getTrackers = noopFunc;
      Gat.prototype.aa = noopFunc;
      Gat.prototype.ab = noopFunc;
      Gat.prototype.hb = noopFunc;
      Gat.prototype.la = noopFunc;
      Gat.prototype.oa = noopFunc;
      Gat.prototype.pa = noopFunc;
      Gat.prototype.u = noopFunc;
      var gat = new Gat();
      window._gat = gat;
      hit(source);
    }
    GoogleAnalyticsGa$1.names = ['google-analytics-ga', 'ubo-google-analytics_ga.js', 'google-analytics_ga.js'];
    GoogleAnalyticsGa$1.injections = [hit, noopFunc, logMessage];
    function GoogleIma3$1(source) {
      var _window$google$ima;
      var VERSION = '3.453.0';
      var ima = {};
      var AdDisplayContainer = function AdDisplayContainer(containerElement) {
        var divElement = document.createElement('div');
        divElement.style.setProperty('display', 'none', 'important');
        divElement.style.setProperty('visibility', 'collapse', 'important');
        if (containerElement) {
          containerElement.appendChild(divElement);
        }
      };
      AdDisplayContainer.prototype.destroy = noopFunc;
      AdDisplayContainer.prototype.initialize = noopFunc;
      var ImaSdkSettings = function ImaSdkSettings() {};
      ImaSdkSettings.CompanionBackfillMode = {
        ALWAYS: 'always',
        ON_MASTER_AD: 'on_master_ad'
      };
      ImaSdkSettings.VpaidMode = {
        DISABLED: 0,
        ENABLED: 1,
        INSECURE: 2
      };
      ImaSdkSettings.prototype = {
        c: true,
        f: {},
        i: false,
        l: '',
        p: '',
        r: 0,
        t: '',
        v: '',
        getCompanionBackfill: noopFunc,
        getDisableCustomPlaybackForIOS10Plus() {
          return this.i;
        },
        getDisabledFlashAds: function getDisabledFlashAds() {
          return true;
        },
        getFeatureFlags() {
          return this.f;
        },
        getLocale() {
          return this.l;
        },
        getNumRedirects() {
          return this.r;
        },
        getPlayerType() {
          return this.t;
        },
        getPlayerVersion() {
          return this.v;
        },
        getPpid() {
          return this.p;
        },
        getVpaidMode() {
          return this.C;
        },
        isCookiesEnabled() {
          return this.c;
        },
        isVpaidAdapter() {
          return this.M;
        },
        setCompanionBackfill: noopFunc,
        setAutoPlayAdBreaks(a) {
          this.K = a;
        },
        setCookiesEnabled(c) {
          this.c = !!c;
        },
        setDisableCustomPlaybackForIOS10Plus(i) {
          this.i = !!i;
        },
        setDisableFlashAds: noopFunc,
        setFeatureFlags(f) {
          this.f = !!f;
        },
        setIsVpaidAdapter(a) {
          this.M = a;
        },
        setLocale(l) {
          this.l = !!l;
        },
        setNumRedirects(r) {
          this.r = !!r;
        },
        setPageCorrelator(a) {
          this.R = a;
        },
        setPlayerType(t) {
          this.t = !!t;
        },
        setPlayerVersion(v) {
          this.v = !!v;
        },
        setPpid(p) {
          this.p = !!p;
        },
        setVpaidMode(a) {
          this.C = a;
        },
        setSessionId: noopFunc,
        setStreamCorrelator: noopFunc,
        setVpaidAllowed: noopFunc,
        CompanionBackfillMode: {
          ALWAYS: 'always',
          ON_MASTER_AD: 'on_master_ad'
        },
        VpaidMode: {
          DISABLED: 0,
          ENABLED: 1,
          INSECURE: 2
        }
      };
      var EventHandler = function EventHandler() {
        this.listeners = new Map();
        this._dispatch = function (e) {
          var listeners = this.listeners.get(e.type);
          listeners = listeners ? listeners.values() : [];
          for (var _i = 0, _Array$from = Array.from(listeners); _i < _Array$from.length; _i++) {
            var listener = _Array$from[_i];
            try {
              listener(e);
            } catch (r) {
              logMessage(source, r);
            }
          }
        };
        this.addEventListener = function (types, callback, options, context) {
          if (!Array.isArray(types)) {
            types = [types];
          }
          for (var i = 0; i < types.length; i += 1) {
            var type = types[i];
            if (!this.listeners.has(type)) {
              this.listeners.set(type, new Map());
            }
            this.listeners.get(type).set(callback, callback.bind(context || this));
          }
        };
        this.removeEventListener = function (types, callback) {
          if (!Array.isArray(types)) {
            types = [types];
          }
          for (var i = 0; i < types.length; i += 1) {
            var _this$listeners$get;
            var type = types[i];
            (_this$listeners$get = this.listeners.get(type)) === null || _this$listeners$get === void 0 ? void 0 : _this$listeners$get.delete(callback);
          }
        };
      };
      var AdsManager = new EventHandler();
      AdsManager.volume = 1;
      AdsManager.collapse = noopFunc;
      AdsManager.configureAdsManager = noopFunc;
      AdsManager.destroy = noopFunc;
      AdsManager.discardAdBreak = noopFunc;
      AdsManager.expand = noopFunc;
      AdsManager.focus = noopFunc;
      AdsManager.getAdSkippableState = function () {
        return false;
      };
      AdsManager.getCuePoints = function () {
        return [0];
      };
      AdsManager.getCurrentAd = function () {
        return currentAd;
      };
      AdsManager.getCurrentAdCuePoints = function () {
        return [];
      };
      AdsManager.getRemainingTime = function () {
        return 0;
      };
      AdsManager.getVolume = function () {
        return this.volume;
      };
      AdsManager.init = noopFunc;
      AdsManager.isCustomClickTrackingUsed = function () {
        return false;
      };
      AdsManager.isCustomPlaybackUsed = function () {
        return false;
      };
      AdsManager.pause = noopFunc;
      AdsManager.requestNextAdBreak = noopFunc;
      AdsManager.resize = noopFunc;
      AdsManager.resume = noopFunc;
      AdsManager.setVolume = function (v) {
        this.volume = v;
      };
      AdsManager.skip = noopFunc;
      AdsManager.start = function () {
        for (var _i2 = 0, _arr = [AdEvent.Type.ALL_ADS_COMPLETED, AdEvent.Type.CONTENT_RESUME_REQUESTED]; _i2 < _arr.length; _i2++) {
          var type = _arr[_i2];
          try {
            this._dispatch(new ima.AdEvent(type));
          } catch (e) {
            logMessage(source, e);
          }
        }
      };
      AdsManager.stop = noopFunc;
      AdsManager.updateAdsRenderingSettings = noopFunc;
      var manager = Object.create(AdsManager);
      var AdsManagerLoadedEvent = function AdsManagerLoadedEvent(type, adsRequest, userRequestContext) {
        this.type = type;
        this.adsRequest = adsRequest;
        this.userRequestContext = userRequestContext;
      };
      AdsManagerLoadedEvent.prototype = {
        getAdsManager: function getAdsManager() {
          return manager;
        },
        getUserRequestContext() {
          if (this.userRequestContext) {
            return this.userRequestContext;
          }
          return {};
        }
      };
      AdsManagerLoadedEvent.Type = {
        ADS_MANAGER_LOADED: 'adsManagerLoaded'
      };
      var AdsLoader = EventHandler;
      AdsLoader.prototype.settings = new ImaSdkSettings();
      AdsLoader.prototype.contentComplete = noopFunc;
      AdsLoader.prototype.destroy = noopFunc;
      AdsLoader.prototype.getSettings = function () {
        return this.settings;
      };
      AdsLoader.prototype.getVersion = function () {
        return VERSION;
      };
      AdsLoader.prototype.requestAds = function (adsRequest, userRequestContext) {
        var _this = this;
        requestAnimationFrame(function () {
          var ADS_MANAGER_LOADED = AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED;
          var event = new ima.AdsManagerLoadedEvent(ADS_MANAGER_LOADED, adsRequest, userRequestContext);
          _this._dispatch(event);
        });
        var e = new ima.AdError('adPlayError', 1205, 1205, 'The browser prevented playback initiated without user interaction.', adsRequest, userRequestContext);
        requestAnimationFrame(function () {
          _this._dispatch(new ima.AdErrorEvent(e));
        });
      };
      var AdsRenderingSettings = noopFunc;
      var AdsRequest = function AdsRequest() {};
      AdsRequest.prototype = {
        setAdWillAutoPlay: noopFunc,
        setAdWillPlayMuted: noopFunc,
        setContinuousPlayback: noopFunc
      };
      var AdPodInfo = function AdPodInfo() {};
      AdPodInfo.prototype = {
        getAdPosition: function getAdPosition() {
          return 1;
        },
        getIsBumper: function getIsBumper() {
          return false;
        },
        getMaxDuration: function getMaxDuration() {
          return -1;
        },
        getPodIndex: function getPodIndex() {
          return 1;
        },
        getTimeOffset: function getTimeOffset() {
          return 0;
        },
        getTotalAds: function getTotalAds() {
          return 1;
        }
      };
      var UniversalAdIdInfo = function UniversalAdIdInfo() {};
      UniversalAdIdInfo.prototype.getAdIdRegistry = function () {
        return '';
      };
      UniversalAdIdInfo.prototype.getAdIsValue = function () {
        return '';
      };
      var Ad = function Ad() {};
      Ad.prototype = {
        pi: new AdPodInfo(),
        getAdId: function getAdId() {
          return '';
        },
        getAdPodInfo() {
          return this.pi;
        },
        getAdSystem: function getAdSystem() {
          return '';
        },
        getAdvertiserName: function getAdvertiserName() {
          return '';
        },
        getApiFramework: function getApiFramework() {
          return null;
        },
        getCompanionAds: function getCompanionAds() {
          return [];
        },
        getContentType: function getContentType() {
          return '';
        },
        getCreativeAdId: function getCreativeAdId() {
          return '';
        },
        getDealId: function getDealId() {
          return '';
        },
        getDescription: function getDescription() {
          return '';
        },
        getDuration: function getDuration() {
          return 8.5;
        },
        getHeight: function getHeight() {
          return 0;
        },
        getMediaUrl: function getMediaUrl() {
          return null;
        },
        getMinSuggestedDuration: function getMinSuggestedDuration() {
          return -2;
        },
        getSkipTimeOffset: function getSkipTimeOffset() {
          return -1;
        },
        getSurveyUrl: function getSurveyUrl() {
          return null;
        },
        getTitle: function getTitle() {
          return '';
        },
        getTraffickingParametersString: function getTraffickingParametersString() {
          return '';
        },
        getUiElements: function getUiElements() {
          return [''];
        },
        getUniversalAdIdRegistry: function getUniversalAdIdRegistry() {
          return 'unknown';
        },
        getUniversalAdIds: function getUniversalAdIds() {
          return [new UniversalAdIdInfo()];
        },
        getUniversalAdIdValue: function getUniversalAdIdValue() {
          return 'unknown';
        },
        getVastMediaBitrate: function getVastMediaBitrate() {
          return 0;
        },
        getVastMediaHeight: function getVastMediaHeight() {
          return 0;
        },
        getVastMediaWidth: function getVastMediaWidth() {
          return 0;
        },
        getWidth: function getWidth() {
          return 0;
        },
        getWrapperAdIds: function getWrapperAdIds() {
          return [''];
        },
        getWrapperAdSystems: function getWrapperAdSystems() {
          return [''];
        },
        getWrapperCreativeIds: function getWrapperCreativeIds() {
          return [''];
        },
        isLinear: function isLinear() {
          return true;
        },
        isSkippable() {
          return true;
        }
      };
      var CompanionAd = function CompanionAd() {};
      CompanionAd.prototype = {
        getAdSlotId: function getAdSlotId() {
          return '';
        },
        getContent: function getContent() {
          return '';
        },
        getContentType: function getContentType() {
          return '';
        },
        getHeight: function getHeight() {
          return 1;
        },
        getWidth: function getWidth() {
          return 1;
        }
      };
      var AdError = function AdError(type, code, vast, message, adsRequest, userRequestContext) {
        this.errorCode = code;
        this.message = message;
        this.type = type;
        this.adsRequest = adsRequest;
        this.userRequestContext = userRequestContext;
        this.getErrorCode = function () {
          return this.errorCode;
        };
        this.getInnerError = function () {
          return null;
        };
        this.getMessage = function () {
          return this.message;
        };
        this.getType = function () {
          return this.type;
        };
        this.getVastErrorCode = function () {
          return this.vastErrorCode;
        };
        this.toString = function () {
          return "AdError ".concat(this.errorCode, ": ").concat(this.message);
        };
      };
      AdError.ErrorCode = {};
      AdError.Type = {};
      var isEngadget = function isEngadget() {
        try {
          for (var _i3 = 0, _Object$values = Object.values(window.vidible._getContexts()); _i3 < _Object$values.length; _i3++) {
            var _ctx$getPlayer, _ctx$getPlayer$div;
            var ctx = _Object$values[_i3];
            if ((_ctx$getPlayer = ctx.getPlayer()) !== null && _ctx$getPlayer !== void 0 && (_ctx$getPlayer$div = _ctx$getPlayer.div) !== null && _ctx$getPlayer$div !== void 0 && _ctx$getPlayer$div.innerHTML.includes('www.engadget.com')) {
              return true;
            }
          }
        } catch (e) {}
        return false;
      };
      var currentAd = isEngadget() ? undefined : new Ad();
      var AdEvent = function AdEvent(type) {
        this.type = type;
      };
      AdEvent.prototype = {
        getAd: function getAd() {
          return currentAd;
        },
        getAdData: function getAdData() {}
      };
      AdEvent.Type = {
        AD_BREAK_READY: 'adBreakReady',
        AD_BUFFERING: 'adBuffering',
        AD_CAN_PLAY: 'adCanPlay',
        AD_METADATA: 'adMetadata',
        AD_PROGRESS: 'adProgress',
        ALL_ADS_COMPLETED: 'allAdsCompleted',
        CLICK: 'click',
        COMPLETE: 'complete',
        CONTENT_PAUSE_REQUESTED: 'contentPauseRequested',
        CONTENT_RESUME_REQUESTED: 'contentResumeRequested',
        DURATION_CHANGE: 'durationChange',
        EXPANDED_CHANGED: 'expandedChanged',
        FIRST_QUARTILE: 'firstQuartile',
        IMPRESSION: 'impression',
        INTERACTION: 'interaction',
        LINEAR_CHANGE: 'linearChange',
        LINEAR_CHANGED: 'linearChanged',
        LOADED: 'loaded',
        LOG: 'log',
        MIDPOINT: 'midpoint',
        PAUSED: 'pause',
        RESUMED: 'resume',
        SKIPPABLE_STATE_CHANGED: 'skippableStateChanged',
        SKIPPED: 'skip',
        STARTED: 'start',
        THIRD_QUARTILE: 'thirdQuartile',
        USER_CLOSE: 'userClose',
        VIDEO_CLICKED: 'videoClicked',
        VIDEO_ICON_CLICKED: 'videoIconClicked',
        VIEWABLE_IMPRESSION: 'viewable_impression',
        VOLUME_CHANGED: 'volumeChange',
        VOLUME_MUTED: 'mute'
      };
      var AdErrorEvent = function AdErrorEvent(error) {
        this.error = error;
        this.type = 'adError';
        this.getError = function () {
          return this.error;
        };
        this.getUserRequestContext = function () {
          var _this$error;
          if ((_this$error = this.error) !== null && _this$error !== void 0 && _this$error.userRequestContext) {
            return this.error.userRequestContext;
          }
          return {};
        };
      };
      AdErrorEvent.Type = {
        AD_ERROR: 'adError'
      };
      var CustomContentLoadedEvent = function CustomContentLoadedEvent() {};
      CustomContentLoadedEvent.Type = {
        CUSTOM_CONTENT_LOADED: 'deprecated-event'
      };
      var CompanionAdSelectionSettings = function CompanionAdSelectionSettings() {};
      CompanionAdSelectionSettings.CreativeType = {
        ALL: 'All',
        FLASH: 'Flash',
        IMAGE: 'Image'
      };
      CompanionAdSelectionSettings.ResourceType = {
        ALL: 'All',
        HTML: 'Html',
        IFRAME: 'IFrame',
        STATIC: 'Static'
      };
      CompanionAdSelectionSettings.SizeCriteria = {
        IGNORE: 'IgnoreSize',
        SELECT_EXACT_MATCH: 'SelectExactMatch',
        SELECT_NEAR_MATCH: 'SelectNearMatch'
      };
      var AdCuePoints = function AdCuePoints() {};
      AdCuePoints.prototype = {
        getCuePoints: function getCuePoints() {
          return [];
        },
        getAdIdRegistry: function getAdIdRegistry() {
          return '';
        },
        getAdIdValue: function getAdIdValue() {
          return '';
        }
      };
      var AdProgressData = noopFunc;
      Object.assign(ima, {
        AdCuePoints,
        AdDisplayContainer,
        AdError,
        AdErrorEvent,
        AdEvent,
        AdPodInfo,
        AdProgressData,
        AdsLoader,
        AdsManager: manager,
        AdsManagerLoadedEvent,
        AdsRenderingSettings,
        AdsRequest,
        CompanionAd,
        CompanionAdSelectionSettings,
        CustomContentLoadedEvent,
        gptProxyInstance: {},
        ImaSdkSettings,
        OmidAccessMode: {
          DOMAIN: 'domain',
          FULL: 'full',
          LIMITED: 'limited'
        },
        OmidVerificationVendor: {
          1: 'OTHER',
          2: 'MOAT',
          3: 'DOUBLEVERIFY',
          4: 'INTEGRAL_AD_SCIENCE',
          5: 'PIXELATE',
          6: 'NIELSEN',
          7: 'COMSCORE',
          8: 'MEETRICS',
          9: 'GOOGLE',
          OTHER: 1,
          MOAT: 2,
          DOUBLEVERIFY: 3,
          INTEGRAL_AD_SCIENCE: 4,
          PIXELATE: 5,
          NIELSEN: 6,
          COMSCORE: 7,
          MEETRICS: 8,
          GOOGLE: 9
        },
        settings: new ImaSdkSettings(),
        UiElements: {
          AD_ATTRIBUTION: 'adAttribution',
          COUNTDOWN: 'countdown'
        },
        UniversalAdIdInfo,
        VERSION,
        ViewMode: {
          FULLSCREEN: 'fullscreen',
          NORMAL: 'normal'
        }
      });
      if (!window.google) {
        window.google = {};
      }
      if ((_window$google$ima = window.google.ima) !== null && _window$google$ima !== void 0 && _window$google$ima.dai) {
        ima.dai = window.google.ima.dai;
      }
      window.google.ima = ima;
      hit(source);
    }
    GoogleIma3$1.names = ['google-ima3',
    'ubo-google-ima.js',
    'google-ima.js'];
    GoogleIma3$1.injections = [hit, noopFunc, logMessage];
    function GoogleSyndicationAdsByGoogle$1(source) {
      window.adsbygoogle = {
        loaded: true,
        push(arg) {
          if (typeof this.length === 'undefined') {
            this.length = 0;
            this.length += 1;
          }
          if (arg !== null && arg instanceof Object && arg.constructor.name === 'Object') {
            for (var _i = 0, _Object$keys = Object.keys(arg); _i < _Object$keys.length; _i++) {
              var key = _Object$keys[_i];
              if (typeof arg[key] === 'function') {
                try {
                  arg[key].call(this, {});
                } catch (_unused) {
                }
              }
            }
          }
        }
      };
      var adElems = document.querySelectorAll('.adsbygoogle');
      var css = 'height:1px!important;max-height:1px!important;max-width:1px!important;width:1px!important;';
      var statusAttrName = 'data-adsbygoogle-status';
      var ASWIFT_IFRAME_MARKER = 'aswift_';
      var GOOGLE_ADS_IFRAME_MARKER = 'google_ads_iframe_';
      var executed = false;
      for (var i = 0; i < adElems.length; i += 1) {
        var adElemChildNodes = adElems[i].childNodes;
        var childNodesQuantity = adElemChildNodes.length;
        var areIframesDefined = false;
        if (childNodesQuantity > 0) {
          areIframesDefined = childNodesQuantity === 2
          && adElemChildNodes[0].nodeName.toLowerCase() === 'iframe' && adElemChildNodes[0].id.includes(ASWIFT_IFRAME_MARKER)
          && adElemChildNodes[1].nodeName.toLowerCase() === 'iframe' && adElemChildNodes[1].id.includes(GOOGLE_ADS_IFRAME_MARKER);
        }
        if (!areIframesDefined) {
          adElems[i].setAttribute(statusAttrName, 'done');
          var aswiftIframe = document.createElement('iframe');
          aswiftIframe.id = "".concat(ASWIFT_IFRAME_MARKER).concat(i);
          aswiftIframe.style = css;
          adElems[i].appendChild(aswiftIframe);
          var innerAswiftIframe = document.createElement('iframe');
          aswiftIframe.contentWindow.document.body.appendChild(innerAswiftIframe);
          var googleadsIframe = document.createElement('iframe');
          googleadsIframe.id = "".concat(GOOGLE_ADS_IFRAME_MARKER).concat(i);
          googleadsIframe.style = css;
          adElems[i].appendChild(googleadsIframe);
          var innerGoogleadsIframe = document.createElement('iframe');
          googleadsIframe.contentWindow.document.body.appendChild(innerGoogleadsIframe);
          executed = true;
        }
      }
      if (executed) {
        hit(source);
      }
    }
    GoogleSyndicationAdsByGoogle$1.names = ['googlesyndication-adsbygoogle', 'ubo-googlesyndication_adsbygoogle.js', 'googlesyndication_adsbygoogle.js'];
    GoogleSyndicationAdsByGoogle$1.injections = [hit];
    function GoogleTagServicesGpt$1(source) {
      var slots = new Map();
      var slotsById = new Map();
      var slotsPerPath = new Map();
      var slotCreatives = new Map();
      var eventCallbacks = new Map();
      var gTargeting = new Map();
      var addEventListener = function addEventListener(name, listener) {
        if (!eventCallbacks.has(name)) {
          eventCallbacks.set(name, new Set());
        }
        eventCallbacks.get(name).add(listener);
        return this;
      };
      var removeEventListener = function removeEventListener(name, listener) {
        if (eventCallbacks.has(name)) {
          return eventCallbacks.get(name).delete(listener);
        }
        return false;
      };
      var fireSlotEvent = function fireSlotEvent(name, slot) {
        return new Promise(function (resolve) {
          requestAnimationFrame(function () {
            var size = [0, 0];
            var callbacksSet = eventCallbacks.get(name) || [];
            var callbackArray = Array.from(callbacksSet);
            for (var i = 0; i < callbackArray.length; i += 1) {
              callbackArray[i]({
                isEmpty: true,
                size,
                slot
              });
            }
            resolve();
          });
        });
      };
      var emptySlotElement = function emptySlotElement(slot) {
        var node = document.getElementById(slot.getSlotElementId());
        while (node !== null && node !== void 0 && node.lastChild) {
          node.lastChild.remove();
        }
      };
      var recreateIframeForSlot = function recreateIframeForSlot(slot) {
        var _document$getElementB;
        var eid = "google_ads_iframe_".concat(slot.getId());
        (_document$getElementB = document.getElementById(eid)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
        var node = document.getElementById(slot.getSlotElementId());
        if (node) {
          var f = document.createElement('iframe');
          f.id = eid;
          f.srcdoc = '<body></body>';
          f.style = 'position:absolute; width:0; height:0; left:0; right:0; z-index:-1; border:0';
          f.setAttribute('width', 0);
          f.setAttribute('height', 0);
          f.setAttribute('data-load-complete', true);
          f.setAttribute('data-google-container-id', true);
          f.setAttribute('sandbox', '');
          node.appendChild(f);
        }
      };
      var displaySlot = function displaySlot(slot) {
        if (!slot) {
          return;
        }
        var id = slot.getSlotElementId();
        if (!document.getElementById(id)) {
          return;
        }
        var parent = document.getElementById(id);
        if (parent) {
          parent.appendChild(document.createElement('div'));
        }
        emptySlotElement(slot);
        recreateIframeForSlot(slot);
        fireSlotEvent('slotRenderEnded', slot);
        fireSlotEvent('slotRequested', slot);
        fireSlotEvent('slotResponseReceived', slot);
        fireSlotEvent('slotOnload', slot);
        fireSlotEvent('impressionViewable', slot);
      };
      var companionAdsService = {
        addEventListener,
        removeEventListener,
        enableSyncLoading: noopFunc,
        setRefreshUnfilledSlots: noopFunc,
        getSlots: noopArray
      };
      var contentService = {
        addEventListener,
        removeEventListener,
        setContent: noopFunc
      };
      function PassbackSlot() {}
      PassbackSlot.prototype.display = noopFunc;
      PassbackSlot.prototype.get = noopNull;
      PassbackSlot.prototype.set = noopThis;
      PassbackSlot.prototype.setClickUrl = noopThis;
      PassbackSlot.prototype.setTagForChildDirectedTreatment = noopThis;
      PassbackSlot.prototype.setTargeting = noopThis;
      PassbackSlot.prototype.updateTargetingFromMap = noopThis;
      function SizeMappingBuilder() {}
      SizeMappingBuilder.prototype.addSize = noopThis;
      SizeMappingBuilder.prototype.build = noopNull;
      var getTargetingValue = function getTargetingValue(v) {
        if (typeof v === 'string') {
          return [v];
        }
        try {
          return Array.prototype.flat.call(v);
        } catch (_unused) {
        }
        return [];
      };
      var updateTargeting = function updateTargeting(targeting, map) {
        if (typeof map === 'object') {
          for (var key in map) {
            if (Object.prototype.hasOwnProperty.call(map, key)) {
              targeting.set(key, getTargetingValue(map[key]));
            }
          }
        }
      };
      var defineSlot = function defineSlot(adUnitPath, creatives, optDiv) {
        if (slotsById.has(optDiv)) {
          var _document$getElementB2;
          (_document$getElementB2 = document.getElementById(optDiv)) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.remove();
          return slotsById.get(optDiv);
        }
        var attributes = new Map();
        var targeting = new Map();
        var exclusions = new Set();
        var response = {
          advertiserId: undefined,
          campaignId: undefined,
          creativeId: undefined,
          creativeTemplateId: undefined,
          lineItemId: undefined
        };
        var sizes = [{
          getHeight: function getHeight() {
            return 2;
          },
          getWidth: function getWidth() {
            return 2;
          }
        }];
        var num = (slotsPerPath.get(adUnitPath) || 0) + 1;
        slotsPerPath.set(adUnitPath, num);
        var id = "".concat(adUnitPath, "_").concat(num);
        var clickUrl = '';
        var collapseEmptyDiv = null;
        var services = new Set();
        var slot = {
          addService(e) {
            services.add(e);
            return slot;
          },
          clearCategoryExclusions: noopThis,
          clearTargeting(k) {
            if (k === undefined) {
              targeting.clear();
            } else {
              targeting.delete(k);
            }
          },
          defineSizeMapping(mapping) {
            slotCreatives.set(optDiv, mapping);
            return this;
          },
          get: function get(k) {
            return attributes.get(k);
          },
          getAdUnitPath: function getAdUnitPath() {
            return adUnitPath;
          },
          getAttributeKeys: function getAttributeKeys() {
            return Array.from(attributes.keys());
          },
          getCategoryExclusions: function getCategoryExclusions() {
            return Array.from(exclusions);
          },
          getClickUrl: function getClickUrl() {
            return clickUrl;
          },
          getCollapseEmptyDiv: function getCollapseEmptyDiv() {
            return collapseEmptyDiv;
          },
          getContentUrl: function getContentUrl() {
            return '';
          },
          getDivStartsCollapsed: function getDivStartsCollapsed() {
            return null;
          },
          getDomId: function getDomId() {
            return optDiv;
          },
          getEscapedQemQueryId: function getEscapedQemQueryId() {
            return '';
          },
          getFirstLook: function getFirstLook() {
            return 0;
          },
          getId: function getId() {
            return id;
          },
          getHtml: function getHtml() {
            return '';
          },
          getName: function getName() {
            return id;
          },
          getOutOfPage: function getOutOfPage() {
            return false;
          },
          getResponseInformation: function getResponseInformation() {
            return response;
          },
          getServices: function getServices() {
            return Array.from(services);
          },
          getSizes: function getSizes() {
            return sizes;
          },
          getSlotElementId: function getSlotElementId() {
            return optDiv;
          },
          getSlotId: function getSlotId() {
            return slot;
          },
          getTargeting: function getTargeting(k) {
            return targeting.get(k) || gTargeting.get(k) || [];
          },
          getTargetingKeys: function getTargetingKeys() {
            return Array.from(new Set(Array.of(...gTargeting.keys(), ...targeting.keys())));
          },
          getTargetingMap: function getTargetingMap() {
            return Object.assign(Object.fromEntries(gTargeting.entries()), Object.fromEntries(targeting.entries()));
          },
          set(k, v) {
            attributes.set(k, v);
            return slot;
          },
          setCategoryExclusion(e) {
            exclusions.add(e);
            return slot;
          },
          setClickUrl(u) {
            clickUrl = u;
            return slot;
          },
          setCollapseEmptyDiv(v) {
            collapseEmptyDiv = !!v;
            return slot;
          },
          setSafeFrameConfig: noopThis,
          setTagForChildDirectedTreatment: noopThis,
          setTargeting(k, v) {
            targeting.set(k, getTargetingValue(v));
            return slot;
          },
          toString: function toString() {
            return id;
          },
          updateTargetingFromMap(map) {
            updateTargeting(targeting, map);
            return slot;
          }
        };
        slots.set(adUnitPath, slot);
        slotsById.set(optDiv, slot);
        slotCreatives.set(optDiv, creatives);
        return slot;
      };
      var pubAdsService = {
        addEventListener,
        removeEventListener,
        clear: noopFunc,
        clearCategoryExclusions: noopThis,
        clearTagForChildDirectedTreatment: noopThis,
        clearTargeting(k) {
          if (k === undefined) {
            gTargeting.clear();
          } else {
            gTargeting.delete(k);
          }
        },
        collapseEmptyDivs: noopFunc,
        defineOutOfPagePassback() {
          return new PassbackSlot();
        },
        definePassback() {
          return new PassbackSlot();
        },
        disableInitialLoad: noopFunc,
        display: noopFunc,
        enableAsyncRendering: noopFunc,
        enableLazyLoad: noopFunc,
        enableSingleRequest: noopFunc,
        enableSyncRendering: noopFunc,
        enableVideoAds: noopFunc,
        get: noopNull,
        getAttributeKeys: noopArray,
        getTargeting: noopArray,
        getTargetingKeys: noopArray,
        getSlots: noopArray,
        isInitialLoadDisabled: trueFunc,
        refresh: noopFunc,
        set: noopThis,
        setCategoryExclusion: noopThis,
        setCentering: noopFunc,
        setCookieOptions: noopThis,
        setForceSafeFrame: noopThis,
        setLocation: noopThis,
        setPrivacySettings: noopThis,
        setPublisherProvidedId: noopThis,
        setRequestNonPersonalizedAds: noopThis,
        setSafeFrameConfig: noopThis,
        setTagForChildDirectedTreatment: noopThis,
        setTargeting: noopThis,
        setVideoContent: noopThis,
        updateCorrelator: noopFunc
      };
      var _window = window,
        _window$googletag = _window.googletag,
        googletag = _window$googletag === void 0 ? {} : _window$googletag;
      var _googletag$cmd = googletag.cmd,
        cmd = _googletag$cmd === void 0 ? [] : _googletag$cmd;
      googletag.apiReady = true;
      googletag.cmd = [];
      googletag.cmd.push = function (a) {
        try {
          a();
        } catch (ex) {}
        return 1;
      };
      googletag.companionAds = function () {
        return companionAdsService;
      };
      googletag.content = function () {
        return contentService;
      };
      googletag.defineOutOfPageSlot = defineSlot;
      googletag.defineSlot = defineSlot;
      googletag.destroySlots = function () {
        slots.clear();
        slotsById.clear();
      };
      googletag.disablePublisherConsole = noopFunc;
      googletag.display = function (arg) {
        var id;
        if (arg !== null && arg !== void 0 && arg.getSlotElementId) {
          id = arg.getSlotElementId();
        } else if (arg !== null && arg !== void 0 && arg.nodeType) {
          id = arg.id;
        } else {
          id = String(arg);
        }
        displaySlot(slotsById.get(id));
      };
      googletag.enableServices = noopFunc;
      googletag.getVersion = noopStr;
      googletag.pubads = function () {
        return pubAdsService;
      };
      googletag.pubadsReady = true;
      googletag.setAdIframeTitle = noopFunc;
      googletag.sizeMapping = function () {
        return new SizeMappingBuilder();
      };
      window.googletag = googletag;
      while (cmd.length !== 0) {
        googletag.cmd.push(cmd.shift());
      }
      hit(source);
    }
    GoogleTagServicesGpt$1.names = ['googletagservices-gpt', 'ubo-googletagservices_gpt.js', 'googletagservices_gpt.js'];
    GoogleTagServicesGpt$1.injections = [hit, noopFunc, noopThis, noopNull, noopArray, noopStr, trueFunc];
    function Matomo$1(source) {
      var Tracker = function Tracker() {};
      Tracker.prototype.setDoNotTrack = noopFunc;
      Tracker.prototype.setDomains = noopFunc;
      Tracker.prototype.setCustomDimension = noopFunc;
      Tracker.prototype.trackPageView = noopFunc;
      var AsyncTracker = function AsyncTracker() {};
      AsyncTracker.prototype.addListener = noopFunc;
      var matomoWrapper = {
        getTracker: Tracker,
        getAsyncTracker: AsyncTracker
      };
      window.Piwik = matomoWrapper;
      hit(source);
    }
    Matomo$1.names = ['matomo'];
    Matomo$1.injections = [hit, noopFunc];
    function metrikaYandexTag$1(source) {
      var asyncCallbackFromOptions = function asyncCallbackFromOptions(id, param) {
        var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
        var callback = options.callback;
        var ctx = options.ctx;
        if (typeof callback === 'function') {
          callback = ctx !== undefined ? callback.bind(ctx) : callback;
          setTimeout(function () {
            return callback();
          });
        }
      };
      var addFileExtension = noopFunc;
      var extLink = asyncCallbackFromOptions;
      var file = asyncCallbackFromOptions;
      var getClientID = function getClientID(id, cb) {
        if (!cb) {
          return;
        }
        setTimeout(cb(null));
      };
      var hitFunc = asyncCallbackFromOptions;
      var notBounce = asyncCallbackFromOptions;
      var params = noopFunc;
      var reachGoal = function reachGoal(id, target, params, callback, ctx) {
        asyncCallbackFromOptions(null, null, {
          callback,
          ctx
        });
      };
      var setUserID = noopFunc;
      var userParams = noopFunc;
      var destruct = noopFunc;
      var api = {
        addFileExtension,
        extLink,
        file,
        getClientID,
        hit: hitFunc,
        notBounce,
        params,
        reachGoal,
        setUserID,
        userParams,
        destruct
      };
      function ym(id, funcName) {
        for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
          args[_key - 2] = arguments[_key];
        }
        return api[funcName] && api[funcName](id, ...args);
      }
      function init(id) {
        window["yaCounter".concat(id)] = api;
        document.dispatchEvent(new Event("yacounter".concat(id, "inited")));
      }
      if (typeof window.ym === 'undefined') {
        window.ym = ym;
        ym.a = [];
      } else if (window.ym && window.ym.a) {
        ym.a = window.ym.a;
        window.ym = ym;
        window.ym.a.forEach(function (params) {
          var id = params[0];
          init(id);
        });
      }
      hit(source);
    }
    metrikaYandexTag$1.names = ['metrika-yandex-tag'];
    metrikaYandexTag$1.injections = [hit, noopFunc];
    function metrikaYandexWatch$1(source) {
      var cbName = 'yandex_metrika_callbacks';
      var asyncCallbackFromOptions = function asyncCallbackFromOptions() {
        var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
        var callback = options.callback;
        var ctx = options.ctx;
        if (typeof callback === 'function') {
          callback = ctx !== undefined ? callback.bind(ctx) : callback;
          setTimeout(function () {
            return callback();
          });
        }
      };
      function Metrika() {}
      Metrika.counters = noopArray;
      Metrika.prototype.addFileExtension = noopFunc;
      Metrika.prototype.getClientID = noopFunc;
      Metrika.prototype.setUserID = noopFunc;
      Metrika.prototype.userParams = noopFunc;
      Metrika.prototype.params = noopFunc;
      Metrika.prototype.counters = noopArray;
      Metrika.prototype.extLink = function (url, options) {
        asyncCallbackFromOptions(options);
      };
      Metrika.prototype.file = function (url, options) {
        asyncCallbackFromOptions(options);
      };
      Metrika.prototype.hit = function (url, options) {
        asyncCallbackFromOptions(options);
      };
      Metrika.prototype.reachGoal = function (target, params, cb, ctx) {
        asyncCallbackFromOptions({
          callback: cb,
          ctx
        });
      };
      Metrika.prototype.notBounce = asyncCallbackFromOptions;
      if (window.Ya) {
        window.Ya.Metrika = Metrika;
      } else {
        window.Ya = {
          Metrika
        };
      }
      if (window[cbName] && Array.isArray(window[cbName])) {
        window[cbName].forEach(function (func) {
          if (typeof func === 'function') {
            func();
          }
        });
      }
      hit(source);
    }
    metrikaYandexWatch$1.names = ['metrika-yandex-watch'];
    metrikaYandexWatch$1.injections = [hit, noopFunc, noopArray];
    function NaverWcslog$1(source) {
      window.wcs_add = {};
      window.wcs_do = noopFunc;
      window.wcs = {
        inflow: noopFunc
      };
      hit(source);
    }
    NaverWcslog$1.names = ['naver-wcslog'];
    NaverWcslog$1.injections = [hit, noopFunc];
    function Pardot$1(source) {
      window.piVersion = '1.0.2';
      window.piScriptNum = 0;
      window.piScriptObj = [];
      window.checkNamespace = noopFunc;
      window.getPardotUrl = noopStr;
      window.piGetParameter = noopNull;
      window.piSetCookie = noopFunc;
      window.piGetCookie = noopStr;
      function piTracker() {
        window.pi = {
          tracker: {
            visitor_id: '',
            visitor_id_sign: '',
            pi_opt_in: '',
            campaign_id: ''
          }
        };
        window.piScriptNum += 1;
      }
      window.piResponse = noopFunc;
      window.piTracker = piTracker;
      piTracker();
      hit(source);
    }
    Pardot$1.names = ['pardot-1.0'];
    Pardot$1.injections = [hit, noopFunc, noopStr, noopNull];
    function Prebid$1(source) {
      var pushFunction = function pushFunction(arg) {
        if (typeof arg === 'function') {
          try {
            arg.call();
          } catch (ex) {
          }
        }
      };
      var pbjsWrapper = {
        addAdUnits() {},
        adServers: {
          dfp: {
            buildVideoUrl: noopStr
          }
        },
        adUnits: [],
        aliasBidder() {},
        cmd: [],
        enableAnalytics() {},
        getHighestCpmBids: noopArray,
        libLoaded: true,
        que: [],
        requestBids(arg) {
          if (arg instanceof Object && arg.bidsBackHandler) {
            try {
              arg.bidsBackHandler.call();
            } catch (ex) {
            }
          }
        },
        removeAdUnit() {},
        setBidderConfig() {},
        setConfig() {},
        setTargetingForGPTAsync() {}
      };
      pbjsWrapper.cmd.push = pushFunction;
      pbjsWrapper.que.push = pushFunction;
      window.pbjs = pbjsWrapper;
      hit(source);
    }
    Prebid$1.names = ['prebid'];
    Prebid$1.injections = [hit, noopFunc, noopStr, noopArray];
    function ScoreCardResearchBeacon$1(source) {
      window.COMSCORE = {
        purge() {
          window._comscore = [];
        },
        beacon() {}
      };
      hit(source);
    }
    ScoreCardResearchBeacon$1.names = ['scorecardresearch-beacon', 'ubo-scorecardresearch_beacon.js', 'scorecardresearch_beacon.js'];
    ScoreCardResearchBeacon$1.injections = [hit];
    var scriptletListRaw = Object.freeze({
        __proto__: null,
        AmazonApstag: AmazonApstag$1,
        DidomiLoader: DidomiLoader$1,
        Fingerprintjs2: Fingerprintjs2$1,
        Fingerprintjs3: Fingerprintjs3$1,
        Gemius: Gemius$1,
        GoogleAnalytics: GoogleAnalytics$1,
        GoogleAnalyticsGa: GoogleAnalyticsGa$1,
        GoogleIma3: GoogleIma3$1,
        GoogleSyndicationAdsByGoogle: GoogleSyndicationAdsByGoogle$1,
        GoogleTagServicesGpt: GoogleTagServicesGpt$1,
        Matomo: Matomo$1,
        NaverWcslog: NaverWcslog$1,
        Pardot: Pardot$1,
        Prebid: Prebid$1,
        ScoreCardResearchBeacon: ScoreCardResearchBeacon$1,
        abortCurrentInlineScript: abortCurrentInlineScript$1,
        abortOnPropertyRead: abortOnPropertyRead$1,
        abortOnPropertyWrite: abortOnPropertyWrite$1,
        abortOnStackTrace: abortOnStackTrace$1,
        adjustSetInterval: adjustSetInterval$1,
        adjustSetTimeout: adjustSetTimeout$1,
        callNoThrow: callNoThrow$1,
        debugCurrentInlineScript: debugCurrentInlineScript$1,
        debugOnPropertyRead: debugOnPropertyRead$1,
        debugOnPropertyWrite: debugOnPropertyWrite$1,
        dirString: dirString$1,
        disableNewtabLinks: disableNewtabLinks$1,
        evalDataPrune: evalDataPrune$1,
        forceWindowClose: forceWindowClose$1,
        hideInShadowDom: hideInShadowDom$1,
        hrefSanitizer: hrefSanitizer$1,
        injectCssInShadowDom: injectCssInShadowDom$1,
        jsonPrune: jsonPrune$1,
        jsonPruneFetchResponse: jsonPruneFetchResponse$1,
        jsonPruneXhrResponse: jsonPruneXhrResponse$1,
        log: log$1,
        logAddEventListener: logAddEventListener$1,
        logEval: logEval$1,
        logOnStacktrace: logOnStacktrace$1,
        m3uPrune: m3uPrune$1,
        metrikaYandexTag: metrikaYandexTag$1,
        metrikaYandexWatch: metrikaYandexWatch$1,
        noProtectedAudience: noProtectedAudience$1,
        noTopics: noTopics$1,
        noeval: noeval$1,
        nowebrtc: nowebrtc$1,
        preventAddEventListener: preventAddEventListener$1,
        preventAdfly: preventAdfly$1,
        preventBab: preventBab$2,
        preventElementSrcLoading: preventElementSrcLoading$1,
        preventEvalIf: preventEvalIf$1,
        preventFab: preventFab$1,
        preventFetch: preventFetch$1,
        preventPopadsNet: preventPopadsNet$1,
        preventRefresh: preventRefresh$1,
        preventRequestAnimationFrame: preventRequestAnimationFrame$1,
        preventSetInterval: preventSetInterval$1,
        preventSetTimeout: preventSetTimeout$1,
        preventWindowOpen: preventWindowOpen$1,
        preventXHR: preventXHR$1,
        removeAttr: removeAttr$1,
        removeClass: removeClass$1,
        removeCookie: removeCookie$1,
        removeInShadowDom: removeInShadowDom$1,
        removeNodeText: removeNodeText$1,
        setAttr: setAttr$1,
        setConstant: setConstant$1,
        setCookie: setCookie$1,
        setCookieReload: setCookieReload$1,
        setLocalStorageItem: setLocalStorageItem$1,
        setPopadsDummy: setPopadsDummy$1,
        setSessionStorageItem: setSessionStorageItem$1,
        spoofCSS: spoofCSS$1,
        trustedClickElement: trustedClickElement$1,
        trustedCreateElement: trustedCreateElement$1,
        trustedDispatchEvent: trustedDispatchEvent$1,
        trustedPruneInboundObject: trustedPruneInboundObject$1,
        trustedReplaceFetchResponse: trustedReplaceFetchResponse$1,
        trustedReplaceNodeText: trustedReplaceNodeText$1,
        trustedReplaceOutboundText: trustedReplaceOutboundText$1,
        trustedReplaceXhrResponse: trustedReplaceXhrResponse$1,
        trustedSetAttr: trustedSetAttr$1,
        trustedSetConstant: trustedSetConstant$1,
        trustedSetCookie: trustedSetCookie$1,
        trustedSetCookieReload: trustedSetCookieReload$1,
        trustedSetLocalStorageItem: trustedSetLocalStorageItem$1,
        trustedSetSessionStorageItem: trustedSetSessionStorageItem$1,
        trustedSuppressNativeMethod: trustedSuppressNativeMethod$1,
        xmlPrune: xmlPrune$1
    });
    function _typeof(obj) {
      "@babel/helpers - typeof";
      return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
        return typeof obj;
      } : function (obj) {
        return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
      }, _typeof(obj);
    }
    function _toPrimitive(input, hint) {
      if (_typeof(input) !== "object" || input === null) return input;
      var prim = input[Symbol.toPrimitive];
      if (prim !== undefined) {
        var res = prim.call(input, hint || "default");
        if (_typeof(res) !== "object") return res;
        throw new TypeError("@@toPrimitive must return a primitive value.");
      }
      return (hint === "string" ? String : Number)(input);
    }
    function _toPropertyKey(arg) {
      var key = _toPrimitive(arg, "string");
      return _typeof(key) === "symbol" ? key : String(key);
    }
    function _defineProperty(obj, key, value) {
      key = _toPropertyKey(key);
      if (key in obj) {
        Object.defineProperty(obj, key, {
          value: value,
          enumerable: true,
          configurable: true,
          writable: true
        });
      } else {
        obj[key] = value;
      }
      return obj;
    }
    function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
    function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
    var getRuleNode = function getRuleNode(rule) {
      return typeof rule === 'string'
      ? RuleParser.parse(rule, _objectSpread$1(_objectSpread$1({}, defaultParserOptions), {}, {
        includeRaws: false,
        isLocIncluded: false
      })) : rule;
    };
    var getRuleText = function getRuleText(rule) {
      return typeof rule === 'string' ? rule : RuleParser.generate(rule);
    };
    function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
    function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
    function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
    var UBO_JS_SUFFIX = '.js';
    var isScriptletRuleForSyntax = function isScriptletRuleForSyntax(rule, syntax) {
      try {
        var ruleNode = getRuleNode(rule);
        return ruleNode.category === RuleCategory.Cosmetic && ruleNode.type === CosmeticRuleType.ScriptletInjectionRule && ruleNode.syntax === syntax;
      } catch (e) {
        return false;
      }
    };
    var isAdgScriptletRule = function isAdgScriptletRule(rule) {
      return isScriptletRuleForSyntax(rule, AdblockSyntax.Adg);
    };
    var isUboScriptletRule = function isUboScriptletRule(rule) {
      return isScriptletRuleForSyntax(rule, AdblockSyntax.Ubo);
    };
    var isAbpSnippetRule = function isAbpSnippetRule(rule) {
      return isScriptletRuleForSyntax(rule, AdblockSyntax.Abp);
    };
    var getScriptletsObjList = function getScriptletsObjList() {
      return Object.values(scriptletListRaw);
    };
    var getScriptletByName = function getScriptletByName(name, scriptlets) {
      var allScriptletsFns = scriptlets || getScriptletsObjList();
      return allScriptletsFns.find(function (s) {
        return s.names
        && (s.names.includes(name)
        || !name.endsWith(UBO_JS_SUFFIX) && s.names.includes("".concat(name).concat(UBO_JS_SUFFIX)));
      });
    };
    var scriptletObjects = getScriptletsObjList();
    var isValidScriptletNameNotCached = function isValidScriptletNameNotCached(name) {
      if (!name) {
        return false;
      }
      return !!getScriptletByName(name, scriptletObjects);
    };
    var scriptletNameValidationCache = new Map();
    var isValidScriptletName = function isValidScriptletName(name) {
      if (name === '') {
        return true;
      }
      if (!name) {
        return false;
      }
      if (!scriptletNameValidationCache.has(name)) {
        var isValid = isValidScriptletNameNotCached(name);
        scriptletNameValidationCache.set(name, isValid);
        return isValid;
      }
      return scriptletNameValidationCache.get(name);
    };
    var POSSIBLE_REDIRECT_MODIFIERS = new Set(['redirect', 'redirect-rule', 'rewrite']);
    var getRedirectResourcesFromRule = function getRedirectResourcesFromRule(rule) {
      var result = [];
      try {
        var ruleNode = getRuleNode(rule);
        if (ruleNode.category !== RuleCategory.Network) {
          return result;
        }
        if (ruleNode.type !== NetworkRuleType.NetworkRule) {
          return result;
        }
        var ruleModifiers = ruleNode.modifiers;
        if (!ruleModifiers) {
          return result;
        }
        var _iterator = _createForOfIteratorHelper(ruleModifiers.children),
          _step;
        try {
          for (_iterator.s(); !(_step = _iterator.n()).done;) {
            var el = _step.value;
            if (el.exception) {
              continue;
            }
            if (POSSIBLE_REDIRECT_MODIFIERS.has(el.name.value)) {
              var _el$value;
              result.push({
                modifier: el.name.value,
                resource: (_el$value = el.value) === null || _el$value === void 0 ? void 0 : _el$value.value,
                exceptionRule: ruleNode.exception
              });
            }
          }
        } catch (err) {
          _iterator.e(err);
        } finally {
          _iterator.f();
        }
        return result;
      } catch (e) {
        return result;
      }
    };
    var isAdgRedirectRule = function isAdgRedirectRule(rule) {
      var resources = getRedirectResourcesFromRule(rule);
      if (!resources.length || resources.length > 1) {
        return false;
      }
      var _resources = _slicedToArray$1(resources, 1),
        resource = _resources[0];
      return modifiersCompatibilityTable.exists(resource.modifier, GenericPlatform.AdgAny);
    };
    var isRedirectResourceCompatibleWithAdg = function isRedirectResourceCompatibleWithAdg(redirectName) {
      return redirectsCompatibilityTable.exists(redirectName, GenericPlatform.AdgAny);
    };
    var isValidAdgRedirectRule = function isValidAdgRedirectRule(rule) {
      var resources = getRedirectResourcesFromRule(rule);
      if (!resources.length || resources.length > 1) {
        return false;
      }
      var _resources2 = _slicedToArray$1(resources, 1),
        resource = _resources2[0];
      if (!resource.resource) {
        return resource.exceptionRule;
      }
      return modifiersCompatibilityTable.exists(resource.modifier, GenericPlatform.AdgAny) && isRedirectResourceCompatibleWithAdg(resource.resource);
    };
    var checkCompatibility = function checkCompatibility(rule, from, to) {
      var resources = getRedirectResourcesFromRule(rule);
      if (!resources.length || resources.length > 1) {
        return false;
      }
      var _resources3 = _slicedToArray$1(resources, 1),
        resource = _resources3[0];
      if (!resource.resource) {
        return resource.exceptionRule;
      }
      if (!redirectsCompatibilityTable.exists(resource.resource, from)) {
        return false;
      }
      return !!redirectsCompatibilityTable.getFirst(resource.resource, to);
    };
    var isAdgRedirectCompatibleWithUbo = function isAdgRedirectCompatibleWithUbo(rule) {
      return checkCompatibility(rule, GenericPlatform.AdgAny, GenericPlatform.UboAny);
    };
    var isUboRedirectCompatibleWithAdg = function isUboRedirectCompatibleWithAdg(rule) {
      return checkCompatibility(rule, GenericPlatform.UboAny, GenericPlatform.AdgAny);
    };
    var isAbpRedirectCompatibleWithAdg = function isAbpRedirectCompatibleWithAdg(rule) {
      return checkCompatibility(rule, GenericPlatform.AbpAny, GenericPlatform.AdgAny);
    };
    var validator = {
      isAdgScriptletRule,
      isUboScriptletRule,
      isAbpSnippetRule,
      getScriptletByName,
      isValidScriptletName,
      isAdgRedirectRule,
      isValidAdgRedirectRule,
      isRedirectResourceCompatibleWithAdg,
      isAdgRedirectCompatibleWithUbo,
      isUboRedirectCompatibleWithAdg,
      isAbpRedirectCompatibleWithAdg
    };
    var isArrayOfScriptletRules = function isArrayOfScriptletRules(rules) {
      return rules.every(function (rule) {
        return rule.category === RuleCategory.Cosmetic && rule.type === CosmeticRuleType.ScriptletInjectionRule;
      });
    };
    var convertScriptletTo = function convertScriptletTo(rule, method) {
      var ruleNode = getRuleNode(rule);
      if (ruleNode.category !== RuleCategory.Cosmetic || ruleNode.type !== CosmeticRuleType.ScriptletInjectionRule) {
        return [getRuleText(ruleNode)];
      }
      var conversionResult = method(ruleNode);
      if (!conversionResult.isConverted) {
        return [getRuleText(ruleNode)];
      }
      return conversionResult.result.map(getRuleText);
    };
    var convertUboScriptletToAdg = function convertUboScriptletToAdg(rule) {
      return convertScriptletTo(rule, RuleConverter.convertToAdg);
    };
    var convertAbpSnippetToAdg = function convertAbpSnippetToAdg(rule) {
      return convertScriptletTo(rule, RuleConverter.convertToAdg);
    };
    var convertScriptletToAdg = function convertScriptletToAdg(rule) {
      try {
        return convertScriptletTo(rule, RuleConverter.convertToAdg);
      } catch (e) {
        return [];
      }
    };
    var convertAdgScriptletToUbo = function convertAdgScriptletToUbo(rule) {
      try {
        return convertScriptletTo(rule, RuleConverter.convertToUbo)[0];
      } catch (e) {
        return undefined;
      }
    };
    var isValidScriptletRule = function isValidScriptletRule(rule) {
      var ruleNodes;
      try {
        ruleNodes = RuleConverter.convertToAdg(getRuleNode(rule)).result;
      } catch (e) {
        return false;
      }
      if (!isArrayOfScriptletRules(ruleNodes)) {
        return false;
      }
      var isValid = ruleNodes.every(function (ruleNode) {
        var _ruleNode$body$childr, _ruleNode$body$childr2;
        var name = (_ruleNode$body$childr = ruleNode.body.children[0]) === null || _ruleNode$body$childr === void 0 ? void 0 : (_ruleNode$body$childr2 = _ruleNode$body$childr.children[0]) === null || _ruleNode$body$childr2 === void 0 ? void 0 : _ruleNode$body$childr2.value;
        if (!name) {
          return ruleNode.exception;
        }
        var unquotedName = QuoteUtils.removeQuotes(name);
        if (!unquotedName) {
          return false;
        }
        return validator.isValidScriptletName(unquotedName);
      });
      return isValid;
    };
    var convertUboRedirectToAdg = function convertUboRedirectToAdg(rule) {
      return RuleConverter.convertToAdg(getRuleNode(rule)).result.map(getRuleText)[0];
    };
    var convertAbpRedirectToAdg = function convertAbpRedirectToAdg(rule) {
      var node = getRuleNode(rule);
      if (node.category !== RuleCategory.Network) {
        return rule;
      }
      var conversionResult = RuleConverter.convertToAdg(node);
      return getRuleText(conversionResult.result[0]);
    };
    var convertRedirectToAdg = function convertRedirectToAdg(rule) {
      var node = getRuleNode(rule);
      if (node.category !== RuleCategory.Network) {
        return;
      }
      var conversionResult = RuleConverter.convertToAdg(node);
      return getRuleText(conversionResult.result[0]);
    };
    var convertAdgRedirectToUbo = function convertAdgRedirectToUbo(rule) {
      var node = getRuleNode(rule);
      if (node.category !== RuleCategory.Network) {
        throw new Error('Rule is not a network rule');
      }
      var conversionResult = RuleConverter.convertToUbo(node);
      return getRuleText(conversionResult.result[0]);
    };
    var convertRedirectNameToAdg = function convertRedirectNameToAdg(name) {
      var _redirectsCompatibili;
      return (_redirectsCompatibili = redirectsCompatibilityTable.getFirst(name, GenericPlatform.AdgAny)) === null || _redirectsCompatibili === void 0 ? void 0 : _redirectsCompatibili.name;
    };
    var preventBab$1 = preventBab$2;
    preventBab$1.names = ['prevent-bab',
    'nobab.js', 'ubo-nobab.js', 'bab-defuser.js', 'ubo-bab-defuser.js', 'ubo-nobab', 'ubo-bab-defuser'];
    function ATInternetSmartTag(source) {
      var setNoopFuncWrapper = {
        set: noopFunc
      };
      var sendNoopFuncWrapper = {
        send: noopFunc
      };
      var ecommerceWrapper = {
        displayCart: {
          products: setNoopFuncWrapper,
          cart: setNoopFuncWrapper
        },
        updateCart: {
          cart: setNoopFuncWrapper
        },
        displayProduct: {
          products: setNoopFuncWrapper
        },
        displayPageProduct: {
          products: setNoopFuncWrapper
        },
        addProduct: {
          products: setNoopFuncWrapper
        },
        removeProduct: {
          products: setNoopFuncWrapper
        }
      };
      var tag = function tag() {};
      tag.prototype = {
        setConfig: noopFunc,
        setParam: noopFunc,
        dispatch: noopFunc,
        customVars: setNoopFuncWrapper,
        publisher: setNoopFuncWrapper,
        order: setNoopFuncWrapper,
        click: sendNoopFuncWrapper,
        clickListener: sendNoopFuncWrapper,
        internalSearch: {
          set: noopFunc,
          send: noopFunc
        },
        ecommerce: ecommerceWrapper,
        identifiedVisitor: {
          unset: noopFunc
        },
        page: {
          set: noopFunc,
          send: noopFunc
        },
        selfPromotion: {
          add: noopFunc,
          send: noopFunc
        },
        privacy: {
          setVisitorMode: noopFunc,
          getVisitorMode: noopFunc,
          hit: noopFunc
        },
        richMedia: {
          add: noopFunc,
          send: noopFunc,
          remove: noopFunc,
          removeAll: noopFunc
        }
      };
      var smartTagWrapper = {
        Tracker: {
          Tag: tag
        }
      };
      window.ATInternet = smartTagWrapper;
      hit(source);
    }
    ATInternetSmartTag.names = ['ati-smarttag'];
    ATInternetSmartTag.injections = [hit, noopFunc];
    function preventBab2(source) {
      var script = document.currentScript;
      if (script === null) {
        return;
      }
      var url = script.src;
      if (typeof url !== 'string') {
        return;
      }
      var domainsStr = ['adclixx\\.net', 'adnetasia\\.com', 'adtrackers\\.net', 'bannertrack\\.net'].join('|');
      var matchStr = "^https?://[\\w-]+\\.(".concat(domainsStr, ")/.");
      var domainsRegex = new RegExp(matchStr);
      if (domainsRegex.test(url) === false) {
        return;
      }
      window.nH7eXzOsG = 858;
      hit(source);
    }
    preventBab2.names = ['prevent-bab2',
    'nobab2.js'];
    preventBab2.injections = [hit];
    function prebidAds(source) {
      window.canRunAds = true;
      window.isAdBlockActive = false;
      hit(source);
    }
    prebidAds.names = ['prebid-ads', 'ubo-prebid-ads.js', 'prebid-ads.js'];
    prebidAds.injections = [hit];
    var redirectsList = Object.freeze({
        __proto__: null,
        ATInternetSmartTag: ATInternetSmartTag,
        AmazonApstag: AmazonApstag$1,
        DidomiLoader: DidomiLoader$1,
        Fingerprintjs2: Fingerprintjs2$1,
        Fingerprintjs3: Fingerprintjs3$1,
        Gemius: Gemius$1,
        GoogleAnalytics: GoogleAnalytics$1,
        GoogleAnalyticsGa: GoogleAnalyticsGa$1,
        GoogleIma3: GoogleIma3$1,
        GoogleSyndicationAdsByGoogle: GoogleSyndicationAdsByGoogle$1,
        GoogleTagServicesGpt: GoogleTagServicesGpt$1,
        Matomo: Matomo$1,
        NaverWcslog: NaverWcslog$1,
        Pardot: Pardot$1,
        Prebid: Prebid$1,
        ScoreCardResearchBeacon: ScoreCardResearchBeacon$1,
        metrikaYandexTag: metrikaYandexTag$1,
        metrikaYandexWatch: metrikaYandexWatch$1,
        noeval: noeval$1,
        prebidAds: prebidAds,
        preventBab: preventBab$1,
        preventBab2: preventBab2,
        preventFab: preventFab$1,
        preventPopadsNet: preventPopadsNet$1,
        setPopadsDummy: setPopadsDummy$1
    });
    var jsYaml$2 = {};
    var loader$1 = {};
    var common$6 = {};
    function isNothing(subject) {
      return typeof subject === 'undefined' || subject === null;
    }
    function isObject(subject) {
      return typeof subject === 'object' && subject !== null;
    }
    function toArray(sequence) {
      if (Array.isArray(sequence)) return sequence;else if (isNothing(sequence)) return [];
      return [sequence];
    }
    function extend(target, source) {
      var index, length, key, sourceKeys;
      if (source) {
        sourceKeys = Object.keys(source);
        for (index = 0, length = sourceKeys.length; index < length; index += 1) {
          key = sourceKeys[index];
          target[key] = source[key];
        }
      }
      return target;
    }
    function repeat(string, count) {
      var result = '',
        cycle;
      for (cycle = 0; cycle < count; cycle += 1) {
        result += string;
      }
      return result;
    }
    function isNegativeZero(number) {
      return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
    }
    common$6.isNothing = isNothing;
    common$6.isObject = isObject;
    common$6.toArray = toArray;
    common$6.repeat = repeat;
    common$6.isNegativeZero = isNegativeZero;
    common$6.extend = extend;
    function YAMLException$4(reason, mark) {
      Error.call(this);
      this.name = 'YAMLException';
      this.reason = reason;
      this.mark = mark;
      this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
      if (Error.captureStackTrace) {
        Error.captureStackTrace(this, this.constructor);
      } else {
        this.stack = new Error().stack || '';
      }
    }
    YAMLException$4.prototype = Object.create(Error.prototype);
    YAMLException$4.prototype.constructor = YAMLException$4;
    YAMLException$4.prototype.toString = function toString(compact) {
      var result = this.name + ': ';
      result += this.reason || '(unknown reason)';
      if (!compact && this.mark) {
        result += ' ' + this.mark.toString();
      }
      return result;
    };
    var exception = YAMLException$4;
    var common$5 = common$6;
    function Mark$1(name, buffer, position, line, column) {
      this.name = name;
      this.buffer = buffer;
      this.position = position;
      this.line = line;
      this.column = column;
    }
    Mark$1.prototype.getSnippet = function getSnippet(indent, maxLength) {
      var head, start, tail, end, snippet;
      if (!this.buffer) return null;
      indent = indent || 4;
      maxLength = maxLength || 75;
      head = '';
      start = this.position;
      while (start > 0 && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(start - 1)) === -1) {
        start -= 1;
        if (this.position - start > maxLength / 2 - 1) {
          head = ' ... ';
          start += 5;
          break;
        }
      }
      tail = '';
      end = this.position;
      while (end < this.buffer.length && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(end)) === -1) {
        end += 1;
        if (end - this.position > maxLength / 2 - 1) {
          tail = ' ... ';
          end -= 5;
          break;
        }
      }
      snippet = this.buffer.slice(start, end);
      return common$5.repeat(' ', indent) + head + snippet + tail + '\n' + common$5.repeat(' ', indent + this.position - start + head.length) + '^';
    };
    Mark$1.prototype.toString = function toString(compact) {
      var snippet,
        where = '';
      if (this.name) {
        where += 'in "' + this.name + '" ';
      }
      where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
      if (!compact) {
        snippet = this.getSnippet();
        if (snippet) {
          where += ':\n' + snippet;
        }
      }
      return where;
    };
    var mark = Mark$1;
    var YAMLException$3 = exception;
    var TYPE_CONSTRUCTOR_OPTIONS = ['kind', 'resolve', 'construct', 'instanceOf', 'predicate', 'represent', 'defaultStyle', 'styleAliases'];
    var YAML_NODE_KINDS = ['scalar', 'sequence', 'mapping'];
    function compileStyleAliases(map) {
      var result = {};
      if (map !== null) {
        Object.keys(map).forEach(function (style) {
          map[style].forEach(function (alias) {
            result[String(alias)] = style;
          });
        });
      }
      return result;
    }
    function Type$h(tag, options) {
      options = options || {};
      Object.keys(options).forEach(function (name) {
        if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
          throw new YAMLException$3('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
        }
      });
      this.tag = tag;
      this.kind = options['kind'] || null;
      this.resolve = options['resolve'] || function () {
        return true;
      };
      this.construct = options['construct'] || function (data) {
        return data;
      };
      this.instanceOf = options['instanceOf'] || null;
      this.predicate = options['predicate'] || null;
      this.represent = options['represent'] || null;
      this.defaultStyle = options['defaultStyle'] || null;
      this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
      if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
        throw new YAMLException$3('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
      }
    }
    var type = Type$h;
    var common$4 = common$6;
    var YAMLException$2 = exception;
    var Type$g = type;
    function compileList(schema, name, result) {
      var exclude = [];
      schema.include.forEach(function (includedSchema) {
        result = compileList(includedSchema, name, result);
      });
      schema[name].forEach(function (currentType) {
        result.forEach(function (previousType, previousIndex) {
          if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
            exclude.push(previousIndex);
          }
        });
        result.push(currentType);
      });
      return result.filter(function (type, index) {
        return exclude.indexOf(index) === -1;
      });
    }
    function compileMap(
    ) {
      var result = {
          scalar: {},
          sequence: {},
          mapping: {},
          fallback: {}
        },
        index,
        length;
      function collectType(type) {
        result[type.kind][type.tag] = result['fallback'][type.tag] = type;
      }
      for (index = 0, length = arguments.length; index < length; index += 1) {
        arguments[index].forEach(collectType);
      }
      return result;
    }
    function Schema$5(definition) {
      this.include = definition.include || [];
      this.implicit = definition.implicit || [];
      this.explicit = definition.explicit || [];
      this.implicit.forEach(function (type) {
        if (type.loadKind && type.loadKind !== 'scalar') {
          throw new YAMLException$2('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
        }
      });
      this.compiledImplicit = compileList(this, 'implicit', []);
      this.compiledExplicit = compileList(this, 'explicit', []);
      this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
    }
    Schema$5.DEFAULT = null;
    Schema$5.create = function createSchema() {
      var schemas, types;
      switch (arguments.length) {
        case 1:
          schemas = Schema$5.DEFAULT;
          types = arguments[0];
          break;
        case 2:
          schemas = arguments[0];
          types = arguments[1];
          break;
        default:
          throw new YAMLException$2('Wrong number of arguments for Schema.create function');
      }
      schemas = common$4.toArray(schemas);
      types = common$4.toArray(types);
      if (!schemas.every(function (schema) {
        return schema instanceof Schema$5;
      })) {
        throw new YAMLException$2('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
      }
      if (!types.every(function (type) {
        return type instanceof Type$g;
      })) {
        throw new YAMLException$2('Specified list of YAML types (or a single Type object) contains a non-Type object.');
      }
      return new Schema$5({
        include: schemas,
        explicit: types
      });
    };
    var schema = Schema$5;
    var Type$f = type;
    var str = new Type$f('tag:yaml.org,2002:str', {
      kind: 'scalar',
      construct: function construct(data) {
        return data !== null ? data : '';
      }
    });
    var Type$e = type;
    var seq = new Type$e('tag:yaml.org,2002:seq', {
      kind: 'sequence',
      construct: function construct(data) {
        return data !== null ? data : [];
      }
    });
    var Type$d = type;
    var map = new Type$d('tag:yaml.org,2002:map', {
      kind: 'mapping',
      construct: function construct(data) {
        return data !== null ? data : {};
      }
    });
    var Schema$4 = schema;
    var failsafe = new Schema$4({
      explicit: [str, seq, map]
    });
    var Type$c = type;
    function resolveYamlNull(data) {
      if (data === null) return true;
      var max = data.length;
      return max === 1 && data === '~' || max === 4 && (data === 'null' || data === 'Null' || data === 'NULL');
    }
    function constructYamlNull() {
      return null;
    }
    function isNull(object) {
      return object === null;
    }
    var _null = new Type$c('tag:yaml.org,2002:null', {
      kind: 'scalar',
      resolve: resolveYamlNull,
      construct: constructYamlNull,
      predicate: isNull,
      represent: {
        canonical: function canonical() {
          return '~';
        },
        lowercase: function lowercase() {
          return 'null';
        },
        uppercase: function uppercase() {
          return 'NULL';
        },
        camelcase: function camelcase() {
          return 'Null';
        }
      },
      defaultStyle: 'lowercase'
    });
    var Type$b = type;
    function resolveYamlBoolean(data) {
      if (data === null) return false;
      var max = data.length;
      return max === 4 && (data === 'true' || data === 'True' || data === 'TRUE') || max === 5 && (data === 'false' || data === 'False' || data === 'FALSE');
    }
    function constructYamlBoolean(data) {
      return data === 'true' || data === 'True' || data === 'TRUE';
    }
    function isBoolean(object) {
      return Object.prototype.toString.call(object) === '[object Boolean]';
    }
    var bool = new Type$b('tag:yaml.org,2002:bool', {
      kind: 'scalar',
      resolve: resolveYamlBoolean,
      construct: constructYamlBoolean,
      predicate: isBoolean,
      represent: {
        lowercase: function lowercase(object) {
          return object ? 'true' : 'false';
        },
        uppercase: function uppercase(object) {
          return object ? 'TRUE' : 'FALSE';
        },
        camelcase: function camelcase(object) {
          return object ? 'True' : 'False';
        }
      },
      defaultStyle: 'lowercase'
    });
    var common$3 = common$6;
    var Type$a = type;
    function isHexCode(c) {
      return 0x30  <= c && c <= 0x39  || 0x41  <= c && c <= 0x46  || 0x61  <= c && c <= 0x66 ;
    }
    function isOctCode(c) {
      return 0x30  <= c && c <= 0x37 ;
    }
    function isDecCode(c) {
      return 0x30  <= c && c <= 0x39 ;
    }
    function resolveYamlInteger(data) {
      if (data === null) return false;
      var max = data.length,
        index = 0,
        hasDigits = false,
        ch;
      if (!max) return false;
      ch = data[index];
      if (ch === '-' || ch === '+') {
        ch = data[++index];
      }
      if (ch === '0') {
        if (index + 1 === max) return true;
        ch = data[++index];
        if (ch === 'b') {
          index++;
          for (; index < max; index++) {
            ch = data[index];
            if (ch === '_') continue;
            if (ch !== '0' && ch !== '1') return false;
            hasDigits = true;
          }
          return hasDigits && ch !== '_';
        }
        if (ch === 'x') {
          index++;
          for (; index < max; index++) {
            ch = data[index];
            if (ch === '_') continue;
            if (!isHexCode(data.charCodeAt(index))) return false;
            hasDigits = true;
          }
          return hasDigits && ch !== '_';
        }
        for (; index < max; index++) {
          ch = data[index];
          if (ch === '_') continue;
          if (!isOctCode(data.charCodeAt(index))) return false;
          hasDigits = true;
        }
        return hasDigits && ch !== '_';
      }
      if (ch === '_') return false;
      for (; index < max; index++) {
        ch = data[index];
        if (ch === '_') continue;
        if (ch === ':') break;
        if (!isDecCode(data.charCodeAt(index))) {
          return false;
        }
        hasDigits = true;
      }
      if (!hasDigits || ch === '_') return false;
      if (ch !== ':') return true;
      return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
    }
    function constructYamlInteger(data) {
      var value = data,
        sign = 1,
        ch,
        base,
        digits = [];
      if (value.indexOf('_') !== -1) {
        value = value.replace(/_/g, '');
      }
      ch = value[0];
      if (ch === '-' || ch === '+') {
        if (ch === '-') sign = -1;
        value = value.slice(1);
        ch = value[0];
      }
      if (value === '0') return 0;
      if (ch === '0') {
        if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
        if (value[1] === 'x') return sign * parseInt(value, 16);
        return sign * parseInt(value, 8);
      }
      if (value.indexOf(':') !== -1) {
        value.split(':').forEach(function (v) {
          digits.unshift(parseInt(v, 10));
        });
        value = 0;
        base = 1;
        digits.forEach(function (d) {
          value += d * base;
          base *= 60;
        });
        return sign * value;
      }
      return sign * parseInt(value, 10);
    }
    function isInteger(object) {
      return Object.prototype.toString.call(object) === '[object Number]' && object % 1 === 0 && !common$3.isNegativeZero(object);
    }
    var int = new Type$a('tag:yaml.org,2002:int', {
      kind: 'scalar',
      resolve: resolveYamlInteger,
      construct: constructYamlInteger,
      predicate: isInteger,
      represent: {
        binary: function binary(obj) {
          return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1);
        },
        octal: function octal(obj) {
          return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1);
        },
        decimal: function decimal(obj) {
          return obj.toString(10);
        },
        hexadecimal: function hexadecimal(obj) {
          return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1);
        }
      },
      defaultStyle: 'decimal',
      styleAliases: {
        binary: [2, 'bin'],
        octal: [8, 'oct'],
        decimal: [10, 'dec'],
        hexadecimal: [16, 'hex']
      }
    });
    var common$2 = common$6;
    var Type$9 = type;
    var YAML_FLOAT_PATTERN = new RegExp(
    '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
    '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
    '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
    '|[-+]?\\.(?:inf|Inf|INF)' +
    '|\\.(?:nan|NaN|NAN))$');
    function resolveYamlFloat(data) {
      if (data === null) return false;
      if (!YAML_FLOAT_PATTERN.test(data) ||
      data[data.length - 1] === '_') {
        return false;
      }
      return true;
    }
    function constructYamlFloat(data) {
      var value, sign, base, digits;
      value = data.replace(/_/g, '').toLowerCase();
      sign = value[0] === '-' ? -1 : 1;
      digits = [];
      if ('+-'.indexOf(value[0]) >= 0) {
        value = value.slice(1);
      }
      if (value === '.inf') {
        return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
      } else if (value === '.nan') {
        return NaN;
      } else if (value.indexOf(':') >= 0) {
        value.split(':').forEach(function (v) {
          digits.unshift(parseFloat(v, 10));
        });
        value = 0.0;
        base = 1;
        digits.forEach(function (d) {
          value += d * base;
          base *= 60;
        });
        return sign * value;
      }
      return sign * parseFloat(value, 10);
    }
    var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
    function representYamlFloat(object, style) {
      var res;
      if (isNaN(object)) {
        switch (style) {
          case 'lowercase':
            return '.nan';
          case 'uppercase':
            return '.NAN';
          case 'camelcase':
            return '.NaN';
        }
      } else if (Number.POSITIVE_INFINITY === object) {
        switch (style) {
          case 'lowercase':
            return '.inf';
          case 'uppercase':
            return '.INF';
          case 'camelcase':
            return '.Inf';
        }
      } else if (Number.NEGATIVE_INFINITY === object) {
        switch (style) {
          case 'lowercase':
            return '-.inf';
          case 'uppercase':
            return '-.INF';
          case 'camelcase':
            return '-.Inf';
        }
      } else if (common$2.isNegativeZero(object)) {
        return '-0.0';
      }
      res = object.toString(10);
      return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
    }
    function isFloat(object) {
      return Object.prototype.toString.call(object) === '[object Number]' && (object % 1 !== 0 || common$2.isNegativeZero(object));
    }
    var float = new Type$9('tag:yaml.org,2002:float', {
      kind: 'scalar',
      resolve: resolveYamlFloat,
      construct: constructYamlFloat,
      predicate: isFloat,
      represent: representYamlFloat,
      defaultStyle: 'lowercase'
    });
    var Schema$3 = schema;
    var json = new Schema$3({
      include: [failsafe],
      implicit: [_null, bool, int, float]
    });
    var Schema$2 = schema;
    var core = new Schema$2({
      include: [json]
    });
    var Type$8 = type;
    var YAML_DATE_REGEXP = new RegExp('^([0-9][0-9][0-9][0-9])' +
    '-([0-9][0-9])' +
    '-([0-9][0-9])$');
    var YAML_TIMESTAMP_REGEXP = new RegExp('^([0-9][0-9][0-9][0-9])' +
    '-([0-9][0-9]?)' +
    '-([0-9][0-9]?)' +
    '(?:[Tt]|[ \\t]+)' +
    '([0-9][0-9]?)' +
    ':([0-9][0-9])' +
    ':([0-9][0-9])' +
    '(?:\\.([0-9]*))?' +
    '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' +
    '(?::([0-9][0-9]))?))?$');
    function resolveYamlTimestamp(data) {
      if (data === null) return false;
      if (YAML_DATE_REGEXP.exec(data) !== null) return true;
      if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
      return false;
    }
    function constructYamlTimestamp(data) {
      var match,
        year,
        month,
        day,
        hour,
        minute,
        second,
        fraction = 0,
        delta = null,
        tz_hour,
        tz_minute,
        date;
      match = YAML_DATE_REGEXP.exec(data);
      if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
      if (match === null) throw new Error('Date resolve error');
      year = +match[1];
      month = +match[2] - 1;
      day = +match[3];
      if (!match[4]) {
        return new Date(Date.UTC(year, month, day));
      }
      hour = +match[4];
      minute = +match[5];
      second = +match[6];
      if (match[7]) {
        fraction = match[7].slice(0, 3);
        while (fraction.length < 3) {
          fraction += '0';
        }
        fraction = +fraction;
      }
      if (match[9]) {
        tz_hour = +match[10];
        tz_minute = +(match[11] || 0);
        delta = (tz_hour * 60 + tz_minute) * 60000;
        if (match[9] === '-') delta = -delta;
      }
      date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
      if (delta) date.setTime(date.getTime() - delta);
      return date;
    }
    function representYamlTimestamp(object ) {
      return object.toISOString();
    }
    var timestamp = new Type$8('tag:yaml.org,2002:timestamp', {
      kind: 'scalar',
      resolve: resolveYamlTimestamp,
      construct: constructYamlTimestamp,
      instanceOf: Date,
      represent: representYamlTimestamp
    });
    var Type$7 = type;
    function resolveYamlMerge(data) {
      return data === '<<' || data === null;
    }
    var merge = new Type$7('tag:yaml.org,2002:merge', {
      kind: 'scalar',
      resolve: resolveYamlMerge
    });
    function commonjsRequire(path) {
    	throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
    }
    var NodeBuffer;
    try {
      var _require$1 = commonjsRequire;
      NodeBuffer = _require$1('buffer').Buffer;
    } catch (__) {}
    var Type$6 = type;
    var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
    function resolveYamlBinary(data) {
      if (data === null) return false;
      var code,
        idx,
        bitlen = 0,
        max = data.length,
        map = BASE64_MAP;
      for (idx = 0; idx < max; idx++) {
        code = map.indexOf(data.charAt(idx));
        if (code > 64) continue;
        if (code < 0) return false;
        bitlen += 6;
      }
      return bitlen % 8 === 0;
    }
    function constructYamlBinary(data) {
      var idx,
        tailbits,
        input = data.replace(/[\r\n=]/g, ''),
        max = input.length,
        map = BASE64_MAP,
        bits = 0,
        result = [];
      for (idx = 0; idx < max; idx++) {
        if (idx % 4 === 0 && idx) {
          result.push(bits >> 16 & 0xFF);
          result.push(bits >> 8 & 0xFF);
          result.push(bits & 0xFF);
        }
        bits = bits << 6 | map.indexOf(input.charAt(idx));
      }
      tailbits = max % 4 * 6;
      if (tailbits === 0) {
        result.push(bits >> 16 & 0xFF);
        result.push(bits >> 8 & 0xFF);
        result.push(bits & 0xFF);
      } else if (tailbits === 18) {
        result.push(bits >> 10 & 0xFF);
        result.push(bits >> 2 & 0xFF);
      } else if (tailbits === 12) {
        result.push(bits >> 4 & 0xFF);
      }
      if (NodeBuffer) {
        return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
      }
      return result;
    }
    function representYamlBinary(object ) {
      var result = '',
        bits = 0,
        idx,
        tail,
        max = object.length,
        map = BASE64_MAP;
      for (idx = 0; idx < max; idx++) {
        if (idx % 3 === 0 && idx) {
          result += map[bits >> 18 & 0x3F];
          result += map[bits >> 12 & 0x3F];
          result += map[bits >> 6 & 0x3F];
          result += map[bits & 0x3F];
        }
        bits = (bits << 8) + object[idx];
      }
      tail = max % 3;
      if (tail === 0) {
        result += map[bits >> 18 & 0x3F];
        result += map[bits >> 12 & 0x3F];
        result += map[bits >> 6 & 0x3F];
        result += map[bits & 0x3F];
      } else if (tail === 2) {
        result += map[bits >> 10 & 0x3F];
        result += map[bits >> 4 & 0x3F];
        result += map[bits << 2 & 0x3F];
        result += map[64];
      } else if (tail === 1) {
        result += map[bits >> 2 & 0x3F];
        result += map[bits << 4 & 0x3F];
        result += map[64];
        result += map[64];
      }
      return result;
    }
    function isBinary(object) {
      return NodeBuffer && NodeBuffer.isBuffer(object);
    }
    var binary = new Type$6('tag:yaml.org,2002:binary', {
      kind: 'scalar',
      resolve: resolveYamlBinary,
      construct: constructYamlBinary,
      predicate: isBinary,
      represent: representYamlBinary
    });
    var Type$5 = type;
    var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
    var _toString$2 = Object.prototype.toString;
    function resolveYamlOmap(data) {
      if (data === null) return true;
      var objectKeys = [],
        index,
        length,
        pair,
        pairKey,
        pairHasKey,
        object = data;
      for (index = 0, length = object.length; index < length; index += 1) {
        pair = object[index];
        pairHasKey = false;
        if (_toString$2.call(pair) !== '[object Object]') return false;
        for (pairKey in pair) {
          if (_hasOwnProperty$3.call(pair, pairKey)) {
            if (!pairHasKey) pairHasKey = true;else return false;
          }
        }
        if (!pairHasKey) return false;
        if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);else return false;
      }
      return true;
    }
    function constructYamlOmap(data) {
      return data !== null ? data : [];
    }
    var omap = new Type$5('tag:yaml.org,2002:omap', {
      kind: 'sequence',
      resolve: resolveYamlOmap,
      construct: constructYamlOmap
    });
    var Type$4 = type;
    var _toString$1 = Object.prototype.toString;
    function resolveYamlPairs(data) {
      if (data === null) return true;
      var index,
        length,
        pair,
        keys,
        result,
        object = data;
      result = new Array(object.length);
      for (index = 0, length = object.length; index < length; index += 1) {
        pair = object[index];
        if (_toString$1.call(pair) !== '[object Object]') return false;
        keys = Object.keys(pair);
        if (keys.length !== 1) return false;
        result[index] = [keys[0], pair[keys[0]]];
      }
      return true;
    }
    function constructYamlPairs(data) {
      if (data === null) return [];
      var index,
        length,
        pair,
        keys,
        result,
        object = data;
      result = new Array(object.length);
      for (index = 0, length = object.length; index < length; index += 1) {
        pair = object[index];
        keys = Object.keys(pair);
        result[index] = [keys[0], pair[keys[0]]];
      }
      return result;
    }
    var pairs = new Type$4('tag:yaml.org,2002:pairs', {
      kind: 'sequence',
      resolve: resolveYamlPairs,
      construct: constructYamlPairs
    });
    var Type$3 = type;
    var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
    function resolveYamlSet(data) {
      if (data === null) return true;
      var key,
        object = data;
      for (key in object) {
        if (_hasOwnProperty$2.call(object, key)) {
          if (object[key] !== null) return false;
        }
      }
      return true;
    }
    function constructYamlSet(data) {
      return data !== null ? data : {};
    }
    var set = new Type$3('tag:yaml.org,2002:set', {
      kind: 'mapping',
      resolve: resolveYamlSet,
      construct: constructYamlSet
    });
    var Schema$1 = schema;
    var default_safe = new Schema$1({
      include: [core],
      implicit: [timestamp, merge],
      explicit: [binary, omap, pairs, set]
    });
    var Type$2 = type;
    function resolveJavascriptUndefined() {
      return true;
    }
    function constructJavascriptUndefined() {
      return undefined;
    }
    function representJavascriptUndefined() {
      return '';
    }
    function isUndefined(object) {
      return typeof object === 'undefined';
    }
    var _undefined = new Type$2('tag:yaml.org,2002:js/undefined', {
      kind: 'scalar',
      resolve: resolveJavascriptUndefined,
      construct: constructJavascriptUndefined,
      predicate: isUndefined,
      represent: representJavascriptUndefined
    });
    var Type$1 = type;
    function resolveJavascriptRegExp(data) {
      if (data === null) return false;
      if (data.length === 0) return false;
      var regexp = data,
        tail = /\/([gim]*)$/.exec(data),
        modifiers = '';
      if (regexp[0] === '/') {
        if (tail) modifiers = tail[1];
        if (modifiers.length > 3) return false;
        if (regexp[regexp.length - modifiers.length - 1] !== '/') return false;
      }
      return true;
    }
    function constructJavascriptRegExp(data) {
      var regexp = data,
        tail = /\/([gim]*)$/.exec(data),
        modifiers = '';
      if (regexp[0] === '/') {
        if (tail) modifiers = tail[1];
        regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
      }
      return new RegExp(regexp, modifiers);
    }
    function representJavascriptRegExp(object ) {
      var result = '/' + object.source + '/';
      if (object.global) result += 'g';
      if (object.multiline) result += 'm';
      if (object.ignoreCase) result += 'i';
      return result;
    }
    function isRegExp(object) {
      return Object.prototype.toString.call(object) === '[object RegExp]';
    }
    var regexp = new Type$1('tag:yaml.org,2002:js/regexp', {
      kind: 'scalar',
      resolve: resolveJavascriptRegExp,
      construct: constructJavascriptRegExp,
      predicate: isRegExp,
      represent: representJavascriptRegExp
    });
    var esprima;
    try {
      var _require = commonjsRequire;
      esprima = _require('esprima');
    } catch (_) {
      if (typeof window !== 'undefined') esprima = window.esprima;
    }
    var Type = type;
    function resolveJavascriptFunction(data) {
      if (data === null) return false;
      try {
        var source = '(' + data + ')',
          ast = esprima.parse(source, {
            range: true
          });
        if (ast.type !== 'Program' || ast.body.length !== 1 || ast.body[0].type !== 'ExpressionStatement' || ast.body[0].expression.type !== 'ArrowFunctionExpression' && ast.body[0].expression.type !== 'FunctionExpression') {
          return false;
        }
        return true;
      } catch (err) {
        return false;
      }
    }
    function constructJavascriptFunction(data) {
      var source = '(' + data + ')',
        ast = esprima.parse(source, {
          range: true
        }),
        params = [],
        body;
      if (ast.type !== 'Program' || ast.body.length !== 1 || ast.body[0].type !== 'ExpressionStatement' || ast.body[0].expression.type !== 'ArrowFunctionExpression' && ast.body[0].expression.type !== 'FunctionExpression') {
        throw new Error('Failed to resolve function');
      }
      ast.body[0].expression.params.forEach(function (param) {
        params.push(param.name);
      });
      body = ast.body[0].expression.body.range;
      if (ast.body[0].expression.body.type === 'BlockStatement') {
        return new Function(params, source.slice(body[0] + 1, body[1] - 1));
      }
      return new Function(params, 'return ' + source.slice(body[0], body[1]));
    }
    function representJavascriptFunction(object ) {
      return object.toString();
    }
    function isFunction(object) {
      return Object.prototype.toString.call(object) === '[object Function]';
    }
    var _function = new Type('tag:yaml.org,2002:js/function', {
      kind: 'scalar',
      resolve: resolveJavascriptFunction,
      construct: constructJavascriptFunction,
      predicate: isFunction,
      represent: representJavascriptFunction
    });
    var Schema = schema;
    var default_full = Schema.DEFAULT = new Schema({
      include: [default_safe],
      explicit: [_undefined, regexp, _function]
    });
    var common$1 = common$6;
    var YAMLException$1 = exception;
    var Mark = mark;
    var DEFAULT_SAFE_SCHEMA$1 = default_safe;
    var DEFAULT_FULL_SCHEMA$1 = default_full;
    var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
    var CONTEXT_FLOW_IN = 1;
    var CONTEXT_FLOW_OUT = 2;
    var CONTEXT_BLOCK_IN = 3;
    var CONTEXT_BLOCK_OUT = 4;
    var CHOMPING_CLIP = 1;
    var CHOMPING_STRIP = 2;
    var CHOMPING_KEEP = 3;
    var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
    var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
    var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
    var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
    var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
    function _class(obj) {
      return Object.prototype.toString.call(obj);
    }
    function is_EOL(c) {
      return c === 0x0A  || c === 0x0D ;
    }
    function is_WHITE_SPACE(c) {
      return c === 0x09  || c === 0x20 ;
    }
    function is_WS_OR_EOL(c) {
      return c === 0x09  || c === 0x20  || c === 0x0A  || c === 0x0D ;
    }
    function is_FLOW_INDICATOR(c) {
      return c === 0x2C  || c === 0x5B  || c === 0x5D  || c === 0x7B  || c === 0x7D ;
    }
    function fromHexCode(c) {
      var lc;
      if (0x30  <= c && c <= 0x39 ) {
        return c - 0x30;
      }
      lc = c | 0x20;
      if (0x61  <= lc && lc <= 0x66 ) {
        return lc - 0x61 + 10;
      }
      return -1;
    }
    function escapedHexLen(c) {
      if (c === 0x78 ) {
        return 2;
      }
      if (c === 0x75 ) {
        return 4;
      }
      if (c === 0x55 ) {
        return 8;
      }
      return 0;
    }
    function fromDecimalCode(c) {
      if (0x30  <= c && c <= 0x39 ) {
        return c - 0x30;
      }
      return -1;
    }
    function simpleEscapeSequence(c) {
      return c === 0x30  ? '\x00' : c === 0x61  ? '\x07' : c === 0x62  ? '\x08' : c === 0x74  ? '\x09' : c === 0x09  ? '\x09' : c === 0x6E  ? '\x0A' : c === 0x76  ? '\x0B' : c === 0x66  ? '\x0C' : c === 0x72  ? '\x0D' : c === 0x65  ? '\x1B' : c === 0x20  ? ' ' : c === 0x22  ? '\x22' : c === 0x2F  ? '/' : c === 0x5C  ? '\x5C' : c === 0x4E  ? '\x85' : c === 0x5F  ? '\xA0' : c === 0x4C  ? "\u2028" : c === 0x50  ? "\u2029" : '';
    }
    function charFromCodepoint(c) {
      if (c <= 0xFFFF) {
        return String.fromCharCode(c);
      }
      return String.fromCharCode((c - 0x010000 >> 10) + 0xD800, (c - 0x010000 & 0x03FF) + 0xDC00);
    }
    var simpleEscapeCheck = new Array(256);
    var simpleEscapeMap = new Array(256);
    for (var i = 0; i < 256; i++) {
      simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
      simpleEscapeMap[i] = simpleEscapeSequence(i);
    }
    function State$1(input, options) {
      this.input = input;
      this.filename = options['filename'] || null;
      this.schema = options['schema'] || DEFAULT_FULL_SCHEMA$1;
      this.onWarning = options['onWarning'] || null;
      this.legacy = options['legacy'] || false;
      this.json = options['json'] || false;
      this.listener = options['listener'] || null;
      this.implicitTypes = this.schema.compiledImplicit;
      this.typeMap = this.schema.compiledTypeMap;
      this.length = input.length;
      this.position = 0;
      this.line = 0;
      this.lineStart = 0;
      this.lineIndent = 0;
      this.documents = [];
    }
    function generateError(state, message) {
      return new YAMLException$1(message, new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart));
    }
    function throwError(state, message) {
      throw generateError(state, message);
    }
    function throwWarning(state, message) {
      if (state.onWarning) {
        state.onWarning.call(null, generateError(state, message));
      }
    }
    var directiveHandlers = {
      YAML: function handleYamlDirective(state, name, args) {
        var match, major, minor;
        if (state.version !== null) {
          throwError(state, 'duplication of %YAML directive');
        }
        if (args.length !== 1) {
          throwError(state, 'YAML directive accepts exactly one argument');
        }
        match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
        if (match === null) {
          throwError(state, 'ill-formed argument of the YAML directive');
        }
        major = parseInt(match[1], 10);
        minor = parseInt(match[2], 10);
        if (major !== 1) {
          throwError(state, 'unacceptable YAML version of the document');
        }
        state.version = args[0];
        state.checkLineBreaks = minor < 2;
        if (minor !== 1 && minor !== 2) {
          throwWarning(state, 'unsupported YAML version of the document');
        }
      },
      TAG: function handleTagDirective(state, name, args) {
        var handle, prefix;
        if (args.length !== 2) {
          throwError(state, 'TAG directive accepts exactly two arguments');
        }
        handle = args[0];
        prefix = args[1];
        if (!PATTERN_TAG_HANDLE.test(handle)) {
          throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
        }
        if (_hasOwnProperty$1.call(state.tagMap, handle)) {
          throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
        }
        if (!PATTERN_TAG_URI.test(prefix)) {
          throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
        }
        state.tagMap[handle] = prefix;
      }
    };
    function captureSegment(state, start, end, checkJson) {
      var _position, _length, _character, _result;
      if (start < end) {
        _result = state.input.slice(start, end);
        if (checkJson) {
          for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
            _character = _result.charCodeAt(_position);
            if (!(_character === 0x09 || 0x20 <= _character && _character <= 0x10FFFF)) {
              throwError(state, 'expected valid JSON character');
            }
          }
        } else if (PATTERN_NON_PRINTABLE.test(_result)) {
          throwError(state, 'the stream contains non-printable characters');
        }
        state.result += _result;
      }
    }
    function mergeMappings(state, destination, source, overridableKeys) {
      var sourceKeys, key, index, quantity;
      if (!common$1.isObject(source)) {
        throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
      }
      sourceKeys = Object.keys(source);
      for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
        key = sourceKeys[index];
        if (!_hasOwnProperty$1.call(destination, key)) {
          destination[key] = source[key];
          overridableKeys[key] = true;
        }
      }
    }
    function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
      var index, quantity;
      if (Array.isArray(keyNode)) {
        keyNode = Array.prototype.slice.call(keyNode);
        for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
          if (Array.isArray(keyNode[index])) {
            throwError(state, 'nested arrays are not supported inside keys');
          }
          if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
            keyNode[index] = '[object Object]';
          }
        }
      }
      if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
        keyNode = '[object Object]';
      }
      keyNode = String(keyNode);
      if (_result === null) {
        _result = {};
      }
      if (keyTag === 'tag:yaml.org,2002:merge') {
        if (Array.isArray(valueNode)) {
          for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
            mergeMappings(state, _result, valueNode[index], overridableKeys);
          }
        } else {
          mergeMappings(state, _result, valueNode, overridableKeys);
        }
      } else {
        if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
          state.line = startLine || state.line;
          state.position = startPos || state.position;
          throwError(state, 'duplicated mapping key');
        }
        _result[keyNode] = valueNode;
        delete overridableKeys[keyNode];
      }
      return _result;
    }
    function readLineBreak(state) {
      var ch;
      ch = state.input.charCodeAt(state.position);
      if (ch === 0x0A ) {
        state.position++;
      } else if (ch === 0x0D ) {
        state.position++;
        if (state.input.charCodeAt(state.position) === 0x0A ) {
          state.position++;
        }
      } else {
        throwError(state, 'a line break is expected');
      }
      state.line += 1;
      state.lineStart = state.position;
    }
    function skipSeparationSpace(state, allowComments, checkIndent) {
      var lineBreaks = 0,
        ch = state.input.charCodeAt(state.position);
      while (ch !== 0) {
        while (is_WHITE_SPACE(ch)) {
          ch = state.input.charCodeAt(++state.position);
        }
        if (allowComments && ch === 0x23 ) {
          do {
            ch = state.input.charCodeAt(++state.position);
          } while (ch !== 0x0A  && ch !== 0x0D  && ch !== 0);
        }
        if (is_EOL(ch)) {
          readLineBreak(state);
          ch = state.input.charCodeAt(state.position);
          lineBreaks++;
          state.lineIndent = 0;
          while (ch === 0x20 ) {
            state.lineIndent++;
            ch = state.input.charCodeAt(++state.position);
          }
        } else {
          break;
        }
      }
      if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
        throwWarning(state, 'deficient indentation');
      }
      return lineBreaks;
    }
    function testDocumentSeparator(state) {
      var _position = state.position,
        ch;
      ch = state.input.charCodeAt(_position);
      if ((ch === 0x2D  || ch === 0x2E ) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
        _position += 3;
        ch = state.input.charCodeAt(_position);
        if (ch === 0 || is_WS_OR_EOL(ch)) {
          return true;
        }
      }
      return false;
    }
    function writeFoldedLines(state, count) {
      if (count === 1) {
        state.result += ' ';
      } else if (count > 1) {
        state.result += common$1.repeat('\n', count - 1);
      }
    }
    function readPlainScalar(state, nodeIndent, withinFlowCollection) {
      var preceding,
        following,
        captureStart,
        captureEnd,
        hasPendingContent,
        _line,
        _lineStart,
        _lineIndent,
        _kind = state.kind,
        _result = state.result,
        ch;
      ch = state.input.charCodeAt(state.position);
      if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 0x23  || ch === 0x26  || ch === 0x2A  || ch === 0x21  || ch === 0x7C  || ch === 0x3E  || ch === 0x27  || ch === 0x22  || ch === 0x25  || ch === 0x40  || ch === 0x60 ) {
        return false;
      }
      if (ch === 0x3F  || ch === 0x2D ) {
        following = state.input.charCodeAt(state.position + 1);
        if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
          return false;
        }
      }
      state.kind = 'scalar';
      state.result = '';
      captureStart = captureEnd = state.position;
      hasPendingContent = false;
      while (ch !== 0) {
        if (ch === 0x3A ) {
          following = state.input.charCodeAt(state.position + 1);
          if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
            break;
          }
        } else if (ch === 0x23 ) {
          preceding = state.input.charCodeAt(state.position - 1);
          if (is_WS_OR_EOL(preceding)) {
            break;
          }
        } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
          break;
        } else if (is_EOL(ch)) {
          _line = state.line;
          _lineStart = state.lineStart;
          _lineIndent = state.lineIndent;
          skipSeparationSpace(state, false, -1);
          if (state.lineIndent >= nodeIndent) {
            hasPendingContent = true;
            ch = state.input.charCodeAt(state.position);
            continue;
          } else {
            state.position = captureEnd;
            state.line = _line;
            state.lineStart = _lineStart;
            state.lineIndent = _lineIndent;
            break;
          }
        }
        if (hasPendingContent) {
          captureSegment(state, captureStart, captureEnd, false);
          writeFoldedLines(state, state.line - _line);
          captureStart = captureEnd = state.position;
          hasPendingContent = false;
        }
        if (!is_WHITE_SPACE(ch)) {
          captureEnd = state.position + 1;
        }
        ch = state.input.charCodeAt(++state.position);
      }
      captureSegment(state, captureStart, captureEnd, false);
      if (state.result) {
        return true;
      }
      state.kind = _kind;
      state.result = _result;
      return false;
    }
    function readSingleQuotedScalar(state, nodeIndent) {
      var ch, captureStart, captureEnd;
      ch = state.input.charCodeAt(state.position);
      if (ch !== 0x27 ) {
        return false;
      }
      state.kind = 'scalar';
      state.result = '';
      state.position++;
      captureStart = captureEnd = state.position;
      while ((ch = state.input.charCodeAt(state.position)) !== 0) {
        if (ch === 0x27 ) {
          captureSegment(state, captureStart, state.position, true);
          ch = state.input.charCodeAt(++state.position);
          if (ch === 0x27 ) {
            captureStart = state.position;
            state.position++;
            captureEnd = state.position;
          } else {
            return true;
          }
        } else if (is_EOL(ch)) {
          captureSegment(state, captureStart, captureEnd, true);
          writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
          captureStart = captureEnd = state.position;
        } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
          throwError(state, 'unexpected end of the document within a single quoted scalar');
        } else {
          state.position++;
          captureEnd = state.position;
        }
      }
      throwError(state, 'unexpected end of the stream within a single quoted scalar');
    }
    function readDoubleQuotedScalar(state, nodeIndent) {
      var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
      ch = state.input.charCodeAt(state.position);
      if (ch !== 0x22 ) {
        return false;
      }
      state.kind = 'scalar';
      state.result = '';
      state.position++;
      captureStart = captureEnd = state.position;
      while ((ch = state.input.charCodeAt(state.position)) !== 0) {
        if (ch === 0x22 ) {
          captureSegment(state, captureStart, state.position, true);
          state.position++;
          return true;
        } else if (ch === 0x5C ) {
          captureSegment(state, captureStart, state.position, true);
          ch = state.input.charCodeAt(++state.position);
          if (is_EOL(ch)) {
            skipSeparationSpace(state, false, nodeIndent);
          } else if (ch < 256 && simpleEscapeCheck[ch]) {
            state.result += simpleEscapeMap[ch];
            state.position++;
          } else if ((tmp = escapedHexLen(ch)) > 0) {
            hexLength = tmp;
            hexResult = 0;
            for (; hexLength > 0; hexLength--) {
              ch = state.input.charCodeAt(++state.position);
              if ((tmp = fromHexCode(ch)) >= 0) {
                hexResult = (hexResult << 4) + tmp;
              } else {
                throwError(state, 'expected hexadecimal character');
              }
            }
            state.result += charFromCodepoint(hexResult);
            state.position++;
          } else {
            throwError(state, 'unknown escape sequence');
          }
          captureStart = captureEnd = state.position;
        } else if (is_EOL(ch)) {
          captureSegment(state, captureStart, captureEnd, true);
          writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
          captureStart = captureEnd = state.position;
        } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
          throwError(state, 'unexpected end of the document within a double quoted scalar');
        } else {
          state.position++;
          captureEnd = state.position;
        }
      }
      throwError(state, 'unexpected end of the stream within a double quoted scalar');
    }
    function readFlowCollection(state, nodeIndent) {
      var readNext = true,
        _line,
        _tag = state.tag,
        _result,
        _anchor = state.anchor,
        following,
        terminator,
        isPair,
        isExplicitPair,
        isMapping,
        overridableKeys = {},
        keyNode,
        keyTag,
        valueNode,
        ch;
      ch = state.input.charCodeAt(state.position);
      if (ch === 0x5B ) {
        terminator = 0x5D;
        isMapping = false;
        _result = [];
      } else if (ch === 0x7B ) {
        terminator = 0x7D;
        isMapping = true;
        _result = {};
      } else {
        return false;
      }
      if (state.anchor !== null) {
        state.anchorMap[state.anchor] = _result;
      }
      ch = state.input.charCodeAt(++state.position);
      while (ch !== 0) {
        skipSeparationSpace(state, true, nodeIndent);
        ch = state.input.charCodeAt(state.position);
        if (ch === terminator) {
          state.position++;
          state.tag = _tag;
          state.anchor = _anchor;
          state.kind = isMapping ? 'mapping' : 'sequence';
          state.result = _result;
          return true;
        } else if (!readNext) {
          throwError(state, 'missed comma between flow collection entries');
        }
        keyTag = keyNode = valueNode = null;
        isPair = isExplicitPair = false;
        if (ch === 0x3F ) {
          following = state.input.charCodeAt(state.position + 1);
          if (is_WS_OR_EOL(following)) {
            isPair = isExplicitPair = true;
            state.position++;
            skipSeparationSpace(state, true, nodeIndent);
          }
        }
        _line = state.line;
        composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
        keyTag = state.tag;
        keyNode = state.result;
        skipSeparationSpace(state, true, nodeIndent);
        ch = state.input.charCodeAt(state.position);
        if ((isExplicitPair || state.line === _line) && ch === 0x3A ) {
          isPair = true;
          ch = state.input.charCodeAt(++state.position);
          skipSeparationSpace(state, true, nodeIndent);
          composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
          valueNode = state.result;
        }
        if (isMapping) {
          storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
        } else if (isPair) {
          _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
        } else {
          _result.push(keyNode);
        }
        skipSeparationSpace(state, true, nodeIndent);
        ch = state.input.charCodeAt(state.position);
        if (ch === 0x2C ) {
          readNext = true;
          ch = state.input.charCodeAt(++state.position);
        } else {
          readNext = false;
        }
      }
      throwError(state, 'unexpected end of the stream within a flow collection');
    }
    function readBlockScalar(state, nodeIndent) {
      var captureStart,
        folding,
        chomping = CHOMPING_CLIP,
        didReadContent = false,
        detectedIndent = false,
        textIndent = nodeIndent,
        emptyLines = 0,
        atMoreIndented = false,
        tmp,
        ch;
      ch = state.input.charCodeAt(state.position);
      if (ch === 0x7C ) {
        folding = false;
      } else if (ch === 0x3E ) {
        folding = true;
      } else {
        return false;
      }
      state.kind = 'scalar';
      state.result = '';
      while (ch !== 0) {
        ch = state.input.charCodeAt(++state.position);
        if (ch === 0x2B  || ch === 0x2D ) {
          if (CHOMPING_CLIP === chomping) {
            chomping = ch === 0x2B  ? CHOMPING_KEEP : CHOMPING_STRIP;
          } else {
            throwError(state, 'repeat of a chomping mode identifier');
          }
        } else if ((tmp = fromDecimalCode(ch)) >= 0) {
          if (tmp === 0) {
            throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
          } else if (!detectedIndent) {
            textIndent = nodeIndent + tmp - 1;
            detectedIndent = true;
          } else {
            throwError(state, 'repeat of an indentation width identifier');
          }
        } else {
          break;
        }
      }
      if (is_WHITE_SPACE(ch)) {
        do {
          ch = state.input.charCodeAt(++state.position);
        } while (is_WHITE_SPACE(ch));
        if (ch === 0x23 ) {
          do {
            ch = state.input.charCodeAt(++state.position);
          } while (!is_EOL(ch) && ch !== 0);
        }
      }
      while (ch !== 0) {
        readLineBreak(state);
        state.lineIndent = 0;
        ch = state.input.charCodeAt(state.position);
        while ((!detectedIndent || state.lineIndent < textIndent) && ch === 0x20 ) {
          state.lineIndent++;
          ch = state.input.charCodeAt(++state.position);
        }
        if (!detectedIndent && state.lineIndent > textIndent) {
          textIndent = state.lineIndent;
        }
        if (is_EOL(ch)) {
          emptyLines++;
          continue;
        }
        if (state.lineIndent < textIndent) {
          if (chomping === CHOMPING_KEEP) {
            state.result += common$1.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
          } else if (chomping === CHOMPING_CLIP) {
            if (didReadContent) {
              state.result += '\n';
            }
          }
          break;
        }
        if (folding) {
          if (is_WHITE_SPACE(ch)) {
            atMoreIndented = true;
            state.result += common$1.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
          } else if (atMoreIndented) {
            atMoreIndented = false;
            state.result += common$1.repeat('\n', emptyLines + 1);
          } else if (emptyLines === 0) {
            if (didReadContent) {
              state.result += ' ';
            }
          } else {
            state.result += common$1.repeat('\n', emptyLines);
          }
        } else {
          state.result += common$1.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
        }
        didReadContent = true;
        detectedIndent = true;
        emptyLines = 0;
        captureStart = state.position;
        while (!is_EOL(ch) && ch !== 0) {
          ch = state.input.charCodeAt(++state.position);
        }
        captureSegment(state, captureStart, state.position, false);
      }
      return true;
    }
    function readBlockSequence(state, nodeIndent) {
      var _line,
        _tag = state.tag,
        _anchor = state.anchor,
        _result = [],
        following,
        detected = false,
        ch;
      if (state.anchor !== null) {
        state.anchorMap[state.anchor] = _result;
      }
      ch = state.input.charCodeAt(state.position);
      while (ch !== 0) {
        if (ch !== 0x2D ) {
          break;
        }
        following = state.input.charCodeAt(state.position + 1);
        if (!is_WS_OR_EOL(following)) {
          break;
        }
        detected = true;
        state.position++;
        if (skipSeparationSpace(state, true, -1)) {
          if (state.lineIndent <= nodeIndent) {
            _result.push(null);
            ch = state.input.charCodeAt(state.position);
            continue;
          }
        }
        _line = state.line;
        composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
        _result.push(state.result);
        skipSeparationSpace(state, true, -1);
        ch = state.input.charCodeAt(state.position);
        if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
          throwError(state, 'bad indentation of a sequence entry');
        } else if (state.lineIndent < nodeIndent) {
          break;
        }
      }
      if (detected) {
        state.tag = _tag;
        state.anchor = _anchor;
        state.kind = 'sequence';
        state.result = _result;
        return true;
      }
      return false;
    }
    function readBlockMapping(state, nodeIndent, flowIndent) {
      var following,
        allowCompact,
        _line,
        _pos,
        _tag = state.tag,
        _anchor = state.anchor,
        _result = {},
        overridableKeys = {},
        keyTag = null,
        keyNode = null,
        valueNode = null,
        atExplicitKey = false,
        detected = false,
        ch;
      if (state.anchor !== null) {
        state.anchorMap[state.anchor] = _result;
      }
      ch = state.input.charCodeAt(state.position);
      while (ch !== 0) {
        following = state.input.charCodeAt(state.position + 1);
        _line = state.line;
        _pos = state.position;
        if ((ch === 0x3F  || ch === 0x3A ) && is_WS_OR_EOL(following)) {
          if (ch === 0x3F ) {
            if (atExplicitKey) {
              storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
              keyTag = keyNode = valueNode = null;
            }
            detected = true;
            atExplicitKey = true;
            allowCompact = true;
          } else if (atExplicitKey) {
            atExplicitKey = false;
            allowCompact = true;
          } else {
            throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
          }
          state.position += 1;
          ch = following;
        } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
          if (state.line === _line) {
            ch = state.input.charCodeAt(state.position);
            while (is_WHITE_SPACE(ch)) {
              ch = state.input.charCodeAt(++state.position);
            }
            if (ch === 0x3A ) {
              ch = state.input.charCodeAt(++state.position);
              if (!is_WS_OR_EOL(ch)) {
                throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
              }
              if (atExplicitKey) {
                storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
                keyTag = keyNode = valueNode = null;
              }
              detected = true;
              atExplicitKey = false;
              allowCompact = false;
              keyTag = state.tag;
              keyNode = state.result;
            } else if (detected) {
              throwError(state, 'can not read an implicit mapping pair; a colon is missed');
            } else {
              state.tag = _tag;
              state.anchor = _anchor;
              return true;
            }
          } else if (detected) {
            throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
          } else {
            state.tag = _tag;
            state.anchor = _anchor;
            return true;
          }
        } else {
          break;
        }
        if (state.line === _line || state.lineIndent > nodeIndent) {
          if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
            if (atExplicitKey) {
              keyNode = state.result;
            } else {
              valueNode = state.result;
            }
          }
          if (!atExplicitKey) {
            storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
            keyTag = keyNode = valueNode = null;
          }
          skipSeparationSpace(state, true, -1);
          ch = state.input.charCodeAt(state.position);
        }
        if (state.lineIndent > nodeIndent && ch !== 0) {
          throwError(state, 'bad indentation of a mapping entry');
        } else if (state.lineIndent < nodeIndent) {
          break;
        }
      }
      if (atExplicitKey) {
        storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
      }
      if (detected) {
        state.tag = _tag;
        state.anchor = _anchor;
        state.kind = 'mapping';
        state.result = _result;
      }
      return detected;
    }
    function readTagProperty(state) {
      var _position,
        isVerbatim = false,
        isNamed = false,
        tagHandle,
        tagName,
        ch;
      ch = state.input.charCodeAt(state.position);
      if (ch !== 0x21 ) return false;
      if (state.tag !== null) {
        throwError(state, 'duplication of a tag property');
      }
      ch = state.input.charCodeAt(++state.position);
      if (ch === 0x3C ) {
        isVerbatim = true;
        ch = state.input.charCodeAt(++state.position);
      } else if (ch === 0x21 ) {
        isNamed = true;
        tagHandle = '!!';
        ch = state.input.charCodeAt(++state.position);
      } else {
        tagHandle = '!';
      }
      _position = state.position;
      if (isVerbatim) {
        do {
          ch = state.input.charCodeAt(++state.position);
        } while (ch !== 0 && ch !== 0x3E );
        if (state.position < state.length) {
          tagName = state.input.slice(_position, state.position);
          ch = state.input.charCodeAt(++state.position);
        } else {
          throwError(state, 'unexpected end of the stream within a verbatim tag');
        }
      } else {
        while (ch !== 0 && !is_WS_OR_EOL(ch)) {
          if (ch === 0x21 ) {
            if (!isNamed) {
              tagHandle = state.input.slice(_position - 1, state.position + 1);
              if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
                throwError(state, 'named tag handle cannot contain such characters');
              }
              isNamed = true;
              _position = state.position + 1;
            } else {
              throwError(state, 'tag suffix cannot contain exclamation marks');
            }
          }
          ch = state.input.charCodeAt(++state.position);
        }
        tagName = state.input.slice(_position, state.position);
        if (PATTERN_FLOW_INDICATORS.test(tagName)) {
          throwError(state, 'tag suffix cannot contain flow indicator characters');
        }
      }
      if (tagName && !PATTERN_TAG_URI.test(tagName)) {
        throwError(state, 'tag name cannot contain such characters: ' + tagName);
      }
      if (isVerbatim) {
        state.tag = tagName;
      } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
        state.tag = state.tagMap[tagHandle] + tagName;
      } else if (tagHandle === '!') {
        state.tag = '!' + tagName;
      } else if (tagHandle === '!!') {
        state.tag = 'tag:yaml.org,2002:' + tagName;
      } else {
        throwError(state, 'undeclared tag handle "' + tagHandle + '"');
      }
      return true;
    }
    function readAnchorProperty(state) {
      var _position, ch;
      ch = state.input.charCodeAt(state.position);
      if (ch !== 0x26 ) return false;
      if (state.anchor !== null) {
        throwError(state, 'duplication of an anchor property');
      }
      ch = state.input.charCodeAt(++state.position);
      _position = state.position;
      while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
        ch = state.input.charCodeAt(++state.position);
      }
      if (state.position === _position) {
        throwError(state, 'name of an anchor node must contain at least one character');
      }
      state.anchor = state.input.slice(_position, state.position);
      return true;
    }
    function readAlias(state) {
      var _position, alias, ch;
      ch = state.input.charCodeAt(state.position);
      if (ch !== 0x2A ) return false;
      ch = state.input.charCodeAt(++state.position);
      _position = state.position;
      while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
        ch = state.input.charCodeAt(++state.position);
      }
      if (state.position === _position) {
        throwError(state, 'name of an alias node must contain at least one character');
      }
      alias = state.input.slice(_position, state.position);
      if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
        throwError(state, 'unidentified alias "' + alias + '"');
      }
      state.result = state.anchorMap[alias];
      skipSeparationSpace(state, true, -1);
      return true;
    }
    function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
      var allowBlockStyles,
        allowBlockScalars,
        allowBlockCollections,
        indentStatus = 1,
        atNewLine = false,
        hasContent = false,
        typeIndex,
        typeQuantity,
        type,
        flowIndent,
        blockIndent;
      if (state.listener !== null) {
        state.listener('open', state);
      }
      state.tag = null;
      state.anchor = null;
      state.kind = null;
      state.result = null;
      allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
      if (allowToSeek) {
        if (skipSeparationSpace(state, true, -1)) {
          atNewLine = true;
          if (state.lineIndent > parentIndent) {
            indentStatus = 1;
          } else if (state.lineIndent === parentIndent) {
            indentStatus = 0;
          } else if (state.lineIndent < parentIndent) {
            indentStatus = -1;
          }
        }
      }
      if (indentStatus === 1) {
        while (readTagProperty(state) || readAnchorProperty(state)) {
          if (skipSeparationSpace(state, true, -1)) {
            atNewLine = true;
            allowBlockCollections = allowBlockStyles;
            if (state.lineIndent > parentIndent) {
              indentStatus = 1;
            } else if (state.lineIndent === parentIndent) {
              indentStatus = 0;
            } else if (state.lineIndent < parentIndent) {
              indentStatus = -1;
            }
          } else {
            allowBlockCollections = false;
          }
        }
      }
      if (allowBlockCollections) {
        allowBlockCollections = atNewLine || allowCompact;
      }
      if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
        if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
          flowIndent = parentIndent;
        } else {
          flowIndent = parentIndent + 1;
        }
        blockIndent = state.position - state.lineStart;
        if (indentStatus === 1) {
          if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
            hasContent = true;
          } else {
            if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
              hasContent = true;
            } else if (readAlias(state)) {
              hasContent = true;
              if (state.tag !== null || state.anchor !== null) {
                throwError(state, 'alias node should not have any properties');
              }
            } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
              hasContent = true;
              if (state.tag === null) {
                state.tag = '?';
              }
            }
            if (state.anchor !== null) {
              state.anchorMap[state.anchor] = state.result;
            }
          }
        } else if (indentStatus === 0) {
          hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
        }
      }
      if (state.tag !== null && state.tag !== '!') {
        if (state.tag === '?') {
          if (state.result !== null && state.kind !== 'scalar') {
            throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
          }
          for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
            type = state.implicitTypes[typeIndex];
            if (type.resolve(state.result)) {
              state.result = type.construct(state.result);
              state.tag = type.tag;
              if (state.anchor !== null) {
                state.anchorMap[state.anchor] = state.result;
              }
              break;
            }
          }
        } else if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
          type = state.typeMap[state.kind || 'fallback'][state.tag];
          if (state.result !== null && type.kind !== state.kind) {
            throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
          }
          if (!type.resolve(state.result)) {
            throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
          } else {
            state.result = type.construct(state.result);
            if (state.anchor !== null) {
              state.anchorMap[state.anchor] = state.result;
            }
          }
        } else {
          throwError(state, 'unknown tag !<' + state.tag + '>');
        }
      }
      if (state.listener !== null) {
        state.listener('close', state);
      }
      return state.tag !== null || state.anchor !== null || hasContent;
    }
    function readDocument(state) {
      var documentStart = state.position,
        _position,
        directiveName,
        directiveArgs,
        hasDirectives = false,
        ch;
      state.version = null;
      state.checkLineBreaks = state.legacy;
      state.tagMap = {};
      state.anchorMap = {};
      while ((ch = state.input.charCodeAt(state.position)) !== 0) {
        skipSeparationSpace(state, true, -1);
        ch = state.input.charCodeAt(state.position);
        if (state.lineIndent > 0 || ch !== 0x25 ) {
          break;
        }
        hasDirectives = true;
        ch = state.input.charCodeAt(++state.position);
        _position = state.position;
        while (ch !== 0 && !is_WS_OR_EOL(ch)) {
          ch = state.input.charCodeAt(++state.position);
        }
        directiveName = state.input.slice(_position, state.position);
        directiveArgs = [];
        if (directiveName.length < 1) {
          throwError(state, 'directive name must not be less than one character in length');
        }
        while (ch !== 0) {
          while (is_WHITE_SPACE(ch)) {
            ch = state.input.charCodeAt(++state.position);
          }
          if (ch === 0x23 ) {
            do {
              ch = state.input.charCodeAt(++state.position);
            } while (ch !== 0 && !is_EOL(ch));
            break;
          }
          if (is_EOL(ch)) break;
          _position = state.position;
          while (ch !== 0 && !is_WS_OR_EOL(ch)) {
            ch = state.input.charCodeAt(++state.position);
          }
          directiveArgs.push(state.input.slice(_position, state.position));
        }
        if (ch !== 0) readLineBreak(state);
        if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
          directiveHandlers[directiveName](state, directiveName, directiveArgs);
        } else {
          throwWarning(state, 'unknown document directive "' + directiveName + '"');
        }
      }
      skipSeparationSpace(state, true, -1);
      if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 0x2D  && state.input.charCodeAt(state.position + 1) === 0x2D  && state.input.charCodeAt(state.position + 2) === 0x2D ) {
        state.position += 3;
        skipSeparationSpace(state, true, -1);
      } else if (hasDirectives) {
        throwError(state, 'directives end mark is expected');
      }
      composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
      skipSeparationSpace(state, true, -1);
      if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
        throwWarning(state, 'non-ASCII line breaks are interpreted as content');
      }
      state.documents.push(state.result);
      if (state.position === state.lineStart && testDocumentSeparator(state)) {
        if (state.input.charCodeAt(state.position) === 0x2E ) {
          state.position += 3;
          skipSeparationSpace(state, true, -1);
        }
        return;
      }
      if (state.position < state.length - 1) {
        throwError(state, 'end of the stream or a document separator is expected');
      } else {
        return;
      }
    }
    function loadDocuments(input, options) {
      input = String(input);
      options = options || {};
      if (input.length !== 0) {
        if (input.charCodeAt(input.length - 1) !== 0x0A  && input.charCodeAt(input.length - 1) !== 0x0D ) {
          input += '\n';
        }
        if (input.charCodeAt(0) === 0xFEFF) {
          input = input.slice(1);
        }
      }
      var state = new State$1(input, options);
      var nullpos = input.indexOf('\0');
      if (nullpos !== -1) {
        state.position = nullpos;
        throwError(state, 'null byte is not allowed in input');
      }
      state.input += '\0';
      while (state.input.charCodeAt(state.position) === 0x20 ) {
        state.lineIndent += 1;
        state.position += 1;
      }
      while (state.position < state.length - 1) {
        readDocument(state);
      }
      return state.documents;
    }
    function loadAll(input, iterator, options) {
      if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
        options = iterator;
        iterator = null;
      }
      var documents = loadDocuments(input, options);
      if (typeof iterator !== 'function') {
        return documents;
      }
      for (var index = 0, length = documents.length; index < length; index += 1) {
        iterator(documents[index]);
      }
    }
    function load(input, options) {
      var documents = loadDocuments(input, options);
      if (documents.length === 0) {
        return undefined;
      } else if (documents.length === 1) {
        return documents[0];
      }
      throw new YAMLException$1('expected a single document in the stream, but found more');
    }
    function safeLoadAll(input, iterator, options) {
      if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') {
        options = iterator;
        iterator = null;
      }
      return loadAll(input, iterator, common$1.extend({
        schema: DEFAULT_SAFE_SCHEMA$1
      }, options));
    }
    function safeLoad(input, options) {
      return load(input, common$1.extend({
        schema: DEFAULT_SAFE_SCHEMA$1
      }, options));
    }
    loader$1.loadAll = loadAll;
    loader$1.load = load;
    loader$1.safeLoadAll = safeLoadAll;
    loader$1.safeLoad = safeLoad;
    var dumper$1 = {};
    var common = common$6;
    var YAMLException = exception;
    var DEFAULT_FULL_SCHEMA = default_full;
    var DEFAULT_SAFE_SCHEMA = default_safe;
    var _toString = Object.prototype.toString;
    var _hasOwnProperty = Object.prototype.hasOwnProperty;
    var CHAR_TAB = 0x09;
    var CHAR_LINE_FEED = 0x0A;
    var CHAR_CARRIAGE_RETURN = 0x0D;
    var CHAR_SPACE = 0x20;
    var CHAR_EXCLAMATION = 0x21;
    var CHAR_DOUBLE_QUOTE = 0x22;
    var CHAR_SHARP = 0x23;
    var CHAR_PERCENT = 0x25;
    var CHAR_AMPERSAND = 0x26;
    var CHAR_SINGLE_QUOTE = 0x27;
    var CHAR_ASTERISK = 0x2A;
    var CHAR_COMMA = 0x2C;
    var CHAR_MINUS = 0x2D;
    var CHAR_COLON = 0x3A;
    var CHAR_EQUALS = 0x3D;
    var CHAR_GREATER_THAN = 0x3E;
    var CHAR_QUESTION = 0x3F;
    var CHAR_COMMERCIAL_AT = 0x40;
    var CHAR_LEFT_SQUARE_BRACKET = 0x5B;
    var CHAR_RIGHT_SQUARE_BRACKET = 0x5D;
    var CHAR_GRAVE_ACCENT = 0x60;
    var CHAR_LEFT_CURLY_BRACKET = 0x7B;
    var CHAR_VERTICAL_LINE = 0x7C;
    var CHAR_RIGHT_CURLY_BRACKET = 0x7D;
    var ESCAPE_SEQUENCES = {};
    ESCAPE_SEQUENCES[0x00] = '\\0';
    ESCAPE_SEQUENCES[0x07] = '\\a';
    ESCAPE_SEQUENCES[0x08] = '\\b';
    ESCAPE_SEQUENCES[0x09] = '\\t';
    ESCAPE_SEQUENCES[0x0A] = '\\n';
    ESCAPE_SEQUENCES[0x0B] = '\\v';
    ESCAPE_SEQUENCES[0x0C] = '\\f';
    ESCAPE_SEQUENCES[0x0D] = '\\r';
    ESCAPE_SEQUENCES[0x1B] = '\\e';
    ESCAPE_SEQUENCES[0x22] = '\\"';
    ESCAPE_SEQUENCES[0x5C] = '\\\\';
    ESCAPE_SEQUENCES[0x85] = '\\N';
    ESCAPE_SEQUENCES[0xA0] = '\\_';
    ESCAPE_SEQUENCES[0x2028] = '\\L';
    ESCAPE_SEQUENCES[0x2029] = '\\P';
    var DEPRECATED_BOOLEANS_SYNTAX = ['y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'];
    function compileStyleMap(schema, map) {
      var result, keys, index, length, tag, style, type;
      if (map === null) return {};
      result = {};
      keys = Object.keys(map);
      for (index = 0, length = keys.length; index < length; index += 1) {
        tag = keys[index];
        style = String(map[tag]);
        if (tag.slice(0, 2) === '!!') {
          tag = 'tag:yaml.org,2002:' + tag.slice(2);
        }
        type = schema.compiledTypeMap['fallback'][tag];
        if (type && _hasOwnProperty.call(type.styleAliases, style)) {
          style = type.styleAliases[style];
        }
        result[tag] = style;
      }
      return result;
    }
    function encodeHex(character) {
      var string, handle, length;
      string = character.toString(16).toUpperCase();
      if (character <= 0xFF) {
        handle = 'x';
        length = 2;
      } else if (character <= 0xFFFF) {
        handle = 'u';
        length = 4;
      } else if (character <= 0xFFFFFFFF) {
        handle = 'U';
        length = 8;
      } else {
        throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
      }
      return '\\' + handle + common.repeat('0', length - string.length) + string;
    }
    function State(options) {
      this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
      this.indent = Math.max(1, options['indent'] || 2);
      this.noArrayIndent = options['noArrayIndent'] || false;
      this.skipInvalid = options['skipInvalid'] || false;
      this.flowLevel = common.isNothing(options['flowLevel']) ? -1 : options['flowLevel'];
      this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
      this.sortKeys = options['sortKeys'] || false;
      this.lineWidth = options['lineWidth'] || 80;
      this.noRefs = options['noRefs'] || false;
      this.noCompatMode = options['noCompatMode'] || false;
      this.condenseFlow = options['condenseFlow'] || false;
      this.implicitTypes = this.schema.compiledImplicit;
      this.explicitTypes = this.schema.compiledExplicit;
      this.tag = null;
      this.result = '';
      this.duplicates = [];
      this.usedDuplicates = null;
    }
    function indentString(string, spaces) {
      var ind = common.repeat(' ', spaces),
        position = 0,
        next = -1,
        result = '',
        line,
        length = string.length;
      while (position < length) {
        next = string.indexOf('\n', position);
        if (next === -1) {
          line = string.slice(position);
          position = length;
        } else {
          line = string.slice(position, next + 1);
          position = next + 1;
        }
        if (line.length && line !== '\n') result += ind;
        result += line;
      }
      return result;
    }
    function generateNextLine(state, level) {
      return '\n' + common.repeat(' ', state.indent * level);
    }
    function testImplicitResolving(state, str) {
      var index, length, type;
      for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
        type = state.implicitTypes[index];
        if (type.resolve(str)) {
          return true;
        }
      }
      return false;
    }
    function isWhitespace(c) {
      return c === CHAR_SPACE || c === CHAR_TAB;
    }
    function isPrintable(c) {
      return 0x00020 <= c && c <= 0x00007E || 0x000A1 <= c && c <= 0x00D7FF && c !== 0x2028 && c !== 0x2029 || 0x0E000 <= c && c <= 0x00FFFD && c !== 0xFEFF  || 0x10000 <= c && c <= 0x10FFFF;
    }
    function isNsChar(c) {
      return isPrintable(c) && !isWhitespace(c)
      && c !== 0xFEFF
      && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
    }
    function isPlainSafe(c, prev) {
      return isPrintable(c) && c !== 0xFEFF
      && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET
      && c !== CHAR_COLON && (c !== CHAR_SHARP || prev && isNsChar(prev));
    }
    function isPlainSafeFirst(c) {
      return isPrintable(c) && c !== 0xFEFF && !isWhitespace(c)
      && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET
      && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE
      && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
    }
    function needIndentIndicator(string) {
      var leadingSpaceRe = /^\n* /;
      return leadingSpaceRe.test(string);
    }
    var STYLE_PLAIN = 1,
      STYLE_SINGLE = 2,
      STYLE_LITERAL = 3,
      STYLE_FOLDED = 4,
      STYLE_DOUBLE = 5;
    function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
      var i;
      var char, prev_char;
      var hasLineBreak = false;
      var hasFoldableLine = false;
      var shouldTrackWidth = lineWidth !== -1;
      var previousLineBreak = -1;
      var plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1));
      if (singleLineOnly) {
        for (i = 0; i < string.length; i++) {
          char = string.charCodeAt(i);
          if (!isPrintable(char)) {
            return STYLE_DOUBLE;
          }
          prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
          plain = plain && isPlainSafe(char, prev_char);
        }
      } else {
        for (i = 0; i < string.length; i++) {
          char = string.charCodeAt(i);
          if (char === CHAR_LINE_FEED) {
            hasLineBreak = true;
            if (shouldTrackWidth) {
              hasFoldableLine = hasFoldableLine ||
              i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== ' ';
              previousLineBreak = i;
            }
          } else if (!isPrintable(char)) {
            return STYLE_DOUBLE;
          }
          prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
          plain = plain && isPlainSafe(char, prev_char);
        }
        hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== ' ';
      }
      if (!hasLineBreak && !hasFoldableLine) {
        return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE;
      }
      if (indentPerLevel > 9 && needIndentIndicator(string)) {
        return STYLE_DOUBLE;
      }
      return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
    }
    function writeScalar(state, string, level, iskey) {
      state.dump = function () {
        if (string.length === 0) {
          return "''";
        }
        if (!state.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
          return "'" + string + "'";
        }
        var indent = state.indent * Math.max(1, level);
        var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
        var singleLineOnly = iskey
        || state.flowLevel > -1 && level >= state.flowLevel;
        function testAmbiguity(string) {
          return testImplicitResolving(state, string);
        }
        switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
          case STYLE_PLAIN:
            return string;
          case STYLE_SINGLE:
            return "'" + string.replace(/'/g, "''") + "'";
          case STYLE_LITERAL:
            return '|' + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
          case STYLE_FOLDED:
            return '>' + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
          case STYLE_DOUBLE:
            return '"' + escapeString(string) + '"';
          default:
            throw new YAMLException('impossible error: invalid scalar style');
        }
      }();
    }
    function blockHeader(string, indentPerLevel) {
      var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
      var clip = string[string.length - 1] === '\n';
      var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
      var chomp = keep ? '+' : clip ? '' : '-';
      return indentIndicator + chomp + '\n';
    }
    function dropEndingNewline(string) {
      return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
    }
    function foldString(string, width) {
      var lineRe = /(\n+)([^\n]*)/g;
      var result = function () {
        var nextLF = string.indexOf('\n');
        nextLF = nextLF !== -1 ? nextLF : string.length;
        lineRe.lastIndex = nextLF;
        return foldLine(string.slice(0, nextLF), width);
      }();
      var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
      var moreIndented;
      var match;
      while (match = lineRe.exec(string)) {
        var prefix = match[1],
          line = match[2];
        moreIndented = line[0] === ' ';
        result += prefix + (!prevMoreIndented && !moreIndented && line !== '' ? '\n' : '') + foldLine(line, width);
        prevMoreIndented = moreIndented;
      }
      return result;
    }
    function foldLine(line, width) {
      if (line === '' || line[0] === ' ') return line;
      var breakRe = / [^ ]/g;
      var match;
      var start = 0,
        end,
        curr = 0,
        next = 0;
      var result = '';
      while (match = breakRe.exec(line)) {
        next = match.index;
        if (next - start > width) {
          end = curr > start ? curr : next;
          result += '\n' + line.slice(start, end);
          start = end + 1;
        }
        curr = next;
      }
      result += '\n';
      if (line.length - start > width && curr > start) {
        result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
      } else {
        result += line.slice(start);
      }
      return result.slice(1);
    }
    function escapeString(string) {
      var result = '';
      var char, nextChar;
      var escapeSeq;
      for (var i = 0; i < string.length; i++) {
        char = string.charCodeAt(i);
        if (char >= 0xD800 && char <= 0xDBFF ) {
          nextChar = string.charCodeAt(i + 1);
          if (nextChar >= 0xDC00 && nextChar <= 0xDFFF ) {
            result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000);
            i++;
            continue;
          }
        }
        escapeSeq = ESCAPE_SEQUENCES[char];
        result += !escapeSeq && isPrintable(char) ? string[i] : escapeSeq || encodeHex(char);
      }
      return result;
    }
    function writeFlowSequence(state, level, object) {
      var _result = '',
        _tag = state.tag,
        index,
        length;
      for (index = 0, length = object.length; index < length; index += 1) {
        if (writeNode(state, level, object[index], false, false)) {
          if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : '');
          _result += state.dump;
        }
      }
      state.tag = _tag;
      state.dump = '[' + _result + ']';
    }
    function writeBlockSequence(state, level, object, compact) {
      var _result = '',
        _tag = state.tag,
        index,
        length;
      for (index = 0, length = object.length; index < length; index += 1) {
        if (writeNode(state, level + 1, object[index], true, true)) {
          if (!compact || index !== 0) {
            _result += generateNextLine(state, level);
          }
          if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
            _result += '-';
          } else {
            _result += '- ';
          }
          _result += state.dump;
        }
      }
      state.tag = _tag;
      state.dump = _result || '[]';
    }
    function writeFlowMapping(state, level, object) {
      var _result = '',
        _tag = state.tag,
        objectKeyList = Object.keys(object),
        index,
        length,
        objectKey,
        objectValue,
        pairBuffer;
      for (index = 0, length = objectKeyList.length; index < length; index += 1) {
        pairBuffer = '';
        if (index !== 0) pairBuffer += ', ';
        if (state.condenseFlow) pairBuffer += '"';
        objectKey = objectKeyList[index];
        objectValue = object[objectKey];
        if (!writeNode(state, level, objectKey, false, false)) {
          continue;
        }
        if (state.dump.length > 1024) pairBuffer += '? ';
        pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
        if (!writeNode(state, level, objectValue, false, false)) {
          continue;
        }
        pairBuffer += state.dump;
        _result += pairBuffer;
      }
      state.tag = _tag;
      state.dump = '{' + _result + '}';
    }
    function writeBlockMapping(state, level, object, compact) {
      var _result = '',
        _tag = state.tag,
        objectKeyList = Object.keys(object),
        index,
        length,
        objectKey,
        objectValue,
        explicitPair,
        pairBuffer;
      if (state.sortKeys === true) {
        objectKeyList.sort();
      } else if (typeof state.sortKeys === 'function') {
        objectKeyList.sort(state.sortKeys);
      } else if (state.sortKeys) {
        throw new YAMLException('sortKeys must be a boolean or a function');
      }
      for (index = 0, length = objectKeyList.length; index < length; index += 1) {
        pairBuffer = '';
        if (!compact || index !== 0) {
          pairBuffer += generateNextLine(state, level);
        }
        objectKey = objectKeyList[index];
        objectValue = object[objectKey];
        if (!writeNode(state, level + 1, objectKey, true, true, true)) {
          continue;
        }
        explicitPair = state.tag !== null && state.tag !== '?' || state.dump && state.dump.length > 1024;
        if (explicitPair) {
          if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
            pairBuffer += '?';
          } else {
            pairBuffer += '? ';
          }
        }
        pairBuffer += state.dump;
        if (explicitPair) {
          pairBuffer += generateNextLine(state, level);
        }
        if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
          continue;
        }
        if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
          pairBuffer += ':';
        } else {
          pairBuffer += ': ';
        }
        pairBuffer += state.dump;
        _result += pairBuffer;
      }
      state.tag = _tag;
      state.dump = _result || '{}';
    }
    function detectType(state, object, explicit) {
      var _result, typeList, index, length, type, style;
      typeList = explicit ? state.explicitTypes : state.implicitTypes;
      for (index = 0, length = typeList.length; index < length; index += 1) {
        type = typeList[index];
        if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === 'object' && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
          state.tag = explicit ? type.tag : '?';
          if (type.represent) {
            style = state.styleMap[type.tag] || type.defaultStyle;
            if (_toString.call(type.represent) === '[object Function]') {
              _result = type.represent(object, style);
            } else if (_hasOwnProperty.call(type.represent, style)) {
              _result = type.represent[style](object, style);
            } else {
              throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
            }
            state.dump = _result;
          }
          return true;
        }
      }
      return false;
    }
    function writeNode(state, level, object, block, compact, iskey) {
      state.tag = null;
      state.dump = object;
      if (!detectType(state, object, false)) {
        detectType(state, object, true);
      }
      var type = _toString.call(state.dump);
      if (block) {
        block = state.flowLevel < 0 || state.flowLevel > level;
      }
      var objectOrArray = type === '[object Object]' || type === '[object Array]',
        duplicateIndex,
        duplicate;
      if (objectOrArray) {
        duplicateIndex = state.duplicates.indexOf(object);
        duplicate = duplicateIndex !== -1;
      }
      if (state.tag !== null && state.tag !== '?' || duplicate || state.indent !== 2 && level > 0) {
        compact = false;
      }
      if (duplicate && state.usedDuplicates[duplicateIndex]) {
        state.dump = '*ref_' + duplicateIndex;
      } else {
        if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
          state.usedDuplicates[duplicateIndex] = true;
        }
        if (type === '[object Object]') {
          if (block && Object.keys(state.dump).length !== 0) {
            writeBlockMapping(state, level, state.dump, compact);
            if (duplicate) {
              state.dump = '&ref_' + duplicateIndex + state.dump;
            }
          } else {
            writeFlowMapping(state, level, state.dump);
            if (duplicate) {
              state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
            }
          }
        } else if (type === '[object Array]') {
          var arrayLevel = state.noArrayIndent && level > 0 ? level - 1 : level;
          if (block && state.dump.length !== 0) {
            writeBlockSequence(state, arrayLevel, state.dump, compact);
            if (duplicate) {
              state.dump = '&ref_' + duplicateIndex + state.dump;
            }
          } else {
            writeFlowSequence(state, arrayLevel, state.dump);
            if (duplicate) {
              state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
            }
          }
        } else if (type === '[object String]') {
          if (state.tag !== '?') {
            writeScalar(state, state.dump, level, iskey);
          }
        } else {
          if (state.skipInvalid) return false;
          throw new YAMLException('unacceptable kind of an object to dump ' + type);
        }
        if (state.tag !== null && state.tag !== '?') {
          state.dump = '!<' + state.tag + '> ' + state.dump;
        }
      }
      return true;
    }
    function getDuplicateReferences(object, state) {
      var objects = [],
        duplicatesIndexes = [],
        index,
        length;
      inspectNode(object, objects, duplicatesIndexes);
      for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
        state.duplicates.push(objects[duplicatesIndexes[index]]);
      }
      state.usedDuplicates = new Array(length);
    }
    function inspectNode(object, objects, duplicatesIndexes) {
      var objectKeyList, index, length;
      if (object !== null && typeof object === 'object') {
        index = objects.indexOf(object);
        if (index !== -1) {
          if (duplicatesIndexes.indexOf(index) === -1) {
            duplicatesIndexes.push(index);
          }
        } else {
          objects.push(object);
          if (Array.isArray(object)) {
            for (index = 0, length = object.length; index < length; index += 1) {
              inspectNode(object[index], objects, duplicatesIndexes);
            }
          } else {
            objectKeyList = Object.keys(object);
            for (index = 0, length = objectKeyList.length; index < length; index += 1) {
              inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
            }
          }
        }
      }
    }
    function dump(input, options) {
      options = options || {};
      var state = new State(options);
      if (!state.noRefs) getDuplicateReferences(input, state);
      if (writeNode(state, 0, input, true, true)) return state.dump + '\n';
      return '';
    }
    function safeDump(input, options) {
      return dump(input, common.extend({
        schema: DEFAULT_SAFE_SCHEMA
      }, options));
    }
    dumper$1.dump = dump;
    dumper$1.safeDump = safeDump;
    var loader = loader$1;
    var dumper = dumper$1;
    function deprecated(name) {
      return function () {
        throw new Error('Function ' + name + ' is deprecated and cannot be used.');
      };
    }
    jsYaml$2.Type = type;
    jsYaml$2.Schema = schema;
    jsYaml$2.FAILSAFE_SCHEMA = failsafe;
    jsYaml$2.JSON_SCHEMA = json;
    jsYaml$2.CORE_SCHEMA = core;
    jsYaml$2.DEFAULT_SAFE_SCHEMA = default_safe;
    jsYaml$2.DEFAULT_FULL_SCHEMA = default_full;
    jsYaml$2.load = loader.load;
    jsYaml$2.loadAll = loader.loadAll;
    jsYaml$2.safeLoad = loader.safeLoad;
    jsYaml$2.safeLoadAll = loader.safeLoadAll;
    jsYaml$2.dump = dumper.dump;
    jsYaml$2.safeDump = dumper.safeDump;
    jsYaml$2.YAMLException = exception;
    jsYaml$2.MINIMAL_SCHEMA = failsafe;
    jsYaml$2.SAFE_SCHEMA = default_safe;
    jsYaml$2.DEFAULT_SCHEMA = default_full;
    jsYaml$2.scan = deprecated('scan');
    jsYaml$2.parse = deprecated('parse');
    jsYaml$2.compose = deprecated('compose');
    jsYaml$2.addConstructor = deprecated('addConstructor');
    var yaml = jsYaml$2;
    var jsYaml = yaml;
    var jsYaml$1 = getDefaultExportFromCjs$1(jsYaml);
    function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
    function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
    class Redirects {
      constructor(rawYaml) {
        try {
          var arrOfRedirects = jsYaml$1.safeLoad(rawYaml);
          this.redirects = arrOfRedirects.reduce(function (acc, redirect) {
            return _objectSpread(_objectSpread({}, acc), {}, {
              [redirect.title]: redirect
            });
          }, {});
        } catch (e) {
          console.log("Was unable to load YAML into JS due to: ".concat(e.message));
          throw e;
        }
      }
      getRedirect(title) {
        var _this = this;
        if (Object.prototype.hasOwnProperty.call(this.redirects, title)) {
          return this.redirects[title];
        }
        var values = Object.keys(this.redirects).map(function (key) {
          return _this.redirects[key];
        });
        return values.find(function (redirect) {
          var aliases = redirect.aliases;
          if (!aliases) {
            return false;
          }
          return aliases.includes(title);
        });
      }
      isBlocking(title) {
        var redirect = this.redirects[title];
        if (redirect) {
          return !!redirect.isBlocking;
        }
        return false;
      }
    }
    var redirectsMap = {
      "1x1-transparent.gif": "1x1-transparent.gif",
      "1x1.gif": "1x1-transparent.gif",
      "1x1-transparent-gif": "1x1-transparent.gif",
      "2x2-transparent.png": "2x2-transparent.png",
      "2x2.png": "2x2-transparent.png",
      "2x2-transparent-png": "2x2-transparent.png",
      "3x2-transparent.png": "3x2-transparent.png",
      "3x2.png": "3x2-transparent.png",
      "3x2-transparent-png": "3x2-transparent.png",
      "32x32-transparent.png": "32x32-transparent.png",
      "32x32.png": "32x32-transparent.png",
      "32x32-transparent-png": "32x32-transparent.png",
      noopframe: "noopframe.html",
      "noop.html": "noopframe.html",
      "blank-html": "noopframe.html",
      noopcss: "noopcss.css",
      "noop.css": "noopcss.css",
      "blank-css": "noopcss.css",
      noopjs: "noopjs.js",
      "noop.js": "noopjs.js",
      "blank-js": "noopjs.js",
      noopjson: "noopjson.json",
      "noop.json": "noopjson.json",
      nooptext: "nooptext.js",
      "noop.txt": "nooptext.js",
      "blank-text": "nooptext.js",
      empty: "nooptext.js",
      "noopvmap-1.0": "noopvmap01.xml",
      "noop-vmap1.xml": "noopvmap01.xml",
      "noop-vmap1.0.xml": "noopvmap01.xml",
      "noopvast-2.0": "noopvast02.xml",
      "noop-vast2.xml": "noopvast02.xml",
      "noopvast-3.0": "noopvast03.xml",
      "noop-vast3.xml": "noopvast03.xml",
      "noopvast-4.0": "noopvast04.xml",
      "noop-vast4.xml": "noopvast04.xml",
      "noopmp3-0.1s": "noopmp3.mp3",
      "blank-mp3": "noopmp3.mp3",
      "noopmp4-1s": "noopmp4.mp4",
      "noop-1s.mp4": "noopmp4.mp4",
      "blank-mp4": "noopmp4.mp4",
      "click2load.html": "click2load.html",
      "ubo-click2load.html": "click2load.html",
      "amazon-apstag": "amazon-apstag.js",
      "ubo-amazon_apstag.js": "amazon-apstag.js",
      "amazon_apstag.js": "amazon-apstag.js",
      "ati-smarttag": "ati-smarttag.js",
      "didomi-loader": "didomi-loader.js",
      fingerprintjs2: "fingerprintjs2.js",
      "ubo-fingerprint2.js": "fingerprintjs2.js",
      "fingerprint2.js": "fingerprintjs2.js",
      fingerprintjs3: "fingerprintjs3.js",
      "ubo-fingerprint3.js": "fingerprintjs3.js",
      "fingerprint3.js": "fingerprintjs3.js",
      gemius: "gemius.js",
      "google-analytics-ga": "google-analytics-ga.js",
      "ubo-google-analytics_ga.js": "google-analytics-ga.js",
      "google-analytics_ga.js": "google-analytics-ga.js",
      "google-analytics": "google-analytics.js",
      "ubo-google-analytics_analytics.js": "google-analytics.js",
      "google-analytics_analytics.js": "google-analytics.js",
      "googletagmanager-gtm": "google-analytics.js",
      "ubo-googletagmanager_gtm.js": "google-analytics.js",
      "googletagmanager_gtm.js": "google-analytics.js",
      "google-ima3": "google-ima3.js",
      "ubo-google-ima.js": "google-ima3.js",
      "google-ima.js": "google-ima3.js",
      "googlesyndication-adsbygoogle": "googlesyndication-adsbygoogle.js",
      "ubo-googlesyndication_adsbygoogle.js": "googlesyndication-adsbygoogle.js",
      "googlesyndication_adsbygoogle.js": "googlesyndication-adsbygoogle.js",
      "googletagservices-gpt": "googletagservices-gpt.js",
      "ubo-googletagservices_gpt.js": "googletagservices-gpt.js",
      "googletagservices_gpt.js": "googletagservices-gpt.js",
      matomo: "matomo.js",
      "metrika-yandex-tag": "metrika-yandex-tag.js",
      "metrika-yandex-watch": "metrika-yandex-watch.js",
      "naver-wcslog": "naver-wcslog.js",
      noeval: "noeval.js",
      "noeval.js": "noeval.js",
      "silent-noeval.js": "noeval.js",
      "ubo-noeval.js": "noeval.js",
      "ubo-silent-noeval.js": "noeval.js",
      "ubo-noeval": "noeval.js",
      "ubo-silent-noeval": "noeval.js",
      "pardot-1.0": "pardot-1.0.js",
      "prebid-ads": "prebid-ads.js",
      "ubo-prebid-ads.js": "prebid-ads.js",
      "prebid-ads.js": "prebid-ads.js",
      prebid: "prebid.js",
      "prevent-bab": "prevent-bab.js",
      "nobab.js": "prevent-bab.js",
      "ubo-nobab.js": "prevent-bab.js",
      "bab-defuser.js": "prevent-bab.js",
      "ubo-bab-defuser.js": "prevent-bab.js",
      "ubo-nobab": "prevent-bab.js",
      "ubo-bab-defuser": "prevent-bab.js",
      "prevent-bab2": "prevent-bab2.js",
      "nobab2.js": "prevent-bab2.js",
      "prevent-fab-3.2.0": "prevent-fab-3.2.0.js",
      "nofab.js": "prevent-fab-3.2.0.js",
      "ubo-nofab.js": "prevent-fab-3.2.0.js",
      "fuckadblock.js-3.2.0": "prevent-fab-3.2.0.js",
      "ubo-fuckadblock.js-3.2.0": "prevent-fab-3.2.0.js",
      "ubo-nofab": "prevent-fab-3.2.0.js",
      "prevent-popads-net": "prevent-popads-net.js",
      "popads.net.js": "prevent-popads-net.js",
      "ubo-popads.net.js": "prevent-popads-net.js",
      "ubo-popads.net": "prevent-popads-net.js",
      "scorecardresearch-beacon": "scorecardresearch-beacon.js",
      "ubo-scorecardresearch_beacon.js": "scorecardresearch-beacon.js",
      "scorecardresearch_beacon.js": "scorecardresearch-beacon.js",
      "set-popads-dummy": "set-popads-dummy.js",
      "popads-dummy.js": "set-popads-dummy.js",
      "ubo-popads-dummy.js": "set-popads-dummy.js",
      "ubo-popads-dummy": "set-popads-dummy.js"
    };
    var getRedirectByName = function getRedirectByName(name) {
      var redirects = Object.keys(redirectsList).map(function (key) {
        return redirectsList[key];
      });
      return redirects.find(function (r) {
        return r.names && r.names.includes(name);
      });
    };
    var getRedirectCode = function getRedirectCode(source) {
      var redirect = getRedirectByName(source.name);
      var result = attachDependencies(redirect);
      result = addCall(redirect, result);
      result = source.engine === 'test' ? wrapInNonameFunc(result) : passSourceAndProps(source, result, true);
      return result;
    };
    var getRedirectFilename = function getRedirectFilename(name) {
      return redirectsMap[name];
    };
    var redirects = {
      Redirects,
      getRedirectFilename,
      getCode: getRedirectCode,
      isAdgRedirectRule: validator.isAdgRedirectRule,
      isValidAdgRedirectRule: validator.isValidAdgRedirectRule,
      isRedirectResourceCompatibleWithAdg: validator.isRedirectResourceCompatibleWithAdg,
      isAdgRedirectCompatibleWithUbo: validator.isAdgRedirectCompatibleWithUbo,
      isUboRedirectCompatibleWithAdg: validator.isUboRedirectCompatibleWithAdg,
      isAbpRedirectCompatibleWithAdg: validator.isAbpRedirectCompatibleWithAdg,
      convertUboRedirectToAdg,
      convertAbpRedirectToAdg,
      convertRedirectToAdg,
      convertRedirectNameToAdg,
      convertAdgRedirectToUbo
    };
    var version = "1.12.1";
    function AmazonApstag(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function AmazonApstag(source){var apstagWrapper={fetchBids(a,b){if(typeof b==="function"){b([]);}},init:noopFunc,setDisplayBids:noopFunc,targetingKeys:noopFunc};window.apstag=apstagWrapper;hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}var updatedArgs=args?[].concat(source).concat(args):[source];try{AmazonApstag.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function DidomiLoader(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function DidomiLoader(source){function UserConsentStatusForVendorSubscribe(){}UserConsentStatusForVendorSubscribe.prototype.filter=function(){return new UserConsentStatusForVendorSubscribe();};UserConsentStatusForVendorSubscribe.prototype.subscribe=noopFunc;function UserConsentStatusForVendor(){}UserConsentStatusForVendor.prototype.first=function(){return new UserConsentStatusForVendorSubscribe();};UserConsentStatusForVendor.prototype.filter=function(){return new UserConsentStatusForVendorSubscribe();};UserConsentStatusForVendor.prototype.subscribe=noopFunc;var DidomiWrapper={isConsentRequired:falseFunc,getUserConsentStatusForPurpose:trueFunc,getUserConsentStatus:trueFunc,getUserStatus:noopFunc,getRequiredPurposes:noopArray,getUserConsentStatusForVendor:trueFunc,Purposes:{Cookies:"cookies"},notice:{configure:noopFunc,hide:noopFunc,isVisible:falseFunc,show:noopFunc,showDataProcessing:trueFunc},isUserConsentStatusPartial:falseFunc,on(){return {actions:{},emitter:{},services:{},store:{}};},shouldConsentBeCollected:falseFunc,getUserConsentStatusForAll:noopFunc,getObservableOnUserConsentStatusForVendor(){return new UserConsentStatusForVendor();}};window.Didomi=DidomiWrapper;var didomiStateWrapper={didomiExperimentId:"",didomiExperimentUserGroup:"",didomiGDPRApplies:1,didomiIABConsent:"",didomiPurposesConsent:"",didomiPurposesConsentDenied:"",didomiPurposesConsentUnknown:"",didomiVendorsConsent:"",didomiVendorsConsentDenied:"",didomiVendorsConsentUnknown:"",didomiVendorsRawConsent:"",didomiVendorsRawConsentDenied:"",didomiVendorsRawConsentUnknown:""};window.didomiState=didomiStateWrapper;var tcData={eventStatus:"tcloaded",gdprApplies:false,listenerId:noopFunc,vendor:{consents:[]},purpose:{consents:[]}};var __tcfapiWrapper=function __tcfapiWrapper(command,version,callback){if(typeof callback!=="function"||command==="removeEventListener"){return;}callback(tcData,true);};window.__tcfapi=__tcfapiWrapper;var didomiEventListenersWrapper={stub:true,push:noopFunc};window.didomiEventListeners=didomiEventListenersWrapper;var didomiOnReadyWrapper={stub:true,push(arg){if(typeof arg!=="function"){return;}if(document.readyState!=="complete"){window.addEventListener("load",function(){setTimeout(arg(window.Didomi));});}else {setTimeout(arg(window.Didomi));}}};window.didomiOnReady=window.didomiOnReady||didomiOnReadyWrapper;if(Array.isArray(window.didomiOnReady)){window.didomiOnReady.forEach(function(arg){if(typeof arg==="function"){try{setTimeout(arg(window.Didomi));}catch(e){}}});}hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}function noopArray(){return [];}function trueFunc(){return true;}function falseFunc(){return false;}var updatedArgs=args?[].concat(source).concat(args):[source];try{DidomiLoader.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function Fingerprintjs2(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function Fingerprintjs2(source){var browserId="";for(var i=0;i<8;i+=1){browserId+=(Math.random()*65536+4096).toString(16).slice(-4);}var Fingerprint2=function Fingerprint2(){};Fingerprint2.get=function(options,callback){if(!callback){callback=options;}setTimeout(function(){if(callback){callback(browserId,[]);}},1);};Fingerprint2.prototype={get:Fingerprint2.get};window.Fingerprint2=Fingerprint2;hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{Fingerprintjs2.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function Fingerprintjs3(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function Fingerprintjs3(source){var visitorId=function(){var id="";for(var i=0;i<8;i+=1){id+=(Math.random()*65536+4096).toString(16).slice(-4);}return id;}();var FingerprintJS=function FingerprintJS(){};FingerprintJS.prototype={load(){return Promise.resolve(new FingerprintJS());},get(){return Promise.resolve({visitorId:visitorId});},hashComponents:noopStr};window.FingerprintJS=new FingerprintJS();hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopStr(){return "";}var updatedArgs=args?[].concat(source).concat(args):[source];try{Fingerprintjs3.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function Gemius(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function Gemius(source){var GemiusPlayer=function GemiusPlayer(){};GemiusPlayer.prototype={setVideoObject:noopFunc,newProgram:noopFunc,programEvent:noopFunc,newAd:noopFunc,adEvent:noopFunc};window.GemiusPlayer=GemiusPlayer;hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}var updatedArgs=args?[].concat(source).concat(args):[source];try{Gemius.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function GoogleAnalytics(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function GoogleAnalytics(source){var _window$googleAnalyti;var Tracker=function Tracker(){};var proto=Tracker.prototype;proto.get=noopFunc;proto.set=noopFunc;proto.send=noopFunc;var googleAnalyticsName=window.GoogleAnalyticsObject||"ga";var queue=(_window$googleAnalyti=window[googleAnalyticsName])===null||_window$googleAnalyti===void 0?void 0:_window$googleAnalyti.q;function ga(a){var len=arguments.length;if(len===0){return;}var lastArg=arguments[len-1];var replacer;if(lastArg instanceof Object&&lastArg!==null&&typeof lastArg.hitCallback==="function"){replacer=lastArg.hitCallback;}else if(typeof lastArg==="function"){replacer=function replacer(){lastArg(ga.create());};}try{setTimeout(replacer,1);}catch(ex){}}ga.create=function(){return new Tracker();};ga.getByName=function(){return new Tracker();};ga.getAll=function(){return [new Tracker()];};ga.remove=noopFunc;ga.loaded=true;window[googleAnalyticsName]=ga;if(Array.isArray(queue)){var push=function push(arg){ga(...arg);};queue.push=push;queue.forEach(push);}var _window=window,dataLayer=_window.dataLayer,google_optimize=_window.google_optimize;if(dataLayer instanceof Object===false){return;}if(dataLayer.hide instanceof Object&&typeof dataLayer.hide.end==="function"){dataLayer.hide.end();}var handleCallback=function handleCallback(dataObj,funcName){if(dataObj&&typeof dataObj[funcName]==="function"){setTimeout(dataObj[funcName]);}};if(typeof dataLayer.push==="function"){dataLayer.push=function(data){if(data instanceof Object){handleCallback(data,"eventCallback");for(var key in data){handleCallback(data[key],"event_callback");}if(!data.hasOwnProperty("eventCallback")&&!data.hasOwnProperty("eventCallback")){[].push.call(window.dataLayer,data);}}if(Array.isArray(data)){data.forEach(function(arg){handleCallback(arg,"callback");});}return noopFunc;};}if(google_optimize instanceof Object&&typeof google_optimize.get==="function"){var googleOptimizeWrapper={get:noopFunc};window.google_optimize=googleOptimizeWrapper;}hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}var updatedArgs=args?[].concat(source).concat(args):[source];try{GoogleAnalytics.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function GoogleAnalyticsGa(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function GoogleAnalyticsGa(source){function Gaq(){}Gaq.prototype.Na=noopFunc;Gaq.prototype.O=noopFunc;Gaq.prototype.Sa=noopFunc;Gaq.prototype.Ta=noopFunc;Gaq.prototype.Va=noopFunc;Gaq.prototype._createAsyncTracker=noopFunc;Gaq.prototype._getAsyncTracker=noopFunc;Gaq.prototype._getPlugin=noopFunc;Gaq.prototype.push=function(data){if(typeof data==="function"){data();return;}if(Array.isArray(data)===false){return;}if(typeof data[0]==="string"&&/(^|\.)_link$/.test(data[0])&&typeof data[1]==="string"){window.location.assign(data[1]);}if(data[0]==="_set"&&data[1]==="hitCallback"&&typeof data[2]==="function"){data[2]();}};var gaq=new Gaq();var asyncTrackers=window._gaq||[];if(Array.isArray(asyncTrackers)){while(asyncTrackers[0]){gaq.push(asyncTrackers.shift());}}window._gaq=gaq.qf=gaq;function Gat(){}var api=["_addIgnoredOrganic","_addIgnoredRef","_addItem","_addOrganic","_addTrans","_clearIgnoredOrganic","_clearIgnoredRef","_clearOrganic","_cookiePathCopy","_deleteCustomVar","_getName","_setAccount","_getAccount","_getClientInfo","_getDetectFlash","_getDetectTitle","_getLinkerUrl","_getLocalGifPath","_getServiceMode","_getVersion","_getVisitorCustomVar","_initData","_link","_linkByPost","_setAllowAnchor","_setAllowHash","_setAllowLinker","_setCampContentKey","_setCampMediumKey","_setCampNameKey","_setCampNOKey","_setCampSourceKey","_setCampTermKey","_setCampaignCookieTimeout","_setCampaignTrack","_setClientInfo","_setCookiePath","_setCookiePersistence","_setCookieTimeout","_setCustomVar","_setDetectFlash","_setDetectTitle","_setDomainName","_setLocalGifPath","_setLocalRemoteServerMode","_setLocalServerMode","_setReferrerOverride","_setRemoteServerMode","_setSampleRate","_setSessionTimeout","_setSiteSpeedSampleRate","_setSessionCookieTimeout","_setVar","_setVisitorCookieTimeout","_trackEvent","_trackPageLoadTime","_trackPageview","_trackSocial","_trackTiming","_trackTrans","_visitCode"];var tracker=api.reduce(function(res,funcName){res[funcName]=noopFunc;return res;},{});tracker._getLinkerUrl=function(a){return a;};tracker._link=function(url){if(typeof url!=="string"){return;}try{window.location.assign(url);}catch(e){logMessage(source,e);}};Gat.prototype._anonymizeIP=noopFunc;Gat.prototype._createTracker=noopFunc;Gat.prototype._forceSSL=noopFunc;Gat.prototype._getPlugin=noopFunc;Gat.prototype._getTracker=function(){return tracker;};Gat.prototype._getTrackerByName=function(){return tracker;};Gat.prototype._getTrackers=noopFunc;Gat.prototype.aa=noopFunc;Gat.prototype.ab=noopFunc;Gat.prototype.hb=noopFunc;Gat.prototype.la=noopFunc;Gat.prototype.oa=noopFunc;Gat.prototype.pa=noopFunc;Gat.prototype.u=noopFunc;var gat=new Gat();window._gat=gat;hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}var updatedArgs=args?[].concat(source).concat(args):[source];try{GoogleAnalyticsGa.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function GoogleIma3(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function GoogleIma3(source){var _window$google$ima;var VERSION="3.453.0";var ima={};var AdDisplayContainer=function AdDisplayContainer(containerElement){var divElement=document.createElement("div");divElement.style.setProperty("display","none","important");divElement.style.setProperty("visibility","collapse","important");if(containerElement){containerElement.appendChild(divElement);}};AdDisplayContainer.prototype.destroy=noopFunc;AdDisplayContainer.prototype.initialize=noopFunc;var ImaSdkSettings=function ImaSdkSettings(){};ImaSdkSettings.CompanionBackfillMode={ALWAYS:"always",ON_MASTER_AD:"on_master_ad"};ImaSdkSettings.VpaidMode={DISABLED:0,ENABLED:1,INSECURE:2};ImaSdkSettings.prototype={c:true,f:{},i:false,l:"",p:"",r:0,t:"",v:"",getCompanionBackfill:noopFunc,getDisableCustomPlaybackForIOS10Plus(){return this.i;},getDisabledFlashAds:function getDisabledFlashAds(){return true;},getFeatureFlags(){return this.f;},getLocale(){return this.l;},getNumRedirects(){return this.r;},getPlayerType(){return this.t;},getPlayerVersion(){return this.v;},getPpid(){return this.p;},getVpaidMode(){return this.C;},isCookiesEnabled(){return this.c;},isVpaidAdapter(){return this.M;},setCompanionBackfill:noopFunc,setAutoPlayAdBreaks(a){this.K=a;},setCookiesEnabled(c){this.c=!!c;},setDisableCustomPlaybackForIOS10Plus(i){this.i=!!i;},setDisableFlashAds:noopFunc,setFeatureFlags(f){this.f=!!f;},setIsVpaidAdapter(a){this.M=a;},setLocale(l){this.l=!!l;},setNumRedirects(r){this.r=!!r;},setPageCorrelator(a){this.R=a;},setPlayerType(t){this.t=!!t;},setPlayerVersion(v){this.v=!!v;},setPpid(p){this.p=!!p;},setVpaidMode(a){this.C=a;},setSessionId:noopFunc,setStreamCorrelator:noopFunc,setVpaidAllowed:noopFunc,CompanionBackfillMode:{ALWAYS:"always",ON_MASTER_AD:"on_master_ad"},VpaidMode:{DISABLED:0,ENABLED:1,INSECURE:2}};var EventHandler=function EventHandler(){this.listeners=new Map();this._dispatch=function(e){var listeners=this.listeners.get(e.type);listeners=listeners?listeners.values():[];for(var _i=0,_Array$from=Array.from(listeners);_i<_Array$from.length;_i++){var listener=_Array$from[_i];try{listener(e);}catch(r){logMessage(source,r);}}};this.addEventListener=function(types,callback,options,context){if(!Array.isArray(types)){types=[types];}for(var i=0;i<types.length;i+=1){var type=types[i];if(!this.listeners.has(type)){this.listeners.set(type,new Map());}this.listeners.get(type).set(callback,callback.bind(context||this));}};this.removeEventListener=function(types,callback){if(!Array.isArray(types)){types=[types];}for(var i=0;i<types.length;i+=1){var _this$listeners$get;var type=types[i];(_this$listeners$get=this.listeners.get(type))===null||_this$listeners$get===void 0?void 0:_this$listeners$get.delete(callback);}};};var AdsManager=new EventHandler();AdsManager.volume=1;AdsManager.collapse=noopFunc;AdsManager.configureAdsManager=noopFunc;AdsManager.destroy=noopFunc;AdsManager.discardAdBreak=noopFunc;AdsManager.expand=noopFunc;AdsManager.focus=noopFunc;AdsManager.getAdSkippableState=function(){return false;};AdsManager.getCuePoints=function(){return [0];};AdsManager.getCurrentAd=function(){return currentAd;};AdsManager.getCurrentAdCuePoints=function(){return [];};AdsManager.getRemainingTime=function(){return 0;};AdsManager.getVolume=function(){return this.volume;};AdsManager.init=noopFunc;AdsManager.isCustomClickTrackingUsed=function(){return false;};AdsManager.isCustomPlaybackUsed=function(){return false;};AdsManager.pause=noopFunc;AdsManager.requestNextAdBreak=noopFunc;AdsManager.resize=noopFunc;AdsManager.resume=noopFunc;AdsManager.setVolume=function(v){this.volume=v;};AdsManager.skip=noopFunc;AdsManager.start=function(){for(var _i2=0,_arr=[AdEvent.Type.ALL_ADS_COMPLETED,AdEvent.Type.CONTENT_RESUME_REQUESTED];_i2<_arr.length;_i2++){var type=_arr[_i2];try{this._dispatch(new ima.AdEvent(type));}catch(e){logMessage(source,e);}}};AdsManager.stop=noopFunc;AdsManager.updateAdsRenderingSettings=noopFunc;var manager=Object.create(AdsManager);var AdsManagerLoadedEvent=function AdsManagerLoadedEvent(type,adsRequest,userRequestContext){this.type=type;this.adsRequest=adsRequest;this.userRequestContext=userRequestContext;};AdsManagerLoadedEvent.prototype={getAdsManager:function getAdsManager(){return manager;},getUserRequestContext(){if(this.userRequestContext){return this.userRequestContext;}return {};}};AdsManagerLoadedEvent.Type={ADS_MANAGER_LOADED:"adsManagerLoaded"};var AdsLoader=EventHandler;AdsLoader.prototype.settings=new ImaSdkSettings();AdsLoader.prototype.contentComplete=noopFunc;AdsLoader.prototype.destroy=noopFunc;AdsLoader.prototype.getSettings=function(){return this.settings;};AdsLoader.prototype.getVersion=function(){return VERSION;};AdsLoader.prototype.requestAds=function(adsRequest,userRequestContext){var _this=this;requestAnimationFrame(function(){var ADS_MANAGER_LOADED=AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED;var event=new ima.AdsManagerLoadedEvent(ADS_MANAGER_LOADED,adsRequest,userRequestContext);_this._dispatch(event);});var e=new ima.AdError("adPlayError",1205,1205,"The browser prevented playback initiated without user interaction.",adsRequest,userRequestContext);requestAnimationFrame(function(){_this._dispatch(new ima.AdErrorEvent(e));});};var AdsRenderingSettings=noopFunc;var AdsRequest=function AdsRequest(){};AdsRequest.prototype={setAdWillAutoPlay:noopFunc,setAdWillPlayMuted:noopFunc,setContinuousPlayback:noopFunc};var AdPodInfo=function AdPodInfo(){};AdPodInfo.prototype={getAdPosition:function getAdPosition(){return 1;},getIsBumper:function getIsBumper(){return false;},getMaxDuration:function getMaxDuration(){return -1;},getPodIndex:function getPodIndex(){return 1;},getTimeOffset:function getTimeOffset(){return 0;},getTotalAds:function getTotalAds(){return 1;}};var UniversalAdIdInfo=function UniversalAdIdInfo(){};UniversalAdIdInfo.prototype.getAdIdRegistry=function(){return "";};UniversalAdIdInfo.prototype.getAdIsValue=function(){return "";};var Ad=function Ad(){};Ad.prototype={pi:new AdPodInfo(),getAdId:function getAdId(){return "";},getAdPodInfo(){return this.pi;},getAdSystem:function getAdSystem(){return "";},getAdvertiserName:function getAdvertiserName(){return "";},getApiFramework:function getApiFramework(){return null;},getCompanionAds:function getCompanionAds(){return [];},getContentType:function getContentType(){return "";},getCreativeAdId:function getCreativeAdId(){return "";},getDealId:function getDealId(){return "";},getDescription:function getDescription(){return "";},getDuration:function getDuration(){return 8.5;},getHeight:function getHeight(){return 0;},getMediaUrl:function getMediaUrl(){return null;},getMinSuggestedDuration:function getMinSuggestedDuration(){return -2;},getSkipTimeOffset:function getSkipTimeOffset(){return -1;},getSurveyUrl:function getSurveyUrl(){return null;},getTitle:function getTitle(){return "";},getTraffickingParametersString:function getTraffickingParametersString(){return "";},getUiElements:function getUiElements(){return [""];},getUniversalAdIdRegistry:function getUniversalAdIdRegistry(){return "unknown";},getUniversalAdIds:function getUniversalAdIds(){return [new UniversalAdIdInfo()];},getUniversalAdIdValue:function getUniversalAdIdValue(){return "unknown";},getVastMediaBitrate:function getVastMediaBitrate(){return 0;},getVastMediaHeight:function getVastMediaHeight(){return 0;},getVastMediaWidth:function getVastMediaWidth(){return 0;},getWidth:function getWidth(){return 0;},getWrapperAdIds:function getWrapperAdIds(){return [""];},getWrapperAdSystems:function getWrapperAdSystems(){return [""];},getWrapperCreativeIds:function getWrapperCreativeIds(){return [""];},isLinear:function isLinear(){return true;},isSkippable(){return true;}};var CompanionAd=function CompanionAd(){};CompanionAd.prototype={getAdSlotId:function getAdSlotId(){return "";},getContent:function getContent(){return "";},getContentType:function getContentType(){return "";},getHeight:function getHeight(){return 1;},getWidth:function getWidth(){return 1;}};var AdError=function AdError(type,code,vast,message,adsRequest,userRequestContext){this.errorCode=code;this.message=message;this.type=type;this.adsRequest=adsRequest;this.userRequestContext=userRequestContext;this.getErrorCode=function(){return this.errorCode;};this.getInnerError=function(){return null;};this.getMessage=function(){return this.message;};this.getType=function(){return this.type;};this.getVastErrorCode=function(){return this.vastErrorCode;};this.toString=function(){return "AdError ".concat(this.errorCode,": ").concat(this.message);};};AdError.ErrorCode={};AdError.Type={};var isEngadget=function isEngadget(){try{for(var _i3=0,_Object$values=Object.values(window.vidible._getContexts());_i3<_Object$values.length;_i3++){var _ctx$getPlayer,_ctx$getPlayer$div;var ctx=_Object$values[_i3];if((_ctx$getPlayer=ctx.getPlayer())!==null&&_ctx$getPlayer!==void 0&&(_ctx$getPlayer$div=_ctx$getPlayer.div)!==null&&_ctx$getPlayer$div!==void 0&&_ctx$getPlayer$div.innerHTML.includes("www.engadget.com")){return true;}}}catch(e){}return false;};var currentAd=isEngadget()?undefined:new Ad();var AdEvent=function AdEvent(type){this.type=type;};AdEvent.prototype={getAd:function getAd(){return currentAd;},getAdData:function getAdData(){}};AdEvent.Type={AD_BREAK_READY:"adBreakReady",AD_BUFFERING:"adBuffering",AD_CAN_PLAY:"adCanPlay",AD_METADATA:"adMetadata",AD_PROGRESS:"adProgress",ALL_ADS_COMPLETED:"allAdsCompleted",CLICK:"click",COMPLETE:"complete",CONTENT_PAUSE_REQUESTED:"contentPauseRequested",CONTENT_RESUME_REQUESTED:"contentResumeRequested",DURATION_CHANGE:"durationChange",EXPANDED_CHANGED:"expandedChanged",FIRST_QUARTILE:"firstQuartile",IMPRESSION:"impression",INTERACTION:"interaction",LINEAR_CHANGE:"linearChange",LINEAR_CHANGED:"linearChanged",LOADED:"loaded",LOG:"log",MIDPOINT:"midpoint",PAUSED:"pause",RESUMED:"resume",SKIPPABLE_STATE_CHANGED:"skippableStateChanged",SKIPPED:"skip",STARTED:"start",THIRD_QUARTILE:"thirdQuartile",USER_CLOSE:"userClose",VIDEO_CLICKED:"videoClicked",VIDEO_ICON_CLICKED:"videoIconClicked",VIEWABLE_IMPRESSION:"viewable_impression",VOLUME_CHANGED:"volumeChange",VOLUME_MUTED:"mute"};var AdErrorEvent=function AdErrorEvent(error){this.error=error;this.type="adError";this.getError=function(){return this.error;};this.getUserRequestContext=function(){var _this$error;if((_this$error=this.error)!==null&&_this$error!==void 0&&_this$error.userRequestContext){return this.error.userRequestContext;}return {};};};AdErrorEvent.Type={AD_ERROR:"adError"};var CustomContentLoadedEvent=function CustomContentLoadedEvent(){};CustomContentLoadedEvent.Type={CUSTOM_CONTENT_LOADED:"deprecated-event"};var CompanionAdSelectionSettings=function CompanionAdSelectionSettings(){};CompanionAdSelectionSettings.CreativeType={ALL:"All",FLASH:"Flash",IMAGE:"Image"};CompanionAdSelectionSettings.ResourceType={ALL:"All",HTML:"Html",IFRAME:"IFrame",STATIC:"Static"};CompanionAdSelectionSettings.SizeCriteria={IGNORE:"IgnoreSize",SELECT_EXACT_MATCH:"SelectExactMatch",SELECT_NEAR_MATCH:"SelectNearMatch"};var AdCuePoints=function AdCuePoints(){};AdCuePoints.prototype={getCuePoints:function getCuePoints(){return [];},getAdIdRegistry:function getAdIdRegistry(){return "";},getAdIdValue:function getAdIdValue(){return "";}};var AdProgressData=noopFunc;Object.assign(ima,{AdCuePoints:AdCuePoints,AdDisplayContainer:AdDisplayContainer,AdError:AdError,AdErrorEvent:AdErrorEvent,AdEvent:AdEvent,AdPodInfo:AdPodInfo,AdProgressData:AdProgressData,AdsLoader:AdsLoader,AdsManager:manager,AdsManagerLoadedEvent:AdsManagerLoadedEvent,AdsRenderingSettings:AdsRenderingSettings,AdsRequest:AdsRequest,CompanionAd:CompanionAd,CompanionAdSelectionSettings:CompanionAdSelectionSettings,CustomContentLoadedEvent:CustomContentLoadedEvent,gptProxyInstance:{},ImaSdkSettings:ImaSdkSettings,OmidAccessMode:{DOMAIN:"domain",FULL:"full",LIMITED:"limited"},OmidVerificationVendor:{1:"OTHER",2:"MOAT",3:"DOUBLEVERIFY",4:"INTEGRAL_AD_SCIENCE",5:"PIXELATE",6:"NIELSEN",7:"COMSCORE",8:"MEETRICS",9:"GOOGLE",OTHER:1,MOAT:2,DOUBLEVERIFY:3,INTEGRAL_AD_SCIENCE:4,PIXELATE:5,NIELSEN:6,COMSCORE:7,MEETRICS:8,GOOGLE:9},settings:new ImaSdkSettings(),UiElements:{AD_ATTRIBUTION:"adAttribution",COUNTDOWN:"countdown"},UniversalAdIdInfo:UniversalAdIdInfo,VERSION:VERSION,ViewMode:{FULLSCREEN:"fullscreen",NORMAL:"normal"}});if(!window.google){window.google={};}if((_window$google$ima=window.google.ima)!==null&&_window$google$ima!==void 0&&_window$google$ima.dai){ima.dai=window.google.ima.dai;}window.google.ima=ima;hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}var updatedArgs=args?[].concat(source).concat(args):[source];try{GoogleIma3.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function GoogleSyndicationAdsByGoogle(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function GoogleSyndicationAdsByGoogle(source){window.adsbygoogle={loaded:true,push(arg){if(typeof this.length==="undefined"){this.length=0;this.length+=1;}if(arg!==null&&arg instanceof Object&&arg.constructor.name==="Object"){for(var _i=0,_Object$keys=Object.keys(arg);_i<_Object$keys.length;_i++){var key=_Object$keys[_i];if(typeof arg[key]==="function"){try{arg[key].call(this,{});}catch(_unused){}}}}}};var adElems=document.querySelectorAll(".adsbygoogle");var css="height:1px!important;max-height:1px!important;max-width:1px!important;width:1px!important;";var statusAttrName="data-adsbygoogle-status";var ASWIFT_IFRAME_MARKER="aswift_";var GOOGLE_ADS_IFRAME_MARKER="google_ads_iframe_";var executed=false;for(var i=0;i<adElems.length;i+=1){var adElemChildNodes=adElems[i].childNodes;var childNodesQuantity=adElemChildNodes.length;var areIframesDefined=false;if(childNodesQuantity>0){areIframesDefined=childNodesQuantity===2&&adElemChildNodes[0].nodeName.toLowerCase()==="iframe"&&adElemChildNodes[0].id.includes(ASWIFT_IFRAME_MARKER)&&adElemChildNodes[1].nodeName.toLowerCase()==="iframe"&&adElemChildNodes[1].id.includes(GOOGLE_ADS_IFRAME_MARKER);}if(!areIframesDefined){adElems[i].setAttribute(statusAttrName,"done");var aswiftIframe=document.createElement("iframe");aswiftIframe.id="".concat(ASWIFT_IFRAME_MARKER).concat(i);aswiftIframe.style=css;adElems[i].appendChild(aswiftIframe);var innerAswiftIframe=document.createElement("iframe");aswiftIframe.contentWindow.document.body.appendChild(innerAswiftIframe);var googleadsIframe=document.createElement("iframe");googleadsIframe.id="".concat(GOOGLE_ADS_IFRAME_MARKER).concat(i);googleadsIframe.style=css;adElems[i].appendChild(googleadsIframe);var innerGoogleadsIframe=document.createElement("iframe");googleadsIframe.contentWindow.document.body.appendChild(innerGoogleadsIframe);executed=true;}}if(executed){hit(source);}}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{GoogleSyndicationAdsByGoogle.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function GoogleTagServicesGpt(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function GoogleTagServicesGpt(source){var slots=new Map();var slotsById=new Map();var slotsPerPath=new Map();var slotCreatives=new Map();var eventCallbacks=new Map();var gTargeting=new Map();var addEventListener=function addEventListener(name,listener){if(!eventCallbacks.has(name)){eventCallbacks.set(name,new Set());}eventCallbacks.get(name).add(listener);return this;};var removeEventListener=function removeEventListener(name,listener){if(eventCallbacks.has(name)){return eventCallbacks.get(name).delete(listener);}return false;};var fireSlotEvent=function fireSlotEvent(name,slot){return new Promise(function(resolve){requestAnimationFrame(function(){var size=[0,0];var callbacksSet=eventCallbacks.get(name)||[];var callbackArray=Array.from(callbacksSet);for(var i=0;i<callbackArray.length;i+=1){callbackArray[i]({isEmpty:true,size:size,slot:slot});}resolve();});});};var emptySlotElement=function emptySlotElement(slot){var node=document.getElementById(slot.getSlotElementId());while(node!==null&&node!==void 0&&node.lastChild){node.lastChild.remove();}};var recreateIframeForSlot=function recreateIframeForSlot(slot){var _document$getElementB;var eid="google_ads_iframe_".concat(slot.getId());(_document$getElementB=document.getElementById(eid))===null||_document$getElementB===void 0?void 0:_document$getElementB.remove();var node=document.getElementById(slot.getSlotElementId());if(node){var f=document.createElement("iframe");f.id=eid;f.srcdoc="<body></body>";f.style="position:absolute; width:0; height:0; left:0; right:0; z-index:-1; border:0";f.setAttribute("width",0);f.setAttribute("height",0);f.setAttribute("data-load-complete",true);f.setAttribute("data-google-container-id",true);f.setAttribute("sandbox","");node.appendChild(f);}};var displaySlot=function displaySlot(slot){if(!slot){return;}var id=slot.getSlotElementId();if(!document.getElementById(id)){return;}var parent=document.getElementById(id);if(parent){parent.appendChild(document.createElement("div"));}emptySlotElement(slot);recreateIframeForSlot(slot);fireSlotEvent("slotRenderEnded",slot);fireSlotEvent("slotRequested",slot);fireSlotEvent("slotResponseReceived",slot);fireSlotEvent("slotOnload",slot);fireSlotEvent("impressionViewable",slot);};var companionAdsService={addEventListener:addEventListener,removeEventListener:removeEventListener,enableSyncLoading:noopFunc,setRefreshUnfilledSlots:noopFunc,getSlots:noopArray};var contentService={addEventListener:addEventListener,removeEventListener:removeEventListener,setContent:noopFunc};function PassbackSlot(){}PassbackSlot.prototype.display=noopFunc;PassbackSlot.prototype.get=noopNull;PassbackSlot.prototype.set=noopThis;PassbackSlot.prototype.setClickUrl=noopThis;PassbackSlot.prototype.setTagForChildDirectedTreatment=noopThis;PassbackSlot.prototype.setTargeting=noopThis;PassbackSlot.prototype.updateTargetingFromMap=noopThis;function SizeMappingBuilder(){}SizeMappingBuilder.prototype.addSize=noopThis;SizeMappingBuilder.prototype.build=noopNull;var getTargetingValue=function getTargetingValue(v){if(typeof v==="string"){return [v];}try{return Array.prototype.flat.call(v);}catch(_unused){}return [];};var updateTargeting=function updateTargeting(targeting,map){if(typeof map==="object"){for(var key in map){if(Object.prototype.hasOwnProperty.call(map,key)){targeting.set(key,getTargetingValue(map[key]));}}}};var defineSlot=function defineSlot(adUnitPath,creatives,optDiv){if(slotsById.has(optDiv)){var _document$getElementB2;(_document$getElementB2=document.getElementById(optDiv))===null||_document$getElementB2===void 0?void 0:_document$getElementB2.remove();return slotsById.get(optDiv);}var attributes=new Map();var targeting=new Map();var exclusions=new Set();var response={advertiserId:undefined,campaignId:undefined,creativeId:undefined,creativeTemplateId:undefined,lineItemId:undefined};var sizes=[{getHeight:function getHeight(){return 2;},getWidth:function getWidth(){return 2;}}];var num=(slotsPerPath.get(adUnitPath)||0)+1;slotsPerPath.set(adUnitPath,num);var id="".concat(adUnitPath,"_").concat(num);var clickUrl="";var collapseEmptyDiv=null;var services=new Set();var slot={addService(e){services.add(e);return slot;},clearCategoryExclusions:noopThis,clearTargeting(k){if(k===undefined){targeting.clear();}else {targeting.delete(k);}},defineSizeMapping(mapping){slotCreatives.set(optDiv,mapping);return this;},get:function get(k){return attributes.get(k);},getAdUnitPath:function getAdUnitPath(){return adUnitPath;},getAttributeKeys:function getAttributeKeys(){return Array.from(attributes.keys());},getCategoryExclusions:function getCategoryExclusions(){return Array.from(exclusions);},getClickUrl:function getClickUrl(){return clickUrl;},getCollapseEmptyDiv:function getCollapseEmptyDiv(){return collapseEmptyDiv;},getContentUrl:function getContentUrl(){return "";},getDivStartsCollapsed:function getDivStartsCollapsed(){return null;},getDomId:function getDomId(){return optDiv;},getEscapedQemQueryId:function getEscapedQemQueryId(){return "";},getFirstLook:function getFirstLook(){return 0;},getId:function getId(){return id;},getHtml:function getHtml(){return "";},getName:function getName(){return id;},getOutOfPage:function getOutOfPage(){return false;},getResponseInformation:function getResponseInformation(){return response;},getServices:function getServices(){return Array.from(services);},getSizes:function getSizes(){return sizes;},getSlotElementId:function getSlotElementId(){return optDiv;},getSlotId:function getSlotId(){return slot;},getTargeting:function getTargeting(k){return targeting.get(k)||gTargeting.get(k)||[];},getTargetingKeys:function getTargetingKeys(){return Array.from(new Set(Array.of(...gTargeting.keys(),...targeting.keys())));},getTargetingMap:function getTargetingMap(){return Object.assign(Object.fromEntries(gTargeting.entries()),Object.fromEntries(targeting.entries()));},set(k,v){attributes.set(k,v);return slot;},setCategoryExclusion(e){exclusions.add(e);return slot;},setClickUrl(u){clickUrl=u;return slot;},setCollapseEmptyDiv(v){collapseEmptyDiv=!!v;return slot;},setSafeFrameConfig:noopThis,setTagForChildDirectedTreatment:noopThis,setTargeting(k,v){targeting.set(k,getTargetingValue(v));return slot;},toString:function toString(){return id;},updateTargetingFromMap(map){updateTargeting(targeting,map);return slot;}};slots.set(adUnitPath,slot);slotsById.set(optDiv,slot);slotCreatives.set(optDiv,creatives);return slot;};var pubAdsService={addEventListener:addEventListener,removeEventListener:removeEventListener,clear:noopFunc,clearCategoryExclusions:noopThis,clearTagForChildDirectedTreatment:noopThis,clearTargeting(k){if(k===undefined){gTargeting.clear();}else {gTargeting.delete(k);}},collapseEmptyDivs:noopFunc,defineOutOfPagePassback(){return new PassbackSlot();},definePassback(){return new PassbackSlot();},disableInitialLoad:noopFunc,display:noopFunc,enableAsyncRendering:noopFunc,enableLazyLoad:noopFunc,enableSingleRequest:noopFunc,enableSyncRendering:noopFunc,enableVideoAds:noopFunc,get:noopNull,getAttributeKeys:noopArray,getTargeting:noopArray,getTargetingKeys:noopArray,getSlots:noopArray,isInitialLoadDisabled:trueFunc,refresh:noopFunc,set:noopThis,setCategoryExclusion:noopThis,setCentering:noopFunc,setCookieOptions:noopThis,setForceSafeFrame:noopThis,setLocation:noopThis,setPrivacySettings:noopThis,setPublisherProvidedId:noopThis,setRequestNonPersonalizedAds:noopThis,setSafeFrameConfig:noopThis,setTagForChildDirectedTreatment:noopThis,setTargeting:noopThis,setVideoContent:noopThis,updateCorrelator:noopFunc};var _window=window,_window$googletag=_window.googletag,googletag=_window$googletag===void 0?{}:_window$googletag;var _googletag$cmd=googletag.cmd,cmd=_googletag$cmd===void 0?[]:_googletag$cmd;googletag.apiReady=true;googletag.cmd=[];googletag.cmd.push=function(a){try{a();}catch(ex){}return 1;};googletag.companionAds=function(){return companionAdsService;};googletag.content=function(){return contentService;};googletag.defineOutOfPageSlot=defineSlot;googletag.defineSlot=defineSlot;googletag.destroySlots=function(){slots.clear();slotsById.clear();};googletag.disablePublisherConsole=noopFunc;googletag.display=function(arg){var id;if(arg!==null&&arg!==void 0&&arg.getSlotElementId){id=arg.getSlotElementId();}else if(arg!==null&&arg!==void 0&&arg.nodeType){id=arg.id;}else {id=String(arg);}displaySlot(slotsById.get(id));};googletag.enableServices=noopFunc;googletag.getVersion=noopStr;googletag.pubads=function(){return pubAdsService;};googletag.pubadsReady=true;googletag.setAdIframeTitle=noopFunc;googletag.sizeMapping=function(){return new SizeMappingBuilder();};window.googletag=googletag;while(cmd.length!==0){googletag.cmd.push(cmd.shift());}hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}function noopThis(){return this;}function noopNull(){return null;}function noopArray(){return [];}function noopStr(){return "";}function trueFunc(){return true;}var updatedArgs=args?[].concat(source).concat(args):[source];try{GoogleTagServicesGpt.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function Matomo(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function Matomo(source){var Tracker=function Tracker(){};Tracker.prototype.setDoNotTrack=noopFunc;Tracker.prototype.setDomains=noopFunc;Tracker.prototype.setCustomDimension=noopFunc;Tracker.prototype.trackPageView=noopFunc;var AsyncTracker=function AsyncTracker(){};AsyncTracker.prototype.addListener=noopFunc;var matomoWrapper={getTracker:Tracker,getAsyncTracker:AsyncTracker};window.Piwik=matomoWrapper;hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}var updatedArgs=args?[].concat(source).concat(args):[source];try{Matomo.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function NaverWcslog(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function NaverWcslog(source){window.wcs_add={};window.wcs_do=noopFunc;window.wcs={inflow:noopFunc};hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}var updatedArgs=args?[].concat(source).concat(args):[source];try{NaverWcslog.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function Pardot(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function Pardot(source){window.piVersion="1.0.2";window.piScriptNum=0;window.piScriptObj=[];window.checkNamespace=noopFunc;window.getPardotUrl=noopStr;window.piGetParameter=noopNull;window.piSetCookie=noopFunc;window.piGetCookie=noopStr;function piTracker(){window.pi={tracker:{visitor_id:"",visitor_id_sign:"",pi_opt_in:"",campaign_id:""}};window.piScriptNum+=1;}window.piResponse=noopFunc;window.piTracker=piTracker;piTracker();hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}function noopStr(){return "";}function noopNull(){return null;}var updatedArgs=args?[].concat(source).concat(args):[source];try{Pardot.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function Prebid(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function Prebid(source){var pushFunction=function pushFunction(arg){if(typeof arg==="function"){try{arg.call();}catch(ex){}}};var pbjsWrapper={addAdUnits(){},adServers:{dfp:{buildVideoUrl:noopStr}},adUnits:[],aliasBidder(){},cmd:[],enableAnalytics(){},getHighestCpmBids:noopArray,libLoaded:true,que:[],requestBids(arg){if(arg instanceof Object&&arg.bidsBackHandler){try{arg.bidsBackHandler.call();}catch(ex){}}},removeAdUnit(){},setBidderConfig(){},setConfig(){},setTargetingForGPTAsync(){}};pbjsWrapper.cmd.push=pushFunction;pbjsWrapper.que.push=pushFunction;window.pbjs=pbjsWrapper;hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopStr(){return "";}function noopArray(){return [];}var updatedArgs=args?[].concat(source).concat(args):[source];try{Prebid.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function ScoreCardResearchBeacon(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function ScoreCardResearchBeacon(source){window.COMSCORE={purge(){window._comscore=[];},beacon(){}};hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{ScoreCardResearchBeacon.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function abortCurrentInlineScript(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function abortCurrentInlineScript(source,property,search){var searchRegexp=toRegExp(search);var rid=randomId();var SRC_DATA_MARKER="data:text/javascript;base64,";var getCurrentScript=function getCurrentScript(){if("currentScript"in document){return document.currentScript;}var scripts=document.getElementsByTagName("script");return scripts[scripts.length-1];};var ourScript=getCurrentScript();var abort=function abort(){var _scriptEl$src;var scriptEl=getCurrentScript();if(!scriptEl){return;}var content=scriptEl.textContent;try{var textContentGetter=Object.getOwnPropertyDescriptor(Node.prototype,"textContent").get;content=textContentGetter.call(scriptEl);}catch(e){}if(content.length===0&&typeof scriptEl.src!=="undefined"&&(_scriptEl$src=scriptEl.src)!==null&&_scriptEl$src!==void 0&&_scriptEl$src.startsWith(SRC_DATA_MARKER)){var encodedContent=scriptEl.src.slice(SRC_DATA_MARKER.length);content=window.atob(encodedContent);}if(scriptEl instanceof HTMLScriptElement&&content.length>0&&scriptEl!==ourScript&&searchRegexp.test(content)){hit(source);throw new ReferenceError(rid);}};var setChainPropAccess=function setChainPropAccess(owner,property){var chainInfo=getPropertyInChain(owner,property);var base=chainInfo.base;var prop=chainInfo.prop,chain=chainInfo.chain;if(base instanceof Object===false&&base===null){var props=property.split(".");var propIndex=props.indexOf(prop);var baseName=props[propIndex-1];var message="The scriptlet had been executed before the ".concat(baseName," was loaded.");logMessage(source,message);return;}if(chain){var setter=function setter(a){base=a;if(a instanceof Object){setChainPropAccess(a,chain);}};Object.defineProperty(owner,prop,{get:function get(){return base;},set:setter});return;}var currentValue=base[prop];var origDescriptor=Object.getOwnPropertyDescriptor(base,prop);if(origDescriptor instanceof Object===false||origDescriptor.get instanceof Function===false){currentValue=base[prop];origDescriptor=undefined;}var descriptorWrapper=Object.assign(getDescriptorAddon(),{currentValue:currentValue,get(){if(!this.isAbortingSuspended){this.isolateCallback(abort);}if(origDescriptor instanceof Object){return origDescriptor.get.call(base);}return this.currentValue;},set(newValue){if(!this.isAbortingSuspended){this.isolateCallback(abort);}if(origDescriptor instanceof Object){origDescriptor.set.call(base,newValue);}else {this.currentValue=newValue;}}});setPropertyAccess(base,prop,{get(){return descriptorWrapper.get.call(descriptorWrapper);},set(newValue){descriptorWrapper.set.call(descriptorWrapper,newValue);}});};setChainPropAccess(window,property);window.onerror=createOnErrorHandler(rid).bind();}function randomId(){return Math.random().toString(36).slice(2,9);}function setPropertyAccess(object,property,descriptor){var currentDescriptor=Object.getOwnPropertyDescriptor(object,property);if(currentDescriptor&&!currentDescriptor.configurable){return false;}Object.defineProperty(object,property,descriptor);return true;}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function createOnErrorHandler(rid){var nativeOnError=window.onerror;return function onError(error){if(typeof error==="string"&&error.includes(rid)){return true;}if(nativeOnError instanceof Function){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return nativeOnError.apply(window,[error,...args]);}return false;};}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}function getDescriptorAddon(){return {isAbortingSuspended:false,isolateCallback(cb){this.isAbortingSuspended=true;try{for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}var result=cb(...args);this.isAbortingSuspended=false;return result;}catch(_unused){var rid=randomId();this.isAbortingSuspended=false;throw new ReferenceError(rid);}}};}var updatedArgs=args?[].concat(source).concat(args):[source];try{abortCurrentInlineScript.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function abortOnPropertyRead(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function abortOnPropertyRead(source,property){if(!property){return;}var rid=randomId();var abort=function abort(){hit(source);throw new ReferenceError(rid);};var setChainPropAccess=function setChainPropAccess(owner,property){var chainInfo=getPropertyInChain(owner,property);var base=chainInfo.base;var prop=chainInfo.prop,chain=chainInfo.chain;if(chain){var setter=function setter(a){base=a;if(a instanceof Object){setChainPropAccess(a,chain);}};Object.defineProperty(owner,prop,{get:function get(){return base;},set:setter});return;}setPropertyAccess(base,prop,{get:abort,set:function set(){}});};setChainPropAccess(window,property);window.onerror=createOnErrorHandler(rid).bind();}function randomId(){return Math.random().toString(36).slice(2,9);}function setPropertyAccess(object,property,descriptor){var currentDescriptor=Object.getOwnPropertyDescriptor(object,property);if(currentDescriptor&&!currentDescriptor.configurable){return false;}Object.defineProperty(object,property,descriptor);return true;}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function createOnErrorHandler(rid){var nativeOnError=window.onerror;return function onError(error){if(typeof error==="string"&&error.includes(rid)){return true;}if(nativeOnError instanceof Function){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return nativeOnError.apply(window,[error,...args]);}return false;};}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}var updatedArgs=args?[].concat(source).concat(args):[source];try{abortOnPropertyRead.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function abortOnPropertyWrite(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function abortOnPropertyWrite(source,property){if(!property){return;}var rid=randomId();var abort=function abort(){hit(source);throw new ReferenceError(rid);};var setChainPropAccess=function setChainPropAccess(owner,property){var chainInfo=getPropertyInChain(owner,property);var base=chainInfo.base;var prop=chainInfo.prop,chain=chainInfo.chain;if(chain){var setter=function setter(a){base=a;if(a instanceof Object){setChainPropAccess(a,chain);}};Object.defineProperty(owner,prop,{get:function get(){return base;},set:setter});return;}setPropertyAccess(base,prop,{set:abort});};setChainPropAccess(window,property);window.onerror=createOnErrorHandler(rid).bind();}function randomId(){return Math.random().toString(36).slice(2,9);}function setPropertyAccess(object,property,descriptor){var currentDescriptor=Object.getOwnPropertyDescriptor(object,property);if(currentDescriptor&&!currentDescriptor.configurable){return false;}Object.defineProperty(object,property,descriptor);return true;}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function createOnErrorHandler(rid){var nativeOnError=window.onerror;return function onError(error){if(typeof error==="string"&&error.includes(rid)){return true;}if(nativeOnError instanceof Function){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return nativeOnError.apply(window,[error,...args]);}return false;};}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}var updatedArgs=args?[].concat(source).concat(args):[source];try{abortOnPropertyWrite.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function abortOnStackTrace(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function abortOnStackTrace(source,property,stack){if(!property||!stack){return;}var rid=randomId();var abort=function abort(){hit(source);throw new ReferenceError(rid);};var setChainPropAccess=function setChainPropAccess(owner,property){var chainInfo=getPropertyInChain(owner,property);var base=chainInfo.base;var prop=chainInfo.prop,chain=chainInfo.chain;if(chain){var setter=function setter(a){base=a;if(a instanceof Object){setChainPropAccess(a,chain);}};Object.defineProperty(owner,prop,{get:function get(){return base;},set:setter});return;}if(!stack.match(/^(inlineScript|injectedScript)$/)&&!isValidStrPattern(stack)){logMessage(source,"Invalid parameter: ".concat(stack));return;}var descriptorWrapper=Object.assign(getDescriptorAddon(),{value:base[prop],get(){if(!this.isAbortingSuspended&&this.isolateCallback(matchStackTrace,stack,new Error().stack)){abort();}return this.value;},set(newValue){if(!this.isAbortingSuspended&&this.isolateCallback(matchStackTrace,stack,new Error().stack)){abort();}this.value=newValue;}});setPropertyAccess(base,prop,{get(){return descriptorWrapper.get.call(descriptorWrapper);},set(newValue){descriptorWrapper.set.call(descriptorWrapper,newValue);}});};setChainPropAccess(window,property);window.onerror=createOnErrorHandler(rid).bind();}function randomId(){return Math.random().toString(36).slice(2,9);}function setPropertyAccess(object,property,descriptor){var currentDescriptor=Object.getOwnPropertyDescriptor(object,property);if(currentDescriptor&&!currentDescriptor.configurable){return false;}Object.defineProperty(object,property,descriptor);return true;}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function createOnErrorHandler(rid){var nativeOnError=window.onerror;return function onError(error){if(typeof error==="string"&&error.includes(rid)){return true;}if(nativeOnError instanceof Function){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return nativeOnError.apply(window,[error,...args]);}return false;};}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}function matchStackTrace(stackMatch,stackTrace){if(!stackMatch||stackMatch===""){return true;}var regExpValues=backupRegExpValues();if(shouldAbortInlineOrInjectedScript(stackMatch,stackTrace)){if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return true;}var stackRegexp=toRegExp(stackMatch);var refinedStackTrace=stackTrace.split("\n").slice(2).map(function(line){return line.trim();}).join("\n");if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return getNativeRegexpTest().call(stackRegexp,refinedStackTrace);}function getDescriptorAddon(){return {isAbortingSuspended:false,isolateCallback(cb){this.isAbortingSuspended=true;try{for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}var result=cb(...args);this.isAbortingSuspended=false;return result;}catch(_unused){var rid=randomId();this.isAbortingSuspended=false;throw new ReferenceError(rid);}}};}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}function getNativeRegexpTest(){var descriptor=Object.getOwnPropertyDescriptor(RegExp.prototype,"test");var nativeRegexTest=descriptor===null||descriptor===void 0?void 0:descriptor.value;if(descriptor&&typeof descriptor.value==="function"){return nativeRegexTest;}throw new Error("RegExp.prototype.test is not a function");}function shouldAbortInlineOrInjectedScript(stackMatch,stackTrace){var INLINE_SCRIPT_STRING="inlineScript";var INJECTED_SCRIPT_STRING="injectedScript";var INJECTED_SCRIPT_MARKER="<anonymous>";var isInlineScript=function isInlineScript(match){return match.includes(INLINE_SCRIPT_STRING);};var isInjectedScript=function isInjectedScript(match){return match.includes(INJECTED_SCRIPT_STRING);};if(!(isInlineScript(stackMatch)||isInjectedScript(stackMatch))){return false;}var documentURL=window.location.href;var pos=documentURL.indexOf("#");if(pos!==-1){documentURL=documentURL.slice(0,pos);}var stackSteps=stackTrace.split("\n").slice(2).map(function(line){return line.trim();});var stackLines=stackSteps.map(function(line){var stack;var getStackTraceValues=/(.*?@)?(\S+)(:\d+)(:\d+)\)?$/.exec(line);if(getStackTraceValues){var _stackURL,_stackURL2;var stackURL=getStackTraceValues[2];var stackLine=getStackTraceValues[3];var stackCol=getStackTraceValues[4];if((_stackURL=stackURL)!==null&&_stackURL!==void 0&&_stackURL.startsWith("(")){stackURL=stackURL.slice(1);}if((_stackURL2=stackURL)!==null&&_stackURL2!==void 0&&_stackURL2.startsWith(INJECTED_SCRIPT_MARKER)){var _stackFunction;stackURL=INJECTED_SCRIPT_STRING;var stackFunction=getStackTraceValues[1]!==undefined?getStackTraceValues[1].slice(0,-1):line.slice(0,getStackTraceValues.index).trim();if((_stackFunction=stackFunction)!==null&&_stackFunction!==void 0&&_stackFunction.startsWith("at")){stackFunction=stackFunction.slice(2).trim();}stack="".concat(stackFunction," ").concat(stackURL).concat(stackLine).concat(stackCol).trim();}else if(stackURL===documentURL){stack="".concat(INLINE_SCRIPT_STRING).concat(stackLine).concat(stackCol).trim();}else {stack="".concat(stackURL).concat(stackLine).concat(stackCol).trim();}}else {stack=line;}return stack;});if(stackLines){for(var index=0;index<stackLines.length;index+=1){if(isInlineScript(stackMatch)&&stackLines[index].startsWith(INLINE_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}if(isInjectedScript(stackMatch)&&stackLines[index].startsWith(INJECTED_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}}}return false;}function backupRegExpValues(){try{var arrayOfRegexpValues=[];for(var index=1;index<10;index+=1){var value="$".concat(index);if(!RegExp[value]){break;}arrayOfRegexpValues.push(RegExp[value]);}return arrayOfRegexpValues;}catch(error){return [];}}function restoreRegExpValues(array){if(!array.length){return;}try{var stringPattern="";if(array.length===1){stringPattern="(".concat(array[0],")");}else {stringPattern=array.reduce(function(accumulator,currentValue,currentIndex){if(currentIndex===1){return "(".concat(accumulator,"),(").concat(currentValue,")");}return "".concat(accumulator,",(").concat(currentValue,")");});}var regExpGroup=new RegExp(stringPattern);array.toString().replace(regExpGroup,"");}catch(error){var message="Failed to restore RegExp values: ".concat(error);console.log(message);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{abortOnStackTrace.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function adjustSetInterval(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function adjustSetInterval(source,matchCallback,matchDelay,boost){var nativeSetInterval=window.setInterval;var matchRegexp=toRegExp(matchCallback);var intervalWrapper=function intervalWrapper(callback,delay){if(!isValidCallback(callback)){var message="Scriptlet can't be applied because of invalid callback: '".concat(String(callback),"'");logMessage(source,message);}else if(matchRegexp.test(callback.toString())&&isDelayMatched(matchDelay,delay)){delay*=getBoostMultiplier(boost);hit(source);}for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}return nativeSetInterval.apply(window,[callback,delay,...args]);};window.setInterval=intervalWrapper;}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function isValidCallback(callback){return callback instanceof Function||typeof callback==="string";}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function getBoostMultiplier(boost){var DEFAULT_MULTIPLIER=.05;var MIN_MULTIPLIER=.001;var MAX_MULTIPLIER=50;var parsedBoost=parseFloat(boost);var boostMultiplier=nativeIsNaN(parsedBoost)||!nativeIsFinite(parsedBoost)?DEFAULT_MULTIPLIER:parsedBoost;if(boostMultiplier<MIN_MULTIPLIER){boostMultiplier=MIN_MULTIPLIER;}if(boostMultiplier>MAX_MULTIPLIER){boostMultiplier=MAX_MULTIPLIER;}return boostMultiplier;}function isDelayMatched(inputDelay,realDelay){return shouldMatchAnyDelay(inputDelay)||realDelay===getMatchDelay(inputDelay);}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function nativeIsFinite(num){var native=Number.isFinite||window.isFinite;return native(num);}function getMatchDelay(delay){var DEFAULT_DELAY=1e3;var parsedDelay=parseInt(delay,10);var delayMatch=nativeIsNaN(parsedDelay)?DEFAULT_DELAY:parsedDelay;return delayMatch;}function shouldMatchAnyDelay(delay){return delay==="*";}var updatedArgs=args?[].concat(source).concat(args):[source];try{adjustSetInterval.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function adjustSetTimeout(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function adjustSetTimeout(source,matchCallback,matchDelay,boost){var nativeSetTimeout=window.setTimeout;var matchRegexp=toRegExp(matchCallback);var timeoutWrapper=function timeoutWrapper(callback,delay){if(!isValidCallback(callback)){var message="Scriptlet can't be applied because of invalid callback: '".concat(String(callback),"'");logMessage(source,message);}else if(matchRegexp.test(callback.toString())&&isDelayMatched(matchDelay,delay)){delay*=getBoostMultiplier(boost);hit(source);}for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}return nativeSetTimeout.apply(window,[callback,delay,...args]);};window.setTimeout=timeoutWrapper;}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function isValidCallback(callback){return callback instanceof Function||typeof callback==="string";}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function getBoostMultiplier(boost){var DEFAULT_MULTIPLIER=.05;var MIN_MULTIPLIER=.001;var MAX_MULTIPLIER=50;var parsedBoost=parseFloat(boost);var boostMultiplier=nativeIsNaN(parsedBoost)||!nativeIsFinite(parsedBoost)?DEFAULT_MULTIPLIER:parsedBoost;if(boostMultiplier<MIN_MULTIPLIER){boostMultiplier=MIN_MULTIPLIER;}if(boostMultiplier>MAX_MULTIPLIER){boostMultiplier=MAX_MULTIPLIER;}return boostMultiplier;}function isDelayMatched(inputDelay,realDelay){return shouldMatchAnyDelay(inputDelay)||realDelay===getMatchDelay(inputDelay);}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function nativeIsFinite(num){var native=Number.isFinite||window.isFinite;return native(num);}function getMatchDelay(delay){var DEFAULT_DELAY=1e3;var parsedDelay=parseInt(delay,10);var delayMatch=nativeIsNaN(parsedDelay)?DEFAULT_DELAY:parsedDelay;return delayMatch;}function shouldMatchAnyDelay(delay){return delay==="*";}var updatedArgs=args?[].concat(source).concat(args):[source];try{adjustSetTimeout.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function callNoThrow(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function callNoThrow(source,functionName){if(!functionName){return;}var _getPropertyInChain=getPropertyInChain(window,functionName),base=_getPropertyInChain.base,prop=_getPropertyInChain.prop;if(!base||!prop||typeof base[prop]!=="function"){var message="".concat(functionName," is not a function");logMessage(source,message);return;}var objectWrapper=function objectWrapper(){var result;try{result=Reflect.apply(...arguments);}catch(e){var _message="Error calling ".concat(functionName,": ").concat(e.message);logMessage(source,_message);}hit(source);return result;};var objectHandler={apply:objectWrapper};base[prop]=new Proxy(base[prop],objectHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}var updatedArgs=args?[].concat(source).concat(args):[source];try{callNoThrow.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function debugCurrentInlineScript(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function debugCurrentInlineScript(source,property,search){var searchRegexp=toRegExp(search);var rid=randomId();var getCurrentScript=function getCurrentScript(){if("currentScript"in document){return document.currentScript;}var scripts=document.getElementsByTagName("script");return scripts[scripts.length-1];};var ourScript=getCurrentScript();var abort=function abort(){var scriptEl=getCurrentScript();if(!scriptEl){return;}var content=scriptEl.textContent;try{var textContentGetter=Object.getOwnPropertyDescriptor(Node.prototype,"textContent").get;content=textContentGetter.call(scriptEl);}catch(e){}if(scriptEl instanceof HTMLScriptElement&&content.length>0&&scriptEl!==ourScript&&searchRegexp.test(content)){hit(source);debugger;}};var setChainPropAccess=function setChainPropAccess(owner,property){var chainInfo=getPropertyInChain(owner,property);var base=chainInfo.base;var prop=chainInfo.prop,chain=chainInfo.chain;if(base instanceof Object===false&&base===null){var props=property.split(".");var propIndex=props.indexOf(prop);var baseName=props[propIndex-1];var message="The scriptlet had been executed before the ".concat(baseName," was loaded.");logMessage(message,source.verbose);return;}if(chain){var setter=function setter(a){base=a;if(a instanceof Object){setChainPropAccess(a,chain);}};Object.defineProperty(owner,prop,{get:function get(){return base;},set:setter});return;}var currentValue=base[prop];setPropertyAccess(base,prop,{set:function set(value){abort();currentValue=value;},get:function get(){abort();return currentValue;}});};setChainPropAccess(window,property);window.onerror=createOnErrorHandler(rid).bind();}function randomId(){return Math.random().toString(36).slice(2,9);}function setPropertyAccess(object,property,descriptor){var currentDescriptor=Object.getOwnPropertyDescriptor(object,property);if(currentDescriptor&&!currentDescriptor.configurable){return false;}Object.defineProperty(object,property,descriptor);return true;}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function createOnErrorHandler(rid){var nativeOnError=window.onerror;return function onError(error){if(typeof error==="string"&&error.includes(rid)){return true;}if(nativeOnError instanceof Function){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return nativeOnError.apply(window,[error,...args]);}return false;};}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}var updatedArgs=args?[].concat(source).concat(args):[source];try{debugCurrentInlineScript.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function debugOnPropertyRead(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function debugOnPropertyRead(source,property){if(!property){return;}var rid=randomId();var abort=function abort(){hit(source);debugger;};var setChainPropAccess=function setChainPropAccess(owner,property){var chainInfo=getPropertyInChain(owner,property);var base=chainInfo.base;var prop=chainInfo.prop,chain=chainInfo.chain;if(chain){var setter=function setter(a){base=a;if(a instanceof Object){setChainPropAccess(a,chain);}};Object.defineProperty(owner,prop,{get:function get(){return base;},set:setter});return;}setPropertyAccess(base,prop,{get:abort,set:noopFunc});};setChainPropAccess(window,property);window.onerror=createOnErrorHandler(rid).bind();}function randomId(){return Math.random().toString(36).slice(2,9);}function setPropertyAccess(object,property,descriptor){var currentDescriptor=Object.getOwnPropertyDescriptor(object,property);if(currentDescriptor&&!currentDescriptor.configurable){return false;}Object.defineProperty(object,property,descriptor);return true;}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function createOnErrorHandler(rid){var nativeOnError=window.onerror;return function onError(error){if(typeof error==="string"&&error.includes(rid)){return true;}if(nativeOnError instanceof Function){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return nativeOnError.apply(window,[error,...args]);}return false;};}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}var updatedArgs=args?[].concat(source).concat(args):[source];try{debugOnPropertyRead.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function debugOnPropertyWrite(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function debugOnPropertyWrite(source,property){if(!property){return;}var rid=randomId();var abort=function abort(){hit(source);debugger;};var setChainPropAccess=function setChainPropAccess(owner,property){var chainInfo=getPropertyInChain(owner,property);var base=chainInfo.base;var prop=chainInfo.prop,chain=chainInfo.chain;if(chain){var setter=function setter(a){base=a;if(a instanceof Object){setChainPropAccess(a,chain);}};Object.defineProperty(owner,prop,{get:function get(){return base;},set:setter});return;}setPropertyAccess(base,prop,{set:abort});};setChainPropAccess(window,property);window.onerror=createOnErrorHandler(rid).bind();}function randomId(){return Math.random().toString(36).slice(2,9);}function setPropertyAccess(object,property,descriptor){var currentDescriptor=Object.getOwnPropertyDescriptor(object,property);if(currentDescriptor&&!currentDescriptor.configurable){return false;}Object.defineProperty(object,property,descriptor);return true;}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function createOnErrorHandler(rid){var nativeOnError=window.onerror;return function onError(error){if(typeof error==="string"&&error.includes(rid)){return true;}if(nativeOnError instanceof Function){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return nativeOnError.apply(window,[error,...args]);}return false;};}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}var updatedArgs=args?[].concat(source).concat(args):[source];try{debugOnPropertyWrite.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function dirString(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function dirString(source,times){var _console=console,dir=_console.dir;function dirWrapper(object){if(typeof dir==="function"){dir.call(this,object);}hit(source);}console.dir=dirWrapper;}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{dirString.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function disableNewtabLinks(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function disableNewtabLinks(source){document.addEventListener("click",function(ev){var target=ev.target;while(target!==null){if(target.localName==="a"&&target.hasAttribute("target")){ev.stopPropagation();ev.preventDefault();hit(source);break;}target=target.parentNode;}});}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{disableNewtabLinks.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function evalDataPrune(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function evalDataPrune(source,propsToRemove,requiredInitialProps,stack){var prunePaths=getPrunePath(propsToRemove);var requiredPaths=getPrunePath(requiredInitialProps);var nativeObjects={nativeStringify:window.JSON.stringify};var evalWrapper=function evalWrapper(target,thisArg,args){var data=Reflect.apply(target,thisArg,args);if(typeof data==="object"){data=jsonPruner(source,data,prunePaths,requiredPaths,stack,nativeObjects);}return data;};var evalHandler={apply:evalWrapper};window.eval=new Proxy(window.eval,evalHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function matchStackTrace(stackMatch,stackTrace){if(!stackMatch||stackMatch===""){return true;}var regExpValues=backupRegExpValues();if(shouldAbortInlineOrInjectedScript(stackMatch,stackTrace)){if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return true;}var stackRegexp=toRegExp(stackMatch);var refinedStackTrace=stackTrace.split("\n").slice(2).map(function(line){return line.trim();}).join("\n");if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return getNativeRegexpTest().call(stackRegexp,refinedStackTrace);}function getWildcardPropertyInChain(base,chain){var lookThrough=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var output=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[];var pos=chain.indexOf(".");if(pos===-1){if(chain==="*"||chain==="[]"){for(var key in base){if(Object.prototype.hasOwnProperty.call(base,key)){output.push({base:base,prop:key});}}}else {output.push({base:base,prop:chain});}return output;}var prop=chain.slice(0,pos);var shouldLookThrough=prop==="[]"&&Array.isArray(base)||prop==="*"&&base instanceof Object;if(shouldLookThrough){var nextProp=chain.slice(pos+1);var baseKeys=Object.keys(base);baseKeys.forEach(function(key){var item=base[key];getWildcardPropertyInChain(item,nextProp,lookThrough,output);});}if(Array.isArray(base)){base.forEach(function(key){var nextBase=key;if(nextBase!==undefined){getWildcardPropertyInChain(nextBase,chain,lookThrough,output);}});}var nextBase=base[prop];chain=chain.slice(pos+1);if(nextBase!==undefined){getWildcardPropertyInChain(nextBase,chain,lookThrough,output);}return output;}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function isPruningNeeded(source,root,prunePaths,requiredPaths,stack,nativeObjects){if(!root){return false;}var nativeStringify=nativeObjects.nativeStringify;var shouldProcess;if(prunePaths.length===0&&requiredPaths.length>0){var rootString=nativeStringify(root);var matchRegex=toRegExp(requiredPaths.join(""));var shouldLog=matchRegex.test(rootString);if(shouldLog){logMessage(source,"".concat(window.location.hostname,"\n").concat(nativeStringify(root,null,2),"\nStack trace:\n").concat(new Error().stack),true);if(root&&typeof root==="object"){logMessage(source,root,true,false);}shouldProcess=false;return shouldProcess;}}if(stack&&!matchStackTrace(stack,new Error().stack||"")){shouldProcess=false;return shouldProcess;}var wildcardSymbols=[".*.","*.",".*",".[].","[].",".[]"];var _loop=function _loop(){var requiredPath=requiredPaths[i];var lastNestedPropName=requiredPath.split(".").pop();var hasWildcard=wildcardSymbols.some(function(symbol){return requiredPath.includes(symbol);});var details=getWildcardPropertyInChain(root,requiredPath,hasWildcard);if(!details.length){shouldProcess=false;return {v:shouldProcess};}shouldProcess=!hasWildcard;for(var j=0;j<details.length;j+=1){var hasRequiredProp=typeof lastNestedPropName==="string"&&details[j].base[lastNestedPropName]!==undefined;if(hasWildcard){shouldProcess=hasRequiredProp||shouldProcess;}else {shouldProcess=hasRequiredProp&&shouldProcess;}}};for(var i=0;i<requiredPaths.length;i+=1){var _ret=_loop();if(typeof _ret==="object")return _ret.v;}return shouldProcess;}function jsonPruner(source,root,prunePaths,requiredPaths,stack,nativeObjects){var nativeStringify=nativeObjects.nativeStringify;if(prunePaths.length===0&&requiredPaths.length===0){logMessage(source,"".concat(window.location.hostname,"\n").concat(nativeStringify(root,null,2),"\nStack trace:\n").concat(new Error().stack),true);if(root&&typeof root==="object"){logMessage(source,root,true,false);}return root;}try{if(isPruningNeeded(source,root,prunePaths,requiredPaths,stack,nativeObjects)===false){return root;}prunePaths.forEach(function(path){var ownerObjArr=getWildcardPropertyInChain(root,path,true);ownerObjArr.forEach(function(ownerObj){if(ownerObj!==undefined&&ownerObj.base){delete ownerObj.base[ownerObj.prop];hit(source);}});});}catch(e){logMessage(source,e);}return root;}function getPrunePath(props){var validPropsString=typeof props==="string"&&props!==undefined&&props!=="";return validPropsString?props.split(/ +/):[];}function getNativeRegexpTest(){var descriptor=Object.getOwnPropertyDescriptor(RegExp.prototype,"test");var nativeRegexTest=descriptor===null||descriptor===void 0?void 0:descriptor.value;if(descriptor&&typeof descriptor.value==="function"){return nativeRegexTest;}throw new Error("RegExp.prototype.test is not a function");}function shouldAbortInlineOrInjectedScript(stackMatch,stackTrace){var INLINE_SCRIPT_STRING="inlineScript";var INJECTED_SCRIPT_STRING="injectedScript";var INJECTED_SCRIPT_MARKER="<anonymous>";var isInlineScript=function isInlineScript(match){return match.includes(INLINE_SCRIPT_STRING);};var isInjectedScript=function isInjectedScript(match){return match.includes(INJECTED_SCRIPT_STRING);};if(!(isInlineScript(stackMatch)||isInjectedScript(stackMatch))){return false;}var documentURL=window.location.href;var pos=documentURL.indexOf("#");if(pos!==-1){documentURL=documentURL.slice(0,pos);}var stackSteps=stackTrace.split("\n").slice(2).map(function(line){return line.trim();});var stackLines=stackSteps.map(function(line){var stack;var getStackTraceValues=/(.*?@)?(\S+)(:\d+)(:\d+)\)?$/.exec(line);if(getStackTraceValues){var _stackURL,_stackURL2;var stackURL=getStackTraceValues[2];var stackLine=getStackTraceValues[3];var stackCol=getStackTraceValues[4];if((_stackURL=stackURL)!==null&&_stackURL!==void 0&&_stackURL.startsWith("(")){stackURL=stackURL.slice(1);}if((_stackURL2=stackURL)!==null&&_stackURL2!==void 0&&_stackURL2.startsWith(INJECTED_SCRIPT_MARKER)){var _stackFunction;stackURL=INJECTED_SCRIPT_STRING;var stackFunction=getStackTraceValues[1]!==undefined?getStackTraceValues[1].slice(0,-1):line.slice(0,getStackTraceValues.index).trim();if((_stackFunction=stackFunction)!==null&&_stackFunction!==void 0&&_stackFunction.startsWith("at")){stackFunction=stackFunction.slice(2).trim();}stack="".concat(stackFunction," ").concat(stackURL).concat(stackLine).concat(stackCol).trim();}else if(stackURL===documentURL){stack="".concat(INLINE_SCRIPT_STRING).concat(stackLine).concat(stackCol).trim();}else {stack="".concat(stackURL).concat(stackLine).concat(stackCol).trim();}}else {stack=line;}return stack;});if(stackLines){for(var index=0;index<stackLines.length;index+=1){if(isInlineScript(stackMatch)&&stackLines[index].startsWith(INLINE_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}if(isInjectedScript(stackMatch)&&stackLines[index].startsWith(INJECTED_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}}}return false;}function backupRegExpValues(){try{var arrayOfRegexpValues=[];for(var index=1;index<10;index+=1){var value="$".concat(index);if(!RegExp[value]){break;}arrayOfRegexpValues.push(RegExp[value]);}return arrayOfRegexpValues;}catch(error){return [];}}function restoreRegExpValues(array){if(!array.length){return;}try{var stringPattern="";if(array.length===1){stringPattern="(".concat(array[0],")");}else {stringPattern=array.reduce(function(accumulator,currentValue,currentIndex){if(currentIndex===1){return "(".concat(accumulator,"),(").concat(currentValue,")");}return "".concat(accumulator,",(").concat(currentValue,")");});}var regExpGroup=new RegExp(stringPattern);array.toString().replace(regExpGroup,"");}catch(error){var message="Failed to restore RegExp values: ".concat(error);console.log(message);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{evalDataPrune.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function forceWindowClose(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function forceWindowClose(source){var path=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";if(typeof window.close!=="function"){var message="window.close() is not a function so 'close-window' scriptlet is unavailable";logMessage(source,message);return;}var closeImmediately=function closeImmediately(){try{hit(source);window.close();}catch(e){logMessage(source,e);}};var closeByExtension=function closeByExtension(){var extCall=function extCall(){dispatchEvent(new Event("adguard:scriptlet-close-window"));};window.addEventListener("adguard:subscribed-to-close-window",extCall,{once:true});setTimeout(function(){window.removeEventListener("adguard:subscribed-to-close-window",extCall,{once:true});},5e3);};var shouldClose=function shouldClose(){if(path===""){return true;}var pathRegexp=toRegExp(path);var currentPath="".concat(window.location.pathname).concat(window.location.search);return pathRegexp.test(currentPath);};if(shouldClose()){closeImmediately();if(navigator.userAgent.includes("Chrome")){closeByExtension();}}}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}var updatedArgs=args?[].concat(source).concat(args):[source];try{forceWindowClose.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function hideInShadowDom(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function hideInShadowDom(source,selector,baseSelector){if(!Element.prototype.attachShadow){return;}var hideElement=function hideElement(targetElement){var DISPLAY_NONE_CSS="display:none!important;";targetElement.style.cssText=DISPLAY_NONE_CSS;};var hideHandler=function hideHandler(){var hostElements=!baseSelector?findHostElements(document.documentElement):document.querySelectorAll(baseSelector);var _loop=function _loop(){var isHidden=false;var _pierceShadowDom=pierceShadowDom(selector,hostElements),targets=_pierceShadowDom.targets,innerHosts=_pierceShadowDom.innerHosts;targets.forEach(function(targetEl){hideElement(targetEl);isHidden=true;});if(isHidden){hit(source);}hostElements=innerHosts;};while(hostElements.length!==0){_loop();}};hideHandler();observeDOMChanges(hideHandler,true);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function observeDOMChanges(callback){var observeAttrs=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var attrsToObserve=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var THROTTLE_DELAY_MS=20;var observer=new MutationObserver(throttle(callbackWrapper,THROTTLE_DELAY_MS));var connect=function connect(){if(attrsToObserve.length>0){observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs,attributeFilter:attrsToObserve});}else {observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs});}};var disconnect=function disconnect(){observer.disconnect();};function callbackWrapper(){disconnect();callback();connect();}connect();}function findHostElements(rootElement){var hosts=[];if(rootElement){var domElems=rootElement.querySelectorAll("*");domElems.forEach(function(el){if(el.shadowRoot){hosts.push(el);}});}return hosts;}function pierceShadowDom(selector,hostElements){var targets=[];var innerHostsAcc=[];hostElements.forEach(function(host){var simpleElems=host.querySelectorAll(selector);targets=targets.concat([].slice.call(simpleElems));var shadowRootElem=host.shadowRoot;var shadowChildren=shadowRootElem.querySelectorAll(selector);targets=targets.concat([].slice.call(shadowChildren));innerHostsAcc.push(findHostElements(shadowRootElem));});var innerHosts=flatten(innerHostsAcc);return {targets:targets,innerHosts:innerHosts};}function flatten(input){var stack=[];input.forEach(function(el){return stack.push(el);});var res=[];while(stack.length){var next=stack.pop();if(Array.isArray(next)){next.forEach(function(el){return stack.push(el);});}else {res.push(next);}}return res.reverse();}function throttle(cb,delay){var wait=false;var savedArgs;var wrapper=function wrapper(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}if(wait){savedArgs=args;return;}cb(...args);wait=true;setTimeout(function(){wait=false;if(savedArgs){wrapper(...savedArgs);savedArgs=null;}},delay);};return wrapper;}var updatedArgs=args?[].concat(source).concat(args):[source];try{hideInShadowDom.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function hrefSanitizer(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function hrefSanitizer(source,selector){var attribute=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"text";if(!selector){logMessage(source,"Selector is required.");return;}var regexpNotValidAtStart=/^(?:[\0- \x7F-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87B-\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+/;var regexpNotValidAtEnd=/(?:[\0- \x7F-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u036F\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482-\u0489\u0530\u0557\u0558\u055A-\u055F\u0589-\u05CF\u05EB-\u05EE\u05F3-\u061F\u064B-\u066D\u0670\u06D4\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u06FD\u06FE\u0700-\u070F\u0711\u0730-\u074C\u07A6-\u07B0\u07B2-\u07C9\u07EB-\u07F3\u07F6-\u07F9\u07FB-\u07FF\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u083F\u0859-\u085F\u086B-\u086F\u0888\u088F-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0970\u0981-\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA-\u09BC\u09BE-\u09CD\u09CF-\u09DB\u09DE\u09E2-\u09EF\u09F2-\u09FB\u09FD-\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A-\u0A58\u0A5D\u0A5F-\u0A71\u0A75-\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA-\u0ABC\u0ABE-\u0ACF\u0AD1-\u0ADF\u0AE2-\u0AF8\u0AFA-\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A-\u0B3C\u0B3E-\u0B5B\u0B5E\u0B62-\u0B70\u0B72-\u0B82\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BCF\u0BD1-\u0C04\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C3E-\u0C57\u0C5B\u0C5C\u0C5E\u0C5F\u0C62-\u0C7F\u0C81-\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA-\u0CBC\u0CBE-\u0CDC\u0CDF\u0CE2-\u0CF0\u0CF3-\u0D03\u0D0D\u0D11\u0D3B\u0D3C\u0D3E-\u0D4D\u0D4F-\u0D53\u0D57-\u0D5E\u0D62-\u0D79\u0D80-\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0E00\u0E31\u0E34-\u0E3F\u0E47-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EB1\u0EB4-\u0EBC\u0EBE\u0EBF\u0EC5\u0EC7-\u0EDB\u0EE0-\u0EFF\u0F01-\u0F3F\u0F48\u0F6D-\u0F87\u0F8D-\u0FFF\u102B-\u103E\u1040-\u104F\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16F0\u16F9-\u16FF\u1712-\u171E\u1732-\u173F\u1752-\u175F\u176D\u1771-\u177F\u17B4-\u17D6\u17D8-\u17DB\u17DD-\u181F\u1879-\u187F\u1885\u1886\u18A9\u18AB-\u18AF\u18F6-\u18FF\u191F-\u194F\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19FF\u1A17-\u1A1F\u1A55-\u1AA6\u1AA8-\u1B04\u1B34-\u1B44\u1B4D-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BFF\u1C24-\u1C4C\u1C50-\u1C59\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1CFB-\u1CFF\u1DC0-\u1DFF\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u2182\u2185-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7F\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF-\u2E2E\u2E30-\u3004\u3007-\u3030\u3036-\u303A\u303D-\u3040\u3097-\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA620-\uA629\uA62C-\uA63F\uA66F-\uA67E\uA69E\uA69F\uA6E6-\uA716\uA720\uA721\uA789\uA78A\uA7CB-\uA7CF\uA7D2\uA7D4\uA7DA-\uA7F1\uA802\uA806\uA80B\uA823-\uA83F\uA874-\uA881\uA8B4-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF-\uA909\uA926-\uA92F\uA947-\uA95F\uA97D-\uA983\uA9B3-\uA9CE\uA9D0-\uA9DF\uA9E5\uA9F0-\uA9F9\uA9FF\uAA29-\uAA3F\uAA43\uAA4C-\uAA5F\uAA77-\uAA79\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAC3-\uAADA\uAADE\uAADF\uAAEB-\uAAF1\uAAF5-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABE3-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB1E\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFE6F\uFE75\uFEFD-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEFF\uDF20-\uDF2C\uDF41\uDF4A-\uDF4F\uDF76-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0-\uDFFF]|\uD801[\uDC9E-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDD6F\uDD7B\uDD8B\uDD93\uDD96\uDDA2\uDDB2\uDDBA\uDDBD-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDF7F\uDF86\uDFB1\uDFBB-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE01-\uDE0F\uDE14\uDE18\uDE36-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE5-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD24-\uDE7F\uDEAA-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF46-\uDF6F\uDF82-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC00-\uDC02\uDC38-\uDC70\uDC73\uDC74\uDC76-\uDC82\uDCB0-\uDCCF\uDCE9-\uDD02\uDD27-\uDD43\uDD45\uDD46\uDD48-\uDD4F\uDD73-\uDD75\uDD77-\uDD82\uDDB3-\uDDC0\uDDC5-\uDDD9\uDDDB\uDDDD-\uDDFF\uDE12\uDE2C-\uDE3E\uDE41-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEDF-\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A-\uDF3C\uDF3E-\uDF4F\uDF51-\uDF5C\uDF62-\uDFFF]|\uD805[\uDC35-\uDC46\uDC4B-\uDC5E\uDC62-\uDC7F\uDCB0-\uDCC3\uDCC6\uDCC8-\uDD7F\uDDAF-\uDDD7\uDDDC-\uDDFF\uDE30-\uDE43\uDE45-\uDE7F\uDEAB-\uDEB7\uDEB9-\uDEFF\uDF1B-\uDF3F\uDF47-\uDFFF]|\uD806[\uDC2C-\uDC9F\uDCE0-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD30-\uDD3E\uDD40\uDD42-\uDD9F\uDDA8\uDDA9\uDDD1-\uDDE0\uDDE2\uDDE4-\uDDFF\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE4F\uDE51-\uDE5B\uDE8A-\uDE9C\uDE9E-\uDEAF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC2F-\uDC3F\uDC41-\uDC71\uDC90-\uDCFF\uDD07\uDD0A\uDD31-\uDD45\uDD47-\uDD5F\uDD66\uDD69\uDD8A-\uDD97\uDD99-\uDEDF\uDEF3-\uDF01\uDF03\uDF11\uDF34-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC00-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80E-\uD810\uD812-\uD819\uD824-\uD82A\uD82D\uD82E\uD830-\uD834\uD836\uD83C-\uD83F\uD87B-\uD87D\uD87F\uD889-\uDBFF][\uDC00-\uDFFF]|\uD80B[\uDC00-\uDF8F\uDFF1-\uDFFF]|\uD80D[\uDC30-\uDC40\uDC47-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F-\uDE6F\uDEBF-\uDECF\uDEEE-\uDEFF\uDF30-\uDF3F\uDF44-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4F\uDF51-\uDF92\uDFA0-\uDFDF\uDFE2\uDFE4-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82B[\uDC00-\uDFEF\uDFF4\uDFFC\uDFFF]|\uD82C[\uDD23-\uDD31\uDD33-\uDD4F\uDD53\uDD54\uDD56-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC-\uDFFF]|\uD837[\uDC00-\uDEFF\uDF1F-\uDF24\uDF2B-\uDFFF]|\uD838[\uDC00-\uDC2F\uDC6E-\uDCFF\uDD2D-\uDD36\uDD3E-\uDD4D\uDD4F-\uDE8F\uDEAE-\uDEBF\uDEEC-\uDFFF]|\uD839[\uDC00-\uDCCF\uDCEC-\uDFDF\uDFE7\uDFEC\uDFEF\uDFFF]|\uD83A[\uDCC5-\uDCFF\uDD44-\uDD4A\uDD4C-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD869[\uDEE0-\uDEFF]|\uD86D[\uDF3A-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDF4F]|\uD888[\uDFB0-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+$/;var extractNewHref=function extractNewHref(anchor,attr){if(attr==="text"){if(!anchor.textContent){return "";}return anchor.textContent.replace(regexpNotValidAtStart,"").replace(regexpNotValidAtEnd,"");}if(attr.startsWith("?")){try{var url=new URL(anchor.href,document.location.href);return url.searchParams.get(attr.slice(1))||"";}catch(ex){logMessage(source,"Cannot retrieve the parameter '".concat(attr.slice(1),"' from the URL '").concat(anchor.href));return "";}}if(attr.startsWith("[")&&attr.endsWith("]")){return anchor.getAttribute(attr.slice(1,-1))||"";}return "";};var getValidURL=function getValidURL(text){if(!text){return null;}try{var _URL=new URL(text,document.location.href),href=_URL.href,protocol=_URL.protocol;if(protocol!=="http:"&&protocol!=="https:"){logMessage(source,'Protocol not allowed: "'.concat(protocol,'", from URL: "').concat(href,'"'));return null;}return href;}catch(_unused){return null;}};var isSanitizableAnchor=function isSanitizableAnchor(element){return element.nodeName.toLowerCase()==="a"&&element.hasAttribute("href");};var sanitize=function sanitize(elementSelector){var elements;try{elements=document.querySelectorAll(elementSelector);}catch(e){logMessage(source,'Invalid selector "'.concat(elementSelector,'"'));return;}elements.forEach(function(elem){try{if(!isSanitizableAnchor(elem)){return;}var newHref=extractNewHref(elem,attribute);var newValidHref=getValidURL(newHref);if(!newValidHref){logMessage(source,"Invalid URL: ".concat(newHref));return;}var oldHref=elem.href;elem.setAttribute("href",newValidHref);if(newValidHref!==oldHref){logMessage(source,'Sanitized "'.concat(oldHref,'" to "').concat(newValidHref,'".'));}}catch(ex){logMessage(source,"Failed to sanitize ".concat(elem,"."));}});hit(source);};var run=function run(){sanitize(selector);observeDOMChanges(function(){return sanitize(selector);},true);};if(document.readyState==="loading"){window.addEventListener("DOMContentLoaded",run,{once:true});}else {run();}}function observeDOMChanges(callback){var observeAttrs=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var attrsToObserve=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var THROTTLE_DELAY_MS=20;var observer=new MutationObserver(throttle(callbackWrapper,THROTTLE_DELAY_MS));var connect=function connect(){if(attrsToObserve.length>0){observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs,attributeFilter:attrsToObserve});}else {observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs});}};var disconnect=function disconnect(){observer.disconnect();};function callbackWrapper(){disconnect();callback();connect();}connect();}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function throttle(cb,delay){var wait=false;var savedArgs;var wrapper=function wrapper(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}if(wait){savedArgs=args;return;}cb(...args);wait=true;setTimeout(function(){wait=false;if(savedArgs){wrapper(...savedArgs);savedArgs=null;}},delay);};return wrapper;}var updatedArgs=args?[].concat(source).concat(args):[source];try{hrefSanitizer.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function injectCssInShadowDom(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function injectCssInShadowDom(source,cssRule){var hostSelector=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"";if(!Element.prototype.attachShadow||typeof Proxy==="undefined"||typeof Reflect==="undefined"){return;}if(cssRule.match(/(url|image-set)\(.*\)/i)){logMessage(source,'"url()" function is not allowed for css rules');return;}var callback=function callback(shadowRoot){try{var stylesheet=new CSSStyleSheet();try{stylesheet.insertRule(cssRule);}catch(e){logMessage(source,"Unable to apply the rule '".concat(cssRule,"' due to: \n'").concat(e.message,"'"));return;}shadowRoot.adoptedStyleSheets=[...shadowRoot.adoptedStyleSheets,stylesheet];}catch(_unused){var styleTag=document.createElement("style");styleTag.innerText=cssRule;shadowRoot.appendChild(styleTag);}hit(source);};hijackAttachShadow(window,hostSelector,callback);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function hijackAttachShadow(context,hostSelector,callback){var handlerWrapper=function handlerWrapper(target,thisArg,args){var shadowRoot=Reflect.apply(target,thisArg,args);if(thisArg&&thisArg.matches(hostSelector||"*")){callback(shadowRoot);}return shadowRoot;};var attachShadowHandler={apply:handlerWrapper};context.Element.prototype.attachShadow=new Proxy(context.Element.prototype.attachShadow,attachShadowHandler);}var updatedArgs=args?[].concat(source).concat(args):[source];try{injectCssInShadowDom.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function jsonPrune(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function jsonPrune(source,propsToRemove,requiredInitialProps){var stack=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var prunePaths=getPrunePath(propsToRemove);var requiredPaths=getPrunePath(requiredInitialProps);var nativeObjects={nativeStringify:window.JSON.stringify};var nativeJSONParse=JSON.parse;var jsonParseWrapper=function jsonParseWrapper(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var root=nativeJSONParse.apply(JSON,args);return jsonPruner(source,root,prunePaths,requiredPaths,stack,nativeObjects);};jsonParseWrapper.toString=nativeJSONParse.toString.bind(nativeJSONParse);JSON.parse=jsonParseWrapper;var nativeResponseJson=Response.prototype.json;var responseJsonWrapper=function responseJsonWrapper(){var promise=nativeResponseJson.apply(this);return promise.then(function(obj){return jsonPruner(source,obj,prunePaths,requiredPaths,stack,nativeObjects);});};if(typeof Response==="undefined"){return;}Response.prototype.json=responseJsonWrapper;}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function matchStackTrace(stackMatch,stackTrace){if(!stackMatch||stackMatch===""){return true;}var regExpValues=backupRegExpValues();if(shouldAbortInlineOrInjectedScript(stackMatch,stackTrace)){if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return true;}var stackRegexp=toRegExp(stackMatch);var refinedStackTrace=stackTrace.split("\n").slice(2).map(function(line){return line.trim();}).join("\n");if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return getNativeRegexpTest().call(stackRegexp,refinedStackTrace);}function getWildcardPropertyInChain(base,chain){var lookThrough=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var output=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[];var pos=chain.indexOf(".");if(pos===-1){if(chain==="*"||chain==="[]"){for(var key in base){if(Object.prototype.hasOwnProperty.call(base,key)){output.push({base:base,prop:key});}}}else {output.push({base:base,prop:chain});}return output;}var prop=chain.slice(0,pos);var shouldLookThrough=prop==="[]"&&Array.isArray(base)||prop==="*"&&base instanceof Object;if(shouldLookThrough){var nextProp=chain.slice(pos+1);var baseKeys=Object.keys(base);baseKeys.forEach(function(key){var item=base[key];getWildcardPropertyInChain(item,nextProp,lookThrough,output);});}if(Array.isArray(base)){base.forEach(function(key){var nextBase=key;if(nextBase!==undefined){getWildcardPropertyInChain(nextBase,chain,lookThrough,output);}});}var nextBase=base[prop];chain=chain.slice(pos+1);if(nextBase!==undefined){getWildcardPropertyInChain(nextBase,chain,lookThrough,output);}return output;}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function isPruningNeeded(source,root,prunePaths,requiredPaths,stack,nativeObjects){if(!root){return false;}var nativeStringify=nativeObjects.nativeStringify;var shouldProcess;if(prunePaths.length===0&&requiredPaths.length>0){var rootString=nativeStringify(root);var matchRegex=toRegExp(requiredPaths.join(""));var shouldLog=matchRegex.test(rootString);if(shouldLog){logMessage(source,"".concat(window.location.hostname,"\n").concat(nativeStringify(root,null,2),"\nStack trace:\n").concat(new Error().stack),true);if(root&&typeof root==="object"){logMessage(source,root,true,false);}shouldProcess=false;return shouldProcess;}}if(stack&&!matchStackTrace(stack,new Error().stack||"")){shouldProcess=false;return shouldProcess;}var wildcardSymbols=[".*.","*.",".*",".[].","[].",".[]"];var _loop=function _loop(){var requiredPath=requiredPaths[i];var lastNestedPropName=requiredPath.split(".").pop();var hasWildcard=wildcardSymbols.some(function(symbol){return requiredPath.includes(symbol);});var details=getWildcardPropertyInChain(root,requiredPath,hasWildcard);if(!details.length){shouldProcess=false;return {v:shouldProcess};}shouldProcess=!hasWildcard;for(var j=0;j<details.length;j+=1){var hasRequiredProp=typeof lastNestedPropName==="string"&&details[j].base[lastNestedPropName]!==undefined;if(hasWildcard){shouldProcess=hasRequiredProp||shouldProcess;}else {shouldProcess=hasRequiredProp&&shouldProcess;}}};for(var i=0;i<requiredPaths.length;i+=1){var _ret=_loop();if(typeof _ret==="object")return _ret.v;}return shouldProcess;}function jsonPruner(source,root,prunePaths,requiredPaths,stack,nativeObjects){var nativeStringify=nativeObjects.nativeStringify;if(prunePaths.length===0&&requiredPaths.length===0){logMessage(source,"".concat(window.location.hostname,"\n").concat(nativeStringify(root,null,2),"\nStack trace:\n").concat(new Error().stack),true);if(root&&typeof root==="object"){logMessage(source,root,true,false);}return root;}try{if(isPruningNeeded(source,root,prunePaths,requiredPaths,stack,nativeObjects)===false){return root;}prunePaths.forEach(function(path){var ownerObjArr=getWildcardPropertyInChain(root,path,true);ownerObjArr.forEach(function(ownerObj){if(ownerObj!==undefined&&ownerObj.base){delete ownerObj.base[ownerObj.prop];hit(source);}});});}catch(e){logMessage(source,e);}return root;}function getPrunePath(props){var validPropsString=typeof props==="string"&&props!==undefined&&props!=="";return validPropsString?props.split(/ +/):[];}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function getNativeRegexpTest(){var descriptor=Object.getOwnPropertyDescriptor(RegExp.prototype,"test");var nativeRegexTest=descriptor===null||descriptor===void 0?void 0:descriptor.value;if(descriptor&&typeof descriptor.value==="function"){return nativeRegexTest;}throw new Error("RegExp.prototype.test is not a function");}function shouldAbortInlineOrInjectedScript(stackMatch,stackTrace){var INLINE_SCRIPT_STRING="inlineScript";var INJECTED_SCRIPT_STRING="injectedScript";var INJECTED_SCRIPT_MARKER="<anonymous>";var isInlineScript=function isInlineScript(match){return match.includes(INLINE_SCRIPT_STRING);};var isInjectedScript=function isInjectedScript(match){return match.includes(INJECTED_SCRIPT_STRING);};if(!(isInlineScript(stackMatch)||isInjectedScript(stackMatch))){return false;}var documentURL=window.location.href;var pos=documentURL.indexOf("#");if(pos!==-1){documentURL=documentURL.slice(0,pos);}var stackSteps=stackTrace.split("\n").slice(2).map(function(line){return line.trim();});var stackLines=stackSteps.map(function(line){var stack;var getStackTraceValues=/(.*?@)?(\S+)(:\d+)(:\d+)\)?$/.exec(line);if(getStackTraceValues){var _stackURL,_stackURL2;var stackURL=getStackTraceValues[2];var stackLine=getStackTraceValues[3];var stackCol=getStackTraceValues[4];if((_stackURL=stackURL)!==null&&_stackURL!==void 0&&_stackURL.startsWith("(")){stackURL=stackURL.slice(1);}if((_stackURL2=stackURL)!==null&&_stackURL2!==void 0&&_stackURL2.startsWith(INJECTED_SCRIPT_MARKER)){var _stackFunction;stackURL=INJECTED_SCRIPT_STRING;var stackFunction=getStackTraceValues[1]!==undefined?getStackTraceValues[1].slice(0,-1):line.slice(0,getStackTraceValues.index).trim();if((_stackFunction=stackFunction)!==null&&_stackFunction!==void 0&&_stackFunction.startsWith("at")){stackFunction=stackFunction.slice(2).trim();}stack="".concat(stackFunction," ").concat(stackURL).concat(stackLine).concat(stackCol).trim();}else if(stackURL===documentURL){stack="".concat(INLINE_SCRIPT_STRING).concat(stackLine).concat(stackCol).trim();}else {stack="".concat(stackURL).concat(stackLine).concat(stackCol).trim();}}else {stack=line;}return stack;});if(stackLines){for(var index=0;index<stackLines.length;index+=1){if(isInlineScript(stackMatch)&&stackLines[index].startsWith(INLINE_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}if(isInjectedScript(stackMatch)&&stackLines[index].startsWith(INJECTED_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}}}return false;}function backupRegExpValues(){try{var arrayOfRegexpValues=[];for(var index=1;index<10;index+=1){var value="$".concat(index);if(!RegExp[value]){break;}arrayOfRegexpValues.push(RegExp[value]);}return arrayOfRegexpValues;}catch(error){return [];}}function restoreRegExpValues(array){if(!array.length){return;}try{var stringPattern="";if(array.length===1){stringPattern="(".concat(array[0],")");}else {stringPattern=array.reduce(function(accumulator,currentValue,currentIndex){if(currentIndex===1){return "(".concat(accumulator,"),(").concat(currentValue,")");}return "".concat(accumulator,",(").concat(currentValue,")");});}var regExpGroup=new RegExp(stringPattern);array.toString().replace(regExpGroup,"");}catch(error){var message="Failed to restore RegExp values: ".concat(error);console.log(message);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{jsonPrune.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function jsonPruneFetchResponse(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function jsonPruneFetchResponse(source,propsToRemove,obligatoryProps){var propsToMatch=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var stack=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"";if(typeof fetch==="undefined"||typeof Proxy==="undefined"||typeof Response==="undefined"){return;}var prunePaths=getPrunePath(propsToRemove);var requiredPaths=getPrunePath(obligatoryProps);var nativeStringify=window.JSON.stringify;var nativeRequestClone=window.Request.prototype.clone;var nativeResponseClone=window.Response.prototype.clone;var nativeFetch=window.fetch;var fetchHandlerWrapper=async function fetchHandlerWrapper(target,thisArg,args){var fetchData=getFetchData(args,nativeRequestClone);if(!matchRequestProps(source,propsToMatch,fetchData)){return Reflect.apply(target,thisArg,args);}var originalResponse;var clonedResponse;try{originalResponse=await nativeFetch.apply(null,args);clonedResponse=nativeResponseClone.call(originalResponse);}catch(_unused){logMessage(source,"Could not make an original fetch request: ".concat(fetchData.url));return Reflect.apply(target,thisArg,args);}var json;try{json=await originalResponse.json();}catch(e){var message="Response body can't be converted to json: ".concat(objectToString(fetchData));logMessage(source,message);return clonedResponse;}var modifiedJson=jsonPruner(source,json,prunePaths,requiredPaths,stack,{nativeStringify:nativeStringify,nativeRequestClone:nativeRequestClone,nativeResponseClone:nativeResponseClone,nativeFetch:nativeFetch});var forgedResponse=forgeResponse(originalResponse,nativeStringify(modifiedJson));hit(source);return forgedResponse;};var fetchHandler={apply:fetchHandlerWrapper};window.fetch=new Proxy(window.fetch,fetchHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function getFetchData(args,nativeRequestClone){var fetchPropsObj={};var resource=args[0];var fetchUrl;var fetchInit;if(resource instanceof Request){var realData=nativeRequestClone.call(resource);var requestData=getRequestData(realData);fetchUrl=requestData.url;fetchInit=requestData;}else {fetchUrl=resource;fetchInit=args[1];}fetchPropsObj.url=fetchUrl;if(fetchInit instanceof Object){var props=Object.keys(fetchInit);props.forEach(function(prop){fetchPropsObj[prop]=fetchInit[prop];});}return fetchPropsObj;}function objectToString(obj){if(!obj||typeof obj!=="object"){return String(obj);}if(isEmptyObject(obj)){return "{}";}return Object.entries(obj).map(function(pair){var key=pair[0];var value=pair[1];var recordValueStr=value;if(value instanceof Object){recordValueStr="{ ".concat(objectToString(value)," }");}return "".concat(key,':"').concat(recordValueStr,'"');}).join(" ");}function matchRequestProps(source,propsToMatch,requestData){if(propsToMatch===""||propsToMatch==="*"){return true;}var isMatched;var parsedData=parseMatchProps(propsToMatch);if(!isValidParsedData(parsedData)){logMessage(source,"Invalid parameter: ".concat(propsToMatch));isMatched=false;}else {var matchData=getMatchPropsData(parsedData);var matchKeys=Object.keys(matchData);isMatched=matchKeys.every(function(matchKey){var matchValue=matchData[matchKey];var dataValue=requestData[matchKey];return Object.prototype.hasOwnProperty.call(requestData,matchKey)&&typeof dataValue==="string"&&(matchValue===null||matchValue===void 0?void 0:matchValue.test(dataValue));});}return isMatched;}function jsonPruner(source,root,prunePaths,requiredPaths,stack,nativeObjects){var nativeStringify=nativeObjects.nativeStringify;if(prunePaths.length===0&&requiredPaths.length===0){logMessage(source,"".concat(window.location.hostname,"\n").concat(nativeStringify(root,null,2),"\nStack trace:\n").concat(new Error().stack),true);if(root&&typeof root==="object"){logMessage(source,root,true,false);}return root;}try{if(isPruningNeeded(source,root,prunePaths,requiredPaths,stack,nativeObjects)===false){return root;}prunePaths.forEach(function(path){var ownerObjArr=getWildcardPropertyInChain(root,path,true);ownerObjArr.forEach(function(ownerObj){if(ownerObj!==undefined&&ownerObj.base){delete ownerObj.base[ownerObj.prop];hit(source);}});});}catch(e){logMessage(source,e);}return root;}function getPrunePath(props){var validPropsString=typeof props==="string"&&props!==undefined&&props!=="";return validPropsString?props.split(/ +/):[];}function forgeResponse(response,textContent){var bodyUsed=response.bodyUsed,headers=response.headers,ok=response.ok,redirected=response.redirected,status=response.status,statusText=response.statusText,type=response.type,url=response.url;var forgedResponse=new Response(textContent,{status:status,statusText:statusText,headers:headers});Object.defineProperties(forgedResponse,{url:{value:url},type:{value:type},ok:{value:ok},bodyUsed:{value:bodyUsed},redirected:{value:redirected}});return forgedResponse;}function isPruningNeeded(source,root,prunePaths,requiredPaths,stack,nativeObjects){if(!root){return false;}var nativeStringify=nativeObjects.nativeStringify;var shouldProcess;if(prunePaths.length===0&&requiredPaths.length>0){var rootString=nativeStringify(root);var matchRegex=toRegExp(requiredPaths.join(""));var shouldLog=matchRegex.test(rootString);if(shouldLog){logMessage(source,"".concat(window.location.hostname,"\n").concat(nativeStringify(root,null,2),"\nStack trace:\n").concat(new Error().stack),true);if(root&&typeof root==="object"){logMessage(source,root,true,false);}shouldProcess=false;return shouldProcess;}}if(stack&&!matchStackTrace(stack,new Error().stack||"")){shouldProcess=false;return shouldProcess;}var wildcardSymbols=[".*.","*.",".*",".[].","[].",".[]"];var _loop=function _loop(){var requiredPath=requiredPaths[i];var lastNestedPropName=requiredPath.split(".").pop();var hasWildcard=wildcardSymbols.some(function(symbol){return requiredPath.includes(symbol);});var details=getWildcardPropertyInChain(root,requiredPath,hasWildcard);if(!details.length){shouldProcess=false;return {v:shouldProcess};}shouldProcess=!hasWildcard;for(var j=0;j<details.length;j+=1){var hasRequiredProp=typeof lastNestedPropName==="string"&&details[j].base[lastNestedPropName]!==undefined;if(hasWildcard){shouldProcess=hasRequiredProp||shouldProcess;}else {shouldProcess=hasRequiredProp&&shouldProcess;}}};for(var i=0;i<requiredPaths.length;i+=1){var _ret=_loop();if(typeof _ret==="object")return _ret.v;}return shouldProcess;}function matchStackTrace(stackMatch,stackTrace){if(!stackMatch||stackMatch===""){return true;}var regExpValues=backupRegExpValues();if(shouldAbortInlineOrInjectedScript(stackMatch,stackTrace)){if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return true;}var stackRegexp=toRegExp(stackMatch);var refinedStackTrace=stackTrace.split("\n").slice(2).map(function(line){return line.trim();}).join("\n");if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return getNativeRegexpTest().call(stackRegexp,refinedStackTrace);}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}function getRequestData(request){var requestInitOptions=getRequestProps();var entries=requestInitOptions.map(function(key){var value=request[key];return [key,value];});return Object.fromEntries(entries);}function getRequestProps(){return ["url","method","headers","body","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","mode"];}function parseMatchProps(propsToMatchStr){var PROPS_DIVIDER=" ";var PAIRS_MARKER=":";var isRequestProp=function isRequestProp(prop){return getRequestProps().includes(prop);};var propsObj={};var props=propsToMatchStr.split(PROPS_DIVIDER);props.forEach(function(prop){var dividerInd=prop.indexOf(PAIRS_MARKER);var key=prop.slice(0,dividerInd);if(isRequestProp(key)){var value=prop.slice(dividerInd+1);propsObj[key]=value;}else {propsObj.url=prop;}});return propsObj;}function isValidParsedData(data){return Object.values(data).every(function(value){return isValidStrPattern(value);});}function getMatchPropsData(data){var matchData={};var dataKeys=Object.keys(data);dataKeys.forEach(function(key){matchData[key]=toRegExp(data[key]);});return matchData;}function getWildcardPropertyInChain(base,chain){var lookThrough=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var output=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[];var pos=chain.indexOf(".");if(pos===-1){if(chain==="*"||chain==="[]"){for(var key in base){if(Object.prototype.hasOwnProperty.call(base,key)){output.push({base:base,prop:key});}}}else {output.push({base:base,prop:chain});}return output;}var prop=chain.slice(0,pos);var shouldLookThrough=prop==="[]"&&Array.isArray(base)||prop==="*"&&base instanceof Object;if(shouldLookThrough){var nextProp=chain.slice(pos+1);var baseKeys=Object.keys(base);baseKeys.forEach(function(key){var item=base[key];getWildcardPropertyInChain(item,nextProp,lookThrough,output);});}if(Array.isArray(base)){base.forEach(function(key){var nextBase=key;if(nextBase!==undefined){getWildcardPropertyInChain(nextBase,chain,lookThrough,output);}});}var nextBase=base[prop];chain=chain.slice(pos+1);if(nextBase!==undefined){getWildcardPropertyInChain(nextBase,chain,lookThrough,output);}return output;}function shouldAbortInlineOrInjectedScript(stackMatch,stackTrace){var INLINE_SCRIPT_STRING="inlineScript";var INJECTED_SCRIPT_STRING="injectedScript";var INJECTED_SCRIPT_MARKER="<anonymous>";var isInlineScript=function isInlineScript(match){return match.includes(INLINE_SCRIPT_STRING);};var isInjectedScript=function isInjectedScript(match){return match.includes(INJECTED_SCRIPT_STRING);};if(!(isInlineScript(stackMatch)||isInjectedScript(stackMatch))){return false;}var documentURL=window.location.href;var pos=documentURL.indexOf("#");if(pos!==-1){documentURL=documentURL.slice(0,pos);}var stackSteps=stackTrace.split("\n").slice(2).map(function(line){return line.trim();});var stackLines=stackSteps.map(function(line){var stack;var getStackTraceValues=/(.*?@)?(\S+)(:\d+)(:\d+)\)?$/.exec(line);if(getStackTraceValues){var _stackURL,_stackURL2;var stackURL=getStackTraceValues[2];var stackLine=getStackTraceValues[3];var stackCol=getStackTraceValues[4];if((_stackURL=stackURL)!==null&&_stackURL!==void 0&&_stackURL.startsWith("(")){stackURL=stackURL.slice(1);}if((_stackURL2=stackURL)!==null&&_stackURL2!==void 0&&_stackURL2.startsWith(INJECTED_SCRIPT_MARKER)){var _stackFunction;stackURL=INJECTED_SCRIPT_STRING;var stackFunction=getStackTraceValues[1]!==undefined?getStackTraceValues[1].slice(0,-1):line.slice(0,getStackTraceValues.index).trim();if((_stackFunction=stackFunction)!==null&&_stackFunction!==void 0&&_stackFunction.startsWith("at")){stackFunction=stackFunction.slice(2).trim();}stack="".concat(stackFunction," ").concat(stackURL).concat(stackLine).concat(stackCol).trim();}else if(stackURL===documentURL){stack="".concat(INLINE_SCRIPT_STRING).concat(stackLine).concat(stackCol).trim();}else {stack="".concat(stackURL).concat(stackLine).concat(stackCol).trim();}}else {stack=line;}return stack;});if(stackLines){for(var index=0;index<stackLines.length;index+=1){if(isInlineScript(stackMatch)&&stackLines[index].startsWith(INLINE_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}if(isInjectedScript(stackMatch)&&stackLines[index].startsWith(INJECTED_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}}}return false;}function getNativeRegexpTest(){var descriptor=Object.getOwnPropertyDescriptor(RegExp.prototype,"test");var nativeRegexTest=descriptor===null||descriptor===void 0?void 0:descriptor.value;if(descriptor&&typeof descriptor.value==="function"){return nativeRegexTest;}throw new Error("RegExp.prototype.test is not a function");}function backupRegExpValues(){try{var arrayOfRegexpValues=[];for(var index=1;index<10;index+=1){var value="$".concat(index);if(!RegExp[value]){break;}arrayOfRegexpValues.push(RegExp[value]);}return arrayOfRegexpValues;}catch(error){return [];}}function restoreRegExpValues(array){if(!array.length){return;}try{var stringPattern="";if(array.length===1){stringPattern="(".concat(array[0],")");}else {stringPattern=array.reduce(function(accumulator,currentValue,currentIndex){if(currentIndex===1){return "(".concat(accumulator,"),(").concat(currentValue,")");}return "".concat(accumulator,",(").concat(currentValue,")");});}var regExpGroup=new RegExp(stringPattern);array.toString().replace(regExpGroup,"");}catch(error){var message="Failed to restore RegExp values: ".concat(error);console.log(message);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{jsonPruneFetchResponse.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function jsonPruneXhrResponse(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function jsonPruneXhrResponse(source,propsToRemove,obligatoryProps){var propsToMatch=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var stack=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"";if(typeof Proxy==="undefined"){return;}var shouldLog=!propsToRemove&&!obligatoryProps;var prunePaths=getPrunePath(propsToRemove);var requiredPaths=getPrunePath(obligatoryProps);var nativeParse=window.JSON.parse;var nativeStringify=window.JSON.stringify;var nativeOpen=window.XMLHttpRequest.prototype.open;var nativeSend=window.XMLHttpRequest.prototype.send;var setRequestHeaderWrapper=function setRequestHeaderWrapper(setRequestHeader,thisArgument,argsList){thisArgument.collectedHeaders.push(argsList);return Reflect.apply(setRequestHeader,thisArgument,argsList);};var setRequestHeaderHandler={apply:setRequestHeaderWrapper};var xhrData;var openWrapper=function openWrapper(target,thisArg,args){xhrData=getXhrData.apply(null,args);if(matchRequestProps(source,propsToMatch,xhrData)||shouldLog){thisArg.xhrShouldBePruned=true;thisArg.headersReceived=!!thisArg.headersReceived;}if(thisArg.xhrShouldBePruned&&!thisArg.headersReceived){thisArg.headersReceived=true;thisArg.collectedHeaders=[];thisArg.setRequestHeader=new Proxy(thisArg.setRequestHeader,setRequestHeaderHandler);}return Reflect.apply(target,thisArg,args);};var sendWrapper=function sendWrapper(target,thisArg,args){var stackTrace=new Error().stack||"";if(!thisArg.xhrShouldBePruned||stack&&!matchStackTrace(stack,stackTrace)){return Reflect.apply(target,thisArg,args);}var forgedRequest=new XMLHttpRequest();forgedRequest.addEventListener("readystatechange",function(){if(forgedRequest.readyState!==4){return;}var readyState=forgedRequest.readyState,response=forgedRequest.response,responseText=forgedRequest.responseText,responseURL=forgedRequest.responseURL,responseXML=forgedRequest.responseXML,status=forgedRequest.status,statusText=forgedRequest.statusText;var content=responseText||response;if(typeof content!=="string"&&typeof content!=="object"){return;}var modifiedContent;if(typeof content==="string"){try{var jsonContent=nativeParse(content);if(shouldLog){logMessage(source,"".concat(window.location.hostname,"\n").concat(nativeStringify(jsonContent,null,2),"\nStack trace:\n").concat(stackTrace),true);logMessage(source,jsonContent,true,false);modifiedContent=content;}else {modifiedContent=jsonPruner(source,jsonContent,prunePaths,requiredPaths,stack="",{nativeStringify:nativeStringify});try{var responseType=thisArg.responseType;switch(responseType){case"":case"text":modifiedContent=nativeStringify(modifiedContent);break;case"arraybuffer":modifiedContent=new TextEncoder().encode(nativeStringify(modifiedContent)).buffer;break;case"blob":modifiedContent=new Blob([nativeStringify(modifiedContent)]);break;default:break;}}catch(error){var message="Response body cannot be converted to reponse type: '".concat(content,"'");logMessage(source,message);modifiedContent=content;}}}catch(error){var _message="Response body cannot be converted to json: '".concat(content,"'");logMessage(source,_message);modifiedContent=content;}}Object.defineProperties(thisArg,{readyState:{value:readyState,writable:false},responseURL:{value:responseURL,writable:false},responseXML:{value:responseXML,writable:false},status:{value:status,writable:false},statusText:{value:statusText,writable:false},response:{value:modifiedContent,writable:false},responseText:{value:modifiedContent,writable:false}});setTimeout(function(){var stateEvent=new Event("readystatechange");thisArg.dispatchEvent(stateEvent);var loadEvent=new Event("load");thisArg.dispatchEvent(loadEvent);var loadEndEvent=new Event("loadend");thisArg.dispatchEvent(loadEndEvent);},1);hit(source);});nativeOpen.apply(forgedRequest,[xhrData.method,xhrData.url,Boolean(xhrData.async)]);thisArg.collectedHeaders.forEach(function(header){forgedRequest.setRequestHeader(header[0],header[1]);});thisArg.collectedHeaders=[];try{nativeSend.call(forgedRequest,args);}catch(_unused){return Reflect.apply(target,thisArg,args);}return undefined;};var openHandler={apply:openWrapper};var sendHandler={apply:sendWrapper};XMLHttpRequest.prototype.open=new Proxy(XMLHttpRequest.prototype.open,openHandler);XMLHttpRequest.prototype.send=new Proxy(XMLHttpRequest.prototype.send,sendHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function jsonPruner(source,root,prunePaths,requiredPaths,stack,nativeObjects){var nativeStringify=nativeObjects.nativeStringify;if(prunePaths.length===0&&requiredPaths.length===0){logMessage(source,"".concat(window.location.hostname,"\n").concat(nativeStringify(root,null,2),"\nStack trace:\n").concat(new Error().stack),true);if(root&&typeof root==="object"){logMessage(source,root,true,false);}return root;}try{if(isPruningNeeded(source,root,prunePaths,requiredPaths,stack,nativeObjects)===false){return root;}prunePaths.forEach(function(path){var ownerObjArr=getWildcardPropertyInChain(root,path,true);ownerObjArr.forEach(function(ownerObj){if(ownerObj!==undefined&&ownerObj.base){delete ownerObj.base[ownerObj.prop];hit(source);}});});}catch(e){logMessage(source,e);}return root;}function getPrunePath(props){var validPropsString=typeof props==="string"&&props!==undefined&&props!=="";return validPropsString?props.split(/ +/):[];}function matchRequestProps(source,propsToMatch,requestData){if(propsToMatch===""||propsToMatch==="*"){return true;}var isMatched;var parsedData=parseMatchProps(propsToMatch);if(!isValidParsedData(parsedData)){logMessage(source,"Invalid parameter: ".concat(propsToMatch));isMatched=false;}else {var matchData=getMatchPropsData(parsedData);var matchKeys=Object.keys(matchData);isMatched=matchKeys.every(function(matchKey){var matchValue=matchData[matchKey];var dataValue=requestData[matchKey];return Object.prototype.hasOwnProperty.call(requestData,matchKey)&&typeof dataValue==="string"&&(matchValue===null||matchValue===void 0?void 0:matchValue.test(dataValue));});}return isMatched;}function getXhrData(method,url,async,user,password){return {method:method,url:url,async:async,user:user,password:password};}function isPruningNeeded(source,root,prunePaths,requiredPaths,stack,nativeObjects){if(!root){return false;}var nativeStringify=nativeObjects.nativeStringify;var shouldProcess;if(prunePaths.length===0&&requiredPaths.length>0){var rootString=nativeStringify(root);var matchRegex=toRegExp(requiredPaths.join(""));var shouldLog=matchRegex.test(rootString);if(shouldLog){logMessage(source,"".concat(window.location.hostname,"\n").concat(nativeStringify(root,null,2),"\nStack trace:\n").concat(new Error().stack),true);if(root&&typeof root==="object"){logMessage(source,root,true,false);}shouldProcess=false;return shouldProcess;}}if(stack&&!matchStackTrace(stack,new Error().stack||"")){shouldProcess=false;return shouldProcess;}var wildcardSymbols=[".*.","*.",".*",".[].","[].",".[]"];var _loop=function _loop(){var requiredPath=requiredPaths[i];var lastNestedPropName=requiredPath.split(".").pop();var hasWildcard=wildcardSymbols.some(function(symbol){return requiredPath.includes(symbol);});var details=getWildcardPropertyInChain(root,requiredPath,hasWildcard);if(!details.length){shouldProcess=false;return {v:shouldProcess};}shouldProcess=!hasWildcard;for(var j=0;j<details.length;j+=1){var hasRequiredProp=typeof lastNestedPropName==="string"&&details[j].base[lastNestedPropName]!==undefined;if(hasWildcard){shouldProcess=hasRequiredProp||shouldProcess;}else {shouldProcess=hasRequiredProp&&shouldProcess;}}};for(var i=0;i<requiredPaths.length;i+=1){var _ret=_loop();if(typeof _ret==="object")return _ret.v;}return shouldProcess;}function matchStackTrace(stackMatch,stackTrace){if(!stackMatch||stackMatch===""){return true;}var regExpValues=backupRegExpValues();if(shouldAbortInlineOrInjectedScript(stackMatch,stackTrace)){if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return true;}var stackRegexp=toRegExp(stackMatch);var refinedStackTrace=stackTrace.split("\n").slice(2).map(function(line){return line.trim();}).join("\n");if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return getNativeRegexpTest().call(stackRegexp,refinedStackTrace);}function getMatchPropsData(data){var matchData={};var dataKeys=Object.keys(data);dataKeys.forEach(function(key){matchData[key]=toRegExp(data[key]);});return matchData;}function getRequestProps(){return ["url","method","headers","body","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","mode"];}function isValidParsedData(data){return Object.values(data).every(function(value){return isValidStrPattern(value);});}function parseMatchProps(propsToMatchStr){var PROPS_DIVIDER=" ";var PAIRS_MARKER=":";var isRequestProp=function isRequestProp(prop){return getRequestProps().includes(prop);};var propsObj={};var props=propsToMatchStr.split(PROPS_DIVIDER);props.forEach(function(prop){var dividerInd=prop.indexOf(PAIRS_MARKER);var key=prop.slice(0,dividerInd);if(isRequestProp(key)){var value=prop.slice(dividerInd+1);propsObj[key]=value;}else {propsObj.url=prop;}});return propsObj;}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}function getWildcardPropertyInChain(base,chain){var lookThrough=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var output=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[];var pos=chain.indexOf(".");if(pos===-1){if(chain==="*"||chain==="[]"){for(var key in base){if(Object.prototype.hasOwnProperty.call(base,key)){output.push({base:base,prop:key});}}}else {output.push({base:base,prop:chain});}return output;}var prop=chain.slice(0,pos);var shouldLookThrough=prop==="[]"&&Array.isArray(base)||prop==="*"&&base instanceof Object;if(shouldLookThrough){var nextProp=chain.slice(pos+1);var baseKeys=Object.keys(base);baseKeys.forEach(function(key){var item=base[key];getWildcardPropertyInChain(item,nextProp,lookThrough,output);});}if(Array.isArray(base)){base.forEach(function(key){var nextBase=key;if(nextBase!==undefined){getWildcardPropertyInChain(nextBase,chain,lookThrough,output);}});}var nextBase=base[prop];chain=chain.slice(pos+1);if(nextBase!==undefined){getWildcardPropertyInChain(nextBase,chain,lookThrough,output);}return output;}function shouldAbortInlineOrInjectedScript(stackMatch,stackTrace){var INLINE_SCRIPT_STRING="inlineScript";var INJECTED_SCRIPT_STRING="injectedScript";var INJECTED_SCRIPT_MARKER="<anonymous>";var isInlineScript=function isInlineScript(match){return match.includes(INLINE_SCRIPT_STRING);};var isInjectedScript=function isInjectedScript(match){return match.includes(INJECTED_SCRIPT_STRING);};if(!(isInlineScript(stackMatch)||isInjectedScript(stackMatch))){return false;}var documentURL=window.location.href;var pos=documentURL.indexOf("#");if(pos!==-1){documentURL=documentURL.slice(0,pos);}var stackSteps=stackTrace.split("\n").slice(2).map(function(line){return line.trim();});var stackLines=stackSteps.map(function(line){var stack;var getStackTraceValues=/(.*?@)?(\S+)(:\d+)(:\d+)\)?$/.exec(line);if(getStackTraceValues){var _stackURL,_stackURL2;var stackURL=getStackTraceValues[2];var stackLine=getStackTraceValues[3];var stackCol=getStackTraceValues[4];if((_stackURL=stackURL)!==null&&_stackURL!==void 0&&_stackURL.startsWith("(")){stackURL=stackURL.slice(1);}if((_stackURL2=stackURL)!==null&&_stackURL2!==void 0&&_stackURL2.startsWith(INJECTED_SCRIPT_MARKER)){var _stackFunction;stackURL=INJECTED_SCRIPT_STRING;var stackFunction=getStackTraceValues[1]!==undefined?getStackTraceValues[1].slice(0,-1):line.slice(0,getStackTraceValues.index).trim();if((_stackFunction=stackFunction)!==null&&_stackFunction!==void 0&&_stackFunction.startsWith("at")){stackFunction=stackFunction.slice(2).trim();}stack="".concat(stackFunction," ").concat(stackURL).concat(stackLine).concat(stackCol).trim();}else if(stackURL===documentURL){stack="".concat(INLINE_SCRIPT_STRING).concat(stackLine).concat(stackCol).trim();}else {stack="".concat(stackURL).concat(stackLine).concat(stackCol).trim();}}else {stack=line;}return stack;});if(stackLines){for(var index=0;index<stackLines.length;index+=1){if(isInlineScript(stackMatch)&&stackLines[index].startsWith(INLINE_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}if(isInjectedScript(stackMatch)&&stackLines[index].startsWith(INJECTED_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}}}return false;}function getNativeRegexpTest(){var descriptor=Object.getOwnPropertyDescriptor(RegExp.prototype,"test");var nativeRegexTest=descriptor===null||descriptor===void 0?void 0:descriptor.value;if(descriptor&&typeof descriptor.value==="function"){return nativeRegexTest;}throw new Error("RegExp.prototype.test is not a function");}function backupRegExpValues(){try{var arrayOfRegexpValues=[];for(var index=1;index<10;index+=1){var value="$".concat(index);if(!RegExp[value]){break;}arrayOfRegexpValues.push(RegExp[value]);}return arrayOfRegexpValues;}catch(error){return [];}}function restoreRegExpValues(array){if(!array.length){return;}try{var stringPattern="";if(array.length===1){stringPattern="(".concat(array[0],")");}else {stringPattern=array.reduce(function(accumulator,currentValue,currentIndex){if(currentIndex===1){return "(".concat(accumulator,"),(").concat(currentValue,")");}return "".concat(accumulator,",(").concat(currentValue,")");});}var regExpGroup=new RegExp(stringPattern);array.toString().replace(regExpGroup,"");}catch(error){var message="Failed to restore RegExp values: ".concat(error);console.log(message);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{jsonPruneXhrResponse.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function log(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function log(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}console.log(args);}var updatedArgs=args?[].concat(source).concat(args):[source];try{log.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function logAddEventListener(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function logAddEventListener(source){var nativeAddEventListener=window.EventTarget.prototype.addEventListener;function addEventListenerWrapper(type,listener){var _this$constructor;if(validateType(type)&&validateListener(listener)){var message='addEventListener("'.concat(type,'", ').concat(listenerToString(listener),")");logMessage(source,message,true);hit(source);}else {var _message="Invalid event type or listener passed to addEventListener:\n        type: ".concat(convertTypeToString(type),"\n        listener: ").concat(convertTypeToString(listener));logMessage(source,_message,true);}var context=this;if(this&&((_this$constructor=this.constructor)===null||_this$constructor===void 0?void 0:_this$constructor.name)==="Window"&&this!==window){context=window;}for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}return nativeAddEventListener.apply(context,[type,listener,...args]);}var descriptor={configurable:true,set:function set(){},get:function get(){return addEventListenerWrapper;}};Object.defineProperty(window.EventTarget.prototype,"addEventListener",descriptor);Object.defineProperty(window,"addEventListener",descriptor);Object.defineProperty(document,"addEventListener",descriptor);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function validateType(type){return typeof type!=="undefined";}function validateListener(listener){return typeof listener!=="undefined"&&(typeof listener==="function"||typeof listener==="object"&&listener!==null&&"handleEvent"in listener&&typeof listener.handleEvent==="function");}function listenerToString(listener){return typeof listener==="function"?listener.toString():listener.handleEvent.toString();}function convertTypeToString(value){var output;if(typeof value==="undefined"){output="undefined";}else if(typeof value==="object"){if(value===null){output="null";}else {output=objectToString(value);}}else {output=String(value);}return output;}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function objectToString(obj){if(!obj||typeof obj!=="object"){return String(obj);}if(isEmptyObject(obj)){return "{}";}return Object.entries(obj).map(function(pair){var key=pair[0];var value=pair[1];var recordValueStr=value;if(value instanceof Object){recordValueStr="{ ".concat(objectToString(value)," }");}return "".concat(key,':"').concat(recordValueStr,'"');}).join(" ");}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}var updatedArgs=args?[].concat(source).concat(args):[source];try{logAddEventListener.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function logEval(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function logEval(source){var nativeEval=window.eval;function evalWrapper(str){hit(source);logMessage(source,'eval("'.concat(str,'")'),true);return nativeEval(str);}window.eval=evalWrapper;var nativeFunction=window.Function;function FunctionWrapper(){hit(source);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}logMessage(source,"new Function(".concat(args.join(", "),")"),true);return nativeFunction.apply(this,[...args]);}FunctionWrapper.prototype=Object.create(nativeFunction.prototype);FunctionWrapper.prototype.constructor=FunctionWrapper;window.Function=FunctionWrapper;}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}var updatedArgs=args?[].concat(source).concat(args):[source];try{logEval.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function logOnStacktrace(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function logOnStacktrace(source,property){if(!property){return;}var refineStackTrace=function refineStackTrace(stackString){var regExpValues=backupRegExpValues();var stackSteps=stackString.split("\n").slice(2).map(function(line){return line.replace(/ {4}at /,"");});var logInfoArray=stackSteps.map(function(line){var funcName;var funcFullPath;var reg=/\(([^\)]+)\)/;var regFirefox=/(.*?@)(\S+)(:\d+):\d+\)?$/;if(line.match(reg)){funcName=line.split(" ").slice(0,-1).join(" ");funcFullPath=line.match(reg)[1];}else if(line.match(regFirefox)){funcName=line.split("@").slice(0,-1).join(" ");funcFullPath=line.match(regFirefox)[2];}else {funcName="function name is not available";funcFullPath=line;}return [funcName,funcFullPath];});var logInfoObject={};logInfoArray.forEach(function(pair){logInfoObject[pair[0]]=pair[1];});if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return logInfoObject;};var setChainPropAccess=function setChainPropAccess(owner,property){var chainInfo=getPropertyInChain(owner,property);var base=chainInfo.base;var prop=chainInfo.prop,chain=chainInfo.chain;if(chain){var setter=function setter(a){base=a;if(a instanceof Object){setChainPropAccess(a,chain);}};Object.defineProperty(owner,prop,{get:function get(){return base;},set:setter});return;}var value=base[prop];setPropertyAccess(base,prop,{get(){hit(source);logMessage(source,"Get ".concat(prop),true);console.table(refineStackTrace(new Error().stack));return value;},set(newValue){hit(source);logMessage(source,"Set ".concat(prop),true);console.table(refineStackTrace(new Error().stack));value=newValue;}});};setChainPropAccess(window,property);}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function setPropertyAccess(object,property,descriptor){var currentDescriptor=Object.getOwnPropertyDescriptor(object,property);if(currentDescriptor&&!currentDescriptor.configurable){return false;}Object.defineProperty(object,property,descriptor);return true;}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}function backupRegExpValues(){try{var arrayOfRegexpValues=[];for(var index=1;index<10;index+=1){var value="$".concat(index);if(!RegExp[value]){break;}arrayOfRegexpValues.push(RegExp[value]);}return arrayOfRegexpValues;}catch(error){return [];}}function restoreRegExpValues(array){if(!array.length){return;}try{var stringPattern="";if(array.length===1){stringPattern="(".concat(array[0],")");}else {stringPattern=array.reduce(function(accumulator,currentValue,currentIndex){if(currentIndex===1){return "(".concat(accumulator,"),(").concat(currentValue,")");}return "".concat(accumulator,",(").concat(currentValue,")");});}var regExpGroup=new RegExp(stringPattern);array.toString().replace(regExpGroup,"");}catch(error){var message="Failed to restore RegExp values: ".concat(error);console.log(message);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{logOnStacktrace.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function m3uPrune(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function m3uPrune(source,propsToRemove){var urlToMatch=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"";var verbose=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(typeof Reflect==="undefined"||typeof fetch==="undefined"||typeof Proxy==="undefined"||typeof Response==="undefined"){return;}var shouldPruneResponse=false;var shouldLogContent=verbose==="true";var urlMatchRegexp=toRegExp(urlToMatch);var SEGMENT_MARKER="#";var AD_MARKER={ASSET:"#EXT-X-ASSET:",CUE:"#EXT-X-CUE:",CUE_IN:"#EXT-X-CUE-IN",DISCONTINUITY:"#EXT-X-DISCONTINUITY",EXTINF:"#EXTINF",EXTM3U:"#EXTM3U",SCTE35:"#EXT-X-SCTE35:"};var COMCAST_AD_MARKER={AD:"-AD-",VAST:"-VAST-",VMAP_AD:"-VMAP-AD-",VMAP_AD_BREAK:"#EXT-X-VMAP-AD-BREAK:"};var TAGS_ALLOWLIST=["#EXT-X-TARGETDURATION","#EXT-X-MEDIA-SEQUENCE","#EXT-X-DISCONTINUITY-SEQUENCE","#EXT-X-ENDLIST","#EXT-X-PLAYLIST-TYPE","#EXT-X-I-FRAMES-ONLY","#EXT-X-MEDIA","#EXT-X-STREAM-INF","#EXT-X-I-FRAME-STREAM-INF","#EXT-X-SESSION-DATA","#EXT-X-SESSION-KEY","#EXT-X-INDEPENDENT-SEGMENTS","#EXT-X-START"];var isAllowedTag=function isAllowedTag(str){return TAGS_ALLOWLIST.some(function(el){return str.startsWith(el);});};var pruneExtinfFromVmapBlock=function pruneExtinfFromVmapBlock(lines,i){var array=lines.slice();var index=i;if(array[index].includes(AD_MARKER.EXTINF)){array[index]=undefined;index+=1;if(array[index].includes(AD_MARKER.DISCONTINUITY)){array[index]=undefined;index+=1;var prunedExtinf=pruneExtinfFromVmapBlock(array,index);array=prunedExtinf.array;index=prunedExtinf.index;}}return {array:array,index:index};};var pruneVmapBlock=function pruneVmapBlock(lines){var array=lines.slice();for(var i=0;i<array.length-1;i+=1){if(array[i].includes(COMCAST_AD_MARKER.VMAP_AD)||array[i].includes(COMCAST_AD_MARKER.VAST)||array[i].includes(COMCAST_AD_MARKER.AD)){array[i]=undefined;if(array[i+1].includes(AD_MARKER.EXTINF)){i+=1;var prunedExtinf=pruneExtinfFromVmapBlock(array,i);array=prunedExtinf.array;i=prunedExtinf.index-1;}}}return array;};var pruneSpliceoutBlock=function pruneSpliceoutBlock(line,index,array){if(!line.startsWith(AD_MARKER.CUE)){return line;}line=undefined;index+=1;if(array[index].startsWith(AD_MARKER.ASSET)){array[index]=undefined;index+=1;}if(array[index].startsWith(AD_MARKER.SCTE35)){array[index]=undefined;index+=1;}if(array[index].startsWith(AD_MARKER.CUE_IN)){array[index]=undefined;index+=1;}if(array[index].startsWith(AD_MARKER.SCTE35)){array[index]=undefined;}return line;};var removeM3ULineRegexp=toRegExp(propsToRemove);var pruneInfBlock=function pruneInfBlock(line,index,array){if(!line.startsWith(AD_MARKER.EXTINF)){return line;}if(!removeM3ULineRegexp.test(array[index+1])){return line;}if(!isAllowedTag(array[index])){array[index]=undefined;}index+=1;if(!isAllowedTag(array[index])){array[index]=undefined;}index+=1;if(array[index].startsWith(AD_MARKER.DISCONTINUITY)){array[index]=undefined;}return line;};var pruneSegments=function pruneSegments(lines){for(var i=0;i<lines.length-1;i+=1){var _lines$i;if((_lines$i=lines[i])!==null&&_lines$i!==void 0&&_lines$i.startsWith(SEGMENT_MARKER)&&removeM3ULineRegexp.test(lines[i])){var segmentName=lines[i].substring(0,lines[i].indexOf(":"));if(!segmentName){return lines;}lines[i]=undefined;i+=1;for(var j=i;j<lines.length;j+=1){if(!lines[j].includes(segmentName)&&!isAllowedTag(lines[j])){lines[j]=undefined;}else {i=j-1;break;}}}}return lines;};var isM3U=function isM3U(text){if(typeof text==="string"){var trimmedText=text.trim();return trimmedText.startsWith(AD_MARKER.EXTM3U)||trimmedText.startsWith(COMCAST_AD_MARKER.VMAP_AD_BREAK);}return false;};var isPruningNeeded=function isPruningNeeded(text,regexp){return isM3U(text)&&regexp.test(text);};var pruneM3U=function pruneM3U(text){if(shouldLogContent){logMessage(source,"Original M3U content:\n".concat(text));}var lines=text.split(/\r?\n/);if(text.includes(COMCAST_AD_MARKER.VMAP_AD_BREAK)){lines=pruneVmapBlock(lines);lines=lines.filter(function(l){return !!l;}).join("\n");if(shouldLogContent){logMessage(source,"Modified M3U content:\n".concat(lines));}return lines;}lines=pruneSegments(lines);lines=lines.map(function(line,index,array){if(typeof line==="undefined"){return line;}line=pruneSpliceoutBlock(line,index,array);if(typeof line!=="undefined"){line=pruneInfBlock(line,index,array);}return line;}).filter(function(l){return !!l;}).join("\n");if(shouldLogContent){logMessage(source,"Modified M3U content:\n".concat(lines));}return lines;};var nativeOpen=window.XMLHttpRequest.prototype.open;var nativeSend=window.XMLHttpRequest.prototype.send;var xhrData;var openWrapper=function openWrapper(target,thisArg,args){xhrData=getXhrData.apply(null,args);if(matchRequestProps(source,urlToMatch,xhrData)){thisArg.shouldBePruned=true;}if(thisArg.shouldBePruned){thisArg.collectedHeaders=[];var setRequestHeaderWrapper=function setRequestHeaderWrapper(target,thisArg,args){thisArg.collectedHeaders.push(args);return Reflect.apply(target,thisArg,args);};var setRequestHeaderHandler={apply:setRequestHeaderWrapper};thisArg.setRequestHeader=new Proxy(thisArg.setRequestHeader,setRequestHeaderHandler);}return Reflect.apply(target,thisArg,args);};var sendWrapper=function sendWrapper(target,thisArg,args){var allowedResponseTypeValues=["","text"];if(!thisArg.shouldBePruned||!allowedResponseTypeValues.includes(thisArg.responseType)){return Reflect.apply(target,thisArg,args);}var forgedRequest=new XMLHttpRequest();forgedRequest.addEventListener("readystatechange",function(){if(forgedRequest.readyState!==4){return;}var readyState=forgedRequest.readyState,response=forgedRequest.response,responseText=forgedRequest.responseText,responseURL=forgedRequest.responseURL,responseXML=forgedRequest.responseXML,status=forgedRequest.status,statusText=forgedRequest.statusText;var content=responseText||response;if(typeof content!=="string"){return;}if(!propsToRemove){if(isM3U(response)){var message="XMLHttpRequest.open() URL: ".concat(responseURL,"\nresponse: ").concat(response);logMessage(source,message);}}else {shouldPruneResponse=isPruningNeeded(response,removeM3ULineRegexp);}var responseContent=shouldPruneResponse?pruneM3U(response):response;Object.defineProperties(thisArg,{readyState:{value:readyState,writable:false},responseURL:{value:responseURL,writable:false},responseXML:{value:responseXML,writable:false},status:{value:status,writable:false},statusText:{value:statusText,writable:false},response:{value:responseContent,writable:false},responseText:{value:responseContent,writable:false}});setTimeout(function(){var stateEvent=new Event("readystatechange");thisArg.dispatchEvent(stateEvent);var loadEvent=new Event("load");thisArg.dispatchEvent(loadEvent);var loadEndEvent=new Event("loadend");thisArg.dispatchEvent(loadEndEvent);},1);hit(source);});nativeOpen.apply(forgedRequest,[xhrData.method,xhrData.url]);thisArg.collectedHeaders.forEach(function(header){var name=header[0];var value=header[1];forgedRequest.setRequestHeader(name,value);});thisArg.collectedHeaders=[];try{nativeSend.call(forgedRequest,args);}catch(_unused){return Reflect.apply(target,thisArg,args);}return undefined;};var openHandler={apply:openWrapper};var sendHandler={apply:sendWrapper};XMLHttpRequest.prototype.open=new Proxy(XMLHttpRequest.prototype.open,openHandler);XMLHttpRequest.prototype.send=new Proxy(XMLHttpRequest.prototype.send,sendHandler);var nativeFetch=window.fetch;var fetchWrapper=async function fetchWrapper(target,thisArg,args){var fetchURL=args[0]instanceof Request?args[0].url:args[0];if(typeof fetchURL!=="string"||fetchURL.length===0){return Reflect.apply(target,thisArg,args);}if(urlMatchRegexp.test(fetchURL)){var response=await nativeFetch(...args);var clonedResponse=response.clone();var responseText=await response.text();if(!propsToRemove&&isM3U(responseText)){var message="fetch URL: ".concat(fetchURL,"\nresponse text: ").concat(responseText);logMessage(source,message);return clonedResponse;}if(isPruningNeeded(responseText,removeM3ULineRegexp)){var prunedText=pruneM3U(responseText);hit(source);return new Response(prunedText,{status:response.status,statusText:response.statusText,headers:response.headers});}return clonedResponse;}return Reflect.apply(target,thisArg,args);};var fetchHandler={apply:fetchWrapper};window.fetch=new Proxy(window.fetch,fetchHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function getXhrData(method,url,async,user,password){return {method:method,url:url,async:async,user:user,password:password};}function matchRequestProps(source,propsToMatch,requestData){if(propsToMatch===""||propsToMatch==="*"){return true;}var isMatched;var parsedData=parseMatchProps(propsToMatch);if(!isValidParsedData(parsedData)){logMessage(source,"Invalid parameter: ".concat(propsToMatch));isMatched=false;}else {var matchData=getMatchPropsData(parsedData);var matchKeys=Object.keys(matchData);isMatched=matchKeys.every(function(matchKey){var matchValue=matchData[matchKey];var dataValue=requestData[matchKey];return Object.prototype.hasOwnProperty.call(requestData,matchKey)&&typeof dataValue==="string"&&(matchValue===null||matchValue===void 0?void 0:matchValue.test(dataValue));});}return isMatched;}function getMatchPropsData(data){var matchData={};var dataKeys=Object.keys(data);dataKeys.forEach(function(key){matchData[key]=toRegExp(data[key]);});return matchData;}function getRequestProps(){return ["url","method","headers","body","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","mode"];}function isValidParsedData(data){return Object.values(data).every(function(value){return isValidStrPattern(value);});}function parseMatchProps(propsToMatchStr){var PROPS_DIVIDER=" ";var PAIRS_MARKER=":";var isRequestProp=function isRequestProp(prop){return getRequestProps().includes(prop);};var propsObj={};var props=propsToMatchStr.split(PROPS_DIVIDER);props.forEach(function(prop){var dividerInd=prop.indexOf(PAIRS_MARKER);var key=prop.slice(0,dividerInd);if(isRequestProp(key)){var value=prop.slice(dividerInd+1);propsObj[key]=value;}else {propsObj.url=prop;}});return propsObj;}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}var updatedArgs=args?[].concat(source).concat(args):[source];try{m3uPrune.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function metrikaYandexTag(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function metrikaYandexTag(source){var asyncCallbackFromOptions=function asyncCallbackFromOptions(id,param){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var callback=options.callback;var ctx=options.ctx;if(typeof callback==="function"){callback=ctx!==undefined?callback.bind(ctx):callback;setTimeout(function(){return callback();});}};var addFileExtension=noopFunc;var extLink=asyncCallbackFromOptions;var file=asyncCallbackFromOptions;var getClientID=function getClientID(id,cb){if(!cb){return;}setTimeout(cb(null));};var hitFunc=asyncCallbackFromOptions;var notBounce=asyncCallbackFromOptions;var params=noopFunc;var reachGoal=function reachGoal(id,target,params,callback,ctx){asyncCallbackFromOptions(null,null,{callback:callback,ctx:ctx});};var setUserID=noopFunc;var userParams=noopFunc;var destruct=noopFunc;var api={addFileExtension:addFileExtension,extLink:extLink,file:file,getClientID:getClientID,hit:hitFunc,notBounce:notBounce,params:params,reachGoal:reachGoal,setUserID:setUserID,userParams:userParams,destruct:destruct};function ym(id,funcName){for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}return api[funcName]&&api[funcName](id,...args);}function init(id){window["yaCounter".concat(id)]=api;document.dispatchEvent(new Event("yacounter".concat(id,"inited")));}if(typeof window.ym==="undefined"){window.ym=ym;ym.a=[];}else if(window.ym&&window.ym.a){ym.a=window.ym.a;window.ym=ym;window.ym.a.forEach(function(params){var id=params[0];init(id);});}hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}var updatedArgs=args?[].concat(source).concat(args):[source];try{metrikaYandexTag.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function metrikaYandexWatch(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function metrikaYandexWatch(source){var cbName="yandex_metrika_callbacks";var asyncCallbackFromOptions=function asyncCallbackFromOptions(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var callback=options.callback;var ctx=options.ctx;if(typeof callback==="function"){callback=ctx!==undefined?callback.bind(ctx):callback;setTimeout(function(){return callback();});}};function Metrika(){}Metrika.counters=noopArray;Metrika.prototype.addFileExtension=noopFunc;Metrika.prototype.getClientID=noopFunc;Metrika.prototype.setUserID=noopFunc;Metrika.prototype.userParams=noopFunc;Metrika.prototype.params=noopFunc;Metrika.prototype.counters=noopArray;Metrika.prototype.extLink=function(url,options){asyncCallbackFromOptions(options);};Metrika.prototype.file=function(url,options){asyncCallbackFromOptions(options);};Metrika.prototype.hit=function(url,options){asyncCallbackFromOptions(options);};Metrika.prototype.reachGoal=function(target,params,cb,ctx){asyncCallbackFromOptions({callback:cb,ctx:ctx});};Metrika.prototype.notBounce=asyncCallbackFromOptions;if(window.Ya){window.Ya.Metrika=Metrika;}else {window.Ya={Metrika:Metrika};}if(window[cbName]&&Array.isArray(window[cbName])){window[cbName].forEach(function(func){if(typeof func==="function"){func();}});}hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}function noopArray(){return [];}var updatedArgs=args?[].concat(source).concat(args):[source];try{metrikaYandexWatch.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function noProtectedAudience(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function noProtectedAudience(source){if(Document instanceof Object===false){return;}var protectedAudienceMethods={joinAdInterestGroup:noopResolveVoid,runAdAuction:noopResolveNull,leaveAdInterestGroup:noopResolveVoid,clearOriginJoinedAdInterestGroups:noopResolveVoid,createAuctionNonce:noopStr,updateAdInterestGroups:noopFunc};for(var _i=0,_Object$keys=Object.keys(protectedAudienceMethods);_i<_Object$keys.length;_i++){var key=_Object$keys[_i];var methodName=key;var prototype=Navigator.prototype;if(!Object.prototype.hasOwnProperty.call(prototype,methodName)||prototype[methodName]instanceof Function===false){continue;}prototype[methodName]=protectedAudienceMethods[methodName];}hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopStr(){return "";}function noopFunc(){}function noopResolveVoid(){return Promise.resolve(undefined);}function noopResolveNull(){return Promise.resolve(null);}var updatedArgs=args?[].concat(source).concat(args):[source];try{noProtectedAudience.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function noTopics(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function noTopics(source){var TOPICS_PROPERTY_NAME="browsingTopics";if(Document instanceof Object===false){return;}if(!Object.prototype.hasOwnProperty.call(Document.prototype,TOPICS_PROPERTY_NAME)||Document.prototype[TOPICS_PROPERTY_NAME]instanceof Function===false){return;}Document.prototype[TOPICS_PROPERTY_NAME]=function(){return noopPromiseResolve("[]");};hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopPromiseResolve(){var responseBody=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"{}";var responseUrl=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";var responseType=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"basic";if(typeof Response==="undefined"){return;}var response=new Response(responseBody,{status:200,statusText:"OK"});if(responseType==="opaque"){Object.defineProperties(response,{body:{value:null},status:{value:0},statusText:{value:""},url:{value:""},type:{value:responseType}});}else {Object.defineProperties(response,{url:{value:responseUrl},type:{value:responseType}});}return Promise.resolve(response);}var updatedArgs=args?[].concat(source).concat(args):[source];try{noTopics.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function noeval(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function noeval(source){window.eval=function evalWrapper(s){hit(source);logMessage(source,"AdGuard has prevented eval:\n".concat(s),true);}.bind();}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}var updatedArgs=args?[].concat(source).concat(args):[source];try{noeval.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function nowebrtc(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function nowebrtc(source){var propertyName="";if(window.RTCPeerConnection){propertyName="RTCPeerConnection";}else if(window.webkitRTCPeerConnection){propertyName="webkitRTCPeerConnection";}if(propertyName===""){return;}var rtcReplacement=function rtcReplacement(config){var message="Document tried to create an RTCPeerConnection: ".concat(convertRtcConfigToString(config));logMessage(source,message);hit(source);};rtcReplacement.prototype={close:noopFunc,createDataChannel:noopFunc,createOffer:noopFunc,setRemoteDescription:noopFunc};var rtc=window[propertyName];window[propertyName]=rtcReplacement;if(rtc.prototype){rtc.prototype.createDataChannel=function(a,b){return {close:noopFunc,send:noopFunc};}.bind(null);}}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function convertRtcConfigToString(config){var UNDEF_STR="undefined";var str=UNDEF_STR;if(config===null){str="null";}else if(config instanceof Object){var SERVERS_PROP_NAME="iceServers";var URLS_PROP_NAME="urls";if(Object.prototype.hasOwnProperty.call(config,SERVERS_PROP_NAME)&&config[SERVERS_PROP_NAME]&&Object.prototype.hasOwnProperty.call(config[SERVERS_PROP_NAME][0],URLS_PROP_NAME)&&!!config[SERVERS_PROP_NAME][0][URLS_PROP_NAME]){str=config[SERVERS_PROP_NAME][0][URLS_PROP_NAME].toString();}}return str;}var updatedArgs=args?[].concat(source).concat(args):[source];try{nowebrtc.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventAddEventListener(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventAddEventListener(source,typeSearch,listenerSearch){var typeSearchRegexp=toRegExp(typeSearch);var listenerSearchRegexp=toRegExp(listenerSearch);var nativeAddEventListener=window.EventTarget.prototype.addEventListener;function addEventListenerWrapper(type,listener){var _this$constructor;var shouldPrevent=false;if(validateType(type)&&validateListener(listener)){shouldPrevent=typeSearchRegexp.test(type.toString())&&listenerSearchRegexp.test(listenerToString(listener));}if(shouldPrevent){hit(source);return undefined;}var context=this;if(this&&((_this$constructor=this.constructor)===null||_this$constructor===void 0?void 0:_this$constructor.name)==="Window"&&this!==window){context=window;}for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}return nativeAddEventListener.apply(context,[type,listener,...args]);}var descriptor={configurable:true,set:function set(){},get:function get(){return addEventListenerWrapper;}};Object.defineProperty(window.EventTarget.prototype,"addEventListener",descriptor);Object.defineProperty(window,"addEventListener",descriptor);Object.defineProperty(document,"addEventListener",descriptor);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function validateType(type){return typeof type!=="undefined";}function validateListener(listener){return typeof listener!=="undefined"&&(typeof listener==="function"||typeof listener==="object"&&listener!==null&&"handleEvent"in listener&&typeof listener.handleEvent==="function");}function listenerToString(listener){return typeof listener==="function"?listener.toString():listener.handleEvent.toString();}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventAddEventListener.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventAdfly(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventAdfly(source){var isDigit=function isDigit(data){return /^\d$/.test(data);};var handler=function handler(encodedURL){var evenChars="";var oddChars="";for(var i=0;i<encodedURL.length;i+=1){if(i%2===0){evenChars+=encodedURL.charAt(i);}else {oddChars=encodedURL.charAt(i)+oddChars;}}var data=(evenChars+oddChars).split("");for(var _i=0;_i<data.length;_i+=1){if(isDigit(data[_i])){for(var ii=_i+1;ii<data.length;ii+=1){if(isDigit(data[ii])){var temp=parseInt(data[_i],10)^parseInt(data[ii],10);if(temp<10){data[_i]=temp.toString();}_i=ii;break;}}}}data=data.join("");var decodedURL=window.atob(data).slice(16,-16);if(window.stop){window.stop();}window.onbeforeunload=null;window.location.href=decodedURL;};var val;var applyHandler=true;var result=setPropertyAccess(window,"ysmm",{configurable:false,set:function set(value){if(applyHandler){applyHandler=false;try{if(typeof value==="string"){handler(value);}}catch(err){}}val=value;},get:function get(){return val;}});if(result){hit(source);}else {logMessage(source,"Failed to set up prevent-adfly scriptlet");}}function setPropertyAccess(object,property,descriptor){var currentDescriptor=Object.getOwnPropertyDescriptor(object,property);if(currentDescriptor&&!currentDescriptor.configurable){return false;}Object.defineProperty(object,property,descriptor);return true;}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventAdfly.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventBab(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventBab(source){var nativeSetTimeout=window.setTimeout;var babRegex=/\.bab_elementid.$/;var timeoutWrapper=function timeoutWrapper(callback){if(typeof callback!=="string"||!babRegex.test(callback)){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return nativeSetTimeout.apply(window,[callback,...args]);}hit(source);};window.setTimeout=timeoutWrapper;var signatures=[["blockadblock"],["babasbm"],[/getItem\('babn'\)/],["getElementById","String.fromCharCode","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789","charAt","DOMContentLoaded","AdBlock","addEventListener","doScroll","fromCharCode","<<2|r>>4","sessionStorage","clientWidth","localStorage","Math","random"]];var check=function check(str){if(typeof str!=="string"){return false;}for(var i=0;i<signatures.length;i+=1){var tokens=signatures[i];var match=0;for(var j=0;j<tokens.length;j+=1){var token=tokens[j];var found=token instanceof RegExp?token.test(str):str.includes(token);if(found){match+=1;}}if(match/tokens.length>=.8){return true;}}return false;};var nativeEval=window.eval;var evalWrapper=function evalWrapper(str){if(!check(str)){return nativeEval(str);}hit(source);var bodyEl=document.body;if(bodyEl){bodyEl.style.removeProperty("visibility");}var el=document.getElementById("babasbmsgx");if(el){el.parentNode.removeChild(el);}};window.eval=evalWrapper.bind(window);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventBab.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventElementSrcLoading(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventElementSrcLoading(source,tagName,match){if(typeof Proxy==="undefined"||typeof Reflect==="undefined"){return;}var srcMockData={script:"data:text/javascript;base64,KCk9Pnt9",img:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",iframe:"data:text/html;base64, PGRpdj48L2Rpdj4=",link:"data:text/plain;base64,"};var instance;if(tagName==="script"){instance=HTMLScriptElement;}else if(tagName==="img"){instance=HTMLImageElement;}else if(tagName==="iframe"){instance=HTMLIFrameElement;}else if(tagName==="link"){instance=HTMLLinkElement;}else {return;}var hasTrustedTypes=window.trustedTypes&&typeof window.trustedTypes.createPolicy==="function";var policy;if(hasTrustedTypes){policy=window.trustedTypes.createPolicy("AGPolicy",{createScriptURL:function createScriptURL(arg){return arg;}});}var SOURCE_PROPERTY_NAME=tagName==="link"?"href":"src";var ONERROR_PROPERTY_NAME="onerror";var searchRegexp=toRegExp(match);var setMatchedAttribute=function setMatchedAttribute(elem){return elem.setAttribute(source.name,"matched");};var setAttributeWrapper=function setAttributeWrapper(target,thisArg,args){if(!args[0]||!args[1]){return Reflect.apply(target,thisArg,args);}var nodeName=thisArg.nodeName.toLowerCase();var attrName=args[0].toLowerCase();var attrValue=args[1];var isMatched=attrName===SOURCE_PROPERTY_NAME&&tagName.toLowerCase()===nodeName&&srcMockData[nodeName]&&searchRegexp.test(attrValue);if(!isMatched){return Reflect.apply(target,thisArg,args);}hit(source);setMatchedAttribute(thisArg);return Reflect.apply(target,thisArg,[attrName,srcMockData[nodeName]]);};var setAttributeHandler={apply:setAttributeWrapper};instance.prototype.setAttribute=new Proxy(Element.prototype.setAttribute,setAttributeHandler);var origSrcDescriptor=safeGetDescriptor(instance.prototype,SOURCE_PROPERTY_NAME);if(!origSrcDescriptor){return;}Object.defineProperty(instance.prototype,SOURCE_PROPERTY_NAME,{enumerable:true,configurable:true,get(){return origSrcDescriptor.get.call(this);},set(urlValue){var nodeName=this.nodeName.toLowerCase();var isMatched=tagName.toLowerCase()===nodeName&&srcMockData[nodeName]&&searchRegexp.test(urlValue);if(!isMatched){origSrcDescriptor.set.call(this,urlValue);return true;}if(policy&&urlValue instanceof TrustedScriptURL){var trustedSrc=policy.createScriptURL(urlValue);origSrcDescriptor.set.call(this,trustedSrc);hit(source);return;}setMatchedAttribute(this);origSrcDescriptor.set.call(this,srcMockData[nodeName]);hit(source);}});var origOnerrorDescriptor=safeGetDescriptor(HTMLElement.prototype,ONERROR_PROPERTY_NAME);if(!origOnerrorDescriptor){return;}Object.defineProperty(HTMLElement.prototype,ONERROR_PROPERTY_NAME,{enumerable:true,configurable:true,get(){return origOnerrorDescriptor.get.call(this);},set(cb){var isMatched=this.getAttribute(source.name)==="matched";if(!isMatched){origOnerrorDescriptor.set.call(this,cb);return true;}origOnerrorDescriptor.set.call(this,noopFunc);return true;}});var addEventListenerWrapper=function addEventListenerWrapper(target,thisArg,args){if(!args[0]||!args[1]||!thisArg){return Reflect.apply(target,thisArg,args);}var eventName=args[0];var isMatched=typeof thisArg.getAttribute==="function"&&thisArg.getAttribute(source.name)==="matched"&&eventName==="error";if(isMatched){return Reflect.apply(target,thisArg,[eventName,noopFunc]);}return Reflect.apply(target,thisArg,args);};var addEventListenerHandler={apply:addEventListenerWrapper};EventTarget.prototype.addEventListener=new Proxy(EventTarget.prototype.addEventListener,addEventListenerHandler);var preventInlineOnerror=function preventInlineOnerror(tagName,src){window.addEventListener("error",function(event){if(!event.target||!event.target.nodeName||event.target.nodeName.toLowerCase()!==tagName||!event.target.src||!src.test(event.target.src)){return;}hit(source);if(typeof event.target.onload==="function"){event.target.onerror=event.target.onload;return;}event.target.onerror=noopFunc;},true);};preventInlineOnerror(tagName,searchRegexp);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function safeGetDescriptor(obj,prop){var descriptor=Object.getOwnPropertyDescriptor(obj,prop);if(descriptor&&descriptor.configurable){return descriptor;}return null;}function noopFunc(){}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventElementSrcLoading.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventEvalIf(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventEvalIf(source,search){var searchRegexp=toRegExp(search);var nativeEval=window.eval;window.eval=function(payload){if(!searchRegexp.test(payload.toString())){return nativeEval.call(window,payload);}hit(source);return undefined;}.bind(window);}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventEvalIf.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventFab(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventFab(source){hit(source);var Fab=function Fab(){};Fab.prototype.check=noopFunc;Fab.prototype.clearEvent=noopFunc;Fab.prototype.emitEvent=noopFunc;Fab.prototype.on=function(a,b){if(!a){b();}return this;};Fab.prototype.onDetected=noopThis;Fab.prototype.onNotDetected=function(a){a();return this;};Fab.prototype.setOption=noopFunc;Fab.prototype.options={set:noopFunc,get:noopFunc};var fab=new Fab();var getSetFab={get(){return Fab;},set(){}};var getsetfab={get(){return fab;},set(){}};if(Object.prototype.hasOwnProperty.call(window,"FuckAdBlock")){window.FuckAdBlock=Fab;}else {Object.defineProperty(window,"FuckAdBlock",getSetFab);}if(Object.prototype.hasOwnProperty.call(window,"BlockAdBlock")){window.BlockAdBlock=Fab;}else {Object.defineProperty(window,"BlockAdBlock",getSetFab);}if(Object.prototype.hasOwnProperty.call(window,"SniffAdBlock")){window.SniffAdBlock=Fab;}else {Object.defineProperty(window,"SniffAdBlock",getSetFab);}if(Object.prototype.hasOwnProperty.call(window,"fuckAdBlock")){window.fuckAdBlock=fab;}else {Object.defineProperty(window,"fuckAdBlock",getsetfab);}if(Object.prototype.hasOwnProperty.call(window,"blockAdBlock")){window.blockAdBlock=fab;}else {Object.defineProperty(window,"blockAdBlock",getsetfab);}if(Object.prototype.hasOwnProperty.call(window,"sniffAdBlock")){window.sniffAdBlock=fab;}else {Object.defineProperty(window,"sniffAdBlock",getsetfab);}}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}function noopThis(){return this;}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventFab.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventFetch(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventFetch(source,propsToMatch){var responseBody=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"emptyObj";var responseType=arguments.length>3?arguments[3]:undefined;if(typeof fetch==="undefined"||typeof Proxy==="undefined"||typeof Response==="undefined"){return;}var nativeRequestClone=Request.prototype.clone;var strResponseBody;if(responseBody===""||responseBody==="emptyObj"){strResponseBody="{}";}else if(responseBody==="emptyArr"){strResponseBody="[]";}else if(responseBody==="emptyStr"){strResponseBody="";}else {logMessage(source,"Invalid responseBody parameter: '".concat(responseBody,"'"));return;}var isResponseTypeSpecified=typeof responseType!=="undefined";var isResponseTypeSupported=function isResponseTypeSupported(responseType){var SUPPORTED_TYPES=["basic","cors","opaque"];return SUPPORTED_TYPES.includes(responseType);};if(isResponseTypeSpecified&&!isResponseTypeSupported(responseType)){logMessage(source,"Invalid responseType parameter: '".concat(responseType,"'"));return;}var getResponseType=function getResponseType(request){try{var mode=request.mode;if(mode===undefined||mode==="cors"||mode==="no-cors"){var fetchURL=new URL(request.url);if(fetchURL.origin===document.location.origin){return "basic";}return mode==="no-cors"?"opaque":"cors";}}catch(error){logMessage(source,"Could not determine response type: ".concat(error));}return undefined;};var handlerWrapper=async function handlerWrapper(target,thisArg,args){var shouldPrevent=false;var fetchData=getFetchData(args,nativeRequestClone);if(typeof propsToMatch==="undefined"){logMessage(source,"fetch( ".concat(objectToString(fetchData)," )"),true);hit(source);return Reflect.apply(target,thisArg,args);}shouldPrevent=matchRequestProps(source,propsToMatch,fetchData);if(shouldPrevent){hit(source);var finalResponseType;try{finalResponseType=responseType||getResponseType(fetchData);var origResponse=await Reflect.apply(target,thisArg,args);if(!origResponse.ok){return noopPromiseResolve(strResponseBody,fetchData.url,finalResponseType);}return modifyResponse(origResponse,{body:strResponseBody,type:finalResponseType});}catch(ex){return noopPromiseResolve(strResponseBody,fetchData.url,finalResponseType);}}return Reflect.apply(target,thisArg,args);};var fetchHandler={apply:handlerWrapper};fetch=new Proxy(fetch,fetchHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function getFetchData(args,nativeRequestClone){var fetchPropsObj={};var resource=args[0];var fetchUrl;var fetchInit;if(resource instanceof Request){var realData=nativeRequestClone.call(resource);var requestData=getRequestData(realData);fetchUrl=requestData.url;fetchInit=requestData;}else {fetchUrl=resource;fetchInit=args[1];}fetchPropsObj.url=fetchUrl;if(fetchInit instanceof Object){var props=Object.keys(fetchInit);props.forEach(function(prop){fetchPropsObj[prop]=fetchInit[prop];});}return fetchPropsObj;}function objectToString(obj){if(!obj||typeof obj!=="object"){return String(obj);}if(isEmptyObject(obj)){return "{}";}return Object.entries(obj).map(function(pair){var key=pair[0];var value=pair[1];var recordValueStr=value;if(value instanceof Object){recordValueStr="{ ".concat(objectToString(value)," }");}return "".concat(key,':"').concat(recordValueStr,'"');}).join(" ");}function matchRequestProps(source,propsToMatch,requestData){if(propsToMatch===""||propsToMatch==="*"){return true;}var isMatched;var parsedData=parseMatchProps(propsToMatch);if(!isValidParsedData(parsedData)){logMessage(source,"Invalid parameter: ".concat(propsToMatch));isMatched=false;}else {var matchData=getMatchPropsData(parsedData);var matchKeys=Object.keys(matchData);isMatched=matchKeys.every(function(matchKey){var matchValue=matchData[matchKey];var dataValue=requestData[matchKey];return Object.prototype.hasOwnProperty.call(requestData,matchKey)&&typeof dataValue==="string"&&(matchValue===null||matchValue===void 0?void 0:matchValue.test(dataValue));});}return isMatched;}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function noopPromiseResolve(){var responseBody=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"{}";var responseUrl=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";var responseType=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"basic";if(typeof Response==="undefined"){return;}var response=new Response(responseBody,{status:200,statusText:"OK"});if(responseType==="opaque"){Object.defineProperties(response,{body:{value:null},status:{value:0},statusText:{value:""},url:{value:""},type:{value:responseType}});}else {Object.defineProperties(response,{url:{value:responseUrl},type:{value:responseType}});}return Promise.resolve(response);}function modifyResponse(origResponse){var _origResponse$headers;var replacement=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{body:"{}"};var headers={};origResponse===null||origResponse===void 0?void 0:(_origResponse$headers=origResponse.headers)===null||_origResponse$headers===void 0?void 0:_origResponse$headers.forEach(function(value,key){headers[key]=value;});var modifiedResponse=new Response(replacement.body,{status:origResponse.status,statusText:origResponse.statusText,headers:headers});Object.defineProperties(modifiedResponse,{url:{value:origResponse.url},type:{value:replacement.type||origResponse.type}});return modifiedResponse;}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}function getRequestData(request){var requestInitOptions=getRequestProps();var entries=requestInitOptions.map(function(key){var value=request[key];return [key,value];});return Object.fromEntries(entries);}function getRequestProps(){return ["url","method","headers","body","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","mode"];}function parseMatchProps(propsToMatchStr){var PROPS_DIVIDER=" ";var PAIRS_MARKER=":";var isRequestProp=function isRequestProp(prop){return getRequestProps().includes(prop);};var propsObj={};var props=propsToMatchStr.split(PROPS_DIVIDER);props.forEach(function(prop){var dividerInd=prop.indexOf(PAIRS_MARKER);var key=prop.slice(0,dividerInd);if(isRequestProp(key)){var value=prop.slice(dividerInd+1);propsObj[key]=value;}else {propsObj.url=prop;}});return propsObj;}function isValidParsedData(data){return Object.values(data).every(function(value){return isValidStrPattern(value);});}function getMatchPropsData(data){var matchData={};var dataKeys=Object.keys(data);dataKeys.forEach(function(key){matchData[key]=toRegExp(data[key]);});return matchData;}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventFetch.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventPopadsNet(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventPopadsNet(source){var rid=randomId();var throwError=function throwError(){throw new ReferenceError(rid);};delete window.PopAds;delete window.popns;Object.defineProperties(window,{PopAds:{set:throwError},popns:{set:throwError}});window.onerror=createOnErrorHandler(rid).bind();hit(source);}function createOnErrorHandler(rid){var nativeOnError=window.onerror;return function onError(error){if(typeof error==="string"&&error.includes(rid)){return true;}if(nativeOnError instanceof Function){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return nativeOnError.apply(window,[error,...args]);}return false;};}function randomId(){return Math.random().toString(36).slice(2,9);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventPopadsNet.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventRefresh(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventRefresh(source,delaySec){var getMetaElements=function getMetaElements(){var metaNodes=[];try{metaNodes=document.querySelectorAll('meta[http-equiv="refresh" i][content]');}catch(e){try{metaNodes=document.querySelectorAll('meta[http-equiv="refresh"][content]');}catch(e){logMessage(source,e);}}return Array.from(metaNodes);};var getMetaContentDelay=function getMetaContentDelay(metaElements){var delays=metaElements.map(function(meta){var contentString=meta.getAttribute("content");if(contentString.length===0){return null;}var contentDelay;var limiterIndex=contentString.indexOf(";");if(limiterIndex!==-1){var delaySubstring=contentString.substring(0,limiterIndex);contentDelay=getNumberFromString(delaySubstring);}else {contentDelay=getNumberFromString(contentString);}return contentDelay;}).filter(function(delay){return delay!==null;});if(!delays.length){return null;}var minDelay=delays.reduce(function(a,b){return Math.min(a,b);});return minDelay;};var stop=function stop(){var metaElements=getMetaElements();if(metaElements.length===0){return;}var secondsToRun=getNumberFromString(delaySec);if(secondsToRun===null){secondsToRun=getMetaContentDelay(metaElements);}if(secondsToRun===null){return;}var delayMs=secondsToRun*1e3;setTimeout(function(){window.stop();hit(source);},delayMs);};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",stop,{once:true});}else {stop();}}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function getNumberFromString(rawString){var parsedDelay=parseInt(rawString,10);var validDelay=nativeIsNaN(parsedDelay)?null:parsedDelay;return validDelay;}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventRefresh.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventRequestAnimationFrame(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventRequestAnimationFrame(source,match){var nativeRequestAnimationFrame=window.requestAnimationFrame;var shouldLog=typeof match==="undefined";var _parseMatchArg=parseMatchArg(match),isInvertedMatch=_parseMatchArg.isInvertedMatch,matchRegexp=_parseMatchArg.matchRegexp;var rafWrapper=function rafWrapper(callback){var shouldPrevent=false;if(shouldLog){hit(source);logMessage(source,"requestAnimationFrame(".concat(String(callback),")"),true);}else if(isValidCallback(callback)&&isValidStrPattern(match)){shouldPrevent=matchRegexp.test(callback.toString())!==isInvertedMatch;}if(shouldPrevent){hit(source);return nativeRequestAnimationFrame(noopFunc);}for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return nativeRequestAnimationFrame.apply(window,[callback,...args]);};window.requestAnimationFrame=rafWrapper;}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}function parseMatchArg(match){var INVERT_MARKER="!";var isInvertedMatch=match?match===null||match===void 0?void 0:match.startsWith(INVERT_MARKER):false;var matchValue=isInvertedMatch?match.slice(1):match;var matchRegexp=toRegExp(matchValue);return {isInvertedMatch:isInvertedMatch,matchRegexp:matchRegexp,matchValue:matchValue};}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function isValidCallback(callback){return callback instanceof Function||typeof callback==="string";}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventRequestAnimationFrame.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventSetInterval(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventSetInterval(source,matchCallback,matchDelay){var shouldLog=typeof matchCallback==="undefined"&&typeof matchDelay==="undefined";var handlerWrapper=function handlerWrapper(target,thisArg,args){var callback=args[0];var delay=args[1];var shouldPrevent=false;if(shouldLog){hit(source);logMessage(source,"setInterval(".concat(String(callback),", ").concat(delay,")"),true);}else {shouldPrevent=isPreventionNeeded({callback:callback,delay:delay,matchCallback:matchCallback,matchDelay:matchDelay});}if(shouldPrevent){hit(source);args[0]=noopFunc;}return target.apply(thisArg,args);};var setIntervalHandler={apply:handlerWrapper};window.setInterval=new Proxy(window.setInterval,setIntervalHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}function isPreventionNeeded(_ref){var callback=_ref.callback,delay=_ref.delay,matchCallback=_ref.matchCallback,matchDelay=_ref.matchDelay;if(!isValidCallback(callback)){return false;}if(!isValidMatchStr(matchCallback)||matchDelay&&!isValidMatchNumber(matchDelay)){return false;}var _parseMatchArg=parseMatchArg(matchCallback),isInvertedMatch=_parseMatchArg.isInvertedMatch,matchRegexp=_parseMatchArg.matchRegexp;var _parseDelayArg=parseDelayArg(matchDelay),isInvertedDelayMatch=_parseDelayArg.isInvertedDelayMatch,delayMatch=_parseDelayArg.delayMatch;var parsedDelay=parseRawDelay(delay);var shouldPrevent=false;var callbackStr=String(callback);if(delayMatch===null){shouldPrevent=matchRegexp.test(callbackStr)!==isInvertedMatch;}else if(!matchCallback){shouldPrevent=parsedDelay===delayMatch!==isInvertedDelayMatch;}else {shouldPrevent=matchRegexp.test(callbackStr)!==isInvertedMatch&&parsedDelay===delayMatch!==isInvertedDelayMatch;}return shouldPrevent;}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function parseMatchArg(match){var INVERT_MARKER="!";var isInvertedMatch=match?match===null||match===void 0?void 0:match.startsWith(INVERT_MARKER):false;var matchValue=isInvertedMatch?match.slice(1):match;var matchRegexp=toRegExp(matchValue);return {isInvertedMatch:isInvertedMatch,matchRegexp:matchRegexp,matchValue:matchValue};}function parseDelayArg(delay){var INVERT_MARKER="!";var isInvertedDelayMatch=delay===null||delay===void 0?void 0:delay.startsWith(INVERT_MARKER);var delayValue=isInvertedDelayMatch?delay.slice(1):delay;var parsedDelay=parseInt(delayValue,10);var delayMatch=nativeIsNaN(parsedDelay)?null:parsedDelay;return {isInvertedDelayMatch:isInvertedDelayMatch,delayMatch:delayMatch};}function isValidCallback(callback){return callback instanceof Function||typeof callback==="string";}function isValidMatchStr(match){var INVERT_MARKER="!";var str=match;if(match!==null&&match!==void 0&&match.startsWith(INVERT_MARKER)){str=match.slice(1);}return isValidStrPattern(str);}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}function nativeIsFinite(num){var native=Number.isFinite||window.isFinite;return native(num);}function isValidMatchNumber(match){var INVERT_MARKER="!";var str=match;if(match!==null&&match!==void 0&&match.startsWith(INVERT_MARKER)){str=match.slice(1);}var num=parseFloat(str);return !nativeIsNaN(num)&&nativeIsFinite(num);}function parseRawDelay(delay){var parsedDelay=Math.floor(parseInt(delay,10));return typeof parsedDelay==="number"&&!nativeIsNaN(parsedDelay)?parsedDelay:delay;}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventSetInterval.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventSetTimeout(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventSetTimeout(source,matchCallback,matchDelay){var shouldLog=typeof matchCallback==="undefined"&&typeof matchDelay==="undefined";var handlerWrapper=function handlerWrapper(target,thisArg,args){var callback=args[0];var delay=args[1];var shouldPrevent=false;if(shouldLog){hit(source);logMessage(source,"setTimeout(".concat(String(callback),", ").concat(delay,")"),true);}else {shouldPrevent=isPreventionNeeded({callback:callback,delay:delay,matchCallback:matchCallback,matchDelay:matchDelay});}if(shouldPrevent){hit(source);args[0]=noopFunc;}return target.apply(thisArg,args);};var setTimeoutHandler={apply:handlerWrapper};window.setTimeout=new Proxy(window.setTimeout,setTimeoutHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function noopFunc(){}function isPreventionNeeded(_ref){var callback=_ref.callback,delay=_ref.delay,matchCallback=_ref.matchCallback,matchDelay=_ref.matchDelay;if(!isValidCallback(callback)){return false;}if(!isValidMatchStr(matchCallback)||matchDelay&&!isValidMatchNumber(matchDelay)){return false;}var _parseMatchArg=parseMatchArg(matchCallback),isInvertedMatch=_parseMatchArg.isInvertedMatch,matchRegexp=_parseMatchArg.matchRegexp;var _parseDelayArg=parseDelayArg(matchDelay),isInvertedDelayMatch=_parseDelayArg.isInvertedDelayMatch,delayMatch=_parseDelayArg.delayMatch;var parsedDelay=parseRawDelay(delay);var shouldPrevent=false;var callbackStr=String(callback);if(delayMatch===null){shouldPrevent=matchRegexp.test(callbackStr)!==isInvertedMatch;}else if(!matchCallback){shouldPrevent=parsedDelay===delayMatch!==isInvertedDelayMatch;}else {shouldPrevent=matchRegexp.test(callbackStr)!==isInvertedMatch&&parsedDelay===delayMatch!==isInvertedDelayMatch;}return shouldPrevent;}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function parseMatchArg(match){var INVERT_MARKER="!";var isInvertedMatch=match?match===null||match===void 0?void 0:match.startsWith(INVERT_MARKER):false;var matchValue=isInvertedMatch?match.slice(1):match;var matchRegexp=toRegExp(matchValue);return {isInvertedMatch:isInvertedMatch,matchRegexp:matchRegexp,matchValue:matchValue};}function parseDelayArg(delay){var INVERT_MARKER="!";var isInvertedDelayMatch=delay===null||delay===void 0?void 0:delay.startsWith(INVERT_MARKER);var delayValue=isInvertedDelayMatch?delay.slice(1):delay;var parsedDelay=parseInt(delayValue,10);var delayMatch=nativeIsNaN(parsedDelay)?null:parsedDelay;return {isInvertedDelayMatch:isInvertedDelayMatch,delayMatch:delayMatch};}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function isValidCallback(callback){return callback instanceof Function||typeof callback==="string";}function isValidMatchStr(match){var INVERT_MARKER="!";var str=match;if(match!==null&&match!==void 0&&match.startsWith(INVERT_MARKER)){str=match.slice(1);}return isValidStrPattern(str);}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function nativeIsFinite(num){var native=Number.isFinite||window.isFinite;return native(num);}function isValidMatchNumber(match){var INVERT_MARKER="!";var str=match;if(match!==null&&match!==void 0&&match.startsWith(INVERT_MARKER)){str=match.slice(1);}var num=parseFloat(str);return !nativeIsNaN(num)&&nativeIsFinite(num);}function parseRawDelay(delay){var parsedDelay=Math.floor(parseInt(delay,10));return typeof parsedDelay==="number"&&!nativeIsNaN(parsedDelay)?parsedDelay:delay;}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventSetTimeout.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventWindowOpen(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventWindowOpen(source){var match=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"*";var delay=arguments.length>2?arguments[2]:undefined;var replacement=arguments.length>3?arguments[3]:undefined;var nativeOpen=window.open;var isNewSyntax=match!=="0"&&match!=="1";var oldOpenWrapper=function oldOpenWrapper(str){match=Number(match)>0;for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}if(!isValidStrPattern(delay)){logMessage(source,"Invalid parameter: ".concat(delay));return nativeOpen.apply(window,[str,...args]);}var searchRegexp=toRegExp(delay);if(match!==searchRegexp.test(str)){return nativeOpen.apply(window,[str,...args]);}hit(source);return handleOldReplacement(replacement);};var newOpenWrapper=function newOpenWrapper(url){var shouldLog=replacement&&replacement.includes("log");for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}if(shouldLog){var argsStr=args&&args.length>0?", ".concat(args.join(", ")):"";var message="".concat(url).concat(argsStr);logMessage(source,message,true);hit(source);}var shouldPrevent=false;if(match==="*"){shouldPrevent=true;}else if(isValidMatchStr(match)){var _parseMatchArg=parseMatchArg(match),isInvertedMatch=_parseMatchArg.isInvertedMatch,matchRegexp=_parseMatchArg.matchRegexp;shouldPrevent=matchRegexp.test(url)!==isInvertedMatch;}else {logMessage(source,"Invalid parameter: ".concat(match));shouldPrevent=false;}if(shouldPrevent){var parsedDelay=parseInt(delay,10);var result;if(nativeIsNaN(parsedDelay)){result=noopNull();}else {var decoyArgs={replacement:replacement,url:url,delay:parsedDelay};var decoy=createDecoy(decoyArgs);var popup=decoy.contentWindow;if(typeof popup==="object"&&popup!==null){Object.defineProperty(popup,"closed",{value:false});Object.defineProperty(popup,"opener",{value:window});Object.defineProperty(popup,"frameElement",{value:null});}else {var nativeGetter=decoy.contentWindow&&decoy.contentWindow.get;Object.defineProperty(decoy,"contentWindow",{get:getPreventGetter(nativeGetter)});popup=decoy.contentWindow;}result=popup;}hit(source);return result;}return nativeOpen.apply(window,[url,...args]);};window.open=isNewSyntax?newOpenWrapper:oldOpenWrapper;window.open.toString=nativeOpen.toString.bind(nativeOpen);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}function isValidMatchStr(match){var INVERT_MARKER="!";var str=match;if(match!==null&&match!==void 0&&match.startsWith(INVERT_MARKER)){str=match.slice(1);}return isValidStrPattern(str);}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function parseMatchArg(match){var INVERT_MARKER="!";var isInvertedMatch=match?match===null||match===void 0?void 0:match.startsWith(INVERT_MARKER):false;var matchValue=isInvertedMatch?match.slice(1):match;var matchRegexp=toRegExp(matchValue);return {isInvertedMatch:isInvertedMatch,matchRegexp:matchRegexp,matchValue:matchValue};}function handleOldReplacement(replacement){var result;if(!replacement){result=noopFunc;}else if(replacement==="trueFunc"){result=trueFunc;}else if(replacement.includes("=")){var isProp=replacement.startsWith("{")&&replacement.endsWith("}");if(isProp){var propertyPart=replacement.slice(1,-1);var propertyName=substringBefore(propertyPart,"=");var propertyValue=substringAfter(propertyPart,"=");if(propertyValue==="noopFunc"){result={};result[propertyName]=noopFunc;}}}return result;}function createDecoy(args){var UrlPropNameOf=function(UrlPropNameOf){UrlPropNameOf["Object"]="data";UrlPropNameOf["Iframe"]="src";return UrlPropNameOf;}({});var replacement=args.replacement,url=args.url,delay=args.delay;var tag;if(replacement==="obj"){tag="object";}else {tag="iframe";}var decoy=document.createElement(tag);if(decoy instanceof HTMLObjectElement){decoy[UrlPropNameOf.Object]=url;}else if(decoy instanceof HTMLIFrameElement){decoy[UrlPropNameOf.Iframe]=url;}decoy.style.setProperty("height","1px","important");decoy.style.setProperty("position","fixed","important");decoy.style.setProperty("top","-1px","important");decoy.style.setProperty("width","1px","important");document.body.appendChild(decoy);setTimeout(function(){return decoy.remove();},delay*1e3);return decoy;}function getPreventGetter(nativeGetter){var preventGetter=function preventGetter(target,prop){if(prop&&prop==="closed"){return false;}if(typeof nativeGetter==="function"){return noopFunc;}return prop&&target[prop];};return preventGetter;}function noopNull(){return null;}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function noopFunc(){}function trueFunc(){return true;}function substringBefore(str,separator){if(!str||!separator){return str;}var index=str.indexOf(separator);return index<0?str:str.substring(0,index);}function substringAfter(str,separator){if(!str){return str;}var index=str.indexOf(separator);return index<0?"":str.substring(index+separator.length);}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventWindowOpen.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function preventXHR(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function preventXHR(source,propsToMatch,customResponseText){if(typeof Proxy==="undefined"){return;}var nativeOpen=window.XMLHttpRequest.prototype.open;var nativeSend=window.XMLHttpRequest.prototype.send;var nativeGetResponseHeader=window.XMLHttpRequest.prototype.getResponseHeader;var nativeGetAllResponseHeaders=window.XMLHttpRequest.prototype.getAllResponseHeaders;var xhrData;var modifiedResponse="";var modifiedResponseText="";var openWrapper=function openWrapper(target,thisArg,args){xhrData=getXhrData.apply(null,args);if(typeof propsToMatch==="undefined"){logMessage(source,"xhr( ".concat(objectToString(xhrData)," )"),true);hit(source);}else if(matchRequestProps(source,propsToMatch,xhrData)){thisArg.shouldBePrevented=true;thisArg.xhrData=xhrData;}if(thisArg.shouldBePrevented){thisArg.collectedHeaders=[];var setRequestHeaderWrapper=function setRequestHeaderWrapper(target,thisArg,args){thisArg.collectedHeaders.push(args);return Reflect.apply(target,thisArg,args);};var setRequestHeaderHandler={apply:setRequestHeaderWrapper};thisArg.setRequestHeader=new Proxy(thisArg.setRequestHeader,setRequestHeaderHandler);}return Reflect.apply(target,thisArg,args);};var sendWrapper=function sendWrapper(target,thisArg,args){if(!thisArg.shouldBePrevented){return Reflect.apply(target,thisArg,args);}if(thisArg.responseType==="blob"){modifiedResponse=new Blob();}if(thisArg.responseType==="arraybuffer"){modifiedResponse=new ArrayBuffer();}if(customResponseText){var randomText=generateRandomResponse(customResponseText);if(randomText){modifiedResponseText=randomText;}else {logMessage(source,"Invalid randomize parameter: '".concat(customResponseText,"'"));}}var forgedRequest=new XMLHttpRequest();forgedRequest.addEventListener("readystatechange",function(){if(forgedRequest.readyState!==4){return;}var readyState=forgedRequest.readyState,responseURL=forgedRequest.responseURL,responseXML=forgedRequest.responseXML,statusText=forgedRequest.statusText;Object.defineProperties(thisArg,{readyState:{value:readyState,writable:false},statusText:{value:statusText,writable:false},responseURL:{value:responseURL||thisArg.xhrData.url,writable:false},responseXML:{value:responseXML,writable:false},status:{value:200,writable:false},response:{value:modifiedResponse,writable:false},responseText:{value:modifiedResponseText,writable:false}});setTimeout(function(){var stateEvent=new Event("readystatechange");thisArg.dispatchEvent(stateEvent);var loadEvent=new Event("load");thisArg.dispatchEvent(loadEvent);var loadEndEvent=new Event("loadend");thisArg.dispatchEvent(loadEndEvent);},1);hit(source);});nativeOpen.apply(forgedRequest,[thisArg.xhrData.method,thisArg.xhrData.url]);thisArg.collectedHeaders.forEach(function(header){var name=header[0];var value=header[1];forgedRequest.setRequestHeader(name,value);});try{nativeSend.call(forgedRequest,args);}catch(_unused){return Reflect.apply(target,thisArg,args);}return undefined;};var getHeaderWrapper=function getHeaderWrapper(target,thisArg,args){if(!thisArg.shouldBePrevented){return nativeGetResponseHeader.apply(thisArg,args);}if(!thisArg.collectedHeaders.length){return null;}var searchHeaderName=args[0].toLowerCase();var matchedHeader=thisArg.collectedHeaders.find(function(header){var headerName=header[0].toLowerCase();return headerName===searchHeaderName;});return matchedHeader?matchedHeader[1]:null;};var getAllHeadersWrapper=function getAllHeadersWrapper(target,thisArg){if(!thisArg.shouldBePrevented){return nativeGetAllResponseHeaders.call(thisArg);}if(!thisArg.collectedHeaders.length){return "";}var allHeadersStr=thisArg.collectedHeaders.map(function(header){var headerName=header[0];var headerValue=header[1];return "".concat(headerName.toLowerCase(),": ").concat(headerValue);}).join("\r\n");return allHeadersStr;};var openHandler={apply:openWrapper};var sendHandler={apply:sendWrapper};var getHeaderHandler={apply:getHeaderWrapper};var getAllHeadersHandler={apply:getAllHeadersWrapper};XMLHttpRequest.prototype.open=new Proxy(XMLHttpRequest.prototype.open,openHandler);XMLHttpRequest.prototype.send=new Proxy(XMLHttpRequest.prototype.send,sendHandler);XMLHttpRequest.prototype.getResponseHeader=new Proxy(XMLHttpRequest.prototype.getResponseHeader,getHeaderHandler);XMLHttpRequest.prototype.getAllResponseHeaders=new Proxy(XMLHttpRequest.prototype.getAllResponseHeaders,getAllHeadersHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function objectToString(obj){if(!obj||typeof obj!=="object"){return String(obj);}if(isEmptyObject(obj)){return "{}";}return Object.entries(obj).map(function(pair){var key=pair[0];var value=pair[1];var recordValueStr=value;if(value instanceof Object){recordValueStr="{ ".concat(objectToString(value)," }");}return "".concat(key,':"').concat(recordValueStr,'"');}).join(" ");}function generateRandomResponse(customResponseText){var customResponse=customResponseText;if(customResponse==="true"){customResponse=Math.random().toString(36).slice(-10);return customResponse;}customResponse=customResponse.replace("length:","");var rangeRegex=/^\d+-\d+$/;if(!rangeRegex.test(customResponse)){return null;}var rangeMin=getNumberFromString(customResponse.split("-")[0]);var rangeMax=getNumberFromString(customResponse.split("-")[1]);if(!nativeIsFinite(rangeMin)||!nativeIsFinite(rangeMax)){return null;}if(rangeMin>rangeMax){var temp=rangeMin;rangeMin=rangeMax;rangeMax=temp;}var LENGTH_RANGE_LIMIT=500*1e3;if(rangeMax>LENGTH_RANGE_LIMIT){return null;}var length=getRandomIntInclusive(rangeMin,rangeMax);customResponse=getRandomStrByLength(length);return customResponse;}function matchRequestProps(source,propsToMatch,requestData){if(propsToMatch===""||propsToMatch==="*"){return true;}var isMatched;var parsedData=parseMatchProps(propsToMatch);if(!isValidParsedData(parsedData)){logMessage(source,"Invalid parameter: ".concat(propsToMatch));isMatched=false;}else {var matchData=getMatchPropsData(parsedData);var matchKeys=Object.keys(matchData);isMatched=matchKeys.every(function(matchKey){var matchValue=matchData[matchKey];var dataValue=requestData[matchKey];return Object.prototype.hasOwnProperty.call(requestData,matchKey)&&typeof dataValue==="string"&&(matchValue===null||matchValue===void 0?void 0:matchValue.test(dataValue));});}return isMatched;}function getXhrData(method,url,async,user,password){return {method:method,url:url,async:async,user:user,password:password};}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}function getNumberFromString(rawString){var parsedDelay=parseInt(rawString,10);var validDelay=nativeIsNaN(parsedDelay)?null:parsedDelay;return validDelay;}function nativeIsFinite(num){var native=Number.isFinite||window.isFinite;return native(num);}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function parseMatchProps(propsToMatchStr){var PROPS_DIVIDER=" ";var PAIRS_MARKER=":";var isRequestProp=function isRequestProp(prop){return getRequestProps().includes(prop);};var propsObj={};var props=propsToMatchStr.split(PROPS_DIVIDER);props.forEach(function(prop){var dividerInd=prop.indexOf(PAIRS_MARKER);var key=prop.slice(0,dividerInd);if(isRequestProp(key)){var value=prop.slice(dividerInd+1);propsObj[key]=value;}else {propsObj.url=prop;}});return propsObj;}function isValidParsedData(data){return Object.values(data).every(function(value){return isValidStrPattern(value);});}function getMatchPropsData(data){var matchData={};var dataKeys=Object.keys(data);dataKeys.forEach(function(key){matchData[key]=toRegExp(data[key]);});return matchData;}function getRequestProps(){return ["url","method","headers","body","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","mode"];}function getRandomIntInclusive(min,max){min=Math.ceil(min);max=Math.floor(max);return Math.floor(Math.random()*(max-min+1)+min);}function getRandomStrByLength(length){var result="";var characters="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+=~";var charactersLength=characters.length;for(var i=0;i<length;i+=1){result+=characters.charAt(Math.floor(Math.random()*charactersLength));}return result;}var updatedArgs=args?[].concat(source).concat(args):[source];try{preventXHR.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function removeAttr(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function removeAttr(source,attrs,selector){var applying=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"asap stay";if(!attrs){return;}attrs=attrs.split(/\s*\|\s*/);if(!selector){selector="[".concat(attrs.join("],["),"]");}var rmattr=function rmattr(){var nodes=[];try{nodes=[].slice.call(document.querySelectorAll(selector));}catch(e){logMessage(source,"Invalid selector arg: '".concat(selector,"'"));}var removed=false;nodes.forEach(function(node){attrs.forEach(function(attr){node.removeAttribute(attr);removed=true;});});if(removed){hit(source);}};var flags=parseFlags(applying);var run=function run(){rmattr();if(!flags.hasFlag(flags.STAY)){return;}observeDOMChanges(rmattr,true);};if(flags.hasFlag(flags.ASAP)){if(document.readyState==="loading"){window.addEventListener("DOMContentLoaded",rmattr,{once:true});}else {rmattr();}}if(document.readyState!=="complete"&&flags.hasFlag(flags.COMPLETE)){window.addEventListener("load",run,{once:true});}else if(flags.hasFlag(flags.STAY)){if(!applying.includes(" ")){rmattr();}observeDOMChanges(rmattr,true);}}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function observeDOMChanges(callback){var observeAttrs=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var attrsToObserve=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var THROTTLE_DELAY_MS=20;var observer=new MutationObserver(throttle(callbackWrapper,THROTTLE_DELAY_MS));var connect=function connect(){if(attrsToObserve.length>0){observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs,attributeFilter:attrsToObserve});}else {observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs});}};var disconnect=function disconnect(){observer.disconnect();};function callbackWrapper(){disconnect();callback();connect();}connect();}function parseFlags(flags){var FLAGS_DIVIDER=" ";var ASAP_FLAG="asap";var COMPLETE_FLAG="complete";var STAY_FLAG="stay";var VALID_FLAGS=new Set([ASAP_FLAG,COMPLETE_FLAG,STAY_FLAG]);var passedFlags=new Set(flags.trim().split(FLAGS_DIVIDER).filter(function(flag){return VALID_FLAGS.has(flag);}));return {ASAP:ASAP_FLAG,COMPLETE:COMPLETE_FLAG,STAY:STAY_FLAG,hasFlag:function hasFlag(flag){return passedFlags.has(flag);}};}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function throttle(cb,delay){var wait=false;var savedArgs;var wrapper=function wrapper(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}if(wait){savedArgs=args;return;}cb(...args);wait=true;setTimeout(function(){wait=false;if(savedArgs){wrapper(...savedArgs);savedArgs=null;}},delay);};return wrapper;}var updatedArgs=args?[].concat(source).concat(args):[source];try{removeAttr.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function removeClass(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function removeClass(source,classNames,selector){var applying=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"asap stay";if(!classNames){return;}classNames=classNames.split(/\s*\|\s*/);var selectors=[];if(!selector){selectors=classNames.map(function(className){return ".".concat(className);});}var removeClassHandler=function removeClassHandler(){var nodes=new Set();if(selector){var foundNodes=[];try{foundNodes=[].slice.call(document.querySelectorAll(selector));}catch(e){logMessage(source,"Invalid selector arg: '".concat(selector,"'"));}foundNodes.forEach(function(n){return nodes.add(n);});}else if(selectors.length>0){selectors.forEach(function(s){var elements=document.querySelectorAll(s);for(var i=0;i<elements.length;i+=1){var element=elements[i];nodes.add(element);}});}var removed=false;nodes.forEach(function(node){classNames.forEach(function(className){if(node.classList.contains(className)){node.classList.remove(className);removed=true;}});});if(removed){hit(source);}};var CLASS_ATTR_NAME=["class"];var flags=parseFlags(applying);var run=function run(){removeClassHandler();if(!flags.hasFlag(flags.STAY)){return;}observeDOMChanges(removeClassHandler,true,CLASS_ATTR_NAME);};if(flags.hasFlag(flags.ASAP)){if(document.readyState==="loading"){window.addEventListener("DOMContentLoaded",removeClassHandler,{once:true});}else {removeClassHandler();}}if(document.readyState!=="complete"&&flags.hasFlag(flags.COMPLETE)){window.addEventListener("load",run,{once:true});}else if(flags.hasFlag(flags.STAY)){if(!applying.includes(" ")){removeClassHandler();}observeDOMChanges(removeClassHandler,true,CLASS_ATTR_NAME);}}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function observeDOMChanges(callback){var observeAttrs=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var attrsToObserve=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var THROTTLE_DELAY_MS=20;var observer=new MutationObserver(throttle(callbackWrapper,THROTTLE_DELAY_MS));var connect=function connect(){if(attrsToObserve.length>0){observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs,attributeFilter:attrsToObserve});}else {observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs});}};var disconnect=function disconnect(){observer.disconnect();};function callbackWrapper(){disconnect();callback();connect();}connect();}function parseFlags(flags){var FLAGS_DIVIDER=" ";var ASAP_FLAG="asap";var COMPLETE_FLAG="complete";var STAY_FLAG="stay";var VALID_FLAGS=new Set([ASAP_FLAG,COMPLETE_FLAG,STAY_FLAG]);var passedFlags=new Set(flags.trim().split(FLAGS_DIVIDER).filter(function(flag){return VALID_FLAGS.has(flag);}));return {ASAP:ASAP_FLAG,COMPLETE:COMPLETE_FLAG,STAY:STAY_FLAG,hasFlag:function hasFlag(flag){return passedFlags.has(flag);}};}function throttle(cb,delay){var wait=false;var savedArgs;var wrapper=function wrapper(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}if(wait){savedArgs=args;return;}cb(...args);wait=true;setTimeout(function(){wait=false;if(savedArgs){wrapper(...savedArgs);savedArgs=null;}},delay);};return wrapper;}var updatedArgs=args?[].concat(source).concat(args):[source];try{removeClass.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function removeCookie(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function removeCookie(source,match){var matchRegexp=toRegExp(match);var removeCookieFromHost=function removeCookieFromHost(cookieName,hostName){var cookieSpec="".concat(cookieName,"=");var domain1="; domain=".concat(hostName);var domain2="; domain=.".concat(hostName);var path="; path=/";var expiration="; expires=Thu, 01 Jan 1970 00:00:00 GMT";document.cookie=cookieSpec+expiration;document.cookie=cookieSpec+domain1+expiration;document.cookie=cookieSpec+domain2+expiration;document.cookie=cookieSpec+path+expiration;document.cookie=cookieSpec+domain1+path+expiration;document.cookie=cookieSpec+domain2+path+expiration;hit(source);};var rmCookie=function rmCookie(){document.cookie.split(";").forEach(function(cookieStr){var pos=cookieStr.indexOf("=");if(pos===-1){return;}var cookieName=cookieStr.slice(0,pos).trim();if(!matchRegexp.test(cookieName)){return;}var hostParts=document.location.hostname.split(".");for(var i=0;i<=hostParts.length-1;i+=1){var hostName=hostParts.slice(i).join(".");if(hostName){removeCookieFromHost(cookieName,hostName);}}});};rmCookie();window.addEventListener("beforeunload",rmCookie);}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{removeCookie.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function removeInShadowDom(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function removeInShadowDom(source,selector,baseSelector){if(!Element.prototype.attachShadow){return;}var removeElement=function removeElement(targetElement){targetElement.remove();};var removeHandler=function removeHandler(){var hostElements=!baseSelector?findHostElements(document.documentElement):document.querySelectorAll(baseSelector);var _loop=function _loop(){var isRemoved=false;var _pierceShadowDom=pierceShadowDom(selector,hostElements),targets=_pierceShadowDom.targets,innerHosts=_pierceShadowDom.innerHosts;targets.forEach(function(targetEl){removeElement(targetEl);isRemoved=true;});if(isRemoved){hit(source);}hostElements=innerHosts;};while(hostElements.length!==0){_loop();}};removeHandler();observeDOMChanges(removeHandler,true);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function observeDOMChanges(callback){var observeAttrs=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var attrsToObserve=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var THROTTLE_DELAY_MS=20;var observer=new MutationObserver(throttle(callbackWrapper,THROTTLE_DELAY_MS));var connect=function connect(){if(attrsToObserve.length>0){observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs,attributeFilter:attrsToObserve});}else {observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs});}};var disconnect=function disconnect(){observer.disconnect();};function callbackWrapper(){disconnect();callback();connect();}connect();}function findHostElements(rootElement){var hosts=[];if(rootElement){var domElems=rootElement.querySelectorAll("*");domElems.forEach(function(el){if(el.shadowRoot){hosts.push(el);}});}return hosts;}function pierceShadowDom(selector,hostElements){var targets=[];var innerHostsAcc=[];hostElements.forEach(function(host){var simpleElems=host.querySelectorAll(selector);targets=targets.concat([].slice.call(simpleElems));var shadowRootElem=host.shadowRoot;var shadowChildren=shadowRootElem.querySelectorAll(selector);targets=targets.concat([].slice.call(shadowChildren));innerHostsAcc.push(findHostElements(shadowRootElem));});var innerHosts=flatten(innerHostsAcc);return {targets:targets,innerHosts:innerHosts};}function flatten(input){var stack=[];input.forEach(function(el){return stack.push(el);});var res=[];while(stack.length){var next=stack.pop();if(Array.isArray(next)){next.forEach(function(el){return stack.push(el);});}else {res.push(next);}}return res.reverse();}function throttle(cb,delay){var wait=false;var savedArgs;var wrapper=function wrapper(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}if(wait){savedArgs=args;return;}cb(...args);wait=true;setTimeout(function(){wait=false;if(savedArgs){wrapper(...savedArgs);savedArgs=null;}},delay);};return wrapper;}var updatedArgs=args?[].concat(source).concat(args):[source];try{removeInShadowDom.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function removeNodeText(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function removeNodeText(source,nodeName,textMatch){var _parseNodeTextParams=parseNodeTextParams(nodeName,textMatch),selector=_parseNodeTextParams.selector,nodeNameMatch=_parseNodeTextParams.nodeNameMatch,textContentMatch=_parseNodeTextParams.textContentMatch;var handleNodes=function handleNodes(nodes){return nodes.forEach(function(node){var shouldReplace=isTargetNode(node,nodeNameMatch,textContentMatch);if(shouldReplace){var ALL_TEXT_PATTERN=/^[\s\S]*$/;var REPLACEMENT="";replaceNodeText(source,node,ALL_TEXT_PATTERN,REPLACEMENT);}});};if(document.documentElement){handleExistingNodes(selector,handleNodes);}observeDocumentWithTimeout(function(mutations){return handleMutations(mutations,handleNodes);});}function observeDocumentWithTimeout(callback){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{subtree:true,childList:true};var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1e4;var documentObserver=new MutationObserver(function(mutations,observer){observer.disconnect();callback(mutations,observer);observer.observe(document.documentElement,options);});documentObserver.observe(document.documentElement,options);if(typeof timeout==="number"){setTimeout(function(){return documentObserver.disconnect();},timeout);}}function handleExistingNodes(selector,handler){var nodeList=document.querySelectorAll(selector);var nodes=nodeListToArray(nodeList);handler(nodes);}function handleMutations(mutations,handler){var addedNodes=getAddedNodes(mutations);handler(addedNodes);}function replaceNodeText(source,node,pattern,replacement){var textContent=node.textContent;if(textContent){node.textContent=textContent.replace(pattern,replacement);hit(source);}}function isTargetNode(node,nodeNameMatch,textContentMatch){var nodeName=node.nodeName,textContent=node.textContent;var nodeNameLowerCase=nodeName.toLowerCase();return textContent!==null&&textContent!==""&&(nodeNameMatch instanceof RegExp?nodeNameMatch.test(nodeNameLowerCase):nodeNameMatch===nodeNameLowerCase)&&(textContentMatch instanceof RegExp?textContentMatch.test(textContent):textContent.includes(textContentMatch));}function parseNodeTextParams(nodeName,textMatch){var pattern=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var REGEXP_START_MARKER="/";var isStringNameMatch=!(nodeName.startsWith(REGEXP_START_MARKER)&&nodeName.endsWith(REGEXP_START_MARKER));var selector=isStringNameMatch?nodeName:"*";var nodeNameMatch=isStringNameMatch?nodeName:toRegExp(nodeName);var textContentMatch=!textMatch.startsWith(REGEXP_START_MARKER)?textMatch:toRegExp(textMatch);var patternMatch;if(pattern){patternMatch=!pattern.startsWith(REGEXP_START_MARKER)?pattern:toRegExp(pattern);}return {selector:selector,nodeNameMatch:nodeNameMatch,textContentMatch:textContentMatch,patternMatch:patternMatch};}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function nodeListToArray(nodeList){var nodes=[];for(var i=0;i<nodeList.length;i+=1){nodes.push(nodeList[i]);}return nodes;}function getAddedNodes(mutations){var nodes=[];for(var i=0;i<mutations.length;i+=1){var addedNodes=mutations[i].addedNodes;for(var j=0;j<addedNodes.length;j+=1){nodes.push(addedNodes[j]);}}return nodes;}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}var updatedArgs=args?[].concat(source).concat(args):[source];try{removeNodeText.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function setAttr(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function setAttr(source,selector,attr){var value=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";if(!selector||!attr){return;}var allowedValues=["true","false"];var shouldCopyValue=value.startsWith("[")&&value.endsWith("]");var isValidValue=value.length===0||!nativeIsNaN(parseInt(value,10))&&parseInt(value,10)>=0&&parseInt(value,10)<=32767||allowedValues.includes(value.toLowerCase());if(!shouldCopyValue&&!isValidValue){logMessage(source,"Invalid attribute value provided: '".concat(convertTypeToString(value),"'"));return;}var attributeHandler;if(shouldCopyValue){attributeHandler=function attributeHandler(elem,attr,value){var valueToCopy=elem.getAttribute(value.slice(1,-1));if(valueToCopy===null){logMessage(source,"No element attribute found to copy value from: ".concat(value));}elem.setAttribute(attr,valueToCopy);};}setAttributeBySelector(source,selector,attr,value,attributeHandler);observeDOMChanges(function(){return setAttributeBySelector(source,selector,attr,value,attributeHandler);},true);}function setAttributeBySelector(source,selector,attribute,value){var attributeSetter=arguments.length>4&&arguments[4]!==undefined?arguments[4]:defaultAttributeSetter;var elements;try{elements=document.querySelectorAll(selector);}catch(_unused){logMessage(source,'Failed to find elements matching selector "'.concat(selector,'"'));return;}if(!elements||elements.length===0){return;}try{elements.forEach(function(elem){return attributeSetter(elem,attribute,value);});hit(source);}catch(_unused2){logMessage(source,"Failed to set [".concat(attribute,'="').concat(value,'"] to each of selected elements.'));}}function observeDOMChanges(callback){var observeAttrs=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var attrsToObserve=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var THROTTLE_DELAY_MS=20;var observer=new MutationObserver(throttle(callbackWrapper,THROTTLE_DELAY_MS));var connect=function connect(){if(attrsToObserve.length>0){observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs,attributeFilter:attrsToObserve});}else {observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs});}};var disconnect=function disconnect(){observer.disconnect();};function callbackWrapper(){disconnect();callback();connect();}connect();}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function convertTypeToString(value){var output;if(typeof value==="undefined"){output="undefined";}else if(typeof value==="object"){if(value===null){output="null";}else {output=objectToString(value);}}else {output=String(value);}return output;}function defaultAttributeSetter(elem,attribute,value){return elem.setAttribute(attribute,value);}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function throttle(cb,delay){var wait=false;var savedArgs;var wrapper=function wrapper(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}if(wait){savedArgs=args;return;}cb(...args);wait=true;setTimeout(function(){wait=false;if(savedArgs){wrapper(...savedArgs);savedArgs=null;}},delay);};return wrapper;}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{setAttr.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function setConstant(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function setConstant(source,property,value){var stack=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var valueWrapper=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"";var setProxyTrap=arguments.length>5&&arguments[5]!==undefined?arguments[5]:false;var uboAliases=["set-constant.js","ubo-set-constant.js","set.js","ubo-set.js","ubo-set-constant","ubo-set"];if(uboAliases.includes(source.name)){if(stack.length!==1&&!getNumberFromString(stack)){valueWrapper=stack;}stack=undefined;}if(!property||!matchStackTrace(stack,new Error().stack)){return;}var isProxyTrapSet=false;var emptyArr=noopArray();var emptyObj=noopObject();var constantValue;if(value==="undefined"){constantValue=undefined;}else if(value==="false"){constantValue=false;}else if(value==="true"){constantValue=true;}else if(value==="null"){constantValue=null;}else if(value==="emptyArr"){constantValue=emptyArr;}else if(value==="emptyObj"){constantValue=emptyObj;}else if(value==="noopFunc"){constantValue=noopFunc;}else if(value==="noopCallbackFunc"){constantValue=noopCallbackFunc;}else if(value==="trueFunc"){constantValue=trueFunc;}else if(value==="falseFunc"){constantValue=falseFunc;}else if(value==="throwFunc"){constantValue=throwFunc;}else if(value==="noopPromiseResolve"){constantValue=noopPromiseResolve;}else if(value==="noopPromiseReject"){constantValue=noopPromiseReject;}else if(/^\d+$/.test(value)){constantValue=parseFloat(value);if(nativeIsNaN(constantValue)){return;}if(Math.abs(constantValue)>32767){return;}}else if(value==="-1"){constantValue=-1;}else if(value===""){constantValue="";}else if(value==="yes"){constantValue="yes";}else if(value==="no"){constantValue="no";}else {return;}var valueWrapperNames=["asFunction","asCallback","asResolved","asRejected"];if(valueWrapperNames.includes(valueWrapper)){var valueWrappersMap={asFunction(v){return function(){return v;};},asCallback(v){return function(){return function(){return v;};};},asResolved(v){return Promise.resolve(v);},asRejected(v){return Promise.reject(v);}};constantValue=valueWrappersMap[valueWrapper](constantValue);}var canceled=false;var mustCancel=function mustCancel(value){if(canceled){return canceled;}canceled=value!==undefined&&constantValue!==undefined&&typeof value!==typeof constantValue&&value!==null;return canceled;};var trapProp=function trapProp(base,prop,configurable,handler){if(!handler.init(base[prop])){return false;}var origDescriptor=Object.getOwnPropertyDescriptor(base,prop);var prevSetter;if(origDescriptor instanceof Object){if(!origDescriptor.configurable){var message="Property '".concat(prop,"' is not configurable");logMessage(source,message);return false;}if(base[prop]){base[prop]=constantValue;}if(origDescriptor.set instanceof Function){prevSetter=origDescriptor.set;}}Object.defineProperty(base,prop,{configurable:configurable,get(){return handler.get();},set(a){if(prevSetter!==undefined){prevSetter(a);}if(a instanceof Object){var propertiesToCheck=property.split(".").slice(1);if(setProxyTrap&&!isProxyTrapSet){isProxyTrapSet=true;a=new Proxy(a,{get:function get(target,propertyKey,val){propertiesToCheck.reduce(function(object,currentProp,index,array){var currentObj=object===null||object===void 0?void 0:object[currentProp];if(index===array.length-1&&currentObj!==constantValue){object[currentProp]=constantValue;}return currentObj||object;},target);return Reflect.get(target,propertyKey,val);}});}}handler.set(a);}});return true;};var setChainPropAccess=function setChainPropAccess(owner,property){var chainInfo=getPropertyInChain(owner,property);var base=chainInfo.base;var prop=chainInfo.prop,chain=chainInfo.chain;var inChainPropHandler={factValue:undefined,init(a){this.factValue=a;return true;},get(){return this.factValue;},set(a){if(this.factValue===a){return;}this.factValue=a;if(a instanceof Object){setChainPropAccess(a,chain);}}};var endPropHandler={init(a){if(mustCancel(a)){return false;}return true;},get(){return constantValue;},set(a){if(!mustCancel(a)){return;}constantValue=a;}};if(!chain){var isTrapped=trapProp(base,prop,false,endPropHandler);if(isTrapped){hit(source);}return;}if(base!==undefined&&base[prop]===null){trapProp(base,prop,true,inChainPropHandler);return;}if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){trapProp(base,prop,true,inChainPropHandler);}var propValue=owner[prop];if(propValue instanceof Object||typeof propValue==="object"&&propValue!==null){setChainPropAccess(propValue,chain);}trapProp(base,prop,true,inChainPropHandler);};setChainPropAccess(window,property);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function getNumberFromString(rawString){var parsedDelay=parseInt(rawString,10);var validDelay=nativeIsNaN(parsedDelay)?null:parsedDelay;return validDelay;}function noopArray(){return [];}function noopObject(){return {};}function noopFunc(){}function noopCallbackFunc(){return noopFunc;}function trueFunc(){return true;}function falseFunc(){return false;}function throwFunc(){throw new Error();}function noopPromiseReject(){return Promise.reject();}function noopPromiseResolve(){var responseBody=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"{}";var responseUrl=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";var responseType=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"basic";if(typeof Response==="undefined"){return;}var response=new Response(responseBody,{status:200,statusText:"OK"});if(responseType==="opaque"){Object.defineProperties(response,{body:{value:null},status:{value:0},statusText:{value:""},url:{value:""},type:{value:responseType}});}else {Object.defineProperties(response,{url:{value:responseUrl},type:{value:responseType}});}return Promise.resolve(response);}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function matchStackTrace(stackMatch,stackTrace){if(!stackMatch||stackMatch===""){return true;}var regExpValues=backupRegExpValues();if(shouldAbortInlineOrInjectedScript(stackMatch,stackTrace)){if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return true;}var stackRegexp=toRegExp(stackMatch);var refinedStackTrace=stackTrace.split("\n").slice(2).map(function(line){return line.trim();}).join("\n");if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return getNativeRegexpTest().call(stackRegexp,refinedStackTrace);}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}function shouldAbortInlineOrInjectedScript(stackMatch,stackTrace){var INLINE_SCRIPT_STRING="inlineScript";var INJECTED_SCRIPT_STRING="injectedScript";var INJECTED_SCRIPT_MARKER="<anonymous>";var isInlineScript=function isInlineScript(match){return match.includes(INLINE_SCRIPT_STRING);};var isInjectedScript=function isInjectedScript(match){return match.includes(INJECTED_SCRIPT_STRING);};if(!(isInlineScript(stackMatch)||isInjectedScript(stackMatch))){return false;}var documentURL=window.location.href;var pos=documentURL.indexOf("#");if(pos!==-1){documentURL=documentURL.slice(0,pos);}var stackSteps=stackTrace.split("\n").slice(2).map(function(line){return line.trim();});var stackLines=stackSteps.map(function(line){var stack;var getStackTraceValues=/(.*?@)?(\S+)(:\d+)(:\d+)\)?$/.exec(line);if(getStackTraceValues){var _stackURL,_stackURL2;var stackURL=getStackTraceValues[2];var stackLine=getStackTraceValues[3];var stackCol=getStackTraceValues[4];if((_stackURL=stackURL)!==null&&_stackURL!==void 0&&_stackURL.startsWith("(")){stackURL=stackURL.slice(1);}if((_stackURL2=stackURL)!==null&&_stackURL2!==void 0&&_stackURL2.startsWith(INJECTED_SCRIPT_MARKER)){var _stackFunction;stackURL=INJECTED_SCRIPT_STRING;var stackFunction=getStackTraceValues[1]!==undefined?getStackTraceValues[1].slice(0,-1):line.slice(0,getStackTraceValues.index).trim();if((_stackFunction=stackFunction)!==null&&_stackFunction!==void 0&&_stackFunction.startsWith("at")){stackFunction=stackFunction.slice(2).trim();}stack="".concat(stackFunction," ").concat(stackURL).concat(stackLine).concat(stackCol).trim();}else if(stackURL===documentURL){stack="".concat(INLINE_SCRIPT_STRING).concat(stackLine).concat(stackCol).trim();}else {stack="".concat(stackURL).concat(stackLine).concat(stackCol).trim();}}else {stack=line;}return stack;});if(stackLines){for(var index=0;index<stackLines.length;index+=1){if(isInlineScript(stackMatch)&&stackLines[index].startsWith(INLINE_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}if(isInjectedScript(stackMatch)&&stackLines[index].startsWith(INJECTED_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}}}return false;}function getNativeRegexpTest(){var descriptor=Object.getOwnPropertyDescriptor(RegExp.prototype,"test");var nativeRegexTest=descriptor===null||descriptor===void 0?void 0:descriptor.value;if(descriptor&&typeof descriptor.value==="function"){return nativeRegexTest;}throw new Error("RegExp.prototype.test is not a function");}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function backupRegExpValues(){try{var arrayOfRegexpValues=[];for(var index=1;index<10;index+=1){var value="$".concat(index);if(!RegExp[value]){break;}arrayOfRegexpValues.push(RegExp[value]);}return arrayOfRegexpValues;}catch(error){return [];}}function restoreRegExpValues(array){if(!array.length){return;}try{var stringPattern="";if(array.length===1){stringPattern="(".concat(array[0],")");}else {stringPattern=array.reduce(function(accumulator,currentValue,currentIndex){if(currentIndex===1){return "(".concat(accumulator,"),(").concat(currentValue,")");}return "".concat(accumulator,",(").concat(currentValue,")");});}var regExpGroup=new RegExp(stringPattern);array.toString().replace(regExpGroup,"");}catch(error){var message="Failed to restore RegExp values: ".concat(error);console.log(message);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{setConstant.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function setCookie(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function setCookie(source,name,value){var path=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"/";var domain=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"";var validValue=getLimitedCookieValue(value);if(validValue===null){logMessage(source,"Invalid cookie value: '".concat(validValue,"'"));return;}if(!isValidCookiePath(path)){logMessage(source,"Invalid cookie path: '".concat(path,"'"));return;}if(!document.location.origin.includes(domain)){logMessage(source,"Cookie domain not matched by origin: '".concat(domain,"'"));return;}var cookieToSet=serializeCookie(name,validValue,path,domain);if(!cookieToSet){logMessage(source,"Invalid cookie name or value");return;}hit(source);document.cookie=cookieToSet;}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function getLimitedCookieValue(value){if(!value){return null;}var allowedCookieValues=new Set(["true","t","false","f","yes","y","no","n","ok","on","off","accept","accepted","notaccepted","reject","rejected","allow","allowed","disallow","deny","enable","enabled","disable","disabled","necessary","required","hide","hidden","essential","nonessential","checked","unchecked"]);var validValue;if(allowedCookieValues.has(value.toLowerCase())){validValue=value;}else if(/^\d+$/.test(value)){validValue=parseFloat(value);if(nativeIsNaN(validValue)){return null;}if(Math.abs(validValue)<0||Math.abs(validValue)>32767){return null;}}else {return null;}return validValue;}function serializeCookie(name,rawValue,rawPath){var domainValue=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var shouldEncodeValue=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;var HOST_PREFIX="__Host-";var SECURE_PREFIX="__Secure-";var COOKIE_BREAKER=";";if(!shouldEncodeValue&&"".concat(rawValue).includes(COOKIE_BREAKER)||name.includes(COOKIE_BREAKER)){return null;}var value=shouldEncodeValue?encodeURIComponent(rawValue):rawValue;var resultCookie="".concat(name,"=").concat(value);if(name.startsWith(HOST_PREFIX)){resultCookie+="; path=/; secure";if(domainValue){console.debug('Domain value: "'.concat(domainValue,'" has been ignored, because is not allowed for __Host- prefixed cookies'));}return resultCookie;}var path=getCookiePath(rawPath);if(path){resultCookie+="; ".concat(path);}if(name.startsWith(SECURE_PREFIX)){resultCookie+="; secure";}if(domainValue){resultCookie+="; domain=".concat(domainValue);}return resultCookie;}function isValidCookiePath(rawPath){return rawPath==="/"||rawPath==="none";}function getCookiePath(rawPath){if(rawPath==="/"){return "path=/";}return "";}var updatedArgs=args?[].concat(source).concat(args):[source];try{setCookie.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function setCookieReload(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function setCookieReload(source,name,value){var path=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"/";var domain=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"";if(isCookieSetWithValue(document.cookie,name,value)){return;}var validValue=getLimitedCookieValue(value);if(validValue===null){logMessage(source,"Invalid cookie value: '".concat(value,"'"));return;}if(!isValidCookiePath(path)){logMessage(source,"Invalid cookie path: '".concat(path,"'"));return;}if(!document.location.origin.includes(domain)){logMessage(source,"Cookie domain not matched by origin: '".concat(domain,"'"));return;}var cookieToSet=serializeCookie(name,validValue,path,domain);if(!cookieToSet){logMessage(source,"Invalid cookie name or value");return;}document.cookie=cookieToSet;hit(source);if(isCookieSetWithValue(document.cookie,name,value)){window.location.reload();}}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function isCookieSetWithValue(cookieString,name,value){return cookieString.split(";").some(function(cookieStr){var pos=cookieStr.indexOf("=");if(pos===-1){return false;}var cookieName=cookieStr.slice(0,pos).trim();var cookieValue=cookieStr.slice(pos+1).trim();return name===cookieName&&value===cookieValue;});}function getLimitedCookieValue(value){if(!value){return null;}var allowedCookieValues=new Set(["true","t","false","f","yes","y","no","n","ok","on","off","accept","accepted","notaccepted","reject","rejected","allow","allowed","disallow","deny","enable","enabled","disable","disabled","necessary","required","hide","hidden","essential","nonessential","checked","unchecked"]);var validValue;if(allowedCookieValues.has(value.toLowerCase())){validValue=value;}else if(/^\d+$/.test(value)){validValue=parseFloat(value);if(nativeIsNaN(validValue)){return null;}if(Math.abs(validValue)<0||Math.abs(validValue)>32767){return null;}}else {return null;}return validValue;}function serializeCookie(name,rawValue,rawPath){var domainValue=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var shouldEncodeValue=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;var HOST_PREFIX="__Host-";var SECURE_PREFIX="__Secure-";var COOKIE_BREAKER=";";if(!shouldEncodeValue&&"".concat(rawValue).includes(COOKIE_BREAKER)||name.includes(COOKIE_BREAKER)){return null;}var value=shouldEncodeValue?encodeURIComponent(rawValue):rawValue;var resultCookie="".concat(name,"=").concat(value);if(name.startsWith(HOST_PREFIX)){resultCookie+="; path=/; secure";if(domainValue){console.debug('Domain value: "'.concat(domainValue,'" has been ignored, because is not allowed for __Host- prefixed cookies'));}return resultCookie;}var path=getCookiePath(rawPath);if(path){resultCookie+="; ".concat(path);}if(name.startsWith(SECURE_PREFIX)){resultCookie+="; secure";}if(domainValue){resultCookie+="; domain=".concat(domainValue);}return resultCookie;}function isValidCookiePath(rawPath){return rawPath==="/"||rawPath==="none";}function getCookiePath(rawPath){if(rawPath==="/"){return "path=/";}return "";}var updatedArgs=args?[].concat(source).concat(args):[source];try{setCookieReload.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function setLocalStorageItem(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function setLocalStorageItem(source,key,value){if(typeof key==="undefined"){logMessage(source,"Item key should be specified.");return;}var validValue;try{validValue=getLimitedStorageItemValue(value);}catch(_unused){logMessage(source,"Invalid storage item value: '".concat(value,"'"));return;}var _window=window,localStorage=_window.localStorage;if(validValue==="$remove$"){removeStorageItem(source,localStorage,key);}else {setStorageItem(source,localStorage,key,validValue);}hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function setStorageItem(source,storage,key,value){try{storage.setItem(key,value);}catch(e){var message="Unable to set sessionStorage item due to: ".concat(e.message);logMessage(source,message);}}function removeStorageItem(source,storage,key){try{if(key.startsWith("/")&&(key.endsWith("/")||key.endsWith("/i"))&&isValidStrPattern(key)){var regExpKey=toRegExp(key);var storageKeys=Object.keys(storage);storageKeys.forEach(function(storageKey){if(regExpKey.test(storageKey)){storage.removeItem(storageKey);}});}else {storage.removeItem(key);}}catch(e){var message="Unable to remove storage item due to: ".concat(e.message);logMessage(source,message);}}function getLimitedStorageItemValue(value){if(typeof value!=="string"){throw new Error("Invalid value");}var allowedStorageValues=new Set(["undefined","false","true","null","","yes","no","on","off","accept","accepted","reject","rejected","allowed","denied"]);var validValue;if(allowedStorageValues.has(value.toLowerCase())){validValue=value;}else if(value==="emptyArr"){validValue="[]";}else if(value==="emptyObj"){validValue="{}";}else if(/^\d+$/.test(value)){validValue=parseFloat(value);if(nativeIsNaN(validValue)){throw new Error("Invalid value");}if(Math.abs(validValue)>32767){throw new Error("Invalid value");}}else if(value==="$remove$"){validValue="$remove$";}else {throw new Error("Invalid value");}return validValue;}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}var updatedArgs=args?[].concat(source).concat(args):[source];try{setLocalStorageItem.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function setPopadsDummy(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function setPopadsDummy(source){delete window.PopAds;delete window.popns;Object.defineProperties(window,{PopAds:{get:function get(){hit(source);return {};}},popns:{get:function get(){hit(source);return {};}}});}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{setPopadsDummy.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function setSessionStorageItem(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function setSessionStorageItem(source,key,value){if(typeof key==="undefined"){logMessage(source,"Item key should be specified.");return;}var validValue;try{validValue=getLimitedStorageItemValue(value);}catch(_unused){logMessage(source,"Invalid storage item value: '".concat(value,"'"));return;}var _window=window,sessionStorage=_window.sessionStorage;if(validValue==="$remove$"){removeStorageItem(source,sessionStorage,key);}else {setStorageItem(source,sessionStorage,key,validValue);}hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function setStorageItem(source,storage,key,value){try{storage.setItem(key,value);}catch(e){var message="Unable to set sessionStorage item due to: ".concat(e.message);logMessage(source,message);}}function removeStorageItem(source,storage,key){try{if(key.startsWith("/")&&(key.endsWith("/")||key.endsWith("/i"))&&isValidStrPattern(key)){var regExpKey=toRegExp(key);var storageKeys=Object.keys(storage);storageKeys.forEach(function(storageKey){if(regExpKey.test(storageKey)){storage.removeItem(storageKey);}});}else {storage.removeItem(key);}}catch(e){var message="Unable to remove storage item due to: ".concat(e.message);logMessage(source,message);}}function getLimitedStorageItemValue(value){if(typeof value!=="string"){throw new Error("Invalid value");}var allowedStorageValues=new Set(["undefined","false","true","null","","yes","no","on","off","accept","accepted","reject","rejected","allowed","denied"]);var validValue;if(allowedStorageValues.has(value.toLowerCase())){validValue=value;}else if(value==="emptyArr"){validValue="[]";}else if(value==="emptyObj"){validValue="{}";}else if(/^\d+$/.test(value)){validValue=parseFloat(value);if(nativeIsNaN(validValue)){throw new Error("Invalid value");}if(Math.abs(validValue)>32767){throw new Error("Invalid value");}}else if(value==="$remove$"){validValue="$remove$";}else {throw new Error("Invalid value");}return validValue;}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}var updatedArgs=args?[].concat(source).concat(args):[source];try{setSessionStorageItem.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function spoofCSS(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function spoofCSS(source,selectors,cssPropertyName,cssPropertyValue){if(!selectors){return;}var uboAliases=["spoof-css.js","ubo-spoof-css.js","ubo-spoof-css"];function convertToCamelCase(cssProperty){if(!cssProperty.includes("-")){return cssProperty;}var splittedProperty=cssProperty.split("-");var firstPart=splittedProperty[0];var secondPart=splittedProperty[1];return "".concat(firstPart).concat(secondPart[0].toUpperCase()).concat(secondPart.slice(1));}var shouldDebug=!!(cssPropertyName==="debug"&&cssPropertyValue);var propToValueMap=new Map();if(uboAliases.includes(source.name)){var args=source.args;var arrayOfProperties=[];var isDebug=args.at(-2);if(isDebug==="debug"){arrayOfProperties=args.slice(1,-2);}else {arrayOfProperties=args.slice(1);}for(var i=0;i<arrayOfProperties.length;i+=2){if(arrayOfProperties[i]===""){break;}propToValueMap.set(convertToCamelCase(arrayOfProperties[i]),arrayOfProperties[i+1]);}}else if(cssPropertyName&&cssPropertyValue&&!shouldDebug){propToValueMap.set(convertToCamelCase(cssPropertyName),cssPropertyValue);}var spoofStyle=function spoofStyle(cssProperty,realCssValue){return propToValueMap.has(cssProperty)?propToValueMap.get(cssProperty):realCssValue;};var setRectValue=function setRectValue(rect,prop,value){Object.defineProperty(rect,prop,{value:parseFloat(value)});};var getter=function getter(target,prop,receiver){hit(source);if(prop==="toString"){return target.toString.bind(target);}return Reflect.get(target,prop,receiver);};var getComputedStyleWrapper=function getComputedStyleWrapper(target,thisArg,args){if(shouldDebug){debugger;}var style=Reflect.apply(target,thisArg,args);if(!args[0].matches(selectors)){return style;}var proxiedStyle=new Proxy(style,{get(target,prop){var CSSStyleProp=target[prop];if(typeof CSSStyleProp!=="function"){return spoofStyle(prop,CSSStyleProp||"");}if(prop!=="getPropertyValue"){return CSSStyleProp.bind(target);}var getPropertyValueFunc=new Proxy(CSSStyleProp,{apply(target,thisArg,args){var cssName=args[0];var cssValue=thisArg[cssName];return spoofStyle(cssName,cssValue);},get:getter});return getPropertyValueFunc;},getOwnPropertyDescriptor(target,prop){if(propToValueMap.has(prop)){return {configurable:true,enumerable:true,value:propToValueMap.get(prop),writable:true};}return Reflect.getOwnPropertyDescriptor(target,prop);}});hit(source);return proxiedStyle;};var getComputedStyleHandler={apply:getComputedStyleWrapper,get:getter};window.getComputedStyle=new Proxy(window.getComputedStyle,getComputedStyleHandler);var getBoundingClientRectWrapper=function getBoundingClientRectWrapper(target,thisArg,args){if(shouldDebug){debugger;}var rect=Reflect.apply(target,thisArg,args);if(!thisArg.matches(selectors)){return rect;}var top=rect.top,bottom=rect.bottom,height=rect.height,width=rect.width,left=rect.left,right=rect.right;var newDOMRect=new window.DOMRect(rect.x,rect.y,top,bottom,width,height,left,right);if(propToValueMap.has("top")){setRectValue(newDOMRect,"top",propToValueMap.get("top"));}if(propToValueMap.has("bottom")){setRectValue(newDOMRect,"bottom",propToValueMap.get("bottom"));}if(propToValueMap.has("left")){setRectValue(newDOMRect,"left",propToValueMap.get("left"));}if(propToValueMap.has("right")){setRectValue(newDOMRect,"right",propToValueMap.get("right"));}if(propToValueMap.has("height")){setRectValue(newDOMRect,"height",propToValueMap.get("height"));}if(propToValueMap.has("width")){setRectValue(newDOMRect,"width",propToValueMap.get("width"));}hit(source);return newDOMRect;};var getBoundingClientRectHandler={apply:getBoundingClientRectWrapper,get:getter};window.Element.prototype.getBoundingClientRect=new Proxy(window.Element.prototype.getBoundingClientRect,getBoundingClientRectHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{spoofCSS.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedClickElement(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedClickElement(source,selectors){var extraMatch=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"";var delay=arguments.length>3&&arguments[3]!==undefined?arguments[3]:NaN;var reload=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"";if(!selectors){return;}var SHADOW_COMBINATOR=" >>> ";var OBSERVER_TIMEOUT_MS=1e4;var THROTTLE_DELAY_MS=20;var STATIC_CLICK_DELAY_MS=150;var STATIC_RELOAD_DELAY_MS=500;var COOKIE_MATCH_MARKER="cookie:";var LOCAL_STORAGE_MATCH_MARKER="localStorage:";var TEXT_MATCH_MARKER="containsText:";var RELOAD_ON_FINAL_CLICK_MARKER="reloadAfterClick";var SELECTORS_DELIMITER=",";var COOKIE_STRING_DELIMITER=";";var COLON=":";var EXTRA_MATCH_DELIMITER=/(,\s*){1}(?=!?cookie:|!?localStorage:|containsText:)/;var sleep=function sleep(delayMs){return new Promise(function(resolve){return setTimeout(resolve,delayMs);});};if(selectors.includes(SHADOW_COMBINATOR)){var attachShadowWrapper=function attachShadowWrapper(target,thisArg,argumentsList){var _argumentsList$;var mode=(_argumentsList$=argumentsList[0])===null||_argumentsList$===void 0?void 0:_argumentsList$.mode;if(mode==="closed"){argumentsList[0].mode="open";}return Reflect.apply(target,thisArg,argumentsList);};var attachShadowHandler={apply:attachShadowWrapper};window.Element.prototype.attachShadow=new Proxy(window.Element.prototype.attachShadow,attachShadowHandler);}var parsedDelay;if(delay){parsedDelay=parseInt(String(delay),10);var isValidDelay=!Number.isNaN(parsedDelay)||parsedDelay<OBSERVER_TIMEOUT_MS;if(!isValidDelay){var message="Passed delay '".concat(delay,"' is invalid or bigger than ").concat(OBSERVER_TIMEOUT_MS," ms");logMessage(source,message);return;}}var canClick=!parsedDelay;var cookieMatches=[];var localStorageMatches=[];var textMatches="";var isInvertedMatchCookie=false;var isInvertedMatchLocalStorage=false;if(extraMatch){var parsedExtraMatch=extraMatch.split(EXTRA_MATCH_DELIMITER).map(function(matchStr){return matchStr.trim();});parsedExtraMatch.forEach(function(matchStr){if(matchStr.includes(COOKIE_MATCH_MARKER)){var _parseMatchArg=parseMatchArg(matchStr),isInvertedMatch=_parseMatchArg.isInvertedMatch,matchValue=_parseMatchArg.matchValue;isInvertedMatchCookie=isInvertedMatch;var cookieMatch=matchValue.replace(COOKIE_MATCH_MARKER,"");cookieMatches.push(cookieMatch);}if(matchStr.includes(LOCAL_STORAGE_MATCH_MARKER)){var _parseMatchArg2=parseMatchArg(matchStr),_isInvertedMatch=_parseMatchArg2.isInvertedMatch,_matchValue=_parseMatchArg2.matchValue;isInvertedMatchLocalStorage=_isInvertedMatch;var localStorageMatch=_matchValue.replace(LOCAL_STORAGE_MATCH_MARKER,"");localStorageMatches.push(localStorageMatch);}if(matchStr.includes(TEXT_MATCH_MARKER)){var _parseMatchArg3=parseMatchArg(matchStr),_matchValue2=_parseMatchArg3.matchValue;var textMatch=_matchValue2.replace(TEXT_MATCH_MARKER,"");textMatches=textMatch;}});}if(cookieMatches.length>0){var parsedCookieMatches=parseCookieString(cookieMatches.join(COOKIE_STRING_DELIMITER));var parsedCookies=parseCookieString(document.cookie);var cookieKeys=Object.keys(parsedCookies);if(cookieKeys.length===0){return;}var cookiesMatched=Object.keys(parsedCookieMatches).every(function(key){var valueMatch=parsedCookieMatches[key]?toRegExp(parsedCookieMatches[key]):null;var keyMatch=toRegExp(key);return cookieKeys.some(function(cookieKey){var keysMatched=keyMatch.test(cookieKey);if(!keysMatched){return false;}if(!valueMatch){return true;}var parsedCookieValue=parsedCookies[cookieKey];if(!parsedCookieValue){return false;}return valueMatch.test(parsedCookieValue);});});var shouldRun=cookiesMatched!==isInvertedMatchCookie;if(!shouldRun){return;}}if(localStorageMatches.length>0){var localStorageMatched=localStorageMatches.every(function(str){var itemValue=window.localStorage.getItem(str);return itemValue||itemValue==="";});var _shouldRun=localStorageMatched!==isInvertedMatchLocalStorage;if(!_shouldRun){return;}}var textMatchRegexp=textMatches?toRegExp(textMatches):null;var doesElementContainText=function doesElementContainText(element,matchRegexp){var textContent=element.textContent;if(!textContent){return false;}return matchRegexp.test(textContent);};var selectorsSequence=selectors.split(SELECTORS_DELIMITER).map(function(selector){return selector.trim();});var createElementObj=function createElementObj(element){return {element:element||null,clicked:false};};var elementsSequence=Array(selectorsSequence.length).fill(createElementObj(null));var shouldReloadAfterClick=false;var reloadDelayMs=STATIC_RELOAD_DELAY_MS;if(reload){var _reload$split=reload.split(COLON),_reload$split2=_slicedToArray(_reload$split,2),reloadMarker=_reload$split2[0],reloadValue=_reload$split2[1];if(reloadMarker!==RELOAD_ON_FINAL_CLICK_MARKER){logMessage(source,"Passed reload option '".concat(reload,"' is invalid"));return;}if(reloadValue){var passedReload=Number(reloadValue);if(Number.isNaN(passedReload)){logMessage(source,"Passed reload delay value '".concat(passedReload,"' is invalid"));return;}if(passedReload>OBSERVER_TIMEOUT_MS){logMessage(source,"Passed reload delay value '".concat(passedReload,"' is bigger than maximum ").concat(OBSERVER_TIMEOUT_MS," ms"));return;}reloadDelayMs=passedReload;}shouldReloadAfterClick=true;}var canReload=true;var clickElementsBySequence=async function clickElementsBySequence(){for(var i=0;i<elementsSequence.length;i+=1){var elementObj=elementsSequence[i];if(i>=1){await sleep(STATIC_CLICK_DELAY_MS);}if(!elementObj.element){break;}if(!elementObj.clicked){if(textMatchRegexp&&!doesElementContainText(elementObj.element,textMatchRegexp)){continue;}elementObj.element.click();elementObj.clicked=true;}}var allElementsClicked=elementsSequence.every(function(elementObj){return elementObj.clicked===true;});if(allElementsClicked){if(shouldReloadAfterClick&&canReload){canReload=false;setTimeout(function(){window.location.reload();},reloadDelayMs);}hit(source);}};var handleElement=function handleElement(element,i){var elementObj=createElementObj(element);elementsSequence[i]=elementObj;if(canClick){clickElementsBySequence();}};var fulfillAndHandleSelectors=function fulfillAndHandleSelectors(){var fulfilledSelectors=[];selectorsSequence.forEach(function(selector,i){if(!selector){return;}var element=queryShadowSelector(selector);if(!element){return;}handleElement(element,i);fulfilledSelectors.push(selector);});selectorsSequence=selectorsSequence.map(function(selector){return selector&&fulfilledSelectors.includes(selector)?null:selector;});return selectorsSequence;};var findElements=function findElements(mutations,observer){selectorsSequence=fulfillAndHandleSelectors();var allSelectorsFulfilled=selectorsSequence.every(function(selector){return selector===null;});if(allSelectorsFulfilled){observer.disconnect();}};var initializeMutationObserver=function initializeMutationObserver(){var observer=new MutationObserver(throttle(findElements,THROTTLE_DELAY_MS));observer.observe(document.documentElement,{attributes:true,childList:true,subtree:true});setTimeout(function(){return observer.disconnect();},OBSERVER_TIMEOUT_MS);};var checkInitialElements=function checkInitialElements(){var foundElements=selectorsSequence.every(function(selector){if(!selector){return false;}var element=queryShadowSelector(selector);return !!element;});if(foundElements){fulfillAndHandleSelectors();}else {initializeMutationObserver();}};checkInitialElements();if(parsedDelay){setTimeout(function(){clickElementsBySequence();canClick=true;},parsedDelay);}}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function parseCookieString(cookieString){var COOKIE_DELIMITER="=";var COOKIE_PAIRS_DELIMITER=";";var cookieChunks=cookieString.split(COOKIE_PAIRS_DELIMITER);var cookieData={};cookieChunks.forEach(function(singleCookie){var cookieKey;var cookieValue="";var delimiterIndex=singleCookie.indexOf(COOKIE_DELIMITER);if(delimiterIndex===-1){cookieKey=singleCookie.trim();}else {cookieKey=singleCookie.slice(0,delimiterIndex).trim();cookieValue=singleCookie.slice(delimiterIndex+1);}cookieData[cookieKey]=cookieValue||null;});return cookieData;}function throttle(cb,delay){var wait=false;var savedArgs;var wrapper=function wrapper(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}if(wait){savedArgs=args;return;}cb(...args);wait=true;setTimeout(function(){wait=false;if(savedArgs){wrapper(...savedArgs);savedArgs=null;}},delay);};return wrapper;}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function parseMatchArg(match){var INVERT_MARKER="!";var isInvertedMatch=match?match===null||match===void 0?void 0:match.startsWith(INVERT_MARKER):false;var matchValue=isInvertedMatch?match.slice(1):match;var matchRegexp=toRegExp(matchValue);return {isInvertedMatch:isInvertedMatch,matchRegexp:matchRegexp,matchValue:matchValue};}function queryShadowSelector(selector){var context=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document.documentElement;var SHADOW_COMBINATOR=" >>> ";var pos=selector.indexOf(SHADOW_COMBINATOR);if(pos===-1){return context.querySelector(selector);}var shadowHostSelector=selector.slice(0,pos).trim();var elem=context.querySelector(shadowHostSelector);if(!elem||!elem.shadowRoot){return null;}var shadowRootSelector=selector.slice(pos+SHADOW_COMBINATOR.length).trim();return queryShadowSelector(shadowRootSelector,elem.shadowRoot);}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedClickElement.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedCreateElement(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedCreateElement(source,parentSelector,tagName){var attributePairs=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var textContent=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"";var cleanupDelayMs=arguments.length>5&&arguments[5]!==undefined?arguments[5]:NaN;if(!parentSelector||!tagName){return;}var IFRAME_WINDOW_NAME="trusted-create-element-window";if(window.name===IFRAME_WINDOW_NAME){return;}var logError=function logError(prefix,error){logMessage(source,"".concat(prefix," due to ").concat(getErrorMessage(error)));};var element;try{element=document.createElement(tagName);element.textContent=textContent;}catch(e){logError("Cannot create element with tag name '".concat(tagName,"'"),e);return;}var attributes=[];try{attributes=parseAttributePairs(attributePairs);}catch(e){logError("Cannot parse attributePairs param: '".concat(attributePairs,"'"),e);return;}attributes.forEach(function(attr){try{element.setAttribute(attr.name,attr.value);}catch(e){logError("Cannot set attribute '".concat(attr.name,"' with value '").concat(attr.value,"'"),e);}});var timerId;var elementCreated=false;var elementRemoved=false;var findParentAndAppendEl=function findParentAndAppendEl(parentElSelector,el,removeElDelayMs){var parentEl;try{parentEl=document.querySelector(parentElSelector);}catch(e){logError("Cannot find parent element by selector '".concat(parentElSelector,"'"),e);return false;}if(!parentEl){logMessage(source,"No parent element found by selector: '".concat(parentElSelector,"'"));return false;}try{if(!parentEl.contains(el)){parentEl.append(el);}if(el instanceof HTMLIFrameElement&&el.contentWindow){el.contentWindow.name=IFRAME_WINDOW_NAME;}elementCreated=true;hit(source);}catch(e){logError("Cannot append child to parent by selector '".concat(parentElSelector,"'"),e);return false;}if(!nativeIsNaN(removeElDelayMs)){timerId=setTimeout(function(){el.remove();elementRemoved=true;clearTimeout(timerId);},removeElDelayMs);}return true;};if(!findParentAndAppendEl(parentSelector,element,cleanupDelayMs)){observeDocumentWithTimeout(function(mutations,observer){if(elementRemoved||elementCreated||findParentAndAppendEl(parentSelector,element,cleanupDelayMs)){observer.disconnect();}});}}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function observeDocumentWithTimeout(callback){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{subtree:true,childList:true};var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1e4;var documentObserver=new MutationObserver(function(mutations,observer){observer.disconnect();callback(mutations,observer);observer.observe(document.documentElement,options);});documentObserver.observe(document.documentElement,options);if(typeof timeout==="number"){setTimeout(function(){return documentObserver.disconnect();},timeout);}}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function parseAttributePairs(input){if(!input){return [];}var NAME_VALUE_SEPARATOR="=";var PAIRS_SEPARATOR=" ";var SINGLE_QUOTE="'";var DOUBLE_QUOTE='"';var BACKSLASH="\\";var pairs=[];for(var i=0;i<input.length;i+=1){var name="";var value="";while(i<input.length&&input[i]!==NAME_VALUE_SEPARATOR&&input[i]!==PAIRS_SEPARATOR){name+=input[i];i+=1;}if(i<input.length&&input[i]===NAME_VALUE_SEPARATOR){i+=1;var quote=null;if(input[i]===SINGLE_QUOTE||input[i]===DOUBLE_QUOTE){quote=input[i];i+=1;for(;i<input.length;i+=1){if(input[i]===quote){if(input[i-1]===BACKSLASH){value="".concat(value.slice(0,-1)).concat(quote);}else {i+=1;quote=null;break;}}else {value+=input[i];}}if(quote!==null){throw new Error("Unbalanced quote for attribute value: '".concat(input,"'"));}}else {throw new Error('Attribute value should be quoted: "'.concat(input.slice(i),'"'));}}name=name.trim();value=value.trim();if(!name){if(!value){continue;}throw new Error("Attribute name before '=' should be specified: '".concat(input,"'"));}pairs.push({name:name,value:value});if(input[i]&&input[i]!==PAIRS_SEPARATOR){throw new Error("No space before attribute: '".concat(input.slice(i),"'"));}}return pairs;}function getErrorMessage(error){var isErrorWithMessage=function isErrorWithMessage(e){return typeof e==="object"&&e!==null&&"message"in e&&typeof e.message==="string";};if(isErrorWithMessage(error)){return error.message;}try{return new Error(JSON.stringify(error)).message;}catch(_unused){return new Error(String(error)).message;}}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedCreateElement.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedDispatchEvent(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedDispatchEvent(source,event,target){if(!event){return;}var hasBeenDispatched=false;var eventTarget=document;if(target==="window"){eventTarget=window;}var events=new Set();var dispatch=function dispatch(){var customEvent=new Event(event);if(typeof target==="string"&&target!=="window"){eventTarget=document.querySelector(target);}var isEventAdded=events.has(event);if(!hasBeenDispatched&&isEventAdded&&eventTarget){hasBeenDispatched=true;hit(source);eventTarget.dispatchEvent(customEvent);}};var wrapper=function wrapper(eventListener,thisArg,args){var eventName=args[0];if(thisArg&&eventName){events.add(eventName);setTimeout(function(){dispatch();},1);}return Reflect.apply(eventListener,thisArg,args);};var handler={apply:wrapper};EventTarget.prototype.addEventListener=new Proxy(EventTarget.prototype.addEventListener,handler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedDispatchEvent.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedPruneInboundObject(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedPruneInboundObject(source,functionName,propsToRemove,requiredInitialProps){var stack=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"";if(!functionName){return;}var nativeObjects={nativeStringify:window.JSON.stringify};var _getPropertyInChain=getPropertyInChain(window,functionName),base=_getPropertyInChain.base,prop=_getPropertyInChain.prop;if(!base||!prop||typeof base[prop]!=="function"){var message="".concat(functionName," is not a function");logMessage(source,message);return;}var prunePaths=getPrunePath(propsToRemove);var requiredPaths=getPrunePath(requiredInitialProps);var objectWrapper=function objectWrapper(target,thisArg,args){var data=args[0];if(typeof data==="object"){data=jsonPruner(source,data,prunePaths,requiredPaths,stack,nativeObjects);args[0]=data;}return Reflect.apply(target,thisArg,args);};var objectHandler={apply:objectWrapper};base[prop]=new Proxy(base[prop],objectHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function matchStackTrace(stackMatch,stackTrace){if(!stackMatch||stackMatch===""){return true;}var regExpValues=backupRegExpValues();if(shouldAbortInlineOrInjectedScript(stackMatch,stackTrace)){if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return true;}var stackRegexp=toRegExp(stackMatch);var refinedStackTrace=stackTrace.split("\n").slice(2).map(function(line){return line.trim();}).join("\n");if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return getNativeRegexpTest().call(stackRegexp,refinedStackTrace);}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function getWildcardPropertyInChain(base,chain){var lookThrough=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var output=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[];var pos=chain.indexOf(".");if(pos===-1){if(chain==="*"||chain==="[]"){for(var key in base){if(Object.prototype.hasOwnProperty.call(base,key)){output.push({base:base,prop:key});}}}else {output.push({base:base,prop:chain});}return output;}var prop=chain.slice(0,pos);var shouldLookThrough=prop==="[]"&&Array.isArray(base)||prop==="*"&&base instanceof Object;if(shouldLookThrough){var nextProp=chain.slice(pos+1);var baseKeys=Object.keys(base);baseKeys.forEach(function(key){var item=base[key];getWildcardPropertyInChain(item,nextProp,lookThrough,output);});}if(Array.isArray(base)){base.forEach(function(key){var nextBase=key;if(nextBase!==undefined){getWildcardPropertyInChain(nextBase,chain,lookThrough,output);}});}var nextBase=base[prop];chain=chain.slice(pos+1);if(nextBase!==undefined){getWildcardPropertyInChain(nextBase,chain,lookThrough,output);}return output;}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function isPruningNeeded(source,root,prunePaths,requiredPaths,stack,nativeObjects){if(!root){return false;}var nativeStringify=nativeObjects.nativeStringify;var shouldProcess;if(prunePaths.length===0&&requiredPaths.length>0){var rootString=nativeStringify(root);var matchRegex=toRegExp(requiredPaths.join(""));var shouldLog=matchRegex.test(rootString);if(shouldLog){logMessage(source,"".concat(window.location.hostname,"\n").concat(nativeStringify(root,null,2),"\nStack trace:\n").concat(new Error().stack),true);if(root&&typeof root==="object"){logMessage(source,root,true,false);}shouldProcess=false;return shouldProcess;}}if(stack&&!matchStackTrace(stack,new Error().stack||"")){shouldProcess=false;return shouldProcess;}var wildcardSymbols=[".*.","*.",".*",".[].","[].",".[]"];var _loop=function _loop(){var requiredPath=requiredPaths[i];var lastNestedPropName=requiredPath.split(".").pop();var hasWildcard=wildcardSymbols.some(function(symbol){return requiredPath.includes(symbol);});var details=getWildcardPropertyInChain(root,requiredPath,hasWildcard);if(!details.length){shouldProcess=false;return {v:shouldProcess};}shouldProcess=!hasWildcard;for(var j=0;j<details.length;j+=1){var hasRequiredProp=typeof lastNestedPropName==="string"&&details[j].base[lastNestedPropName]!==undefined;if(hasWildcard){shouldProcess=hasRequiredProp||shouldProcess;}else {shouldProcess=hasRequiredProp&&shouldProcess;}}};for(var i=0;i<requiredPaths.length;i+=1){var _ret=_loop();if(typeof _ret==="object")return _ret.v;}return shouldProcess;}function jsonPruner(source,root,prunePaths,requiredPaths,stack,nativeObjects){var nativeStringify=nativeObjects.nativeStringify;if(prunePaths.length===0&&requiredPaths.length===0){logMessage(source,"".concat(window.location.hostname,"\n").concat(nativeStringify(root,null,2),"\nStack trace:\n").concat(new Error().stack),true);if(root&&typeof root==="object"){logMessage(source,root,true,false);}return root;}try{if(isPruningNeeded(source,root,prunePaths,requiredPaths,stack,nativeObjects)===false){return root;}prunePaths.forEach(function(path){var ownerObjArr=getWildcardPropertyInChain(root,path,true);ownerObjArr.forEach(function(ownerObj){if(ownerObj!==undefined&&ownerObj.base){delete ownerObj.base[ownerObj.prop];hit(source);}});});}catch(e){logMessage(source,e);}return root;}function getPrunePath(props){var validPropsString=typeof props==="string"&&props!==undefined&&props!=="";return validPropsString?props.split(/ +/):[];}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function getNativeRegexpTest(){var descriptor=Object.getOwnPropertyDescriptor(RegExp.prototype,"test");var nativeRegexTest=descriptor===null||descriptor===void 0?void 0:descriptor.value;if(descriptor&&typeof descriptor.value==="function"){return nativeRegexTest;}throw new Error("RegExp.prototype.test is not a function");}function shouldAbortInlineOrInjectedScript(stackMatch,stackTrace){var INLINE_SCRIPT_STRING="inlineScript";var INJECTED_SCRIPT_STRING="injectedScript";var INJECTED_SCRIPT_MARKER="<anonymous>";var isInlineScript=function isInlineScript(match){return match.includes(INLINE_SCRIPT_STRING);};var isInjectedScript=function isInjectedScript(match){return match.includes(INJECTED_SCRIPT_STRING);};if(!(isInlineScript(stackMatch)||isInjectedScript(stackMatch))){return false;}var documentURL=window.location.href;var pos=documentURL.indexOf("#");if(pos!==-1){documentURL=documentURL.slice(0,pos);}var stackSteps=stackTrace.split("\n").slice(2).map(function(line){return line.trim();});var stackLines=stackSteps.map(function(line){var stack;var getStackTraceValues=/(.*?@)?(\S+)(:\d+)(:\d+)\)?$/.exec(line);if(getStackTraceValues){var _stackURL,_stackURL2;var stackURL=getStackTraceValues[2];var stackLine=getStackTraceValues[3];var stackCol=getStackTraceValues[4];if((_stackURL=stackURL)!==null&&_stackURL!==void 0&&_stackURL.startsWith("(")){stackURL=stackURL.slice(1);}if((_stackURL2=stackURL)!==null&&_stackURL2!==void 0&&_stackURL2.startsWith(INJECTED_SCRIPT_MARKER)){var _stackFunction;stackURL=INJECTED_SCRIPT_STRING;var stackFunction=getStackTraceValues[1]!==undefined?getStackTraceValues[1].slice(0,-1):line.slice(0,getStackTraceValues.index).trim();if((_stackFunction=stackFunction)!==null&&_stackFunction!==void 0&&_stackFunction.startsWith("at")){stackFunction=stackFunction.slice(2).trim();}stack="".concat(stackFunction," ").concat(stackURL).concat(stackLine).concat(stackCol).trim();}else if(stackURL===documentURL){stack="".concat(INLINE_SCRIPT_STRING).concat(stackLine).concat(stackCol).trim();}else {stack="".concat(stackURL).concat(stackLine).concat(stackCol).trim();}}else {stack=line;}return stack;});if(stackLines){for(var index=0;index<stackLines.length;index+=1){if(isInlineScript(stackMatch)&&stackLines[index].startsWith(INLINE_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}if(isInjectedScript(stackMatch)&&stackLines[index].startsWith(INJECTED_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}}}return false;}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}function backupRegExpValues(){try{var arrayOfRegexpValues=[];for(var index=1;index<10;index+=1){var value="$".concat(index);if(!RegExp[value]){break;}arrayOfRegexpValues.push(RegExp[value]);}return arrayOfRegexpValues;}catch(error){return [];}}function restoreRegExpValues(array){if(!array.length){return;}try{var stringPattern="";if(array.length===1){stringPattern="(".concat(array[0],")");}else {stringPattern=array.reduce(function(accumulator,currentValue,currentIndex){if(currentIndex===1){return "(".concat(accumulator,"),(").concat(currentValue,")");}return "".concat(accumulator,",(").concat(currentValue,")");});}var regExpGroup=new RegExp(stringPattern);array.toString().replace(regExpGroup,"");}catch(error){var message="Failed to restore RegExp values: ".concat(error);console.log(message);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedPruneInboundObject.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedReplaceFetchResponse(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedReplaceFetchResponse(source){var pattern=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";var replacement=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"";var propsToMatch=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var verbose=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;if(typeof fetch==="undefined"||typeof Proxy==="undefined"||typeof Response==="undefined"){return;}if(pattern===""&&replacement!==""){logMessage(source,"Pattern argument should not be empty string");return;}var shouldLog=pattern===""&&replacement==="";var shouldLogContent=verbose==="true";var nativeRequestClone=Request.prototype.clone;var nativeFetch=fetch;var shouldReplace=false;var fetchData;var handlerWrapper=function handlerWrapper(target,thisArg,args){fetchData=getFetchData(args,nativeRequestClone);if(shouldLog){logMessage(source,"fetch( ".concat(objectToString(fetchData)," )"),true);hit(source);return Reflect.apply(target,thisArg,args);}shouldReplace=matchRequestProps(source,propsToMatch,fetchData);if(!shouldReplace){return Reflect.apply(target,thisArg,args);}return nativeFetch.apply(null,args).then(function(response){return response.text().then(function(bodyText){var patternRegexp=pattern==="*"?/(\n|.)*/:toRegExp(pattern);if(shouldLogContent){logMessage(source,"Original text content: ".concat(bodyText));}var modifiedTextContent=bodyText.replace(patternRegexp,replacement);if(shouldLogContent){logMessage(source,"Modified text content: ".concat(modifiedTextContent));}var forgedResponse=forgeResponse(response,modifiedTextContent);hit(source);return forgedResponse;}).catch(function(){var fetchDataStr=objectToString(fetchData);var message="Response body can't be converted to text: ".concat(fetchDataStr);logMessage(source,message);return Reflect.apply(target,thisArg,args);});}).catch(function(){return Reflect.apply(target,thisArg,args);});};var fetchHandler={apply:handlerWrapper};fetch=new Proxy(fetch,fetchHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function getFetchData(args,nativeRequestClone){var fetchPropsObj={};var resource=args[0];var fetchUrl;var fetchInit;if(resource instanceof Request){var realData=nativeRequestClone.call(resource);var requestData=getRequestData(realData);fetchUrl=requestData.url;fetchInit=requestData;}else {fetchUrl=resource;fetchInit=args[1];}fetchPropsObj.url=fetchUrl;if(fetchInit instanceof Object){var props=Object.keys(fetchInit);props.forEach(function(prop){fetchPropsObj[prop]=fetchInit[prop];});}return fetchPropsObj;}function objectToString(obj){if(!obj||typeof obj!=="object"){return String(obj);}if(isEmptyObject(obj)){return "{}";}return Object.entries(obj).map(function(pair){var key=pair[0];var value=pair[1];var recordValueStr=value;if(value instanceof Object){recordValueStr="{ ".concat(objectToString(value)," }");}return "".concat(key,':"').concat(recordValueStr,'"');}).join(" ");}function matchRequestProps(source,propsToMatch,requestData){if(propsToMatch===""||propsToMatch==="*"){return true;}var isMatched;var parsedData=parseMatchProps(propsToMatch);if(!isValidParsedData(parsedData)){logMessage(source,"Invalid parameter: ".concat(propsToMatch));isMatched=false;}else {var matchData=getMatchPropsData(parsedData);var matchKeys=Object.keys(matchData);isMatched=matchKeys.every(function(matchKey){var matchValue=matchData[matchKey];var dataValue=requestData[matchKey];return Object.prototype.hasOwnProperty.call(requestData,matchKey)&&typeof dataValue==="string"&&(matchValue===null||matchValue===void 0?void 0:matchValue.test(dataValue));});}return isMatched;}function forgeResponse(response,textContent){var bodyUsed=response.bodyUsed,headers=response.headers,ok=response.ok,redirected=response.redirected,status=response.status,statusText=response.statusText,type=response.type,url=response.url;var forgedResponse=new Response(textContent,{status:status,statusText:statusText,headers:headers});Object.defineProperties(forgedResponse,{url:{value:url},type:{value:type},ok:{value:ok},bodyUsed:{value:bodyUsed},redirected:{value:redirected}});return forgedResponse;}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}function getRequestData(request){var requestInitOptions=getRequestProps();var entries=requestInitOptions.map(function(key){var value=request[key];return [key,value];});return Object.fromEntries(entries);}function getRequestProps(){return ["url","method","headers","body","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","mode"];}function parseMatchProps(propsToMatchStr){var PROPS_DIVIDER=" ";var PAIRS_MARKER=":";var isRequestProp=function isRequestProp(prop){return getRequestProps().includes(prop);};var propsObj={};var props=propsToMatchStr.split(PROPS_DIVIDER);props.forEach(function(prop){var dividerInd=prop.indexOf(PAIRS_MARKER);var key=prop.slice(0,dividerInd);if(isRequestProp(key)){var value=prop.slice(dividerInd+1);propsObj[key]=value;}else {propsObj.url=prop;}});return propsObj;}function isValidParsedData(data){return Object.values(data).every(function(value){return isValidStrPattern(value);});}function getMatchPropsData(data){var matchData={};var dataKeys=Object.keys(data);dataKeys.forEach(function(key){matchData[key]=toRegExp(data[key]);});return matchData;}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedReplaceFetchResponse.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedReplaceNodeText(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedReplaceNodeText(source,nodeName,textMatch,pattern,replacement){var _parseNodeTextParams=parseNodeTextParams(nodeName,textMatch,pattern),selector=_parseNodeTextParams.selector,nodeNameMatch=_parseNodeTextParams.nodeNameMatch,textContentMatch=_parseNodeTextParams.textContentMatch,patternMatch=_parseNodeTextParams.patternMatch;for(var _len=arguments.length,extraArgs=new Array(_len>5?_len-5:0),_key=5;_key<_len;_key++){extraArgs[_key-5]=arguments[_key];}var shouldLog=extraArgs.includes("verbose");var handleNodes=function handleNodes(nodes){return nodes.forEach(function(node){var shouldReplace=isTargetNode(node,nodeNameMatch,textContentMatch);if(shouldReplace){if(shouldLog){var originalText=node.textContent;if(originalText){logMessage(source,"Original text content: ".concat(originalText));}}replaceNodeText(source,node,patternMatch,replacement);if(shouldLog){var modifiedText=node.textContent;if(modifiedText){logMessage(source,"Modified text content: ".concat(modifiedText));}}}});};if(document.documentElement){handleExistingNodes(selector,handleNodes);}observeDocumentWithTimeout(function(mutations){return handleMutations(mutations,handleNodes);});}function observeDocumentWithTimeout(callback){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{subtree:true,childList:true};var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1e4;var documentObserver=new MutationObserver(function(mutations,observer){observer.disconnect();callback(mutations,observer);observer.observe(document.documentElement,options);});documentObserver.observe(document.documentElement,options);if(typeof timeout==="number"){setTimeout(function(){return documentObserver.disconnect();},timeout);}}function handleExistingNodes(selector,handler){var nodeList=document.querySelectorAll(selector);var nodes=nodeListToArray(nodeList);handler(nodes);}function handleMutations(mutations,handler){var addedNodes=getAddedNodes(mutations);handler(addedNodes);}function replaceNodeText(source,node,pattern,replacement){var textContent=node.textContent;if(textContent){node.textContent=textContent.replace(pattern,replacement);hit(source);}}function isTargetNode(node,nodeNameMatch,textContentMatch){var nodeName=node.nodeName,textContent=node.textContent;var nodeNameLowerCase=nodeName.toLowerCase();return textContent!==null&&textContent!==""&&(nodeNameMatch instanceof RegExp?nodeNameMatch.test(nodeNameLowerCase):nodeNameMatch===nodeNameLowerCase)&&(textContentMatch instanceof RegExp?textContentMatch.test(textContent):textContent.includes(textContentMatch));}function parseNodeTextParams(nodeName,textMatch){var pattern=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var REGEXP_START_MARKER="/";var isStringNameMatch=!(nodeName.startsWith(REGEXP_START_MARKER)&&nodeName.endsWith(REGEXP_START_MARKER));var selector=isStringNameMatch?nodeName:"*";var nodeNameMatch=isStringNameMatch?nodeName:toRegExp(nodeName);var textContentMatch=!textMatch.startsWith(REGEXP_START_MARKER)?textMatch:toRegExp(textMatch);var patternMatch;if(pattern){patternMatch=!pattern.startsWith(REGEXP_START_MARKER)?pattern:toRegExp(pattern);}return {selector:selector,nodeNameMatch:nodeNameMatch,textContentMatch:textContentMatch,patternMatch:patternMatch};}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function nodeListToArray(nodeList){var nodes=[];for(var i=0;i<nodeList.length;i+=1){nodes.push(nodeList[i]);}return nodes;}function getAddedNodes(mutations){var nodes=[];for(var i=0;i<mutations.length;i+=1){var addedNodes=mutations[i].addedNodes;for(var j=0;j<addedNodes.length;j+=1){nodes.push(addedNodes[j]);}}return nodes;}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedReplaceNodeText.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedReplaceOutboundText(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedReplaceOutboundText(source,methodPath){var textToReplace=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"";var replacement=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var decodeMethod=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"";var stack=arguments.length>5&&arguments[5]!==undefined?arguments[5]:"";var logContent=arguments.length>6&&arguments[6]!==undefined?arguments[6]:"";if(!methodPath){return;}var getPathParts=getPropertyInChain;var _getPathParts=getPathParts(window,methodPath),base=_getPathParts.base,chain=_getPathParts.chain,prop=_getPathParts.prop;if(typeof chain!=="undefined"){logMessage(source,"Could not reach the end of the prop chain: ".concat(methodPath));return;}var nativeMethod=base[prop];if(!nativeMethod||typeof nativeMethod!=="function"){logMessage(source,"Could not retrieve the method: ".concat(methodPath));return;}var isValidBase64=function isValidBase64(str){try{if(str===""){return false;}var decodedString=atob(str);var encodedString=btoa(decodedString);var stringWithoutPadding=str.replace(/=+$/,"");var encodedStringWithoutPadding=encodedString.replace(/=+$/,"");return encodedStringWithoutPadding===stringWithoutPadding;}catch(e){return false;}};var decodeAndReplaceContent=function decodeAndReplaceContent(content,pattern,textReplacement,decode,log){switch(decode){case"base64":try{if(!isValidBase64(content)){logMessage(source,"Text content is not a valid base64 encoded string: ".concat(content));return content;}var decodedContent=atob(content);if(log){logMessage(source,"Decoded text content: ".concat(decodedContent));}var modifiedContent=textToReplace?decodedContent.replace(pattern,textReplacement):decodedContent;if(log){var message=modifiedContent!==decodedContent?"Modified decoded text content: ".concat(modifiedContent):"Decoded text content was not modified";logMessage(source,message);}var encodedContent=btoa(modifiedContent);return encodedContent;}catch(e){return content;}default:return content.replace(pattern,textReplacement);}};var logOriginalContent=!textToReplace||!!logContent;var logModifiedContent=!!logContent;var logDecodedContent=!!decodeMethod&&!!logContent;var isMatchingSuspended=false;var objectWrapper=function objectWrapper(target,thisArg,argumentsList){if(isMatchingSuspended){return Reflect.apply(target,thisArg,argumentsList);}isMatchingSuspended=true;hit(source);var result=Reflect.apply(target,thisArg,argumentsList);if(stack&&!matchStackTrace(stack,new Error().stack||"")){return result;}if(typeof result==="string"){if(logOriginalContent){logMessage(source,"Original text content: ".concat(result));}var patternRegexp=toRegExp(textToReplace);var modifiedContent=textToReplace||logDecodedContent?decodeAndReplaceContent(result,patternRegexp,replacement,decodeMethod,logContent):result;if(logModifiedContent){var message=modifiedContent!==result?"Modified text content: ".concat(modifiedContent):"Text content was not modified";logMessage(source,message);}isMatchingSuspended=false;return modifiedContent;}isMatchingSuspended=false;logMessage(source,"Content is not a string");return result;};var objectHandler={apply:objectWrapper};base[prop]=new Proxy(nativeMethod,objectHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function matchStackTrace(stackMatch,stackTrace){if(!stackMatch||stackMatch===""){return true;}var regExpValues=backupRegExpValues();if(shouldAbortInlineOrInjectedScript(stackMatch,stackTrace)){if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return true;}var stackRegexp=toRegExp(stackMatch);var refinedStackTrace=stackTrace.split("\n").slice(2).map(function(line){return line.trim();}).join("\n");if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return getNativeRegexpTest().call(stackRegexp,refinedStackTrace);}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function shouldAbortInlineOrInjectedScript(stackMatch,stackTrace){var INLINE_SCRIPT_STRING="inlineScript";var INJECTED_SCRIPT_STRING="injectedScript";var INJECTED_SCRIPT_MARKER="<anonymous>";var isInlineScript=function isInlineScript(match){return match.includes(INLINE_SCRIPT_STRING);};var isInjectedScript=function isInjectedScript(match){return match.includes(INJECTED_SCRIPT_STRING);};if(!(isInlineScript(stackMatch)||isInjectedScript(stackMatch))){return false;}var documentURL=window.location.href;var pos=documentURL.indexOf("#");if(pos!==-1){documentURL=documentURL.slice(0,pos);}var stackSteps=stackTrace.split("\n").slice(2).map(function(line){return line.trim();});var stackLines=stackSteps.map(function(line){var stack;var getStackTraceValues=/(.*?@)?(\S+)(:\d+)(:\d+)\)?$/.exec(line);if(getStackTraceValues){var _stackURL,_stackURL2;var stackURL=getStackTraceValues[2];var stackLine=getStackTraceValues[3];var stackCol=getStackTraceValues[4];if((_stackURL=stackURL)!==null&&_stackURL!==void 0&&_stackURL.startsWith("(")){stackURL=stackURL.slice(1);}if((_stackURL2=stackURL)!==null&&_stackURL2!==void 0&&_stackURL2.startsWith(INJECTED_SCRIPT_MARKER)){var _stackFunction;stackURL=INJECTED_SCRIPT_STRING;var stackFunction=getStackTraceValues[1]!==undefined?getStackTraceValues[1].slice(0,-1):line.slice(0,getStackTraceValues.index).trim();if((_stackFunction=stackFunction)!==null&&_stackFunction!==void 0&&_stackFunction.startsWith("at")){stackFunction=stackFunction.slice(2).trim();}stack="".concat(stackFunction," ").concat(stackURL).concat(stackLine).concat(stackCol).trim();}else if(stackURL===documentURL){stack="".concat(INLINE_SCRIPT_STRING).concat(stackLine).concat(stackCol).trim();}else {stack="".concat(stackURL).concat(stackLine).concat(stackCol).trim();}}else {stack=line;}return stack;});if(stackLines){for(var index=0;index<stackLines.length;index+=1){if(isInlineScript(stackMatch)&&stackLines[index].startsWith(INLINE_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}if(isInjectedScript(stackMatch)&&stackLines[index].startsWith(INJECTED_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}}}return false;}function getNativeRegexpTest(){var descriptor=Object.getOwnPropertyDescriptor(RegExp.prototype,"test");var nativeRegexTest=descriptor===null||descriptor===void 0?void 0:descriptor.value;if(descriptor&&typeof descriptor.value==="function"){return nativeRegexTest;}throw new Error("RegExp.prototype.test is not a function");}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}function backupRegExpValues(){try{var arrayOfRegexpValues=[];for(var index=1;index<10;index+=1){var value="$".concat(index);if(!RegExp[value]){break;}arrayOfRegexpValues.push(RegExp[value]);}return arrayOfRegexpValues;}catch(error){return [];}}function restoreRegExpValues(array){if(!array.length){return;}try{var stringPattern="";if(array.length===1){stringPattern="(".concat(array[0],")");}else {stringPattern=array.reduce(function(accumulator,currentValue,currentIndex){if(currentIndex===1){return "(".concat(accumulator,"),(").concat(currentValue,")");}return "".concat(accumulator,",(").concat(currentValue,")");});}var regExpGroup=new RegExp(stringPattern);array.toString().replace(regExpGroup,"");}catch(error){var message="Failed to restore RegExp values: ".concat(error);console.log(message);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedReplaceOutboundText.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedReplaceXhrResponse(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedReplaceXhrResponse(source){var pattern=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";var replacement=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"";var propsToMatch=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var verbose=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;if(typeof Proxy==="undefined"){return;}if(pattern===""&&replacement!==""){var message="Pattern argument should not be empty string.";logMessage(source,message);return;}var shouldLog=pattern===""&&replacement==="";var shouldLogContent=verbose==="true";var nativeOpen=window.XMLHttpRequest.prototype.open;var nativeSend=window.XMLHttpRequest.prototype.send;var xhrData;var openWrapper=function openWrapper(target,thisArg,args){xhrData=getXhrData.apply(null,args);if(shouldLog){var _message="xhr( ".concat(objectToString(xhrData)," )");logMessage(source,_message,true);hit(source);return Reflect.apply(target,thisArg,args);}if(matchRequestProps(source,propsToMatch,xhrData)){thisArg.shouldBePrevented=true;thisArg.headersReceived=!!thisArg.headersReceived;}if(thisArg.shouldBePrevented&&!thisArg.headersReceived){thisArg.headersReceived=true;thisArg.collectedHeaders=[];var setRequestHeaderWrapper=function setRequestHeaderWrapper(target,thisArg,args){thisArg.collectedHeaders.push(args);return Reflect.apply(target,thisArg,args);};var setRequestHeaderHandler={apply:setRequestHeaderWrapper};thisArg.setRequestHeader=new Proxy(thisArg.setRequestHeader,setRequestHeaderHandler);}return Reflect.apply(target,thisArg,args);};var sendWrapper=function sendWrapper(target,thisArg,args){if(!thisArg.shouldBePrevented){return Reflect.apply(target,thisArg,args);}var forgedRequest=new XMLHttpRequest();forgedRequest.addEventListener("readystatechange",function(){if(forgedRequest.readyState!==4){return;}var readyState=forgedRequest.readyState,response=forgedRequest.response,responseText=forgedRequest.responseText,responseURL=forgedRequest.responseURL,responseXML=forgedRequest.responseXML,status=forgedRequest.status,statusText=forgedRequest.statusText;var content=responseText||response;if(typeof content!=="string"){return;}var patternRegexp=pattern==="*"?/(\n|.)*/:toRegExp(pattern);if(shouldLogContent){logMessage(source,"Original text content: ".concat(content));}var modifiedContent=content.replace(patternRegexp,replacement);if(shouldLogContent){logMessage(source,"Modified text content: ".concat(modifiedContent));}Object.defineProperties(thisArg,{readyState:{value:readyState,writable:false},responseURL:{value:responseURL,writable:false},responseXML:{value:responseXML,writable:false},status:{value:status,writable:false},statusText:{value:statusText,writable:false},response:{value:modifiedContent,writable:false},responseText:{value:modifiedContent,writable:false}});setTimeout(function(){var stateEvent=new Event("readystatechange");thisArg.dispatchEvent(stateEvent);var loadEvent=new Event("load");thisArg.dispatchEvent(loadEvent);var loadEndEvent=new Event("loadend");thisArg.dispatchEvent(loadEndEvent);},1);hit(source);});nativeOpen.apply(forgedRequest,[xhrData.method,xhrData.url]);thisArg.collectedHeaders.forEach(function(header){var name=header[0];var value=header[1];forgedRequest.setRequestHeader(name,value);});thisArg.collectedHeaders=[];try{nativeSend.call(forgedRequest,args);}catch(_unused){return Reflect.apply(target,thisArg,args);}return undefined;};var openHandler={apply:openWrapper};var sendHandler={apply:sendWrapper};XMLHttpRequest.prototype.open=new Proxy(XMLHttpRequest.prototype.open,openHandler);XMLHttpRequest.prototype.send=new Proxy(XMLHttpRequest.prototype.send,sendHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function objectToString(obj){if(!obj||typeof obj!=="object"){return String(obj);}if(isEmptyObject(obj)){return "{}";}return Object.entries(obj).map(function(pair){var key=pair[0];var value=pair[1];var recordValueStr=value;if(value instanceof Object){recordValueStr="{ ".concat(objectToString(value)," }");}return "".concat(key,':"').concat(recordValueStr,'"');}).join(" ");}function matchRequestProps(source,propsToMatch,requestData){if(propsToMatch===""||propsToMatch==="*"){return true;}var isMatched;var parsedData=parseMatchProps(propsToMatch);if(!isValidParsedData(parsedData)){logMessage(source,"Invalid parameter: ".concat(propsToMatch));isMatched=false;}else {var matchData=getMatchPropsData(parsedData);var matchKeys=Object.keys(matchData);isMatched=matchKeys.every(function(matchKey){var matchValue=matchData[matchKey];var dataValue=requestData[matchKey];return Object.prototype.hasOwnProperty.call(requestData,matchKey)&&typeof dataValue==="string"&&(matchValue===null||matchValue===void 0?void 0:matchValue.test(dataValue));});}return isMatched;}function getXhrData(method,url,async,user,password){return {method:method,url:url,async:async,user:user,password:password};}function getMatchPropsData(data){var matchData={};var dataKeys=Object.keys(data);dataKeys.forEach(function(key){matchData[key]=toRegExp(data[key]);});return matchData;}function getRequestProps(){return ["url","method","headers","body","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","mode"];}function isValidParsedData(data){return Object.values(data).every(function(value){return isValidStrPattern(value);});}function parseMatchProps(propsToMatchStr){var PROPS_DIVIDER=" ";var PAIRS_MARKER=":";var isRequestProp=function isRequestProp(prop){return getRequestProps().includes(prop);};var propsObj={};var props=propsToMatchStr.split(PROPS_DIVIDER);props.forEach(function(prop){var dividerInd=prop.indexOf(PAIRS_MARKER);var key=prop.slice(0,dividerInd);if(isRequestProp(key)){var value=prop.slice(dividerInd+1);propsObj[key]=value;}else {propsObj.url=prop;}});return propsObj;}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedReplaceXhrResponse.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedSetAttr(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedSetAttr(source,selector,attr){var value=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";if(!selector||!attr){return;}setAttributeBySelector(source,selector,attr,value);observeDOMChanges(function(){return setAttributeBySelector(source,selector,attr,value);},true);}function setAttributeBySelector(source,selector,attribute,value){var attributeSetter=arguments.length>4&&arguments[4]!==undefined?arguments[4]:defaultAttributeSetter;var elements;try{elements=document.querySelectorAll(selector);}catch(_unused){logMessage(source,'Failed to find elements matching selector "'.concat(selector,'"'));return;}if(!elements||elements.length===0){return;}try{elements.forEach(function(elem){return attributeSetter(elem,attribute,value);});hit(source);}catch(_unused2){logMessage(source,"Failed to set [".concat(attribute,'="').concat(value,'"] to each of selected elements.'));}}function observeDOMChanges(callback){var observeAttrs=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var attrsToObserve=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var THROTTLE_DELAY_MS=20;var observer=new MutationObserver(throttle(callbackWrapper,THROTTLE_DELAY_MS));var connect=function connect(){if(attrsToObserve.length>0){observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs,attributeFilter:attrsToObserve});}else {observer.observe(document.documentElement,{childList:true,subtree:true,attributes:observeAttrs});}};var disconnect=function disconnect(){observer.disconnect();};function callbackWrapper(){disconnect();callback();connect();}connect();}function defaultAttributeSetter(elem,attribute,value){return elem.setAttribute(attribute,value);}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function throttle(cb,delay){var wait=false;var savedArgs;var wrapper=function wrapper(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}if(wait){savedArgs=args;return;}cb(...args);wait=true;setTimeout(function(){wait=false;if(savedArgs){wrapper(...savedArgs);savedArgs=null;}},delay);};return wrapper;}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedSetAttr.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedSetConstant(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedSetConstant(source,property,value,stack){if(!property||!matchStackTrace(stack,new Error().stack)){return;}var constantValue;try{constantValue=inferValue(value);}catch(e){logMessage(source,e);return;}var canceled=false;var mustCancel=function mustCancel(value){if(canceled){return canceled;}canceled=value!==undefined&&constantValue!==undefined&&typeof value!==typeof constantValue&&value!==null;return canceled;};var trapProp=function trapProp(base,prop,configurable,handler){if(!handler.init(base[prop])){return false;}var origDescriptor=Object.getOwnPropertyDescriptor(base,prop);var prevSetter;if(origDescriptor instanceof Object){if(!origDescriptor.configurable){var message="Property '".concat(prop,"' is not configurable");logMessage(source,message);return false;}base[prop]=constantValue;if(origDescriptor.set instanceof Function){prevSetter=origDescriptor.set;}}Object.defineProperty(base,prop,{configurable:configurable,get(){return handler.get();},set(a){if(prevSetter!==undefined){prevSetter(a);}handler.set(a);}});return true;};var setChainPropAccess=function setChainPropAccess(owner,property){var chainInfo=getPropertyInChain(owner,property);var base=chainInfo.base;var prop=chainInfo.prop,chain=chainInfo.chain;var inChainPropHandler={factValue:undefined,init(a){this.factValue=a;return true;},get(){return this.factValue;},set(a){if(this.factValue===a){return;}this.factValue=a;if(a instanceof Object){setChainPropAccess(a,chain);}}};var endPropHandler={init(a){if(mustCancel(a)){return false;}return true;},get(){return constantValue;},set(a){if(!mustCancel(a)){return;}constantValue=a;}};if(!chain){var isTrapped=trapProp(base,prop,false,endPropHandler);if(isTrapped){hit(source);}return;}if(base!==undefined&&base[prop]===null){trapProp(base,prop,true,inChainPropHandler);return;}if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){trapProp(base,prop,true,inChainPropHandler);}var propValue=owner[prop];if(propValue instanceof Object||typeof propValue==="object"&&propValue!==null){setChainPropAccess(propValue,chain);}trapProp(base,prop,true,inChainPropHandler);};setChainPropAccess(window,property);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function inferValue(value){if(value==="undefined"){return undefined;}if(value==="false"){return false;}if(value==="true"){return true;}if(value==="null"){return null;}if(value==="NaN"){return NaN;}if(value.startsWith("/")&&value.endsWith("/")){return toRegExp(value);}var MAX_ALLOWED_NUM=32767;var numVal=Number(value);if(!nativeIsNaN(numVal)){if(Math.abs(numVal)>MAX_ALLOWED_NUM){throw new Error("number values bigger than 32767 are not allowed");}return numVal;}var errorMessage="'".concat(value,"' value type can't be inferred");try{var parsableVal=JSON.parse(value);if(parsableVal instanceof Object||typeof parsableVal==="string"){return parsableVal;}}catch(e){errorMessage+=": ".concat(e);}throw new TypeError(errorMessage);}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function matchStackTrace(stackMatch,stackTrace){if(!stackMatch||stackMatch===""){return true;}var regExpValues=backupRegExpValues();if(shouldAbortInlineOrInjectedScript(stackMatch,stackTrace)){if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return true;}var stackRegexp=toRegExp(stackMatch);var refinedStackTrace=stackTrace.split("\n").slice(2).map(function(line){return line.trim();}).join("\n");if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return getNativeRegexpTest().call(stackRegexp,refinedStackTrace);}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}function getNativeRegexpTest(){var descriptor=Object.getOwnPropertyDescriptor(RegExp.prototype,"test");var nativeRegexTest=descriptor===null||descriptor===void 0?void 0:descriptor.value;if(descriptor&&typeof descriptor.value==="function"){return nativeRegexTest;}throw new Error("RegExp.prototype.test is not a function");}function shouldAbortInlineOrInjectedScript(stackMatch,stackTrace){var INLINE_SCRIPT_STRING="inlineScript";var INJECTED_SCRIPT_STRING="injectedScript";var INJECTED_SCRIPT_MARKER="<anonymous>";var isInlineScript=function isInlineScript(match){return match.includes(INLINE_SCRIPT_STRING);};var isInjectedScript=function isInjectedScript(match){return match.includes(INJECTED_SCRIPT_STRING);};if(!(isInlineScript(stackMatch)||isInjectedScript(stackMatch))){return false;}var documentURL=window.location.href;var pos=documentURL.indexOf("#");if(pos!==-1){documentURL=documentURL.slice(0,pos);}var stackSteps=stackTrace.split("\n").slice(2).map(function(line){return line.trim();});var stackLines=stackSteps.map(function(line){var stack;var getStackTraceValues=/(.*?@)?(\S+)(:\d+)(:\d+)\)?$/.exec(line);if(getStackTraceValues){var _stackURL,_stackURL2;var stackURL=getStackTraceValues[2];var stackLine=getStackTraceValues[3];var stackCol=getStackTraceValues[4];if((_stackURL=stackURL)!==null&&_stackURL!==void 0&&_stackURL.startsWith("(")){stackURL=stackURL.slice(1);}if((_stackURL2=stackURL)!==null&&_stackURL2!==void 0&&_stackURL2.startsWith(INJECTED_SCRIPT_MARKER)){var _stackFunction;stackURL=INJECTED_SCRIPT_STRING;var stackFunction=getStackTraceValues[1]!==undefined?getStackTraceValues[1].slice(0,-1):line.slice(0,getStackTraceValues.index).trim();if((_stackFunction=stackFunction)!==null&&_stackFunction!==void 0&&_stackFunction.startsWith("at")){stackFunction=stackFunction.slice(2).trim();}stack="".concat(stackFunction," ").concat(stackURL).concat(stackLine).concat(stackCol).trim();}else if(stackURL===documentURL){stack="".concat(INLINE_SCRIPT_STRING).concat(stackLine).concat(stackCol).trim();}else {stack="".concat(stackURL).concat(stackLine).concat(stackCol).trim();}}else {stack=line;}return stack;});if(stackLines){for(var index=0;index<stackLines.length;index+=1){if(isInlineScript(stackMatch)&&stackLines[index].startsWith(INLINE_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}if(isInjectedScript(stackMatch)&&stackLines[index].startsWith(INJECTED_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}}}return false;}function backupRegExpValues(){try{var arrayOfRegexpValues=[];for(var index=1;index<10;index+=1){var value="$".concat(index);if(!RegExp[value]){break;}arrayOfRegexpValues.push(RegExp[value]);}return arrayOfRegexpValues;}catch(error){return [];}}function restoreRegExpValues(array){if(!array.length){return;}try{var stringPattern="";if(array.length===1){stringPattern="(".concat(array[0],")");}else {stringPattern=array.reduce(function(accumulator,currentValue,currentIndex){if(currentIndex===1){return "(".concat(accumulator,"),(").concat(currentValue,")");}return "".concat(accumulator,",(").concat(currentValue,")");});}var regExpGroup=new RegExp(stringPattern);array.toString().replace(regExpGroup,"");}catch(error){var message="Failed to restore RegExp values: ".concat(error);console.log(message);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedSetConstant.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedSetCookie(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedSetCookie(source,name,value){var offsetExpiresSec=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var path=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"/";var domain=arguments.length>5&&arguments[5]!==undefined?arguments[5]:"";if(typeof name==="undefined"){logMessage(source,"Cookie name should be specified");return;}if(typeof value==="undefined"){logMessage(source,"Cookie value should be specified");return;}var parsedValue=parseKeywordValue(value);if(!isValidCookiePath(path)){logMessage(source,"Invalid cookie path: '".concat(path,"'"));return;}if(!document.location.origin.includes(domain)){logMessage(source,"Cookie domain not matched by origin: '".concat(domain,"'"));return;}var cookieToSet=serializeCookie(name,parsedValue,path,domain,false);if(!cookieToSet){logMessage(source,"Invalid cookie name or value");return;}if(offsetExpiresSec){var parsedOffsetMs=getTrustedCookieOffsetMs(offsetExpiresSec);if(!parsedOffsetMs){logMessage(source,"Invalid offsetExpiresSec value: ".concat(offsetExpiresSec));return;}var expires=Date.now()+parsedOffsetMs;cookieToSet+="; expires=".concat(new Date(expires).toUTCString());}document.cookie=cookieToSet;hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function serializeCookie(name,rawValue,rawPath){var domainValue=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var shouldEncodeValue=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;var HOST_PREFIX="__Host-";var SECURE_PREFIX="__Secure-";var COOKIE_BREAKER=";";if(!shouldEncodeValue&&"".concat(rawValue).includes(COOKIE_BREAKER)||name.includes(COOKIE_BREAKER)){return null;}var value=shouldEncodeValue?encodeURIComponent(rawValue):rawValue;var resultCookie="".concat(name,"=").concat(value);if(name.startsWith(HOST_PREFIX)){resultCookie+="; path=/; secure";if(domainValue){console.debug('Domain value: "'.concat(domainValue,'" has been ignored, because is not allowed for __Host- prefixed cookies'));}return resultCookie;}var path=getCookiePath(rawPath);if(path){resultCookie+="; ".concat(path);}if(name.startsWith(SECURE_PREFIX)){resultCookie+="; secure";}if(domainValue){resultCookie+="; domain=".concat(domainValue);}return resultCookie;}function isValidCookiePath(rawPath){return rawPath==="/"||rawPath==="none";}function getTrustedCookieOffsetMs(offsetExpiresSec){var ONE_YEAR_EXPIRATION_KEYWORD="1year";var ONE_DAY_EXPIRATION_KEYWORD="1day";var MS_IN_SEC=1e3;var SECONDS_IN_YEAR=365*24*60*60;var SECONDS_IN_DAY=24*60*60;var parsedSec;if(offsetExpiresSec===ONE_YEAR_EXPIRATION_KEYWORD){parsedSec=SECONDS_IN_YEAR;}else if(offsetExpiresSec===ONE_DAY_EXPIRATION_KEYWORD){parsedSec=SECONDS_IN_DAY;}else {parsedSec=Number.parseInt(offsetExpiresSec,10);if(Number.isNaN(parsedSec)){return null;}}return parsedSec*MS_IN_SEC;}function parseKeywordValue(rawValue){var NOW_VALUE_KEYWORD="$now$";var CURRENT_DATE_KEYWORD="$currentDate$";var CURRENT_ISO_DATE_KEYWORD="$currentISODate$";var parsedValue=rawValue;if(rawValue===NOW_VALUE_KEYWORD){parsedValue=Date.now().toString();}else if(rawValue===CURRENT_DATE_KEYWORD){parsedValue=Date();}else if(rawValue===CURRENT_ISO_DATE_KEYWORD){parsedValue=new Date().toISOString();}return parsedValue;}function getCookiePath(rawPath){if(rawPath==="/"){return "path=/";}return "";}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedSetCookie.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedSetCookieReload(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedSetCookieReload(source,name,value){var offsetExpiresSec=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var path=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"/";var domain=arguments.length>5&&arguments[5]!==undefined?arguments[5]:"";if(typeof name==="undefined"){logMessage(source,"Cookie name should be specified");return;}if(typeof value==="undefined"){logMessage(source,"Cookie value should be specified");return;}if(isCookieSetWithValue(document.cookie,name,value)){return;}var parsedValue=parseKeywordValue(value);if(!isValidCookiePath(path)){logMessage(source,"Invalid cookie path: '".concat(path,"'"));return;}if(!document.location.origin.includes(domain)){logMessage(source,"Cookie domain not matched by origin: '".concat(domain,"'"));return;}var cookieToSet=serializeCookie(name,parsedValue,path,domain,false);if(!cookieToSet){logMessage(source,"Invalid cookie name or value");return;}if(offsetExpiresSec){var parsedOffsetMs=getTrustedCookieOffsetMs(offsetExpiresSec);if(!parsedOffsetMs){logMessage(source,"Invalid offsetExpiresSec value: ".concat(offsetExpiresSec));return;}var expires=Date.now()+parsedOffsetMs;cookieToSet+="; expires=".concat(new Date(expires).toUTCString());}document.cookie=cookieToSet;hit(source);var cookieValueToCheck=parseCookieString(document.cookie)[name];if(isCookieSetWithValue(document.cookie,name,cookieValueToCheck)){window.location.reload();}}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function isCookieSetWithValue(cookieString,name,value){return cookieString.split(";").some(function(cookieStr){var pos=cookieStr.indexOf("=");if(pos===-1){return false;}var cookieName=cookieStr.slice(0,pos).trim();var cookieValue=cookieStr.slice(pos+1).trim();return name===cookieName&&value===cookieValue;});}function serializeCookie(name,rawValue,rawPath){var domainValue=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var shouldEncodeValue=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;var HOST_PREFIX="__Host-";var SECURE_PREFIX="__Secure-";var COOKIE_BREAKER=";";if(!shouldEncodeValue&&"".concat(rawValue).includes(COOKIE_BREAKER)||name.includes(COOKIE_BREAKER)){return null;}var value=shouldEncodeValue?encodeURIComponent(rawValue):rawValue;var resultCookie="".concat(name,"=").concat(value);if(name.startsWith(HOST_PREFIX)){resultCookie+="; path=/; secure";if(domainValue){console.debug('Domain value: "'.concat(domainValue,'" has been ignored, because is not allowed for __Host- prefixed cookies'));}return resultCookie;}var path=getCookiePath(rawPath);if(path){resultCookie+="; ".concat(path);}if(name.startsWith(SECURE_PREFIX)){resultCookie+="; secure";}if(domainValue){resultCookie+="; domain=".concat(domainValue);}return resultCookie;}function isValidCookiePath(rawPath){return rawPath==="/"||rawPath==="none";}function getTrustedCookieOffsetMs(offsetExpiresSec){var ONE_YEAR_EXPIRATION_KEYWORD="1year";var ONE_DAY_EXPIRATION_KEYWORD="1day";var MS_IN_SEC=1e3;var SECONDS_IN_YEAR=365*24*60*60;var SECONDS_IN_DAY=24*60*60;var parsedSec;if(offsetExpiresSec===ONE_YEAR_EXPIRATION_KEYWORD){parsedSec=SECONDS_IN_YEAR;}else if(offsetExpiresSec===ONE_DAY_EXPIRATION_KEYWORD){parsedSec=SECONDS_IN_DAY;}else {parsedSec=Number.parseInt(offsetExpiresSec,10);if(Number.isNaN(parsedSec)){return null;}}return parsedSec*MS_IN_SEC;}function parseKeywordValue(rawValue){var NOW_VALUE_KEYWORD="$now$";var CURRENT_DATE_KEYWORD="$currentDate$";var CURRENT_ISO_DATE_KEYWORD="$currentISODate$";var parsedValue=rawValue;if(rawValue===NOW_VALUE_KEYWORD){parsedValue=Date.now().toString();}else if(rawValue===CURRENT_DATE_KEYWORD){parsedValue=Date();}else if(rawValue===CURRENT_ISO_DATE_KEYWORD){parsedValue=new Date().toISOString();}return parsedValue;}function parseCookieString(cookieString){var COOKIE_DELIMITER="=";var COOKIE_PAIRS_DELIMITER=";";var cookieChunks=cookieString.split(COOKIE_PAIRS_DELIMITER);var cookieData={};cookieChunks.forEach(function(singleCookie){var cookieKey;var cookieValue="";var delimiterIndex=singleCookie.indexOf(COOKIE_DELIMITER);if(delimiterIndex===-1){cookieKey=singleCookie.trim();}else {cookieKey=singleCookie.slice(0,delimiterIndex).trim();cookieValue=singleCookie.slice(delimiterIndex+1);}cookieData[cookieKey]=cookieValue||null;});return cookieData;}function getCookiePath(rawPath){if(rawPath==="/"){return "path=/";}return "";}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedSetCookieReload.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedSetLocalStorageItem(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedSetLocalStorageItem(source,key,value){if(typeof key==="undefined"){logMessage(source,"Item key should be specified");return;}if(typeof value==="undefined"){logMessage(source,"Item value should be specified");return;}var parsedValue=parseKeywordValue(value);var _window=window,localStorage=_window.localStorage;setStorageItem(source,localStorage,key,parsedValue);hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function setStorageItem(source,storage,key,value){try{storage.setItem(key,value);}catch(e){var message="Unable to set sessionStorage item due to: ".concat(e.message);logMessage(source,message);}}function parseKeywordValue(rawValue){var NOW_VALUE_KEYWORD="$now$";var CURRENT_DATE_KEYWORD="$currentDate$";var CURRENT_ISO_DATE_KEYWORD="$currentISODate$";var parsedValue=rawValue;if(rawValue===NOW_VALUE_KEYWORD){parsedValue=Date.now().toString();}else if(rawValue===CURRENT_DATE_KEYWORD){parsedValue=Date();}else if(rawValue===CURRENT_ISO_DATE_KEYWORD){parsedValue=new Date().toISOString();}return parsedValue;}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedSetLocalStorageItem.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedSetSessionStorageItem(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedSetSessionStorageItem(source,key,value){if(typeof key==="undefined"){logMessage(source,"Item key should be specified");return;}if(typeof value==="undefined"){logMessage(source,"Item value should be specified");return;}var parsedValue=parseKeywordValue(value);var _window=window,sessionStorage=_window.sessionStorage;setStorageItem(source,sessionStorage,key,parsedValue);hit(source);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function setStorageItem(source,storage,key,value){try{storage.setItem(key,value);}catch(e){var message="Unable to set sessionStorage item due to: ".concat(e.message);logMessage(source,message);}}function parseKeywordValue(rawValue){var NOW_VALUE_KEYWORD="$now$";var CURRENT_DATE_KEYWORD="$currentDate$";var CURRENT_ISO_DATE_KEYWORD="$currentISODate$";var parsedValue=rawValue;if(rawValue===NOW_VALUE_KEYWORD){parsedValue=Date.now().toString();}else if(rawValue===CURRENT_DATE_KEYWORD){parsedValue=Date();}else if(rawValue===CURRENT_ISO_DATE_KEYWORD){parsedValue=new Date().toISOString();}return parsedValue;}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedSetSessionStorageItem.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function trustedSuppressNativeMethod(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function trustedSuppressNativeMethod(source,methodPath,signatureStr){var how=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"abort";var stack=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"";if(!methodPath||!signatureStr){return;}var IGNORE_ARG_SYMBOL=" ";var suppress=how==="abort"?getAbortFunc():function(){};var signatureMatcher;try{signatureMatcher=signatureStr.split("|").map(function(value){return value===IGNORE_ARG_SYMBOL?value:inferValue(value);});}catch(e){logMessage(source,"Could not parse the signature matcher: ".concat(getErrorMessage(e)));return;}var getPathParts=getPropertyInChain;var _getPathParts=getPathParts(window,methodPath),base=_getPathParts.base,chain=_getPathParts.chain,prop=_getPathParts.prop;if(typeof chain!=="undefined"){logMessage(source,"Could not reach the end of the prop chain: ".concat(methodPath));return;}var nativeMethod=base[prop];if(!nativeMethod||typeof nativeMethod!=="function"){logMessage(source,"Could not retrieve the method: ".concat(methodPath));return;}function matchMethodCall(nativeArguments,matchArguments){return matchArguments.every(function(matcher,i){if(matcher===IGNORE_ARG_SYMBOL){return true;}var argument=nativeArguments[i];return isValueMatched(argument,matcher);});}var isMatchingSuspended=false;function apply(target,thisArg,argumentsList){if(isMatchingSuspended){return Reflect.apply(target,thisArg,argumentsList);}isMatchingSuspended=true;if(stack&&!matchStackTrace(stack,new Error().stack||"")){return Reflect.apply(target,thisArg,argumentsList);}var isMatching=matchMethodCall(argumentsList,signatureMatcher);isMatchingSuspended=false;if(isMatching){hit(source);return suppress();}return Reflect.apply(target,thisArg,argumentsList);}base[prop]=new Proxy(nativeMethod,{apply:apply});}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function getPropertyInChain(base,chain){var pos=chain.indexOf(".");if(pos===-1){return {base:base,prop:chain};}var prop=chain.slice(0,pos);if(base===null){return {base:base,prop:prop,chain:chain};}var nextBase=base[prop];chain=chain.slice(pos+1);if((base instanceof Object||typeof base==="object")&&isEmptyObject(base)){return {base:base,prop:prop,chain:chain};}if(nextBase===null){return {base:base,prop:prop,chain:chain};}if(nextBase!==undefined){return getPropertyInChain(nextBase,chain);}Object.defineProperty(base,prop,{configurable:true});return {base:base,prop:prop,chain:chain};}function inferValue(value){if(value==="undefined"){return undefined;}if(value==="false"){return false;}if(value==="true"){return true;}if(value==="null"){return null;}if(value==="NaN"){return NaN;}if(value.startsWith("/")&&value.endsWith("/")){return toRegExp(value);}var MAX_ALLOWED_NUM=32767;var numVal=Number(value);if(!nativeIsNaN(numVal)){if(Math.abs(numVal)>MAX_ALLOWED_NUM){throw new Error("number values bigger than 32767 are not allowed");}return numVal;}var errorMessage="'".concat(value,"' value type can't be inferred");try{var parsableVal=JSON.parse(value);if(parsableVal instanceof Object||typeof parsableVal==="string"){return parsableVal;}}catch(e){errorMessage+=": ".concat(e);}throw new TypeError(errorMessage);}function isValueMatched(value,matcher){if(typeof value==="function"){return false;}if(nativeIsNaN(value)){return nativeIsNaN(matcher);}if(value===null||typeof value==="undefined"||typeof value==="number"||typeof value==="boolean"){return value===matcher;}if(typeof value==="string"){if(typeof matcher==="string"||matcher instanceof RegExp){return isStringMatched(value,matcher);}return false;}if(Array.isArray(value)&&Array.isArray(matcher)){return isArrayMatched(value,matcher);}if(isArbitraryObject(value)&&isArbitraryObject(matcher)){return isObjectMatched(value,matcher);}return false;}function getAbortFunc(){var rid=randomId();var isErrorHandlerSet=false;return function abort(){if(!isErrorHandlerSet){window.onerror=createOnErrorHandler(rid);isErrorHandlerSet=true;}throw new ReferenceError(rid);};}function matchStackTrace(stackMatch,stackTrace){if(!stackMatch||stackMatch===""){return true;}var regExpValues=backupRegExpValues();if(shouldAbortInlineOrInjectedScript(stackMatch,stackTrace)){if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return true;}var stackRegexp=toRegExp(stackMatch);var refinedStackTrace=stackTrace.split("\n").slice(2).map(function(line){return line.trim();}).join("\n");if(regExpValues.length&&regExpValues[0]!==RegExp.$1){restoreRegExpValues(regExpValues);}return getNativeRegexpTest().call(stackRegexp,refinedStackTrace);}function getErrorMessage(error){var isErrorWithMessage=function isErrorWithMessage(e){return typeof e==="object"&&e!==null&&"message"in e&&typeof e.message==="string";};if(isErrorWithMessage(error)){return error.message;}try{return new Error(JSON.stringify(error)).message;}catch(_unused){return new Error(String(error)).message;}}function shouldAbortInlineOrInjectedScript(stackMatch,stackTrace){var INLINE_SCRIPT_STRING="inlineScript";var INJECTED_SCRIPT_STRING="injectedScript";var INJECTED_SCRIPT_MARKER="<anonymous>";var isInlineScript=function isInlineScript(match){return match.includes(INLINE_SCRIPT_STRING);};var isInjectedScript=function isInjectedScript(match){return match.includes(INJECTED_SCRIPT_STRING);};if(!(isInlineScript(stackMatch)||isInjectedScript(stackMatch))){return false;}var documentURL=window.location.href;var pos=documentURL.indexOf("#");if(pos!==-1){documentURL=documentURL.slice(0,pos);}var stackSteps=stackTrace.split("\n").slice(2).map(function(line){return line.trim();});var stackLines=stackSteps.map(function(line){var stack;var getStackTraceValues=/(.*?@)?(\S+)(:\d+)(:\d+)\)?$/.exec(line);if(getStackTraceValues){var _stackURL,_stackURL2;var stackURL=getStackTraceValues[2];var stackLine=getStackTraceValues[3];var stackCol=getStackTraceValues[4];if((_stackURL=stackURL)!==null&&_stackURL!==void 0&&_stackURL.startsWith("(")){stackURL=stackURL.slice(1);}if((_stackURL2=stackURL)!==null&&_stackURL2!==void 0&&_stackURL2.startsWith(INJECTED_SCRIPT_MARKER)){var _stackFunction;stackURL=INJECTED_SCRIPT_STRING;var stackFunction=getStackTraceValues[1]!==undefined?getStackTraceValues[1].slice(0,-1):line.slice(0,getStackTraceValues.index).trim();if((_stackFunction=stackFunction)!==null&&_stackFunction!==void 0&&_stackFunction.startsWith("at")){stackFunction=stackFunction.slice(2).trim();}stack="".concat(stackFunction," ").concat(stackURL).concat(stackLine).concat(stackCol).trim();}else if(stackURL===documentURL){stack="".concat(INLINE_SCRIPT_STRING).concat(stackLine).concat(stackCol).trim();}else {stack="".concat(stackURL).concat(stackLine).concat(stackCol).trim();}}else {stack=line;}return stack;});if(stackLines){for(var index=0;index<stackLines.length;index+=1){if(isInlineScript(stackMatch)&&stackLines[index].startsWith(INLINE_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}if(isInjectedScript(stackMatch)&&stackLines[index].startsWith(INJECTED_SCRIPT_STRING)&&stackLines[index].match(toRegExp(stackMatch))){return true;}}}return false;}function getNativeRegexpTest(){var descriptor=Object.getOwnPropertyDescriptor(RegExp.prototype,"test");var nativeRegexTest=descriptor===null||descriptor===void 0?void 0:descriptor.value;if(descriptor&&typeof descriptor.value==="function"){return nativeRegexTest;}throw new Error("RegExp.prototype.test is not a function");}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function nativeIsNaN(num){var native=Number.isNaN||window.isNaN;return native(num);}function randomId(){return Math.random().toString(36).slice(2,9);}function createOnErrorHandler(rid){var nativeOnError=window.onerror;return function onError(error){if(typeof error==="string"&&error.includes(rid)){return true;}if(nativeOnError instanceof Function){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return nativeOnError.apply(window,[error,...args]);}return false;};}function isEmptyObject(obj){return Object.keys(obj).length===0&&!obj.prototype;}function isArbitraryObject(value){return value!==null&&typeof value==="object"&&!Array.isArray(value)&&!(value instanceof RegExp);}function isStringMatched(str,matcher){if(typeof matcher==="string"){if(matcher===""){return str===matcher;}return str.includes(matcher);}if(matcher instanceof RegExp){return matcher.test(str);}return false;}function isArrayMatched(array,matcher){if(array.length===0){return matcher.length===0;}if(matcher.length===0){return false;}var _loop=function _loop(){var matcherValue=matcher[i];var isMatching=array.some(function(arrItem){return isValueMatched(arrItem,matcherValue);});if(!isMatching){return {v:false};}return "continue";};for(var i=0;i<matcher.length;i+=1){var _ret=_loop();if(_ret==="continue")continue;if(typeof _ret==="object")return _ret.v;}return true;}function isObjectMatched(obj,matcher){var matcherKeys=Object.keys(matcher);for(var i=0;i<matcherKeys.length;i+=1){var key=matcherKeys[i];var value=obj[key];if(!isValueMatched(value,matcher[key])){return false;}continue;}return true;}function backupRegExpValues(){try{var arrayOfRegexpValues=[];for(var index=1;index<10;index+=1){var value="$".concat(index);if(!RegExp[value]){break;}arrayOfRegexpValues.push(RegExp[value]);}return arrayOfRegexpValues;}catch(error){return [];}}function restoreRegExpValues(array){if(!array.length){return;}try{var stringPattern="";if(array.length===1){stringPattern="(".concat(array[0],")");}else {stringPattern=array.reduce(function(accumulator,currentValue,currentIndex){if(currentIndex===1){return "(".concat(accumulator,"),(").concat(currentValue,")");}return "".concat(accumulator,",(").concat(currentValue,")");});}var regExpGroup=new RegExp(stringPattern);array.toString().replace(regExpGroup,"");}catch(error){var message="Failed to restore RegExp values: ".concat(error);console.log(message);}}var updatedArgs=args?[].concat(source).concat(args):[source];try{trustedSuppressNativeMethod.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}function xmlPrune(source,args){var flag="done";var uniqueIdentifier=source.uniqueId+source.name+"_"+(Array.isArray(args)?args.join("_"):"");if(source.uniqueId){if(Window.prototype.toString[uniqueIdentifier]===flag){return;}}function xmlPrune(source,propsToRemove){var optionalProp=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"";var urlToMatch=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";var verbose=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;if(typeof Reflect==="undefined"||typeof fetch==="undefined"||typeof Proxy==="undefined"||typeof Response==="undefined"){return;}var shouldPruneResponse=false;var shouldLogContent=verbose==="true";var urlMatchRegexp=toRegExp(urlToMatch);var XPATH_MARKER="xpath(";var isXpath=propsToRemove&&propsToRemove.startsWith(XPATH_MARKER);var getXPathElements=function getXPathElements(contextNode){var matchedElements=[];try{var elementsToRemove=propsToRemove.slice(XPATH_MARKER.length,-1);var xpathResult=contextNode.evaluate(elementsToRemove,contextNode,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0;i<xpathResult.snapshotLength;i+=1){matchedElements.push(xpathResult.snapshotItem(i));}}catch(ex){var message="Invalid XPath parameter: ".concat(propsToRemove,"\n").concat(ex);logMessage(source,message);}return matchedElements;};var xPathPruning=function xPathPruning(xPathElements){xPathElements.forEach(function(element){if(element.nodeType===1){element.remove();}else if(element.nodeType===2){element.ownerElement.removeAttribute(element.nodeName);}});};var isXML=function isXML(text){if(typeof text==="string"){var trimmedText=text.trim();if(trimmedText.startsWith("<")&&trimmedText.endsWith(">")){return true;}}return false;};var createXMLDocument=function createXMLDocument(text){var xmlParser=new DOMParser();var xmlDocument=xmlParser.parseFromString(text,"text/xml");return xmlDocument;};var isPruningNeeded=function isPruningNeeded(response,propsToRemove){if(!isXML(response)){return false;}var docXML=createXMLDocument(response);return isXpath?getXPathElements(docXML):!!docXML.querySelector(propsToRemove);};var pruneXML=function pruneXML(text){if(!isXML(text)){shouldPruneResponse=false;return text;}var xmlDoc=createXMLDocument(text);var errorNode=xmlDoc.querySelector("parsererror");if(errorNode){return text;}if(optionalProp!==""&&xmlDoc.querySelector(optionalProp)===null){shouldPruneResponse=false;return text;}var elements=isXpath?getXPathElements(xmlDoc):xmlDoc.querySelectorAll(propsToRemove);if(!elements.length){shouldPruneResponse=false;return text;}if(shouldLogContent){var cloneXmlDoc=xmlDoc.cloneNode(true);logMessage(source,"Original xml:");logMessage(source,cloneXmlDoc,true,false);}if(isXpath){xPathPruning(elements);}else {elements.forEach(function(elem){elem.remove();});}if(shouldLogContent){logMessage(source,"Modified xml:");logMessage(source,xmlDoc,true,false);}var serializer=new XMLSerializer();text=serializer.serializeToString(xmlDoc);return text;};var nativeOpen=window.XMLHttpRequest.prototype.open;var nativeSend=window.XMLHttpRequest.prototype.send;var xhrData;var openWrapper=function openWrapper(target,thisArg,args){xhrData=getXhrData.apply(null,args);if(matchRequestProps(source,urlToMatch,xhrData)){thisArg.shouldBePruned=true;}if(thisArg.shouldBePruned){thisArg.collectedHeaders=[];var setRequestHeaderWrapper=function setRequestHeaderWrapper(target,thisArg,args){thisArg.collectedHeaders.push(args);return Reflect.apply(target,thisArg,args);};var setRequestHeaderHandler={apply:setRequestHeaderWrapper};thisArg.setRequestHeader=new Proxy(thisArg.setRequestHeader,setRequestHeaderHandler);}return Reflect.apply(target,thisArg,args);};var sendWrapper=function sendWrapper(target,thisArg,args){var allowedResponseTypeValues=["","text"];if(!thisArg.shouldBePruned||!allowedResponseTypeValues.includes(thisArg.responseType)){return Reflect.apply(target,thisArg,args);}var forgedRequest=new XMLHttpRequest();forgedRequest.addEventListener("readystatechange",function(){if(forgedRequest.readyState!==4){return;}var readyState=forgedRequest.readyState,response=forgedRequest.response,responseText=forgedRequest.responseText,responseURL=forgedRequest.responseURL,responseXML=forgedRequest.responseXML,status=forgedRequest.status,statusText=forgedRequest.statusText;var content=responseText||response;if(typeof content!=="string"){return;}if(!propsToRemove){if(isXML(response)){var message="XMLHttpRequest.open() URL: ".concat(responseURL,"\nresponse: ").concat(response);logMessage(source,message);logMessage(source,createXMLDocument(response),true,false);}}else {shouldPruneResponse=isPruningNeeded(response,propsToRemove);}var responseContent=shouldPruneResponse?pruneXML(response):response;Object.defineProperties(thisArg,{readyState:{value:readyState,writable:false},responseURL:{value:responseURL,writable:false},responseXML:{value:responseXML,writable:false},status:{value:status,writable:false},statusText:{value:statusText,writable:false},response:{value:responseContent,writable:false},responseText:{value:responseContent,writable:false}});setTimeout(function(){var stateEvent=new Event("readystatechange");thisArg.dispatchEvent(stateEvent);var loadEvent=new Event("load");thisArg.dispatchEvent(loadEvent);var loadEndEvent=new Event("loadend");thisArg.dispatchEvent(loadEndEvent);},1);hit(source);});nativeOpen.apply(forgedRequest,[xhrData.method,xhrData.url]);thisArg.collectedHeaders.forEach(function(header){var name=header[0];var value=header[1];forgedRequest.setRequestHeader(name,value);});thisArg.collectedHeaders=[];try{nativeSend.call(forgedRequest,args);}catch(_unused){return Reflect.apply(target,thisArg,args);}return undefined;};var openHandler={apply:openWrapper};var sendHandler={apply:sendWrapper};XMLHttpRequest.prototype.open=new Proxy(XMLHttpRequest.prototype.open,openHandler);XMLHttpRequest.prototype.send=new Proxy(XMLHttpRequest.prototype.send,sendHandler);var nativeFetch=window.fetch;var fetchWrapper=async function fetchWrapper(target,thisArg,args){var fetchURL=args[0]instanceof Request?args[0].url:args[0];if(typeof fetchURL!=="string"||fetchURL.length===0){return Reflect.apply(target,thisArg,args);}if(urlMatchRegexp.test(fetchURL)){var response=await nativeFetch(...args);var clonedResponse=response.clone();var responseText=await response.text();shouldPruneResponse=isPruningNeeded(responseText,propsToRemove);if(!shouldPruneResponse){var message="fetch URL: ".concat(fetchURL,"\nresponse text: ").concat(responseText);logMessage(source,message);logMessage(source,createXMLDocument(responseText),true,false);return clonedResponse;}var prunedText=pruneXML(responseText);if(shouldPruneResponse){hit(source);return new Response(prunedText,{status:response.status,statusText:response.statusText,headers:response.headers});}return clonedResponse;}return Reflect.apply(target,thisArg,args);};var fetchHandler={apply:fetchWrapper};window.fetch=new Proxy(window.fetch,fetchHandler);}function hit(source){var ADGUARD_PREFIX="[AdGuard]";if(!source.verbose){return;}try{var trace=console.trace.bind(console);var label="".concat(ADGUARD_PREFIX," ");if(source.engine==="corelibs"){label+=source.ruleText;}else {if(source.domainName){label+="".concat(source.domainName);}if(source.args){label+="#%#//scriptlet('".concat(source.name,"', '").concat(source.args.join("', '"),"')");}else {label+="#%#//scriptlet('".concat(source.name,"')");}}if(trace){trace(label);}}catch(e){}if(typeof window.__debug==="function"){window.__debug(source);}}function logMessage(source,message){var forced=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var convertMessageToString=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var name=source.name,verbose=source.verbose;if(!forced&&!verbose){return;}var nativeConsole=console.log;if(!convertMessageToString){nativeConsole("".concat(name,":"),message);return;}nativeConsole("".concat(name,": ").concat(message));}function toRegExp(rawInput){var input=rawInput||"";var DEFAULT_VALUE=".?";var FORWARD_SLASH="/";if(input===""){return new RegExp(DEFAULT_VALUE);}var delimiterIndex=input.lastIndexOf(FORWARD_SLASH);var flagsPart=input.substring(delimiterIndex+1);var regExpPart=input.substring(0,delimiterIndex+1);var isValidRegExpFlag=function isValidRegExpFlag(flag){if(!flag){return false;}try{new RegExp("",flag);return true;}catch(ex){return false;}};var getRegExpFlags=function getRegExpFlags(regExpStr,flagsStr){if(regExpStr.startsWith(FORWARD_SLASH)&&regExpStr.endsWith(FORWARD_SLASH)&&!regExpStr.endsWith("\\/")&&isValidRegExpFlag(flagsStr)){return flagsStr;}return "";};var flags=getRegExpFlags(regExpPart,flagsPart);if(input.startsWith(FORWARD_SLASH)&&input.endsWith(FORWARD_SLASH)||flags){var regExpInput=flags?regExpPart:input;return new RegExp(regExpInput.slice(1,-1),flags);}var escaped=input.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(escaped);}function getXhrData(method,url,async,user,password){return {method:method,url:url,async:async,user:user,password:password};}function matchRequestProps(source,propsToMatch,requestData){if(propsToMatch===""||propsToMatch==="*"){return true;}var isMatched;var parsedData=parseMatchProps(propsToMatch);if(!isValidParsedData(parsedData)){logMessage(source,"Invalid parameter: ".concat(propsToMatch));isMatched=false;}else {var matchData=getMatchPropsData(parsedData);var matchKeys=Object.keys(matchData);isMatched=matchKeys.every(function(matchKey){var matchValue=matchData[matchKey];var dataValue=requestData[matchKey];return Object.prototype.hasOwnProperty.call(requestData,matchKey)&&typeof dataValue==="string"&&(matchValue===null||matchValue===void 0?void 0:matchValue.test(dataValue));});}return isMatched;}function getMatchPropsData(data){var matchData={};var dataKeys=Object.keys(data);dataKeys.forEach(function(key){matchData[key]=toRegExp(data[key]);});return matchData;}function getRequestProps(){return ["url","method","headers","body","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","mode"];}function isValidParsedData(data){return Object.values(data).every(function(value){return isValidStrPattern(value);});}function parseMatchProps(propsToMatchStr){var PROPS_DIVIDER=" ";var PAIRS_MARKER=":";var isRequestProp=function isRequestProp(prop){return getRequestProps().includes(prop);};var propsObj={};var props=propsToMatchStr.split(PROPS_DIVIDER);props.forEach(function(prop){var dividerInd=prop.indexOf(PAIRS_MARKER);var key=prop.slice(0,dividerInd);if(isRequestProp(key)){var value=prop.slice(dividerInd+1);propsObj[key]=value;}else {propsObj.url=prop;}});return propsObj;}function isValidStrPattern(input){var FORWARD_SLASH="/";var str=escapeRegExp(input);if(input[0]===FORWARD_SLASH&&input[input.length-1]===FORWARD_SLASH){str=input.slice(1,-1);}var isValid;try{isValid=new RegExp(str);isValid=true;}catch(e){isValid=false;}return isValid;}function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");}var updatedArgs=args?[].concat(source).concat(args):[source];try{xmlPrune.apply(this,updatedArgs);if(source.uniqueId){Object.defineProperty(Window.prototype.toString,uniqueIdentifier,{value:flag,enumerable:false,writable:false,configurable:false});}}catch(e){console.log(e);}}var scriptletsMap={"amazon-apstag":AmazonApstag,"ubo-amazon_apstag.js":AmazonApstag,"amazon_apstag.js":AmazonApstag,"didomi-loader":DidomiLoader,fingerprintjs2:Fingerprintjs2,"ubo-fingerprint2.js":Fingerprintjs2,"fingerprint2.js":Fingerprintjs2,fingerprintjs3:Fingerprintjs3,"ubo-fingerprint3.js":Fingerprintjs3,"fingerprint3.js":Fingerprintjs3,gemius:Gemius,"google-analytics":GoogleAnalytics,"ubo-google-analytics_analytics.js":GoogleAnalytics,"google-analytics_analytics.js":GoogleAnalytics,"googletagmanager-gtm":GoogleAnalytics,"ubo-googletagmanager_gtm.js":GoogleAnalytics,"googletagmanager_gtm.js":GoogleAnalytics,"google-analytics-ga":GoogleAnalyticsGa,"ubo-google-analytics_ga.js":GoogleAnalyticsGa,"google-analytics_ga.js":GoogleAnalyticsGa,"google-ima3":GoogleIma3,"ubo-google-ima.js":GoogleIma3,"google-ima.js":GoogleIma3,"googlesyndication-adsbygoogle":GoogleSyndicationAdsByGoogle,"ubo-googlesyndication_adsbygoogle.js":GoogleSyndicationAdsByGoogle,"googlesyndication_adsbygoogle.js":GoogleSyndicationAdsByGoogle,"googletagservices-gpt":GoogleTagServicesGpt,"ubo-googletagservices_gpt.js":GoogleTagServicesGpt,"googletagservices_gpt.js":GoogleTagServicesGpt,matomo:Matomo,"naver-wcslog":NaverWcslog,"pardot-1.0":Pardot,prebid:Prebid,"scorecardresearch-beacon":ScoreCardResearchBeacon,"ubo-scorecardresearch_beacon.js":ScoreCardResearchBeacon,"scorecardresearch_beacon.js":ScoreCardResearchBeacon,"abort-current-inline-script":abortCurrentInlineScript,"abort-current-script.js":abortCurrentInlineScript,"ubo-abort-current-script.js":abortCurrentInlineScript,"acs.js":abortCurrentInlineScript,"ubo-acs.js":abortCurrentInlineScript,"ubo-abort-current-script":abortCurrentInlineScript,"ubo-acs":abortCurrentInlineScript,"abort-current-inline-script.js":abortCurrentInlineScript,"ubo-abort-current-inline-script.js":abortCurrentInlineScript,"acis.js":abortCurrentInlineScript,"ubo-acis.js":abortCurrentInlineScript,"ubo-abort-current-inline-script":abortCurrentInlineScript,"ubo-acis":abortCurrentInlineScript,"abp-abort-current-inline-script":abortCurrentInlineScript,"abort-on-property-read":abortOnPropertyRead,"abort-on-property-read.js":abortOnPropertyRead,"ubo-abort-on-property-read.js":abortOnPropertyRead,"aopr.js":abortOnPropertyRead,"ubo-aopr.js":abortOnPropertyRead,"ubo-abort-on-property-read":abortOnPropertyRead,"ubo-aopr":abortOnPropertyRead,"abp-abort-on-property-read":abortOnPropertyRead,"abort-on-property-write":abortOnPropertyWrite,"abort-on-property-write.js":abortOnPropertyWrite,"ubo-abort-on-property-write.js":abortOnPropertyWrite,"aopw.js":abortOnPropertyWrite,"ubo-aopw.js":abortOnPropertyWrite,"ubo-abort-on-property-write":abortOnPropertyWrite,"ubo-aopw":abortOnPropertyWrite,"abp-abort-on-property-write":abortOnPropertyWrite,"abort-on-stack-trace":abortOnStackTrace,"abort-on-stack-trace.js":abortOnStackTrace,"ubo-abort-on-stack-trace.js":abortOnStackTrace,"aost.js":abortOnStackTrace,"ubo-aost.js":abortOnStackTrace,"ubo-abort-on-stack-trace":abortOnStackTrace,"ubo-aost":abortOnStackTrace,"abp-abort-on-stack-trace":abortOnStackTrace,"adjust-setInterval":adjustSetInterval,"nano-setInterval-booster.js":adjustSetInterval,"ubo-nano-setInterval-booster.js":adjustSetInterval,"nano-sib.js":adjustSetInterval,"ubo-nano-sib.js":adjustSetInterval,"adjust-setInterval.js":adjustSetInterval,"ubo-adjust-setInterval.js":adjustSetInterval,"ubo-nano-setInterval-booster":adjustSetInterval,"ubo-nano-sib":adjustSetInterval,"ubo-adjust-setInterval":adjustSetInterval,"adjust-setTimeout":adjustSetTimeout,"adjust-setTimeout.js":adjustSetTimeout,"ubo-adjust-setTimeout.js":adjustSetTimeout,"nano-setTimeout-booster.js":adjustSetTimeout,"ubo-nano-setTimeout-booster.js":adjustSetTimeout,"nano-stb.js":adjustSetTimeout,"ubo-nano-stb.js":adjustSetTimeout,"ubo-adjust-setTimeout":adjustSetTimeout,"ubo-nano-setTimeout-booster":adjustSetTimeout,"ubo-nano-stb":adjustSetTimeout,"call-nothrow":callNoThrow,"call-nothrow.js":callNoThrow,"ubo-call-nothrow.js":callNoThrow,"ubo-call-nothrow":callNoThrow,"debug-current-inline-script":debugCurrentInlineScript,"debug-on-property-read":debugOnPropertyRead,"debug-on-property-write":debugOnPropertyWrite,"dir-string":dirString,"disable-newtab-links":disableNewtabLinks,"disable-newtab-links.js":disableNewtabLinks,"ubo-disable-newtab-links.js":disableNewtabLinks,"ubo-disable-newtab-links":disableNewtabLinks,"evaldata-prune":evalDataPrune,"evaldata-prune.js":evalDataPrune,"ubo-evaldata-prune.js":evalDataPrune,"ubo-evaldata-prune":evalDataPrune,"close-window":forceWindowClose,"window-close-if.js":forceWindowClose,"ubo-window-close-if.js":forceWindowClose,"ubo-window-close-if":forceWindowClose,"close-window.js":forceWindowClose,"ubo-close-window.js":forceWindowClose,"ubo-close-window":forceWindowClose,"hide-in-shadow-dom":hideInShadowDom,"href-sanitizer":hrefSanitizer,"href-sanitizer.js":hrefSanitizer,"ubo-href-sanitizer.js":hrefSanitizer,"ubo-href-sanitizer":hrefSanitizer,"inject-css-in-shadow-dom":injectCssInShadowDom,"json-prune":jsonPrune,"json-prune.js":jsonPrune,"ubo-json-prune.js":jsonPrune,"ubo-json-prune":jsonPrune,"abp-json-prune":jsonPrune,"json-prune-fetch-response":jsonPruneFetchResponse,"json-prune-fetch-response.js":jsonPruneFetchResponse,"ubo-json-prune-fetch-response.js":jsonPruneFetchResponse,"ubo-json-prune-fetch-response":jsonPruneFetchResponse,"json-prune-xhr-response":jsonPruneXhrResponse,"json-prune-xhr-response.js":jsonPruneXhrResponse,"ubo-json-prune-xhr-response.js":jsonPruneXhrResponse,"ubo-json-prune-xhr-response":jsonPruneXhrResponse,log:log,"abp-log":log,"log-addEventListener":logAddEventListener,"addEventListener-logger.js":logAddEventListener,"ubo-addEventListener-logger.js":logAddEventListener,"aell.js":logAddEventListener,"ubo-aell.js":logAddEventListener,"ubo-addEventListener-logger":logAddEventListener,"ubo-aell":logAddEventListener,"log-eval":logEval,"log-on-stack-trace":logOnStacktrace,"m3u-prune":m3uPrune,"m3u-prune.js":m3uPrune,"ubo-m3u-prune.js":m3uPrune,"ubo-m3u-prune":m3uPrune,"metrika-yandex-tag":metrikaYandexTag,"metrika-yandex-watch":metrikaYandexWatch,"no-protected-audience":noProtectedAudience,"no-topics":noTopics,noeval:noeval,"noeval.js":noeval,"silent-noeval.js":noeval,"ubo-noeval.js":noeval,"ubo-silent-noeval.js":noeval,"ubo-noeval":noeval,"ubo-silent-noeval":noeval,nowebrtc:nowebrtc,"nowebrtc.js":nowebrtc,"ubo-nowebrtc.js":nowebrtc,"ubo-nowebrtc":nowebrtc,"prevent-addEventListener":preventAddEventListener,"addEventListener-defuser.js":preventAddEventListener,"ubo-addEventListener-defuser.js":preventAddEventListener,"aeld.js":preventAddEventListener,"ubo-aeld.js":preventAddEventListener,"ubo-addEventListener-defuser":preventAddEventListener,"ubo-aeld":preventAddEventListener,"abp-prevent-listener":preventAddEventListener,"prevent-adfly":preventAdfly,"prevent-bab":preventBab,"prevent-element-src-loading":preventElementSrcLoading,"prevent-eval-if":preventEvalIf,"noeval-if.js":preventEvalIf,"ubo-noeval-if.js":preventEvalIf,"ubo-noeval-if":preventEvalIf,"prevent-fab-3.2.0":preventFab,"nofab.js":preventFab,"ubo-nofab.js":preventFab,"fuckadblock.js-3.2.0":preventFab,"ubo-fuckadblock.js-3.2.0":preventFab,"ubo-nofab":preventFab,"prevent-fetch":preventFetch,"prevent-fetch.js":preventFetch,"ubo-prevent-fetch.js":preventFetch,"ubo-prevent-fetch":preventFetch,"no-fetch-if.js":preventFetch,"ubo-no-fetch-if.js":preventFetch,"ubo-no-fetch-if":preventFetch,"prevent-popads-net":preventPopadsNet,"popads.net.js":preventPopadsNet,"ubo-popads.net.js":preventPopadsNet,"ubo-popads.net":preventPopadsNet,"prevent-refresh":preventRefresh,"prevent-refresh.js":preventRefresh,"refresh-defuser.js":preventRefresh,"refresh-defuser":preventRefresh,"ubo-prevent-refresh.js":preventRefresh,"ubo-prevent-refresh":preventRefresh,"ubo-refresh-defuser.js":preventRefresh,"ubo-refresh-defuser":preventRefresh,"prevent-requestAnimationFrame":preventRequestAnimationFrame,"no-requestAnimationFrame-if.js":preventRequestAnimationFrame,"ubo-no-requestAnimationFrame-if.js":preventRequestAnimationFrame,"norafif.js":preventRequestAnimationFrame,"ubo-norafif.js":preventRequestAnimationFrame,"ubo-no-requestAnimationFrame-if":preventRequestAnimationFrame,"ubo-norafif":preventRequestAnimationFrame,"prevent-setInterval":preventSetInterval,"no-setInterval-if.js":preventSetInterval,"ubo-no-setInterval-if.js":preventSetInterval,"setInterval-defuser.js":preventSetInterval,"ubo-setInterval-defuser.js":preventSetInterval,"nosiif.js":preventSetInterval,"ubo-nosiif.js":preventSetInterval,"sid.js":preventSetInterval,"ubo-sid.js":preventSetInterval,"ubo-no-setInterval-if":preventSetInterval,"ubo-setInterval-defuser":preventSetInterval,"ubo-nosiif":preventSetInterval,"ubo-sid":preventSetInterval,"prevent-setTimeout":preventSetTimeout,"no-setTimeout-if.js":preventSetTimeout,"ubo-no-setTimeout-if.js":preventSetTimeout,"nostif.js":preventSetTimeout,"ubo-nostif.js":preventSetTimeout,"ubo-no-setTimeout-if":preventSetTimeout,"ubo-nostif":preventSetTimeout,"setTimeout-defuser.js":preventSetTimeout,"ubo-setTimeout-defuser.js":preventSetTimeout,"ubo-setTimeout-defuser":preventSetTimeout,"std.js":preventSetTimeout,"ubo-std.js":preventSetTimeout,"ubo-std":preventSetTimeout,"prevent-window-open":preventWindowOpen,"window.open-defuser.js":preventWindowOpen,"ubo-window.open-defuser.js":preventWindowOpen,"ubo-window.open-defuser":preventWindowOpen,"nowoif.js":preventWindowOpen,"ubo-nowoif.js":preventWindowOpen,"ubo-nowoif":preventWindowOpen,"no-window-open-if.js":preventWindowOpen,"ubo-no-window-open-if.js":preventWindowOpen,"ubo-no-window-open-if":preventWindowOpen,"prevent-xhr":preventXHR,"no-xhr-if.js":preventXHR,"ubo-no-xhr-if.js":preventXHR,"ubo-no-xhr-if":preventXHR,"remove-attr":removeAttr,"remove-attr.js":removeAttr,"ubo-remove-attr.js":removeAttr,"ra.js":removeAttr,"ubo-ra.js":removeAttr,"ubo-remove-attr":removeAttr,"ubo-ra":removeAttr,"remove-class":removeClass,"remove-class.js":removeClass,"ubo-remove-class.js":removeClass,"rc.js":removeClass,"ubo-rc.js":removeClass,"ubo-remove-class":removeClass,"ubo-rc":removeClass,"remove-cookie":removeCookie,"cookie-remover.js":removeCookie,"ubo-cookie-remover.js":removeCookie,"ubo-cookie-remover":removeCookie,"remove-cookie.js":removeCookie,"ubo-remove-cookie.js":removeCookie,"ubo-remove-cookie":removeCookie,"abp-cookie-remover":removeCookie,"remove-in-shadow-dom":removeInShadowDom,"remove-node-text":removeNodeText,"remove-node-text.js":removeNodeText,"ubo-remove-node-text.js":removeNodeText,"rmnt.js":removeNodeText,"ubo-rmnt.js":removeNodeText,"ubo-remove-node-text":removeNodeText,"ubo-rmnt":removeNodeText,"set-attr":setAttr,"set-attr.js":setAttr,"ubo-set-attr.js":setAttr,"ubo-set-attr":setAttr,"set-constant":setConstant,"set-constant.js":setConstant,"ubo-set-constant.js":setConstant,"set.js":setConstant,"ubo-set.js":setConstant,"ubo-set-constant":setConstant,"ubo-set":setConstant,"abp-override-property-read":setConstant,"set-cookie":setCookie,"set-cookie.js":setCookie,"ubo-set-cookie.js":setCookie,"ubo-set-cookie":setCookie,"set-cookie-reload":setCookieReload,"set-cookie-reload.js":setCookieReload,"ubo-set-cookie-reload.js":setCookieReload,"ubo-set-cookie-reload":setCookieReload,"set-local-storage-item":setLocalStorageItem,"set-local-storage-item.js":setLocalStorageItem,"ubo-set-local-storage-item.js":setLocalStorageItem,"ubo-set-local-storage-item":setLocalStorageItem,"set-popads-dummy":setPopadsDummy,"popads-dummy.js":setPopadsDummy,"ubo-popads-dummy.js":setPopadsDummy,"ubo-popads-dummy":setPopadsDummy,"set-session-storage-item":setSessionStorageItem,"set-session-storage-item.js":setSessionStorageItem,"ubo-set-session-storage-item.js":setSessionStorageItem,"ubo-set-session-storage-item":setSessionStorageItem,"spoof-css":spoofCSS,"spoof-css.js":spoofCSS,"ubo-spoof-css.js":spoofCSS,"ubo-spoof-css":spoofCSS,"trusted-click-element":trustedClickElement,"trusted-create-element":trustedCreateElement,"trusted-dispatch-event":trustedDispatchEvent,"trusted-prune-inbound-object":trustedPruneInboundObject,"trusted-replace-fetch-response":trustedReplaceFetchResponse,"trusted-replace-node-text":trustedReplaceNodeText,"trusted-replace-outbound-text":trustedReplaceOutboundText,"trusted-replace-xhr-response":trustedReplaceXhrResponse,"trusted-set-attr":trustedSetAttr,"trusted-set-constant":trustedSetConstant,"trusted-set-cookie":trustedSetCookie,"trusted-set-cookie-reload":trustedSetCookieReload,"trusted-set-local-storage-item":trustedSetLocalStorageItem,"trusted-set-session-storage-item":trustedSetSessionStorageItem,"trusted-suppress-native-method":trustedSuppressNativeMethod,"xml-prune":xmlPrune,"xml-prune.js":xmlPrune,"ubo-xml-prune.js":xmlPrune,"ubo-xml-prune":xmlPrune};var getScriptletFunction=function getScriptletFunction(name){return scriptletsMap[name];};
    function getScriptletCode(source) {
      if (!validator.isValidScriptletName(source.name)) {
        return null;
      }
      var scriptletFunction = getScriptletFunction(source.name);
      if (typeof scriptletFunction !== 'function') {
        throw new Error("Error: cannot invoke scriptlet with name: '".concat(source.name, "'"));
      }
      var scriptletFunctionString = scriptletFunction.toString();
      var result = source.engine === 'corelibs' || source.engine === 'test' ? wrapInNonameFunc(scriptletFunctionString) : passSourceAndProps(source, scriptletFunctionString);
      return result;
    }
    var scriptletsObject = function () {
      return {
        invoke: getScriptletCode,
        getScriptletFunction,
        isValidScriptletName: validator.isValidScriptletName,
        isValidScriptletRule,
        isAdgScriptletRule: validator.isAdgScriptletRule,
        isUboScriptletRule: validator.isUboScriptletRule,
        isAbpSnippetRule: validator.isAbpSnippetRule,
        convertUboToAdg: convertUboScriptletToAdg,
        convertAbpToAdg: convertAbpSnippetToAdg,
        convertScriptletToAdg,
        convertAdgToUbo: convertAdgScriptletToUbo,
        redirects,
        SCRIPTLETS_VERSION: version
      };
    }();
    scriptlets_umd.exports = scriptletsObject;
}));

var scriptlets_umdExports = scriptlets_umd.exports;
var scriptlets = /*@__PURE__*/getDefaultExportFromCjs$1(scriptlets_umdExports);

var isCidr$2 = {exports: {}};

var cidrRegex$2 = {exports: {}};

const ipRegex$1 = ipRegex$3;
const defaultOpts$1 = {exact: false};
const v4str$1 = `${ipRegex$1.v4().source}\\/(3[0-2]|[12]?[0-9])`;
const v6str$1 = `${ipRegex$1.v6().source}\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])`;
const v4exact$2 = new RegExp(`^${v4str$1}$`);
const v6exact$2 = new RegExp(`^${v6str$1}$`);
const v46exact$1 = new RegExp(`(?:^${v4str$1}$)|(?:^${v6str$1}$)`);
cidrRegex$2.exports = ({exact} = defaultOpts$1) => exact ? v46exact$1 : new RegExp(`(?:${v4str$1})|(?:${v6str$1})`, "g");
cidrRegex$2.exports.v4 = ({exact} = defaultOpts$1) => exact ? v4exact$2 : new RegExp(v4str$1, "g");
cidrRegex$2.exports.v6 = ({exact} = defaultOpts$1) => exact ? v6exact$2 : new RegExp(v6str$1, "g");

var cidrRegexExports = cidrRegex$2.exports;

const {v4: v4$1, v6: v6$1} = cidrRegexExports;
const re4 = v4$1({exact: true});
const re6 = v6$1({exact: true});
isCidr$2.exports = str => re4.test(str) ? 4 : (re6.test(str) ? 6 : 0);
isCidr$2.exports.v4 = str => re4.test(str);
isCidr$2.exports.v6 = str => re6.test(str);

var isCidrExports = isCidr$2.exports;
var isCidr$1 = /*@__PURE__*/getDefaultExportFromCjs$1(isCidrExports);

const word = '[a-fA-F\\d:]';
const boundry = options => options && options.includeBoundaries
	? `(?:(?<=\\s|^)(?=${word})|(?<=${word})(?=\\s|$))`
	: '';
const v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}';
const v6segment = '[a-fA-F\\d]{1,4}';
const v6 = `
(?:
(?:${v6segment}:){7}(?:${v6segment}|:)|                                    // 1:2:3:4:5:6:7::  1:2:3:4:5:6:7:8
(?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)|                             // 1:2:3:4:5:6::    1:2:3:4:5:6::8   1:2:3:4:5:6::8  1:2:3:4:5:6::1.2.3.4
(?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)|                   // 1:2:3:4:5::      1:2:3:4:5::7:8   1:2:3:4:5::8    1:2:3:4:5::7:1.2.3.4
(?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)| // 1:2:3:4::        1:2:3:4::6:7:8   1:2:3:4::8      1:2:3:4::6:7:1.2.3.4
(?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)| // 1:2:3::          1:2:3::5:6:7:8   1:2:3::8        1:2:3::5:6:7:1.2.3.4
(?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)| // 1:2::            1:2::4:5:6:7:8   1:2::8          1:2::4:5:6:7:1.2.3.4
(?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)| // 1::              1::3:4:5:6:7:8   1::8            1::3:4:5:6:7:1.2.3.4
(?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:))             // ::2:3:4:5:6:7:8  ::2:3:4:5:6:7:8  ::8             ::1.2.3.4
)(?:%[0-9a-zA-Z]{1,})?                                             // %eth0            %1
`.replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim();
const v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`);
const v4exact$1 = new RegExp(`^${v4}$`);
const v6exact$1 = new RegExp(`^${v6}$`);
const ipRegex = options => options && options.exact
	? v46Exact
	: new RegExp(`(?:${boundry(options)}${v4}${boundry(options)})|(?:${boundry(options)}${v6}${boundry(options)})`, 'g');
ipRegex.v4 = options => options && options.exact ? v4exact$1 : new RegExp(`${boundry(options)}${v4}${boundry(options)}`, 'g');
ipRegex.v6 = options => options && options.exact ? v6exact$1 : new RegExp(`${boundry(options)}${v6}${boundry(options)}`, 'g');

const defaultOpts = {exact: false};
const v4str = `${ipRegex.v4().source}\\/(3[0-2]|[12]?[0-9])`;
const v6str = `${ipRegex.v6().source}\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])`;
const v4exact = new RegExp(`^${v4str}$`);
const v6exact = new RegExp(`^${v6str}$`);
const v46exact = new RegExp(`(?:^${v4str}$)|(?:^${v6str}$)`);
const cidrRegex = ({exact} = defaultOpts) => exact ? v46exact : new RegExp(`(?:${v4str})|(?:${v6str})`, "g");
cidrRegex.v4 = ({exact} = defaultOpts) => exact ? v4exact : new RegExp(v4str, "g");
cidrRegex.v6 = ({exact} = defaultOpts) => exact ? v6exact : new RegExp(v6str, "g");
var cidrRegex$1 = cidrRegex;

function parseIp(ip) {
  const version = ipVersion(ip);
  if (!version) throw new Error(`Invalid IP address: ${ip}`);
  let number = 0n;
  let exp = 0n;
  const res = Object.create(null);
  if (version === 4) {
    for (const n of ip.split(".").map(BigInt).reverse()) {
      number += n * (2n ** exp);
      exp += 8n;
    }
  } else {
    if (ip.includes(".")) {
      res.ipv4mapped = true;
      ip = ip.split(":").map(part => {
        if (part.includes(".")) {
          const digits = part.split(".").map(str => Number(str).toString(16).padStart(2, "0"));
          return `${digits[0]}${digits[1]}:${digits[2]}${digits[3]}`;
        } else {
          return part;
        }
      }).join(":");
    }
    if (ip.includes("%")) {
      let scopeid;
      [, ip, scopeid] = /(.+)%(.+)/.exec(ip);
      res.scopeid = scopeid;
    }
    const parts = ip.split(":");
    const index = parts.indexOf("");
    if (index !== -1) {
      while (parts.length < 8) {
        parts.splice(index, 0, "");
      }
    }
    for (const n of parts.map(part => BigInt(parseInt(part || 0, 16))).reverse()) {
      number += n * (2n ** exp);
      exp += 16n;
    }
  }
  res.number = number;
  res.version = version;
  return res;
}
function ipVersion(ip) {
  return ip.includes(":") ? 6 : ip.includes(".") ? 4 : 0;
}

const bits = {
  4: 32,
  6: 128,
};
const uniq = arr => Array.from(new Set(arr));
function isIP(ip) {
  if (ipRegex.v4({exact: true}).test(ip)) return 4;
  if (ipRegex.v6({exact: true}).test(ip)) return 6;
  return 0;
}
function isCidr(ip) {
  if (cidrRegex$1.v4({exact: true}).test(ip)) return 4;
  if (cidrRegex$1.v6({exact: true}).test(ip)) return 6;
  return 0;
}
function parse(str) {
  const cidrVersion = isCidr(str);
  const parsed = Object.create(null);
  parsed.single = false;
  if (cidrVersion) {
    parsed.cidr = str;
    parsed.version = cidrVersion;
  } else {
    const version = isIP(str);
    if (version) {
      parsed.cidr = `${str}/${bits[version]}`;
      parsed.version = version;
      parsed.single = true;
    } else {
      throw new Error(`Network is not a CIDR or IP: ${str}`);
    }
  }
  const [ip, prefix] = parsed.cidr.split("/");
  parsed.prefix = prefix;
  const {number, version} = parseIp(ip);
  const numBits = bits[version];
  const ipBits = number.toString(2).padStart(numBits, "0");
  const prefixLen = Number(numBits - prefix);
  const startBits = ipBits.substring(0, numBits - prefixLen);
  parsed.start = BigInt(`0b${startBits}${"0".repeat(prefixLen)}`);
  parsed.end = BigInt(`0b${startBits}${"1".repeat(prefixLen)}`);
  return parsed;
}
function netContains(a, b) {
  if (b.start < a.start) return false;
  if (b.end > a.end) return false;
  return true;
}
function contains(a, b) {
  const aNets = uniq(Array.isArray(a) ? a : [a]);
  const bNets = uniq(Array.isArray(b) ? b : [b]);
  const numExpected = bNets.length;
  let numFound = 0;
  for (const a of aNets) {
    const aParsed = parse(a);
    for (const b of bNets) {
      const bParsed = parse(b);
      if (aParsed.version !== bParsed.version) {
        continue;
      }
      if (netContains(aParsed, bParsed)) {
        numFound++;
        continue;
      }
    }
  }
  return numFound === numExpected;
}

const maxInt = 2147483647;
const base = 36;
const tMin = 1;
const tMax = 26;
const skew = 38;
const damp = 700;
const initialBias = 72;
const initialN = 128;
const delimiter = '-';
const regexPunycode = /^xn--/;
const regexNonASCII = /[^\0-\x7F]/;
const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g;
const errors = {
	'overflow': 'Overflow: input needs wider integers to process',
	'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
	'invalid-input': 'Invalid input'
};
const baseMinusTMin = base - tMin;
const floor = Math.floor;
const stringFromCharCode = String.fromCharCode;
function error(type) {
	throw new RangeError(errors[type]);
}
function map(array, callback) {
	const result = [];
	let length = array.length;
	while (length--) {
		result[length] = callback(array[length]);
	}
	return result;
}
function mapDomain(domain, callback) {
	const parts = domain.split('@');
	let result = '';
	if (parts.length > 1) {
		result = parts[0] + '@';
		domain = parts[1];
	}
	domain = domain.replace(regexSeparators, '\x2E');
	const labels = domain.split('.');
	const encoded = map(labels, callback).join('.');
	return result + encoded;
}
function ucs2decode(string) {
	const output = [];
	let counter = 0;
	const length = string.length;
	while (counter < length) {
		const value = string.charCodeAt(counter++);
		if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
			const extra = string.charCodeAt(counter++);
			if ((extra & 0xFC00) == 0xDC00) {
				output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
			} else {
				output.push(value);
				counter--;
			}
		} else {
			output.push(value);
		}
	}
	return output;
}
const ucs2encode = codePoints => String.fromCodePoint(...codePoints);
const basicToDigit = function(codePoint) {
	if (codePoint >= 0x30 && codePoint < 0x3A) {
		return 26 + (codePoint - 0x30);
	}
	if (codePoint >= 0x41 && codePoint < 0x5B) {
		return codePoint - 0x41;
	}
	if (codePoint >= 0x61 && codePoint < 0x7B) {
		return codePoint - 0x61;
	}
	return base;
};
const digitToBasic = function(digit, flag) {
	return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
};
const adapt = function(delta, numPoints, firstTime) {
	let k = 0;
	delta = firstTime ? floor(delta / damp) : delta >> 1;
	delta += floor(delta / numPoints);
	for (; delta > baseMinusTMin * tMax >> 1; k += base) {
		delta = floor(delta / baseMinusTMin);
	}
	return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
};
const decode = function(input) {
	const output = [];
	const inputLength = input.length;
	let i = 0;
	let n = initialN;
	let bias = initialBias;
	let basic = input.lastIndexOf(delimiter);
	if (basic < 0) {
		basic = 0;
	}
	for (let j = 0; j < basic; ++j) {
		if (input.charCodeAt(j) >= 0x80) {
			error('not-basic');
		}
		output.push(input.charCodeAt(j));
	}
	for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; ) {
		const oldi = i;
		for (let w = 1, k = base; ; k += base) {
			if (index >= inputLength) {
				error('invalid-input');
			}
			const digit = basicToDigit(input.charCodeAt(index++));
			if (digit >= base) {
				error('invalid-input');
			}
			if (digit > floor((maxInt - i) / w)) {
				error('overflow');
			}
			i += digit * w;
			const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
			if (digit < t) {
				break;
			}
			const baseMinusT = base - t;
			if (w > floor(maxInt / baseMinusT)) {
				error('overflow');
			}
			w *= baseMinusT;
		}
		const out = output.length + 1;
		bias = adapt(i - oldi, out, oldi == 0);
		if (floor(i / out) > maxInt - n) {
			error('overflow');
		}
		n += floor(i / out);
		i %= out;
		output.splice(i++, 0, n);
	}
	return String.fromCodePoint(...output);
};
const encode = function(input) {
	const output = [];
	input = ucs2decode(input);
	const inputLength = input.length;
	let n = initialN;
	let delta = 0;
	let bias = initialBias;
	for (const currentValue of input) {
		if (currentValue < 0x80) {
			output.push(stringFromCharCode(currentValue));
		}
	}
	const basicLength = output.length;
	let handledCPCount = basicLength;
	if (basicLength) {
		output.push(delimiter);
	}
	while (handledCPCount < inputLength) {
		let m = maxInt;
		for (const currentValue of input) {
			if (currentValue >= n && currentValue < m) {
				m = currentValue;
			}
		}
		const handledCPCountPlusOne = handledCPCount + 1;
		if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
			error('overflow');
		}
		delta += (m - n) * handledCPCountPlusOne;
		n = m;
		for (const currentValue of input) {
			if (currentValue < n && ++delta > maxInt) {
				error('overflow');
			}
			if (currentValue === n) {
				let q = delta;
				for (let k = base; ; k += base) {
					const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
					if (q < t) {
						break;
					}
					const qMinusT = q - t;
					const baseMinusT = base - t;
					output.push(
						stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
					);
					q = floor(qMinusT / baseMinusT);
				}
				output.push(stringFromCharCode(digitToBasic(q, 0)));
				bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
				delta = 0;
				++handledCPCount;
			}
		}
		++delta;
		++n;
	}
	return output.join('');
};
const toUnicode = function(input) {
	return mapDomain(input, function(string) {
		return regexPunycode.test(string)
			? decode(string.slice(4).toLowerCase())
			: string;
	});
};
const toASCII = function(input) {
	return mapDomain(input, function(string) {
		return regexNonASCII.test(string)
			? 'xn--' + encode(string)
			: string;
	});
};
const punycode = {
	'version': '2.3.1',
	'ucs2': {
		'decode': ucs2decode,
		'encode': ucs2encode
	},
	'decode': decode,
	'encode': encode,
	'toASCII': toASCII,
	'toUnicode': toUnicode
};

var extendStatics = function(d, b) {
    extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
    return extendStatics(d, b);
};
function __extends(d, b) {
    if (typeof b !== "function" && b !== null)
        throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
    extendStatics(d, b);
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
    __assign = Object.assign || function __assign(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
function __awaiter(thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
}
function __generator(thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
}
function __makeTemplateObject(cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
}
function isErrorWithMessage$2(error) {
    return (typeof error === 'object'
        && error !== null
        && 'message' in error
        && typeof error.message === 'string');
}
function toErrorWithMessage$2(maybeError) {
    if (isErrorWithMessage$2(maybeError)) {
        return maybeError;
    }
    try {
        return new Error(JSON.stringify(maybeError));
    }
    catch (_a) {
        return new Error(String(maybeError));
    }
}
function getErrorMessage$2(error) {
    return toErrorWithMessage$2(error).message;
}
var ErrorStatusCodes;
(function (ErrorStatusCodes) {
    ErrorStatusCodes[ErrorStatusCodes["ComplexRegex"] = 1001] = "ComplexRegex";
    ErrorStatusCodes[ErrorStatusCodes["RuleLimit"] = 1002] = "RuleLimit";
    ErrorStatusCodes[ErrorStatusCodes["RegexpRuleLimit"] = 1003] = "RegexpRuleLimit";
    ErrorStatusCodes[ErrorStatusCodes["RemoveparamRegexpIsNotSupported"] = 1004] = "RemoveparamRegexpIsNotSupported";
    ErrorStatusCodes[ErrorStatusCodes["RemoveparamInversionIsNotSupported"] = 1005] = "RemoveparamInversionIsNotSupported";
})(ErrorStatusCodes || (ErrorStatusCodes = {}));
var EMPTY_STRING = '';
var SEPARATOR = '|';
var SPACE = ' ';
var WILDCARD = '*';
var LF$1 = '\n';
var CR = '\r';
var FF = '\f';
function splitByDelimiterWithEscapeCharacter(string, delimiter, escapeCharacter, preserveEmptyTokens, shouldUnescape) {
    if (shouldUnescape === void 0) { shouldUnescape = true; }
    if (!string) {
        return [];
    }
    if (string.startsWith(delimiter)) {
        string = string.substring(1);
    }
    var words = [];
    if (!string.includes(escapeCharacter)) {
        words = string.split(delimiter);
        if (!preserveEmptyTokens) {
            words = words.filter(function (word) { return !!word; });
        }
        return words;
    }
    var chars = [];
    var makeWord = function () {
        var word = chars.join('');
        words.push(word);
        chars = [];
    };
    for (var i = 0; i < string.length; i += 1) {
        var char = string.charAt(i);
        var isLastChar = i === (string.length - 1);
        if (char === delimiter) {
            var isEscapedChar = i > 0 && string[i - 1] === escapeCharacter;
            if (isEscapedChar) {
                if (shouldUnescape) {
                    chars.splice(chars.length - 1, 1);
                }
                chars.push(char);
            }
            else {
                makeWord();
            }
            if (isLastChar) {
                makeWord();
            }
        }
        else if (isLastChar) {
            chars.push(char);
            makeWord();
        }
        else {
            chars.push(char);
        }
    }
    if (!preserveEmptyTokens) {
        words = words.filter(function (word) { return !!word; });
    }
    return words;
}
function fastHash(str) {
    if (str.length === 0) {
        return 0;
    }
    var hash = 5381;
    for (var i = 0; i < str.length; i += 1) {
        hash = hash * 33 ^ str.charCodeAt(i);
    }
    return hash >>> 0;
}
function replaceAll(str, find, replace) {
    if (!str) {
        return str;
    }
    return str.split(find).join(replace);
}
function stringArraysEquals(left, right) {
    if (!left || !right) {
        return !left && !right;
    }
    if (left.length !== right.length) {
        return false;
    }
    for (var i = 0; i < left.length; i += 1) {
        if (left[i] !== right[i]) {
            return false;
        }
    }
    return true;
}
function stringArraysHaveIntersection(left, right) {
    if (!left || !right) {
        return true;
    }
    for (var i = 0; i < left.length; i += 1) {
        if (right.includes(left[i])) {
            return true;
        }
    }
    return false;
}
function hasSpaces(str) {
    return str.includes(SPACE);
}
function isString(value) {
    return typeof value === 'string';
}
function unescapeChar(str, char) {
    return str.replace("\\".concat(char), char);
}
function findNextLineBreakIndex(str, startIndex) {
    if (startIndex === void 0) { startIndex = 0; }
    var length = str.length;
    var offset = startIndex;
    while (offset < length) {
        var char = str[offset];
        if (char === LF$1 || char === FF) {
            return [offset, 1];
        }
        if (char === CR) {
            return str[offset + 1] === LF$1 ? [offset, 2] : [offset, 1];
        }
        offset += 1;
    }
    return [length, 0];
}
var RULE_INDEX_NONE = -1;
var IndexedRule =  (function () {
    function IndexedRule(rule, index) {
        this.rule = rule;
        this.index = index;
    }
    return IndexedRule;
}());
var specialCharacters = ['.', '+', '?', '$', '{', '}', '(', ')', '[', ']', '/', '\\'];
var reSpecialCharacters = new RegExp("[".concat(specialCharacters.join('\\'), "]"), 'g');
var reSpecialCharactersFull = /[.*+?^${}()|[\]\\]/g;
var reEscapedSpecialCharactersFull = /\\[.*+?^${}()|[\]\\]/g;
var protocolMarker = String.raw(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["://"], [":\\/\\/"])));
var escapeSequence = {
    n: '\n',
    r: '\r',
    t: '\t',
    b: '\b',
    f: '\f',
    v: '\v',
};
var SimpleRegex =  (function () {
    function SimpleRegex() {
    }
    SimpleRegex.extractShortcut = function (pattern) {
        if (pattern.startsWith(this.MASK_REGEX_RULE) && pattern.endsWith(this.MASK_REGEX_RULE)) {
            return this.extractRegexpShortcut(pattern);
        }
        return this.extractBasicShortcut(pattern);
    };
    SimpleRegex.extractBasicShortcut = function (pattern) {
        var longest = '';
        var parts = pattern.split(this.rePatternSpecialCharacters);
        for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
            var part = parts_1[_i];
            if (part.length > longest.length) {
                longest = part;
            }
        }
        return (longest || '').toLowerCase();
    };
    SimpleRegex.extractRegexpShortcut = function (pattern) {
        var reText = pattern.substring(this.MASK_REGEX_RULE.length, pattern.length - this.MASK_REGEX_RULE.length);
        if (reText.length === 0) {
            return '';
        }
        if (reText.indexOf('?') >= 0) {
            return '';
        }
        var protocolIndex = reText.indexOf(protocolMarker);
        if (protocolIndex > -1) {
            reText = reText.substring(protocolIndex + protocolMarker.length);
        }
        var currentLongest = '';
        var token = '';
        for (var i = 0; i < reText.length; i += 1) {
            var char = reText[i];
            if (char === '\\') {
                continue;
            }
            if (SimpleRegex.isValidRegexpShortcutChar(reText, i)) {
                token += char;
                if (i !== reText.length - 1) {
                    continue;
                }
            }
            if (token.length > currentLongest.length) {
                currentLongest = token;
            }
            token = '';
        }
        return currentLongest.toLowerCase();
    };
    SimpleRegex.patternToRegexp = function (pattern) {
        if (pattern === this.MASK_START_URL
            || pattern === this.MASK_PIPE
            || pattern === this.MASK_ANY_CHARACTER
            || pattern === '') {
            return this.REGEX_ANY_CHARACTER;
        }
        if (pattern.startsWith(this.MASK_REGEX_RULE) && pattern.endsWith(this.MASK_REGEX_RULE)) {
            return pattern.substring(this.MASK_REGEX_RULE.length, pattern.length - this.MASK_REGEX_RULE.length);
        }
        var regex = pattern.replace(reSpecialCharacters, '\\$&');
        if (regex.startsWith(this.MASK_START_URL)) {
            regex = regex.substring(0, this.MASK_START_URL.length)
                + replaceAll(regex.substring(this.MASK_START_URL.length, regex.length - this.MASK_PIPE.length), this.MASK_PIPE, "\\".concat(this.MASK_PIPE))
                + regex.substring(regex.length - this.MASK_PIPE.length);
        }
        else {
            regex = regex.substring(0, this.MASK_PIPE.length)
                + replaceAll(regex.substring(this.MASK_PIPE.length, regex.length - this.MASK_PIPE.length), this.MASK_PIPE, "\\".concat(this.MASK_PIPE))
                + regex.substring(regex.length - this.MASK_PIPE.length);
        }
        regex = replaceAll(regex, this.MASK_ANY_CHARACTER, this.REGEX_ANY_CHARACTER);
        regex = replaceAll(regex, this.MASK_SEPARATOR, this.REGEX_SEPARATOR);
        if (regex.startsWith(this.MASK_START_URL)) {
            regex = this.REGEX_START_URL + regex.substring(this.MASK_START_URL.length);
        }
        else if (regex.startsWith(this.MASK_PIPE)) {
            regex = this.REGEX_START_STRING + regex.substring(this.MASK_PIPE.length);
        }
        if (regex.endsWith(this.MASK_PIPE)) {
            regex = regex.substring(0, regex.length - this.MASK_PIPE.length) + this.REGEX_END_STRING;
        }
        return regex;
    };
    SimpleRegex.patternFromString = function (str) {
        var parts = splitByDelimiterWithEscapeCharacter(str, '/', '\\', true);
        var modifiers = (parts[1] || '');
        if (modifiers.indexOf('g') < 0) {
            modifiers += 'g';
        }
        return new RegExp(parts[0], modifiers);
    };
    SimpleRegex.escapeRegexSpecials = function (str, searchPattern) {
        if (searchPattern === void 0) { searchPattern = reSpecialCharactersFull; }
        return str.replace(searchPattern, '\\$&');
    };
    SimpleRegex.unescapeRegexSpecials = function (str, searchPattern) {
        if (searchPattern === void 0) { searchPattern = reEscapedSpecialCharactersFull; }
        return str.replace(searchPattern, function (match) { return match.substring(1); });
    };
    SimpleRegex.isRegexPattern = function (str) {
        return str.startsWith('/') && str.endsWith('/');
    };
    SimpleRegex.unescapeSpecials = function (str) {
        var keys = Object.keys(escapeSequence).join('|');
        var regex = new RegExp("\\\\(".concat(keys, ")"), 'g');
        return str.replace(regex, function (match, group) {
            return escapeSequence[group];
        });
    };
    SimpleRegex.MASK_START_URL = '||';
    SimpleRegex.REGEX_START_URL = '^(http|https|ws|wss)://([a-z0-9-_.]+\\.)?';
    SimpleRegex.MASK_PIPE = '|';
    SimpleRegex.REGEX_END_STRING = '$';
    SimpleRegex.REGEX_START_STRING = '^';
    SimpleRegex.MASK_SEPARATOR = '^';
    SimpleRegex.REGEX_SEPARATOR = '([^ a-zA-Z0-9.%_-]|$)';
    SimpleRegex.MASK_ANY_CHARACTER = '*';
    SimpleRegex.MASK_BACKSLASH = '/';
    SimpleRegex.REGEX_ANY_CHARACTER = '.*';
    SimpleRegex.MASK_REGEX_RULE = '/';
    SimpleRegex.reModifierPatternSpecialCharacters = /[[\],\\]/g;
    SimpleRegex.reModifierPatternEscapedSpecialCharacters = /\\[[\],\\]/g;
    SimpleRegex.MASK_COMMENT = '!';
    SimpleRegex.MIN_SHORTCUT_LENGTH = 3;
    SimpleRegex.MIN_GENERIC_RULE_LENGTH = 4;
    SimpleRegex.rePatternSpecialCharacters = new RegExp('[*^|]');
    SimpleRegex.isValidRegexpShortcutChar = function (str, i) {
        var charCode = str.charCodeAt(i);
        if (SimpleRegex.isAlphaNumericChar(charCode)) {
            return true;
        }
        if (i > 0 && str[i - 1] === '\\') {
            if (charCode === 46 || charCode === 47) {
                return true;
            }
        }
        return false;
    };
    SimpleRegex.isAlphaNumericChar = function (charCode) {
        return (charCode > 47 && charCode < 58)
            || (charCode > 64 && charCode < 91)
            || (charCode > 96 && charCode < 123);
    };
    return SimpleRegex;
}());
var templateObject_1$1;
var logger$1 = console;
var PIPE_SEPARATOR$1 = '|';
var DomainModifier =  (function () {
    function DomainModifier(domains, separator) {
        var processed;
        if (isString(domains)) {
            var node = DomainListParser.parse(domains.trim(), __assign(__assign({}, defaultParserOptions), { isLocIncluded: false }), 0, separator);
            if (node.children.length === 0) {
                throw new SyntaxError('At least one domain must be specified');
            }
            processed = DomainModifier.processDomainList(node);
        }
        else {
            if (separator !== domains.separator) {
                throw new SyntaxError('Separator mismatch');
            }
            processed = DomainModifier.processDomainList(domains);
        }
        processed.permittedDomains = processed.permittedDomains.map(function (domain) { return unescapeChar(domain, separator); });
        processed.restrictedDomains = processed.restrictedDomains.map(function (domain) { return unescapeChar(domain, separator); });
        this.restrictedDomains = processed.restrictedDomains.length > 0 ? processed.restrictedDomains : null;
        this.permittedDomains = processed.permittedDomains.length > 0 ? processed.permittedDomains : null;
    }
    DomainModifier.processDomainList = function (domainListNode) {
        var result = {
            permittedDomains: [],
            restrictedDomains: [],
        };
        var domains = domainListNode.children;
        for (var _i = 0, domains_1 = domains; _i < domains_1.length; _i++) {
            var _a = domains_1[_i], exception = _a.exception, domain = _a.value;
            var domainLowerCased = domain.toLowerCase();
            if (!SimpleRegex.isRegexPattern(domain) && domain.includes(WILDCARD) && !domain.endsWith(WILDCARD)) {
                throw new SyntaxError("Wildcards are only supported for top-level domains: \"".concat(domain, "\""));
            }
            if (exception) {
                result.restrictedDomains.push(domainLowerCased);
            }
            else {
                result.permittedDomains.push(domainLowerCased);
            }
        }
        return result;
    };
    DomainModifier.prototype.matchDomain = function (domain) {
        if (this.hasRestrictedDomains()) {
            if (DomainModifier.isDomainOrSubdomainOfAny(domain, this.restrictedDomains)) {
                return false;
            }
        }
        if (this.hasPermittedDomains()) {
            if (!DomainModifier.isDomainOrSubdomainOfAny(domain, this.permittedDomains)) {
                return false;
            }
        }
        return true;
    };
    DomainModifier.prototype.hasPermittedDomains = function () {
        return !!this.permittedDomains && this.permittedDomains.length > 0;
    };
    DomainModifier.prototype.hasRestrictedDomains = function () {
        return !!this.restrictedDomains && this.restrictedDomains.length > 0;
    };
    DomainModifier.prototype.getPermittedDomains = function () {
        return this.permittedDomains;
    };
    DomainModifier.prototype.getRestrictedDomains = function () {
        return this.restrictedDomains;
    };
    DomainModifier.isDomainOrSubdomainOfAny = function (domain, domains) {
        for (var i = 0; i < domains.length; i += 1) {
            var d = domains[i];
            if (DomainModifier.isWildcardDomain(d)) {
                if (DomainModifier.matchAsWildcard(d, domain)) {
                    return true;
                }
            }
            if (domain === d || (domain.endsWith(d) && domain.endsWith(".".concat(d)))) {
                return true;
            }
            if (SimpleRegex.isRegexPattern(d)) {
                try {
                    var domainPattern = new RegExp(d.slice(1, -1));
                    if (domainPattern.test(domain)) {
                        return true;
                    }
                }
                catch (_a) {
                    logger$1.error("Invalid regular expression as domain pattern: \"".concat(d, "\""));
                }
                continue;
            }
        }
        return false;
    };
    DomainModifier.isWildcardDomain = function (domain) {
        return domain.endsWith('.*');
    };
    DomainModifier.isWildcardOrRegexDomain = function (domain) {
        return DomainModifier.isWildcardDomain(domain) || SimpleRegex.isRegexPattern(domain);
    };
    DomainModifier.matchAsWildcard = function (wildcard, domainNameToCheck) {
        var wildcardedDomainToCheck = DomainModifier.genTldWildcard(domainNameToCheck);
        if (wildcardedDomainToCheck) {
            return wildcardedDomainToCheck === wildcard
                || (wildcardedDomainToCheck.endsWith(wildcard) && wildcardedDomainToCheck.endsWith(".".concat(wildcard)));
        }
        return false;
    };
    DomainModifier.genTldWildcard = function (domainName) {
        var tld = (0,tldts__WEBPACK_IMPORTED_MODULE_0__/* .getPublicSuffix */ .cH)(domainName, { allowPrivateDomains: true });
        if (tld) {
            return "".concat(domainName.slice(0, domainName.lastIndexOf(".".concat(tld))), ".*");
        }
        return '';
    };
    return DomainModifier;
}());
var ReplaceModifier =  (function () {
    function ReplaceModifier(value) {
        var parsed = ReplaceModifier.parseReplaceOption(value);
        this.replaceOption = parsed.optionText;
        this.replaceApply = parsed.apply;
    }
    ReplaceModifier.parseReplaceOption = function (option) {
        if (!option) {
            return {
                apply: function (x) { return x; },
                optionText: '',
            };
        }
        var parts = splitByDelimiterWithEscapeCharacter(option, '/', '\\', true);
        var modifiers = (parts[2] || '');
        if (modifiers.indexOf('g') < 0) {
            modifiers += 'g';
        }
        var pattern = new RegExp(parts[0], modifiers);
        var replacement = parts[1].replace(/\\\$/g, '$');
        replacement = SimpleRegex.unescapeSpecials(replacement);
        var apply = function (input) { return input.replace(pattern, replacement); };
        return {
            apply: apply,
            optionText: option,
        };
    };
    ReplaceModifier.prototype.getValue = function () {
        return this.replaceOption;
    };
    ReplaceModifier.prototype.getApplyFunc = function () {
        return this.replaceApply;
    };
    return ReplaceModifier;
}());
var CSP_HEADER_NAME = 'Content-Security-Policy';
var CspModifier =  (function () {
    function CspModifier(value, isAllowlist) {
        this.cspDirective = value;
        this.isAllowlist = isAllowlist;
        this.validateCspDirective();
    }
    CspModifier.prototype.getValue = function () {
        return this.cspDirective;
    };
    CspModifier.prototype.validateCspDirective = function () {
        if (!this.isAllowlist && !this.cspDirective) {
            throw new Error('Invalid $CSP rule: CSP directive must not be empty');
        }
        if (this.cspDirective) {
            var cspDirective = this.cspDirective.toLowerCase();
            if (cspDirective.indexOf('report-') >= 0) {
                throw new Error("Forbidden CSP directive: ".concat(cspDirective));
            }
        }
    };
    return CspModifier;
}());
var CookieModifier =  (function () {
    function CookieModifier(value) {
        this.optionValue = value || '';
        this.regex = null;
        this.cookieName = null;
        this.sameSite = null;
        this.maxAge = null;
        var parts = this.optionValue.split(/;/);
        if (parts.length < 1) {
            throw new Error("Cannot parse ".concat(this.optionValue));
        }
        var cookieName = parts[0];
        if (cookieName.startsWith('/') && cookieName.endsWith('/')) {
            var pattern = cookieName.substring(1, cookieName.length - 1);
            this.regex = new RegExp(pattern);
        }
        else {
            this.cookieName = cookieName;
        }
        if (parts.length > 1) {
            for (var i = 1; i < parts.length; i += 1) {
                var nameValue = parts[i].split('=');
                var optionName = nameValue[0];
                var optionValue = nameValue[1];
                if (optionName === CookieModifier.MAX_AGE) {
                    this.maxAge = parseInt(optionValue, 10);
                }
                else if (optionName === CookieModifier.SAME_SITE) {
                    this.sameSite = optionValue;
                }
                else {
                    throw new Error("Unknown $cookie option: ".concat(optionName));
                }
            }
        }
    }
    CookieModifier.prototype.getValue = function () {
        return this.optionValue;
    };
    CookieModifier.prototype.getCookieName = function () {
        return this.cookieName;
    };
    CookieModifier.prototype.getMaxAge = function () {
        return this.maxAge;
    };
    CookieModifier.prototype.getSameSite = function () {
        return this.sameSite;
    };
    CookieModifier.prototype.matches = function (name) {
        if (!name) {
            return false;
        }
        if (this.regex) {
            return this.regex.test(name);
        }
        if (this.cookieName) {
            return this.cookieName === name;
        }
        return true;
    };
    CookieModifier.prototype.isEmpty = function () {
        return !this.regex && !this.cookieName;
    };
    CookieModifier.MAX_AGE = 'maxAge';
    CookieModifier.SAME_SITE = 'sameSite';
    CookieModifier.isCookieModifier = function (m) {
        return m instanceof CookieModifier;
    };
    return CookieModifier;
}());
var _a$2;
var UniversalStealthOption;
(function (UniversalStealthOption) {
    UniversalStealthOption["HideSearchQueries"] = "searchqueries";
    UniversalStealthOption["DoNotTrack"] = "donottrack";
    UniversalStealthOption["ThirdPartyCookies"] = "3p-cookie";
    UniversalStealthOption["FirstPartyCookies"] = "1p-cookie";
    UniversalStealthOption["ThirdPartyCache"] = "3p-cache";
    UniversalStealthOption["ThirdPartyAuth"] = "3p-auth";
    UniversalStealthOption["WebRTC"] = "webrtc";
    UniversalStealthOption["Push"] = "push";
    UniversalStealthOption["Location"] = "location";
    UniversalStealthOption["Flash"] = "flash";
    UniversalStealthOption["Java"] = "java";
    UniversalStealthOption["HideReferrer"] = "referrer";
    UniversalStealthOption["UserAgent"] = "useragent";
    UniversalStealthOption["IP"] = "ip";
    UniversalStealthOption["XClientData"] = "xclientdata";
    UniversalStealthOption["DPI"] = "dpi";
})(UniversalStealthOption || (UniversalStealthOption = {}));
var StealthOptionName;
(function (StealthOptionName) {
    StealthOptionName["HideSearchQueries"] = "searchqueries";
    StealthOptionName["DoNotTrack"] = "donottrack";
    StealthOptionName["HideReferrer"] = "referrer";
    StealthOptionName["XClientData"] = "xclientdata";
    StealthOptionName["FirstPartyCookies"] = "1p-cookie";
    StealthOptionName["ThirdPartyCookies"] = "3p-cookie";
})(StealthOptionName || (StealthOptionName = {}));
var StealthModifierOptions = new Set(Object.values(StealthOptionName));
var UniversalStealthOptions = new Set(Object.values(UniversalStealthOption));
var StealthOption = (_a$2 = {
        NotSet: 0
    },
    _a$2[StealthOptionName.HideSearchQueries] = 1,
    _a$2[StealthOptionName.DoNotTrack] = 1 << 1,
    _a$2[StealthOptionName.HideReferrer] = 1 << 2,
    _a$2[StealthOptionName.XClientData] = 1 << 3,
    _a$2[StealthOptionName.FirstPartyCookies] = 1 << 4,
    _a$2[StealthOptionName.ThirdPartyCookies] = 1 << 5,
    _a$2);
var StealthModifier =  (function () {
    function StealthModifier(optionsStr) {
        this.PIPE_SEPARATOR = '|';
        this.options = StealthOption.NotSet;
        if (optionsStr.trim().length === 0) {
            return;
        }
        if (optionsStr.includes(',')) {
            throw new SyntaxError("Invalid separator of stealth options used: \"".concat(optionsStr, "\""));
        }
        var tokens = optionsStr.split(this.PIPE_SEPARATOR);
        for (var i = 0; i < tokens.length; i += 1) {
            var optionName = tokens[i].trim();
            if (optionName === '') {
                continue;
            }
            if (optionName.startsWith('~')) {
                throw new SyntaxError("Inverted $stealth modifier values are not allowed: \"".concat(optionsStr, "\""));
            }
            if (!StealthModifier.isValidStealthOption(optionName)) {
                throw new SyntaxError("Invalid $stealth option in modifier value: \"".concat(optionsStr, "\""));
            }
            if (!StealthModifier.isSupportedStealthOption(optionName)) {
                continue;
            }
            var option = StealthOption[optionName];
            if (this.options & option) {
                logger$1.debug("Duplicate $stealth modifier value \"".concat(optionName, "\" in \"").concat(optionsStr, "\""));
            }
            this.options |= option;
        }
        if (this.options === StealthOption.NotSet) {
            var msg = "$stealth modifier does not contain any options supported by browser extension: \"".concat(optionsStr, "\"");
            logger$1.debug(msg);
        }
    }
    StealthModifier.prototype.hasValues = function () {
        return this.options !== StealthOption.NotSet;
    };
    StealthModifier.prototype.hasStealthOption = function (optionName) {
        var option = StealthOption[optionName];
        return !!(option && this.options & option);
    };
    StealthModifier.isSupportedStealthOption = function (option) { return StealthModifierOptions.has(option); };
    StealthModifier.isValidStealthOption = function (option) { return UniversalStealthOptions.has(option); };
    return StealthModifier;
}());
var RedirectModifier =  (function () {
    function RedirectModifier(value, isAllowlist, isRedirectingOnlyBlocked) {
        if (isRedirectingOnlyBlocked === void 0) { isRedirectingOnlyBlocked = false; }
        this.isRedirectingOnlyBlocked = false;
        RedirectModifier.validate(value, isAllowlist);
        this.redirectTitle = value;
        this.isRedirectingOnlyBlocked = isRedirectingOnlyBlocked;
    }
    RedirectModifier.prototype.getValue = function () {
        return this.redirectTitle;
    };
    RedirectModifier.validate = function (redirectTitle, isAllowlist) {
        if (isAllowlist && !redirectTitle) {
            return;
        }
        if (!redirectTitle) {
            throw new SyntaxError('Invalid $redirect rule, redirect value must not be empty');
        }
        var redirects = scriptlets.redirects;
        if (!redirects.isRedirectResourceCompatibleWithAdg(redirectTitle)) {
            throw new SyntaxError('$redirect modifier is invalid');
        }
    };
    return RedirectModifier;
}());
function splitUrl(url) {
    var strippedUrl = url;
    var hash = '';
    var hashIndex = url.indexOf('#');
    if (hashIndex >= 0) {
        hash = url.slice(hashIndex);
        strippedUrl = url.slice(0, hashIndex);
    }
    var query = '';
    var queryIndex = url.indexOf('?');
    if (queryIndex >= 0) {
        query = strippedUrl.slice(queryIndex + 1);
        strippedUrl = strippedUrl.slice(0, queryIndex);
    }
    return {
        path: strippedUrl,
        query: query,
        hash: hash,
    };
}
function normalizeQuery(query) {
    var result = query
        .split('&')
        .filter(function (x) { return x && !x.startsWith('='); })
        .join('&');
    while (result.charAt(0) === '&') {
        result = result.slice(1);
    }
    return result;
}
function cleanUrlParamByRegExp(url, regExp, invert) {
    if (invert === void 0) { invert = false; }
    var searchIndex = url.indexOf('?');
    if (searchIndex === -1) {
        return url;
    }
    var split = splitUrl(url);
    var modifiedQuery;
    if (invert) {
        modifiedQuery = split.query
            .split('&')
            .filter(function (x) { return x; })
            .filter(function (x) { return x && x.match(regExp); })
            .join('&');
    }
    else {
        modifiedQuery = split.query
            .split('&')
            .filter(function (x) {
            var test = x.includes('=') ? x : "".concat(x, "=");
            return !test.match(regExp);
        })
            .join('&');
    }
    if (modifiedQuery === split.query) {
        return url;
    }
    modifiedQuery = normalizeQuery(modifiedQuery);
    var result = split.path;
    if (modifiedQuery) {
        result += "?".concat(modifiedQuery);
    }
    return result + split.hash;
}
var getRelativeUrl = function (url) {
    var i = url.indexOf('/', url.indexOf('://') + 3);
    return i !== -1 ? url.slice(i) : null;
};
var RemoveParamModifier =  (function () {
    function RemoveParamModifier(value) {
        this.mv3Valid = true;
        this.value = value;
        var rawValue = value;
        if (value.startsWith('~')) {
            rawValue = value.substring(1);
            this.mv3Valid = false;
        }
        if (rawValue.startsWith('/')) {
            this.valueRegExp = SimpleRegex.patternFromString(rawValue);
            this.mv3Valid = false;
        }
        else {
            if (rawValue.includes('|')) {
                throw new Error('Unsupported option in $removeparam: multiple values are not allowed');
            }
            this.valueRegExp = new RegExp("((^|&)(".concat(SimpleRegex.escapeRegexSpecials(rawValue), ")=[^&#]*)"), 'g');
        }
    }
    RemoveParamModifier.prototype.getValue = function () {
        return this.value;
    };
    RemoveParamModifier.prototype.getMV3Validity = function () {
        return this.mv3Valid;
    };
    RemoveParamModifier.prototype.removeParameters = function (url) {
        var sepIndex = url.indexOf('?');
        if (sepIndex < 0) {
            return url;
        }
        if (!this.value) {
            return url.substring(0, sepIndex);
        }
        if (sepIndex === url.length - 1) {
            return url;
        }
        if (this.value.startsWith('~')) {
            return cleanUrlParamByRegExp(url, this.valueRegExp, true);
        }
        return cleanUrlParamByRegExp(url, this.valueRegExp);
    };
    RemoveParamModifier.isRemoveParamModifier = function (m) {
        return m instanceof RemoveParamModifier;
    };
    return RemoveParamModifier;
}());
var RemoveHeaderModifier =  (function () {
    function RemoveHeaderModifier(value, isAllowlist) {
        this.value = value.toLowerCase();
        if (!isAllowlist && !this.value) {
            throw new SyntaxError('Invalid $removeheader rule, removeheader value must not be empty');
        }
        this.isRequestModifier = this.value.startsWith(RemoveHeaderModifier.REQUEST_PREFIX);
        var headerName = this.isRequestModifier
            ? this.value.substring(RemoveHeaderModifier.REQUEST_PREFIX.length)
            : this.value;
        this.valid = RemoveHeaderModifier.isAllowedHeader(headerName) && !headerName.includes(':');
        this.applicableHeaderName = this.valid ? headerName : null;
    }
    RemoveHeaderModifier.prototype.getValue = function () {
        return this.value;
    };
    Object.defineProperty(RemoveHeaderModifier.prototype, "isValid", {
        get: function () {
            return this.valid;
        },
        enumerable: false,
        configurable: true
    });
    RemoveHeaderModifier.prototype.getApplicableHeaderName = function (isRequestHeaders) {
        if (!this.applicableHeaderName) {
            return null;
        }
        if (isRequestHeaders !== this.isRequestModifier) {
            return null;
        }
        return this.applicableHeaderName;
    };
    RemoveHeaderModifier.isAllowedHeader = function (headerName) {
        return !this.FORBIDDEN_HEADERS.includes(headerName);
    };
    RemoveHeaderModifier.FORBIDDEN_HEADERS = [
        'access-control-allow-origin',
        'access-control-allow-credentials',
        'access-control-allow-headers',
        'access-control-allow-methods',
        'access-control-expose-headers',
        'access-control-max-age',
        'access-control-request-headers',
        'access-control-request-method',
        'origin',
        'timing-allow-origin',
        'allow',
        'cross-origin-embedder-policy',
        'cross-origin-opener-policy',
        'cross-origin-resource-policy',
        'content-security-policy',
        'content-security-policy-report-only',
        'expect-ct',
        'feature-policy',
        'origin-isolation',
        'strict-transport-security',
        'upgrade-insecure-requests',
        'x-content-type-options',
        'x-download-options',
        'x-frame-options',
        'x-permitted-cross-domain-policies',
        'x-powered-by',
        'x-xss-protection',
        'public-key-pins',
        'public-key-pins-report-only',
        'sec-websocket-key',
        'sec-websocket-extensions',
        'sec-websocket-accept',
        'sec-websocket-protocol',
        'sec-websocket-version',
        'p3p',
        'sec-fetch-mode',
        'sec-fetch-dest',
        'sec-fetch-site',
        'sec-fetch-user',
        'referrer-policy',
        'content-type',
        'content-length',
        'accept',
        'accept-encoding',
        'host',
        'connection',
        'transfer-encoding',
        'upgrade',
    ];
    RemoveHeaderModifier.REQUEST_PREFIX = 'request:';
    RemoveHeaderModifier.isRemoveHeaderModifier = function (m) {
        return m instanceof RemoveHeaderModifier;
    };
    return RemoveHeaderModifier;
}());
var AppModifier =  (function () {
    function AppModifier(apps) {
        if (!apps) {
            throw new SyntaxError('$app modifier cannot be empty');
        }
        var permittedApps = [];
        var restrictedApps = [];
        var parts = apps.split(SEPARATOR);
        for (var i = 0; i < parts.length; i += 1) {
            var app = parts[i];
            var restricted = false;
            if (app.startsWith('~')) {
                restricted = true;
                app = app.substring(1).trim();
            }
            if (app === '') {
                throw new SyntaxError("Empty app specified in \"".concat(apps, "\""));
            }
            if (restricted) {
                restrictedApps.push(app);
            }
            else {
                permittedApps.push(app);
            }
        }
        this.restrictedApps = restrictedApps.length > 0 ? restrictedApps : null;
        this.permittedApps = permittedApps.length > 0 ? permittedApps : null;
    }
    return AppModifier;
}());
var HTTPMethod;
(function (HTTPMethod) {
    HTTPMethod["GET"] = "GET";
    HTTPMethod["POST"] = "POST";
    HTTPMethod["PUT"] = "PUT";
    HTTPMethod["DELETE"] = "DELETE";
    HTTPMethod["PATCH"] = "PATCH";
    HTTPMethod["HEAD"] = "HEAD";
    HTTPMethod["OPTIONS"] = "OPTIONS";
    HTTPMethod["CONNECT"] = "CONNECT";
    HTTPMethod["TRACE"] = "TRACE";
})(HTTPMethod || (HTTPMethod = {}));
var MethodModifier =  (function () {
    function MethodModifier(methodsStr) {
        if (methodsStr === '') {
            throw new SyntaxError('$method modifier value cannot be empty');
        }
        var permittedMethods = [];
        var restrictedMethods = [];
        var parts = methodsStr.toUpperCase().split(MethodModifier.PIPE_SEPARATOR);
        for (var i = 0; i < parts.length; i += 1) {
            var method = parts[i].trim();
            var restricted = false;
            if (method.startsWith('~')) {
                restricted = true;
                method = method.substring(1);
            }
            if (!MethodModifier.isHTTPMethod(method)) {
                throw new SyntaxError("Invalid $method modifier value: ".concat(method));
            }
            if (restricted) {
                restrictedMethods.push(method);
            }
            else {
                permittedMethods.push(method);
            }
        }
        if (restrictedMethods.length > 0 && permittedMethods.length > 0) {
            throw new SyntaxError("Negated values cannot be mixed with non-negated values: ".concat(methodsStr));
        }
        this.restrictedValues = restrictedMethods.length > 0 ? restrictedMethods : null;
        this.permittedValues = permittedMethods.length > 0 ? permittedMethods : null;
    }
    MethodModifier.PIPE_SEPARATOR = '|';
    MethodModifier.isHTTPMethod = function (value) { return value in HTTPMethod; };
    return MethodModifier;
}());
var HeaderModifier =  (function () {
    function HeaderModifier(headerStr) {
        this.COLON_SEPARATOR = ':';
        this.FORWARD_SLASH = '/';
        if (headerStr === '') {
            throw new SyntaxError('$header modifier value cannot be empty');
        }
        var separatorIndex = headerStr.indexOf(this.COLON_SEPARATOR);
        if (separatorIndex === -1) {
            this.header = headerStr;
            this.value = null;
            return;
        }
        this.header = headerStr.slice(0, separatorIndex);
        var rawValue = headerStr.slice(separatorIndex + 1);
        if (rawValue === '') {
            throw new SyntaxError("Invalid $header modifier value: \"".concat(headerStr, "\""));
        }
        if (rawValue.startsWith(this.FORWARD_SLASH) && rawValue.endsWith(this.FORWARD_SLASH)) {
            this.value = new RegExp(rawValue.slice(1, -1));
        }
        else {
            this.value = rawValue;
        }
    }
    HeaderModifier.prototype.getHeaderModifierValue = function () {
        return {
            header: this.header,
            value: this.value,
        };
    };
    return HeaderModifier;
}());
var ToModifier =  (function () {
    function ToModifier(domainsStr) {
        if (!domainsStr) {
            throw new SyntaxError('$to modifier value cannot be empty');
        }
        var permittedDomains = [];
        var restrictedDomains = [];
        var parts = domainsStr.toLowerCase().split(ToModifier.PIPE_SEPARATOR);
        for (var i = 0; i < parts.length; i += 1) {
            var domain = parts[i].trim();
            var restricted = false;
            if (domain.startsWith('~')) {
                restricted = true;
                domain = domain.substring(1);
            }
            if (domain === '') {
                throw new SyntaxError("Empty domain specified in \"".concat(domainsStr, "\""));
            }
            if (restricted) {
                restrictedDomains.push(domain);
            }
            else {
                permittedDomains.push(domain);
            }
        }
        this.restrictedValues = restrictedDomains.length > 0 ? restrictedDomains : null;
        this.permittedValues = permittedDomains.length > 0 ? permittedDomains : null;
    }
    ToModifier.PIPE_SEPARATOR = '|';
    return ToModifier;
}());
var PERMISSIONS_POLICY_HEADER_NAME = 'Permissions-Policy';
var COMMA_SEPARATOR = ',';
var PIPE_SEPARATOR = '|';
var PermissionsModifier =  (function () {
    function PermissionsModifier(permissionPolicyStr, isAllowlist) {
        this.permissionPolicyDirective = permissionPolicyStr
            .replace(PermissionsModifier.RE_SEPARATOR_REPLACE, COMMA_SEPARATOR);
        PermissionsModifier.validatePermissionPolicyDirective(this.permissionPolicyDirective, isAllowlist);
    }
    PermissionsModifier.prototype.getValue = function () {
        return this.permissionPolicyDirective;
    };
    PermissionsModifier.validatePermissionPolicyDirective = function (directive, isAllowlist) {
        if (!isAllowlist && !directive) {
            throw new SyntaxError('Invalid $permissions rule: permissions directive must not be empty');
        }
    };
    PermissionsModifier.RE_SEPARATOR_REPLACE = new RegExp("(\\\\".concat(COMMA_SEPARATOR, "|\\").concat(PIPE_SEPARATOR, ")"), 'g');
    return PermissionsModifier;
}());
var CompatibilityTypes;
(function (CompatibilityTypes) {
    CompatibilityTypes[CompatibilityTypes["Extension"] = 1] = "Extension";
    CompatibilityTypes[CompatibilityTypes["CoreLibs"] = 2] = "CoreLibs";
    CompatibilityTypes[CompatibilityTypes["Dns"] = 4] = "Dns";
})(CompatibilityTypes || (CompatibilityTypes = {}));
var Configuration =  (function () {
    function Configuration(inputConfig) {
        this.defaultConfig = {
            engine: null,
            version: null,
            verbose: false,
            compatibility: null,
        };
        this.engine = null;
        this.version = null;
        this.verbose = false;
        this.compatibility = CompatibilityTypes.Extension;
        var config = __assign(__assign({}, this.defaultConfig), inputConfig);
        this.engine = config.engine;
        this.version = config.version;
        this.verbose = config.verbose;
        this.compatibility = config.compatibility;
    }
    return Configuration;
}());
var config = new Configuration();
function isCompatibleWith(compatibilityLevel) {
    if (config.compatibility === null) {
        return false;
    }
    return (config.compatibility & compatibilityLevel) === compatibilityLevel;
}
var NETWORK_RULE_OPTIONS = {
    THIRD_PARTY: 'third-party',
    FIRST_PARTY: 'first-party',
    MATCH_CASE: 'match-case',
    IMPORTANT: 'important',
    DOMAIN: 'domain',
    DENYALLOW: 'denyallow',
    ELEMHIDE: 'elemhide',
    GENERICHIDE: 'generichide',
    SPECIFICHIDE: 'specifichide',
    GENERICBLOCK: 'genericblock',
    JSINJECT: 'jsinject',
    URLBLOCK: 'urlblock',
    CONTENT: 'content',
    DOCUMENT: 'document',
    DOC: 'doc',
    STEALTH: 'stealth',
    POPUP: 'popup',
    EMPTY: 'empty',
    MP4: 'mp4',
    SCRIPT: 'script',
    STYLESHEET: 'stylesheet',
    SUBDOCUMENT: 'subdocument',
    OBJECT: 'object',
    IMAGE: 'image',
    XMLHTTPREQUEST: 'xmlhttprequest',
    MEDIA: 'media',
    FONT: 'font',
    WEBSOCKET: 'websocket',
    OTHER: 'other',
    PING: 'ping',
    BADFILTER: 'badfilter',
    CSP: 'csp',
    REPLACE: 'replace',
    COOKIE: 'cookie',
    REDIRECT: 'redirect',
    REDIRECTRULE: 'redirect-rule',
    REMOVEPARAM: 'removeparam',
    REMOVEHEADER: 'removeheader',
    JSONPRUNE: 'jsonprune',
    HLS: 'hls',
    REFERRERPOLICY: 'referrerpolicy',
    APP: 'app',
    NETWORK: 'network',
    EXTENSION: 'extension',
    NOOP: '_',
    CLIENT: 'client',
    DNSREWRITE: 'dnsrewrite',
    DNSTYPE: 'dnstype',
    CTAG: 'ctag',
    HEADER: 'header',
    METHOD: 'method',
    TO: 'to',
    PERMISSIONS: 'permissions',
    ALL: 'all',
};
var OPTIONS_DELIMITER = '$';
var MASK_ALLOWLIST = '@@';
var NOT_MARK = '~';
var RequestType$1 = {
    NotSet: 0,
    Document: 1,
    SubDocument: 2,
    Script: 4,
    Stylesheet: 8,
    Object: 16,
    Image: 32,
    XmlHttpRequest: 64,
    Media: 128,
    Font: 256,
    WebSocket: 512,
    Ping: 1024,
    CspReport: 2048,
    Other: 4096,
};
var BaseValuesModifier =  (function () {
    function BaseValuesModifier(values) {
        if (!values) {
            throw new SyntaxError('Modifier cannot be empty');
        }
        this.value = values;
        var permittedValues = [];
        var restrictedValues = [];
        var parts = values.split(SEPARATOR);
        for (var i = 0; i < parts.length; i += 1) {
            var app = parts[i];
            var restricted = false;
            if (app.startsWith('~')) {
                restricted = true;
                app = app.substring(1).trim();
            }
            if (app === '') {
                throw new SyntaxError("Empty values specified in \"".concat(values, "\""));
            }
            if (restricted) {
                restrictedValues.push(app);
            }
            else {
                permittedValues.push(app);
            }
        }
        this.restricted = restrictedValues.length > 0 ? restrictedValues : null;
        this.permitted = permittedValues.length > 0 ? permittedValues : null;
    }
    BaseValuesModifier.prototype.getPermitted = function () {
        return this.permitted;
    };
    BaseValuesModifier.prototype.getRestricted = function () {
        return this.restricted;
    };
    BaseValuesModifier.prototype.getValue = function () {
        return this.value;
    };
    BaseValuesModifier.prototype.match = function (value) {
        if (!this.restricted && !this.permitted) {
            return true;
        }
        if (this.restricted && this.restricted.includes(value)) {
            return false;
        }
        if (this.permitted) {
            return this.permitted.includes(value);
        }
        return true;
    };
    return BaseValuesModifier;
}());
var NetmasksCollection =  (function () {
    function NetmasksCollection() {
        this.ipv4Masks = [];
        this.ipv6Masks = [];
    }
    NetmasksCollection.prototype.contains = function (value) {
        if (isIp$1.v4(value)) {
            return this.ipv4Masks.some(function (x) { return contains(x, value); });
        }
        return this.ipv6Masks.some(function (x) { return contains(x, value); });
    };
    return NetmasksCollection;
}());
var ClientModifier =  (function (_super) {
    __extends(ClientModifier, _super);
    function ClientModifier(value) {
        var _this = _super.call(this, value) || this;
        var permitted = _this.getPermitted();
        if (permitted) {
            _this.permitted = ClientModifier.stripValues(permitted);
            _this.permittedNetmasks = ClientModifier.parseNetmasks(_this.permitted);
        }
        var restricted = _this.getRestricted();
        if (restricted) {
            _this.restricted = ClientModifier.stripValues(restricted);
            _this.restrictedNetmasks = ClientModifier.parseNetmasks(_this.restricted);
        }
        return _this;
    }
    ClientModifier.stripValues = function (values) {
        return values.map(function (v) {
            if ((v.startsWith('"') && v.endsWith('"'))
                || (v.startsWith('\'') && v.endsWith('\''))) {
                v = v.substr(1, v.length - 2);
            }
            return v.replace(/\\/ig, '');
        });
    };
    ClientModifier.prototype.matchAny = function (clientName, clientIP) {
        if (this.restricted) {
            if (clientName && this.restricted.includes(clientName)) {
                return false;
            }
            if (clientIP && this.restricted.includes(clientIP)) {
                return false;
            }
            return true;
        }
        if (this.restrictedNetmasks) {
            if (clientIP && this.restrictedNetmasks.contains(clientIP)) {
                return false;
            }
            return true;
        }
        if (this.permitted) {
            if (clientName && this.permitted.includes(clientName)) {
                return true;
            }
            if (clientIP && this.permitted.includes(clientIP)) {
                return true;
            }
        }
        if (this.permittedNetmasks) {
            if (clientIP && this.permittedNetmasks.contains(clientIP)) {
                return true;
            }
        }
        return false;
    };
    ClientModifier.parseNetmasks = function (values) {
        var result = new NetmasksCollection();
        values.forEach(function (x) {
            var cidrVersion = isCidr$1(x);
            if (cidrVersion === 4) {
                result.ipv4Masks.push(x);
            }
            else if (cidrVersion === 6) {
                result.ipv6Masks.push(x);
            }
        });
        return result;
    };
    return ClientModifier;
}(BaseValuesModifier));
var DnsRewriteModifier =  (function () {
    function DnsRewriteModifier(value) {
        this.value = value;
    }
    DnsRewriteModifier.prototype.getValue = function () {
        return this.value;
    };
    return DnsRewriteModifier;
}());
var DnsTypeModifier =  (function (_super) {
    __extends(DnsTypeModifier, _super);
    function DnsTypeModifier(value) {
        var _this = _super.call(this, value) || this;
        if (_this.permitted) {
            _this.restricted = null;
        }
        return _this;
    }
    return DnsTypeModifier;
}(BaseValuesModifier));
var CtagModifier =  (function (_super) {
    __extends(CtagModifier, _super);
    function CtagModifier(value) {
        var _this = _super.call(this, value) || this;
        _this.validate();
        return _this;
    }
    CtagModifier.prototype.validate = function () {
        if (!this.getValue()) {
            throw new Error('Invalid rule: Ctag modifier must not be empty');
        }
        var tags = this.permitted ? this.permitted : this.restricted;
        if (tags && tags.some(function (x) { return !CtagModifier.ALLOWED_TAGS.includes(x); })) {
            throw new Error('Invalid rule: Invalid ctag modifier');
        }
    };
    CtagModifier.ALLOWED_TAGS = [
        'device_audio',
        'device_camera',
        'device_gameconsole',
        'device_laptop',
        'device_nas',
        'device_pc',
        'device_phone',
        'device_printer',
        'device_securityalarm',
        'device_tablet',
        'device_tv',
        'device_other',
        'os_android',
        'os_ios',
        'os_linux',
        'os_macos',
        'os_windows',
        'os_other',
        'user_admin',
        'user_regular',
        'user_child',
    ];
    return CtagModifier;
}(BaseValuesModifier));
var Pattern =  (function () {
    function Pattern(pattern, matchcase) {
        if (matchcase === void 0) { matchcase = false; }
        this.pattern = pattern;
        this.shortcut = SimpleRegex.extractShortcut(this.pattern);
        this.matchcase = matchcase;
    }
    Pattern.prototype.matchPattern = function (request, shortcutMatched) {
        this.prepare();
        if (this.patternShortcut) {
            return shortcutMatched || this.matchShortcut(request.urlLowercase);
        }
        if (this.hostname) {
            return request.hostname === this.hostname
                || (
                request.hostname.endsWith(this.hostname)
                    && request.hostname.endsWith(".".concat(this.hostname)));
        }
        if (this.regexInvalid || !this.regex) {
            return false;
        }
        if (this.shouldMatchHostname(request)) {
            return this.regex.test(request.hostname);
        }
        return this.regex.test(request.url);
    };
    Pattern.prototype.matchPathPattern = function (path) {
        this.prepare();
        if (this.hostname) {
            return false;
        }
        var pathIsEmptyString = this.pattern === '';
        if (pathIsEmptyString && path === '/') {
            return true;
        }
        if (!pathIsEmptyString && this.patternShortcut) {
            return this.matchShortcut(path);
        }
        if (this.regexInvalid || !this.regex) {
            return false;
        }
        return this.regex.test(path);
    };
    Pattern.prototype.matchShortcut = function (str) {
        return str.indexOf(this.shortcut) >= 0;
    };
    Pattern.prototype.prepare = function () {
        if (this.prepared) {
            return;
        }
        this.prepared = true;
        if (this.pattern === this.shortcut && !this.matchcase) {
            this.patternShortcut = true;
            return;
        }
        if (this.pattern.startsWith(this.shortcut)
            && this.pattern.length === this.shortcut.length + 1
            && this.pattern.endsWith('*')) {
            this.patternShortcut = true;
            return;
        }
        if (this.pattern.startsWith(SimpleRegex.MASK_START_URL)
            && this.pattern.endsWith(SimpleRegex.MASK_SEPARATOR)
            && this.pattern.indexOf('*') < 0
            && this.pattern.indexOf('/') < 0) {
            this.hostname = this.pattern.slice(2, this.pattern.length - 1);
            return;
        }
        this.compileRegex();
    };
    Pattern.prototype.compileRegex = function () {
        var regexText = SimpleRegex.patternToRegexp(this.pattern);
        try {
            var flags = 'i';
            if (this.matchcase) {
                flags = '';
            }
            this.regex = new RegExp(regexText, flags);
        }
        catch (e) {
            this.regexInvalid = true;
        }
    };
    Pattern.prototype.shouldMatchHostname = function (request) {
        if (!request.isHostnameRequest) {
            return false;
        }
        return !this.isPatternDomainSpecific();
    };
    Pattern.prototype.isPatternDomainSpecific = function () {
        if (this.patternDomainSpecific === undefined) {
            this.patternDomainSpecific = this.pattern.startsWith(SimpleRegex.MASK_START_URL)
                || this.pattern.startsWith('http://')
                || this.pattern.startsWith('https:/')
                || this.pattern.startsWith('://');
        }
        return this.patternDomainSpecific;
    };
    return Pattern;
}());
function getBitCount(a) {
    var count = 0;
    var n = a;
    while (n > 0) {
        count += n & 1;
        n >>= 1;
    }
    return count;
}
function countEnabledBits(base, mask) {
    var common = base & mask;
    return getBitCount(common);
}
var NetworkRuleOption;
(function (NetworkRuleOption) {
    NetworkRuleOption[NetworkRuleOption["NotSet"] = 0] = "NotSet";
    NetworkRuleOption[NetworkRuleOption["ThirdParty"] = 1] = "ThirdParty";
    NetworkRuleOption[NetworkRuleOption["MatchCase"] = 2] = "MatchCase";
    NetworkRuleOption[NetworkRuleOption["Important"] = 4] = "Important";
    NetworkRuleOption[NetworkRuleOption["Elemhide"] = 8] = "Elemhide";
    NetworkRuleOption[NetworkRuleOption["Generichide"] = 16] = "Generichide";
    NetworkRuleOption[NetworkRuleOption["Specifichide"] = 32] = "Specifichide";
    NetworkRuleOption[NetworkRuleOption["Genericblock"] = 64] = "Genericblock";
    NetworkRuleOption[NetworkRuleOption["Jsinject"] = 128] = "Jsinject";
    NetworkRuleOption[NetworkRuleOption["Urlblock"] = 256] = "Urlblock";
    NetworkRuleOption[NetworkRuleOption["Content"] = 512] = "Content";
    NetworkRuleOption[NetworkRuleOption["Extension"] = 1024] = "Extension";
    NetworkRuleOption[NetworkRuleOption["Stealth"] = 2048] = "Stealth";
    NetworkRuleOption[NetworkRuleOption["Popup"] = 4096] = "Popup";
    NetworkRuleOption[NetworkRuleOption["Csp"] = 8192] = "Csp";
    NetworkRuleOption[NetworkRuleOption["Replace"] = 16384] = "Replace";
    NetworkRuleOption[NetworkRuleOption["Cookie"] = 32768] = "Cookie";
    NetworkRuleOption[NetworkRuleOption["Redirect"] = 65536] = "Redirect";
    NetworkRuleOption[NetworkRuleOption["Badfilter"] = 131072] = "Badfilter";
    NetworkRuleOption[NetworkRuleOption["RemoveParam"] = 262144] = "RemoveParam";
    NetworkRuleOption[NetworkRuleOption["RemoveHeader"] = 524288] = "RemoveHeader";
    NetworkRuleOption[NetworkRuleOption["JsonPrune"] = 1048576] = "JsonPrune";
    NetworkRuleOption[NetworkRuleOption["Hls"] = 2097152] = "Hls";
    NetworkRuleOption[NetworkRuleOption["Network"] = 4194304] = "Network";
    NetworkRuleOption[NetworkRuleOption["Client"] = 8388608] = "Client";
    NetworkRuleOption[NetworkRuleOption["DnsRewrite"] = 16777216] = "DnsRewrite";
    NetworkRuleOption[NetworkRuleOption["DnsType"] = 33554432] = "DnsType";
    NetworkRuleOption[NetworkRuleOption["Ctag"] = 67108864] = "Ctag";
    NetworkRuleOption[NetworkRuleOption["Method"] = 134217728] = "Method";
    NetworkRuleOption[NetworkRuleOption["To"] = 268435456] = "To";
    NetworkRuleOption[NetworkRuleOption["Permissions"] = 536870912] = "Permissions";
    NetworkRuleOption[NetworkRuleOption["Header"] = 1073741824] = "Header";
})(NetworkRuleOption || (NetworkRuleOption = {}));
var NetworkRuleGroupOptions;
(function (NetworkRuleGroupOptions) {
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["AllowlistOnly"] = 4088] = "AllowlistOnly";
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["OptionHostLevelRules"] = 125960196] = "OptionHostLevelRules";
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["CosmeticOption"] = 696] = "CosmeticOption";
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["RemoveParamCompatibleOptions"] = 393223] = "RemoveParamCompatibleOptions";
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["RemoveHeaderCompatibleOptions"] = 1074397191] = "RemoveHeaderCompatibleOptions";
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["PermissionsCompatibleOptions"] = 537001988] = "PermissionsCompatibleOptions";
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["HeaderCompatibleOptions"] = 1074405380] = "HeaderCompatibleOptions";
})(NetworkRuleGroupOptions || (NetworkRuleGroupOptions = {}));
var NetworkRule =  (function () {
    function NetworkRule(node, filterListId, ruleIndex) {
        if (ruleIndex === void 0) { ruleIndex = RULE_INDEX_NONE; }
        var _a, _b;
        this.denyAllowDomains = null;
        this.enabledOptions = NetworkRuleOption.NotSet;
        this.disabledOptions = NetworkRuleOption.NotSet;
        this.permittedRequestTypes = RequestType$1.NotSet;
        this.restrictedRequestTypes = RequestType$1.NotSet;
        this.advancedModifier = null;
        this.domainModifier = null;
        this.appModifier = null;
        this.methodModifier = null;
        this.headerModifier = null;
        this.toModifier = null;
        this.stealthModifier = null;
        this.usedOptionNames = new Set();
        this.priorityWeight = 1;
        this.ruleIndex = ruleIndex;
        this.ruleText = RuleParser.generate(node);
        this.filterListId = filterListId;
        this.allowlist = node.exception;
        var pattern = node.pattern.value;
        if (pattern && hasSpaces(pattern)) {
            throw new SyntaxError('Rule has spaces, seems to be an host rule');
        }
        if ((_b = (_a = node.modifiers) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.length) {
            this.loadOptions(node.modifiers);
        }
        if (NetworkRule.isTooGeneral(node)) {
            throw new SyntaxError("Rule is too general: ".concat(RuleParser.generate(node)));
        }
        this.calculatePriorityWeight();
        this.pattern = new Pattern(pattern, this.isOptionEnabled(NetworkRuleOption.MatchCase));
    }
    NetworkRule.prototype.getText = function () {
        return this.ruleText;
    };
    NetworkRule.prototype.getIndex = function () {
        return this.ruleIndex;
    };
    NetworkRule.prototype.getFilterListId = function () {
        return this.filterListId;
    };
    NetworkRule.prototype.getUsedOptionNames = function () {
        return this.usedOptionNames;
    };
    NetworkRule.prototype.getPriorityWeight = function () {
        return this.priorityWeight;
    };
    NetworkRule.prototype.getPattern = function () {
        return this.pattern.pattern;
    };
    NetworkRule.prototype.isAllowlist = function () {
        return this.allowlist;
    };
    NetworkRule.prototype.isDocumentLevelAllowlistRule = function () {
        if (!this.isAllowlist()) {
            return false;
        }
        return this.isOptionEnabled(NetworkRuleOption.Urlblock)
            || this.isOptionEnabled(NetworkRuleOption.Genericblock)
            || this.isOptionEnabled(NetworkRuleOption.Content);
    };
    NetworkRule.prototype.isFilteringDisabled = function () {
        if (!this.isAllowlist()) {
            return false;
        }
        return this.isOptionEnabled(NetworkRuleOption.Elemhide)
            && this.isOptionEnabled(NetworkRuleOption.Content)
            && this.isOptionEnabled(NetworkRuleOption.Urlblock)
            && this.isOptionEnabled(NetworkRuleOption.Jsinject);
    };
    NetworkRule.prototype.getShortcut = function () {
        return this.pattern.shortcut;
    };
    NetworkRule.prototype.getPermittedDomains = function () {
        if (this.domainModifier) {
            return this.domainModifier.getPermittedDomains();
        }
        return null;
    };
    NetworkRule.prototype.getRestrictedDomains = function () {
        if (this.domainModifier) {
            return this.domainModifier.getRestrictedDomains();
        }
        return null;
    };
    NetworkRule.prototype.getDenyAllowDomains = function () {
        return this.denyAllowDomains;
    };
    NetworkRule.prototype.getPermittedToDomains = function () {
        if (this.toModifier) {
            return this.toModifier.permittedValues;
        }
        return null;
    };
    NetworkRule.prototype.getRestrictedToDomains = function () {
        if (this.toModifier) {
            return this.toModifier.restrictedValues;
        }
        return null;
    };
    NetworkRule.prototype.getPermittedApps = function () {
        if (this.appModifier) {
            return this.appModifier.permittedApps;
        }
        return null;
    };
    NetworkRule.prototype.getRestrictedApps = function () {
        if (this.appModifier) {
            return this.appModifier.restrictedApps;
        }
        return null;
    };
    NetworkRule.prototype.getRestrictedMethods = function () {
        if (this.methodModifier) {
            return this.methodModifier.restrictedValues;
        }
        return null;
    };
    NetworkRule.prototype.getPermittedMethods = function () {
        if (this.methodModifier) {
            return this.methodModifier.permittedValues;
        }
        return null;
    };
    NetworkRule.prototype.getPermittedRequestTypes = function () {
        return this.permittedRequestTypes;
    };
    NetworkRule.prototype.getRestrictedRequestTypes = function () {
        return this.restrictedRequestTypes;
    };
    NetworkRule.prototype.getAdvancedModifier = function () {
        return this.advancedModifier;
    };
    NetworkRule.prototype.getStealthModifier = function () {
        return this.stealthModifier;
    };
    NetworkRule.prototype.getAdvancedModifierValue = function () {
        return this.advancedModifier && this.advancedModifier.getValue();
    };
    NetworkRule.prototype.getHeaderModifierValue = function () {
        if (!this.headerModifier) {
            return null;
        }
        return this.headerModifier.getHeaderModifierValue();
    };
    NetworkRule.prototype.isRegexRule = function () {
        return (this.getPattern().startsWith(SimpleRegex.MASK_REGEX_RULE)
            && this.getPattern().endsWith(SimpleRegex.MASK_REGEX_RULE));
    };
    NetworkRule.prototype.match = function (request, useShortcut) {
        if (useShortcut === void 0) { useShortcut = true; }
        if (useShortcut && !this.matchShortcut(request)) {
            return false;
        }
        if (this.isOptionEnabled(NetworkRuleOption.Method) && !this.matchMethod(request.method)) {
            return false;
        }
        if (this.isOptionEnabled(NetworkRuleOption.ThirdParty) && !request.thirdParty) {
            return false;
        }
        if (this.isOptionDisabled(NetworkRuleOption.ThirdParty) && request.thirdParty) {
            return false;
        }
        if (!this.matchRequestType(request.requestType)) {
            return false;
        }
        if (!this.matchDomainModifier(request)) {
            return false;
        }
        if (this.isOptionEnabled(NetworkRuleOption.RemoveParam)
            || this.isOptionEnabled(NetworkRuleOption.Permissions)) {
            if (!this.matchRequestTypeExplicit(request.requestType)) {
                return false;
            }
        }
        if (!this.matchDenyAllowDomains(request.hostname)) {
            return false;
        }
        if (this.isOptionEnabled(NetworkRuleOption.To) && !this.matchToModifier(request.hostname)) {
            return false;
        }
        if (!this.matchDnsType(request.dnsType)) {
            return false;
        }
        if (!this.matchClientTags(request.clientTags)) {
            return false;
        }
        if (!this.matchClient(request.clientName, request.clientIP)) {
            return false;
        }
        return this.pattern.matchPattern(request, true);
    };
    NetworkRule.prototype.matchShortcut = function (request) {
        return request.urlLowercase.indexOf(this.getShortcut()) >= 0;
    };
    NetworkRule.prototype.matchDomainModifier = function (request) {
        if (!this.domainModifier) {
            return true;
        }
        var domainModifier = this.domainModifier;
        var isDocumentType = request.requestType === RequestType$1.Document;
        var hasOnlyExcludedDomains = !domainModifier.hasPermittedDomains()
            && domainModifier.hasRestrictedDomains();
        var patternIsRegex = this.isRegexRule();
        var patternIsDomainSpecific = this.pattern.isPatternDomainSpecific();
        var matchesTargetByPatternCondition = !patternIsRegex && !patternIsDomainSpecific;
        if (isDocumentType && (hasOnlyExcludedDomains || matchesTargetByPatternCondition)) {
            return (request.sourceHostname && domainModifier.matchDomain(request.sourceHostname))
                || domainModifier.matchDomain(request.hostname);
        }
        return domainModifier.matchDomain(request.sourceHostname || '');
    };
    NetworkRule.prototype.matchDenyAllowDomains = function (domain) {
        if (!this.denyAllowDomains) {
            return true;
        }
        if (this.denyAllowDomains.length > 0) {
            if (DomainModifier.isDomainOrSubdomainOfAny(domain, this.denyAllowDomains)) {
                return false;
            }
        }
        return true;
    };
    NetworkRule.prototype.matchToModifier = function (domain) {
        if (!this.toModifier) {
            return true;
        }
        var permittedDomains = this.getPermittedToDomains();
        var restrictedDomains = this.getRestrictedToDomains();
        var matches = false;
        if (permittedDomains) {
            matches = DomainModifier.isDomainOrSubdomainOfAny(domain, permittedDomains);
        }
        if (restrictedDomains) {
            matches = !DomainModifier.isDomainOrSubdomainOfAny(domain, restrictedDomains);
        }
        return matches;
    };
    NetworkRule.prototype.matchClientTags = function (clientTags) {
        var advancedModifier = this.getAdvancedModifier();
        if (!advancedModifier || !(advancedModifier instanceof CtagModifier)) {
            return true;
        }
        if (!clientTags) {
            return false;
        }
        var cTagsModifier = advancedModifier;
        return clientTags.every(function (x) { return cTagsModifier.match(x); });
    };
    NetworkRule.prototype.matchClient = function (clientName, clientIP) {
        var advancedModifier = this.getAdvancedModifier();
        if (!advancedModifier || !(advancedModifier instanceof ClientModifier)) {
            return true;
        }
        if (!clientName && !clientIP) {
            return false;
        }
        var modifier = advancedModifier;
        return modifier.matchAny(clientName, clientIP);
    };
    NetworkRule.prototype.matchDnsType = function (dnstype) {
        var advancedModifier = this.getAdvancedModifier();
        if (!advancedModifier || !(advancedModifier instanceof DnsTypeModifier)) {
            return true;
        }
        if (!dnstype) {
            return false;
        }
        var modifier = advancedModifier;
        return modifier.match(dnstype);
    };
    NetworkRule.prototype.hasPermittedApps = function () {
        if (!this.appModifier) {
            return false;
        }
        return this.appModifier.permittedApps !== null && this.appModifier.permittedApps.length > 0;
    };
    NetworkRule.prototype.matchRequestType = function (requestType) {
        if (this.permittedRequestTypes !== RequestType$1.NotSet) {
            if ((this.permittedRequestTypes & requestType) !== requestType) {
                return false;
            }
        }
        if (this.restrictedRequestTypes !== RequestType$1.NotSet) {
            if ((this.restrictedRequestTypes & requestType) === requestType) {
                return false;
            }
        }
        return true;
    };
    NetworkRule.prototype.matchRequestTypeExplicit = function (requestType) {
        if (this.permittedRequestTypes === RequestType$1.NotSet
            && this.restrictedRequestTypes === RequestType$1.NotSet
            && requestType !== RequestType$1.Document
            && requestType !== RequestType$1.SubDocument) {
            return false;
        }
        return this.matchRequestType(requestType);
    };
    NetworkRule.prototype.matchMethod = function (method) {
        if (!method || !MethodModifier.isHTTPMethod(method)) {
            return false;
        }
        var permittedMethods = this.getPermittedMethods();
        if (permittedMethods === null || permittedMethods === void 0 ? void 0 : permittedMethods.includes(method)) {
            return true;
        }
        var restrictedMethods = this.getRestrictedMethods();
        return !!restrictedMethods && !restrictedMethods.includes(method);
    };
    NetworkRule.prototype.matchResponseHeaders = function (responseHeadersItems) {
        if (!responseHeadersItems || responseHeadersItems.length === 0) {
            return false;
        }
        var ruleData = this.getHeaderModifierValue();
        if (!ruleData) {
            return false;
        }
        var ruleHeaderName = ruleData.header, ruleHeaderValue = ruleData.value;
        return responseHeadersItems.some(function (responseHeadersItem) {
            var responseHeaderName = responseHeadersItem.name, responseHeaderValue = responseHeadersItem.value;
            if (ruleHeaderName.toLowerCase() !== responseHeaderName.toLowerCase()) {
                return false;
            }
            if (ruleHeaderValue === null) {
                return true;
            }
            if (typeof ruleHeaderValue === 'string') {
                return ruleHeaderValue === responseHeaderValue;
            }
            if (responseHeaderValue && ruleHeaderValue instanceof RegExp) {
                return ruleHeaderValue.test(responseHeaderValue);
            }
            return false;
        });
    };
    NetworkRule.isTooGeneral = function (node) {
        var _a, _b;
        return !((_b = (_a = node.modifiers) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.length) && node.pattern.value.length < 4;
    };
    NetworkRule.prototype.loadOptions = function (options) {
        for (var _i = 0, _a = options.children; _i < _a.length; _i++) {
            var option = _a[_i];
            var value = EMPTY_STRING;
            if (option.value && option.value.value) {
                value = option.value.value;
            }
            this.loadOption(option.name.value, value, option.exception);
            this.usedOptionNames.add(option.name.value);
        }
        this.validateOptions();
    };
    NetworkRule.prototype.hasOption = function (option) {
        return this.isOptionEnabled(option) || this.isOptionDisabled(option);
    };
    NetworkRule.prototype.hasCosmeticOption = function () {
        return (this.enabledOptions & NetworkRuleGroupOptions.CosmeticOption) !== 0;
    };
    NetworkRule.prototype.isOptionEnabled = function (option) {
        return (this.enabledOptions & option) === option;
    };
    NetworkRule.prototype.isSingleOptionEnabled = function (option) {
        return this.enabledOptions === option;
    };
    NetworkRule.prototype.isOptionDisabled = function (option) {
        return (this.disabledOptions & option) === option;
    };
    NetworkRule.prototype.isHigherPriority = function (r) {
        return this.priorityWeight > r.priorityWeight;
    };
    NetworkRule.prototype.isGeneric = function () {
        var _a;
        return !((_a = this.domainModifier) === null || _a === void 0 ? void 0 : _a.hasPermittedDomains());
    };
    NetworkRule.prototype.negatesBadfilter = function (specifiedRule) {
        if (!this.isOptionEnabled(NetworkRuleOption.Badfilter)) {
            return false;
        }
        if (this.allowlist !== specifiedRule.allowlist) {
            return false;
        }
        if (this.pattern.pattern !== specifiedRule.pattern.pattern) {
            return false;
        }
        if (this.permittedRequestTypes !== specifiedRule.permittedRequestTypes) {
            return false;
        }
        if (this.restrictedRequestTypes !== specifiedRule.restrictedRequestTypes) {
            return false;
        }
        if ((this.enabledOptions ^ NetworkRuleOption.Badfilter) !== specifiedRule.enabledOptions) {
            return false;
        }
        if (this.disabledOptions !== specifiedRule.disabledOptions) {
            return false;
        }
        if (!stringArraysEquals(this.getRestrictedDomains(), specifiedRule.getRestrictedDomains())) {
            return false;
        }
        if (!stringArraysHaveIntersection(this.getPermittedDomains(), specifiedRule.getPermittedDomains())) {
            return false;
        }
        return true;
    };
    NetworkRule.prototype.isHostLevelNetworkRule = function () {
        var _a, _b;
        if (((_a = this.domainModifier) === null || _a === void 0 ? void 0 : _a.hasPermittedDomains()) || ((_b = this.domainModifier) === null || _b === void 0 ? void 0 : _b.hasRestrictedDomains())) {
            return false;
        }
        if (this.permittedRequestTypes !== 0 && this.restrictedRequestTypes !== 0) {
            return false;
        }
        if (this.disabledOptions !== NetworkRuleOption.NotSet) {
            return false;
        }
        if (this.enabledOptions !== NetworkRuleOption.NotSet) {
            return ((this.enabledOptions
                & NetworkRuleGroupOptions.OptionHostLevelRules)
                | (this.enabledOptions
                    ^ NetworkRuleGroupOptions.OptionHostLevelRules)) === NetworkRuleGroupOptions.OptionHostLevelRules;
        }
        return true;
    };
    NetworkRule.prototype.setOptionEnabled = function (option, enabled, skipRestrictions) {
        if (skipRestrictions === void 0) { skipRestrictions = false; }
        if (!skipRestrictions) {
            if (!this.allowlist && (option & NetworkRuleGroupOptions.AllowlistOnly) === option) {
                throw new SyntaxError("Modifier ".concat(NetworkRuleOption[option], " cannot be used in blacklist rule"));
            }
        }
        if (enabled) {
            this.enabledOptions |= option;
        }
        else {
            this.disabledOptions |= option;
        }
    };
    NetworkRule.prototype.setRequestType = function (requestType, permitted) {
        if (permitted) {
            this.permittedRequestTypes |= requestType;
        }
        else {
            this.restrictedRequestTypes |= requestType;
        }
    };
    NetworkRule.prototype.setDenyAllowDomains = function (optionValue) {
        var domainModifier = new DomainModifier(optionValue, PIPE_SEPARATOR$1);
        if (domainModifier.restrictedDomains && domainModifier.restrictedDomains.length > 0) {
            throw new SyntaxError('Invalid modifier: $denyallow domains cannot be negated');
        }
        if (domainModifier.permittedDomains) {
            if (domainModifier.permittedDomains.some(DomainModifier.isWildcardOrRegexDomain)) {
                throw new SyntaxError('Invalid modifier: $denyallow does not support wildcards and regex domains');
            }
        }
        this.denyAllowDomains = domainModifier.permittedDomains;
    };
    NetworkRule.prototype.loadOption = function (optionName, optionValue, exception) {
        var _this = this;
        if (exception === void 0) { exception = false; }
        var OPTIONS = NetworkRule.OPTIONS, NEGATABLE_OPTIONS = NetworkRule.NEGATABLE_OPTIONS;
        if (optionName.startsWith(OPTIONS.NOOP)) {
            if (!optionName.split(OPTIONS.NOOP).some(function (s) { return !!s; })) {
                return;
            }
        }
        if (exception && !NEGATABLE_OPTIONS.has(optionName)) {
            throw new SyntaxError("Invalid modifier: '".concat(optionName, "' cannot be negated"));
        }
        switch (optionName) {
            case OPTIONS.FIRST_PARTY:
                this.setOptionEnabled(NetworkRuleOption.ThirdParty, exception);
                break;
            case OPTIONS.THIRD_PARTY:
                this.setOptionEnabled(NetworkRuleOption.ThirdParty, !exception);
                break;
            case OPTIONS.MATCH_CASE:
                this.setOptionEnabled(NetworkRuleOption.MatchCase, !exception);
                break;
            case OPTIONS.IMPORTANT:
                this.setOptionEnabled(NetworkRuleOption.Important, true);
                break;
            case OPTIONS.DOMAIN:
                this.domainModifier = new DomainModifier(optionValue, PIPE_SEPARATOR$1);
                break;
            case OPTIONS.DENYALLOW:
                this.setDenyAllowDomains(optionValue);
                break;
            case OPTIONS.METHOD: {
                this.setOptionEnabled(NetworkRuleOption.Method, true);
                this.methodModifier = new MethodModifier(optionValue);
                break;
            }
            case OPTIONS.HEADER:
                this.setOptionEnabled(NetworkRuleOption.Header, true);
                this.headerModifier = new HeaderModifier(optionValue);
                break;
            case OPTIONS.TO: {
                this.setOptionEnabled(NetworkRuleOption.To, true);
                this.toModifier = new ToModifier(optionValue);
                break;
            }
            case OPTIONS.ELEMHIDE:
                this.setOptionEnabled(NetworkRuleOption.Elemhide, true);
                this.setRequestType(RequestType$1.Document, true);
                this.setRequestType(RequestType$1.SubDocument, true);
                break;
            case OPTIONS.GENERICHIDE:
                this.setOptionEnabled(NetworkRuleOption.Generichide, true);
                this.setRequestType(RequestType$1.Document, true);
                this.setRequestType(RequestType$1.SubDocument, true);
                break;
            case OPTIONS.SPECIFICHIDE:
                this.setOptionEnabled(NetworkRuleOption.Specifichide, true);
                this.setRequestType(RequestType$1.Document, true);
                this.setRequestType(RequestType$1.SubDocument, true);
                break;
            case OPTIONS.GENERICBLOCK:
                this.setOptionEnabled(NetworkRuleOption.Genericblock, true);
                this.setRequestType(RequestType$1.Document, true);
                this.setRequestType(RequestType$1.SubDocument, true);
                break;
            case OPTIONS.JSINJECT:
                this.setOptionEnabled(NetworkRuleOption.Jsinject, true);
                this.setRequestType(RequestType$1.Document, true);
                this.setRequestType(RequestType$1.SubDocument, true);
                break;
            case OPTIONS.URLBLOCK:
                this.setOptionEnabled(NetworkRuleOption.Urlblock, true);
                this.setRequestType(RequestType$1.Document, true);
                this.setRequestType(RequestType$1.SubDocument, true);
                break;
            case OPTIONS.CONTENT:
                this.setOptionEnabled(NetworkRuleOption.Content, true);
                this.setRequestType(RequestType$1.Document, true);
                this.setRequestType(RequestType$1.SubDocument, true);
                break;
            case OPTIONS.DOCUMENT:
            case OPTIONS.DOC:
                if (exception) {
                    this.setRequestType(RequestType$1.Document, false);
                    break;
                }
                this.setRequestType(RequestType$1.Document, true);
                if (this.isAllowlist()) {
                    this.setOptionEnabled(NetworkRuleOption.Elemhide, true, true);
                    this.setOptionEnabled(NetworkRuleOption.Jsinject, true, true);
                    this.setOptionEnabled(NetworkRuleOption.Urlblock, true, true);
                    this.setOptionEnabled(NetworkRuleOption.Content, true, true);
                }
                break;
            case OPTIONS.STEALTH:
                this.setOptionEnabled(NetworkRuleOption.Stealth, true);
                this.stealthModifier = new StealthModifier(optionValue);
                break;
            case OPTIONS.POPUP:
                this.setOptionEnabled(NetworkRuleOption.Popup, true);
                break;
            case OPTIONS.SCRIPT:
                this.setRequestType(RequestType$1.Script, !exception);
                break;
            case OPTIONS.STYLESHEET:
                this.setRequestType(RequestType$1.Stylesheet, !exception);
                break;
            case OPTIONS.SUBDOCUMENT:
                this.setRequestType(RequestType$1.SubDocument, !exception);
                break;
            case OPTIONS.OBJECT:
                this.setRequestType(RequestType$1.Object, !exception);
                break;
            case OPTIONS.IMAGE:
                this.setRequestType(RequestType$1.Image, !exception);
                break;
            case OPTIONS.XMLHTTPREQUEST:
                this.setRequestType(RequestType$1.XmlHttpRequest, !exception);
                break;
            case OPTIONS.MEDIA:
                this.setRequestType(RequestType$1.Media, !exception);
                break;
            case OPTIONS.FONT:
                this.setRequestType(RequestType$1.Font, !exception);
                break;
            case OPTIONS.WEBSOCKET:
                this.setRequestType(RequestType$1.WebSocket, !exception);
                break;
            case OPTIONS.OTHER:
                this.setRequestType(RequestType$1.Other, !exception);
                break;
            case OPTIONS.PING:
                this.setRequestType(RequestType$1.Ping, !exception);
                break;
            case OPTIONS.BADFILTER:
                this.setOptionEnabled(NetworkRuleOption.Badfilter, true);
                break;
            case OPTIONS.CSP:
                this.setOptionEnabled(NetworkRuleOption.Csp, true);
                this.advancedModifier = new CspModifier(optionValue, this.isAllowlist());
                break;
            case OPTIONS.REPLACE:
                this.setOptionEnabled(NetworkRuleOption.Replace, true);
                this.advancedModifier = new ReplaceModifier(optionValue);
                break;
            case OPTIONS.COOKIE:
                this.setOptionEnabled(NetworkRuleOption.Cookie, true);
                this.advancedModifier = new CookieModifier(optionValue);
                break;
            case OPTIONS.REDIRECT:
                this.setOptionEnabled(NetworkRuleOption.Redirect, true);
                this.advancedModifier = new RedirectModifier(optionValue, this.isAllowlist());
                break;
            case OPTIONS.REDIRECTRULE:
                this.setOptionEnabled(NetworkRuleOption.Redirect, true);
                this.advancedModifier = new RedirectModifier(optionValue, this.isAllowlist(), true);
                break;
            case OPTIONS.REMOVEPARAM:
                this.setOptionEnabled(NetworkRuleOption.RemoveParam, true);
                this.advancedModifier = new RemoveParamModifier(optionValue);
                break;
            case OPTIONS.REMOVEHEADER:
                this.setOptionEnabled(NetworkRuleOption.RemoveHeader, true);
                this.advancedModifier = new RemoveHeaderModifier(optionValue, this.isAllowlist());
                break;
            case OPTIONS.PERMISSIONS:
                this.setOptionEnabled(NetworkRuleOption.Permissions, true);
                this.advancedModifier = new PermissionsModifier(optionValue, this.isAllowlist());
                break;
            case OPTIONS.JSONPRUNE:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension does not support $jsonprune modifier yet');
                }
                this.setOptionEnabled(NetworkRuleOption.JsonPrune, true);
                break;
            case OPTIONS.HLS:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension does not support $hls modifier yet');
                }
                this.setOptionEnabled(NetworkRuleOption.Hls, true);
                break;
            case OPTIONS.REFERRERPOLICY:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension does not support $referrerpolicy modifier');
                }
                break;
            case OPTIONS.CLIENT:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $client modifier');
                }
                this.setOptionEnabled(NetworkRuleOption.Client, true);
                this.advancedModifier = new ClientModifier(optionValue);
                break;
            case OPTIONS.DNSREWRITE:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $dnsrewrite modifier');
                }
                this.setOptionEnabled(NetworkRuleOption.DnsRewrite, true);
                this.advancedModifier = new DnsRewriteModifier(optionValue);
                break;
            case OPTIONS.DNSTYPE:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $dnstype modifier');
                }
                this.setOptionEnabled(NetworkRuleOption.DnsType, true);
                this.advancedModifier = new DnsTypeModifier(optionValue);
                break;
            case OPTIONS.CTAG:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $ctag modifier');
                }
                this.setOptionEnabled(NetworkRuleOption.Ctag, true);
                this.advancedModifier = new CtagModifier(optionValue);
                break;
            case OPTIONS.APP:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $app modifier');
                }
                this.appModifier = new AppModifier(optionValue);
                break;
            case OPTIONS.NETWORK:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $network modifier');
                }
                this.setOptionEnabled(NetworkRuleOption.Network, true);
                break;
            case OPTIONS.EXTENSION:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $extension modifier');
                }
                this.setOptionEnabled(NetworkRuleOption.Extension, !exception);
                break;
            case OPTIONS.ALL:
                if (this.isAllowlist()) {
                    throw new SyntaxError('Rule with $all modifier can not be allowlist rule');
                }
                Object.values(RequestType$1).forEach(function (type) {
                    _this.setRequestType(type, true);
                });
                this.setOptionEnabled(NetworkRuleOption.Popup, true);
                break;
            case OPTIONS.EMPTY:
            case OPTIONS.MP4:
                break;
            default: {
                var modifierView = [optionName, optionValue]
                    .filter(function (i) { return i; })
                    .join('=');
                throw new SyntaxError("Unknown modifier: ".concat(modifierView));
            }
        }
    };
    NetworkRule.prototype.calculatePriorityWeight = function () {
        var _a, _b;
        this.priorityWeight += countEnabledBits(this.enabledOptions, NetworkRule.CATEGORY_1_OPTIONS_MASK);
        this.priorityWeight += countEnabledBits(this.disabledOptions, NetworkRule.CATEGORY_1_OPTIONS_MASK);
        if (this.denyAllowDomains && this.denyAllowDomains.length > 0) {
            this.priorityWeight += 1;
        }
        var domainModifier = this.domainModifier;
        if (domainModifier === null || domainModifier === void 0 ? void 0 : domainModifier.hasRestrictedDomains()) {
            this.priorityWeight += 1;
        }
        if (((_a = this.methodModifier) === null || _a === void 0 ? void 0 : _a.restrictedValues) && this.methodModifier.restrictedValues.length > 0) {
            this.priorityWeight += 1;
        }
        if (this.restrictedRequestTypes !== RequestType$1.NotSet) {
            this.priorityWeight += 1;
        }
        if (this.toModifier) {
            this.priorityWeight += 1;
        }
        if (this.permittedRequestTypes !== RequestType$1.NotSet) {
            var numberOfPermittedRequestTypes = getBitCount(this.permittedRequestTypes);
            var relativeWeight = NetworkRule.CategoryTwoWeight / numberOfPermittedRequestTypes;
            this.priorityWeight += NetworkRule.CategoryTwoWeight + relativeWeight;
        }
        if (((_b = this.methodModifier) === null || _b === void 0 ? void 0 : _b.permittedValues) && this.methodModifier.permittedValues.length > 0) {
            var relativeWeight = NetworkRule.CategoryTwoWeight / this.methodModifier.permittedValues.length;
            this.priorityWeight += NetworkRule.CategoryTwoWeight + relativeWeight;
        }
        if (this.headerModifier) {
            this.priorityWeight += NetworkRule.CategoryTwoWeight;
        }
        if (domainModifier === null || domainModifier === void 0 ? void 0 : domainModifier.hasPermittedDomains()) {
            var relativeWeight = NetworkRule.CategoryThreeWeight / domainModifier.getPermittedDomains().length;
            this.priorityWeight += NetworkRule.CategoryThreeWeight + relativeWeight;
        }
        if (this.isOptionEnabled(NetworkRuleOption.Redirect)) {
            this.priorityWeight += NetworkRule.CategoryFourWeight;
        }
        this.priorityWeight += NetworkRule.CategoryFiveWeight * countEnabledBits(this.enabledOptions, NetworkRule.SPECIFIC_EXCLUSIONS_MASK);
        if (this.isAllowlist()) {
            this.priorityWeight += NetworkRule.CategorySixWeight;
        }
        if (this.isOptionEnabled(NetworkRuleOption.Important)) {
            this.priorityWeight += NetworkRule.CategorySevenWeight;
        }
        this.priorityWeight = Math.ceil(this.priorityWeight);
    };
    NetworkRule.prototype.validateOptions = function () {
        if (this.advancedModifier instanceof RemoveParamModifier) {
            this.validateRemoveParamRule();
        }
        else if (this.advancedModifier instanceof RemoveHeaderModifier) {
            this.validateRemoveHeaderRule();
        }
        else if (this.advancedModifier instanceof PermissionsModifier) {
            this.validatePermissionsRule();
        }
        else if (this.headerModifier instanceof HeaderModifier) {
            this.validateHeaderRule();
        }
        else if (this.toModifier !== null) {
            this.validateToRule();
        }
        else if (this.denyAllowDomains !== null) {
            this.validateDenyallowRule();
        }
    };
    NetworkRule.prototype.validateHeaderRule = function () {
        if ((this.enabledOptions | NetworkRuleGroupOptions.HeaderCompatibleOptions)
            !== NetworkRuleGroupOptions.HeaderCompatibleOptions) {
            throw new SyntaxError('$header rules are not compatible with some other modifiers');
        }
        if (this.advancedModifier && this.isOptionEnabled(NetworkRuleOption.RemoveHeader)) {
            var removeHeaderValue = this.getAdvancedModifierValue();
            if (!removeHeaderValue || removeHeaderValue.includes('request:')) {
                var message = '$header rules are only compatible with response headers removal of $removeheader.';
                throw new SyntaxError(message);
            }
        }
    };
    NetworkRule.prototype.validatePermissionsRule = function () {
        if ((this.enabledOptions | NetworkRuleGroupOptions.PermissionsCompatibleOptions)
            !== NetworkRuleGroupOptions.PermissionsCompatibleOptions) {
            throw new SyntaxError('$permissions rules are not compatible with some other modifiers');
        }
    };
    NetworkRule.prototype.validateRemoveParamRule = function () {
        if ((this.enabledOptions | NetworkRuleGroupOptions.RemoveParamCompatibleOptions)
            !== NetworkRuleGroupOptions.RemoveParamCompatibleOptions) {
            throw new SyntaxError('$removeparam rules are not compatible with some other modifiers');
        }
    };
    NetworkRule.prototype.validateRemoveHeaderRule = function () {
        if ((this.enabledOptions | NetworkRuleGroupOptions.RemoveHeaderCompatibleOptions)
            !== NetworkRuleGroupOptions.RemoveHeaderCompatibleOptions) {
            throw new SyntaxError('$removeheader rules are not compatible with some other modifiers');
        }
        if (this.headerModifier && this.isOptionEnabled(NetworkRuleOption.Header)) {
            var removeHeaderValue = this.getAdvancedModifierValue();
            if (!removeHeaderValue || removeHeaderValue.includes('request:')) {
                var message = 'Request headers removal of $removeheaders is not compatible with $header rules.';
                throw new SyntaxError(message);
            }
        }
    };
    NetworkRule.prototype.validateToRule = function () {
        if (this.denyAllowDomains) {
            throw new SyntaxError('modifier $to is not compatible with $denyallow modifier');
        }
    };
    NetworkRule.prototype.validateDenyallowRule = function () {
        if (this.toModifier) {
            throw new SyntaxError('modifier $to is not compatible with $denyallow modifier');
        }
    };
    NetworkRule.CATEGORY_1_OPTIONS_MASK = NetworkRuleOption.ThirdParty
        | NetworkRuleOption.MatchCase
        | NetworkRuleOption.DnsRewrite;
    NetworkRule.CategoryTwoWeight = 50;
    NetworkRule.CategoryThreeWeight = 100;
    NetworkRule.CategoryFourWeight = Math.pow(10, 3);
    NetworkRule.CategoryFiveWeight = Math.pow(10, 4);
    NetworkRule.SPECIFIC_EXCLUSIONS_MASK = NetworkRuleOption.Elemhide
        | NetworkRuleOption.Generichide
        | NetworkRuleOption.Specifichide
        | NetworkRuleOption.Content
        | NetworkRuleOption.Urlblock
        | NetworkRuleOption.Genericblock
        | NetworkRuleOption.Jsinject
        | NetworkRuleOption.Extension;
    NetworkRule.CategorySixWeight = Math.pow(10, 5);
    NetworkRule.CategorySevenWeight = Math.pow(10, 6);
    NetworkRule.OPTIONS_DELIMITER = OPTIONS_DELIMITER;
    NetworkRule.MASK_ALLOWLIST = MASK_ALLOWLIST;
    NetworkRule.NOT_MARK = NOT_MARK;
    NetworkRule.OPTIONS = NETWORK_RULE_OPTIONS;
    NetworkRule.NEGATABLE_OPTIONS = new Set([
        NetworkRule.OPTIONS.FIRST_PARTY,
        NetworkRule.OPTIONS.THIRD_PARTY,
        NetworkRule.OPTIONS.MATCH_CASE,
        NetworkRule.OPTIONS.DOCUMENT,
        NetworkRule.OPTIONS.DOC,
        NetworkRule.OPTIONS.SCRIPT,
        NetworkRule.OPTIONS.STYLESHEET,
        NetworkRule.OPTIONS.SUBDOCUMENT,
        NetworkRule.OPTIONS.OBJECT,
        NetworkRule.OPTIONS.IMAGE,
        NetworkRule.OPTIONS.XMLHTTPREQUEST,
        NetworkRule.OPTIONS.MEDIA,
        NetworkRule.OPTIONS.FONT,
        NetworkRule.OPTIONS.WEBSOCKET,
        NetworkRule.OPTIONS.OTHER,
        NetworkRule.OPTIONS.PING,
        NetworkRule.OPTIONS.EXTENSION,
    ]);
    NetworkRule.ADVANCED_OPTIONS = new Set([
        NetworkRule.OPTIONS.CSP,
        NetworkRule.OPTIONS.REPLACE,
        NetworkRule.OPTIONS.COOKIE,
        NetworkRule.OPTIONS.REDIRECT,
        NetworkRule.OPTIONS.REDIRECTRULE,
        NetworkRule.OPTIONS.REMOVEPARAM,
        NetworkRule.OPTIONS.REMOVEHEADER,
        NetworkRule.OPTIONS.PERMISSIONS,
        NetworkRule.OPTIONS.CLIENT,
        NetworkRule.OPTIONS.DNSREWRITE,
        NetworkRule.OPTIONS.DNSTYPE,
        NetworkRule.OPTIONS.CTAG,
    ]);
    return NetworkRule;
}());
var SUPPORTED_EXT_CSS_PSEUDO_CLASSES = new Set([
    '-abp-contains',
    '-abp-has',
    'contains',
    'has',
    'has-text',
    'if',
    'if-not',
    'matches-attr',
    'matches-css',
    'matches-css-after',
    'matches-css-before',
    'matches-property',
    'nth-ancestor',
    'remove',
    'upward',
    'xpath',
]);
var SUPPORTED_CSS_PSEUDO_CLASSES = new Set([
    'active',
    'checked',
    'disabled',
    'empty',
    'enabled',
    'first-child',
    'first-of-type',
    'focus',
    'has',
    'hover',
    'in-range',
    'invalid',
    'is',
    'lang',
    'last-child',
    'last-of-type',
    'link',
    'not',
    'nth-child',
    'nth-last-child',
    'nth-last-of-type',
    'nth-of-type',
    'only-child',
    'only-of-type',
    'optional',
    'out-of-range',
    'read-only',
    'read-write',
    'required',
    'root',
    'target',
    'valid',
    'visited',
    'where',
]);
var EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX = '-ext-';
var SUPPORTED_EXT_CSS_ATTRIBUTE_SELECTORS = new Set([
    "".concat(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX, "has"),
    "".concat(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX, "contains"),
    "".concat(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX, "has-text"),
    "".concat(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX, "matches-css"),
    "".concat(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX, "matches-css-before"),
    "".concat(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX, "matches-css-after"),
]);
var FORBIDDEN_CSS_FUNCTIONS = new Set([
    '-webkit-cross-fade',
    'cross-fade',
    'image',
    '-webkit-image-set',
    'image-set',
    'url',
]);
var validateSelectorList = function (selectorList) {
    var result = {
        isValid: true,
        isExtendedCss: false,
    };
    try {
        var prevIsDoubleColon_1 = false;
        var prevToken_1;
        var prevNonWhitespaceToken_1;
        tokenizeExtended(selectorList, function (token, start, end) {
            if ((token === TokenType$1.Function || token === TokenType$1.Ident)
                && prevToken_1 === TokenType$1.Colon
                && !prevIsDoubleColon_1) {
                var name_1 = selectorList.slice(start,
                token === TokenType$1.Function ? end - 1 : end);
                var decodedName = decodeIdent(name_1);
                if (SUPPORTED_EXT_CSS_PSEUDO_CLASSES.has(decodedName)) {
                    result.isExtendedCss = true;
                }
                else if (!SUPPORTED_CSS_PSEUDO_CLASSES.has(decodedName)) {
                    throw new Error("Unsupported pseudo-class: ':".concat(decodedName, "'"));
                }
            }
            else if (token === TokenType$1.Ident && prevNonWhitespaceToken_1 === TokenType$1.OpenSquareBracket) {
                var attributeName = selectorList.slice(start, end);
                if (attributeName.startsWith(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX)) {
                    result.isExtendedCss = true;
                    if (!SUPPORTED_EXT_CSS_ATTRIBUTE_SELECTORS.has(attributeName)) {
                        throw new Error("Unsupported Extended CSS attribute selector: '".concat(attributeName, "'"));
                    }
                }
            }
            else if (token === TokenType$1.OpenCurlyBracket || token === TokenType$1.CloseCurlyBracket) {
                throw new Error('Curly brackets are not allowed in selector lists');
            }
            else if (token === TokenType$1.Comment) {
                throw new Error('Comments are not allowed in selector lists');
            }
            if (token === TokenType$1.Colon) {
                prevIsDoubleColon_1 = prevToken_1 === TokenType$1.Colon;
            }
            prevToken_1 = token;
            if (token !== TokenType$1.Whitespace) {
                prevNonWhitespaceToken_1 = token;
            }
        });
    }
    catch (error) {
        result.isValid = false;
        result.errorMessage = getErrorMessage$2(error);
    }
    return result;
};
var REMOVE_PROPERTY = 'remove';
var REMOVE_LENGTH = REMOVE_PROPERTY.length;
var checkFunctionName = function (functionName) {
    var decodedFunctionName = decodeIdent(functionName);
    if (FORBIDDEN_CSS_FUNCTIONS.has(decodedFunctionName)) {
        throw new Error("Using '".concat(decodedFunctionName, "()' is not allowed"));
    }
};
var validateDeclarationList = function (declarationList) {
    var result = {
        isValid: true,
        isExtendedCss: false,
    };
    try {
        tokenizeExtended(declarationList, function (token, start, end) {
            switch (token) {
                case TokenType$1.Url:
                case TokenType$1.BadUrl:
                    throw new Error("Using 'url()' is not allowed");
                case TokenType$1.Function:
                    checkFunctionName(declarationList.slice(start, end - 1));
                    break;
                case TokenType$1.Ident:
                    if (end - start === REMOVE_LENGTH) {
                        if (decodeIdent(declarationList.slice(start, end)) === REMOVE_PROPERTY) {
                            result.isExtendedCss = true;
                        }
                    }
                    break;
                case TokenType$1.Comment:
                    throw new Error('Comments are not allowed in declaration lists');
                default:
                    break;
            }
        });
    }
    catch (error) {
        result.isValid = false;
        result.errorMessage = getErrorMessage$2(error);
    }
    return result;
};
var ScriptletParams =  (function () {
    function ScriptletParams(name, args) {
        this.props = null;
        if (typeof name !== 'undefined') {
            this.props = {
                name: name,
                args: args || [],
            };
        }
    }
    Object.defineProperty(ScriptletParams.prototype, "name", {
        get: function () {
            var _a;
            return (_a = this.props) === null || _a === void 0 ? void 0 : _a.name;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScriptletParams.prototype, "args", {
        get: function () {
            var _a, _b;
            return (_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.args) !== null && _b !== void 0 ? _b : [];
        },
        enumerable: false,
        configurable: true
    });
    ScriptletParams.prototype.toString = function () {
        var result = [];
        result.push(ADG_SCRIPTLET_MASK);
        result.push('(');
        if (this.name) {
            result.push(QuoteUtils.setStringQuoteType(this.name, QuoteType.Single));
        }
        if (this.args.length) {
            result.push(', ');
            result.push(this.args.map(function (arg) { return QuoteUtils.setStringQuoteType(arg, QuoteType.Single); }).join(', '));
        }
        result.push(')');
        return result.join(EMPTY_STRING);
    };
    return ScriptletParams;
}());
var CosmeticRule =  (function () {
    function CosmeticRule(node, filterListId, ruleIndex) {
        if (ruleIndex === void 0) { ruleIndex = RULE_INDEX_NONE; }
        var _a, _b, _c;
        this.allowlist = false;
        this.extendedCss = false;
        this.domainModifier = null;
        this.script = undefined;
        this.scriptData = null;
        this.scriptletData = null;
        this.isScriptlet = false;
        this.ruleIndex = ruleIndex;
        this.filterListId = filterListId;
        this.allowlist = CosmeticRuleSeparatorUtils.isException(node.separator.value);
        this.type = node.type;
        this.isScriptlet = node.type === CosmeticRuleType.ScriptletInjectionRule;
        this.content = CosmeticRuleParser.generateBody(node);
        if (node.type === CosmeticRuleType.ScriptletInjectionRule) {
            var params = (_b = (_a = node.body.children[0]) === null || _a === void 0 ? void 0 : _a.children.map(function (param) { return (param === null ? EMPTY_STRING : QuoteUtils.removeQuotesAndUnescape(param.value)); })) !== null && _b !== void 0 ? _b : [];
            this.scriptletParams = new ScriptletParams((_c = params[0]) !== null && _c !== void 0 ? _c : '', params.slice(1));
        }
        else {
            this.scriptletParams = new ScriptletParams();
        }
        var validationResult = CosmeticRule.validate(node);
        if (!validationResult.isValid) {
            throw new SyntaxError(validationResult.errorMessage);
        }
        var isExtendedCssSeparator = CosmeticRuleSeparatorUtils.isExtendedCssMarker(node.separator.value);
        this.extendedCss = isExtendedCssSeparator || validationResult.isExtendedCss;
        var processedModifiers = CosmeticRule.processModifiers(node);
        if (processedModifiers) {
            if (processedModifiers.domainModifier) {
                this.domainModifier = processedModifiers.domainModifier;
            }
            if (processedModifiers.pathModifier) {
                this.pathModifier = processedModifiers.pathModifier;
            }
            if (processedModifiers.urlModifier) {
                this.urlModifier = processedModifiers.urlModifier;
            }
        }
        var domainListNode = node.domains;
        if (CosmeticRule.isAnyDomainSpecified(domainListNode)) {
            this.domainModifier = new DomainModifier(domainListNode, COMMA_DOMAIN_LIST_SEPARATOR);
        }
    }
    CosmeticRule.prototype.getIndex = function () {
        return this.ruleIndex;
    };
    CosmeticRule.prototype.getFilterListId = function () {
        return this.filterListId;
    };
    CosmeticRule.prototype.getContent = function () {
        return this.content;
    };
    CosmeticRule.prototype.getType = function () {
        return this.type;
    };
    CosmeticRule.prototype.isAllowlist = function () {
        return this.allowlist;
    };
    CosmeticRule.prototype.getScript = function (options) {
        var _a, _b;
        if (options === void 0) { options = {}; }
        var _c = options.debug, debug = _c === void 0 ? false : _c, frameUrl = options.frameUrl;
        var scriptData = this.scriptData;
        if (scriptData && !this.isScriptlet) {
            return scriptData.code;
        }
        if (scriptData && scriptData.debug === debug) {
            if (frameUrl) {
                if (frameUrl === scriptData.frameUrl) {
                    return scriptData.code;
                }
            }
            else {
                return scriptData.code;
            }
        }
        this.initScript(options);
        return (_b = (_a = this.scriptData) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : null;
    };
    CosmeticRule.prototype.getPermittedDomains = function () {
        if (this.domainModifier) {
            return this.domainModifier.getPermittedDomains();
        }
        return null;
    };
    CosmeticRule.prototype.getRestrictedDomains = function () {
        if (this.domainModifier) {
            return this.domainModifier.getRestrictedDomains();
        }
        return null;
    };
    CosmeticRule.prototype.isGeneric = function () {
        var _a;
        return !((_a = this.domainModifier) === null || _a === void 0 ? void 0 : _a.hasPermittedDomains());
    };
    CosmeticRule.prototype.isExtendedCss = function () {
        return this.extendedCss;
    };
    CosmeticRule.processModifiers = function (ruleNode) {
        var _a;
        if (!ruleNode.modifiers) {
            return null;
        }
        var result = {};
        var usedModifiers = new Set();
        var modifierNodes = ruleNode.modifiers.children;
        if (modifierNodes.length < 1) {
            throw new SyntaxError('Modifiers list cannot be be empty');
        }
        for (var _i = 0, modifierNodes_1 = modifierNodes; _i < modifierNodes_1.length; _i++) {
            var modifierNode = modifierNodes_1[_i];
            var modifierName = modifierNode.name.value;
            if (usedModifiers.has(modifierName)) {
                throw new Error("Duplicated modifier: '".concat(modifierName, "'"));
            }
            usedModifiers.add(modifierName);
            var modifierValue = ((_a = modifierNode.value) === null || _a === void 0 ? void 0 : _a.value) || EMPTY_STRING;
            if (modifierValue.length < 1 && modifierName !== "path" ) {
                throw new SyntaxError("'$".concat(modifierName, "' modifier should have a value"));
            }
            switch (modifierName) {
                case "domain" :
                    if (ruleNode.domains.children.length > 0) {
                        throw new SyntaxError("'$".concat(modifierName, "' modifier is not allowed in a domain-specific rule"));
                    }
                    result.domainModifier = new DomainModifier(modifierValue, PIPE_MODIFIER_SEPARATOR);
                    break;
                case "path" :
                    result.pathModifier = new Pattern(SimpleRegex.isRegexPattern(modifierValue)
                        ? SimpleRegex.unescapeRegexSpecials(modifierValue, SimpleRegex.reModifierPatternEscapedSpecialCharacters)
                        : modifierValue);
                    break;
                case "url" :
                    if (ruleNode.domains.children.length > 0) {
                        throw new SyntaxError("'$".concat(modifierName, "' modifier is not allowed in a domain-specific rule"));
                    }
                    result.urlModifier = new Pattern(SimpleRegex.isRegexPattern(modifierValue)
                        ? SimpleRegex.unescapeRegexSpecials(modifierValue, SimpleRegex.reModifierPatternEscapedSpecialCharacters)
                        : modifierValue);
                    break;
                default:
                    throw new SyntaxError("'$".concat(modifierName, "' modifier is not supported"));
            }
        }
        if (result.urlModifier && usedModifiers.size > 1) {
            throw new SyntaxError("'$".concat("url" , "' modifier cannot be used with other modifiers"));
        }
        return result;
    };
    CosmeticRule.validate = function (ruleNode) {
        var _a, _b, _c, _d;
        var result = {
            isValid: true,
            isExtendedCss: false,
        };
        var scriptletName;
        var selectorListValidationResult;
        var ruleType = ruleNode.type;
        try {
            if ((_a = ruleNode.domains) === null || _a === void 0 ? void 0 : _a.children.length) {
                for (var _i = 0, _e = ruleNode.domains.children; _i < _e.length; _i++) {
                    var domain = _e[_i].value;
                    if (!DomainUtils.isValidDomainOrHostname(domain)) {
                        throw new Error("'".concat(domain, "' is not a valid domain name"));
                    }
                }
            }
            switch (ruleType) {
                case CosmeticRuleType.ElementHidingRule:
                    selectorListValidationResult = validateSelectorList(ruleNode.body.selectorList.value);
                    if (!selectorListValidationResult.isValid) {
                        throw new Error(selectorListValidationResult.errorMessage);
                    }
                    result.isExtendedCss = selectorListValidationResult.isExtendedCss;
                    break;
                case CosmeticRuleType.CssInjectionRule:
                    selectorListValidationResult = validateSelectorList(ruleNode.body.selectorList.value);
                    if (!selectorListValidationResult.isValid) {
                        throw new Error(selectorListValidationResult.errorMessage);
                    }
                    result.isExtendedCss = selectorListValidationResult.isExtendedCss;
                    if (ruleNode.body.declarationList) {
                        var declarationListValidationResult = validateDeclarationList(ruleNode.body.declarationList.value);
                        if (!declarationListValidationResult.isValid) {
                            throw new Error(declarationListValidationResult.errorMessage);
                        }
                        if (!result.isExtendedCss) {
                            result.isExtendedCss = declarationListValidationResult.isExtendedCss;
                        }
                    }
                    break;
                case CosmeticRuleType.ScriptletInjectionRule:
                    scriptletName = QuoteUtils.removeQuotes((_d = (_c = (_b = ruleNode.body.children[0]) === null || _b === void 0 ? void 0 : _b.children[0]) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : EMPTY_STRING);
                    if (scriptletName.length === 0) {
                        break;
                    }
                    if (!scriptlets.isValidScriptletName(scriptletName)) {
                        throw new Error("'".concat(scriptletName, "' is not a known scriptlet name"));
                    }
                    break;
                case CosmeticRuleType.HtmlFilteringRule:
                    break;
                case CosmeticRuleType.JsInjectionRule:
                    break;
                default:
                    break;
            }
        }
        catch (error) {
            result.isValid = false;
            result.errorMessage = getErrorMessage$2(error);
        }
        return result;
    };
    CosmeticRule.isAnyDomainSpecified = function (domainListNode) {
        if (domainListNode.children.length > 0) {
            return !(domainListNode.children.length === 1 && domainListNode.children[0].value === WILDCARD);
        }
        return false;
    };
    CosmeticRule.prototype.match = function (request) {
        if (!this.domainModifier
            && !this.pathModifier
            && !this.urlModifier) {
            return true;
        }
        if (this.urlModifier) {
            return this.urlModifier.matchPattern(request, false);
        }
        if (this.domainModifier) {
            if (!this.domainModifier.matchDomain(request.hostname)) {
                return false;
            }
        }
        if (this.pathModifier) {
            var path = getRelativeUrl(request.urlLowercase);
            if (path) {
                return this.pathModifier.matchPathPattern(path);
            }
            return false;
        }
        return true;
    };
    CosmeticRule.prototype.getScriptletData = function () {
        if (this.scriptletData) {
            return this.scriptletData;
        }
        this.initScript();
        return this.scriptletData;
    };
    CosmeticRule.prototype.initScript = function (options) {
        var _a, _b;
        if (options === void 0) { options = {}; }
        var _c = options.debug, debug = _c === void 0 ? false : _c, frameUrl = options.frameUrl;
        var ruleContent = this.getContent();
        if (!this.isScriptlet) {
            this.scriptData = {
                code: ruleContent,
            };
            return;
        }
        if (!((_a = this.scriptletParams) === null || _a === void 0 ? void 0 : _a.name)) {
            return;
        }
        var params = {
            args: this.scriptletParams.args,
            engine: config.engine || EMPTY_STRING,
            name: this.scriptletParams.name,
            verbose: debug,
            domainName: frameUrl,
            version: config.version || EMPTY_STRING,
        };
        this.scriptData = {
            code: (_b = scriptlets.invoke(params)) !== null && _b !== void 0 ? _b : null,
            debug: debug,
            frameUrl: frameUrl,
        };
        this.scriptletData = {
            func: scriptlets.getScriptletFunction(params.name),
            params: params,
        };
    };
    return CosmeticRule;
}());
var HostRule =  (function () {
    function HostRule(node, filterListId, ruleIndex) {
        if (ruleIndex === void 0) { ruleIndex = RULE_INDEX_NONE; }
        this.hostnames = [];
        this.ip = '';
        this.invalid = false;
        this.ruleIndex = ruleIndex;
        this.filterListId = filterListId;
        this.ip = node.ip.value;
        if (node.hostnames.children.length === 0) {
            this.invalid = true;
            return;
        }
        this.hostnames = node.hostnames.children.map(function (hostname) { return hostname.value; });
    }
    HostRule.prototype.match = function (hostname) {
        return this.hostnames.includes(hostname);
    };
    HostRule.prototype.getFilterListId = function () {
        return this.filterListId;
    };
    HostRule.prototype.getIndex = function () {
        return this.ruleIndex;
    };
    HostRule.prototype.getIp = function () {
        return this.ip;
    };
    HostRule.prototype.getHostnames = function () {
        return this.hostnames;
    };
    HostRule.prototype.isInvalid = function () {
        return this.invalid;
    };
    return HostRule;
}());
var createAllowlistRuleNode = function (domain) {
    var domainToUse = domain.startsWith('www.') ? domain.substring(4) : domain;
    if (!domainToUse) {
        return null;
    }
    var pattern;
    if (domainToUse.startsWith('*.')) {
        pattern = "".concat(SimpleRegex.MASK_START_URL).concat(domainToUse.slice(2));
    }
    else {
        var regexp = '';
        for (var i = 0; i < domainToUse.length; i += 1) {
            var char = domainToUse[i];
            if (char === '*') {
                regexp += '.*';
            }
            else if (char === '.') {
                regexp += String.raw(templateObject_1 || (templateObject_1 = __makeTemplateObject(["."], ["\\."])));
            }
            else {
                regexp += char;
            }
        }
        pattern = String.raw(templateObject_2 || (templateObject_2 = __makeTemplateObject(["///(www.)?", "/"], ["///(www\\.)?", "/"])), regexp);
    }
    var node = {
        category: RuleCategory.Network,
        type: NetworkRuleType.NetworkRule,
        syntax: AdblockSyntax.Common,
        exception: true,
        pattern: {
            type: 'Value',
            value: pattern,
        },
        modifiers: {
            type: 'ModifierList',
            children: [
                {
                    type: 'Modifier',
                    name: {
                        type: 'Value',
                        value: 'document',
                    },
                },
                {
                    type: 'Modifier',
                    name: {
                        type: 'Value',
                        value: 'important',
                    },
                },
            ],
        },
    };
    return node;
};
var templateObject_1, templateObject_2;
var RuleFactory =  (function () {
    function RuleFactory() {
    }
    RuleFactory.createRule = function (node, filterListId, ruleIndex, ignoreNetwork, ignoreCosmetic, ignoreHost, silent) {
        if (ruleIndex === void 0) { ruleIndex = RULE_INDEX_NONE; }
        if (ignoreNetwork === void 0) { ignoreNetwork = false; }
        if (ignoreCosmetic === void 0) { ignoreCosmetic = false; }
        if (ignoreHost === void 0) { ignoreHost = true; }
        if (silent === void 0) { silent = true; }
        try {
            switch (node.category) {
                case RuleCategory.Invalid:
                case RuleCategory.Empty:
                case RuleCategory.Comment:
                    return null;
                case RuleCategory.Cosmetic:
                    if (ignoreCosmetic) {
                        return null;
                    }
                    return new CosmeticRule(node, filterListId, ruleIndex);
                case RuleCategory.Network:
                    if (node.type === NetworkRuleType.HostRule) {
                        if (ignoreHost) {
                            return null;
                        }
                        return new HostRule(node, filterListId, ruleIndex);
                    }
                    if (ignoreNetwork) {
                        return null;
                    }
                    return new NetworkRule(node, filterListId, ruleIndex);
                default:
                    return null;
            }
        }
        catch (e) {
            var ruleText = RuleParser.generate(node);
            var msg = "\"".concat(getErrorMessage$2(e), "\" in the rule: \"").concat(ruleText, "\"");
            if (silent) {
                logger$1.info("Error: ".concat(msg));
            }
            else {
                throw new Error(msg);
            }
        }
        return null;
    };
    RuleFactory.createAllowlistRule = function (domain, filterListId, ruleIndex) {
        if (ruleIndex === void 0) { ruleIndex = RULE_INDEX_NONE; }
        var node = createAllowlistRuleNode(domain);
        if (!node) {
            return null;
        }
        return new NetworkRule(node, filterListId, ruleIndex);
    };
    return RuleFactory;
}());
var IndexedNetworkRuleWithHash =  (function (_super) {
    __extends(IndexedNetworkRuleWithHash, _super);
    function IndexedNetworkRuleWithHash(rule, index, hash) {
        var _this = _super.call(this, rule, index) || this;
        _this.hash = hash;
        _this.rule = rule;
        return _this;
    }
    IndexedNetworkRuleWithHash.createRuleHash = function (networkRule) {
        var significantPart = networkRule.getPattern();
        var hash = fastHash(significantPart);
        return hash;
    };
    IndexedNetworkRuleWithHash.createIndexedNetworkRuleWithHash = function (filterId, lineIndex, ruleConvertedToAGSyntax) {
        var networkRule;
        try {
            networkRule = RuleFactory.createRule(ruleConvertedToAGSyntax, filterId, lineIndex, false,
            true,
            true,
            false);
        }
        catch (e) {
            throw new Error("Cannot create IRule from filter \"".concat(filterId, "\" and byte offset \"").concat(lineIndex, "\": ").concat(getErrorMessage$2(e)));
        }
        if (networkRule === null) {
            return null;
        }
        if (!(networkRule instanceof NetworkRule)) {
            throw new Error("Rule from filter \"".concat(filterId, "\" and line \"").concat(lineIndex, "\" is not network rule: ").concat(networkRule));
        }
        var hash = IndexedNetworkRuleWithHash.createRuleHash(networkRule);
        var indexedNetworkRuleWithHash = new IndexedNetworkRuleWithHash(networkRule, lineIndex, hash);
        if (!indexedNetworkRuleWithHash) {
            throw new Error("Cannot create indexed network rule with hash from filter \"".concat(filterId, "\" and line \"").concat(lineIndex, "\""));
        }
        return indexedNetworkRuleWithHash;
    };
    IndexedNetworkRuleWithHash.createFromNode = function (filterId, lineIndex, node) {
        var rulesConvertedToAGSyntax;
        try {
            var conversionResult = RuleConverter.convertToAdg(node);
            if (conversionResult.isConverted) {
                rulesConvertedToAGSyntax = conversionResult.result;
            }
            else {
                rulesConvertedToAGSyntax = [node];
            }
        }
        catch (e) {
            throw new Error("Unknown error during conversion rule to AG syntax: ".concat(getErrorMessage$2(e)));
        }
        var rules = [];
        var convertedAGRules = rulesConvertedToAGSyntax;
        for (var rulesIndex = 0; rulesIndex < convertedAGRules.length; rulesIndex += 1) {
            var ruleConvertedToAGSyntax = convertedAGRules[rulesIndex];
            try {
                var networkIndexedRuleWithHash = IndexedNetworkRuleWithHash.createIndexedNetworkRuleWithHash(filterId, lineIndex, ruleConvertedToAGSyntax);
                if (networkIndexedRuleWithHash) {
                    rules.push(networkIndexedRuleWithHash);
                }
            }
            catch (e) {
                throw new Error("Error during creating indexed rule with hash: ".concat(getErrorMessage$2(e)));
            }
        }
        return rules;
    };
    return IndexedNetworkRuleWithHash;
}(IndexedRule));
var _a$1, _b;
var DomainType;
(function (DomainType) {
    DomainType["FirstParty"] = "firstParty";
    DomainType["ThirdParty"] = "thirdParty";
})(DomainType || (DomainType = {}));
var ResourceType;
(function (ResourceType) {
    ResourceType["MainFrame"] = "main_frame";
    ResourceType["SubFrame"] = "sub_frame";
    ResourceType["Stylesheet"] = "stylesheet";
    ResourceType["Script"] = "script";
    ResourceType["Image"] = "image";
    ResourceType["Font"] = "font";
    ResourceType["Object"] = "object";
    ResourceType["XmlHttpRequest"] = "xmlhttprequest";
    ResourceType["Ping"] = "ping";
    ResourceType["Media"] = "media";
    ResourceType["WebSocket"] = "websocket";
    ResourceType["Other"] = "other";
})(ResourceType || (ResourceType = {}));
var QueryKeyValueValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.strictObject({
    key: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    replaceOnly: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean().optional(),
    value: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
});
var QueryTransformValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.strictObject({
    addOrReplaceParams: QueryKeyValueValidator.array().optional(),
    removeParams: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().array().optional(),
});
var URLTransformValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.strictObject({
    fragment: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
    host: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
    password: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
    path: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
    port: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
    query: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
    queryTransform: QueryTransformValidator.optional(),
    scheme: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
    username: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
});
var RedirectValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.strictObject({
    extensionPath: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
    regexSubstitution: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
    transform: URLTransformValidator.optional(),
    url: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
});
var HeaderOperation;
(function (HeaderOperation) {
    HeaderOperation["Append"] = "append";
    HeaderOperation["Set"] = "set";
    HeaderOperation["Remove"] = "remove";
})(HeaderOperation || (HeaderOperation = {}));
var ModifyHeaderInfoValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.strictObject({
    header: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    operation: zod__WEBPACK_IMPORTED_MODULE_3__.z.nativeEnum(HeaderOperation),
    value: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
});
var RuleActionType;
(function (RuleActionType) {
    RuleActionType["BLOCK"] = "block";
    RuleActionType["REDIRECT"] = "redirect";
    RuleActionType["ALLOW"] = "allow";
    RuleActionType["UPGRADE_SCHEME"] = "upgradeScheme";
    RuleActionType["MODIFY_HEADERS"] = "modifyHeaders";
    RuleActionType["ALLOW_ALL_REQUESTS"] = "allowAllRequests";
})(RuleActionType || (RuleActionType = {}));
var RuleActionValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.strictObject({
    redirect: RedirectValidator.optional(),
    requestHeaders: ModifyHeaderInfoValidator.array().optional(),
    responseHeaders: ModifyHeaderInfoValidator.array().optional(),
    type: zod__WEBPACK_IMPORTED_MODULE_3__.z.nativeEnum(RuleActionType),
});
var RequestMethod;
(function (RequestMethod) {
    RequestMethod["Connect"] = "connect";
    RequestMethod["Delete"] = "delete";
    RequestMethod["Get"] = "get";
    RequestMethod["Head"] = "head";
    RequestMethod["Options"] = "options";
    RequestMethod["Patch"] = "patch";
    RequestMethod["Post"] = "post";
    RequestMethod["Put"] = "put";
})(RequestMethod || (RequestMethod = {}));
var DECLARATIVE_REQUEST_METHOD_MAP = (_a$1 = {},
    _a$1[HTTPMethod.GET] = RequestMethod.Get,
    _a$1[HTTPMethod.POST] = RequestMethod.Post,
    _a$1[HTTPMethod.PUT] = RequestMethod.Put,
    _a$1[HTTPMethod.DELETE] = RequestMethod.Delete,
    _a$1[HTTPMethod.PATCH] = RequestMethod.Patch,
    _a$1[HTTPMethod.HEAD] = RequestMethod.Head,
    _a$1[HTTPMethod.OPTIONS] = RequestMethod.Options,
    _a$1[HTTPMethod.CONNECT] = RequestMethod.Connect,
    _a$1);
var RuleConditionValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.strictObject({
    domainType: zod__WEBPACK_IMPORTED_MODULE_3__.z.nativeEnum(DomainType).optional(),
    excludedInitiatorDomains: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().array().optional(),
    excludedRequestDomains: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().array().optional(),
    excludedRequestMethods: zod__WEBPACK_IMPORTED_MODULE_3__.z.nativeEnum(RequestMethod).array().optional(),
    excludedResourceTypes: zod__WEBPACK_IMPORTED_MODULE_3__.z.nativeEnum(ResourceType).array().optional(),
    excludedTabIds: zod__WEBPACK_IMPORTED_MODULE_3__.z.number().array().optional(),
    initiatorDomains: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().array().optional(),
    isUrlFilterCaseSensitive: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean().optional(),
    regexFilter: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
    requestDomains: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().array().optional(),
    requestMethods: zod__WEBPACK_IMPORTED_MODULE_3__.z.nativeEnum(RequestMethod).array().optional(),
    resourceTypes: zod__WEBPACK_IMPORTED_MODULE_3__.z.nativeEnum(ResourceType).array().optional(),
    tabIds: zod__WEBPACK_IMPORTED_MODULE_3__.z.number().array().optional(),
    urlFilter: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
});
var DeclarativeRuleValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.strictObject({
    action: RuleActionValidator,
    condition: RuleConditionValidator,
    id: zod__WEBPACK_IMPORTED_MODULE_3__.z.number(),
    priority: zod__WEBPACK_IMPORTED_MODULE_3__.z.number().optional(),
});
var DECLARATIVE_RESOURCE_TYPES_MAP = (_b = {},
    _b[ResourceType.MainFrame] = RequestType$1.Document,
    _b[ResourceType.SubFrame] = RequestType$1.SubDocument,
    _b[ResourceType.Stylesheet] = RequestType$1.Stylesheet,
    _b[ResourceType.Script] = RequestType$1.Script,
    _b[ResourceType.Image] = RequestType$1.Image,
    _b[ResourceType.Font] = RequestType$1.Font,
    _b[ResourceType.Object] = RequestType$1.Object,
    _b[ResourceType.XmlHttpRequest] = RequestType$1.XmlHttpRequest,
    _b[ResourceType.Ping] = RequestType$1.Ping,
    _b[ResourceType.Media] = RequestType$1.Media,
    _b[ResourceType.WebSocket] = RequestType$1.WebSocket,
    _b[ResourceType.Other] = RequestType$1.Other,
    _b);
var UnavailableRuleSetSourceError =  (function (_super) {
    __extends(UnavailableRuleSetSourceError, _super);
    function UnavailableRuleSetSourceError(message, ruleSetId, cause) {
        var _this = _super.call(this, message, { cause: cause }) || this;
        _this.name = 'UnavailableRuleSetSourceError';
        _this.ruleSetId = ruleSetId;
        Object.setPrototypeOf(_this, UnavailableRuleSetSourceError.prototype);
        return _this;
    }
    return UnavailableRuleSetSourceError;
}(Error));
var SourceMap =  (function () {
    function SourceMap(sources) {
        var _this = this;
        this.sources = [];
        this.ruleIdMap = new Map();
        this.declarativeIdMap = new Map();
        this.sources = sources;
        this.sources.forEach(function (item) {
            var sourceRuleIndex = item.sourceRuleIndex, filterId = item.filterId, declarativeRuleId = item.declarativeRuleId;
            var existingSourcePairs = _this.ruleIdMap.get(declarativeRuleId);
            var value = {
                sourceRuleIndex: sourceRuleIndex,
                filterId: filterId,
            };
            var newSourceValue = existingSourcePairs
                ? existingSourcePairs.concat(value)
                : [value];
            _this.ruleIdMap.set(declarativeRuleId, newSourceValue);
            var key = SourceMap.getKeyFromSource(value);
            var existingDeclarativeIdsPairs = _this.declarativeIdMap.get(key);
            var newDeclarativeIdsValue = existingDeclarativeIdsPairs
                ? existingDeclarativeIdsPairs.concat(declarativeRuleId)
                : [declarativeRuleId];
            _this.declarativeIdMap.set(key, newDeclarativeIdsValue);
        });
    }
    SourceMap.getKeyFromSource = function (source) {
        return "".concat(source.filterId, "_").concat(source.sourceRuleIndex);
    };
    SourceMap.prototype.getByDeclarativeRuleId = function (ruleId) {
        return this.ruleIdMap.get(ruleId) || [];
    };
    SourceMap.prototype.getBySourceRuleIndex = function (source) {
        var key = SourceMap.getKeyFromSource(source);
        return this.declarativeIdMap.get(key) || [];
    };
    SourceMap.deserializeSources = function (sourceString) {
        var arr = JSON.parse(sourceString);
        return arr.map(function (item) { return ({
            declarativeRuleId: item[0],
            sourceRuleIndex: item[1],
            filterId: item[2],
        }); });
    };
    SourceMap.prototype.serialize = function () {
        var plainArray = this.sources.map(function (_a) {
            var declarativeRuleId = _a.declarativeRuleId, sourceRuleIndex = _a.sourceRuleIndex, filterId = _a.filterId;
            return ([declarativeRuleId, sourceRuleIndex, filterId]);
        });
        return JSON.stringify(plainArray);
    };
    return SourceMap;
}());
var serializedRuleSetLazyDataValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.strictObject({
    sourceMapRaw: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    filterIds: zod__WEBPACK_IMPORTED_MODULE_3__.z.number().array(),
});
var serializedRuleSetDataValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.strictObject({
    regexpRulesCount: zod__WEBPACK_IMPORTED_MODULE_3__.z.number(),
    rulesCount: zod__WEBPACK_IMPORTED_MODULE_3__.z.number(),
    ruleSetHashMapRaw: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    badFilterRulesRaw: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().array(),
});
var RuleSet =  (function () {
    function RuleSet(id, rulesCount, regexpRulesCount, ruleSetContentProvider, badFilterRules, rulesHashMap) {
        this.declarativeRules = [];
        this.rulesCount = 0;
        this.regexpRulesCount = 0;
        this.filterList = new Map();
        this.initialized = false;
        this.id = id;
        this.rulesCount = rulesCount;
        this.regexpRulesCount = regexpRulesCount;
        this.ruleSetContentProvider = ruleSetContentProvider;
        this.badFilterRules = badFilterRules;
        this.rulesHashMap = rulesHashMap;
    }
    RuleSet.prototype.getRulesCount = function () {
        return this.rulesCount || this.declarativeRules.length;
    };
    RuleSet.prototype.getRegexpRulesCount = function () {
        return this.regexpRulesCount;
    };
    RuleSet.prototype.getId = function () {
        return this.id;
    };
    RuleSet.prototype.findSourceRules = function (declarativeRuleId) {
        var _this = this;
        if (!this.sourceMap) {
            return Promise.resolve([]);
        }
        var sourcePairs = this.sourceMap.getByDeclarativeRuleId(declarativeRuleId);
        var sourceRules = sourcePairs.map(function (_a) {
            var filterId = _a.filterId, sourceRuleIndex = _a.sourceRuleIndex;
            return __awaiter(_this, void 0, void 0, function () {
                var filter, sourceRule;
                return __generator(this, function (_b) {
                    switch (_b.label) {
                        case 0:
                            filter = this.filterList.get(filterId);
                            if (!filter) {
                                throw new Error("Not found filter list with id: ".concat(filterId));
                            }
                            return [4 , filter.getRuleByIndex(sourceRuleIndex)];
                        case 1:
                            sourceRule = _b.sent();
                            return [2 , {
                                    sourceRule: sourceRule,
                                    filterId: filterId,
                                }];
                    }
                });
            });
        });
        return Promise.all(sourceRules);
    };
    RuleSet.prototype.loadContent = function () {
        return __awaiter(this, void 0, void 0, function () {
            var initialize;
            var _this = this;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        if (this.initialized) {
                            return [2 ];
                        }
                        if (!this.initializerPromise) return [3 , 2];
                        return [4 , this.initializerPromise];
                    case 1:
                        _a.sent();
                        return [2 ];
                    case 2:
                        initialize = function () { return __awaiter(_this, void 0, void 0, function () {
                            var _a, loadSourceMap, loadFilterList, loadDeclarativeRules, _b, _c, filtersList;
                            var _this = this;
                            return __generator(this, function (_d) {
                                switch (_d.label) {
                                    case 0:
                                        _a = this.ruleSetContentProvider, loadSourceMap = _a.loadSourceMap, loadFilterList = _a.loadFilterList, loadDeclarativeRules = _a.loadDeclarativeRules;
                                        _b = this;
                                        return [4 , loadSourceMap()];
                                    case 1:
                                        _b.sourceMap = _d.sent();
                                        _c = this;
                                        return [4 , loadDeclarativeRules()];
                                    case 2:
                                        _c.declarativeRules = _d.sent();
                                        return [4 , loadFilterList()];
                                    case 3:
                                        filtersList = _d.sent();
                                        filtersList.forEach(function (filter) {
                                            _this.filterList.set(filter.getId(), filter);
                                        });
                                        this.initialized = true;
                                        return [2 ];
                                }
                            });
                        }); };
                        this.initializerPromise = initialize().then(function () {
                            _this.initializerPromise = undefined;
                        });
                        return [4 , this.initializerPromise];
                    case 3:
                        _a.sent();
                        return [2 ];
                }
            });
        });
    };
    RuleSet.prototype.getRulesById = function (declarativeRuleId) {
        return __awaiter(this, void 0, void 0, function () {
            var originalRules, e_1, id, msg;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        _a.trys.push([0, 3, , 4]);
                        return [4 , this.loadContent()];
                    case 1:
                        _a.sent();
                        return [4 , this.findSourceRules(declarativeRuleId)];
                    case 2:
                        originalRules = _a.sent();
                        return [2 , originalRules];
                    case 3:
                        e_1 = _a.sent();
                        id = this.getId();
                        msg = "Cannot extract source rule for given declarativeRuleId ".concat(declarativeRuleId, " in rule set '").concat(id, "'");
                        throw new UnavailableRuleSetSourceError(msg, id, e_1);
                    case 4: return [2 ];
                }
            });
        });
    };
    RuleSet.prototype.getBadFilterRules = function () {
        return this.badFilterRules;
    };
    RuleSet.prototype.getRulesHashMap = function () {
        return this.rulesHashMap;
    };
    RuleSet.prototype.getDeclarativeRulesIdsBySourceRuleIndex = function (source) {
        return __awaiter(this, void 0, void 0, function () {
            var filterId, sourceRuleIndex;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 , this.loadContent()];
                    case 1:
                        _a.sent();
                        if (!this.sourceMap) {
                            filterId = source.filterId, sourceRuleIndex = source.sourceRuleIndex;
                            throw new Error("Cannot find declarative rules for filter id - ".concat(filterId, ", rule index - ").concat(sourceRuleIndex, " because source map is undefined in ruleset: ").concat(this.getId()));
                        }
                        return [2 , this.sourceMap.getBySourceRuleIndex(source)];
                }
            });
        });
    };
    RuleSet.prototype.getDeclarativeRules = function () {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 , this.loadContent()];
                    case 1:
                        _a.sent();
                        return [2 , this.declarativeRules];
                }
            });
        });
    };
    RuleSet.getNetworkRuleBySourceRule = function (source) {
        var sourceRule = source.sourceRule, filterId = source.filterId;
        var networkIndexedRulesWithHash = [];
        try {
            networkIndexedRulesWithHash = IndexedNetworkRuleWithHash.createFromNode(filterId,
            0, RuleParser.parse(sourceRule));
        }
        catch (e) {
            return [];
        }
        var networkRules = networkIndexedRulesWithHash.map(function (_a) {
            var rule = _a.rule;
            return rule;
        });
        return networkRules;
    };
    RuleSet.deserialize = function (id, rawData, loadLazyData, loadDeclarativeRules, filterList) {
        return __awaiter(this, void 0, void 0, function () {
            var data, objectFromString, msg, deserializedLazyData, getLazyData, deserialized;
            var _this = this;
            return __generator(this, function (_a) {
                try {
                    objectFromString = JSON.parse(rawData);
                    data = serializedRuleSetDataValidator.parse(objectFromString);
                }
                catch (e) {
                    msg = "Cannot parse serialized ruleset's data with id \"".concat(id, "\" because of not available source");
                    throw new UnavailableRuleSetSourceError(msg, id, e);
                }
                getLazyData = function () { return __awaiter(_this, void 0, void 0, function () {
                    var lazyData, objectFromString, e_2, msg;
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0:
                                if (deserializedLazyData !== undefined) {
                                    return [2 , deserializedLazyData];
                                }
                                _a.label = 1;
                            case 1:
                                _a.trys.push([1, 3, , 4]);
                                return [4 , loadLazyData()];
                            case 2:
                                lazyData = _a.sent();
                                objectFromString = JSON.parse(lazyData);
                                deserializedLazyData = serializedRuleSetLazyDataValidator.parse(objectFromString);
                                return [2 , deserializedLazyData];
                            case 3:
                                e_2 = _a.sent();
                                msg = "Cannot parse or load data for lazy metadata for rule set with id \"".concat(id, "\": ").concat(getErrorMessage$2(e_2));
                                throw new UnavailableRuleSetSourceError(msg, id, e_2);
                            case 4: return [2 ];
                        }
                    });
                }); };
                deserialized = {
                    id: id,
                    data: data,
                    ruleSetContentProvider: {
                        loadSourceMap: function () { return __awaiter(_this, void 0, void 0, function () {
                            var sourceMapRaw, sources;
                            return __generator(this, function (_a) {
                                switch (_a.label) {
                                    case 0: return [4 , getLazyData()];
                                    case 1:
                                        sourceMapRaw = (_a.sent()).sourceMapRaw;
                                        sources = SourceMap.deserializeSources(sourceMapRaw);
                                        return [2 , new SourceMap(sources)];
                                }
                            });
                        }); },
                        loadFilterList: function () { return __awaiter(_this, void 0, void 0, function () {
                            var filterIds;
                            return __generator(this, function (_a) {
                                switch (_a.label) {
                                    case 0: return [4 , getLazyData()];
                                    case 1:
                                        filterIds = (_a.sent()).filterIds;
                                        return [2 , filterList.filter(function (filter) { return filterIds.includes(filter.getId()); })];
                                }
                            });
                        }); },
                        loadDeclarativeRules: function () { return __awaiter(_this, void 0, void 0, function () {
                            var rawFileContent, objectFromString, declarativeRules;
                            return __generator(this, function (_a) {
                                switch (_a.label) {
                                    case 0: return [4 , loadDeclarativeRules()];
                                    case 1:
                                        rawFileContent = _a.sent();
                                        objectFromString = JSON.parse(rawFileContent);
                                        declarativeRules = DeclarativeRuleValidator
                                            .array()
                                            .parse(objectFromString);
                                        return [2 , declarativeRules];
                                }
                            });
                        }); },
                    },
                };
                return [2 , deserialized];
            });
        });
    };
    RuleSet.prototype.serialize = function () {
        var _a;
        return __awaiter(this, void 0, void 0, function () {
            var e_3, id, msg, data, lazyData, serialized;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        _b.trys.push([0, 2, , 3]);
                        return [4 , this.loadContent()];
                    case 1:
                        _b.sent();
                        return [3 , 3];
                    case 2:
                        e_3 = _b.sent();
                        id = this.getId();
                        msg = "Cannot serialize rule set '".concat(id, "' because of not available source");
                        throw new UnavailableRuleSetSourceError(msg, id, e_3);
                    case 3:
                        data = {
                            regexpRulesCount: this.regexpRulesCount,
                            rulesCount: this.rulesCount,
                            ruleSetHashMapRaw: this.rulesHashMap.serialize(),
                            badFilterRulesRaw: this.badFilterRules.map(function (r) { return r.rule.getText(); }) || [],
                        };
                        lazyData = {
                            sourceMapRaw: ((_a = this.sourceMap) === null || _a === void 0 ? void 0 : _a.serialize()) || '',
                            filterIds: Array.from(this.filterList.keys()),
                        };
                        serialized = {
                            id: this.id,
                            data: JSON.stringify(data),
                            lazyData: JSON.stringify(lazyData),
                        };
                        return [2 , serialized];
                }
            });
        });
    };
    return RuleSet;
}());
var InvalidDeclarativeRuleError =  (function (_super) {
    __extends(InvalidDeclarativeRuleError, _super);
    function InvalidDeclarativeRuleError(message, networkRule, declarativeRule) {
        var _this = _super.call(this, message) || this;
        _this.name = 'InvalidDeclarativeRuleError';
        _this.networkRule = networkRule;
        _this.declarativeRule = declarativeRule;
        Object.setPrototypeOf(_this, InvalidDeclarativeRuleError.prototype);
        return _this;
    }
    return InvalidDeclarativeRuleError;
}(Error));
var EmptyResourcesError =  (function (_super) {
    __extends(EmptyResourcesError, _super);
    function EmptyResourcesError(message, networkRule, declarativeRule) {
        var _this = _super.call(this, message, networkRule, declarativeRule) || this;
        _this.name = 'EmptyResourcesError';
        Object.setPrototypeOf(_this, EmptyResourcesError.prototype);
        return _this;
    }
    return EmptyResourcesError;
}(InvalidDeclarativeRuleError));
var UnsupportedModifierError =  (function (_super) {
    __extends(UnsupportedModifierError, _super);
    function UnsupportedModifierError(message, networkRule) {
        var _this = _super.call(this, message) || this;
        _this.name = 'UnsupportedModifierError';
        _this.networkRule = networkRule;
        Object.setPrototypeOf(_this, UnsupportedModifierError.prototype);
        return _this;
    }
    return UnsupportedModifierError;
}(Error));
var UnsupportedRegexpError =  (function (_super) {
    __extends(UnsupportedRegexpError, _super);
    function UnsupportedRegexpError(message, networkRule, declarativeRule, reason) {
        var _this = _super.call(this, message, networkRule, declarativeRule) || this;
        _this.name = 'UnsupportedRegexpError';
        _this.reason = reason;
        Object.setPrototypeOf(_this, UnsupportedRegexpError.prototype);
        return _this;
    }
    return UnsupportedRegexpError;
}(InvalidDeclarativeRuleError));
var EmptyOrNegativeNumberOfRulesError =  (function (_super) {
    __extends(EmptyOrNegativeNumberOfRulesError, _super);
    function EmptyOrNegativeNumberOfRulesError(message) {
        var _this = _super.call(this, message) || this;
        _this.name = 'EmptyOrNegativeNumberOfRulesError';
        Object.setPrototypeOf(_this, EmptyOrNegativeNumberOfRulesError.prototype);
        return _this;
    }
    return EmptyOrNegativeNumberOfRulesError;
}(Error));
var NegativeNumberOfRegexpRulesError =  (function (_super) {
    __extends(NegativeNumberOfRegexpRulesError, _super);
    function NegativeNumberOfRegexpRulesError(message) {
        var _this = _super.call(this, message) || this;
        _this.name = 'NegativeNumberOfRegexpRulesError';
        Object.setPrototypeOf(_this, NegativeNumberOfRegexpRulesError.prototype);
        return _this;
    }
    return NegativeNumberOfRegexpRulesError;
}(Error));
var ResourcesPathError =  (function (_super) {
    __extends(ResourcesPathError, _super);
    function ResourcesPathError(message) {
        var _this = _super.call(this, message) || this;
        _this.name = 'ResourcesPathError';
        Object.setPrototypeOf(_this, ResourcesPathError.prototype);
        return _this;
    }
    return ResourcesPathError;
}(Error));
var NetworkRuleDeclarativeValidator =  (function () {
    function NetworkRuleDeclarativeValidator() {
    }
    NetworkRuleDeclarativeValidator.checkRemoveParamModifierFn = function (r, name) {
        var removeParam = r.getAdvancedModifier();
        if (!removeParam) {
            return null;
        }
        if (!RemoveParamModifier.isRemoveParamModifier(removeParam)) {
            return null;
        }
        if (!removeParam.getMV3Validity()) {
            return new UnsupportedModifierError('Network rule with $removeparam modifier with negation or regexp is not supported', r);
        }
        return null;
    };
    NetworkRuleDeclarativeValidator.checkAllowRulesFn = function (r, name) {
        if (r.isAllowlist()) {
            return new UnsupportedModifierError("Network allowlist rule with ".concat(name, " modifier is not supported"), r);
        }
        return null;
    };
    NetworkRuleDeclarativeValidator.checkNotOnlyOneModifier = function (r, name) {
        var nameToCheck = name;
        if (nameToCheck.startsWith(OPTIONS_DELIMITER)) {
            nameToCheck = nameToCheck.slice(OPTIONS_DELIMITER.length);
        }
        var optionNames = r.getUsedOptionNames();
        if (optionNames.size === 1 && optionNames.has(nameToCheck)) {
            return new UnsupportedModifierError("Network rule with only one enabled modifier ".concat(name, " is not supported"), r);
        }
        return null;
    };
    NetworkRuleDeclarativeValidator.checkRemoveHeaderModifierFn = function (r, name) {
        var removeHeader = r.getAdvancedModifier();
        if (!removeHeader) {
            return null;
        }
        if (!RemoveHeaderModifier.isRemoveHeaderModifier(removeHeader)) {
            return null;
        }
        if (!removeHeader.isValid) {
            return new UnsupportedModifierError(
            'Network rule with $removeheader modifier contains some of the unsupported headers', r);
        }
        return null;
    };
    NetworkRuleDeclarativeValidator.checkMethodModifierFn = function (r, name) {
        var permittedMethods = r.getPermittedMethods();
        var restrictedMethods = r.getRestrictedMethods();
        if ((permittedMethods === null || permittedMethods === void 0 ? void 0 : permittedMethods.some(function (method) { return method === HTTPMethod.TRACE; }))
            || (restrictedMethods === null || restrictedMethods === void 0 ? void 0 : restrictedMethods.some(function (method) { return method === HTTPMethod.TRACE; }))) {
            return new UnsupportedModifierError('Network rule with $method modifier containing \'trace\' method is not supported', r);
        }
        return null;
    };
    NetworkRuleDeclarativeValidator.shouldConvertNetworkRule = function (rule) {
        var options = Object.keys(NetworkRuleOption).filter(function (key) { return key !== 'NotSet'; });
        for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
            var option = options_1[_i];
            var networkOption = NetworkRuleOption[option];
            if (!rule.isOptionEnabled(networkOption)) {
                continue;
            }
            var validator = this.optionsValidators[option];
            if (!validator) {
                throw new Error("Validator for option \"".concat(option, "\" is not found"));
            }
            var name_1 = validator.name, customChecks = validator.customChecks, skipConversion = validator.skipConversion, notSupported = validator.notSupported;
            if (notSupported) {
                throw new UnsupportedModifierError("Unsupported option \"".concat(name_1, "\""), rule);
            }
            if (skipConversion) {
                if (rule.isSingleOptionEnabled(networkOption)) {
                    return false;
                }
                continue;
            }
            if (customChecks) {
                for (var j = 0; j < customChecks.length; j += 1) {
                    var err = customChecks[j](rule, name_1);
                    if (err !== null) {
                        throw err;
                    }
                }
            }
        }
        return true;
    };
    NetworkRuleDeclarativeValidator.checkCookieModifierFn = function (r, name) {
        var cookieModifier = r.getAdvancedModifier();
        if (!cookieModifier) {
            return null;
        }
        if (!CookieModifier.isCookieModifier(cookieModifier)) {
            return null;
        }
        if (!cookieModifier.isEmpty()) {
            var msg = 'The use of additional parameters in $cookie (apart from $cookie itself) is not supported';
            return new UnsupportedModifierError(msg, r);
        }
        return null;
    };
    NetworkRuleDeclarativeValidator.checkDocumentAllowlistFn = function (r, name) {
        if (r.isFilteringDisabled()) {
            return null;
        }
        return new UnsupportedModifierError("Network rule with \"".concat(name, "\" modifier is not supported"), r);
    };
    NetworkRuleDeclarativeValidator.checkRedirectModifierFn = function (r, name) {
        var isRedirectRule = r.isOptionEnabled(NetworkRuleOption.Redirect)
            && r.getAdvancedModifier().isRedirectingOnlyBlocked;
        if (!isRedirectRule) {
            return null;
        }
        return new UnsupportedModifierError('Network rule with $redirect-rule modifier is not supported', r);
    };
    NetworkRuleDeclarativeValidator.optionsValidators = {
        ThirdParty: { name: '$third-party' },
        MatchCase: { name: '$match-case' },
        Important: { name: '$important' },
        To: { name: '$to' },
        Badfilter: { name: '$badfilter' },
        Permissions: { name: '$permissions' },
        Elemhide: { name: '$elemhide', skipConversion: true },
        Generichide: { name: '$generichide', skipConversion: true },
        Specifichide: { name: '$specifichide', skipConversion: true },
        Jsinject: { name: '$jsinject', customChecks: [NetworkRuleDeclarativeValidator.checkDocumentAllowlistFn] },
        Urlblock: { name: '$urlblock', customChecks: [NetworkRuleDeclarativeValidator.checkDocumentAllowlistFn] },
        Content: { name: '$content', customChecks: [NetworkRuleDeclarativeValidator.checkDocumentAllowlistFn] },
        Popup: { name: '$popup', customChecks: [NetworkRuleDeclarativeValidator.checkNotOnlyOneModifier] },
        Csp: { name: '$csp', customChecks: [NetworkRuleDeclarativeValidator.checkAllowRulesFn] },
        Redirect: {
            name: '$redirect',
            customChecks: [
                NetworkRuleDeclarativeValidator.checkAllowRulesFn,
                NetworkRuleDeclarativeValidator.checkRedirectModifierFn,
            ],
        },
        RemoveParam: {
            name: '$removeparam',
            customChecks: [
                NetworkRuleDeclarativeValidator.checkAllowRulesFn,
                NetworkRuleDeclarativeValidator.checkRemoveParamModifierFn,
            ],
        },
        RemoveHeader: {
            name: '$removeheader',
            customChecks: [
                NetworkRuleDeclarativeValidator.checkAllowRulesFn,
                NetworkRuleDeclarativeValidator.checkRemoveHeaderModifierFn,
            ],
        },
        Cookie: {
            name: '$cookie',
            customChecks: [
                NetworkRuleDeclarativeValidator.checkAllowRulesFn,
                NetworkRuleDeclarativeValidator.checkCookieModifierFn,
            ],
        },
        Method: { name: '$method', customChecks: [NetworkRuleDeclarativeValidator.checkMethodModifierFn] },
        Header: { name: '$header', notSupported: true },
        Genericblock: { name: '$genericblock', notSupported: true },
        Stealth: { name: '$stealth', notSupported: true },
        Replace: { name: '$replace', notSupported: true },
        JsonPrune: { name: '$jsonprune', notSupported: true },
        Hls: { name: '$hls', notSupported: true },
        Client: { name: '$client', notSupported: true },
        DnsRewrite: { name: '$dnsrewrite', notSupported: true },
        DnsType: { name: '$dnstype', notSupported: true },
        Ctag: { name: '$ctag', notSupported: true },
        Network: { name: '$network', notSupported: true },
        Extension: { name: '$extension', notSupported: true },
    };
    return NetworkRuleDeclarativeValidator;
}());
var EmptyDomainsError =  (function (_super) {
    __extends(EmptyDomainsError, _super);
    function EmptyDomainsError(message, networkRule, declarativeRule) {
        var _this = _super.call(this, message, networkRule, declarativeRule) || this;
        _this.name = 'EmptyDomainsError';
        Object.setPrototypeOf(_this, EmptyDomainsError.prototype);
        return _this;
    }
    return EmptyDomainsError;
}(InvalidDeclarativeRuleError));
var regexValidatorExtension = function (regexFilter) { return __awaiter(void 0, void 0, void 0, function () {
    return __generator(this, function (_a) {
        return [2 , new Promise(function (resolve, reject) {
                if (typeof chrome !== 'undefined' && chrome.declarativeNetRequest) {
                    var regexOptions = { regex: regexFilter };
                    chrome.declarativeNetRequest.isRegexSupported(regexOptions, function (result) {
                        if (chrome.runtime.lastError) {
                            reject(chrome.runtime.lastError);
                        }
                        else if (result.isSupported) {
                            resolve(true);
                        }
                        else {
                            reject(new Error(result.reason));
                        }
                    });
                }
                else {
                    reject(new Error('chrome.declarativeNetRequest is not available'));
                }
            })];
    });
}); };
var Re2Validator =  (function () {
    function Re2Validator() {
        this.validator = regexValidatorExtension;
    }
    Re2Validator.prototype.setValidator = function (validator) {
        this.validator = validator;
    };
    Re2Validator.prototype.isRegexSupported = function (regexFilter) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 , this.validator(regexFilter)];
            });
        });
    };
    return Re2Validator;
}());
var re2Validator = new Re2Validator();
var DeclarativeRuleConverter =  (function () {
    function DeclarativeRuleConverter(webAccessibleResourcesPath) {
        this.webAccessibleResourcesPath = webAccessibleResourcesPath;
    }
    DeclarativeRuleConverter.getResourceTypes = function (requestTypes) {
        return Object.entries(DECLARATIVE_RESOURCE_TYPES_MAP)
            .filter(function (_a) {
            var requestType = _a[1];
            return (requestTypes & requestType) === requestType;
        })
            .map(function (_a) {
            var resourceTypeKey = _a[0];
            return resourceTypeKey;
        });
    };
    DeclarativeRuleConverter.mapHttpMethodToDeclarativeHttpMethod = function (methods) {
        return methods
            .filter(function (m) { return m !== HTTPMethod.TRACE; })
            .map(function (m) { return DECLARATIVE_REQUEST_METHOD_MAP[m]; });
    };
    DeclarativeRuleConverter.isASCII = function (str) {
        return /^[\x00-\x7F]+$/.test(str);
    };
    DeclarativeRuleConverter.prepareASCII = function (str) {
        var res = str;
        try {
            if (!DeclarativeRuleConverter.isASCII(res)) {
                res = punycode.toASCII(res);
            }
            if (!DeclarativeRuleConverter.isASCII(res)) {
                res = punycode.encode(res);
            }
        }
        catch (e) {
            throw new Error("Error converting to ASCII: \"".concat(str, "\" due to ").concat(getErrorMessage$2(e)));
        }
        return res;
    };
    DeclarativeRuleConverter.removeSlashes = function (str) {
        if (str.startsWith('/') && str.endsWith('/')) {
            return str.substring(1, str.length - 1);
        }
        return str;
    };
    DeclarativeRuleConverter.toASCII = function (strings) {
        return strings.map(function (s) {
            return DeclarativeRuleConverter.prepareASCII(s);
        });
    };
    DeclarativeRuleConverter.isCompatibleWithAllowAllRequests = function (rule) {
        var types = DeclarativeRuleConverter.getResourceTypes(rule.getPermittedRequestTypes());
        var allowedRequestTypes = [ResourceType.MainFrame, ResourceType.SubFrame];
        if (types.some(function (type) { return !allowedRequestTypes.includes(type); })) {
            return false;
        }
        return true;
    };
    DeclarativeRuleConverter.getPriority = function (rule) {
        return rule.getPriorityWeight();
    };
    DeclarativeRuleConverter.prototype.getRedirectAction = function (rule) {
        if (rule.isOptionEnabled(NetworkRuleOption.Redirect)) {
            var resourcesPath = this.webAccessibleResourcesPath;
            if (!resourcesPath) {
                throw new ResourcesPathError('Empty web accessible resources path');
            }
            var advancedModifier = rule.getAdvancedModifier();
            var redirectTo = advancedModifier;
            var filename = scriptlets_umdExports.redirects.getRedirectFilename(redirectTo.getValue());
            return { extensionPath: "".concat(resourcesPath, "/").concat(filename) };
        }
        if (rule.isOptionEnabled(NetworkRuleOption.RemoveParam)) {
            var advancedModifier = rule.getAdvancedModifier();
            var removeParamModifier = advancedModifier;
            var value = removeParamModifier.getValue();
            if (value === '') {
                return { transform: { query: '' } };
            }
            return {
                transform: {
                    queryTransform: {
                        removeParams: DeclarativeRuleConverter.toASCII([value]),
                    },
                },
            };
        }
        return {};
    };
    DeclarativeRuleConverter.getModifyHeadersAction = function (rule) {
        if (!rule.isOptionEnabled(NetworkRuleOption.RemoveHeader)) {
            return null;
        }
        var removeHeaderModifier = rule.getAdvancedModifier();
        var removeRequestHeader = removeHeaderModifier.getApplicableHeaderName(true);
        if (removeRequestHeader) {
            return {
                requestHeaders: [{
                        header: removeRequestHeader,
                        operation: HeaderOperation.Remove,
                    }],
            };
        }
        var removeResponseHeader = removeHeaderModifier.getApplicableHeaderName(false);
        if (removeResponseHeader) {
            return {
                responseHeaders: [{
                        header: removeResponseHeader,
                        operation: HeaderOperation.Remove,
                    }],
            };
        }
        return null;
    };
    DeclarativeRuleConverter.getRemovingCookieHeadersAction = function (rule) {
        if (!rule.isOptionEnabled(NetworkRuleOption.Cookie)) {
            return null;
        }
        return {
            responseHeaders: [{
                    operation: HeaderOperation.Remove,
                    header: 'Set-Cookie',
                }],
            requestHeaders: [{
                    operation: HeaderOperation.Remove,
                    header: 'Cookie',
                }],
        };
    };
    DeclarativeRuleConverter.getAddingCspHeadersAction = function (rule) {
        if (!rule.isOptionEnabled(NetworkRuleOption.Csp)) {
            return null;
        }
        var cspHeaderValue = rule.getAdvancedModifierValue();
        if (cspHeaderValue) {
            return {
                operation: HeaderOperation.Append,
                header: CSP_HEADER_NAME,
                value: cspHeaderValue,
            };
        }
        return null;
    };
    DeclarativeRuleConverter.getAddingPermissionsHeadersAction = function (rule) {
        if (!rule.isOptionEnabled(NetworkRuleOption.Permissions)) {
            return null;
        }
        var permissionsHeaderValue = rule.getAdvancedModifierValue();
        if (permissionsHeaderValue) {
            return {
                operation: HeaderOperation.Append,
                header: PERMISSIONS_POLICY_HEADER_NAME,
                value: permissionsHeaderValue,
            };
        }
        return null;
    };
    DeclarativeRuleConverter.prototype.getAction = function (rule) {
        if (rule.isAllowlist()) {
            if (rule.isFilteringDisabled() && DeclarativeRuleConverter.isCompatibleWithAllowAllRequests(rule)) {
                return { type: RuleActionType.ALLOW_ALL_REQUESTS };
            }
            return { type: RuleActionType.ALLOW };
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Redirect)
            || rule.isOptionEnabled(NetworkRuleOption.RemoveParam)) {
            return {
                type: RuleActionType.REDIRECT,
                redirect: this.getRedirectAction(rule),
            };
        }
        if (rule.isOptionEnabled(NetworkRuleOption.RemoveHeader)) {
            var modifyHeadersAction = DeclarativeRuleConverter.getModifyHeadersAction(rule);
            if (modifyHeadersAction === null || modifyHeadersAction === void 0 ? void 0 : modifyHeadersAction.requestHeaders) {
                return {
                    type: RuleActionType.MODIFY_HEADERS,
                    requestHeaders: modifyHeadersAction.requestHeaders,
                };
            }
            if (modifyHeadersAction === null || modifyHeadersAction === void 0 ? void 0 : modifyHeadersAction.responseHeaders) {
                return {
                    type: RuleActionType.MODIFY_HEADERS,
                    responseHeaders: modifyHeadersAction.responseHeaders,
                };
            }
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Csp)) {
            var headersAction = DeclarativeRuleConverter.getAddingCspHeadersAction(rule);
            if (headersAction) {
                return {
                    type: RuleActionType.MODIFY_HEADERS,
                    responseHeaders: [headersAction],
                };
            }
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Permissions)) {
            var headersAction = DeclarativeRuleConverter.getAddingPermissionsHeadersAction(rule);
            if (headersAction) {
                return {
                    type: RuleActionType.MODIFY_HEADERS,
                    responseHeaders: [headersAction],
                };
            }
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Cookie)) {
            var removeCookieHeaders = DeclarativeRuleConverter.getRemovingCookieHeadersAction(rule);
            if (removeCookieHeaders) {
                var responseHeaders = removeCookieHeaders.responseHeaders, requestHeaders = removeCookieHeaders.requestHeaders;
                return {
                    type: RuleActionType.MODIFY_HEADERS,
                    responseHeaders: responseHeaders,
                    requestHeaders: requestHeaders,
                };
            }
        }
        return { type: RuleActionType.BLOCK };
    };
    DeclarativeRuleConverter.getCondition = function (rule) {
        var _a;
        var condition = {};
        var pattern = rule.getPattern();
        if (pattern) {
            if (rule.isRegexRule()) {
                var regexFilter = DeclarativeRuleConverter.removeSlashes(pattern);
                condition.regexFilter = DeclarativeRuleConverter.prepareASCII(regexFilter);
            }
            else {
                var patternWithoutVerticals = pattern.startsWith('||*')
                    ? pattern.substring(2)
                    : pattern;
                condition.urlFilter = DeclarativeRuleConverter.prepareASCII(patternWithoutVerticals);
            }
        }
        if (rule.isOptionEnabled(NetworkRuleOption.ThirdParty)) {
            condition.domainType = DomainType.ThirdParty;
        }
        else if (rule.isOptionDisabled(NetworkRuleOption.ThirdParty)) {
            condition.domainType = DomainType.FirstParty;
        }
        var permittedDomains = (_a = rule.getPermittedDomains()) === null || _a === void 0 ? void 0 : _a.filter(function (d) {
            return !d.includes(SimpleRegex.MASK_ANY_CHARACTER) && !SimpleRegex.isRegexPattern(d);
        });
        if (permittedDomains && permittedDomains.length > 0) {
            condition.initiatorDomains = this.toASCII(permittedDomains);
        }
        var excludedDomains = rule.getRestrictedDomains();
        if (excludedDomains && excludedDomains.length > 0) {
            condition.excludedInitiatorDomains = this.toASCII(excludedDomains);
        }
        var permittedToDomains = rule.getPermittedToDomains();
        if (permittedToDomains && permittedToDomains.length > 0) {
            condition.requestDomains = this.toASCII(permittedToDomains);
        }
        var denyAllowDomains = rule.getDenyAllowDomains();
        var restrictedToDomains = rule.getRestrictedToDomains();
        if (denyAllowDomains && denyAllowDomains.length !== 0) {
            condition.excludedRequestDomains = this.toASCII(denyAllowDomains);
        }
        else if (restrictedToDomains && restrictedToDomains.length !== 0) {
            condition.excludedRequestDomains = this.toASCII(restrictedToDomains);
        }
        var restrictedRequestTypes = rule.getRestrictedRequestTypes();
        var hasExcludedResourceTypes = restrictedRequestTypes !== 0;
        if (hasExcludedResourceTypes) {
            condition.excludedResourceTypes = this.getResourceTypes(restrictedRequestTypes);
            if (!condition.excludedResourceTypes.includes(ResourceType.MainFrame)) {
                condition.excludedResourceTypes.push(ResourceType.MainFrame);
            }
        }
        var permittedRequestTypes = rule.getPermittedRequestTypes();
        if (!hasExcludedResourceTypes && permittedRequestTypes !== 0) {
            condition.resourceTypes = this.getResourceTypes(permittedRequestTypes);
        }
        var permittedMethods = rule.getPermittedMethods();
        if (permittedMethods && permittedMethods.length !== 0) {
            condition.requestMethods = this.mapHttpMethodToDeclarativeHttpMethod(permittedMethods);
        }
        var restrictedMethods = rule.getRestrictedMethods();
        if (restrictedMethods && restrictedMethods.length !== 0) {
            condition.excludedRequestMethods = this.mapHttpMethodToDeclarativeHttpMethod(restrictedMethods);
        }
        if (rule.isOptionEnabled(NetworkRuleOption.MatchCase)) {
            condition.isUrlFilterCaseSensitive = rule.isOptionEnabled(NetworkRuleOption.MatchCase);
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Popup)) {
            condition.resourceTypes = condition.resourceTypes || [];
            if (!condition.resourceTypes.includes(ResourceType.MainFrame)) {
                condition.resourceTypes.push(ResourceType.MainFrame);
            }
        }
        var emptyResourceTypes = !condition.resourceTypes && !condition.excludedResourceTypes;
        if (emptyResourceTypes) {
            var shouldMatchAllResourcesTypes = rule.isOptionEnabled(NetworkRuleOption.RemoveHeader)
                || rule.isOptionEnabled(NetworkRuleOption.Csp)
                || rule.isOptionEnabled(NetworkRuleOption.Cookie)
                || rule.isOptionEnabled(NetworkRuleOption.To)
                || rule.isOptionEnabled(NetworkRuleOption.Method);
            var shouldMatchOnlyDocument = rule.isOptionEnabled(NetworkRuleOption.RemoveParam)
                || rule.isOptionEnabled(NetworkRuleOption.Permissions);
            if (shouldMatchAllResourcesTypes) {
                condition.resourceTypes = [
                    ResourceType.MainFrame,
                    ResourceType.SubFrame,
                    ResourceType.Stylesheet,
                    ResourceType.Script,
                    ResourceType.Image,
                    ResourceType.Font,
                    ResourceType.Object,
                    ResourceType.XmlHttpRequest,
                    ResourceType.Ping,
                    ResourceType.Media,
                    ResourceType.WebSocket,
                    ResourceType.Other,
                ];
            }
            else if (shouldMatchOnlyDocument) {
                condition.resourceTypes = [ResourceType.MainFrame, ResourceType.SubFrame];
            }
        }
        return condition;
    };
    DeclarativeRuleConverter.prototype.convertRule = function (rule, id) {
        return __awaiter(this, void 0, void 0, function () {
            var shouldConvert, declarativeRule, priority, conversionErr;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        shouldConvert = NetworkRuleDeclarativeValidator.shouldConvertNetworkRule(rule);
                        if (!shouldConvert) {
                            return [2 , []];
                        }
                        declarativeRule = {
                            id: id,
                            action: this.getAction(rule),
                            condition: DeclarativeRuleConverter.getCondition(rule),
                        };
                        priority = DeclarativeRuleConverter.getPriority(rule);
                        if (priority) {
                            declarativeRule.priority = priority;
                        }
                        return [4 , DeclarativeRuleConverter.checkDeclarativeRuleApplicable(rule, declarativeRule)];
                    case 1:
                        conversionErr = _a.sent();
                        if (conversionErr) {
                            throw conversionErr;
                        }
                        return [2 , [declarativeRule]];
                }
            });
        });
    };
    DeclarativeRuleConverter.checkDeclarativeRuleApplicable = function (networkRule, declarativeRule) {
        return __awaiter(this, void 0, void 0, function () {
            var _a, regexFilter, resourceTypes, permittedDomains, initiatorDomains, ruleText, msg, e_1, ruleText, msg;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        _a = declarativeRule.condition, regexFilter = _a.regexFilter, resourceTypes = _a.resourceTypes;
                        if ((resourceTypes === null || resourceTypes === void 0 ? void 0 : resourceTypes.length) === 0) {
                            return [2 , new EmptyResourcesError('Conversion resourceTypes is empty', networkRule, declarativeRule)];
                        }
                        permittedDomains = networkRule.getPermittedDomains();
                        if (permittedDomains && permittedDomains.length > 0) {
                            initiatorDomains = declarativeRule.condition.initiatorDomains;
                            if (!initiatorDomains || initiatorDomains.length === 0) {
                                ruleText = networkRule.getText();
                                msg = "Conversion initiatorDomains is empty, but original rule's domains not: \"".concat(ruleText, "\"");
                                return [2 , new EmptyDomainsError(msg, networkRule, declarativeRule)];
                            }
                        }
                        if (!regexFilter) return [3 , 4];
                        _b.label = 1;
                    case 1:
                        _b.trys.push([1, 3, , 4]);
                        return [4 , re2Validator.isRegexSupported(regexFilter)];
                    case 2:
                        _b.sent();
                        return [3 , 4];
                    case 3:
                        e_1 = _b.sent();
                        ruleText = networkRule.getText();
                        msg = "Regex is unsupported: \"".concat(ruleText, "\"");
                        return [2 , new UnsupportedRegexpError(msg, networkRule, declarativeRule, getErrorMessage$2(e_1))];
                    case 4: return [2 , null];
                }
            });
        });
    };
    DeclarativeRuleConverter.catchErrorDuringConversion = function (rule, index, id, e) {
        if (e instanceof EmptyResourcesError
            || e instanceof UnsupportedModifierError
            || e instanceof UnsupportedRegexpError
            || e instanceof EmptyDomainsError) {
            return e;
        }
        var msg = "Non-categorized error during a conversion rule (index - ".concat(index, ", id - ").concat(id, ")");
        return e instanceof Error
            ? new Error(msg, { cause: e })
            : new Error(msg);
    };
    DeclarativeRuleConverter.prototype.convertRules = function (filterId, rules, offsetId) {
        return __awaiter(this, void 0, void 0, function () {
            var res;
            var _this = this;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        res = {
                            declarativeRules: [],
                            errors: [],
                            sourceMapValues: [],
                        };
                        return [4 , Promise.all(rules.map(function (_a) {
                                var rule = _a.rule, index = _a.index;
                                return __awaiter(_this, void 0, void 0, function () {
                                    var id, converted, e_2, err;
                                    return __generator(this, function (_b) {
                                        switch (_b.label) {
                                            case 0:
                                                id = offsetId + index;
                                                converted = [];
                                                _b.label = 1;
                                            case 1:
                                                _b.trys.push([1, 3, , 4]);
                                                return [4 , this.convertRule(rule, id)];
                                            case 2:
                                                converted = _b.sent();
                                                return [3 , 4];
                                            case 3:
                                                e_2 = _b.sent();
                                                err = DeclarativeRuleConverter.catchErrorDuringConversion(rule, index, id, e_2);
                                                res.errors.push(err);
                                                return [2 ];
                                            case 4:
                                                converted.forEach(function (dRule) {
                                                    res.sourceMapValues.push({
                                                        declarativeRuleId: dRule.id,
                                                        sourceRuleIndex: index,
                                                        filterId: filterId,
                                                    });
                                                    res.declarativeRules.push(dRule);
                                                });
                                                return [2 ];
                                        }
                                    });
                                });
                            }))];
                    case 1:
                        _a.sent();
                        return [2 , res];
                }
            });
        });
    };
    DeclarativeRuleConverter.prototype.groupConvertedRules = function (converted, createRuleTemplate, combineRulePair) {
        var rulesTemplates = new Map();
        var saveRuleTemplate = function (rule) {
            var template = createRuleTemplate(rule);
            rulesTemplates.set(template, rule);
        };
        var result = {
            declarativeRules: [],
            sourceMapValues: [],
            errors: converted.errors,
        };
        var sourceMapValues = converted.sourceMapValues, declarativeRules = converted.declarativeRules;
        declarativeRules.forEach(function (dRule) {
            var template = createRuleTemplate(dRule);
            var siblingDeclarativeRule = rulesTemplates.get(template);
            var source = sourceMapValues.find(function (s) { return s.declarativeRuleId === dRule.id; });
            if (source === undefined) {
                result.errors.push(new Error("Cannot find source for converted rule \"".concat(dRule, "\"")));
                return;
            }
            if (siblingDeclarativeRule) {
                var combinedRule = combineRulePair(siblingDeclarativeRule, dRule);
                saveRuleTemplate(combinedRule);
                result.sourceMapValues.push(__assign(__assign({}, source), { declarativeRuleId: combinedRule.id }));
            }
            else {
                saveRuleTemplate(dRule);
                result.sourceMapValues.push(source);
            }
        });
        result.declarativeRules = Array.from(rulesTemplates.values());
        return result;
    };
    return DeclarativeRuleConverter;
}());
var RegularRulesConverter =  (function (_super) {
    __extends(RegularRulesConverter, _super);
    function RegularRulesConverter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RegularRulesConverter.prototype.convert = function (filterId, rules, offsetId) {
        return this.convertRules(filterId, rules, offsetId);
    };
    return RegularRulesConverter;
}(DeclarativeRuleConverter));
var RemoveParamRulesConverter =  (function (_super) {
    __extends(RemoveParamRulesConverter, _super);
    function RemoveParamRulesConverter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RemoveParamRulesConverter.prototype.convert = function (filterId, rules, offsetId) {
        return __awaiter(this, void 0, void 0, function () {
            var createRuleTemplate, combineRulePair, converted, result;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        createRuleTemplate = function (rule) {
                            var _a, _b, _c, _d;
                            var template = JSON.parse(JSON.stringify(rule));
                            delete template.id;
                            (_d = (_c = (_b = (_a = template.action) === null || _a === void 0 ? void 0 : _a.redirect) === null || _b === void 0 ? void 0 : _b.transform) === null || _c === void 0 ? void 0 : _c.queryTransform) === null || _d === void 0 ? true : delete _d.removeParams;
                            return JSON.stringify(template);
                        };
                        combineRulePair = function (sourceRule, ruleToMerge) {
                            var _a, _b, _c, _d, _e, _f, _g;
                            var resultRule = JSON.parse(JSON.stringify(sourceRule));
                            var params = ((_c = (_b = (_a = ruleToMerge.action.redirect) === null || _a === void 0 ? void 0 : _a.transform) === null || _b === void 0 ? void 0 : _b.queryTransform) === null || _c === void 0 ? void 0 : _c.removeParams) || [];
                            (_g = (_f = (_e = (_d = resultRule.action.redirect) === null || _d === void 0 ? void 0 : _d.transform) === null || _e === void 0 ? void 0 : _e.queryTransform) === null || _f === void 0 ? void 0 : _f.removeParams) === null || _g === void 0 ? void 0 : _g.push.apply(_g, params);
                            return resultRule;
                        };
                        return [4 , this.convertRules(filterId, rules, offsetId)];
                    case 1:
                        converted = _a.sent();
                        result = this.groupConvertedRules(converted, createRuleTemplate, combineRulePair);
                        return [2 , result];
                }
            });
        });
    };
    return RemoveParamRulesConverter;
}(DeclarativeRuleConverter));
var RemoveHeaderRulesConverter =  (function (_super) {
    __extends(RemoveHeaderRulesConverter, _super);
    function RemoveHeaderRulesConverter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RemoveHeaderRulesConverter.prototype.convert = function (filterId, rules, offsetId) {
        return __awaiter(this, void 0, void 0, function () {
            var createRuleTemplate, combineRulePair, converted, result;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        createRuleTemplate = function (rule) {
                            var template = JSON.parse(JSON.stringify(rule));
                            delete template.id;
                            delete template.action.requestHeaders;
                            delete template.action.responseHeaders;
                            return JSON.stringify(template);
                        };
                        combineRulePair = function (sourceRule, ruleToMerge) {
                            var _a, _b;
                            var resultRule = JSON.parse(JSON.stringify(sourceRule));
                            var _c = ruleToMerge.action, responseHeaders = _c.responseHeaders, requestHeaders = _c.requestHeaders;
                            if (responseHeaders) {
                                if (resultRule.action.responseHeaders) {
                                    (_a = resultRule.action.responseHeaders).push.apply(_a, responseHeaders);
                                }
                                else {
                                    resultRule.action.responseHeaders = responseHeaders;
                                }
                            }
                            if (requestHeaders) {
                                if (resultRule.action.requestHeaders) {
                                    (_b = resultRule.action.requestHeaders).push.apply(_b, requestHeaders);
                                }
                                else {
                                    resultRule.action.requestHeaders = requestHeaders;
                                }
                            }
                            return resultRule;
                        };
                        return [4 , this.convertRules(filterId, rules, offsetId)];
                    case 1:
                        converted = _a.sent();
                        result = this.groupConvertedRules(converted, createRuleTemplate, combineRulePair);
                        return [2 , result];
                }
            });
        });
    };
    return RemoveHeaderRulesConverter;
}(DeclarativeRuleConverter));
var CspRulesConverter =  (function (_super) {
    __extends(CspRulesConverter, _super);
    function CspRulesConverter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    CspRulesConverter.prototype.convert = function (filterId, rules, offsetId) {
        return __awaiter(this, void 0, void 0, function () {
            var createRuleTemplate, combineRulePair, converted, result;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        createRuleTemplate = function (rule) {
                            var template = JSON.parse(JSON.stringify(rule));
                            delete template.id;
                            delete template.action.responseHeaders[0].value;
                            return JSON.stringify(template);
                        };
                        combineRulePair = function (sourceRule, ruleToMerge) {
                            var resultRule = JSON.parse(JSON.stringify(sourceRule));
                            if (!ruleToMerge.action.responseHeaders || ruleToMerge.action.responseHeaders.length === 0) {
                                return resultRule;
                            }
                            var cspHeaderToMerge = ruleToMerge.action.responseHeaders
                                .find(function (h) { return h.header === CSP_HEADER_NAME; });
                            if (!cspHeaderToMerge) {
                                return resultRule;
                            }
                            if (resultRule.action.responseHeaders && resultRule.action.responseHeaders.length > 0) {
                                var idx = resultRule.action.responseHeaders
                                    .findIndex(function (h) { return h.header === CSP_HEADER_NAME; });
                                if (idx === -1) {
                                    return resultRule;
                                }
                                var cspHeaderValue = resultRule.action.responseHeaders[idx].value;
                                if (cspHeaderValue) {
                                    resultRule.action.responseHeaders[idx].value = "".concat(cspHeaderValue, "; ").concat(cspHeaderToMerge.value);
                                }
                                else {
                                    resultRule.action.responseHeaders[idx].value = cspHeaderToMerge.value;
                                }
                            }
                            else {
                                resultRule.action.responseHeaders = [cspHeaderToMerge];
                            }
                            return resultRule;
                        };
                        return [4 , this.convertRules(filterId, rules, offsetId)];
                    case 1:
                        converted = _a.sent();
                        result = this.groupConvertedRules(converted, createRuleTemplate, combineRulePair);
                        return [2 , result];
                }
            });
        });
    };
    return CspRulesConverter;
}(DeclarativeRuleConverter));
var MaxScannedRulesError =  (function (_super) {
    __extends(MaxScannedRulesError, _super);
    function MaxScannedRulesError(message, lineIndex) {
        var _this = _super.call(this, message) || this;
        _this.name = 'MaxScannedRulesError';
        _this.lineIndex = lineIndex;
        Object.setPrototypeOf(_this, MaxScannedRulesError.prototype);
        return _this;
    }
    return MaxScannedRulesError;
}(Error));
var TooManyRegexpRulesError =  (function (_super) {
    __extends(TooManyRegexpRulesError, _super);
    function TooManyRegexpRulesError(message, excludedRulesIds, numberOfMaximumRules, numberOfExcludedDeclarativeRules) {
        var _this = _super.call(this, message) || this;
        _this.name = 'TooManyRegexpRulesError';
        _this.excludedRulesIds = excludedRulesIds;
        _this.numberOfMaximumRules = numberOfMaximumRules;
        _this.numberOfExcludedDeclarativeRules = numberOfExcludedDeclarativeRules;
        Object.setPrototypeOf(_this, TooManyRegexpRulesError.prototype);
        return _this;
    }
    return TooManyRegexpRulesError;
}(Error));
var TooManyRulesError =  (function (_super) {
    __extends(TooManyRulesError, _super);
    function TooManyRulesError(message, excludedRulesIds, numberOfMaximumRules, numberOfExcludedDeclarativeRules) {
        var _this = _super.call(this, message) || this;
        _this.name = 'TooManyRulesError';
        _this.excludedRulesIds = excludedRulesIds;
        _this.numberOfMaximumRules = numberOfMaximumRules;
        _this.numberOfExcludedDeclarativeRules = numberOfExcludedDeclarativeRules;
        Object.setPrototypeOf(_this, TooManyRulesError.prototype);
        return _this;
    }
    return TooManyRulesError;
}(Error));
var BadFilterRulesConverter =  (function (_super) {
    __extends(BadFilterRulesConverter, _super);
    function BadFilterRulesConverter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    BadFilterRulesConverter.prototype.convert = function (
    filterId,
    rules,
    offsetId) {
        return Promise.resolve({
            sourceMapValues: [],
            declarativeRules: [],
            errors: [],
        });
    };
    return BadFilterRulesConverter;
}(DeclarativeRuleConverter));
var RulesGroup;
(function (RulesGroup) {
    RulesGroup[RulesGroup["Regular"] = 0] = "Regular";
    RulesGroup[RulesGroup["RemoveParam"] = 1] = "RemoveParam";
    RulesGroup[RulesGroup["RemoveHeader"] = 2] = "RemoveHeader";
    RulesGroup[RulesGroup["Csp"] = 3] = "Csp";
    RulesGroup[RulesGroup["BadFilter"] = 4] = "BadFilter";
})(RulesGroup || (RulesGroup = {}));
var DeclarativeRulesGrouper =  (function () {
    function DeclarativeRulesGrouper() {
    }
    DeclarativeRulesGrouper.getRuleGroup = function (indexedNetworkRuleWithHash) {
        var rule = indexedNetworkRuleWithHash.rule;
        if (rule.isOptionEnabled(NetworkRuleOption.RemoveParam)) {
            return RulesGroup.RemoveParam;
        }
        if (rule.isOptionEnabled(NetworkRuleOption.RemoveHeader)) {
            return RulesGroup.RemoveHeader;
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Csp)) {
            return RulesGroup.Csp;
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Badfilter)) {
            return RulesGroup.BadFilter;
        }
        return RulesGroup.Regular;
    };
    DeclarativeRulesGrouper.splitRulesByGroups = function (rules) {
        var _a;
        var rulesToProcess = (_a = {},
            _a[RulesGroup.RemoveParam] = [],
            _a[RulesGroup.RemoveHeader] = [],
            _a[RulesGroup.BadFilter] = [],
            _a[RulesGroup.Regular] = [],
            _a[RulesGroup.Csp] = [],
            _a);
        rules.forEach(function (indexedNetworkRuleWithHash) {
            var group = DeclarativeRulesGrouper.getRuleGroup(indexedNetworkRuleWithHash);
            rulesToProcess[group].push(indexedNetworkRuleWithHash);
        });
        return rulesToProcess;
    };
    return DeclarativeRulesGrouper;
}());
var _a;
var DeclarativeRulesConverter =  (function () {
    function DeclarativeRulesConverter() {
    }
    DeclarativeRulesConverter.convert = function (filtersWithRules, options) {
        return __awaiter(this, void 0, void 0, function () {
            var filters, converted, _i, filters_1, _a, filterId, groupedRules, highestUsedId, _b, sourceMapValues, declarativeRules, errors;
            return __generator(this, function (_c) {
                switch (_c.label) {
                    case 0:
                        filters = this.applyBadFilter(filtersWithRules);
                        converted = {
                            sourceMapValues: [],
                            declarativeRules: [],
                            errors: [],
                        };
                        _i = 0, filters_1 = filters;
                        _c.label = 1;
                    case 1:
                        if (!(_i < filters_1.length)) return [3 , 4];
                        _a = filters_1[_i], filterId = _a[0], groupedRules = _a[1];
                        highestUsedId = converted.declarativeRules.reduce(function (currentMax, rule) {
                            return Math.max(currentMax, rule.id);
                        }, DeclarativeRulesConverter.START_DECLARATIVE_RULE_ID);
                        return [4 , this.convertRules(filterId, groupedRules, highestUsedId, options)];
                    case 2:
                        _b = _c.sent(), sourceMapValues = _b.sourceMapValues, declarativeRules = _b.declarativeRules, errors = _b.errors;
                        converted.sourceMapValues = converted.sourceMapValues.concat(sourceMapValues);
                        converted.declarativeRules = converted.declarativeRules.concat(declarativeRules);
                        converted.errors = converted.errors.concat(errors);
                        _c.label = 3;
                    case 3:
                        _i++;
                        return [3 , 1];
                    case 4:
                        converted = this.checkLimitations(converted, options === null || options === void 0 ? void 0 : options.maxNumberOfRules, options === null || options === void 0 ? void 0 : options.maxNumberOfRegexpRules);
                        if (!this.checkRulesHaveUniqueIds(converted.declarativeRules)) {
                            throw new Error('Declarative rules have non-unique identifiers.');
                        }
                        return [2 , converted];
                }
            });
        });
    };
    DeclarativeRulesConverter.convertRules = function (filterId, groupsRules, lastUsedId, options) {
        return __awaiter(this, void 0, void 0, function () {
            var converted, groups;
            var _this = this;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        converted = {
                            sourceMapValues: [],
                            declarativeRules: [],
                            errors: [],
                        };
                        groups = Object.keys(groupsRules).map(Number);
                        return [4 , Promise.all(groups.map(function (key) { return __awaiter(_this, void 0, void 0, function () {
                                var converter, _a, sourceMapValues, declarativeRules, errors;
                                return __generator(this, function (_b) {
                                    switch (_b.label) {
                                        case 0:
                                            converter = new DeclarativeRulesConverter.converters[key](options === null || options === void 0 ? void 0 : options.resourcesPath);
                                            return [4 , converter.convert(filterId, groupsRules[key], lastUsedId)];
                                        case 1:
                                            _a = _b.sent(), sourceMapValues = _a.sourceMapValues, declarativeRules = _a.declarativeRules, errors = _a.errors;
                                            converted.sourceMapValues = converted.sourceMapValues.concat(sourceMapValues);
                                            converted.declarativeRules = converted.declarativeRules.concat(declarativeRules);
                                            converted.errors = converted.errors.concat(errors);
                                            return [2 ];
                                    }
                                });
                            }); }))];
                    case 1:
                        _a.sent();
                        return [2 , converted];
                }
            });
        });
    };
    DeclarativeRulesConverter.checkRulesHaveUniqueIds = function (rules) {
        var ids = rules.map(function (_a) {
            var id = _a.id;
            return id;
        });
        var uniqueIds = new Set(ids);
        return uniqueIds.size === rules.length;
    };
    DeclarativeRulesConverter.checkLimitations = function (converted, maxNumberOfRules, maxNumberOfRegexpRules) {
        var limitations = [];
        var declarativeRules = converted.declarativeRules, sourceMapValues = converted.sourceMapValues, errors = converted.errors;
        var convertedRulesErrors = [];
        var otherErrors = [];
        for (var i = 0; i < errors.length; i += 1) {
            var e = errors[i];
            if (e instanceof InvalidDeclarativeRuleError) {
                convertedRulesErrors.push(e);
            }
            else {
                otherErrors.push(e);
            }
        }
        var convertedRulesErrorsIndex = new Map();
        convertedRulesErrors.forEach(function (e) {
            var errorsList = convertedRulesErrorsIndex.get(e.declarativeRule.id);
            var newValue = errorsList
                ? errorsList.concat(e)
                : [e];
            convertedRulesErrorsIndex.set(e.declarativeRule.id, newValue);
        });
        var sourcesIndex = new Map();
        sourceMapValues.forEach(function (source) {
            var sources = sourcesIndex.get(source.declarativeRuleId);
            var newValue = sources
                ? sources.concat(source)
                : [source];
            sourcesIndex.set(source.declarativeRuleId, newValue);
        });
        if (maxNumberOfRules && declarativeRules.length > maxNumberOfRules) {
            var filteredRules = [];
            var excludedRulesIds = [];
            for (var i = 0; i < declarativeRules.length; i += 1) {
                var rule = declarativeRules[i];
                if (i < maxNumberOfRules) {
                    filteredRules.push(rule);
                    continue;
                }
                var sources = sourcesIndex.get(rule.id) || [];
                var sourcesRulesIds = sources.map(function (_a) {
                    var sourceRuleIndex = _a.sourceRuleIndex;
                    return sourceRuleIndex;
                });
                sourcesIndex.set(rule.id, []);
                convertedRulesErrorsIndex.set(rule.id, []);
                excludedRulesIds.push.apply(excludedRulesIds, sourcesRulesIds);
            }
            var msg = 'After conversion, too many declarative rules remain: '
                + "".concat(declarativeRules.length, " exceeds ")
                + "the limit provided - ".concat(maxNumberOfRules);
            var err = new TooManyRulesError(msg, excludedRulesIds, maxNumberOfRules, declarativeRules.length - maxNumberOfRules);
            limitations.push(err);
            declarativeRules = filteredRules;
        }
        if (maxNumberOfRegexpRules) {
            var filteredRules = [];
            var excludedRulesIds = [];
            var regexpRulesCounter = 0;
            for (var i = 0; i < declarativeRules.length; i += 1) {
                var rule = declarativeRules[i];
                var isRegexp = rule.condition.regexFilter !== undefined;
                if (isRegexp) {
                    regexpRulesCounter += 1;
                    if (regexpRulesCounter > maxNumberOfRegexpRules) {
                        var sources = sourcesIndex.get(rule.id) || [];
                        var sourcesRulesIds = sources.map(function (_a) {
                            var sourceRuleIndex = _a.sourceRuleIndex;
                            return sourceRuleIndex;
                        });
                        sourcesIndex.set(rule.id, []);
                        convertedRulesErrorsIndex.set(rule.id, []);
                        excludedRulesIds.push.apply(excludedRulesIds, sourcesRulesIds);
                        continue;
                    }
                }
                filteredRules.push(rule);
            }
            if (regexpRulesCounter > maxNumberOfRegexpRules) {
                var msg = 'After conversion, too many regexp rules remain: '
                    + "".concat(regexpRulesCounter, " exceeds ")
                    + "the limit provided - ".concat(maxNumberOfRegexpRules);
                var err = new TooManyRegexpRulesError(msg, excludedRulesIds, maxNumberOfRegexpRules, regexpRulesCounter - maxNumberOfRegexpRules);
                limitations.push(err);
            }
            declarativeRules = filteredRules;
        }
        sourceMapValues = Array.from(sourcesIndex.values())
            .filter(function (arr) { return arr.length > 0; })
            .flat();
        errors = Array.from(convertedRulesErrorsIndex.values())
            .filter(function (arr) { return arr.length > 0; })
            .flat();
        return {
            sourceMapValues: sourceMapValues,
            declarativeRules: declarativeRules,
            errors: errors.concat(otherErrors),
            limitations: limitations,
        };
    };
    DeclarativeRulesConverter.applyBadFilter = function (filtersWithRules) {
        var allBadFilterRules = [];
        var filterIdsWithGroupedRules = filtersWithRules
            .map(function (_a) {
            var id = _a.id, rules = _a.rules;
            var rulesToProcess = DeclarativeRulesGrouper.splitRulesByGroups(rules);
            allBadFilterRules = allBadFilterRules.concat(rulesToProcess[RulesGroup.BadFilter]);
            var tuple = [id, rulesToProcess];
            return tuple;
        });
        var filterByBadFilterFn = function (ruleToTest) {
            var networkRuleToTest = ruleToTest.rule;
            for (var _i = 0, allBadFilterRules_1 = allBadFilterRules; _i < allBadFilterRules_1.length; _i++) {
                var rule = allBadFilterRules_1[_i].rule;
                if (rule.negatesBadfilter(networkRuleToTest)) {
                    return false;
                }
            }
            return true;
        };
        return filterIdsWithGroupedRules.map(function (_a) {
            var filterId = _a[0], groupedRules = _a[1];
            var filtered = groupedRules;
            var groups = Object.keys(filtered).map(Number);
            groups.forEach(function (key) {
                filtered[key] = filtered[key].filter(filterByBadFilterFn);
            });
            filtered[RulesGroup.BadFilter] = [];
            return [filterId, filtered];
        });
    };
    DeclarativeRulesConverter.START_DECLARATIVE_RULE_ID = 1;
    DeclarativeRulesConverter.converters = (_a = {},
        _a[RulesGroup.Regular] = RegularRulesConverter,
        _a[RulesGroup.Csp] = CspRulesConverter,
        _a[RulesGroup.RemoveParam] = RemoveParamRulesConverter,
        _a[RulesGroup.RemoveHeader] = RemoveHeaderRulesConverter,
        _a[RulesGroup.BadFilter] = BadFilterRulesConverter,
        _a);
    return DeclarativeRulesConverter;
}());
var RulesHashMap =  (function () {
    function RulesHashMap(listOfRulesWithHash) {
        var _this = this;
        this.map = new Map();
        listOfRulesWithHash.forEach(function (_a) {
            var hash = _a.hash, source = _a.source;
            var existingValue = _this.map.get(hash);
            if (existingValue) {
                existingValue.push(source);
            }
            else {
                _this.map.set(hash, [source]);
            }
        });
    }
    RulesHashMap.prototype.findRules = function (hash) {
        return this.map.get(hash) || [];
    };
    RulesHashMap.deserializeSources = function (rawString) {
        var plainArray = JSON.parse(rawString);
        var allPairs = plainArray
            .map(function (_a) {
            var hash = _a[0], sources = _a[1];
            return sources.map(function (_a) {
                var filterId = _a[0], sourceRuleIndex = _a[1];
                return {
                    hash: hash,
                    source: {
                        filterId: filterId,
                        sourceRuleIndex: sourceRuleIndex,
                    },
                };
            });
        })
            .flat();
        return allPairs;
    };
    RulesHashMap.prototype.serialize = function () {
        var arr = Array.from(this.map);
        var serializedValues = arr
            .map(function (_a) {
            var hash = _a[0], source = _a[1];
            var sources = source.map(function (s) {
                return [s.filterId, s.sourceRuleIndex];
            });
            return [hash, sources];
        });
        return JSON.stringify(serializedValues);
    };
    return RulesHashMap;
}());
var BufferReader =  (function () {
    function BufferReader(buffer) {
        this.currentIndex = 0;
        this.buffer = buffer;
        this.currentIndex = this.buffer.currentOffset;
    }
    BufferReader.prototype.readNext = function () {
        if (this.buffer.peekUint8() === 0) {
            return null;
        }
        var ruleNode;
        RuleParser.deserialize(this.buffer, ruleNode = {});
        this.currentIndex = this.buffer.currentOffset;
        if (ruleNode.category) {
            return ruleNode;
        }
        return null;
    };
    BufferReader.prototype.getCurrentPos = function () {
        return this.currentIndex;
    };
    BufferReader.prototype.getDataLength = function () {
        return this.buffer.capacity;
    };
    return BufferReader;
}());
zod__WEBPACK_IMPORTED_MODULE_3__.z.record(
zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
zod__WEBPACK_IMPORTED_MODULE_3__.z.number());
var getRuleSourceText = function (lineStartIndex, source) {
    var lineEndIndex = findNextLineBreakIndex(source, lineStartIndex)[0];
    if (lineEndIndex === -1) {
        lineEndIndex = source.length;
    }
    if (lineStartIndex >= lineEndIndex) {
        return null;
    }
    var ruleSourceText = source.slice(lineStartIndex, lineEndIndex);
    return ruleSourceText.split('').join('');
};
var getRuleSourceIndex = function (ruleIdx, sourceMap) {
    var _a;
    return (_a = sourceMap[ruleIdx]) !== null && _a !== void 0 ? _a : RULE_INDEX_NONE;
};
var FilterScanner =  (function () {
    function FilterScanner(filter, filterId) {
        this.filter = filter;
        this.filterId = filterId;
    }
    FilterScanner.createNew = function (filter) {
        return __awaiter(this, void 0, void 0, function () {
            var content;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 , filter.getContent()];
                    case 1:
                        content = _a.sent();
                        return [2 , new FilterScanner(content, filter.getId())];
                }
            });
        });
    };
    FilterScanner.prototype.getIndexedRules = function (filterFn, maxNumberOfScannedNetworkRules) {
        var _a;
        var filterList = this.filter.filterList;
        var result = {
            errors: [],
            rules: [],
        };
        var buffer = new InputByteBuffer(filterList);
        var reader = new BufferReader(buffer);
        var ruleBufferIndex = reader.getCurrentPos();
        var ruleNode = reader.readNext();
        var curNumberOfScannedNetworkRules = 0;
        while (ruleNode) {
            var indexedNetworkRulesWithHash = [];
            try {
                indexedNetworkRulesWithHash = IndexedNetworkRuleWithHash.createFromNode(this.filterId, ruleBufferIndex, ruleNode);
            }
            catch (e) {
                if (e instanceof Error) {
                    result.errors.push(e);
                }
                else {
                    var lineIndex = getRuleSourceIndex(ruleBufferIndex, this.filter.sourceMap);
                    var rawRule = getRuleSourceText(lineIndex, this.filter.rawFilterList);
                    var originalRawRule = this.filter.conversionMap[lineIndex];
                    var errorMessage = "Unknown error during creating indexed rule with hash from raw string: filter id - ".concat(this.filterId, ", line index - ").concat(lineIndex, ", line - ").concat(rawRule);
                    if (originalRawRule) {
                        errorMessage += ", original line - ".concat(originalRawRule);
                    }
                    var err = new Error(errorMessage);
                    result.errors.push(err);
                }
                continue;
            }
            finally {
                ruleBufferIndex = reader.getCurrentPos();
                ruleNode = reader.readNext();
            }
            var filteredRules = filterFn
                ? indexedNetworkRulesWithHash.filter(filterFn)
                : indexedNetworkRulesWithHash;
            (_a = result.rules).push.apply(_a, filteredRules);
            curNumberOfScannedNetworkRules += filteredRules.length;
            if (maxNumberOfScannedNetworkRules !== undefined
                && curNumberOfScannedNetworkRules >= maxNumberOfScannedNetworkRules) {
                var lastScannedRule = indexedNetworkRulesWithHash[indexedNetworkRulesWithHash.length - 1];
                var lineIndex = getRuleSourceIndex(lastScannedRule.index, this.filter.sourceMap);
                var err = new MaxScannedRulesError("Maximum number of scanned network rules reached at line index ".concat(lineIndex, "."), lineIndex);
                result.errors.push(err);
                break;
            }
        }
        return result;
    };
    return FilterScanner;
}());
var NetworkRulesScanner =  (function () {
    function NetworkRulesScanner() {
    }
    NetworkRulesScanner.scanRules = function (filterList, filterFn, maxNumberOfScannedNetworkRules) {
        return __awaiter(this, void 0, void 0, function () {
            var res, promises, tasks;
            var _this = this;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        res = {
                            errors: [],
                            filters: [],
                        };
                        promises = filterList.map(function (filter) { return __awaiter(_this, void 0, void 0, function () {
                            var scanner, _a, errors, rules, badFilterRules;
                            return __generator(this, function (_b) {
                                switch (_b.label) {
                                    case 0: return [4 , FilterScanner.createNew(filter)];
                                    case 1:
                                        scanner = _b.sent();
                                        _a = scanner.getIndexedRules(filterFn, maxNumberOfScannedNetworkRules), errors = _a.errors, rules = _a.rules;
                                        res.errors = res.errors.concat(errors);
                                        badFilterRules = rules.filter(function (_a) {
                                            var rule = _a.rule;
                                            return rule.isOptionEnabled(NetworkRuleOption.Badfilter);
                                        });
                                        return [2 , {
                                                id: filter.getId(),
                                                rules: rules,
                                                badFilterRules: badFilterRules,
                                            }];
                                }
                            });
                        }); });
                        return [4 , Promise.allSettled(promises)];
                    case 1:
                        tasks = _a.sent();
                        tasks.forEach(function (task, index) {
                            if (task.status === 'rejected') {
                                var filterId = filterList[index].getId();
                                res.errors.push(new Error("Cannot scan rules from filter ".concat(filterId, ": ").concat(task.reason)));
                                return;
                            }
                            res.filters.push(task.value);
                        });
                        return [2 , res];
                }
            });
        });
    };
    return NetworkRulesScanner;
}());
var DeclarativeFilterConverter =  (function () {
    function DeclarativeFilterConverter() {
    }
    DeclarativeFilterConverter.checkConverterOptions = function (options) {
        var resourcesPath = options.resourcesPath, maxNumberOfRules = options.maxNumberOfRules, maxNumberOfRegexpRules = options.maxNumberOfRegexpRules;
        if (resourcesPath !== undefined) {
            var firstChar = 0;
            var lastChar = resourcesPath.length > 0
                ? resourcesPath.length - 1
                : 0;
            if (resourcesPath[firstChar] !== '/') {
                var msg = 'Path to web accessible resources should '
                    + "be started with leading slash: ".concat(resourcesPath);
                throw new ResourcesPathError(msg);
            }
            if (resourcesPath[lastChar] === '/') {
                var msg = 'Path to web accessible resources should '
                    + "not be ended with slash: ".concat(resourcesPath);
                throw new ResourcesPathError(msg);
            }
        }
        if (maxNumberOfRules !== undefined && maxNumberOfRules <= 0) {
            var msg = 'Maximum number of rules cannot be equal or less than 0';
            throw new EmptyOrNegativeNumberOfRulesError(msg);
        }
        if (maxNumberOfRegexpRules && maxNumberOfRegexpRules < 0) {
            var msg = 'Maximum number of regexp rules cannot be less than 0';
            throw new NegativeNumberOfRegexpRulesError(msg);
        }
    };
    DeclarativeFilterConverter.prototype.convertStaticRuleSet = function (filter, options) {
        return __awaiter(this, void 0, void 0, function () {
            var _a, errors, filters, scannedStaticFilter, id, badFilterRules, convertedRules, conversionResult;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        if (options) {
                            DeclarativeFilterConverter.checkConverterOptions(options);
                        }
                        return [4 , NetworkRulesScanner.scanRules([filter])];
                    case 1:
                        _a = _b.sent(), errors = _a.errors, filters = _a.filters;
                        scannedStaticFilter = filters[0];
                        id = scannedStaticFilter.id, badFilterRules = scannedStaticFilter.badFilterRules;
                        return [4 , DeclarativeRulesConverter.convert(filters, options)];
                    case 2:
                        convertedRules = _b.sent();
                        conversionResult = DeclarativeFilterConverter.collectConvertedResult("ruleset_".concat(id), [filter], filters, convertedRules, badFilterRules);
                        return [2 , {
                                ruleSet: conversionResult.ruleSet,
                                errors: errors.concat(conversionResult.errors),
                                limitations: conversionResult.limitations,
                            }];
                }
            });
        });
    };
    DeclarativeFilterConverter.prototype.convertDynamicRuleSets = function (filterList, staticRuleSets, options) {
        return __awaiter(this, void 0, void 0, function () {
            var allStaticBadFilterRules, skipNegatedRulesFn, scanned, convertedRules, dynamicBadFilterRules, conversionResult, _a, declarativeRulesToCancel, errors;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        if (options) {
                            DeclarativeFilterConverter.checkConverterOptions(options);
                        }
                        allStaticBadFilterRules = DeclarativeFilterConverter.createBadFilterRulesHashMap(staticRuleSets);
                        skipNegatedRulesFn = function (r) {
                            var fastMatchedBadFilterRules = allStaticBadFilterRules.get(r.hash);
                            if (!fastMatchedBadFilterRules) {
                                return true;
                            }
                            for (var i = 0; i < fastMatchedBadFilterRules.length; i += 1) {
                                var rule = fastMatchedBadFilterRules[i];
                                var badFilterRule = rule.rule;
                                var ruleToCheck = r.rule;
                                if (badFilterRule.negatesBadfilter(ruleToCheck)) {
                                    return false;
                                }
                            }
                            return true;
                        };
                        return [4 , NetworkRulesScanner.scanRules(filterList, skipNegatedRulesFn,
                            (options === null || options === void 0 ? void 0 : options.maxNumberOfRules)
                                ? Math.ceil(options.maxNumberOfRules * DeclarativeFilterConverter.SCANNED_NETWORK_RULES_MULTIPLICATOR)
                                : undefined)];
                    case 1:
                        scanned = _b.sent();
                        return [4 , DeclarativeRulesConverter.convert(scanned.filters, options)];
                    case 2:
                        convertedRules = _b.sent();
                        dynamicBadFilterRules = scanned.filters
                            .map(function (_a) {
                            var badFilterRules = _a.badFilterRules;
                            return badFilterRules;
                        })
                            .flat();
                        conversionResult = DeclarativeFilterConverter.collectConvertedResult(DeclarativeFilterConverter.COMBINED_RULESET_ID, filterList, scanned.filters, convertedRules, dynamicBadFilterRules);
                        return [4 , DeclarativeFilterConverter.collectDeclarativeRulesToCancel(staticRuleSets, dynamicBadFilterRules)];
                    case 3:
                        _a = _b.sent(), declarativeRulesToCancel = _a.declarativeRulesToCancel, errors = _a.errors;
                        conversionResult.errors = conversionResult.errors
                            .concat(scanned.errors)
                            .concat(errors);
                        conversionResult.declarativeRulesToCancel = declarativeRulesToCancel;
                        return [2 , conversionResult];
                }
            });
        });
    };
    DeclarativeFilterConverter.collectConvertedResult = function (ruleSetId, filterList, scannedFilters, convertedRules, badFilterRules) {
        var _this = this;
        var sourceMapValues = convertedRules.sourceMapValues, declarativeRules = convertedRules.declarativeRules, errors = convertedRules.errors, _a = convertedRules.limitations, limitations = _a === void 0 ? [] : _a;
        var ruleSetContent = {
            loadSourceMap: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
                return [2 , new SourceMap(sourceMapValues)];
            }); }); },
            loadFilterList: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
                return [2 , filterList];
            }); }); },
            loadDeclarativeRules: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
                return [2 , declarativeRules];
            }); }); },
        };
        var listOfRulesWithHash = scannedFilters
            .map(function (_a) {
            var id = _a.id, rules = _a.rules;
            return rules.map(function (r) { return ({
                hash: r.hash,
                source: {
                    sourceRuleIndex: r.index,
                    filterId: id,
                },
            }); });
        })
            .flat();
        var rulesHashMap = new RulesHashMap(listOfRulesWithHash);
        var ruleSet = new RuleSet(ruleSetId, declarativeRules.length, declarativeRules.filter(function (d) { return d.condition.regexFilter; }).length, ruleSetContent, badFilterRules, rulesHashMap);
        return {
            ruleSet: ruleSet,
            errors: errors,
            limitations: limitations,
        };
    };
    DeclarativeFilterConverter.createBadFilterRulesHashMap = function (ruleSets) {
        var allStaticBadFilterRules = new Map();
        ruleSets.forEach(function (ruleSet) {
            ruleSet.getBadFilterRules().forEach(function (r) {
                var existingValue = allStaticBadFilterRules.get(r.hash);
                if (existingValue) {
                    existingValue.push(r);
                }
                else {
                    allStaticBadFilterRules.set(r.hash, [r]);
                }
            });
        });
        return allStaticBadFilterRules;
    };
    DeclarativeFilterConverter.checkFastMatchedRulesCanBeCancelled = function (badFilterRule, staticRuleSet, fastMatchedRulesByHash) {
        return __awaiter(this, void 0, void 0, function () {
            var fastMatchedDeclarativeRulesIds, promises, ids, e_1, disableRuleIds, k, id, matchedSourceRules, e_2, indexedNetworkRulesWithHash, arrayWithRules, e_3, someRulesMatched;
            var _this = this;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        fastMatchedDeclarativeRulesIds = [];
                        _a.label = 1;
                    case 1:
                        _a.trys.push([1, 3, , 4]);
                        promises = fastMatchedRulesByHash.map(function (source) { return __awaiter(_this, void 0, void 0, function () {
                            return __generator(this, function (_a) {
                                return [2 , staticRuleSet.getDeclarativeRulesIdsBySourceRuleIndex(source)];
                            });
                        }); });
                        return [4 , Promise.all(promises)];
                    case 2:
                        ids = _a.sent();
                        fastMatchedDeclarativeRulesIds.push.apply(fastMatchedDeclarativeRulesIds, ids.flat());
                        return [3 , 4];
                    case 3:
                        e_1 = _a.sent();
                        throw new Error("Not found declarative rule id for some source from list: ".concat(JSON.stringify(fastMatchedDeclarativeRulesIds), ": ").concat(getErrorMessage$2(e_1)));
                    case 4:
                        disableRuleIds = [];
                        k = 0;
                        _a.label = 5;
                    case 5:
                        if (!(k < fastMatchedDeclarativeRulesIds.length)) return [3 , 15];
                        id = fastMatchedDeclarativeRulesIds[k];
                        matchedSourceRules = [];
                        _a.label = 6;
                    case 6:
                        _a.trys.push([6, 8, , 9]);
                        return [4 , staticRuleSet.getRulesById(id)];
                    case 7:
                        matchedSourceRules = _a.sent();
                        return [3 , 9];
                    case 8:
                        e_2 = _a.sent();
                        throw new Error("Not found sources for declarative rule with id \"".concat(id, "\": ").concat(getErrorMessage$2(e_2)));
                    case 9:
                        indexedNetworkRulesWithHash = [];
                        _a.label = 10;
                    case 10:
                        _a.trys.push([10, 12, , 13]);
                        return [4 , Promise.all(matchedSourceRules.map(function (source) {
                                return RuleSet.getNetworkRuleBySourceRule(source);
                            }))];
                    case 11:
                        arrayWithRules = _a.sent();
                        indexedNetworkRulesWithHash = arrayWithRules.flat();
                        return [3 , 13];
                    case 12:
                        e_3 = _a.sent();
                        throw new Error("Not found network rules from matched sources \"".concat(JSON.stringify(matchedSourceRules), "\": ").concat(getErrorMessage$2(e_3)));
                    case 13:
                        someRulesMatched = indexedNetworkRulesWithHash
                            .flat()
                            .some(function (rule) { return badFilterRule.rule.negatesBadfilter(rule); });
                        if (someRulesMatched) {
                            disableRuleIds.push(id);
                        }
                        _a.label = 14;
                    case 14:
                        k += 1;
                        return [3 , 5];
                    case 15: return [2 , disableRuleIds];
                }
            });
        });
    };
    DeclarativeFilterConverter.collectDeclarativeRulesToCancel = function (staticRuleSets, dynamicBadFilterRules) {
        return __awaiter(this, void 0, void 0, function () {
            var declarativeRulesToCancel, errors, i, staticRuleSet, disableRuleIds, j, badFilterRule, hashMap, fastMatchedRulesByHash, ids, e_4;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        declarativeRulesToCancel = [];
                        errors = [];
                        i = 0;
                        _a.label = 1;
                    case 1:
                        if (!(i < staticRuleSets.length)) return [3 , 9];
                        staticRuleSet = staticRuleSets[i];
                        disableRuleIds = [];
                        j = 0;
                        _a.label = 2;
                    case 2:
                        if (!(j < dynamicBadFilterRules.length)) return [3 , 7];
                        badFilterRule = dynamicBadFilterRules[j];
                        hashMap = staticRuleSet.getRulesHashMap();
                        fastMatchedRulesByHash = hashMap.findRules(badFilterRule.hash);
                        if (fastMatchedRulesByHash.length === 0) {
                            return [3 , 6];
                        }
                        _a.label = 3;
                    case 3:
                        _a.trys.push([3, 5, , 6]);
                        return [4 , DeclarativeFilterConverter.checkFastMatchedRulesCanBeCancelled(badFilterRule, staticRuleSet, fastMatchedRulesByHash)];
                    case 4:
                        ids = _a.sent();
                        disableRuleIds.push.apply(disableRuleIds, ids);
                        return [3 , 6];
                    case 5:
                        e_4 = _a.sent();
                        errors.push(new Error("Cannot apply badfilter: ".concat(getErrorMessage$2(e_4))));
                        return [3 , 6];
                    case 6:
                        j += 1;
                        return [3 , 2];
                    case 7:
                        if (disableRuleIds.length > 0) {
                            declarativeRulesToCancel.push({
                                rulesetId: staticRuleSet.getId(),
                                disableRuleIds: disableRuleIds,
                            });
                        }
                        _a.label = 8;
                    case 8:
                        i += 1;
                        return [3 , 1];
                    case 9: return [2 , {
                            errors: errors,
                            declarativeRulesToCancel: declarativeRulesToCancel,
                        }];
                }
            });
        });
    };
    DeclarativeFilterConverter.COMBINED_RULESET_ID = '_dynamic';
    DeclarativeFilterConverter.SCANNED_NETWORK_RULES_MULTIPLICATOR = 1.1;
    return DeclarativeFilterConverter;
}());
var UnavailableFilterSourceError =  (function (_super) {
    __extends(UnavailableFilterSourceError, _super);
    function UnavailableFilterSourceError(message, filterId, cause) {
        var _this = _super.call(this, message, { cause: cause }) || this;
        _this.name = 'UnavailableFilterSourceError';
        _this.filterId = filterId;
        Object.setPrototypeOf(_this, UnavailableFilterSourceError.prototype);
        return _this;
    }
    return UnavailableFilterSourceError;
}(Error));
var Filter =  (function () {
    function Filter(id, source, trusted) {
        this.content = null;
        this.id = id;
        this.source = source;
        this.trusted = trusted;
    }
    Filter.prototype.getId = function () {
        return this.id;
    };
    Filter.prototype.getContent = function () {
        return __awaiter(this, void 0, void 0, function () {
            var _a, e_1;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        if (this.content) {
                            return [2 , this.content];
                        }
                        _b.label = 1;
                    case 1:
                        _b.trys.push([1, 3, , 4]);
                        _a = this;
                        return [4 , this.source.getContent()];
                    case 2:
                        _a.content = _b.sent();
                        if (!this.content || this.content.rawFilterList.length === 0 || this.content.filterList.length === 0) {
                            throw new Error('Loaded empty content');
                        }
                        return [2 , this.content];
                    case 3:
                        e_1 = _b.sent();
                        throw new UnavailableFilterSourceError('Filter content is unavailable', this.id, e_1);
                    case 4: return [2 ];
                }
            });
        });
    };
    Filter.prototype.getRuleByIndex = function (index) {
        var _a;
        return __awaiter(this, void 0, void 0, function () {
            var content, lineIndex, sourceRule;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0: return [4 , this.getContent()];
                    case 1:
                        content = _b.sent();
                        lineIndex = getRuleSourceIndex(index, content.sourceMap);
                        sourceRule = (_a = getRuleSourceText(lineIndex, content.rawFilterList)) !== null && _a !== void 0 ? _a : EMPTY_STRING;
                        return [2 , sourceRule];
                }
            });
        });
    };
    Filter.prototype.isTrusted = function () {
        return this.trusted;
    };
    return Filter;
}());
var METADATA_FILENAME = 'metadata.json';
var LAZY_METADATA_FILENAME = 'lazy_metadata.json';

function isErrorWithMessage$1(error) {
    return (typeof error === 'object'
        && error !== null
        && 'message' in error
        && typeof error.message === 'string');
}
function toErrorWithMessage$1(maybeError) {
    if (isErrorWithMessage$1(maybeError)) {
        return maybeError;
    }
    try {
        return new Error(JSON.stringify(maybeError));
    }
    catch {
        return new Error(String(maybeError));
    }
}
function getErrorMessage$1(error) {
    return toErrorWithMessage$1(error).message;
}
const pad = (num, size = 2) => {
    return num.toString().padStart(size, '0');
};
const formatTime = (date) => {
    const d = (date instanceof Date) ? date : new Date(date);
    const year = d.getFullYear();
    const month = pad(d.getMonth() + 1);
    const day = pad(d.getDate());
    const hour = pad(d.getHours());
    const minute = pad(d.getMinutes());
    const second = pad(d.getSeconds());
    const millisecond = pad(d.getMilliseconds(), 3);
    return `${year}-${month}-${day}T${hour}:${minute}:${second}:${millisecond}`;
};
var LogLevel;
(function (LogLevel) {
    LogLevel["Error"] = "error";
    LogLevel["Warn"] = "warn";
    LogLevel["Info"] = "info";
    LogLevel["Debug"] = "debug";
    LogLevel["Trace"] = "trace";
})(LogLevel || (LogLevel = {}));
const levelMapNumToString = {
    [1 ]: LogLevel.Error,
    [2 ]: LogLevel.Warn,
    [3 ]: LogLevel.Info,
    [4 ]: LogLevel.Debug,
    [5 ]: LogLevel.Trace,
};
const levelMapStringToNum = Object.entries(levelMapNumToString)
    .reduce((acc, [key, value]) => {
    const numericKey = Number(key);
    if (!Number.isNaN(numericKey)) {
        acc[value] = numericKey;
    }
    return acc;
}, {});
class Logger {
    currentLevelValue = 3 ;
    writer;
    constructor(writer = console) {
        this.writer = writer;
        this.debug = this.debug.bind(this);
        this.info = this.info.bind(this);
        this.warn = this.warn.bind(this);
        this.error = this.error.bind(this);
    }
    debug(...args) {
        this.print(4 , "log" , args);
    }
    info(...args) {
        this.print(3 , "info" , args);
    }
    warn(...args) {
        this.print(2 , "info" , args);
    }
    error(...args) {
        this.print(1 , "error" , args);
    }
    get currentLevel() {
        return levelMapNumToString[this.currentLevelValue];
    }
    set currentLevel(logLevel) {
        const level = levelMapStringToNum[logLevel];
        if (level === undefined) {
            throw new Error(`Logger supports only the following levels: ${[Object.values(LogLevel).join(', ')]}`);
        }
        this.currentLevelValue = level;
    }
    static errorToString(error) {
        const message = getErrorMessage$1(error);
        return `${message}\nStack trace:\n${error.stack}`;
    }
    print(level, method, args) {
        if (this.currentLevelValue < level) {
            return;
        }
        if (!args || args.length === 0 || !args[0]) {
            return;
        }
        const formattedArgs = args.map((value) => {
            if (value instanceof Error) {
                return Logger.errorToString(value);
            }
            if (value && typeof value.message === 'string') {
                return value.message;
            }
            if (typeof value === 'object' && value !== null) {
                return JSON.stringify(value);
            }
            return String(value);
        });
        const formattedTime = `${formatTime(new Date())}:`;
        if (method === "error"
            || this.currentLevelValue < levelMapStringToNum[LogLevel.Trace]
            || !this.writer.trace) {
            this.writer[method](formattedTime, ...formattedArgs);
            return;
        }
        if (!this.writer.groupCollapsed || !this.writer.groupEnd) {
            this.writer.trace(formattedTime, ...formattedArgs);
            return;
        }
        this.writer.groupCollapsed(formattedTime, ...formattedArgs);
        this.writer.trace();
        this.writer.groupEnd();
    }
}

var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
var freeGlobal$1 = freeGlobal;

var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
var root = freeGlobal$1 || freeSelf || Function('return this')();
var root$1 = root;

var Symbol$1 = root$1.Symbol;
var Symbol$2 = Symbol$1;

var objectProto$a = Object.prototype;
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
var nativeObjectToString$1 = objectProto$a.toString;
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
function getRawTag(value) {
  var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
      tag = value[symToStringTag$1];
  try {
    value[symToStringTag$1] = undefined;
    var unmasked = true;
  } catch (e) {}
  var result = nativeObjectToString$1.call(value);
  if (unmasked) {
    if (isOwn) {
      value[symToStringTag$1] = tag;
    } else {
      delete value[symToStringTag$1];
    }
  }
  return result;
}

var objectProto$9 = Object.prototype;
var nativeObjectToString = objectProto$9.toString;
function objectToString$1(value) {
  return nativeObjectToString.call(value);
}

var nullTag = '[object Null]',
    undefinedTag = '[object Undefined]';
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : undefined;
function baseGetTag(value) {
  if (value == null) {
    return value === undefined ? undefinedTag : nullTag;
  }
  return (symToStringTag && symToStringTag in Object(value))
    ? getRawTag(value)
    : objectToString$1(value);
}

function isObjectLike(value) {
  return value != null && typeof value == 'object';
}

var symbolTag = '[object Symbol]';
function isSymbol(value) {
  return typeof value == 'symbol' ||
    (isObjectLike(value) && baseGetTag(value) == symbolTag);
}

function arrayMap(array, iteratee) {
  var index = -1,
      length = array == null ? 0 : array.length,
      result = Array(length);
  while (++index < length) {
    result[index] = iteratee(array[index], index, array);
  }
  return result;
}

var isArray = Array.isArray;
var isArray$1 = isArray;

var INFINITY$1 = 1 / 0;
var symbolProto = Symbol$2 ? Symbol$2.prototype : undefined,
    symbolToString = symbolProto ? symbolProto.toString : undefined;
function baseToString(value) {
  if (typeof value == 'string') {
    return value;
  }
  if (isArray$1(value)) {
    return arrayMap(value, baseToString) + '';
  }
  if (isSymbol(value)) {
    return symbolToString ? symbolToString.call(value) : '';
  }
  var result = (value + '');
  return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
}

var reWhitespace = /\s/;
function trimmedEndIndex(string) {
  var index = string.length;
  while (index-- && reWhitespace.test(string.charAt(index))) {}
  return index;
}

var reTrimStart = /^\s+/;
function baseTrim(string) {
  return string
    ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
    : string;
}

function isObject(value) {
  var type = typeof value;
  return value != null && (type == 'object' || type == 'function');
}

var NAN = 0 / 0;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsOctal = /^0o[0-7]+$/i;
var freeParseInt = parseInt;
function toNumber(value) {
  if (typeof value == 'number') {
    return value;
  }
  if (isSymbol(value)) {
    return NAN;
  }
  if (isObject(value)) {
    var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
    value = isObject(other) ? (other + '') : other;
  }
  if (typeof value != 'string') {
    return value === 0 ? value : +value;
  }
  value = baseTrim(value);
  var isBinary = reIsBinary.test(value);
  return (isBinary || reIsOctal.test(value))
    ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
    : (reIsBadHex.test(value) ? NAN : +value);
}

function identity(value) {
  return value;
}

var asyncTag = '[object AsyncFunction]',
    funcTag$1 = '[object Function]',
    genTag = '[object GeneratorFunction]',
    proxyTag = '[object Proxy]';
function isFunction(value) {
  if (!isObject(value)) {
    return false;
  }
  var tag = baseGetTag(value);
  return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
}

var coreJsData = root$1['__core-js_shared__'];
var coreJsData$1 = coreJsData;

var maskSrcKey = (function() {
  var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || '');
  return uid ? ('Symbol(src)_1.' + uid) : '';
}());
function isMasked(func) {
  return !!maskSrcKey && (maskSrcKey in func);
}

var funcProto$2 = Function.prototype;
var funcToString$2 = funcProto$2.toString;
function toSource(func) {
  if (func != null) {
    try {
      return funcToString$2.call(func);
    } catch (e) {}
    try {
      return (func + '');
    } catch (e) {}
  }
  return '';
}

var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var funcProto$1 = Function.prototype,
    objectProto$8 = Object.prototype;
var funcToString$1 = funcProto$1.toString;
var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
var reIsNative = RegExp('^' +
  funcToString$1.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
function baseIsNative(value) {
  if (!isObject(value) || isMasked(value)) {
    return false;
  }
  var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  return pattern.test(toSource(value));
}

function getValue(object, key) {
  return object == null ? undefined : object[key];
}

function getNative(object, key) {
  var value = getValue(object, key);
  return baseIsNative(value) ? value : undefined;
}

var objectCreate = Object.create;
var baseCreate = (function() {
  function object() {}
  return function(proto) {
    if (!isObject(proto)) {
      return {};
    }
    if (objectCreate) {
      return objectCreate(proto);
    }
    object.prototype = proto;
    var result = new object;
    object.prototype = undefined;
    return result;
  };
}());
var baseCreate$1 = baseCreate;

function apply(func, thisArg, args) {
  switch (args.length) {
    case 0: return func.call(thisArg);
    case 1: return func.call(thisArg, args[0]);
    case 2: return func.call(thisArg, args[0], args[1]);
    case 3: return func.call(thisArg, args[0], args[1], args[2]);
  }
  return func.apply(thisArg, args);
}

function copyArray(source, array) {
  var index = -1,
      length = source.length;
  array || (array = Array(length));
  while (++index < length) {
    array[index] = source[index];
  }
  return array;
}

var HOT_COUNT = 800,
    HOT_SPAN = 16;
var nativeNow = Date.now;
function shortOut(func) {
  var count = 0,
      lastCalled = 0;
  return function() {
    var stamp = nativeNow(),
        remaining = HOT_SPAN - (stamp - lastCalled);
    lastCalled = stamp;
    if (remaining > 0) {
      if (++count >= HOT_COUNT) {
        return arguments[0];
      }
    } else {
      count = 0;
    }
    return func.apply(undefined, arguments);
  };
}

function constant(value) {
  return function() {
    return value;
  };
}

var defineProperty = (function() {
  try {
    var func = getNative(Object, 'defineProperty');
    func({}, '', {});
    return func;
  } catch (e) {}
}());
var defineProperty$1 = defineProperty;

var baseSetToString = !defineProperty$1 ? identity : function(func, string) {
  return defineProperty$1(func, 'toString', {
    'configurable': true,
    'enumerable': false,
    'value': constant(string),
    'writable': true
  });
};
var baseSetToString$1 = baseSetToString;

var setToString = shortOut(baseSetToString$1);
var setToString$1 = setToString;

var MAX_SAFE_INTEGER$1 = 9007199254740991;
var reIsUint = /^(?:0|[1-9]\d*)$/;
function isIndex(value, length) {
  var type = typeof value;
  length = length == null ? MAX_SAFE_INTEGER$1 : length;
  return !!length &&
    (type == 'number' ||
      (type != 'symbol' && reIsUint.test(value))) &&
        (value > -1 && value % 1 == 0 && value < length);
}

function baseAssignValue(object, key, value) {
  if (key == '__proto__' && defineProperty$1) {
    defineProperty$1(object, key, {
      'configurable': true,
      'enumerable': true,
      'value': value,
      'writable': true
    });
  } else {
    object[key] = value;
  }
}

function eq(value, other) {
  return value === other || (value !== value && other !== other);
}

var objectProto$7 = Object.prototype;
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
function assignValue(object, key, value) {
  var objValue = object[key];
  if (!(hasOwnProperty$6.call(object, key) && eq(objValue, value)) ||
      (value === undefined && !(key in object))) {
    baseAssignValue(object, key, value);
  }
}

function copyObject(source, props, object, customizer) {
  var isNew = !object;
  object || (object = {});
  var index = -1,
      length = props.length;
  while (++index < length) {
    var key = props[index];
    var newValue = customizer
      ? customizer(object[key], source[key], key, object, source)
      : undefined;
    if (newValue === undefined) {
      newValue = source[key];
    }
    if (isNew) {
      baseAssignValue(object, key, newValue);
    } else {
      assignValue(object, key, newValue);
    }
  }
  return object;
}

var nativeMax$1 = Math.max;
function overRest(func, start, transform) {
  start = nativeMax$1(start === undefined ? (func.length - 1) : start, 0);
  return function() {
    var args = arguments,
        index = -1,
        length = nativeMax$1(args.length - start, 0),
        array = Array(length);
    while (++index < length) {
      array[index] = args[start + index];
    }
    index = -1;
    var otherArgs = Array(start + 1);
    while (++index < start) {
      otherArgs[index] = args[index];
    }
    otherArgs[start] = transform(array);
    return apply(func, this, otherArgs);
  };
}

function baseRest(func, start) {
  return setToString$1(overRest(func, start, identity), func + '');
}

var MAX_SAFE_INTEGER = 9007199254740991;
function isLength(value) {
  return typeof value == 'number' &&
    value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}

function isArrayLike(value) {
  return value != null && isLength(value.length) && !isFunction(value);
}

function isIterateeCall(value, index, object) {
  if (!isObject(object)) {
    return false;
  }
  var type = typeof index;
  if (type == 'number'
        ? (isArrayLike(object) && isIndex(index, object.length))
        : (type == 'string' && index in object)
      ) {
    return eq(object[index], value);
  }
  return false;
}

function createAssigner(assigner) {
  return baseRest(function(object, sources) {
    var index = -1,
        length = sources.length,
        customizer = length > 1 ? sources[length - 1] : undefined,
        guard = length > 2 ? sources[2] : undefined;
    customizer = (assigner.length > 3 && typeof customizer == 'function')
      ? (length--, customizer)
      : undefined;
    if (guard && isIterateeCall(sources[0], sources[1], guard)) {
      customizer = length < 3 ? undefined : customizer;
      length = 1;
    }
    object = Object(object);
    while (++index < length) {
      var source = sources[index];
      if (source) {
        assigner(object, source, index, customizer);
      }
    }
    return object;
  });
}

var objectProto$6 = Object.prototype;
function isPrototype(value) {
  var Ctor = value && value.constructor,
      proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$6;
  return value === proto;
}

function baseTimes(n, iteratee) {
  var index = -1,
      result = Array(n);
  while (++index < n) {
    result[index] = iteratee(index);
  }
  return result;
}

var argsTag$1 = '[object Arguments]';
function baseIsArguments(value) {
  return isObjectLike(value) && baseGetTag(value) == argsTag$1;
}

var objectProto$5 = Object.prototype;
var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  return isObjectLike(value) && hasOwnProperty$5.call(value, 'callee') &&
    !propertyIsEnumerable.call(value, 'callee');
};
var isArguments$1 = isArguments;

function stubFalse() {
  return false;
}

var freeExports$2 = typeof exports == 'object' && exports && !exports.nodeType && exports;
var freeModule$2 = freeExports$2 && "object" == 'object' && module && !module.nodeType && module;
var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
var Buffer$2 = moduleExports$2 ? root$1.Buffer : undefined;
var nativeIsBuffer = Buffer$2 ? Buffer$2.isBuffer : undefined;
var isBuffer = nativeIsBuffer || stubFalse;
var isBuffer$1 = isBuffer;

var argsTag = '[object Arguments]',
    arrayTag = '[object Array]',
    boolTag = '[object Boolean]',
    dateTag = '[object Date]',
    errorTag = '[object Error]',
    funcTag = '[object Function]',
    mapTag = '[object Map]',
    numberTag = '[object Number]',
    objectTag$1 = '[object Object]',
    regexpTag = '[object RegExp]',
    setTag = '[object Set]',
    stringTag = '[object String]',
    weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
    dataViewTag = '[object DataView]',
    float32Tag = '[object Float32Array]',
    float64Tag = '[object Float64Array]',
    int8Tag = '[object Int8Array]',
    int16Tag = '[object Int16Array]',
    int32Tag = '[object Int32Array]',
    uint8Tag = '[object Uint8Array]',
    uint8ClampedTag = '[object Uint8ClampedArray]',
    uint16Tag = '[object Uint16Array]',
    uint32Tag = '[object Uint32Array]';
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag$1] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
function baseIsTypedArray(value) {
  return isObjectLike(value) &&
    isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}

function baseUnary(func) {
  return function(value) {
    return func(value);
  };
}

var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
var freeModule$1 = freeExports$1 && "object" == 'object' && module && !module.nodeType && module;
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
var freeProcess = moduleExports$1 && freeGlobal$1.process;
var nodeUtil = (function() {
  try {
    var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types;
    if (types) {
      return types;
    }
    return freeProcess && freeProcess.binding && freeProcess.binding('util');
  } catch (e) {}
}());
var nodeUtil$1 = nodeUtil;

var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
var isTypedArray$1 = isTypedArray;

var objectProto$4 = Object.prototype;
var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
function arrayLikeKeys(value, inherited) {
  var isArr = isArray$1(value),
      isArg = !isArr && isArguments$1(value),
      isBuff = !isArr && !isArg && isBuffer$1(value),
      isType = !isArr && !isArg && !isBuff && isTypedArray$1(value),
      skipIndexes = isArr || isArg || isBuff || isType,
      result = skipIndexes ? baseTimes(value.length, String) : [],
      length = result.length;
  for (var key in value) {
    if ((inherited || hasOwnProperty$4.call(value, key)) &&
        !(skipIndexes && (
           key == 'length' ||
           (isBuff && (key == 'offset' || key == 'parent')) ||
           (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
           isIndex(key, length)
        ))) {
      result.push(key);
    }
  }
  return result;
}

function overArg(func, transform) {
  return function(arg) {
    return func(transform(arg));
  };
}

function nativeKeysIn(object) {
  var result = [];
  if (object != null) {
    for (var key in Object(object)) {
      result.push(key);
    }
  }
  return result;
}

var objectProto$3 = Object.prototype;
var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
function baseKeysIn(object) {
  if (!isObject(object)) {
    return nativeKeysIn(object);
  }
  var isProto = isPrototype(object),
      result = [];
  for (var key in object) {
    if (!(key == 'constructor' && (isProto || !hasOwnProperty$3.call(object, key)))) {
      result.push(key);
    }
  }
  return result;
}

function keysIn(object) {
  return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
}

var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
    reIsPlainProp = /^\w*$/;
function isKey(value, object) {
  if (isArray$1(value)) {
    return false;
  }
  var type = typeof value;
  if (type == 'number' || type == 'symbol' || type == 'boolean' ||
      value == null || isSymbol(value)) {
    return true;
  }
  return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
    (object != null && value in Object(object));
}

var nativeCreate = getNative(Object, 'create');
var nativeCreate$1 = nativeCreate;

function hashClear() {
  this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  this.size = 0;
}

function hashDelete(key) {
  var result = this.has(key) && delete this.__data__[key];
  this.size -= result ? 1 : 0;
  return result;
}

var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
var objectProto$2 = Object.prototype;
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
function hashGet(key) {
  var data = this.__data__;
  if (nativeCreate$1) {
    var result = data[key];
    return result === HASH_UNDEFINED$1 ? undefined : result;
  }
  return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
}

var objectProto$1 = Object.prototype;
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
function hashHas(key) {
  var data = this.__data__;
  return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty$1.call(data, key);
}

var HASH_UNDEFINED = '__lodash_hash_undefined__';
function hashSet(key, value) {
  var data = this.__data__;
  this.size += this.has(key) ? 0 : 1;
  data[key] = (nativeCreate$1 && value === undefined) ? HASH_UNDEFINED : value;
  return this;
}

function Hash(entries) {
  var index = -1,
      length = entries == null ? 0 : entries.length;
  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;

function listCacheClear() {
  this.__data__ = [];
  this.size = 0;
}

function assocIndexOf(array, key) {
  var length = array.length;
  while (length--) {
    if (eq(array[length][0], key)) {
      return length;
    }
  }
  return -1;
}

var arrayProto = Array.prototype;
var splice = arrayProto.splice;
function listCacheDelete(key) {
  var data = this.__data__,
      index = assocIndexOf(data, key);
  if (index < 0) {
    return false;
  }
  var lastIndex = data.length - 1;
  if (index == lastIndex) {
    data.pop();
  } else {
    splice.call(data, index, 1);
  }
  --this.size;
  return true;
}

function listCacheGet(key) {
  var data = this.__data__,
      index = assocIndexOf(data, key);
  return index < 0 ? undefined : data[index][1];
}

function listCacheHas(key) {
  return assocIndexOf(this.__data__, key) > -1;
}

function listCacheSet(key, value) {
  var data = this.__data__,
      index = assocIndexOf(data, key);
  if (index < 0) {
    ++this.size;
    data.push([key, value]);
  } else {
    data[index][1] = value;
  }
  return this;
}

function ListCache(entries) {
  var index = -1,
      length = entries == null ? 0 : entries.length;
  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;

var Map$1 = getNative(root$1, 'Map');
var Map$2 = Map$1;

function mapCacheClear() {
  this.size = 0;
  this.__data__ = {
    'hash': new Hash,
    'map': new (Map$2 || ListCache),
    'string': new Hash
  };
}

function isKeyable(value) {
  var type = typeof value;
  return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
    ? (value !== '__proto__')
    : (value === null);
}

function getMapData(map, key) {
  var data = map.__data__;
  return isKeyable(key)
    ? data[typeof key == 'string' ? 'string' : 'hash']
    : data.map;
}

function mapCacheDelete(key) {
  var result = getMapData(this, key)['delete'](key);
  this.size -= result ? 1 : 0;
  return result;
}

function mapCacheGet(key) {
  return getMapData(this, key).get(key);
}

function mapCacheHas(key) {
  return getMapData(this, key).has(key);
}

function mapCacheSet(key, value) {
  var data = getMapData(this, key),
      size = data.size;
  data.set(key, value);
  this.size += data.size == size ? 0 : 1;
  return this;
}

function MapCache(entries) {
  var index = -1,
      length = entries == null ? 0 : entries.length;
  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;

var FUNC_ERROR_TEXT$1 = 'Expected a function';
function memoize(func, resolver) {
  if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
    throw new TypeError(FUNC_ERROR_TEXT$1);
  }
  var memoized = function() {
    var args = arguments,
        key = resolver ? resolver.apply(this, args) : args[0],
        cache = memoized.cache;
    if (cache.has(key)) {
      return cache.get(key);
    }
    var result = func.apply(this, args);
    memoized.cache = cache.set(key, result) || cache;
    return result;
  };
  memoized.cache = new (memoize.Cache || MapCache);
  return memoized;
}
memoize.Cache = MapCache;

var MAX_MEMOIZE_SIZE = 500;
function memoizeCapped(func) {
  var result = memoize(func, function(key) {
    if (cache.size === MAX_MEMOIZE_SIZE) {
      cache.clear();
    }
    return key;
  });
  var cache = result.cache;
  return result;
}

var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reEscapeChar = /\\(\\)?/g;
var stringToPath = memoizeCapped(function(string) {
  var result = [];
  if (string.charCodeAt(0) === 46 ) {
    result.push('');
  }
  string.replace(rePropName, function(match, number, quote, subString) {
    result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  });
  return result;
});
var stringToPath$1 = stringToPath;

function toString(value) {
  return value == null ? '' : baseToString(value);
}

function castPath(value, object) {
  if (isArray$1(value)) {
    return value;
  }
  return isKey(value, object) ? [value] : stringToPath$1(toString(value));
}

var INFINITY = 1 / 0;
function toKey(value) {
  if (typeof value == 'string' || isSymbol(value)) {
    return value;
  }
  var result = (value + '');
  return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}

function baseGet(object, path) {
  path = castPath(path, object);
  var index = 0,
      length = path.length;
  while (object != null && index < length) {
    object = object[toKey(path[index++])];
  }
  return (index && index == length) ? object : undefined;
}

function arrayPush(array, values) {
  var index = -1,
      length = values.length,
      offset = array.length;
  while (++index < length) {
    array[offset + index] = values[index];
  }
  return array;
}

var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : undefined;
function isFlattenable(value) {
  return isArray$1(value) || isArguments$1(value) ||
    !!(spreadableSymbol && value && value[spreadableSymbol]);
}

function baseFlatten(array, depth, predicate, isStrict, result) {
  var index = -1,
      length = array.length;
  predicate || (predicate = isFlattenable);
  result || (result = []);
  while (++index < length) {
    var value = array[index];
    if (depth > 0 && predicate(value)) {
      if (depth > 1) {
        baseFlatten(value, depth - 1, predicate, isStrict, result);
      } else {
        arrayPush(result, value);
      }
    } else if (!isStrict) {
      result[result.length] = value;
    }
  }
  return result;
}

function flatten(array) {
  var length = array == null ? 0 : array.length;
  return length ? baseFlatten(array, 1) : [];
}

function flatRest(func) {
  return setToString$1(overRest(func, undefined, flatten), func + '');
}

var getPrototype = overArg(Object.getPrototypeOf, Object);
var getPrototype$1 = getPrototype;

var objectTag = '[object Object]';
var funcProto = Function.prototype,
    objectProto = Object.prototype;
var funcToString = funcProto.toString;
var hasOwnProperty = objectProto.hasOwnProperty;
var objectCtorString = funcToString.call(Object);
function isPlainObject(value) {
  if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
    return false;
  }
  var proto = getPrototype$1(value);
  if (proto === null) {
    return true;
  }
  var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  return typeof Ctor == 'function' && Ctor instanceof Ctor &&
    funcToString.call(Ctor) == objectCtorString;
}

function stackClear() {
  this.__data__ = new ListCache;
  this.size = 0;
}

function stackDelete(key) {
  var data = this.__data__,
      result = data['delete'](key);
  this.size = data.size;
  return result;
}

function stackGet(key) {
  return this.__data__.get(key);
}

function stackHas(key) {
  return this.__data__.has(key);
}

var LARGE_ARRAY_SIZE = 200;
function stackSet(key, value) {
  var data = this.__data__;
  if (data instanceof ListCache) {
    var pairs = data.__data__;
    if (!Map$2 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
      pairs.push([key, value]);
      this.size = ++data.size;
      return this;
    }
    data = this.__data__ = new MapCache(pairs);
  }
  data.set(key, value);
  this.size = data.size;
  return this;
}

function Stack(entries) {
  var data = this.__data__ = new ListCache(entries);
  this.size = data.size;
}
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;

var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
var moduleExports = freeModule && freeModule.exports === freeExports;
var Buffer$1 = moduleExports ? root$1.Buffer : undefined,
    allocUnsafe = Buffer$1 ? Buffer$1.allocUnsafe : undefined;
function cloneBuffer(buffer, isDeep) {
  if (isDeep) {
    return buffer.slice();
  }
  var length = buffer.length,
      result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  buffer.copy(result);
  return result;
}

var Uint8Array$1 = root$1.Uint8Array;
var Uint8Array$2 = Uint8Array$1;

function cloneArrayBuffer(arrayBuffer) {
  var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  new Uint8Array$2(result).set(new Uint8Array$2(arrayBuffer));
  return result;
}

function cloneTypedArray(typedArray, isDeep) {
  var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}

function initCloneObject(object) {
  return (typeof object.constructor == 'function' && !isPrototype(object))
    ? baseCreate$1(getPrototype$1(object))
    : {};
}

function baseHasIn(object, key) {
  return object != null && key in Object(object);
}

function hasPath(object, path, hasFunc) {
  path = castPath(path, object);
  var index = -1,
      length = path.length,
      result = false;
  while (++index < length) {
    var key = toKey(path[index]);
    if (!(result = object != null && hasFunc(object, key))) {
      break;
    }
    object = object[key];
  }
  if (result || ++index != length) {
    return result;
  }
  length = object == null ? 0 : object.length;
  return !!length && isLength(length) && isIndex(key, length) &&
    (isArray$1(object) || isArguments$1(object));
}

function hasIn(object, path) {
  return object != null && hasPath(object, path, baseHasIn);
}

function createBaseFor(fromRight) {
  return function(object, iteratee, keysFunc) {
    var index = -1,
        iterable = Object(object),
        props = keysFunc(object),
        length = props.length;
    while (length--) {
      var key = props[fromRight ? length : ++index];
      if (iteratee(iterable[key], key, iterable) === false) {
        break;
      }
    }
    return object;
  };
}

var baseFor = createBaseFor();
var baseFor$1 = baseFor;

var now = function() {
  return root$1.Date.now();
};
var now$1 = now;

var FUNC_ERROR_TEXT = 'Expected a function';
var nativeMax = Math.max,
    nativeMin = Math.min;
function debounce(func, wait, options) {
  var lastArgs,
      lastThis,
      maxWait,
      result,
      timerId,
      lastCallTime,
      lastInvokeTime = 0,
      leading = false,
      maxing = false,
      trailing = true;
  if (typeof func != 'function') {
    throw new TypeError(FUNC_ERROR_TEXT);
  }
  wait = toNumber(wait) || 0;
  if (isObject(options)) {
    leading = !!options.leading;
    maxing = 'maxWait' in options;
    maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
    trailing = 'trailing' in options ? !!options.trailing : trailing;
  }
  function invokeFunc(time) {
    var args = lastArgs,
        thisArg = lastThis;
    lastArgs = lastThis = undefined;
    lastInvokeTime = time;
    result = func.apply(thisArg, args);
    return result;
  }
  function leadingEdge(time) {
    lastInvokeTime = time;
    timerId = setTimeout(timerExpired, wait);
    return leading ? invokeFunc(time) : result;
  }
  function remainingWait(time) {
    var timeSinceLastCall = time - lastCallTime,
        timeSinceLastInvoke = time - lastInvokeTime,
        timeWaiting = wait - timeSinceLastCall;
    return maxing
      ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
      : timeWaiting;
  }
  function shouldInvoke(time) {
    var timeSinceLastCall = time - lastCallTime,
        timeSinceLastInvoke = time - lastInvokeTime;
    return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
      (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  }
  function timerExpired() {
    var time = now$1();
    if (shouldInvoke(time)) {
      return trailingEdge(time);
    }
    timerId = setTimeout(timerExpired, remainingWait(time));
  }
  function trailingEdge(time) {
    timerId = undefined;
    if (trailing && lastArgs) {
      return invokeFunc(time);
    }
    lastArgs = lastThis = undefined;
    return result;
  }
  function cancel() {
    if (timerId !== undefined) {
      clearTimeout(timerId);
    }
    lastInvokeTime = 0;
    lastArgs = lastCallTime = lastThis = timerId = undefined;
  }
  function flush() {
    return timerId === undefined ? result : trailingEdge(now$1());
  }
  function debounced() {
    var time = now$1(),
        isInvoking = shouldInvoke(time);
    lastArgs = arguments;
    lastThis = this;
    lastCallTime = time;
    if (isInvoking) {
      if (timerId === undefined) {
        return leadingEdge(lastCallTime);
      }
      if (maxing) {
        clearTimeout(timerId);
        timerId = setTimeout(timerExpired, wait);
        return invokeFunc(lastCallTime);
      }
    }
    if (timerId === undefined) {
      timerId = setTimeout(timerExpired, wait);
    }
    return result;
  }
  debounced.cancel = cancel;
  debounced.flush = flush;
  return debounced;
}

function assignMergeValue(object, key, value) {
  if ((value !== undefined && !eq(object[key], value)) ||
      (value === undefined && !(key in object))) {
    baseAssignValue(object, key, value);
  }
}

function isArrayLikeObject(value) {
  return isObjectLike(value) && isArrayLike(value);
}

function safeGet(object, key) {
  if (key === 'constructor' && typeof object[key] === 'function') {
    return;
  }
  if (key == '__proto__') {
    return;
  }
  return object[key];
}

function toPlainObject(value) {
  return copyObject(value, keysIn(value));
}

function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  var objValue = safeGet(object, key),
      srcValue = safeGet(source, key),
      stacked = stack.get(srcValue);
  if (stacked) {
    assignMergeValue(object, key, stacked);
    return;
  }
  var newValue = customizer
    ? customizer(objValue, srcValue, (key + ''), object, source, stack)
    : undefined;
  var isCommon = newValue === undefined;
  if (isCommon) {
    var isArr = isArray$1(srcValue),
        isBuff = !isArr && isBuffer$1(srcValue),
        isTyped = !isArr && !isBuff && isTypedArray$1(srcValue);
    newValue = srcValue;
    if (isArr || isBuff || isTyped) {
      if (isArray$1(objValue)) {
        newValue = objValue;
      }
      else if (isArrayLikeObject(objValue)) {
        newValue = copyArray(objValue);
      }
      else if (isBuff) {
        isCommon = false;
        newValue = cloneBuffer(srcValue, true);
      }
      else if (isTyped) {
        isCommon = false;
        newValue = cloneTypedArray(srcValue, true);
      }
      else {
        newValue = [];
      }
    }
    else if (isPlainObject(srcValue) || isArguments$1(srcValue)) {
      newValue = objValue;
      if (isArguments$1(objValue)) {
        newValue = toPlainObject(objValue);
      }
      else if (!isObject(objValue) || isFunction(objValue)) {
        newValue = initCloneObject(srcValue);
      }
    }
    else {
      isCommon = false;
    }
  }
  if (isCommon) {
    stack.set(srcValue, newValue);
    mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
    stack['delete'](srcValue);
  }
  assignMergeValue(object, key, newValue);
}

function baseMerge(object, source, srcIndex, customizer, stack) {
  if (object === source) {
    return;
  }
  baseFor$1(source, function(srcValue, key) {
    stack || (stack = new Stack);
    if (isObject(srcValue)) {
      baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
    }
    else {
      var newValue = customizer
        ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
        : undefined;
      if (newValue === undefined) {
        newValue = srcValue;
      }
      assignMergeValue(object, key, newValue);
    }
  }, keysIn);
}

var merge = createAssigner(function(object, source, srcIndex) {
  baseMerge(object, source, srcIndex);
});
var merge$1 = merge;

function baseSet(object, path, value, customizer) {
  if (!isObject(object)) {
    return object;
  }
  path = castPath(path, object);
  var index = -1,
      length = path.length,
      lastIndex = length - 1,
      nested = object;
  while (nested != null && ++index < length) {
    var key = toKey(path[index]),
        newValue = value;
    if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
      return object;
    }
    if (index != lastIndex) {
      var objValue = nested[key];
      newValue = customizer ? customizer(objValue, key, nested) : undefined;
      if (newValue === undefined) {
        newValue = isObject(objValue)
          ? objValue
          : (isIndex(path[index + 1]) ? [] : {});
      }
    }
    assignValue(nested, key, newValue);
    nested = nested[key];
  }
  return object;
}

function basePickBy(object, paths, predicate) {
  var index = -1,
      length = paths.length,
      result = {};
  while (++index < length) {
    var path = paths[index],
        value = baseGet(object, path);
    if (predicate(value, path)) {
      baseSet(result, castPath(path, object), value);
    }
  }
  return result;
}

function basePick(object, paths) {
  return basePickBy(object, paths, function(value, path) {
    return hasIn(object, path);
  });
}

var pick = flatRest(function(object, paths) {
  return object == null ? {} : basePick(object, paths);
});
var pick$1 = pick;

/**
 * API to store a persistent value with debounced synchronization to the specified web extension storage key.
 *
 * After the container is created, we initialize it asynchronously to get the actual value from the storage.
 * The Init method is guarded against multiple initializations to avoid unnecessary reads from the memory.
 * Get/set methods are protected from uninitialized storage to ensure that actual data is used.
 *
 * We declare the sync get/set methods to update the cached value. This allows us to use containers in accessors.
 *
 * Set method updates the cached value and schedules the save operation to the storage via a debounce function to
 * avoid unnecessary writes to the storage.
 *
 * This container saves the data to storage using the specified key to avoid collisions with other instances.
 * It helps to avoid reading the data from the storage that is not related to the current instance.
 */
class PersistentValueContainer {
    // TODO: delete after the migration to event-driven background.
    // We do not recalculate this value because the background type cannot change at runtime.
    static #IS_BACKGROUND_PERSISTENT = PersistentValueContainer.#isBackgroundPersistent();
    #api;
    #key;
    #value;
    // TODO: make required after the migration to event-driven background.
    #save;
    #isInitialized = false;
    /**
     * Creates {@link PersistentValueContainer} instance.
     * @param key The key to use for storing the data.
     * @param api Webextension storage API.
     * @param debounceMs The debounce time in milliseconds to save the data to the storage.
     * Optional. Default is 300ms.
     */
    constructor(key, api, debounceMs = 300) {
        this.#key = key;
        this.#api = api;
        /**
         * TODO: remove this condition after the migration to event-driven background.
         */
        if (!PersistentValueContainer.#IS_BACKGROUND_PERSISTENT) {
            this.#save = debounce(() => {
                this.#api.set({ [this.#key]: this.#value });
            }, debounceMs);
        }
    }
    /**
     * Initializes the value.
     * @param value The initial value.
     * @returns Promise that resolves when the value is initialized.
     * @throws Error, if storage already initialized.
     */
    async init(value) {
        if (this.#isInitialized) {
            throw new Error('Storage already initialized');
        }
        if (PersistentValueContainer.#IS_BACKGROUND_PERSISTENT) {
            this.#value = value;
        }
        else {
            const storageData = await this.#api.get({
                [this.#key]: value,
            });
            // Since Value is unknown, we need to cast it to the correct type.
            this.#value = storageData[this.#key];
        }
        this.#isInitialized = true;
    }
    /**
     * Gets the value.
     * @returns The value stored by the specified key.
     * @throws Error, if storage not initialized.
     */
    get() {
        this.#checkIsInitialized();
        return this.#value;
    }
    /**
     * Sets the value.
     * @param value Value to be stored in the specified key.
     * @throws Error, if storage not initialized.
     */
    set(value) {
        this.#checkIsInitialized();
        this.#value = value;
        if (this.#save) {
            this.#save();
        }
    }
    /**
     * Checks if the storage is initialized.
     * @throws Error, if storage not initialized.
     */
    #checkIsInitialized() {
        if (!this.#isInitialized) {
            throw new Error('Storage not initialized');
        }
    }
    /**
     * TODO: remove this method after the migration to event-driven background.
     * Checks if the background script is persistent.
     * @returns True if the background script is persistent.
     */
    static #isBackgroundPersistent() {
        const manifest = webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().runtime.getManifest();
        if (manifest.manifest_version === 3) {
            return false;
        }
        if (!manifest.background) {
            return true;
        }
        const background = manifest.background;
        return background.persistent ?? true;
    }
}

/**
 * API for storing persistent key-value data with debounced sync with the specified webextension storage key.
 * Webextension storage synchronization described in the {@link PersistentValueContainer} class.
 */
class ExtensionStorage {
    /**
     * API for storing persistent value with debounced sync with the specified webextension storage key.
     */
    #container;
    /**
     * Creates {@link ExtensionStorage} instance.
     * @param key The key to use for storing the data.
     * @param api Webextension storage API.
     */
    constructor(key, api) {
        this.#container = new PersistentValueContainer(key, api);
    }
    /**
     * Initializes the storage.
     * @param data The initial data.
     * @returns Promise that resolves when the storage is initialized.
     * @throws Error, if storage already initialized.
     */
    init(data) {
        return this.#container.init(data);
    }
    /**
     * Gets the value by the specified key.
     * @param key The key to use for storing the value.
     * @throws Error, if storage not initialized.
     * @returns Data stored by the specified key.
     */
    get(key) {
        return this.#container.get()[key];
    }
    /**
     * Sets the value by the specified key.
     * @param key The key to use for storing the value.
     * @param value New value.
     * @throws Error, if storage not initialized.
     */
    set(key, value) {
        const data = this.#container.get();
        data[key] = value;
        this.#container.set(data);
    }
    /**
     * Deletes the value by the specified key.
     * @param key The key to use for storing the value.
     * @throws Error, if storage not initialized.
     */
    delete(key) {
        const data = this.#container.get();
        delete data[key];
        this.#container.set(data);
    }
}

/**
 * Creates accessor decorator for the specified storage.
 *
 * @param storage The extension storage API to use.
 * @returns Accessor decorator for the specified storage.
 * @see https://github.com/tc39/proposal-decorators
 */
function createExtensionStorageDecorator(storage) {
    const fields = new Set();
    /**
     * Creates accessor decorator for the specified storage field.
     *
     * NOTE: You should not set the initial value to the accessor via assignment,
     * because decorator overwrite accessors methods and don't use private property, created on initialization.
     * Use Non-null assertion operator instead.
     * @example `@storage('foo') accessor bar!: string`;
     * @param field Storage field name.
     * @throws Error if decorator is already registered for {@link field}
     * or decorator is applied to class member different from auto accessor.
     * @returns Decorator for access to specified storage {@link field}.
     */
    return function createFieldDecorator(field) {
        // We prevent the use of multiple decorators on a single storage field,
        // because manipulating data through the accessors of multiple modules can be confusing.
        if (fields.has(field)) {
            throw new Error(`Decorator for ${String(field)} field is already registered`);
        }
        fields.add(field);
        return function fieldDecorator(_target, context) {
            if (context.kind !== 'accessor') {
                throw new Error('Class member is not auto accessor');
            }
            // we do not set init descriptor, because data will be initialized asynchronously
            return {
                get() {
                    return storage.get(field);
                },
                set(value) {
                    return storage.set(field, value);
                },
            };
        };
    };
}

/**
 * Memory storage that implements the StorageArea interface.
 */
class MemoryStorage {
    data;
    /** @inheritdoc */
    constructor(initData = {}) {
        this.data = initData;
    }
    /** @inheritdoc */
    get(keys) {
        if (keys === undefined || keys === null) {
            return Promise.resolve(this.data);
        }
        if (typeof keys === 'string') {
            return Promise.resolve({ [keys]: this.data[keys] });
        }
        if (Array.isArray(keys)) {
            return Promise.resolve(pick$1(this.data, keys));
        }
        if (typeof keys === 'object') {
            const picked = Object.keys(keys);
            this.data = merge$1(keys, this.data);
            return Promise.resolve(pick$1(this.data, picked));
        }
        return Promise.resolve({});
    }
    /** @inheritdoc */
    set(items) {
        Object.assign(this.data, items);
        return Promise.resolve();
    }
    /** @inheritdoc */
    remove(keys) {
        if (typeof keys === 'string') {
            delete this.data[keys];
        }
        else {
            keys.forEach((key) => {
                delete this.data[key];
            });
        }
        return Promise.resolve();
    }
    /** @inheritdoc */
    clear() {
        this.data = {};
        return Promise.resolve();
    }
}

/**
 * API for storing data described by {@link SessionStorageSchema} in the {@link browser.storage.session}.
 */
class ExtSessionStorage extends ExtensionStorage {
    static #DOMAIN = 'tswebextension';
    static #DEFAULT_DATA = {
        isAppStarted: false,
        configuration: undefined,
        startTimeMs: undefined,
        cosmeticsInjectedOnStartup: false,
    };
    /**
     * Creates {@link SessionStorage} instance.
     */
    constructor() {
        // Use memory storage as a fallback for old browsers and cases when the code
        // is launched outside the extension (case from partners)
        super(ExtSessionStorage.#DOMAIN, (webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default())?.storage?.session ?? new MemoryStorage());
    }
    /** @inheritdoc */
    init() {
        return super.init(ExtSessionStorage.#DEFAULT_DATA);
    }
}
const extSessionStorage = new ExtSessionStorage();
const sessionDecorator = createExtensionStorageDecorator(extSessionStorage);

function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
    function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
    var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
    var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
    var _, done = false;
    for (var i = decorators.length - 1; i >= 0; i--) {
        var context = {};
        for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
        for (var p in contextIn.access) context.access[p] = contextIn.access[p];
        context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
        var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
        if (kind === "accessor") {
            if (result === void 0) continue;
            if (result === null || typeof result !== "object") throw new TypeError("Object expected");
            if (_ = accept(result.get)) descriptor.get = _;
            if (_ = accept(result.set)) descriptor.set = _;
            if (_ = accept(result.init)) initializers.unshift(_);
        }
        else if (_ = accept(result)) {
            if (kind === "field") initializers.unshift(_);
            else descriptor[key] = _;
        }
    }
    if (target) Object.defineProperty(target, contextIn.name, descriptor);
    done = true;
}function __runInitializers(thisArg, initializers, value) {
    var useValue = arguments.length > 2;
    for (var i = 0; i < initializers.length; i++) {
        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
    }
    return useValue ? value : void 0;
}

/**
 * Top level app context storage.
 *
 * This context is needed to share data between other modules without cyclic dependencies.
 *
 * TODO (v.zhelvis) delete this context after DI is implemented.
 */
let AppContext = (() => {
    let _isAppStarted_decorators;
    let _isAppStarted_initializers = [];
    let _isAppStarted_extraInitializers = [];
    let _configuration_decorators;
    let _configuration_initializers = [];
    let _configuration_extraInitializers = [];
    let _startTimeMs_decorators;
    let _startTimeMs_initializers = [];
    let _startTimeMs_extraInitializers = [];
    let _cosmeticsInjectedOnStartup_decorators;
    let _cosmeticsInjectedOnStartup_initializers = [];
    let _cosmeticsInjectedOnStartup_extraInitializers = [];
    return class AppContext {
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
            _isAppStarted_decorators = [sessionDecorator("isAppStarted" /* SessionStorageKey.IsAppStarted */)];
            _configuration_decorators = [sessionDecorator("configuration" /* SessionStorageKey.Configuration */)];
            _startTimeMs_decorators = [sessionDecorator("startTimeMs" /* SessionStorageKey.StartTimeMs */)];
            _cosmeticsInjectedOnStartup_decorators = [sessionDecorator("cosmeticsInjectedOnStartup" /* SessionStorageKey.CosmeticsInjectedOnStartup */)];
            __esDecorate(this, null, _isAppStarted_decorators, { kind: "accessor", name: "isAppStarted", static: false, private: false, access: { has: obj => "isAppStarted" in obj, get: obj => obj.isAppStarted, set: (obj, value) => { obj.isAppStarted = value; } }, metadata: _metadata }, _isAppStarted_initializers, _isAppStarted_extraInitializers);
            __esDecorate(this, null, _configuration_decorators, { kind: "accessor", name: "configuration", static: false, private: false, access: { has: obj => "configuration" in obj, get: obj => obj.configuration, set: (obj, value) => { obj.configuration = value; } }, metadata: _metadata }, _configuration_initializers, _configuration_extraInitializers);
            __esDecorate(this, null, _startTimeMs_decorators, { kind: "accessor", name: "startTimeMs", static: false, private: false, access: { has: obj => "startTimeMs" in obj, get: obj => obj.startTimeMs, set: (obj, value) => { obj.startTimeMs = value; } }, metadata: _metadata }, _startTimeMs_initializers, _startTimeMs_extraInitializers);
            __esDecorate(this, null, _cosmeticsInjectedOnStartup_decorators, { kind: "accessor", name: "cosmeticsInjectedOnStartup", static: false, private: false, access: { has: obj => "cosmeticsInjectedOnStartup" in obj, get: obj => obj.cosmeticsInjectedOnStartup, set: (obj, value) => { obj.cosmeticsInjectedOnStartup = value; } }, metadata: _metadata }, _cosmeticsInjectedOnStartup_initializers, _cosmeticsInjectedOnStartup_extraInitializers);
            if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        }
        /**
         * Is storage initialized.
         * This flag is used to prevent access to persistent storage data on
         * request from content script, before app is started.
         */
        isStorageInitialized = false;
        #isAppStarted_accessor_storage = __runInitializers(this, _isAppStarted_initializers, void 0);
        /**
         * Is app started.
         */
        get isAppStarted() { return this.#isAppStarted_accessor_storage; }
        set isAppStarted(value) { this.#isAppStarted_accessor_storage = value; }
        #configuration_accessor_storage = (__runInitializers(this, _isAppStarted_extraInitializers), __runInitializers(this, _configuration_initializers, void 0));
        /**
         * MV3 ConfigurationMV3 excludes heavyweight fields with rules.
         */
        get configuration() { return this.#configuration_accessor_storage; }
        set configuration(value) { this.#configuration_accessor_storage = value; }
        #startTimeMs_accessor_storage = (__runInitializers(this, _configuration_extraInitializers), __runInitializers(this, _startTimeMs_initializers, void 0));
        /**
         * Start time of the app.
         */
        get startTimeMs() { return this.#startTimeMs_accessor_storage; }
        set startTimeMs(value) { this.#startTimeMs_accessor_storage = value; }
        #cosmeticsInjectedOnStartup_accessor_storage = (__runInitializers(this, _startTimeMs_extraInitializers), __runInitializers(this, _cosmeticsInjectedOnStartup_initializers, void 0));
        /**
         * Flag that indicates that cosmetics were injected on startup.
         */
        get cosmeticsInjectedOnStartup() { return this.#cosmeticsInjectedOnStartup_accessor_storage; }
        set cosmeticsInjectedOnStartup(value) { this.#cosmeticsInjectedOnStartup_accessor_storage = value; }
        constructor() {
            __runInitializers(this, _cosmeticsInjectedOnStartup_extraInitializers);
        }
    };
})();
const appContext = new AppContext();

/**
 * Export logger implementation.
 */
const logger = new Logger(console);
/**
 * Stringify object via JSON.stringify without specified keys.
 *
 * @param obj Object to stringify.
 * @param excludedKeys Keys to exclude.
 *
 * @returns Stringified object without excludedKeys (checking nested keys too).
 */
const stringifyObjectWithoutKeys = (obj, excludedKeys) => {
    return JSON.stringify(obj, (key, value) => (excludedKeys.includes(key) ? undefined : value), 2);
};

/**
 * Describes error when enabled static rule sets has been failed.
 */
class FailedEnableRuleSetsError extends Error {
    /**
     * A list of the IDs of the rule sets that were attempted to enable.
     */
    enableRulesetIds;
    /**
     * A list of the IDs of the rule sets that were attempted to disable.
     */
    disableRulesetIds;
    /**
     * Describes error when enabled static rule sets has been failed.
     *
     * @param message Message of error.
     * @param enableRulesetIds A list of the IDs of the rule sets that were
     * attempted to enable.
     * @param disableRulesetIds A list of the IDs of the rule sets that were
     * attempted to disable.
     * @param cause Specific browser.declarativeNetRequest error.
     */
    constructor(message, enableRulesetIds, disableRulesetIds, cause) {
        super(message, { cause });
        this.name = 'FailedEnableRuleSetsError';
        this.enableRulesetIds = enableRulesetIds;
        this.disableRulesetIds = disableRulesetIds;
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(this, FailedEnableRuleSetsError.prototype);
    }
}

/**
 * Loads a resource from the extension resources.
 *
 * @param path Path to the resource.
 * @returns Promise resolved with the resource.
 *
 * @throws If the resource is not found.
 */
const loadExtensionResource = async (path) => {
    const chromeUrl = chrome.runtime.getURL(path);
    return fetch(chromeUrl);
};
/**
 * Loads a text file from the extension resources.
 *
 * @param path Path to the file.
 * @returns Promise resolved with file content as a string.
 */
const loadExtensionTextResource = async (path) => {
    const file = await loadExtensionResource(path);
    return file.text();
};
/**
 * Loads a binary file from the extension resources.
 *
 * @param path Path to the file.
 * @returns Promise resolved with file content as an ArrayBuffer.
 */
const loadExtensionBinaryResource = async (path) => {
    const file = await loadExtensionResource(path);
    return file.arrayBuffer();
};

const RULE_SET_NAME_PREFIX = 'ruleset_';
/**
 * FiltersApi knows how to enable or disable static rule sets (which were built
 * with the extension) and how to create {@link Filter} through
 * loading its contents.
 */
class FiltersApi {
    /**
     * Cache for already created filters. Needed to avoid multiple loading
     * of the same filter.
     */
    static filtersCache = new Map();
    /**
     * Enables or disables the provided rule set identifiers.
     *
     * @param disableFiltersIds Rule sets to disable.
     * @param enableFiltersIds Rule sets to enable.
     *
     * @returns Promise resolved with result of updating {@link UpdateStaticFiltersResult}.
     */
    static async updateFiltering(disableFiltersIds, enableFiltersIds) {
        const res = {
            errors: [],
        };
        const enableRulesetIds = enableFiltersIds?.map((filterId) => `${RULE_SET_NAME_PREFIX}${filterId}`) || [];
        const disableRulesetIds = disableFiltersIds?.map((filterId) => `${RULE_SET_NAME_PREFIX}${filterId}`) || [];
        try {
            await browser.declarativeNetRequest.updateEnabledRulesets({
                enableRulesetIds,
                disableRulesetIds,
            });
        }
        catch (e) {
            const msg = 'Cannot change list of enabled rule sets';
            const err = new FailedEnableRuleSetsError(msg, enableRulesetIds, disableRulesetIds, e);
            res.errors.push(err);
        }
        return res;
    }
    /**
     * Returns current enabled rule sets IDs.
     *
     * @returns List of extracted enabled rule sets ids.
     */
    static async getEnabledRuleSets() {
        const ruleSets = await browser.declarativeNetRequest.getEnabledRulesets();
        return ruleSets.map((f) => Number.parseInt(f.slice(RULE_SET_NAME_PREFIX.length), 10));
    }
    /**
     * Helper method to load chunks from ArrayBuffer.
     *
     * @param arrayBuffer ArrayBuffer to load chunks from.
     *
     * @returns List of Uint8Array chunks.
     */
    static async loadChunksFromArrayBuffer(arrayBuffer) {
        // we can assume that the arrayBuffer.byteLength is divisible by ByteBuffer.CHUNK_SIZE
        const chunkSize = ByteBuffer.CHUNK_SIZE;
        const totalChunks = arrayBuffer.byteLength / chunkSize;
        return Array.from({ length: totalChunks }, (_, i) => {
            const start = i * chunkSize;
            const end = Math.min(start + chunkSize, arrayBuffer.byteLength);
            return new Uint8Array(arrayBuffer.slice(start, end));
        });
    }
    /**
     * Loads filters content from provided filtersPath (which has been extracted
     * from field 'filtersPath' of the {@link Configuration}).
     *
     * @param id Filter id.
     * @param filtersPath Path to filters directory.
     *
     * @returns Promise resolved file content as a list of strings.
     */
    static async loadFilterContent(id, filtersPath) {
        const rawFilterPath = `${filtersPath}/${getFilterName(id)}`;
        const binaryFilterPath = `${filtersPath}/${getFilterBinaryName(id)}`;
        const conversionMapPath = `${filtersPath}/${getFilterConversionMapName(id)}`;
        const sourceMapPath = `${filtersPath}/${getFilterSourceMapName(id)}`;
        const [rawFilterList, filterList, conversionMap, sourceMap] = await Promise.all([
            // TODO (David): store raw filter list in byte-encoded form
            loadExtensionTextResource(rawFilterPath),
            loadExtensionBinaryResource(binaryFilterPath).then(this.loadChunksFromArrayBuffer),
            loadExtensionTextResource(conversionMapPath).then(JSON.parse).then(filterListConversionMapValidator.parse),
            loadExtensionTextResource(sourceMapPath).then(JSON.parse).then(filterListSourceMapValidator.parse),
        ]);
        return {
            rawFilterList,
            filterList,
            conversionMap,
            sourceMap,
        };
    }
    /**
     * Wraps static filters into {@link IFilter}.
     *
     * @param filtersIds List of filters ids.
     * @param filtersPath Path to filters directory.
     *
     * @returns List of {@link IFilter} with a lazy content loading feature.
     */
    static createStaticFilters(filtersIds, filtersPath) {
        return filtersIds.map((filterId) => {
            const filterFromCache = this.filtersCache.get(filterId);
            if (filterFromCache) {
                return filterFromCache;
            }
            const filter = new Filter(filterId, { getContent: () => this.loadFilterContent(filterId, filtersPath) }, 
            /**
             * Static filters are trusted.
             */
            true);
            this.filtersCache.set(filterId, filter);
            return filter;
        });
    }
    /**
     * Wraps custom filter into {@link IFilter}.
     *
     * @param customFilters List of custom filters.
     *
     * @returns List of {@link IFilter} with a lazy content loading feature.
     */
    static createCustomFilters(customFilters) {
        return customFilters.map((f) => new Filter(f.filterId, {
            getContent: () => Promise.resolve(f),
        }, f.trusted));
    }
}

/**
 * Checks if error has message.
 *
 * @param error Error object.
 * @returns If param is error.
 */
function isErrorWithMessage(error) {
    return (typeof error === 'object'
        && error !== null
        && 'message' in error
        && typeof error.message === 'string');
}
/**
 * Converts error to the error with message.
 *
 * @param maybeError Possible error.
 * @returns Error with message.
 */
function toErrorWithMessage(maybeError) {
    if (isErrorWithMessage(maybeError)) {
        return maybeError;
    }
    try {
        return new Error(JSON.stringify(maybeError));
    }
    catch {
        // fallback in case there's an error stringifying the maybeError
        // like with circular references for example.
        return new Error(String(maybeError));
    }
}
/**
 * Converts error object to error with message. This method might be helpful to handle thrown errors.
 *
 * @param error Error object.
 *
 * @returns Message of the error.
 */
function getErrorMessage(error) {
    return toErrorWithMessage(error).message;
}

/**
 * DynamicRulesApi knows how to handle dynamic rules: apply a list of custom
 * filters along with user rules, allowlist and quick fixes rules and disable
 * all dynamic rules when the filtration is stopped.
 */
class DynamicRulesApi {
    /**
     * The maximum number of regular expression rules that an extension can add.
     * This limit is evaluated separately for the set of session rules,
     * dynamic rules and those specified in the rule_resources file.
     *
     * @returns Maximum number of regular expression rules.
     */
    static get MAX_NUMBER_OF_REGEX_RULES() {
        return browser.declarativeNetRequest.MAX_NUMBER_OF_REGEX_RULES;
    }
    /**
     * The maximum number of combined dynamic and session scoped rules an extension can add.
     * In Chrome, this limit is enforced for the combination of dynamic and session scoped rules.
     * In Firefox, each ruleset has its own quota.
     *
     * @returns Maximum number of combined dynamic and session rules.
     */
    static get MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES() {
        return browser.declarativeNetRequest.MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES;
    }
    /**
     * Converts custom filters and user rules on the fly into a single merged
     * rule set and applies it via the declarativeNetRequest API.
     *
     * Filters will combine into one in following order:
     * - quickFixesFilter - they are most important and should be applied first,
     * - allowlistRules,
     * - userRules,
     * - customFilters.
     *
     * @param quickFixesFilter Filter with hotfix rules.
     * @param allowlistRules Filter with allowlist rules.
     * @param userRules Filter with user rules.
     * @param customFilters List of custom filters.
     * @param staticRuleSets List of enabled static rule sets to apply
     * $badfilter rules from dynamic rules to static.
     * @param resourcesPath String path to web accessible resources,
     * relative to the extension root dir. Should start with leading slash '/'.
     *
     * @returns Converted dynamic rule set with rule set, errors and
     * limitations. @see {@link ConversionResult}.
     *
     * @throws Error if declarativeNetRequest.updateDynamicRules() receives invalid rules
     * e.g. with non-ASCII `urlFilter` value.
     * @see {@link https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest#property-RuleCondition-urlFilter}
     */
    static async updateDynamicFiltering(quickFixesFilter, allowlistRules, userRules, customFilters, staticRuleSets, resourcesPath) {
        const filterList = [
            quickFixesFilter,
            allowlistRules,
            userRules,
            ...customFilters,
        ];
        // Create filter and convert into single rule set
        const converter = new DeclarativeFilterConverter();
        const conversionResult = await converter.convertDynamicRuleSets(filterList, 
        // TODO: (AG-34651) Pass only enabled rulesets
        staticRuleSets, {
            resourcesPath,
            maxNumberOfRules: DynamicRulesApi.MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES,
            maxNumberOfRegexpRules: DynamicRulesApi.MAX_NUMBER_OF_REGEX_RULES,
        });
        const { ruleSet, declarativeRulesToCancel } = conversionResult;
        const declarativeRules = await ruleSet.getDeclarativeRules();
        // Remove existing dynamic rules, in order their ids not interfere with new ones
        await this.removeAllRules();
        await browser.declarativeNetRequest.updateDynamicRules({
            // TODO update rule types returned by getDeclarativeRules();
            addRules: declarativeRules,
        });
        if (declarativeRulesToCancel && declarativeRulesToCancel.length > 0) {
            // Apply $badfilter rules from dynamic filters.
            await this.applyBadFilterRules(declarativeRulesToCancel);
        }
        else {
            // TODO: (AG-34651) Check, if filter_1 has been enabled and we disable some
            // rules there - should we enable them back before disable filter?
            // Because in other case, when we will re-enable filter - maybe it
            // will contains already disabled rules?
            // Undoes all previously applied changes.
            await this.cancelAllStaticRulesUpdates(staticRuleSets);
        }
        return conversionResult;
    }
    /**
     * Cancels any disabled rules ids for all static rulesets.
     *
     * @param staticRuleSets List of static {@link IRuleSet}.
     */
    static async cancelAllStaticRulesUpdates(staticRuleSets) {
        const tasks = staticRuleSets.map(async (r) => {
            const rulesetId = r.getId();
            // Get list of current disabled rules ids.
            const enableRuleIds = await browser.declarativeNetRequest.getDisabledRuleIds({ rulesetId });
            // And enable all of them.
            return browser.declarativeNetRequest.updateStaticRules({
                rulesetId,
                enableRuleIds,
            });
        });
        try {
            await Promise.all(tasks);
        }
        catch (e) {
            // eslint-disable-next-line max-len
            logger.error(`[tswebextension.cancelAllStaticRulesUpdates]: cannot cancel all updates to static rules due to: ${getErrorMessage(e)}`);
        }
    }
    /**
     * Applies rules with $badfilter modifier which can cancel other rules from
     * static filters which already converted to declarative rules.
     *
     * @param declarativeRulesToCancel List of {@link UpdateStaticRulesOptions}.
     */
    static async applyBadFilterRules(declarativeRulesToCancel) {
        const tasks = declarativeRulesToCancel.map(async ({ rulesetId, disableRuleIds: ruleIdsToDisable, }) => {
            // Get list of current disabled rules ids.
            const disabledRuleIds = await browser.declarativeNetRequest.getDisabledRuleIds({ rulesetId });
            // Collect rules which should be enabled.
            const enableRuleIds = disabledRuleIds.filter((id) => !ruleIdsToDisable.includes(id));
            // Filter only that rules which are not disabled already.
            const disableRuleIds = ruleIdsToDisable.filter((id) => !disabledRuleIds.includes(id));
            return browser.declarativeNetRequest.updateStaticRules({
                rulesetId,
                enableRuleIds,
                disableRuleIds,
            });
        });
        try {
            await Promise.all(tasks);
        }
        catch (e) {
            // eslint-disable-next-line max-len
            logger.error(`[tswebextension.applyBadFilterRules]: cannot apply updates to static rules due to: ${getErrorMessage(e)}`);
        }
    }
    /**
     * Disables all enabled dynamic rules.
     */
    static async removeAllRules() {
        // Get existing dynamic rules
        const existingRules = await browser.declarativeNetRequest.getDynamicRules();
        const existingRulesIds = existingRules.map((rule) => rule.id);
        // Remove existing dynamic rules
        await browser.declarativeNetRequest.updateDynamicRules({ removeRuleIds: existingRulesIds });
    }
}

/**
 * Simple pub-sub implementation.
 */
class EventChannel {
    listeners = [];
    /**
     * Dispatch event.
     *
     * @param data Event data.
     */
    dispatch(data) {
        this.listeners.forEach((listener) => listener(data));
    }
    /**
     * Subscribe to events channel.
     *
     * @param listener Callback to be called on event.
     */
    subscribe(listener) {
        this.listeners.push(listener);
    }
    /**
     * Unsubscribe from events channel.
     *
     * @param listener Callback to be removed from listeners.
     */
    unsubscribe(listener) {
        const index = this.listeners.indexOf(listener);
        if (index !== -1) {
            this.listeners.splice(index, 1);
        }
    }
}

/**
 * @file
 * This file contains constants for communication between background and content scripts.
 * This constants are separated from message.ts to reduce bundle size,
 * because rollup cannot tree-shake tswebextension library code.
 */
/**
 * Name of the message handler.
 * It is needed for determining specific tswebextension message from other messages.
 */
const MESSAGE_HANDLER_NAME = 'tsWebExtension';
/**
 * Message types for communication between background and content scripts.
 */
var MessageType;
(function (MessageType) {
    MessageType["ProcessShouldCollapse"] = "processShouldCollapse";
    MessageType["GetCosmeticData"] = "getCosmeticData";
    MessageType["GetCookieRules"] = "getCookieRules";
    MessageType["SaveCookieLogEvent"] = "saveCookieLogEvent";
    MessageType["InitAssistant"] = "initAssistant";
    MessageType["CloseAssistant"] = "closeAssistant";
    MessageType["AssistantCreateRule"] = "assistantCreateRule";
    MessageType["SaveCssHitsStats"] = "saveCssHitsStats";
})(MessageType || (MessageType = {}));

/**
 * Assistant class is the handler of messages and events related
 * to AdGuard assistant.
 */
class Assistant {
    /**
     * Fires when a rule has been created from the AdGuard assistant.
     */
    static onCreateRule = new EventChannel();
    /**
     * Opens the AdGuard assistant in the specified tab.
     *
     * @param tabId The ID of the tab where is needed to open
     * the AdGuard assistant.
     */
    static async openAssistant(tabId) {
        await MessagesApi.sendMessageToTab(tabId, {
            type: MessageType.InitAssistant,
        });
    }
    /**
     * Closes the AdGuard assistant in the specified tab.
     *
     * @param tabId The ID of the tab where is needed to close
     * the AdGuard assistant.
     */
    static async closeAssistant(tabId) {
        await MessagesApi.sendMessageToTab(tabId, {
            type: MessageType.CloseAssistant,
        });
    }
}

/**
 * Filter ID which is used for User rules.
 */
const USER_FILTER_ID = 0;
/**
 * Filter ID which is used for Allowlist.
 */
const ALLOWLIST_FILTER_ID = 100;
/**
 * Filter ID for AdGuard Quick Fixes filter.
 *
 * @see {@link https://github.com/AdguardTeam/FiltersRegistry/blob/master/filters/filter_24_QuickFixes/metadata.json}
 */
const QUICK_FIXES_FILTER_ID = 24;
/**
 * Tab ID for background page.
 */
const BACKGROUND_TAB_ID = (/* unused pure expression or super */ null && (-1));
/**
 * Line feed character.
 */
const LF = '\n';
/**
 * Timeout used for deletion of request context data and frame context data from the storage.
 */
const FRAME_DELETION_TIMEOUT_MS = 3000;
/**
 * Document level frame id.
 */
const MAIN_FRAME_ID = 0;

/**
 * The allowlist is used to exclude certain websites from filtering.
 * Blocking rules are not applied to the sites in the list.
 * The allow list can also be inverted.
 * In inverted mode, the application will unblock ads everywhere except for the
 * sites added to this list.
 */
class Allowlist {
    /**
     * Indicates whether the allowlist is enabled.
     */
    enabled = false;
    /**
     * If true, ads will be blocked only on sites listed in the allowlist,
     * like "blocklist" mode.
     */
    inverted = false;
    /**
     * List of domains which are allowed (by default)
     * or blocked (if the allowlist is inverted).
     */
    domains = [];
    /**
     * Configures allowlist state based on app configuration.
     *
     * @param configuration App configuration.
     */
    configure(configuration) {
        const { allowlist, settings, } = configuration;
        const { allowlistEnabled, allowlistInverted, } = settings;
        this.enabled = allowlistEnabled;
        this.inverted = allowlistInverted;
        this.domains = allowlist.map((hostname) => {
            return hostname.startsWith('www.') ? hostname.substring(4).trim() : hostname.trim();
        });
    }
    /**
     * Returns a list of rules to be loaded into the engine based on allowlist state.
     *
     * @returns List of allowlist rules or null.
     */
    getAllowlistRules() {
        if (!this.enabled || this.inverted) {
            return null;
        }
        return (0,_adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .createAllowlistRuleList */ .kz)(ALLOWLIST_FILTER_ID, this.domains);
    }
    /**
     * Creates an allowlist rule for a domain which will be passed to our engine
     * to unblock requests. In MV3 we will pass this rule to TsUrlFilter engine,
     * because it do work with cosmetic rules.
     *
     * @param domain Domain name.
     *
     * @returns Allowlist rule or null.
     */
    static createAllowlistRule(domain) {
        if (!domain) {
            return null;
        }
        return _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .RuleFactory.createAllowlistRule */ .Nr.createAllowlistRule(domain, ALLOWLIST_FILTER_ID);
    }
}

/**
 * Checks if url is http request.
 *
 * @param url Request url.
 * @returns True if url starts with http{s?}.
 */
function isHttpRequest(url) {
    return typeof url === 'string' && !!url && url.startsWith('http');
}
/**
 * Checks if url is http or websocket.
 *
 * @param url Request url.
 * @returns True if url starts with http{s?} or ws.
 */
function isHttpOrWsRequest(url) {
    return !!url && (url.startsWith('http') || url.startsWith('ws'));
}
/**
 * Extract host from url.
 *
 * @param url Url.
 * @returns Host of the url or null.
 */
function getHost(url) {
    let firstIdx = url.indexOf('//');
    if (firstIdx === -1) {
        /**
         * It's non-hierarchical structured URL (stun: or turn:).
         *
         * @see {@link https://tools.ietf.org/html/rfc4395#section-2.2}
         * @see {@link https://tools.ietf.org/html/draft-nandakumar-rtcweb-stun-uri-08#appendix-B}
         */
        firstIdx = url.indexOf(':');
        if (firstIdx === -1) {
            return null;
        }
        firstIdx -= 1;
    }
    const nextSlashIdx = url.indexOf('/', firstIdx + 2);
    const startParamsIdx = url.indexOf('?', firstIdx + 2);
    let lastIdx = nextSlashIdx;
    if (startParamsIdx > 0 && (startParamsIdx < nextSlashIdx || nextSlashIdx < 0)) {
        lastIdx = startParamsIdx;
    }
    let host = lastIdx === -1 ? url.substring(firstIdx + 2) : url.substring(firstIdx + 2, lastIdx);
    const portIndex = host.indexOf(':');
    host = portIndex === -1 ? host : host.substring(0, portIndex);
    const lastChar = host.charAt(host.length - 1);
    if (lastChar === '.') {
        host = host.slice(0, -1);
    }
    return host;
}
/**
 * Extracts domain name from url.
 *
 * @param url Url.
 * @returns Domain name or null.
 */
function getDomain(url) {
    const host = getHost(url);
    if (!host) {
        return null;
    }
    return host.startsWith('www.') ? host.substring(4) : host;
}
/**
 * If referrer of request contains full url of extension, then this request is considered as extension's own request.
 * Example: request for filter downloading.
 * Related issue: @see {@link https://github.com/AdguardTeam/AdguardBrowserExtension/issues/1437}.
 *
 * @param url Request url.
 * @returns True if request is extension's own.
 */
function isExtensionUrl(url) {
    return url.indexOf(browser.runtime.getURL('')) === 0;
}
/**
 * Checks third party relation.
 *
 * @param requestUrl Request url.
 * @param referrer Referrer url.
 * @returns True if request is third-party.
 */
function isThirdPartyRequest(requestUrl, referrer) {
    const tldResult = parse$5(requestUrl);
    const sourceTldResult = parse$5(referrer);
    return tldResult.domain !== sourceTldResult.domain;
}
/**
 * Extracts upper level domain from domain.
 *
 * @param domain Domain.
 *
 * @example getUpperLevelDomain('www.example.com') => 'example.com'
 * @example getUpperLevelDomain('test.pages.dev') => 'pages.dev'
 * @example getUpperLevelDomain('allowlist.test.pages.dev') => 'test.pages.dev'
 *
 * @returns Upper level domain.
 */
function getUpperLevelDomain(domain) {
    const parts = domain.split('.');
    parts.shift();
    return parts.join('.');
}

/**
 * The allowlist is used to exclude certain websites from filtering.
 * Blocking rules are not applied to the sites in the list.
 * The allow list can also be inverted.
 * In inverted mode, the application will unblock ads everywhere except for the
 * sites added to this list.
 */
class AllowlistApi extends Allowlist {
    /**
     * Configures allowlist state based on app configuration.
     *
     * @param configuration App configuration.
     */
    configure(configuration) {
        /**
         * For MV3 we add "*." for each domain to make matching algorithm
         * same as in DNR engine: requestDomains and excludedRequestDomains in
         * DNR will match all subdomains of the domain by default.
         */
        const domainWithSubDomainsMask = configuration.allowlist.reduce((acc, domain) => {
            acc.push(domain);
            if (!domain.startsWith('*.')) {
                acc.push(`*.${domain}`);
            }
            return acc;
        }, []);
        super.configure({
            ...configuration,
            allowlist: domainWithSubDomainsMask,
        });
    }
    /**
     * Creates one allowlist rule for all allowlistRules. This one combined rule
     * will be passed to the DNR converter.
     *
     * NOTE: We use $to (_to domains_) modifier instead of $domain (_from domains_),
     * because it is needed to match frame request itself and all requests from
     * this frame.
     * @see https://groups.google.com/a/chromium.org/g/chromium-extensions/c/S0TtE9Vk4N4/m/hPtSafzVAQAJ
     * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#to-modifier
     * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#domain-modifier
     *
     * @example
     * // configuration = { allowlist: 'example.com, example.org', enabled: true, inverted: false }
     * combineAllowListRules() -> '@@$document,to=example.com|example.org'
     *
     * @example
     * // configuration = { allowlist: 'example.com, example.org', enabled: true, inverted: true }
     * combineAllowListRules() -> '@@$document,to=~example.com|~example.org'
     *
     * @returns Combined rule in AG format.
     */
    combineAllowListRulesForDNR() {
        const allDomains = this.domains.map((domain) => {
            // Map subdomain masks to upper domains records, because masks itself
            // will be ignored by DNR. Transforming masks to upper domains will
            // match all subdomains by default in DNR.
            // We added them for consistency between DNR engine and
            // our tsurlfilter (for cosmetic in MV3).
            const d = domain.startsWith('*.')
                ? getUpperLevelDomain(domain)
                : domain;
            return this.inverted ? `~${d}` : d;
        });
        const concatenatedUniqueDomains = Array.from(new Set(allDomains)).join('|');
        return allDomains.length > 0 ? `@@$document,to=${concatenatedUniqueDomains}` : '';
    }
}
const allowlistApi = new AllowlistApi();

/**
 * Matches rules from {@link EngineApi} based on current {@link Allowlist} state.
 */
class DocumentApi {
    /**
     * Match frame rule based on allowlist state.
     *
     * @param frameUrl Frame url.
     * @returns Matched rule or null.
     */
    static matchFrame(frameUrl) {
        const { enabled, inverted } = allowlistApi;
        /**
         * If inverted allowlist enabled, use specific matching strategy.
         */
        if (enabled && inverted) {
            return DocumentApi.matchFrameInverted(frameUrl);
        }
        /**
         * If allowlist mode is default, request rule from engine.
         * If allowlist is enabled, rules have already loaded.
         */
        return engineApi.matchFrame(frameUrl);
    }
    /**
     * Creates allowlist rule for domains that are not in the inverted list.
     * In other cases returns engine matched rule.
     *
     * @param frameUrl Frame url.
     * @returns Matched rule or null.
     */
    static matchFrameInverted(frameUrl) {
        const domain = getDomain(frameUrl);
        if (!domain) {
            return null;
        }
        const upperDomain = getUpperLevelDomain(domain);
        if (!allowlistApi.domains.includes(domain) && !allowlistApi.domains.includes(`*.${upperDomain}`)) {
            return AllowlistApi.createAllowlistRule(domain);
        }
        return engineApi.matchFrame(frameUrl);
    }
}

const ASYNC_LOAD_CHINK_SIZE = 5000;
/**
 * EngineApi - TSUrlFilter engine wrapper which controls how to work with
 * cosmetic rules.
 */
class EngineApi {
    /**
     * Link to current Engine.
     */
    engine;
    // TODO: Make private
    /**
     * To prevent multiple calls to startEngine, saves the first call to
     * startEngine and waits for it.
     */
    waitingForEngine;
    /**
     * Store here links to dynamic filters which created on the fly.
     */
    dynamicFilters = new Map();
    /**
     * Starts the engine with the provided bunch of rules,
     * wrapped in filters or custom rules.
     *
     * @param config {@link EngineConfig} Which contains filters (static and
     * custom), custom rules, quick fixes rules and the verbose flag.
     */
    async startEngine(config) {
        const { filters, userrules, quickFixesRules, verbose, } = config;
        const lists = [];
        for (let i = 0; i < filters.length; i += 1) {
            try {
                const filter = filters[i];
                // eslint-disable-next-line no-await-in-loop
                const content = await filter.getContent();
                const trusted = filter.isTrusted();
                lists.push(new _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .BufferRuleList */ .bm(filter.getId(), content.filterList, false, !trusted, !trusted, content.sourceMap));
            }
            catch (e) {
                const filterId = filters[i].getId();
                logger.error(`Cannot create IRuleList for filter ${filterId} due to: ${getErrorMessage(e)}`);
            }
        }
        if (userrules.filterList.length > 0) {
            // Note: rules are already converted at the extension side
            lists.push(new _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .BufferRuleList */ .bm(USER_FILTER_ID, userrules.filterList, false, false, false, userrules.sourceMap));
        }
        if (quickFixesRules.filterList.length > 0) {
            // Note: rules are already converted at the extension side
            lists.push(new _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .BufferRuleList */ .bm(QUICK_FIXES_FILTER_ID, quickFixesRules.filterList, false, false, false, quickFixesRules.sourceMap));
        }
        const allowlistRulesList = allowlistApi.getAllowlistRules();
        if (allowlistRulesList) {
            lists.push(allowlistRulesList);
            this.dynamicFilters.set(ALLOWLIST_FILTER_ID, allowlistRulesList);
        }
        const ruleStorage = new _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .RuleStorage */ .qc(lists);
        /*
         * UI thread becomes blocked on the options page while request filter is
         * created that's why we create filter rules using chunks of
         * the specified length.
         * Request filter creation is rather slow operation so we should
         * use setTimeout calls to give UI thread some time.
        */
        const engine = new _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .Engine */ .D4(ruleStorage, true);
        await engine.loadRulesAsync(ASYNC_LOAD_CHINK_SIZE);
        this.engine = engine;
        // Update configuration of engine.
        (0,_adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .setConfiguration */ .Dg)({
            engine: 'extension',
            version: webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().runtime.getManifest().version,
            verbose,
            compatibility: _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .CompatibilityTypes.Extension */ .cC.Extension,
        });
    }
    /**
     * Stops filtering engine with cosmetic rules.
     */
    stopEngine() {
        this.engine = undefined;
    }
    /**
     * Matches current frame and returns document-level allowlist rule if found.
     *
     * @param frameUrl Url of current frame.
     *
     * @returns Document-level allowlist rule if found, otherwise null.
     */
    matchFrame(frameUrl) {
        if (!this.engine || !isHttpOrWsRequest(frameUrl)) {
            return null;
        }
        return this.engine.matchFrame(frameUrl);
    }
    /**
     * Gets cosmetic result for the specified url and cosmetic options if
     * engine is started.
     * Otherwise returns empty CosmeticResult.
     *
     * @param url Hostname to check.
     * @param option Mask of enabled cosmetic types.
     * @returns Cosmetic result.
     */
    getCosmeticResult(url, option) {
        if (!this.engine) {
            return new _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .CosmeticResult */ .cT();
        }
        const frameUrl = getHost(url);
        // Checks if an allowlist rule exists at the document level,
        // then discards all cosmetic rules.
        const allowlistFrameRule = DocumentApi.matchFrame(url);
        if (allowlistFrameRule) {
            return new _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .CosmeticResult */ .cT();
        }
        const request = new _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .Request */ .cf(url, frameUrl, _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .RequestType.Document */ .xd.Document);
        return this.engine.getCosmeticResult(request, option);
    }
    /**
     * Gets current loaded rules in the filtering engine
     * (except declarative rules).
     *
     * @returns Number of loaded rules in the filtering engine.
     */
    getRulesCount() {
        return this.engine ? this.engine.getRulesCount() : 0;
    }
    /**
     * Searched for cosmetic rules by match query.
     *
     * @param matchQuery Query against which the request would be matched.
     * @returns Cosmetic result.
     */
    matchCosmetic(matchQuery) {
        if (!this.engine || !isHttpRequest(matchQuery.frameUrl)) {
            return new _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .CosmeticResult */ .cT();
        }
        const matchingResult = this.matchRequest(matchQuery);
        if (!matchingResult) {
            return new _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .CosmeticResult */ .cT();
        }
        const cosmeticOption = matchingResult.getCosmeticOption();
        return this.getCosmeticResult(matchQuery.requestUrl, cosmeticOption);
    }
    /**
     * Matches the specified request against the filtering engine and returns the matching result.
     *
     * @param matchQuery Item of {@link MatchQuery}, contains request details.
     *
     * @returns Item of {@link MatchingResult} or null, if engine is not started.
     */
    matchRequest(matchQuery) {
        if (!this.engine) {
            return null;
        }
        const { requestUrl, frameUrl, requestType, frameRule, } = matchQuery;
        const request = new _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .Request */ .cf(requestUrl, frameUrl, requestType);
        return this.engine.matchRequest(request, frameRule);
    }
    /**
     * Retrieves rule node from a dynamic filter.
     * Dynamic filters are filters that are not loaded from the storage but
     * created on the fly: now only for allowlist rules.
     *
     * @param filterId Filter id.
     * @param ruleIndex Rule index.
     * @returns Rule node or null.
     */
    retrieveDynamicRuleNode(filterId, ruleIndex) {
        const ruleList = this.dynamicFilters.get(filterId);
        if (!ruleList) {
            return null;
        }
        return ruleList.retrieveRuleNode(ruleIndex);
    }
}
const engineApi = new EngineApi();

/**
 * Frame context data.
 * We store {@link MatchingResult} and {@link CosmeticResult} in the frame context
 * to apply rules that cannot be handled during request processing.
 * The frame data is deleted after the {@link browser.webNavigation.onCompleted} event.
 * @see {@link WebRequestApi.deleteFrameContext}
 */
class Frame {
    /**
     * Frame url.
     */
    url;
    /**
     * Main frame url.
     * Used to check if we need to inject script via blob or via script tag. See {@link CosmeticApi.shouldUseBlob}.
     */
    mainFrameUrl;
    /**
     * Tab id.
     */
    tabId;
    /**
     * Frame id.
     */
    frameId;
    /**
     * Frame creation time.
     */
    timeStamp;
    /**
     * Frame rule. Needed in the case of allowlist rules for the tab.
     */
    frameRule;
    /**
     * Parent document id.
     */
    parentDocumentId;
    /**
     * The cosmetic result for the frame.
     * This data is stored in the frame because it is required for logging script and scriptlet rules.
     *
     * @see {@link WebRequestApi.injectCosmetic}
     */
    cosmeticResult;
    /**
     * Prepared cosmetic result for the frame.
     * This data is saved in the frame because it is needed for injecting cosmetic rules into the frames.
     */
    preparedCosmeticResult;
    /**
     * Frame matching result.
     * This data is saved in frame, because we need for access it for script rules injection
     * after deleting request context data.
     */
    matchingResult;
    /**
     * Unique identifier for the frame.
     */
    documentId;
    /**
     * Creates frame instance.
     * @param props Frame constructor properties.
     */
    constructor(props) {
        const { url, tabId, frameId, timeStamp, parentDocumentId, documentId, } = props;
        this.url = url;
        this.tabId = tabId;
        this.frameId = frameId;
        this.timeStamp = timeStamp;
        this.parentDocumentId = parentDocumentId;
        this.documentId = documentId;
    }
}

/**
 * Finds header object by header name (case-insensitive).
 *
 * @param headers Headers collection.
 * @param headerName Header name.
 * @returns Found header, or null if not found.
 */
function findHeaderByName(headers, headerName) {
    const lowerCaseHeaderName = headerName.toLowerCase();
    for (const header of headers) {
        if (header.name.toLowerCase() === lowerCaseHeaderName) {
            return header;
        }
    }
    return null;
}

/**
 * Check if the frame URL is about:blank or about:srcdoc.
 *
 * @param frameUrl Frame URL.
 *
 * @returns True if frame URL is about:blank or about:srcdoc, otherwise false.
 */
const isEmptySrcFrame = (frameUrl) => {
    return frameUrl === 'about:blank'
        || frameUrl === 'about:srcdoc';
};

// TODO: Add 'is' prefix to cssRule, scriptRule and contentRule properties.
/**
 * Types of filtering events that can occur during request processing.
 */
var FilteringEventType;
(function (FilteringEventType) {
    FilteringEventType["SendRequest"] = "sendRequest";
    FilteringEventType["TabReload"] = "tabReload";
    FilteringEventType["ApplyBasicRule"] = "applyBasicRule";
    FilteringEventType["ApplyCosmeticRule"] = "applyCosmeticRule";
    FilteringEventType["ApplyCspRule"] = "applyCspRule";
    FilteringEventType["ApplyPermissionsRule"] = "applyPermissionsRule";
    FilteringEventType["ReceiveResponse"] = "receiveResponse";
    FilteringEventType["Cookie"] = "cookie";
    FilteringEventType["RemoveHeader"] = "removeHeader";
    FilteringEventType["RemoveParam"] = "removeParam";
    FilteringEventType["ReplaceRuleApply"] = "replaceRuleApply";
    FilteringEventType["ContentFilteringStart"] = "contentFilteringStart";
    FilteringEventType["ContentFilteringFinish"] = "contentFilteringFinish";
    FilteringEventType["StealthAction"] = "stealthAction";
    FilteringEventType["StealthAllowlistAction"] = "stealthAllowlistAction";
    FilteringEventType["JsInject"] = "jsInject";
    FilteringEventType["CspReportBlocked"] = "cspReportBlocked";
    /**
     * Used only in unpacked MV3.
     */
    FilteringEventType["MatchedDeclarativeRule"] = "matchedDeclarativeRule";
})(FilteringEventType || (FilteringEventType = {}));
/**
 * {@link FilteringLogInterface} Default implementation.
 */
class FilteringLog {
    onLogEvent = new EventChannel();
    channels = [];
    /**
     * Registers listener for specified {@link FilteringLogEvent}.
     *
     * @param type Filtering log type.
     * @param listener Filtering log listener.
     */
    addEventListener(type, listener) {
        const channel = { type, listener };
        this.channels.push(channel);
    }
    /**
     * Publishes event to attached listeners.
     *
     * @param event Filtering log event.
     */
    publishEvent(event) {
        const listeners = this.channels
            .filter(({ type }) => type === event.type)
            .map(({ listener }) => listener);
        for (const listener of listeners) {
            listener(event);
        }
        this.onLogEvent.dispatch(event);
    }
}
/**
 * Shared {@link FilteringLog} instance.
 */
const defaultFilteringLog = new FilteringLog();

/**
 * Wrapper around a map for frames.
 */
class Frames {
    /**
     * A map where the key is the frame ID and the value is the frame object.
     */
    framesMap = new Map();
    /**
     * Sets frame by id.
     * @param frameId Frame id.
     * @param frame Frame to save.
     */
    set(frameId, frame) {
        this.framesMap.set(frameId, frame);
    }
    /**
     * Returns frame by id.
     * @param frameId Frame id.
     *
     * @returns Frame or undefined if frame not found.
     */
    get(frameId) {
        return this.framesMap.get(frameId);
    }
    /**
     * Clears all frames.
     */
    clear() {
        this.framesMap.clear();
    }
    /**
     * Deletes frame by id.
     * @param frameId Frame id.
     */
    delete(frameId) {
        this.framesMap.delete(frameId);
    }
    /**
     * Returns all frames.
     * @returns Array of frames.
     */
    values() {
        return [...this.framesMap.values()];
    }
}

/**
 * Tab context.
 */
class TabContext {
    info;
    filteringLog;
    /**
     * Frames context.
     *
     * NOTE: this is temporary storage for frames data.
     * Each frame context is deleted after navigation is complete.
     * Storage is cleared on tab reload.
     * Do not use it as a data source out of request or navigation processing.
     */
    frames = new Frames();
    /**
     * Document IDs map.
     * Used to get frame context by document ID.
     */
    documentIdsMap = new Map();
    /**
     * Blocked request count.
     */
    blockedRequestCount = 0;
    /**
     * Document level rule, applied to the tab.
     */
    mainFrameRule = null;
    /**
     * // TODO remove.
     * @deprecated
     * This field is used in the extension, and mv2 version uses it,
     * but it is not used anymore in mv3, so it is deprecated here.
     */
    isSyntheticTab = false;
    /**
     * Timestamp of the assistant initialization.
     *
     * Needed to avoid cosmetic rules injection into the assistant frame.
     *
     * @see {@link https://github.com/AdguardTeam/AdguardBrowserExtension/issues/1848}
     */
    assistantInitTimestamp = null;
    /**
     * Context constructor.
     *
     * @param info Webextension API tab data.
     * @param filteringLog Filtering Log API.
     */
    constructor(info, filteringLog = defaultFilteringLog) {
        this.info = info;
        this.filteringLog = filteringLog;
        this.info = info;
    }
    /**
     * Updates tab info.
     *
     * @param tabInfo Tab info.
     */
    updateTabInfo(tabInfo) {
        this.info = tabInfo;
    }
    /**
     * Updates main frame data.
     *
     * Note: this method will be called on tab reload before the first {@link browser.tabs.onUpdated} event
     * and {@link handleTabUpdate} calls.
     *
     * @param tabId Tab ID.
     * @param url Url.
     */
    updateMainFrameData(tabId, url) {
        this.info.url = url;
        this.info.id = tabId;
    }
    /**
     * Increments blocked requests count.
     */
    incrementBlockedRequestCount() {
        this.blockedRequestCount += 1;
    }
    /**
     * Resets blocked requests count.
     */
    resetBlockedRequestsCount() {
        this.blockedRequestCount = 0;
    }
    /**
     * Creates context for new tab.
     *
     * @param tab Webextension API tab data.
     *
     * @returns Tab context for new tab.
     */
    static createNewTabContext(tab) {
        const tabContext = new TabContext(tab);
        // In some cases, tab is created while browser navigation processing.
        // For example: when you navigate outside the browser or create new empty tab.
        // `pendingUrl` represent url navigated to. We check it first.
        // If server returns redirect, new main frame url will be processed in WebRequestApi.
        const url = tab.pendingUrl || tab.url;
        if (url && isHttpOrWsRequest(url)) {
            tabContext.mainFrameRule = DocumentApi.matchFrame(url);
            tabContext.frames.set(MAIN_FRAME_ID, new Frame({
                tabId: tab.id,
                frameId: MAIN_FRAME_ID,
                url,
                // timestamp is 0, so that it will be recalculated in the next event
                timeStamp: 0,
            }));
        }
        return tabContext;
    }
    /**
     * Checks if passed {@link Tabs.Tab} details represent a browser tab.
     *
     * @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab#type
     * @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/TAB_ID_NONE
     *
     * @param tab Tab details.
     * @returns True if the tab is a browser tab, otherwise returns false.
     */
    static isBrowserTab(tab) {
        return typeof tab.id === 'number' && tab.id !== (webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.TAB_ID_NONE);
    }
    /**
     * Get frame context.
     * @param frameId Frame id.
     * @returns Frame context.
     */
    getFrameContext(frameId) {
        return this.frames.get(frameId);
    }
    /**
     * Set frame context.
     * @param frameId Frame id.
     * @param frameContext Frame context.
     */
    setFrameContext(frameId, frameContext) {
        this.frames.set(frameId, frameContext);
    }
    /**
     * Set document id.
     * @param documentId Unique identifier of the frame.
     * @param frameId Frame id.
     */
    setDocumentId(documentId, frameId) {
        this.documentIdsMap.set(documentId, frameId);
    }
    /**
     * Get frame context by document id.
     * @param documentId Unique identifier of the frame.
     * @returns Frame context.
     */
    getFrameContextByDocumentId(documentId) {
        const frameId = this.documentIdsMap.get(documentId);
        // frameId might be 0, do not use falsy check
        if (frameId !== undefined) {
            return this.frames.get(frameId);
        }
        return undefined;
    }
    /**
     * Deletes the frame context.
     * @param frameId The ID of the frame to delete.
     * @param maxFrameAgeMs The maximum allowed frame age in milliseconds.
     */
    deleteFrameContext(frameId, maxFrameAgeMs) {
        // The main frame should only be deleted when the tab is closed,
        // as it may be needed for sub frames created during the page's lifetime
        // or for retrieving the main frame rule.
        if (frameId === MAIN_FRAME_ID) {
            return;
        }
        const frame = this.frames.get(frameId);
        if (!frame) {
            return;
        }
        // Do not delete frames that are not stale, as they may still be needed.
        if (frame.timeStamp && frame.timeStamp > Date.now() - maxFrameAgeMs) {
            return;
        }
        // Clear the document ID map if the frame has a document ID.
        if (frame.documentId) {
            this.documentIdsMap.delete(frame.documentId);
        }
        this.frames.delete(frameId);
    }
    /**
     * Since document frames are not removed, but rather updated, document IDs can become stale.
     * This method clears stale document IDs.
     */
    clearStaleDocumentIds() {
        const documentIdsLeft = this.frames.values()
            .map((frame) => frame.documentId)
            .filter(identity);
        const documentIdsLeftSet = new Set(documentIdsLeft);
        const documentIds = [...this.documentIdsMap.keys()];
        for (const documentId of documentIds) {
            if (!documentIdsLeftSet.has(documentId)) {
                this.documentIdsMap.delete(documentId);
            }
        }
    }
    /**
     * Clears stale frames.
     * @param maxFrameAgeMs The maximum allowed frame age in milliseconds.
     */
    clearStaleFrames(maxFrameAgeMs) {
        const values = this.frames.values();
        for (const value of values) {
            this.deleteFrameContext(value.frameId, maxFrameAgeMs);
        }
        this.clearStaleDocumentIds();
    }
}

var version$1 = "2.4.0-alpha.11";

var version = "2.0.56";

const TSWEBEXTENSION_VERSION = (/* unused pure expression or super */ null && (version$1));
/**
 * Stealth mode configuration schema.
 */
const stealthConfigValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.object({
    /**
     * Should the application set a fixed lifetime from
     * {@link StealthConfig.selfDestructFirstPartyCookiesTime} for first-party
     * cookies.
     */
    selfDestructFirstPartyCookies: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    /**
     * Time in minutes to delete first-party cookies.
     */
    selfDestructFirstPartyCookiesTime: zod__WEBPACK_IMPORTED_MODULE_3__.z.number(),
    /**
     * Should the application set a fixed lifetime from
     * {@link StealthConfig.selfDestructThirdPartyCookiesTime} for third-party
     * cookies.
     */
    selfDestructThirdPartyCookies: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    /**
     * Time in minutes to delete third-party cookies.
     */
    selfDestructThirdPartyCookiesTime: zod__WEBPACK_IMPORTED_MODULE_3__.z.number(),
    /**
     * Should the application hide the origin referrer in third-party requests
     * by replacing the referrer url with the request url.
     */
    hideReferrer: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    /**
     * Should the application hide the original referrer from the search page
     * containing the search query in third-party queries, replacing
     * the referrer url with the request url.
     */
    hideSearchQueries: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    /**
     * For Google Chrome, it removes the 'X-Client-Data' header from
     * the requests, which contains information about the browser version
     * and modifications.
     */
    blockChromeClientData: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    /**
     * Includes HTTP headers 'DNT' and 'Sec-GPC' in all requests.
     *
     * @see https://en.wikipedia.org/wiki/Do_Not_Track
     * @see https://globalprivacycontrol.org
     */
    sendDoNotTrack: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    /**
     * Blocks the possibility of leaking your IP address through WebRTC, even if
     * you use a proxy server or VPN.
     */
    blockWebRTC: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
}).strict();
/**
 * Filter list configuration validator for MV2.
 */
const basicFilterValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.object({
    /**
     * Filter list text content.
     */
    content: _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .filterListChunksValidator */ .g3,
    /**
     * Source map.
     */
    sourceMap: _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .filterListSourceMapValidator.optional */ .Ff.optional(),
});
/**
 * Settings configuration schema.
 */
const settingsConfigValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.object({
    /**
     * If this flag is true, the application will work ONLY with domains
     * from the {@link Configuration.allowlist},
     * otherwise it will work everywhere EXCLUDING domains from the list.
     */
    allowlistInverted: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    /**
     * Flag specifying {@link Configuration.allowlist} enable state.
     * We don't use allowlist array length condition for calculate enable state,
     * because it's not cover case with empty list in inverted mode.
     */
    allowlistEnabled: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    /**
     * Enables css hits counter if true.
     */
    collectStats: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    /**
     * Enables verbose scriptlets logging if true.
     */
    debugScriptlets: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean().default(false),
    /**
     * Enables stealth mode if true.
     */
    stealthModeEnabled: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    /**
     * Enables filtering if true.
     */
    filteringEnabled: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    /**
     * Redirect url for $document rules.
     */
    documentBlockingPageUrl: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().optional(),
    /**
     * Path to the assembled @adguard/assistant module. Necessary for lazy
     * on-demand loading of the assistant.
     */
    assistantUrl: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    /**
     * Stealth mode options.
     */
    stealth: stealthConfigValidator,
});
/**
 * Generic app configuration schema.
 */
const configurationValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.object({
    /**
     * List of hostnames or domains of sites, which should be excluded
     * from blocking or which should be included in blocking
     * depending on the value of {@link SettingsConfig.allowlistInverted} setting value.
     */
    allowlist: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().array(),
    /**
     * List of rules added by user.
     */
    userrules: basicFilterValidator,
    /**
     * Flag responsible for logging.
     *
     * @deprecated  Will be removed in the next minor version.
     * Use {@link Configuration.logLevel} instead.
     */
    verbose: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean().optional(),
    /**
     * Logging level.
     */
    logLevel: zod__WEBPACK_IMPORTED_MODULE_3__.z["enum"]([
        LogLevel.Error,
        LogLevel.Warn,
        LogLevel.Info,
        LogLevel.Debug,
        LogLevel.Trace,
    ]).optional(),
    settings: settingsConfigValidator,
}).strict();

/**
 * @file
 * This file contains validation schemas and inferred types for message data.
 */
/**
 * Message DTO validation schema.
 */
const messageValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.object({
    handlerName: zod__WEBPACK_IMPORTED_MODULE_3__.z.literal(MESSAGE_HANDLER_NAME),
    type: zod__WEBPACK_IMPORTED_MODULE_3__.z.nativeEnum(MessageType),
    payload: zod__WEBPACK_IMPORTED_MODULE_3__.z.unknown(),
}).strict();
/**
 * {@link MessageType.ProcessShouldCollapse} Message payload validation schema.
 */
zod__WEBPACK_IMPORTED_MODULE_3__.z.object({
    elementUrl: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    documentUrl: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    requestType: zod__WEBPACK_IMPORTED_MODULE_3__.z.nativeEnum(_adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .RequestType */ .xd),
}).strict();
/**
 * {@link MessageType.GetCosmeticData} Message payload validation schema.
 */
zod__WEBPACK_IMPORTED_MODULE_3__.z.object({
    documentUrl: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
}).strict();
/**
 * {@link MessageType.GetCosmeticData} Message payload validation schema.
 */
const getCosmeticDataPayloadValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.object({
    documentUrl: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
}).strict();
/**
 * {@link MessageType.GetCookieRules} Message payload validation schema.
 */
const getCookieRulesPayloadValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.object({
    documentUrl: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
}).strict();
/**
 * {@link MessageType.SaveCookieLogEvent} Message payload validation schema.
 */
const getSaveCookieLogEventPayloadValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.object({
    cookieName: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    cookieDomain: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    cookieValue: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    filterId: zod__WEBPACK_IMPORTED_MODULE_3__.z.number(),
    ruleIndex: zod__WEBPACK_IMPORTED_MODULE_3__.z.number(),
    thirdParty: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    isAllowlist: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    isImportant: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    isDocumentLevel: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    isCsp: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    isCookie: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    advancedModifier: zod__WEBPACK_IMPORTED_MODULE_3__.z.string().nullable(),
}).strict();
/**
 * {@link MessageType.InitAssistant} Message payload validation schema.
 */
const getAssistantCreateRulePayloadValidator = zod__WEBPACK_IMPORTED_MODULE_3__.z.object({
    ruleText: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
}).strict();

var RequestType = {
    NotSet: 0,
    Document: 1,
    SubDocument: 2,
    Script: 4,
    Stylesheet: 8,
    Object: 16,
    Image: 32,
    XmlHttpRequest: 64,
    Media: 128,
    Font: 256,
    WebSocket: 512,
    Ping: 1024,
    CspReport: 2048,
    Other: 4096,
};

/**
 * Request content type.
 *
 * NOTE: Do not use `const enum`,
 * because this enum is imported in extension frontend writing in js.
 */
var ContentType;
(function (ContentType) {
    ContentType["Document"] = "document";
    ContentType["Subdocument"] = "subdocument";
    ContentType["Script"] = "script";
    ContentType["Stylesheet"] = "stylesheet";
    ContentType["Object"] = "object";
    ContentType["Image"] = "image";
    ContentType["XmlHttpRequest"] = "xmlHttpRequest";
    ContentType["Media"] = "media";
    ContentType["Font"] = "font";
    ContentType["Websocket"] = "websocket";
    ContentType["WebRtc"] = "webRtc";
    ContentType["Other"] = "other";
    ContentType["Csp"] = "csp";
    ContentType["PermissionsPolicy"] = "permissionsPolicy";
    ContentType["Cookie"] = "cookie";
    ContentType["Ping"] = "ping";
    ContentType["CspReport"] = "cspReport";
})(ContentType || (ContentType = {}));
/**
 * Returns request type and content type by resource type.
 *
 * @param resourceType Resource type.
 * @returns Request type and content type.
 */
function getRequestType(resourceType) {
    switch (resourceType) {
        case 'main_frame':
            return {
                contentType: ContentType.Document,
                requestType: RequestType.Document,
            };
        case 'sub_frame':
            return {
                contentType: ContentType.Subdocument,
                requestType: RequestType.SubDocument,
            };
        case 'stylesheet':
            return {
                contentType: ContentType.Stylesheet,
                requestType: RequestType.Stylesheet,
            };
        case 'script':
            return {
                contentType: ContentType.Script,
                requestType: RequestType.Script,
            };
        case 'image':
        case 'imageset':
            return {
                contentType: ContentType.Image,
                requestType: RequestType.Image,
            };
        case 'object':
            return {
                contentType: ContentType.Object,
                requestType: RequestType.Object,
            };
        case 'xmlhttprequest':
            return {
                contentType: ContentType.XmlHttpRequest,
                requestType: RequestType.XmlHttpRequest,
            };
        case 'ping':
        case 'beacon':
            return {
                contentType: ContentType.Ping,
                requestType: RequestType.Ping,
            };
        case 'font':
            return {
                contentType: ContentType.Font,
                requestType: RequestType.Font,
            };
        case 'media':
            return {
                contentType: ContentType.Media,
                requestType: RequestType.Media,
            };
        case 'websocket':
            return {
                contentType: ContentType.Websocket,
                requestType: RequestType.WebSocket,
            };
        case 'csp_report':
            return {
                contentType: ContentType.CspReport,
                requestType: RequestType.CspReport,
            };
        default:
            return {
                contentType: ContentType.Other,
                requestType: RequestType.Other,
            };
    }
}

/**
 * TabsApi works with {@link browser.tabs} to record tabs' URLs - they are
 * needed for work domain-specific blocking/allowing cosmetic rules.
 */
class TabsApi {
    context = new Map();
    onCreate = new EventChannel();
    onUpdate = new EventChannel();
    onDelete = new EventChannel();
    onActivate = new EventChannel();
    onReplace = new EventChannel();
    /**
     * Creates new {@link TabsApi} with binding context.
     */
    constructor() {
        this.handleTabCreate = this.handleTabCreate.bind(this);
        this.handleTabUpdate = this.handleTabUpdate.bind(this);
        this.handleTabActivate = this.handleTabActivate.bind(this);
        this.handleTabDelete = this.handleTabDelete.bind(this);
        this.handleTabReplace = this.handleTabReplace.bind(this);
        this.onWindowFocusChanged = this.onWindowFocusChanged.bind(this);
        this.getTabContext = this.getTabContext.bind(this);
        this.getTabFrameRule = this.getTabFrameRule.bind(this);
        this.getTabFrame = this.getTabFrame.bind(this);
        this.getTabMainFrame = this.getTabMainFrame.bind(this);
        this.getMainFrameUrl = this.getMainFrameUrl.bind(this);
    }
    /**
     * Starts recording the main frame URLs for the tabs.
     */
    async start() {
        webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.onCreated.addListener(this.handleTabCreate);
        webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.onRemoved.addListener(this.handleTabDelete);
        webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.onUpdated.addListener(this.handleTabUpdate);
        webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.onActivated.addListener(this.handleTabActivate);
        webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.onReplaced.addListener(this.handleTabReplace);
        // Firefox for android doesn't support windows API
        // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows#chrome_compatibility
        if ((webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().windows)) {
            webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().windows.onFocusChanged.addListener(this.onWindowFocusChanged);
        }
    }
    /**
     * Stops recording the main frame URLs for the tabs.
     */
    stop() {
        webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.onCreated.removeListener(this.handleTabCreate);
        webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.onRemoved.removeListener(this.handleTabDelete);
        webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.onUpdated.removeListener(this.handleTabUpdate);
        webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.onActivated.removeListener(this.handleTabActivate);
        webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.onReplaced.removeListener(this.handleTabReplace);
        // Firefox for android doesn't support windows API
        if ((webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().windows)) {
            webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().windows.onFocusChanged.removeListener(this.onWindowFocusChanged);
        }
        this.context.clear();
    }
    /**
     * Creates a new tab context.
     *
     * @param tab Tab info.
     * @param tab.id Tab id.
     *
     * @returns Created tab context, or null if tab is not browser tab.
     */
    handleTabCreate(tab) {
        if (!TabContext.isBrowserTab(tab)) {
            return null;
        }
        const tabContext = TabContext.createNewTabContext(tab);
        this.context.set(tab.id, tabContext);
        this.onCreate.dispatch(tabContext);
        return tabContext;
    }
    /**
     * Removes tab context by tab ID.
     *
     * @param tabId Tab ID.
     */
    handleTabDelete(tabId) {
        const tabContext = this.context.get(tabId);
        if (!tabContext) {
            return;
        }
        this.context.delete(tabId);
        this.onDelete.dispatch(tabContext);
    }
    /**
     * Updates tab context data on tab update.
     *
     * If the tab context is not found, creates a new tab context.
     *
     * @param tabId Tab ID.
     * @param changeInfo Tab change info.
     * @param tabInfo Tab info.
     */
    handleTabUpdate(tabId, changeInfo, tabInfo) {
        if (!TabContext.isBrowserTab(tabInfo)) {
            return;
        }
        // Skip updates for non-http requests.
        if (changeInfo.url && !isHttpRequest(changeInfo.url)) {
            return;
        }
        // TODO: we can ignore some events (favicon url update etc.)
        const tabContext = this.context.get(tabId);
        if (!tabContext) {
            return;
        }
        tabContext.updateTabInfo(tabInfo);
        this.onUpdate.dispatch(tabContext);
    }
    /**
     * Dispatches tab on activated event.
     * @param tab Tab info.
     */
    handleTabActivate(tab) {
        const tabContext = this.context.get(tab.tabId);
        if (!tabContext) {
            return;
        }
        this.onActivate.dispatch(tabContext);
    }
    /**
     * The browser tab may be replaced by another when the discarded tab wakes up.
     * We handle this case on {@link browser.tabs.onReplaced} event.
     * It fires before the tab details are updated,
     * so we just move the existing tab context to the new key.
     *
     * @param addedTabId - Id of the new tab context moved to.
     * @param removedTabId - Id of removed tab.
     */
    handleTabReplace(addedTabId, removedTabId) {
        const tabContext = this.context.get(removedTabId);
        if (!tabContext) {
            return;
        }
        this.context.delete(removedTabId);
        this.context.set(addedTabId, tabContext);
        this.onReplace.dispatch(tabContext);
    }
    /**
     * Called when focus state of window changed.
     *
     * @param windowId Window ID.
     */
    async onWindowFocusChanged(windowId) {
        // If all browser windows have lost focus.
        if (windowId === (webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().windows.WINDOW_ID_NONE)) {
            return;
        }
        const [activeTab] = await webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.query({
            active: true,
            windowId,
        });
        if (!activeTab || !activeTab.id) {
            return;
        }
        const tabContext = this.context.get(activeTab.id);
        if (!tabContext) {
            return;
        }
        this.onActivate.dispatch(tabContext);
    }
    /**
     * Retrieves frame data for the frame in the tab context.
     *
     * @param tabId Tab ID.
     * @param frameId Frame ID.
     * @returns Frame data or null if not found.
     */
    getTabFrame(tabId, frameId) {
        const tabContext = this.context.get(tabId);
        if (!tabContext) {
            return null;
        }
        const frame = tabContext.frames.get(frameId);
        if (!frame) {
            return null;
        }
        return frame;
    }
    /**
     * Retrieves main frame data for the tab context.
     *
     * @param tabId Tab ID.
     * @returns Frame data or null if not found.
     */
    getTabMainFrame(tabId) {
        return this.getTabFrame(tabId, MAIN_FRAME_ID);
    }
    /**
     * Returns main frame URL for provided tab ID.
     *
     * @param tabId Tab ID.
     *
     * @returns Main frame URL for provided tab ID.
     */
    getMainFrameUrl(tabId) {
        return this.getTabMainFrame(tabId)?.url;
    }
    /**
     * Retrieves tab context by tab ID.
     *
     * @param tabId Tab ID.
     * @returns Tab context or undefined if not found.
     */
    getTabContext(tabId) {
        return this.context.get(tabId);
    }
    /**
     * Retrieves frame rule for the tab context.
     *
     * @param tabId Tab ID.
     * @returns Frame rule or null if not found.
     */
    getTabFrameRule(tabId) {
        const tabContext = this.context.get(tabId);
        if (!tabContext) {
            return null;
        }
        return tabContext.mainFrameRule;
    }
    /**
     * Updates tab's main frame rule.
     *
     * @param tabId Tab ID.
     */
    updateTabMainFrameRule(tabId) {
        const tabContext = this.context.get(tabId);
        if (!tabContext?.info.url || !isHttpOrWsRequest(tabContext.info.url)) {
            return;
        }
        tabContext.mainFrameRule = DocumentApi.matchFrame(tabContext.info.url);
    }
    /**
     * Updates tab context data after filter engine load.
     */
    async updateCurrentTabsMainFrameRules() {
        const currentTabs = await webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().tabs.query({});
        if (!Array.isArray(currentTabs)) {
            return;
        }
        for (const tab of currentTabs) {
            if (typeof tab.id === 'number') {
                this.updateTabMainFrameRule(tab.id);
            }
        }
    }
    /**
     * Checks if tab is a new tab.
     *
     * TODO: Change in AG-22715: if the lifetime of the tab is less than N
     * seconds (for example 5 seconds), then it is a popup and we close it. If
     * the opposite is true, then we block it with a stub.
     *
     * @param tabId Tab ID.
     * @returns True if tab is a new tab.
     */
    isNewPopupTab(tabId) {
        const tab = this.context.get(tabId);
        if (!tab) {
            return false;
        }
        const url = tab.info?.url;
        return url === undefined
            || url === ''
            || url === 'about:blank';
    }
    /**
     * Increments tab context blocked request count.
     *
     * @param tabId Tab ID.
     * @param referrerUrl Request initiator url.
     */
    incrementTabBlockedRequestCount(tabId, referrerUrl) {
        const tabContext = this.context.get(tabId);
        if (!tabContext) {
            return;
        }
        const tabUrl = tabContext.info?.url;
        /**
         * Only increment count for requests that are initiated from the same domain as the tab.
         *
         * This prevents count 'leaks' when moving between main frames due to async nature of
         * {@link browser.webRequest.onBeforeRequest} and {@link browser.tabs.onUpdated} events.
         */
        if (!tabUrl || !referrerUrl || getDomain(tabUrl) !== getDomain(referrerUrl)) {
            return;
        }
        tabContext.incrementBlockedRequestCount();
    }
    /**
     * Checks whether the tab with the specified ID is open in incognito mode
     * or not.
     *
     * @param tabId Tab ID.
     * @returns True if the tab is open in incognito mode, and false
     * if otherwise.
     */
    isIncognitoTab(tabId) {
        const tabContext = this.getTabContext(tabId);
        if (!tabContext) {
            return false;
        }
        return tabContext.info.incognito;
    }
    /**
     * Updates the frame context with additional data.
     *
     * @param tabId The ID of the tab.
     * @param frameId The ID of the frame.
     * @param partialFrameContext The details to be added to the frame context.
     *
     * @throws Error if the tab context or frame context is not found, as this should not occur at this point.
     */
    updateFrameContext(tabId, frameId, partialFrameContext) {
        const tabContext = this.getTabContext(tabId);
        if (!tabContext) {
            logger.debug('At this point tab context should already exist');
            return;
        }
        if (frameId === MAIN_FRAME_ID && partialFrameContext.frameRule) {
            tabContext.mainFrameRule = partialFrameContext.frameRule;
        }
        const frameContext = tabContext?.getFrameContext(frameId);
        if (!frameContext) {
            logger.debug('At this point frame context should already exist');
            return;
        }
        Object.assign(frameContext, partialFrameContext);
        if (frameContext.documentId) {
            tabContext.setDocumentId(frameContext.documentId, frameId);
        }
    }
    /**
     * Sets frame context.
     * @param tabId Tab ID.
     * @param frameId Frame ID.
     * @param frameContext Frame context.
     *
     * @throws Error if the tab context is not found, as this should not occur at this point.
     */
    setFrameContext(tabId, frameId, frameContext) {
        const tabContext = this.getTabContext(tabId);
        if (!tabContext) {
            logger.debug('At this point tab context should already exist');
            return;
        }
        tabContext.setFrameContext(frameId, frameContext);
    }
    /**
     * Returns frame context by tabId and frameId.
     * @param tabId Tab ID.
     * @param frameId Frame ID.
     * @returns Frame context.
     */
    getFrameContext(tabId, frameId) {
        const tabContext = this.getTabContext(tabId);
        const frameContext = tabContext?.getFrameContext(frameId);
        return frameContext;
    }
    /**
     * Returns frame context by documentId.
     * @param tabId Tab ID.
     * @param documentId Unique identifier assigned to the frame on onCommited event.
     *
     * @returns Frame context.
     */
    getByDocumentId(tabId, documentId) {
        const tabContext = this.getTabContext(tabId);
        return tabContext?.getFrameContextByDocumentId(documentId);
    }
    /**
     * Deletes the frame context.
     * Also clears frames older than the specified maxFrameAgeMs.
     *
     * @param tabId The ID of the tab.
     * @param frameId The ID of the frame.
     * @param maxFrameAgeMs The maximum allowed age for frames, in milliseconds.
     */
    deleteFrameContext(tabId, frameId, maxFrameAgeMs) {
        const tabContext = this.getTabContext(tabId);
        if (!tabContext) {
            return;
        }
        tabContext.deleteFrameContext(frameId, maxFrameAgeMs);
        tabContext.clearStaleFrames(maxFrameAgeMs);
    }
    /**
     * Resets blocked requests count for the tab.
     * @param tabId Tab ID.
     */
    resetBlockedRequestsCount(tabId) {
        const tabContext = this.getTabContext(tabId);
        if (!tabContext) {
            return;
        }
        tabContext.resetBlockedRequestsCount();
    }
}
const tabsApi = new TabsApi();

/**
 * Checks if iframe has same source as main frame or if src is about:blank, javascript:, etc.
 * We don't include frames with 'src=data:' because Chrome and Firefox
 * do not allow data to be injected into frames with this type of src,
 * this bug is reported here https://bugs.chromium.org/p/chromium/issues/detail?id=55084.
 *
 * @param frameUrl Frame url.
 * @param frameId Unique id of frame in the tab.
 * @param mainFrameUrl Url of tab where iframe exists.
 * @returns True if frame without src, else returns false.
 */
function isLocalFrame(frameUrl, frameId, mainFrameUrl) {
    return frameId !== MAIN_FRAME_ID
        && (frameUrl === mainFrameUrl
            || isEmptySrcFrame(frameUrl)
            // eslint-disable-next-line no-script-url
            || frameUrl.indexOf('javascript:') > -1);
}

/**
 * Creates match query for frame based on content script data and background tab context.
 * Used in {@link CosmeticApi} and {@link CookieFiltering} to match rules for content scripts.
 * @param frameUrl Frame url. Received from content script.
 * @param frameId Frame id. Received from content script.
 * @param tabContext Tab context. Received from background script.
 * @returns Match query for {@link EngineApi}.
 * @throws Error if tab context url is not defined.
 */
function createFrameMatchQuery(frameUrl, frameId, tabContext) {
    const { info } = tabContext;
    if (!info.url) {
        throw new Error('Tab url is required');
    }
    const mainFrameUrl = info.url;
    const isLocal = isLocalFrame(frameUrl, frameId, mainFrameUrl);
    const requestUrl = isLocal ? mainFrameUrl : frameUrl;
    let requestType;
    // if frame is Local, then apply main frame rules.
    if (isLocal) {
        requestType = RequestType.Document;
    }
    else if (frameId === MAIN_FRAME_ID) {
        requestType = RequestType.Document;
    }
    else {
        requestType = RequestType.SubDocument;
    }
    return {
        requestUrl,
        frameUrl: requestUrl,
        requestType,
        frameRule: tabContext.mainFrameRule,
    };
}

/**
 * CosmeticApiCommon contains common logic about building css for hiding elements.
 */
class CosmeticApiCommon {
    static LINE_BREAK = (/* unused pure expression or super */ null && ('\r\n'));
    /**
     * Number of selectors in grouped selector list.
     */
    static CSS_SELECTORS_PER_LINE = (/* unused pure expression or super */ null && (50));
    /**
     * Builds stylesheets from rules.
     * If `groupElemhideSelectors` is set,
     * element hiding selector are to be combined into selector lists of {@link CosmeticApi.CSS_SELECTORS_PER_LINE}.
     *
     * @param elemhideRules List of elemhide rules.
     * @param injectRules List of inject css rules.
     * @param groupElemhideSelectors Flag for elemhide selectors grouping.
     *
     * @returns List of stylesheet expressions.
     */
    static buildStyleSheets(elemhideRules, injectRules, groupElemhideSelectors) {
        const styles = [];
        const elemHideStyles = CosmeticApiCommon.buildElemhideStyles(elemhideRules, groupElemhideSelectors);
        if (elemHideStyles.length > 0) {
            if (groupElemhideSelectors) {
                styles.push(elemHideStyles.join(CosmeticApiCommon.LINE_BREAK));
            }
            else {
                styles.push(...elemHideStyles);
            }
        }
        const cssStyles = injectRules.map((x) => x.getContent());
        if (cssStyles.length > 0) {
            if (groupElemhideSelectors) {
                styles.push(cssStyles.join(CosmeticApiCommon.LINE_BREAK));
            }
            else {
                styles.push(...cssStyles);
            }
        }
        return styles;
    }
    /**
     * Builds element hiding stylesheet from rules.
     * If `groupElemhideSelectors` is set,
     * selector are to be combined into selector lists of {@link CosmeticApi.CSS_SELECTORS_PER_LINE}.
     *
     * @param elemhideRules List of elemhide rules.
     * @param groupElemhideSelectors Flag for elemhide selectors grouping.
     *
     * @returns Array of styles.
     */
    static buildElemhideStyles(elemhideRules, groupElemhideSelectors) {
        // TODO: refactor constants as ELEMHIDE_CSS_STYLE and ELEMHIDE_HIT_START are duplicates partly
        const ELEMHIDE_CSS_STYLE = ' { display: none !important; }';
        const elemhideSelectors = [];
        for (const selector of elemhideRules) {
            elemhideSelectors.push(selector.getContent());
        }
        // if selector should not be grouped,
        // add element hiding style to each of them
        if (!groupElemhideSelectors) {
            return elemhideSelectors.map((selector) => {
                return `${selector}${ELEMHIDE_CSS_STYLE}`;
            });
        }
        // otherwise selectors should be grouped into selector lists
        const elemhideStyles = [];
        for (let i = 0; i < elemhideSelectors.length; i += CosmeticApiCommon.CSS_SELECTORS_PER_LINE) {
            const selectorList = elemhideSelectors
                .slice(i, i + CosmeticApiCommon.CSS_SELECTORS_PER_LINE)
                .join(', ');
            elemhideStyles.push(`${selectorList}${ELEMHIDE_CSS_STYLE}`);
        }
        return elemhideStyles;
    }
}

/**
 * This class is wrapping around chrome.scripting API.
 */
class ScriptingApi {
    /**
     * Injects CSS into a tab.
     *
     * @param params Parameters for applying CSS rules.
     * @param params.tabId Tab id.
     * @param params.frameId Frame id.
     * @param params.cssText CSS text.
     * @returns Promise that resolves when the CSS is injected.
     */
    static async insertCSS({ tabId, frameId, cssText }) {
        if (tabId === BACKGROUND_TAB_ID) {
            return;
        }
        await chrome.scripting.insertCSS({
            css: cssText,
            origin: 'USER',
            target: { tabId, frameIds: [frameId] },
        });
    }
    /**
     * Executes a scriptlet within the scope of the page.
     *
     * @param params Parameters for executing the scriptlet.
     * @param params.tabId The ID of the tab.
     * @param params.frameId The ID of the frame.
     * @param params.scriptletData The scriptlet data to be executed.
     * @param params.domainName The domain name of the frame. Used for debugging.
     * @returns Promise that resolves when the script is executed.
     */
    static async executeScriptlet({ tabId, frameId, scriptletData, domainName, }) {
        // There is no reason to inject a script into the background page
        if (tabId === BACKGROUND_TAB_ID) {
            return;
        }
        const params = {
            ...scriptletData.params,
            uniqueId: String(appContext.startTimeMs),
            verbose: appContext.configuration?.settings.debugScriptlets || false,
            domainName: domainName ?? undefined,
        };
        await chrome.scripting.executeScript({
            target: { tabId, frameIds: [frameId] },
            func: scriptletData.func,
            injectImmediately: true,
            world: 'MAIN',
            args: [params, scriptletData.params.args],
        });
    }
    /**
     * Executes a script within the scope of the page.
     *
     * @param params Parameters for executing the script.
     * @param params.tabId The ID of the tab.
     * @param params.frameId The ID of the frame.
     * @param params.scriptFunction The script function to be executed.
     *
     * @returns Promise that resolves when the script is executed.
     */
    static async executeScriptFunc({ tabId, frameId, scriptFunction, }) {
        // There is no reason to inject a script into the background page
        if (tabId === BACKGROUND_TAB_ID) {
            return;
        }
        /**
         * It is possible to follow all places using this logic by searching JS_RULES_EXECUTION.
         *
         * This is STEP 4.2: Apply JS functions from pre-built filters — via chrome.scripting API.
         */
        await chrome.scripting.executeScript({
            target: { tabId, frameIds: [frameId] },
            func: scriptFunction,
            injectImmediately: true,
            world: 'MAIN',
        });
    }
}

let urlAlphabet =
  'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
let nanoid = (size = 21) => {
  let id = '';
  let i = size;
  while (i--) {
    id += urlAlphabet[(Math.random() * 64) | 0];
  }
  return id
};

/**
 * It is possible to follow all places using this logic by searching JS_RULES_EXECUTION.
 *
 * Due to Chrome Web Store policies, we cannot execute remotely hosted code.
 * Therefore, we use the following approach:
 *
 * 1. We bundle AdGuard’s JS rules into a local file included with the extension.
 * 2. At runtime, we verify each JS rule to see if it's included in our local bundle.
 *    If it is, we allow it to run; otherwise, we discard it.
 */
class LocalScriptRulesService {
    /**
     * When {@link setLocalScriptRules} is called, this holds a list of prebuilt JS rules
     * allowed to run. If it is never called, this remains undefined.
     */
    localScripts;
    /**
     * Stores prebuilt JS rules in memory for later use.
     *
     * @param localScriptRules A map of script text to their corresponding functions.
     */
    setLocalScriptRules(localScriptRules) {
        this.localScripts = localScriptRules;
    }
    /**
     * Checks if the given script text is included in our prebuilt local scripts.
     *
     * This helper method is primarily for transparency during the Chrome Web Store review process.
     *
     * @param scriptText The script rule to verify.
     *
     * @returns True if the script is part of our local collection, false otherwise.
     */
    isLocalScript(scriptText) {
        if (this.localScripts === undefined) {
            return false;
        }
        return this.localScripts[scriptText] !== undefined;
    }
    /**
     * Retrieves the function associated with the specified script text
     * from our local scripts collection.
     *
     * @param scriptText The script content to look up.
     * @returns The corresponding function if found, or null otherwise.
     */
    getLocalScriptFunction(scriptText) {
        if (this.localScripts === undefined) {
            return null;
        }
        const scriptFunc = this.localScripts[scriptText];
        return scriptFunc !== undefined ? scriptFunc : null;
    }
}
const localScriptRulesService = new LocalScriptRulesService();

/**
 * Cosmetic api class.
 * Used to prepare and inject javascript and css into pages.
 */
class CosmeticApi extends (/* unused pure expression or super */ null && (CosmeticApiCommon)) {
    static ELEMHIDE_HIT_START = (/* unused pure expression or super */ null && (" { display: none !important; content: 'adguard"));
    static INJECT_HIT_START = (/* unused pure expression or super */ null && (" content: 'adguard"));
    static HIT_SEP = encodeURIComponent(';');
    static HIT_END = (/* unused pure expression or super */ null && ("' !important; }"));
    /**
     * Blob injection urls.
     */
    static BLOB_INJECTION_URLS = new Set([
        'facebook.com',
        'open.spotify.com',
    ]);
    /**
     * Retrieves CSS styles from the cosmetic result.
     *
     * @param cosmeticResult Cosmetic result.
     * @returns Css styles as string, or `undefined` if no styles found.
     */
    static getCssText(cosmeticResult) {
        const { configuration } = appContext;
        const collectingCosmeticRulesHits = configuration?.settings.collectStats || false;
        const { elementHiding, CSS } = cosmeticResult;
        const elemhideCss = elementHiding.generic.concat(elementHiding.specific);
        const injectCss = CSS.generic.concat(CSS.specific);
        let styles;
        if (collectingCosmeticRulesHits) {
            styles = CosmeticApi.buildStyleSheetsWithHits(elemhideCss, injectCss);
        }
        else {
            styles = CosmeticApi.buildStyleSheets(elemhideCss, injectCss, true);
        }
        if (styles.length > 0) {
            return styles.join(CosmeticApi.LINE_BREAK);
        }
        return undefined;
    }
    /**
     * Builds extended css rules from cosmetic result.
     *
     * @param cosmeticResult Cosmetic result.
     * @param collectingCosmeticRulesHits Flag to collect cosmetic rules hits.
     * @returns Array of extended css rules or null.
     */
    static getExtCssRules(cosmeticResult, collectingCosmeticRulesHits = false) {
        const { elementHiding, CSS } = cosmeticResult;
        const elemhideExtCss = elementHiding.genericExtCss.concat(elementHiding.specificExtCss);
        const injectExtCss = CSS.genericExtCss.concat(CSS.specificExtCss);
        let extCssRules;
        if (collectingCosmeticRulesHits) {
            extCssRules = CosmeticApi.buildStyleSheetsWithHits(elemhideExtCss, injectExtCss);
        }
        else {
            extCssRules = CosmeticApi.buildStyleSheets(elemhideExtCss, injectExtCss, false);
        }
        return extCssRules.length > 0
            ? extCssRules
            : null;
    }
    /**
     * Wraps the given JavaScript code in a self-invoking function for safe execution
     * and appends a source URL comment for debugging purposes.
     *
     * @param scriptText The JavaScript code to wrap.
     * @returns The wrapped script code, or an empty string if the input is falsy.
     */
    static wrapScriptText(scriptText) {
        if (!scriptText) {
            return '';
        }
        // The "//# sourceURL=ag-scripts.js" line is necessary to ensure the script always has the same URL,
        // making it possible to debug consistently.
        return `
        (function () {
            try {
                ${scriptText}
            } catch (ex) {
                console.error('Error executing AG js: ' + ex);
            }
        })();
        //# sourceURL=ag-scripts.js
        `;
    }
    /**
     * It is possible to follow all places using this logic by searching JS_RULES_EXECUTION.
     *
     * This is STEP 3: All previously matched script rules are processed and filtered:
     * - JS and Scriptlet rules from pre-built filters (previously collected, pre-built and passed to the engine)
     *   are going to be executed as functions via chrome.scripting API.
     */
    /**
     * Generates data for scriptlets and local scripts:
     * - functions for scriptlets,
     * - script texts for JS rules from pre-built filters.
     *
     * @param cosmeticResult Object containing cosmetic rules.
     *
     * @returns An object with data for scriptlets and script texts.
     */
    static getScriptsAndScriptletsData(cosmeticResult) {
        const rules = cosmeticResult.getScriptRules();
        if (rules.length === 0) {
            return {
                scriptTexts: [],
                scriptletDataList: [],
            };
        }
        const uniqueScriptTexts = new Set();
        const scriptletDataList = [];
        for (let i = 0; i < rules.length; i += 1) {
            const rule = rules[i];
            if (rule.isScriptlet) {
                const scriptletData = rule.getScriptletData();
                if (scriptletData) {
                    scriptletDataList.push(scriptletData);
                }
            }
            else {
                // TODO: Optimize script injection by checking if common scripts (e.g., AG_)
                //  are actually used in the rules. If not, avoid injecting them to reduce overhead.
                const ruleScriptText = rule.getContent();
                if (ruleScriptText) {
                    uniqueScriptTexts.add(ruleScriptText);
                }
            }
        }
        return {
            scriptTexts: [...uniqueScriptTexts],
            scriptletDataList,
        };
    }
    /**
     * Returns content script data for applying cosmetic.
     *
     * @param frameUrl Frame url.
     * @param tabId Tab id.
     * @param frameId Frame id.
     * @returns Content script data for applying cosmetic.
     */
    static getContentScriptData(frameUrl, tabId, frameId) {
        const { isStorageInitialized } = appContext;
        const data = {
            isAppStarted: false,
            areHitsStatsCollected: false,
            extCssRules: null,
        };
        // if storage is not initialized, then app is not ready yet.
        if (!isStorageInitialized) {
            return data;
        }
        const { isAppStarted, configuration } = appContext;
        const areHitsStatsCollected = configuration?.settings.collectStats || false;
        data.isAppStarted = isAppStarted;
        data.areHitsStatsCollected = areHitsStatsCollected;
        const tabContext = tabsApi.getTabContext(tabId);
        if (!tabContext?.info.url) {
            return data;
        }
        const matchQuery = createFrameMatchQuery(frameUrl, frameId, tabContext);
        const cosmeticResult = engineApi.matchCosmetic(matchQuery);
        data.extCssRules = CosmeticApi.getExtCssRules(cosmeticResult, areHitsStatsCollected);
        return data;
    }
    /**
     * Injects js to specified tab and frame.
     *
     * @param tabId Tab id.
     * @param frameId Frame id.
     */
    static async applyJsFuncsByTabAndFrame(tabId, frameId) {
        const frameContext = tabsApi.getFrameContext(tabId, frameId);
        if (!frameContext) {
            return;
        }
        const scriptTexts = frameContext.preparedCosmeticResult?.scriptTexts;
        if (!scriptTexts || scriptTexts.length === 0) {
            return;
        }
        try {
            await Promise.all(scriptTexts.map((scriptText) => {
                /**
                 * It is possible to follow all places using this logic by searching JS_RULES_EXECUTION.
                 *
                 * This is STEP 4.1: Selecting only local script functions which were pre-built into the extension.
                 */
                /**
                 * Here we check if the script text is local to guarantee that we do not execute remote code.
                 */
                const isLocalScript = localScriptRulesService.isLocalScript(scriptText);
                if (!isLocalScript) {
                    return;
                }
                /**
                 * Here we get the function associated with the script text.
                 */
                const localScriptFunction = localScriptRulesService.getLocalScriptFunction(scriptText);
                if (!localScriptFunction) {
                    return;
                }
                // eslint-disable-next-line consistent-return
                return ScriptingApi.executeScriptFunc({
                    tabId,
                    frameId,
                    scriptFunction: localScriptFunction,
                });
            }));
        }
        catch (e) {
            logger.debug('[applyJsFuncsByTabAndFrame] error occurred during injection', getErrorMessage(e));
        }
    }
    /**
     * Injects js to specified tab and frame.
     *
     * @param tabId Tab id.
     * @param frameId Frame id.
     */
    static async applyScriptletsByTabAndFrame(tabId, frameId) {
        const frameContext = tabsApi.getFrameContext(tabId, frameId);
        if (!frameContext) {
            return;
        }
        const scriptletDataList = frameContext.preparedCosmeticResult?.scriptletDataList;
        if (!scriptletDataList) {
            return;
        }
        try {
            await Promise.all(scriptletDataList.map((scriptletData) => {
                // eslint-disable-next-line consistent-return
                return ScriptingApi.executeScriptlet({
                    tabId,
                    frameId,
                    scriptletData,
                    domainName: getDomain(frameContext.url),
                });
            }));
        }
        catch (e) {
            // TODO: getErrorMessage may not be needed since logger should handle arg types
            logger.debug('[applyScriptletsByTabAndFrame] error occurred during injection', getErrorMessage(e));
        }
    }
    /**
     * Injects css to specified tab id and frame id.
     *
     * @param tabId Tab id.
     * @param frameId Frame id.
     */
    static async applyCssByTabAndFrame(tabId, frameId) {
        const requestContext = tabsApi.getFrameContext(tabId, frameId);
        const cssText = requestContext?.preparedCosmeticResult?.cssText;
        if (!cssText) {
            return;
        }
        try {
            await ScriptingApi.insertCSS({
                cssText,
                tabId,
                frameId,
            });
        }
        catch (e) {
            logger.debug('[applyCssByTabAndFrame] error occurred during injection', getErrorMessage(e), 'with request context:', requestContext);
        }
    }
    /**
     * Patches rule selector adding adguard mark rule info in the content attribute.
     * Example:
     * .selector -> .selector { content: 'adguard{filterId};{ruleText} !important;}.
     *
     * @param rule Elemhide cosmetic rule.
     *
     * @returns Rule with modified stylesheet, containing content marker.
     */
    static addMarkerToElemhideRule(rule) {
        const result = [];
        result.push(rule.getContent());
        result.push(CosmeticApi.ELEMHIDE_HIT_START);
        result.push(rule.getFilterListId());
        result.push(CosmeticApi.HIT_SEP);
        result.push(rule.getIndex());
        result.push(CosmeticApi.HIT_END);
        return result.join('');
    }
    /**
     * Patches rule selector adding adguard mark and rule info in the content style attribute.
     * Example:
     * .selector { color: red } -> .selector { color: red, content: 'adguard{filterId};{ruleText} !important;}.
     *
     * @param rule Inject cosmetic rule.
     *
     * @returns Modified rule with injected content marker into stylesheet.
     */
    static addMarkerToInjectRule(rule) {
        const result = [];
        const ruleContent = rule.getContent();
        // if rule text has content attribute we don't add rule marker
        const contentAttributeRegex = /[{;"(]\s*content\s*:/gi;
        if (contentAttributeRegex.test(ruleContent)) {
            return ruleContent;
        }
        // remove closing brace
        const ruleTextWithoutCloseBrace = ruleContent.slice(0, -1).trim();
        // check semicolon
        const ruleTextWithSemicolon = ruleTextWithoutCloseBrace.endsWith(';')
            ? ruleTextWithoutCloseBrace
            : `${ruleTextWithoutCloseBrace};`;
        result.push(ruleTextWithSemicolon);
        result.push(CosmeticApi.INJECT_HIT_START);
        result.push(rule.getFilterListId());
        result.push(CosmeticApi.HIT_SEP);
        result.push(rule.getIndex());
        result.push(CosmeticApi.HIT_END);
        return result.join('');
    }
    /**
     * Builds stylesheets with css-hits marker.
     *
     * @param elemhideRules Elemhide css rules.
     * @param injectRules Inject css rules.
     *
     * @returns List of stylesheet expressions.
     */
    static buildStyleSheetsWithHits(elemhideRules, injectRules) {
        const elemhideStyles = elemhideRules.map((x) => CosmeticApi.addMarkerToElemhideRule(x));
        const injectStyles = injectRules.map((x) => CosmeticApi.addMarkerToInjectRule(x));
        return [...elemhideStyles, ...injectStyles];
    }
    /**
     * Logs js rules applied to specific frame.
     *
     * We need a separate function for logging because script rules can be logged before injection
     * to avoid duplicate logs while the js rule is being applied.
     *
     * See {@link WebRequestApi.onBeforeRequest} for details.
     *
     * @param params Data for js rule logging.
     */
    static logScriptRules(params) {
        const { tabId, cosmeticResult, url, contentType, timestamp, } = params;
        const scriptRules = cosmeticResult.getScriptRules();
        for (const scriptRule of scriptRules) {
            if (scriptRule.isGeneric()) {
                continue;
            }
            const ruleText = scriptRule.getContent();
            // do not log rules if they are not local
            // which means that will not be applied
            if (!localScriptRulesService.isLocalScript(ruleText)) {
                continue;
            }
            const ruleType = scriptRule.getType();
            defaultFilteringLog.publishEvent({
                type: FilteringEventType.JsInject,
                data: {
                    script: true,
                    tabId,
                    // for proper filtering log request info rule displaying
                    // event id should be unique for each event, not copied from request
                    // https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2341
                    eventId: nanoid(),
                    requestUrl: url,
                    frameUrl: url,
                    frameDomain: getDomain(url),
                    requestType: contentType,
                    timestamp,
                    filterId: scriptRule.getFilterListId(),
                    ruleIndex: scriptRule.getIndex(),
                    cssRule: ruleType === CosmeticRuleType.ElementHidingRule
                        || ruleType === CosmeticRuleType.CssInjectionRule,
                    scriptRule: ruleType === CosmeticRuleType.ScriptletInjectionRule
                        || ruleType === CosmeticRuleType.JsInjectionRule,
                    contentRule: ruleType === CosmeticRuleType.HtmlFilteringRule,
                },
            });
        }
    }
}

/**
 * Synthetic Cookie-like object parsed from headers.
 */
class ParsedCookie {
    /**
     * The request-URI to associate with the setting of the cookie.
     */
    url;
    /**
     * Defines the host to which the cookie will be sent.
     * Only the current domain can be set as the value, or a domain of a higher
     * order, unless it is a public suffix. Setting the domain will make
     * the cookie available to it, as well as to all its subdomains.
     *
     * Can be empty. And actually should be empty for `__Host-` cookies.
     *
     * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes}
     */
    domain;
    /**
     * The name of the cookie.
     */
    name;
    /**
     * The value of the cookie.
     */
    value;
    /**
     * The expiration date of the cookie.
     */
    expires;
    /**
     * The parsed max-age value in seconds.
     */
    maxAge;
    /**
     * True if the cookie is marked as Secure.
     */
    secure;
    /**
     * Whether the cookie should be marked as HttpOnly.
     */
    httpOnly;
    /**
     * Cookie's same-site status.
     */
    sameSite;
    /**
     * Cookies path. Defaults to the path portion of the url parameter.
     */
    path;
    /**
     * Priority chrome only specs.
     * Isn't affected. Let it be here just in case.
     *
     * @see {@link https://bugs.chromium.org/p/chromium/issues/detail?id=232693}
     */
    priority;
    /**
     * Cookie's third-party status.
     */
    thirdParty = false;
    /**
     * Constructor.
     *
     * @param name Cookie name.
     * @param value Cookie value.
     * @param url Url.
     */
    constructor(name, value, url) {
        this.name = name;
        this.value = value;
        this.url = url;
        this.path = new URL(url).pathname;
    }
    /**
     * Creates new {@link ParsedCookie} from provided {@link Cookies.Cookie}.
     *
     * @param cookie Item of {@link Cookies.Cookie}.
     * @param url String URL relative to this cookie.
     *
     * @returns New {@link ParsedCookie}.
     */
    static fromBrowserCookie(cookie, url) {
        const parsedCookie = new ParsedCookie(cookie.name, cookie.value, url);
        parsedCookie.thirdParty = !cookie.firstPartyDomain;
        parsedCookie.httpOnly = cookie.httpOnly;
        parsedCookie.secure = cookie.secure;
        parsedCookie.sameSite = cookie.sameSite;
        // For hostOnly cookie domain should be empty and path should be '/'.
        if (cookie.hostOnly) {
            parsedCookie.path = '/';
        }
        else {
            parsedCookie.domain = cookie.domain;
            parsedCookie.path = cookie.path;
        }
        if (cookie.expirationDate) {
            // cookie.expirationDate is a number of seconds that's why it should be multiplied
            parsedCookie.expires = new Date(cookie.expirationDate * 1000);
        }
        return parsedCookie;
    }
}

/* eslint-disable class-methods-use-this */
/**
 * Cookie api implementation.
 */
class BrowserCookieApi {
    /**
     * Removes cookie.
     *
     * @param name Cookie name.
     * @param url Request url.
     * @returns True if cookie was removed.
     */
    async removeCookie(name, url) {
        try {
            await webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().cookies.remove({ name, url });
            return true;
        }
        catch (e) {
            logger.error('[tswebextension.removeCookie]: error on removing cookie via browser.cookies.remove: ', e);
        }
        return false;
    }
    /**
     * Updates cookie.
     *
     * @param cookie Cookie for update.
     *
     * @returns Promise resolved with true if cookie was updated, false otherwise.
     */
    async modifyCookie(cookie) {
        try {
            const update = BrowserCookieApi.convertToSetDetailsType(cookie);
            await webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().cookies.set(update);
            return true;
        }
        catch (e) {
            // If `domain` contains the `path` part, the cookie cannot be saved,
            // since `domain` can only contain hostname.
            if (cookie.domain?.includes('/')
                // if url is not matched with domain, cookie cannot be set
                // https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2683
                || (cookie.domain && !BrowserCookieApi.doesDomainMatchUrl(cookie.domain, cookie.url))) {
                logger.info('[tswebextension.modifyCookie]: error on modifying cookie via browser.cookies.set: ', e);
            }
            else {
                logger.error('[tswebextension.modifyCookie]: error on modifying cookie via browser.cookies.set: ', e);
            }
        }
        return false;
    }
    /**
     * Search for cookies that match a given pattern.
     *
     * @param pattern Pattern of cookies to find.
     *
     * @returns List of found cookies.
     */
    async findCookies(pattern) {
        try {
            const found = await webextension_polyfill__WEBPACK_IMPORTED_MODULE_2___default().cookies.getAll(pattern);
            return found;
        }
        catch (e) {
            logger.error('[tswebextension.findCookies]: error on finding cookies via browser.cookies.getAll: ', e);
        }
        return [];
    }
    /**
     * Checks whether the cookie domain matches the url.
     *
     * @param rawCookieDomain Cookie domain.
     * @param url Request url.
     *
     * @returns True if domain matches the url, false otherwise.
     */
    static doesDomainMatchUrl(rawCookieDomain, url) {
        let cookieDomain = rawCookieDomain;
        // cookie domain can be '.example.com'
        if (cookieDomain.startsWith('.')) {
            cookieDomain = cookieDomain.slice(1);
        }
        const urlDomain = (0,tldts__WEBPACK_IMPORTED_MODULE_0__/* .getDomain */ .ge)(url);
        return !!urlDomain && cookieDomain.includes(urlDomain);
    }
    /**
     * Converts cookie to SetDetailsType.
     *
     * @param cookie Cookie for convert.
     * @returns SetDetailsType.
     */
    static convertToSetDetailsType(cookie) {
        return {
            /**
             * The request-URI to associate with the setting of the cookie.
             * This value can affect the default domain and path values of the created cookie.
             * If host permissions for this URL are not specified in the manifest file, the API call will fail.
             */
            url: cookie.url,
            /**
             * The name of the cookie. Empty by default if omitted.
             */
            name: cookie.name,
            /**
             * The value of the cookie. Empty by default if omitted.
             */
            value: cookie.value,
            /**
             * The domain of the cookie. If omitted, the cookie becomes a host-only cookie.
             */
            domain: cookie.domain,
            /**
             * Whether the cookie should be marked as Secure. Defaults to false.
             */
            secure: cookie.secure,
            /**
             * Whether the cookie should be marked as HttpOnly. Defaults to false.
             */
            httpOnly: cookie.httpOnly,
            /**
             * The cookie's same-site status.
             */
            sameSite: BrowserCookieApi.getSameSiteStatus(cookie.sameSite),
            /**
             * The expiration date of the cookie as the number of seconds since the UNIX epoch.
             * If omitted, the cookie becomes a session cookie.
             */
            expirationDate: cookie.expires
                ? Math.floor(cookie.expires.getTime() / 1000)
                : undefined,
            /**
             * The path of the cookie. Defaults to the path portion of the url parameter.
             */
            path: cookie.path,
        };
    }
    /**
     * Returns same-site type.
     *
     * @param sameSite Same-site string.
     * @returns Same-site status or undefined if same-site is not specified.
     */
    static getSameSiteStatus(sameSite) {
        if (sameSite) {
            if (sameSite.toLowerCase() === 'lax') {
                return 'lax';
            }
            if (sameSite.toLowerCase() === 'strict') {
                return 'strict';
            }
        }
        return undefined;
    }
}

/**
 * Cookie rules manager class.
 */
class CookieRulesFinder {
    /**
     * Filters blocking rules.
     * Used in content scripts.
     *
     * @param url Request url.
     * @param rules List of rules.
     * @returns Blocking rules.
     */
    static getBlockingRules(url, rules) {
        return rules.filter((rule) => !CookieRulesFinder.isModifyingRule(rule));
    }
    /**
     * Finds a rule that doesn't modify cookie:
     *  i.e.: this rule cancels cookie or if it's an allowlist rule.
     *
     * @param cookieName Cookie name.
     * @param rules List of network rules.
     * @param isThirdPartyCookie Flag that indicates if cookie is third-party.
     * @returns Found rule or null.
     */
    static lookupNotModifyingRule(cookieName, rules, isThirdPartyCookie) {
        const blockingRules = [];
        const allowlistRules = [];
        for (let i = 0; i < rules.length; i += 1) {
            const rule = rules[i];
            if (!CookieRulesFinder.matchThirdParty(rule, isThirdPartyCookie)) {
                continue;
            }
            const cookieModifier = rule.getAdvancedModifier();
            if (cookieModifier.matches(cookieName) && !CookieRulesFinder.isModifyingRule(rule)) {
                if (rule.isAllowlist()) {
                    allowlistRules.push(rule);
                }
                else {
                    blockingRules.push(rule);
                }
            }
        }
        if (allowlistRules.length > 0) {
            return allowlistRules[0];
        }
        if (blockingRules.length > 0) {
            return blockingRules[0];
        }
        return null;
    }
    /**
     * Finds rules that modify cookie.
     *
     * @param cookieName Cookie name.
     * @param rules Matching rules.
     * @param isThirdPartyCookie Flag that indicates if cookie is third-party.
     * @returns Modifying rules.
     */
    static lookupModifyingRules(cookieName, rules, isThirdPartyCookie) {
        const result = [];
        const allowlistRules = [];
        if (rules && rules.length > 0) {
            for (let i = 0; i < rules.length; i += 1) {
                const rule = rules[i];
                if (!CookieRulesFinder.matchThirdParty(rule, isThirdPartyCookie)) {
                    continue;
                }
                const cookieModifier = rule.getAdvancedModifier();
                if (!cookieModifier.matches(cookieName)) {
                    continue;
                }
                if (!rule.isAllowlist() && !CookieRulesFinder.isModifyingRule(rule)) {
                    return [];
                }
                if (rule.isAllowlist()) {
                    allowlistRules.push(rule);
                }
                else {
                    result.push(rule);
                }
            }
        }
        if (allowlistRules.length > 0) {
            return allowlistRules;
        }
        return result;
    }
    /**
     * Checks if rule and third party flag matches.
     *
     * @param rule Rule.
     * @param isThirdParty Flag that indicates if cookie is third-party.
     * @returns True if rule and third party flag matches.
     */
    static matchThirdParty(rule, isThirdParty) {
        if (!rule.isOptionEnabled(_adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .NetworkRuleOption.ThirdParty */ .SJ.ThirdParty)) {
            return true;
        }
        return isThirdParty === rule.isOptionEnabled(_adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .NetworkRuleOption.ThirdParty */ .SJ.ThirdParty);
    }
    /**
     * Checks if $cookie rule is modifying.
     *
     * @param rule $cookie rule.
     * @returns True if rule is modifying.
     */
    static isModifyingRule(rule) {
        const cookieModifier = rule.getAdvancedModifier();
        return cookieModifier.getSameSite() !== null
            || (cookieModifier.getMaxAge() !== null && cookieModifier.getMaxAge() > 0);
    }
}

/**
 * Cookie Utils.
 */
class CookieUtils {
    /**
     * RegExp to match field-content in RFC 7230 sec 3.2.
     *
     * Example:
     * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
     * field-vchar   = VCHAR / obs-text
     * obs-text      = %x80-FF.
     */
    // eslint-disable-next-line no-control-regex
    static FIELD_CONTENT_REGEX = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
    /**
     * Parses set-cookie header from http response header.
     *
     * @param header HTTP response header.
     * @param url Request URL.
     * @returns Parsed cookie or null if it failed to parse the header.
     */
    static parseSetCookieHeader(header, url) {
        if (!header.name || header.name.toLowerCase() !== 'set-cookie') {
            return null;
        }
        if (!header.value) {
            return null;
        }
        return CookieUtils.parseSetCookie(header.value, url);
    }
    /**
     * Parses set-cookie headers for cookie objects.
     *
     * @param responseHeaders HTTP response headers.
     * @param url Request URL.
     * @returns Array of parsed cookies.
     */
    static parseSetCookieHeaders(responseHeaders, url) {
        const result = [];
        let iResponseHeaders = responseHeaders.length;
        while (iResponseHeaders > 0) {
            iResponseHeaders -= 1;
            const header = responseHeaders[iResponseHeaders];
            const setCookie = CookieUtils.parseSetCookieHeader(header, url);
            if (setCookie) {
                result.push(setCookie);
            }
        }
        return result;
    }
    /**
     * Parse an HTTP Cookie header string and return an object with all cookie name-value pairs.
     *
     * @param cookieValue HTTP Cookie value.
     * @param url Request URL.
     * @returns Array of cookie name-value pairs.
     */
    static parseCookies(cookieValue, url) {
        const cookies = [];
        // Split Cookie values
        const pairs = cookieValue.split(/; */);
        for (let i = 0; i < pairs.length; i += 1) {
            const pair = pairs[i];
            const eqIdx = pair.indexOf('=');
            // skip things that don't look like key=value
            if (eqIdx < 0) {
                continue;
            }
            const key = pair.substring(0, eqIdx).trim();
            const value = pair.substring(eqIdx + 1, pair.length).trim();
            const parsedCookie = new ParsedCookie(key, value, url);
            /**
             * Not obviously there are few special name prefixes.
             *
             * @see {@link https://developer.cdn.mozilla.net/pt-BR/docs/Web/HTTP/Headers/Set-Cookie}
             */
            if (key.startsWith('__Secure-') || key.startsWith('__Host-')) {
                parsedCookie.secure = true;
            }
            cookies.push(parsedCookie);
        }
        return cookies;
    }
    /**
     * Parses "Set-Cookie" header value and returns a cookie object with its properties.
     *
     * @param setCookieValue "Set-Cookie" header value to parse.
     * @param url Request URL.
     * @returns Parsed cookie or null if it failed to parse the value.
     */
    static parseSetCookie(setCookieValue, url) {
        const parts = setCookieValue.split(';').filter((s) => !!s);
        const nameValuePart = parts.shift();
        if (!nameValuePart) {
            // eslint-disable-next-line max-len
            logger.debug(`[tswebextension.parseSetCookie]: cannot shift first name-value pair from Set-Cookie header '${setCookieValue}'.`);
            return null;
        }
        const nameValue = nameValuePart.split('=');
        const name = nameValue.shift();
        if (!name) {
            // eslint-disable-next-line max-len
            logger.debug(`[tswebextension.parseSetCookie]: cannot extract name from first name-value pair from Set-Cookie header '${setCookieValue}'.`);
            return null;
        }
        // Everything after the first =, joined by a "=" if there was more
        // than one part.
        const value = nameValue.join('=');
        const cookie = new ParsedCookie(name, value, url);
        parts.forEach((part) => {
            const sides = part.split('=');
            const key = sides
                .shift()
                .trimStart()
                .toLowerCase();
            const optionValue = sides.join('=');
            if (key === 'expires') {
                cookie.expires = new Date(optionValue);
            }
            else if (key === 'max-age') {
                cookie.maxAge = parseInt(optionValue, 10);
            }
            else if (key === 'secure') {
                cookie.secure = true;
            }
            else if (key === 'httponly') {
                cookie.httpOnly = true;
            }
            else if (key === 'samesite') {
                cookie.sameSite = optionValue;
            }
            else if (key === 'path') {
                cookie.path = optionValue;
            }
            else if (key === 'domain') {
                cookie.domain = optionValue;
            }
        });
        return cookie;
    }
    /**
     * Updates cookie maxAge value.
     *
     * @param cookie Cookie to modify.
     * @param maxAge New maxAge value.
     * @returns True if cookie was modified.
     */
    static updateCookieMaxAge(cookie, maxAge) {
        const currentTimeSec = Date.now() / 1000;
        let cookieExpiresTimeSec = null;
        if (cookie.maxAge) {
            cookieExpiresTimeSec = currentTimeSec + cookie.maxAge;
        }
        else if (cookie.expires) {
            cookieExpiresTimeSec = cookie.expires.getTime() / 1000;
        }
        const newCookieExpiresTimeSec = currentTimeSec + maxAge;
        if (cookieExpiresTimeSec === null || cookieExpiresTimeSec > newCookieExpiresTimeSec) {
            // eslint-disable-next-line no-param-reassign
            cookie.expires = new Date(newCookieExpiresTimeSec * 1000);
            // eslint-disable-next-line no-param-reassign
            cookie.maxAge = maxAge;
            return true;
        }
        return false;
    }
    /**
     * Serializes cookie data into a string suitable for Set-Cookie header.
     *
     * @param cookie A cookie object.
     * @returns Set-Cookie string or null if it failed to serialize object.
     * @throws {TypeError} Thrown in case of invalid input data.
     */
    static serializeCookieToResponseHeader(cookie) {
        if (!cookie) {
            throw new TypeError('empty cookie data');
        }
        // 1. Validate fields
        if (!CookieUtils.FIELD_CONTENT_REGEX.test(cookie.name)) {
            throw new TypeError(`Cookie name is invalid: ${cookie.name}`);
        }
        if (cookie.value && !CookieUtils.FIELD_CONTENT_REGEX.test(cookie.value)) {
            throw new TypeError(`Cookie value is invalid: ${cookie.value}`);
        }
        if (cookie.domain && !CookieUtils.FIELD_CONTENT_REGEX.test(cookie.domain)) {
            throw new TypeError(`Cookie domain is invalid: ${cookie.domain}`);
        }
        if (cookie.path && !CookieUtils.FIELD_CONTENT_REGEX.test(cookie.path)) {
            throw new TypeError(`Cookie path is invalid: ${cookie.path}`);
        }
        if (cookie.expires && typeof cookie.expires.toUTCString !== 'function') {
            throw new TypeError(`Cookie expires is invalid: ${cookie.expires}`);
        }
        // 2. Build Set-Cookie header value
        let setCookieValue = `${cookie.name}=${cookie.value}`;
        if (typeof cookie.maxAge === 'number' && !Number.isNaN(cookie.maxAge)) {
            setCookieValue += `; Max-Age=${Math.floor(cookie.maxAge)}`;
        }
        if (cookie.domain) {
            setCookieValue += `; Domain=${cookie.domain}`;
        }
        if (cookie.path) {
            setCookieValue += `; Path=${cookie.path}`;
        }
        if (cookie.expires) {
            setCookieValue += `; Expires=${cookie.expires.toUTCString()}`;
        }
        if (cookie.httpOnly) {
            setCookieValue += '; HttpOnly';
        }
        if (cookie.secure) {
            setCookieValue += '; Secure';
        }
        if (cookie.sameSite) {
            const sameSite = cookie.sameSite.toLowerCase();
            switch (sameSite) {
                case 'lax':
                    setCookieValue += '; SameSite=Lax';
                    break;
                case 'strict':
                    setCookieValue += '; SameSite=Strict';
                    break;
                case 'none':
                    setCookieValue += '; SameSite=None';
                    break;
                default:
                    throw new TypeError(`Cookie sameSite is invalid: ${cookie.sameSite}`);
            }
        }
        // Not affected. Let it be here just in case
        // https://bugs.chromium.org/p/chromium/issues/detail?id=232693
        if (cookie.priority) {
            setCookieValue += `; Priority=${cookie.priority}`;
        }
        return setCookieValue;
    }
    /**
     * Serializes cookie data into a string suitable for Cookie header.
     *
     * @param cookies Array with {@link ParsedCookie}.
     * @returns Cookie string or null if it failed to serialize object.
     */
    static serializeCookieToRequestHeader(cookies) {
        return cookies
            .map((cookie) => `${cookie.name}=${cookie.value}`)
            .join('; ');
    }
}

/**
 * Request context storage used to keep track of request data
 * and calculated rules for it.
 */
class RequestContextStorage {
    /**
     * Map of request context data.
     */
    requestMap = new Map();
    /**
     * Sets requestData context by requestData id.
     * @param requestId Request id.
     * @param requestData Request context data.
     */
    set(requestId, requestData) {
        this.requestMap.set(requestId, requestData);
    }
    /**
     * Updates request context fields. Can be done partially.
     * @param requestId Request id.
     * @param data Partial request context.
     * @returns Updated request context or undefined if request context not found.
     */
    update(requestId, data) {
        const requestContext = this.requestMap.get(requestId);
        if (requestContext) {
            Object.assign(requestContext, data);
            return requestContext;
        }
        return undefined;
    }
    /**
     * Returns request context by request id.
     * @param requestId Request id.
     * @returns Request context or undefined if request context not found.
     */
    get(requestId) {
        return this.requestMap.get(requestId);
    }
    /**
     * Removes non document/subdocument request context from the map by request id.
     * @param requestId Request id.
     */
    delete(requestId) {
        const context = this.requestMap.get(requestId);
        if (!context) {
            return;
        }
        this.requestMap.delete(requestId);
    }
    /**
     * Clears all request context data.
     */
    clear() {
        this.requestMap.clear();
    }
}
const requestContextStorage = new RequestContextStorage();

/**
 * Generic wrapper for browser.webRequest with custom event implementation.
 */
class RequestEvent {
    listeners = [];
    /**
     * Register listener for the browser.webRequest events.
     *
     * @param event Webrequest event name.
     * @param handler Handler to register.
     * @param filter Filter of the events.
     * @param extraInfoSpec Extra info spec.
     */
    init(event, handler, filter, extraInfoSpec) {
        // TODO: Remove BlockingResponseOrPromise because in MV3 we cannot block
        // response, so we need to left only void or promise<void> as result
        // of handlers.
        const handleBrowserEvent = (details) => {
            const data = handler(details);
            /**
             * Execute all registered listeners one by one until a non-empty value is returned.
             */
            for (let i = 0; i < this.listeners.length; i += 1) {
                const res = this.listeners[i](data);
                if (res) {
                    return res;
                }
            }
            return undefined;
        };
        event.addListener(handleBrowserEvent, filter, extraInfoSpec);
    }
    /**
     * Register listener for the browser.webRequest events.
     *
     * @param listener Event callback.
     */
    addListener(listener) {
        this.listeners.push(listener);
    }
    /**
     * Remove listener from the browser.webRequest events.
     *
     * @param listener Event callback.
     */
    removeListener(listener) {
        const index = this.listeners.indexOf(listener);
        if (index !== -1) {
            this.listeners.splice(index, 1);
        }
    }
}

const MAX_URL_LENGTH = (/* unused pure expression or super */ null && (1024 * 16));
/**
 * Request events class.
 * TODO: Can it be moved to common?
 */
class RequestEvents {
    static onBeforeRequest = new RequestEvent();
    static onResponseStarted = new RequestEvent();
    static onBeforeSendHeaders = new RequestEvent();
    static onHeadersReceived = new RequestEvent();
    static onCompleted = new RequestEvent();
    static onErrorOccurred = new RequestEvent();
    /**
     * Initializes request events service.
     */
    static init() {
        // TODO: Maybe remove RequestEvents and RequestEvent layers?
        RequestEvents.onBeforeRequest.init(browser.webRequest.onBeforeRequest, RequestEvents.handleOnBeforeRequest, { urls: ['<all_urls>'] });
        const onBeforeSendHeadersOptions = ['requestHeaders'];
        const onBeforeSendHeadersOptionTypes = browser.webRequest.OnBeforeSendHeadersOptions;
        if (typeof onBeforeSendHeadersOptionTypes !== 'undefined'
            && Object.prototype.hasOwnProperty.call(onBeforeSendHeadersOptionTypes, 'EXTRA_HEADERS')) {
            onBeforeSendHeadersOptions.push('extraHeaders');
        }
        RequestEvents.onBeforeSendHeaders.init(browser.webRequest.onBeforeSendHeaders, RequestEvents.handleOnBeforeSendHeaders, { urls: ['<all_urls>'] }, onBeforeSendHeadersOptions);
        const onResponseStartedOptions = ['responseHeaders', 'extraHeaders'];
        RequestEvents.onResponseStarted.init(browser.webRequest.onResponseStarted, RequestEvents.handleOnResponseStarted, { urls: ['<all_urls>'] }, onResponseStartedOptions);
        const onHeadersReceivedOptions = ['responseHeaders'];
        const onHeadersReceivedOptionTypes = browser.webRequest.OnHeadersReceivedOptions;
        if (typeof onHeadersReceivedOptionTypes !== 'undefined'
            && Object.prototype.hasOwnProperty.call(onBeforeSendHeadersOptionTypes, 'EXTRA_HEADERS')) {
            onHeadersReceivedOptions.push('extraHeaders');
        }
        RequestEvents.onHeadersReceived.init(browser.webRequest.onHeadersReceived, RequestEvents.handleOnHeadersReceived, { urls: ['<all_urls>'] }, onHeadersReceivedOptions);
        RequestEvents.onCompleted.init(browser.webRequest.onCompleted, RequestEvents.handleOnCompleted, { urls: ['<all_urls>'] }, ['responseHeaders']);
        RequestEvents.onErrorOccurred.init(browser.webRequest.onErrorOccurred, RequestEvents.handleOnErrorOccurred, { urls: ['<all_urls>'] });
    }
    /**
     * Handles onResponseStarted event.
     *
     * @param details WebRequest details.
     * @returns Request data with context.
     */
    static handleOnResponseStarted(details) {
        const { requestId, timeStamp } = details;
        const context = requestContextStorage.update(requestId, {
            state: "responseStarted" /* RequestContextState.ResponseStarted */,
            timestamp: timeStamp,
        });
        return { details, context };
    }
    /**
     * Handles onBeforeRequest event.
     *
     * @param details WebRequest details.
     * @returns Request data.
     */
    static handleOnBeforeRequest(details) {
        const { requestId, type, tabId, parentFrameId, originUrl, initiator, method, timeStamp, } = details;
        let { url, frameId } = details;
        /**
         * Truncate too long urls.
         *
         * @see {@link https://github.com/AdguardTeam/AdguardBrowserExtension/issues/1493}
         */
        if (url.length > MAX_URL_LENGTH) {
            url = url.slice(0, MAX_URL_LENGTH);
        }
        /**
         * FF sends http instead of ws protocol at the http-listeners layer
         * Although this is expected, as the Upgrade request is indeed an HTTP request,
         * we use a chromium based approach in this case.
         */
        if (type === 'websocket' && isHttpRequest(url)) {
            url = url.replace(/^http(s)?:/, 'ws$1:');
        }
        const { requestType, contentType } = getRequestType(type);
        const isDocumentRequest = requestType === RequestType$2.Document;
        // Pre-rendered documents can have a frame ID other than zero
        frameId = isDocumentRequest ? MAIN_FRAME_ID : frameId;
        let requestFrameId = isDocumentRequest ? frameId : parentFrameId;
        // Relate request to main_frame
        if (requestFrameId === -1) {
            requestFrameId = 0;
        }
        // To mark requests started via navigation from the address bar (real
        // request or pre-render, it does not matter) as first-party requests,
        // we get only part of the request context to record only the tab and
        // frame information before calculating the request referrer.
        const tabFrameRequestContext = {
            requestUrl: url,
            requestType,
            requestId,
            frameId,
            tabId,
        };
        const referrerUrl = originUrl
            || initiator
            // Comparison of the requested url with the tab frame url in case of
            // a navigation change from the browser address bar.
            || tabsApi.getTabMainFrame(tabId)?.url
            || tabsApi.getTabFrame(tabId, requestFrameId)?.url
            || url;
        // Retrieve the rest part of the request context for record all fields.
        const context = {
            ...tabFrameRequestContext,
            eventId: nanoid(),
            state: "beforeRequest" /* RequestContextState.BeforeRequest */,
            timestamp: timeStamp,
            thirdParty: isThirdPartyRequest(url, referrerUrl),
            referrerUrl,
            contentType,
            method: method,
        };
        requestContextStorage.set(requestId, context);
        return { details, context };
    }
    /**
     * Handles onBeforeSendHeaders event.
     *
     * @param details WebRequest details.
     * @returns Request data.
     */
    static handleOnBeforeSendHeaders(details) {
        const { requestId, timeStamp, requestHeaders } = details;
        const context = requestContextStorage.update(requestId, {
            state: "beforeSendHeaders" /* RequestContextState.BeforeSendHeaders */,
            timestamp: timeStamp,
            requestHeaders,
        });
        return { details, context };
    }
    /**
     * Handles onHeadersReceived event.
     *
     * @param details WebRequest details.
     * @returns Request data with context.
     */
    static handleOnHeadersReceived(details) {
        const { requestId, responseHeaders, } = details;
        const context = requestContextStorage.update(requestId, {
            state: "headersReceived" /* RequestContextState.HeadersReceived */,
            responseHeaders,
        });
        return { details, context };
    }
    /**
     * Handles onCompleted event.
     *
     * @param details WebRequest details.
     * @returns Request data with context.
     */
    static handleOnCompleted(details) {
        const { requestId, timeStamp } = details;
        const context = requestContextStorage.update(requestId, {
            state: "completed" /* RequestContextState.Completed */,
            timestamp: timeStamp,
        });
        return { details, context };
    }
    /**
     * Handles onErrorOccurred event.
     *
     * @param details WebRequest details.
     * @returns Request data with context.
     */
    static handleOnErrorOccurred(details) {
        const { requestId, timeStamp } = details;
        const context = requestContextStorage.update(requestId, {
            state: "error" /* RequestContextState.Error */,
            timestamp: timeStamp,
        });
        return { details, context };
    }
}

/**
 * Cookie filtering.
 *
 * The following public methods should be set as suitable webrequest events listeners, check sample extension in this
 * repo for an example.
 *
 * Logic introduction:
 *  CookieFiltering.onBeforeSendHeaders:
 *  - get all cookies for request url;
 *  - store cookies (first-party);
 *  - apply rules via modifying or removing them with browser.cookies api;
 *
 *  CookieFiltering.onHeadersReceived:
 *  - parse set-cookie header, only to detect if the cookie in header will be set from third-party request;
 *  - save third-party flag for this cookie cookie.thirdParty=request.thirdParty;
 *  - apply rules via modifying or removing them with browser.cookies api;
 *
 *  CookieFiltering.onCompleted:
 *  - apply rules via content script.
 *
 *  In content-scripts (check /src/content-script/cookie-controller.ts):
 *  - apply matched cookie rules.
 */
class CookieFiltering {
    browserCookieApi = new BrowserCookieApi();
    /**
     * Parses cookies from request headers and applies matched rules
     * via browser.cookies api.
     *
     * @param context Request context.
     */
    onBeforeSendHeaders(context) {
        const { requestHeaders, requestUrl, requestId } = context;
        if (!requestHeaders || !requestUrl) {
            return;
        }
        const cookieHeader = findHeaderByName(requestHeaders, 'Cookie');
        if (!cookieHeader?.value) {
            return;
        }
        const cookies = CookieUtils.parseCookies(cookieHeader.value, requestUrl);
        if (cookies.length === 0) {
            return;
        }
        // Saves cookies to context
        requestContextStorage.update(requestId, { cookies });
        // Removes cookies from browser with browser.cookies api, but not
        // removing them from context to correct process them in headers.
        this.applyRules(context)
            .catch((e) => {
            logger.error('[tswebextension.onBeforeSendHeaders]: cannot apply rules due to: ', e);
        });
    }
    /**
     * Parses set-cookie header from response, looks up third-party cookies
     * and applies matched rules via browser.cookies api.
     *
     * @param context Request context.
     */
    onHeadersReceived(context) {
        const { responseHeaders, requestUrl, thirdParty, requestId, } = context;
        /**
         * Full context can be created in onBeforeRequest, partial context can
         * be created on every requestContextStorage.update method call and
         * because of that case - we explicitly checks fields in object.
         * TODO: Improve in AG-24428.
         */
        if (responseHeaders && requestUrl && typeof thirdParty !== 'undefined') {
            const cookies = CookieUtils.parseSetCookieHeaders(responseHeaders, requestUrl);
            const newCookies = cookies.filter((c) => !context.cookies?.includes(c));
            for (const cookie of newCookies) {
                cookie.thirdParty = thirdParty;
            }
            requestContextStorage.update(requestId, {
                cookies: context.cookies ? [...context.cookies, ...newCookies] : newCookies,
            });
        }
        // Removes cookies from browser with browser.cookies api, but not
        // removing them from context to correct process them in headers.
        this.applyRules(context)
            .catch((e) => {
            logger.error('[tswebextension.onHeadersReceived]: cannot apply rules due to: ', e);
        });
    }
    /**
     * Applies rules.
     *
     * @param context Request context.
     */
    async applyRules(context) {
        const { matchingResult, cookies, requestUrl, tabId, } = context;
        if (!matchingResult || !cookies) {
            return;
        }
        const cookieRules = matchingResult.getCookieRules();
        const promises = cookies.map(async (cookie) => {
            await this.applyRulesToCookie(cookie, cookieRules, requestUrl, tabId);
        });
        await Promise.all(promises);
    }
    /**
     * Attempts to find a "parent" cookie with a wider "path" field,
     * the scope of which includes the specified cookie from
     * the function parameters.
     *
     * This needs to prevent create of multiple "child"-cookies
     * and only modified expiration of general "parent"-cookie,
     * which covered "children"-cookies by 'path' value.
     *
     * @param cookie Cookie, for which need to find the "parent" cookie.
     *
     * @returns Item of parent cookie {@link ParsedCookie} or null if not found.
     */
    async findParentCookie(cookie) {
        const pattern = {
            url: cookie.url,
            name: cookie.name,
            domain: cookie.domain,
            secure: cookie.secure,
        };
        const parentCookies = await this.browserCookieApi.findCookies(pattern);
        const sortedParentCookies = parentCookies.sort((a, b) => a.path.length - b.path.length);
        for (let i = 0; i < sortedParentCookies.length; i += 1) {
            const parentCookie = sortedParentCookies[i];
            if (cookie.path?.startsWith(parentCookie.path)) {
                return ParsedCookie.fromBrowserCookie(parentCookie, cookie.url);
            }
        }
        return null;
    }
    /**
     * Applies rules to cookie.
     *
     * @param cookie Cookie.
     * @param cookieRules Cookie rules.
     * @param requestUrl Request URL, needs to record filtering event.
     * @param tabId Tab id.
     */
    async applyRulesToCookie(cookie, cookieRules, requestUrl, tabId) {
        const cookieName = cookie.name;
        const isThirdPartyCookie = cookie.thirdParty;
        const bRule = CookieRulesFinder.lookupNotModifyingRule(cookieName, cookieRules, isThirdPartyCookie);
        if (bRule) {
            if (bRule.isAllowlist() || await this.browserCookieApi.removeCookie(cookie.name, cookie.url)) {
                CookieFiltering.recordCookieEvent(tabId, cookie, requestUrl, bRule, false, isThirdPartyCookie);
            }
            return;
        }
        const mRules = CookieRulesFinder.lookupModifyingRules(cookieName, cookieRules, isThirdPartyCookie);
        if (mRules.length > 0) {
            // Try to find "parent" cookie and modify it instead of creating
            // "child copy" cookie.
            const parentCookie = await this.findParentCookie(cookie);
            const cookieToModify = parentCookie || cookie;
            const appliedRules = CookieFiltering.applyRuleToBrowserCookie(cookieToModify, mRules);
            if (appliedRules.length === 0) {
                return;
            }
            if (await this.browserCookieApi.modifyCookie(cookieToModify)) {
                appliedRules.forEach((r) => {
                    CookieFiltering.recordCookieEvent(tabId, cookieToModify, requestUrl, r, true, isThirdPartyCookie);
                });
            }
        }
    }
    /**
     * Modifies instance of {@link ParsedCookie} with provided rules.
     *
     * @param cookie Cookie modify.
     * @param rules Cookie matching rules.
     * @returns Applied rules.
     */
    static applyRuleToBrowserCookie(cookie, rules) {
        const appliedRules = [];
        for (let i = 0; i < rules.length; i += 1) {
            const rule = rules[i];
            if (rule.isAllowlist()) {
                appliedRules.push(rule);
                continue;
            }
            const cookieModifier = rule.getAdvancedModifier();
            let modified = false;
            const sameSite = cookieModifier.getSameSite();
            if (sameSite && cookie.sameSite !== sameSite) {
                // eslint-disable-next-line no-param-reassign
                cookie.sameSite = sameSite;
                modified = true;
            }
            const maxAge = cookieModifier.getMaxAge();
            if (maxAge) {
                if (CookieUtils.updateCookieMaxAge(cookie, maxAge)) {
                    modified = true;
                }
            }
            if (modified) {
                appliedRules.push(rule);
            }
        }
        return appliedRules;
    }
    /**
     * Looks up blocking rules for content-script.
     *
     * @param frameUrl Frame url.
     * @param tabId Tab id.
     * @param frameId Frame id.
     *
     * @returns List of blocking rules.
     */
    static getBlockingRules(frameUrl, tabId, frameId) {
        const tabContext = tabsApi.getTabContext(tabId);
        if (!tabContext?.info.url) {
            return [];
        }
        const matchQuery = createFrameMatchQuery(frameUrl, frameId, tabContext);
        const matchingResult = engineApi.matchRequest(matchQuery);
        if (!matchingResult) {
            return [];
        }
        const cookieRules = matchingResult.getCookieRules();
        return CookieRulesFinder.getBlockingRules(matchQuery.requestUrl, cookieRules);
    }
    /**
     * Records cookie event to filtering log.
     *
     * @param tabId Id of the tab.
     * @param cookie Item of {@link ParsedCookie}.
     * @param requestUrl URL of the request.
     * @param rule Applied modifying or deleting rule.
     * @param isModifyingCookieRule Is applied rule modifying or not.
     * @param requestThirdParty Whether request third party or not.
     */
    static recordCookieEvent(tabId, cookie, requestUrl, rule, isModifyingCookieRule, requestThirdParty) {
        defaultFilteringLog.publishEvent({
            type: FilteringEventType.Cookie,
            data: {
                eventId: nanoid(),
                tabId,
                cookieName: cookie.name,
                cookieValue: cookie.value,
                frameDomain: getDomain(requestUrl) || requestUrl,
                filterId: rule.getFilterListId(),
                ruleIndex: rule.getIndex(),
                isModifyingCookieRule,
                requestThirdParty,
                timestamp: Date.now(),
                requestType: ContentType.Cookie,
                isAllowlist: rule.isAllowlist(),
                isImportant: rule.isOptionEnabled(_adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .NetworkRuleOption.Important */ .SJ.Important),
                isDocumentLevel: rule.isDocumentLevelAllowlistRule(),
                isCsp: rule.isOptionEnabled(_adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .NetworkRuleOption.Csp */ .SJ.Csp),
                isCookie: rule.isOptionEnabled(_adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .NetworkRuleOption.Cookie */ .SJ.Cookie),
                advancedModifier: rule.getAdvancedModifierValue(),
            },
        });
    }
}
const cookieFiltering = new CookieFiltering();

/**
 * MessageApi knows how to handle {@link Message}.
 */
class MessagesApi {
    tsWebExtension;
    tabsApi;
    filteringLog;
    /**
     * Creates new {@link MessagesApi}.
     *
     * @param tsWebExtension Current {@link TsWebExtension} app.
     * @param tabsApi Tabs API.
     * @param filteringLog Filtering log.
     *
     * @returns New {@link MessagesApi} handler.
     */
    constructor(tsWebExtension, tabsApi, filteringLog) {
        this.tsWebExtension = tsWebExtension;
        this.tabsApi = tabsApi;
        this.filteringLog = filteringLog;
        this.handleMessage = this.handleMessage.bind(this);
    }
    /**
     * Handles message with {@link MessageType}.
     *
     * @param message Message.
     * @param sender Sender of message.
     *
     * @returns Data according to the received message.
     */
    async handleMessage(message, sender) {
        logger.debug('[tswebextension.handleMessage]: ', message);
        try {
            message = messageValidator.parse(message);
        }
        catch (e) {
            logger.error('[tswebextension.handleMessage]: cannot parse message: ', message);
            // Ignore this message
            return undefined;
        }
        const { type } = message;
        switch (type) {
            case MessageType.GetCosmeticData: {
                return this.handleGetCosmeticData(sender, message.payload);
            }
            case MessageType.AssistantCreateRule: {
                return this.handleAssistantCreateRuleMessage(sender, message.payload);
            }
            case MessageType.GetCookieRules: {
                return this.getCookieRules(sender, message.payload);
            }
            case MessageType.SaveCookieLogEvent: {
                return MessagesApi.handleSaveCookieLogEvent(sender, message.payload);
            }
            case MessageType.SaveCssHitsStats: {
                return this.handleSaveCssHitsStats(sender, message.payload);
            }
            default: {
                logger.error('[tswebextension.handleMessage]: did not found handler for message');
            }
        }
        return undefined;
    }
    /**
     * Builds css for specified url.
     *
     * @param sender Tab, which sent message.
     * @param payload Message payload.
     *
     * @returns Cosmetic css or undefined if there are no css rules for this request.
     */
    handleGetCosmeticData(sender, payload) {
        logger.debug('[tswebextension.handleGetCosmeticData]: received call: ', payload);
        if (!payload || !sender?.tab?.id) {
            return undefined;
        }
        if (!this.tsWebExtension.isStarted) {
            return undefined;
        }
        const res = getCosmeticDataPayloadValidator.safeParse(payload);
        if (!res.success) {
            logger.error('[tswebextension.handleGetCosmeticData]: cannot parse payload: ', payload, res.error);
            return undefined;
        }
        const tabId = sender.tab?.id;
        let { frameId } = sender;
        if (!frameId) {
            frameId = 0;
        }
        return CosmeticApi.getContentScriptData(res.data.documentUrl, tabId, frameId);
    }
    /**
     * Handles message with new rule from assistant content script.
     *
     * @param sender An object containing information about the script context
     * that sent a message or request.
     * @param payload Object with rules text.
     *
     * @returns False if it cannot process the created rule,
     * or true for successful processing.
     */
    // eslint-disable-next-line class-methods-use-this
    handleAssistantCreateRuleMessage(sender, payload) {
        if (!payload || !sender?.tab?.id) {
            return false;
        }
        const res = getAssistantCreateRulePayloadValidator.safeParse(payload);
        if (!res.success) {
            return false;
        }
        const { ruleText } = res.data;
        Assistant.onCreateRule.dispatch(ruleText);
        return true;
    }
    /**
     * Returns cookie rules data for content script.
     *
     * @param sender Tab, which sent message.
     * @param payload Message payload.
     *
     * @returns Cookie rules data.
     */
    getCookieRules(sender, payload) {
        logger.debug('[tswebextension.getCookieRules]: received call: ', payload);
        const { isStorageInitialized } = appContext;
        const data = {
            isAppStarted: false,
            cookieRules: [],
        };
        // if storage is not initialized, then app is not ready yet.
        if (!isStorageInitialized || !this.tsWebExtension.isStarted) {
            return data;
        }
        const res = getCookieRulesPayloadValidator.safeParse(payload);
        if (!res.success) {
            // this log message is added here as error for faster identification of the issue
            logger.error('[tswebextension.getCookieRules]: cannot parse payload: ', payload, res.error);
            return undefined;
        }
        const { documentUrl } = res.data;
        if (isEmptySrcFrame(documentUrl)) {
            logger.debug('[tswebextension.getCookieRules]: frame has empty src');
            return undefined;
        }
        const tabId = sender.tab?.id;
        if (tabId === undefined) {
            logger.debug('[tswebextension.getCookieRules]: tabId is undefined');
            return undefined;
        }
        data.isAppStarted = true;
        let { frameId } = sender;
        if (!frameId) {
            frameId = 0;
        }
        const cookieRules = CookieFiltering.getBlockingRules(documentUrl, tabId, frameId);
        data.cookieRules = cookieRules.map((rule) => ({
            ruleIndex: rule.getIndex(),
            match: rule.getAdvancedModifierValue(),
            isThirdParty: rule.isOptionEnabled(NetworkRuleOption$1.ThirdParty),
            filterId: rule.getFilterListId(),
            isAllowlist: rule.isAllowlist(),
            isImportant: rule.isOptionEnabled(NetworkRuleOption$1.Important),
            isDocumentLevel: rule.isDocumentLevelAllowlistRule(),
            isCsp: rule.isOptionEnabled(NetworkRuleOption$1.Csp),
            isCookie: rule.isOptionEnabled(NetworkRuleOption$1.Cookie),
            advancedModifier: rule.getAdvancedModifierValue(),
        }));
        return data;
    }
    /**
     * Handle message about saving css hits stats.
     *
     * @param sender Tab, which sent message.
     * @param payload Message payload.
     * @returns True if stats was saved.
     */
    handleSaveCssHitsStats(sender, 
    // TODO add payload type
    payload) {
        if (!payload || !sender?.tab?.id) {
            return false;
        }
        const tabId = sender.tab.id;
        const tabContext = this.tabsApi.getTabContext(tabId);
        if (!tabContext?.info.url) {
            return false;
        }
        const { url } = tabContext.info;
        let published = false;
        for (let i = 0; i < payload.length; i += 1) {
            const stat = payload[i];
            this.filteringLog.publishEvent({
                type: FilteringEventType.ApplyCosmeticRule,
                data: {
                    tabId,
                    eventId: nanoid(),
                    filterId: stat.filterId,
                    ruleIndex: stat.ruleIndex,
                    element: stat.element,
                    frameUrl: url,
                    frameDomain: getDomain$1(url),
                    requestType: ContentType.Document,
                    timestamp: Date.now(),
                    cssRule: true,
                    scriptRule: false,
                    contentRule: false,
                },
            });
            published = true;
        }
        return published;
    }
    /**
     * Calls filtering to add an event from cookie-controller content-script.
     *
     * @param sender Tab which sent the message.
     * @param payload Message payload.
     * @returns True if event was published to filtering log.
     */
    static handleSaveCookieLogEvent(sender, payload) {
        if (!payload || !sender?.tab?.id) {
            return false;
        }
        const res = getSaveCookieLogEventPayloadValidator.safeParse(payload);
        if (!res.success) {
            return false;
        }
        const { data } = res;
        defaultFilteringLog.publishEvent({
            type: FilteringEventType.Cookie,
            data: {
                eventId: nanoid(),
                tabId: sender.tab.id,
                cookieName: data.cookieName,
                frameDomain: data.cookieDomain,
                cookieValue: data.cookieValue,
                filterId: data.filterId,
                ruleIndex: data.ruleIndex,
                isModifyingCookieRule: false,
                requestThirdParty: data.thirdParty,
                timestamp: Date.now(),
                requestType: ContentType.Cookie,
                // Additional rule properties
                isAllowlist: data.isAllowlist,
                isImportant: data.isImportant,
                isDocumentLevel: data.isDocumentLevel,
                isCsp: data.isCsp,
                isCookie: data.isCookie,
                advancedModifier: data.advancedModifier,
            },
        });
        return true;
    }
    /**
     * Sends message to the specified tab.
     *
     * @param tabId The ID of the tab to send the message.
     * @param message Some payload to send to the tab.
     */
    static async sendMessageToTab(tabId, message) {
        await browser.tabs.sendMessage(tabId, message);
    }
}

/**
 * Declarative filtering log that can record information about the
 * applied declarative network rules with information about the original rule
 * text and the filter identifier.
 */
class DeclarativeFilteringLog {
    /**
     * Stores list of rule sets.
     */
    ruleSets = [];
    /**
     * Is there an active listener for declarativeNetRequest.onRuleMatchedDebug or not.
     */
    #isListening = false;
    /**
     * Returns is there an active listener for declarativeNetRequest.onRuleMatchedDebug or not.
     *
     * @returns Boolean value.
     */
    get isListening() {
        return this.#isListening;
    }
    /**
     * Returns converted declarative json rule, original text rule,
     * filter name and id.
     *
     * @param ruleSetId Rule set id.
     * @param ruleId Rule id in this filter.
     *
     * @throws Error when couldn't find ruleset or rule in ruleset.
     *
     * @returns Converted declarative json rule, original txt rule
     * and filter id.
     */
    getRuleInfo = async (ruleSetId, ruleId) => {
        const ruleSet = this.ruleSets.find((r) => r.getId() === ruleSetId);
        if (!ruleSet) {
            throw new Error(`Cannot find ruleset with id ${ruleSet}`);
        }
        const sourceRules = await ruleSet.getRulesById(ruleId);
        const declarativeRules = await ruleSet.getDeclarativeRules();
        const declarativeRule = declarativeRules.find((r) => r.id === ruleId);
        if (!declarativeRule) {
            throw new Error(`Cannot find rule with id ${ruleId} in ruleset ${ruleSet}`);
        }
        return {
            sourceRules,
            declarativeRuleJson: JSON.stringify(declarativeRule),
        };
    };
    /**
     * Fires an {@link FilteringEventType.MatchedDeclarativeRule} event with
     * matched declarative rule and source text rule.
     *
     * In current approach we will always load all rules from all rule sets in
     * unpacked extension to extract the rule info. This can be optimized and
     * log rule only if filtering log is opened.
     *
     * @param record Request details {@link browser.declarativeNetRequest.MatchedRuleInfoDebug}.
     */
    logMatchedRule = async (record) => {
        const { request: { requestId }, rule: { rulesetId, ruleId }, } = record;
        const context = requestContextStorage.get(requestId);
        if (!context) {
            logger.debug('[logMatchedRule]: cannot find request context for request id', requestId);
            return;
        }
        let declarativeRuleInfo;
        try {
            declarativeRuleInfo = await this.getRuleInfo(rulesetId, ruleId);
        }
        catch (e) {
            logger.debug(e);
            return;
        }
        defaultFilteringLog.publishEvent({
            type: FilteringEventType.MatchedDeclarativeRule,
            data: {
                eventId: context.eventId,
                tabId: context.tabId,
                declarativeRuleInfo,
            },
        });
    };
    /**
     * Toggles the listener for declarativeNetRequest.onRuleMatchedDebug.
     *
     * @param needToAddListener If true, the listener will be added, otherwise removed.
     */
    toggleListener = (needToAddListener) => {
        // Wrapped in try-catch to prevent the extension from crashing if browser
        // will change the API in the future.
        try {
            // onRuleMatchedDebug can be null if the extension is running
            // as a packed version
            if (!chrome.declarativeNetRequest.onRuleMatchedDebug) {
                return;
            }
            if (needToAddListener) {
                // Already listening
                if (this.#isListening) {
                    return;
                }
                chrome.declarativeNetRequest.onRuleMatchedDebug.addListener(this.logMatchedRule);
                this.#isListening = true;
            }
            else {
                chrome.declarativeNetRequest.onRuleMatchedDebug.removeListener(this.logMatchedRule);
                this.#isListening = false;
            }
        }
        catch (e) {
            const message = needToAddListener
                ? 'Cannot start recording declarative network rules due to: '
                : 'Cannot stop recording declarative network rules due to: ';
            logger.debug(message, e);
        }
    };
    /**
     * Starts recording.
     */
    start = () => {
        this.toggleListener(true);
    };
    /**
     * Stops recording.
     */
    stop = () => {
        this.toggleListener(false);
    };
}
const declarativeFilteringLog = new DeclarativeFilteringLog();

/**
 * RuleSetsLoaderApi can create {@link IRuleSet} from the provided rule set ID
 * with lazy loading (rule set contents will be loaded only after a request).
 */
class RuleSetsLoaderApi {
    /**
     * Cache for already created rulesets. Needed to avoid multiple loading
     * of the same ruleset.
     */
    static ruleSetsCache;
    /**
     * Path to rule sets cache directory to invalidate it when path changes.
     */
    static ruleSetsCachePath;
    /**
     * Path to rule sets directory.
     */
    ruleSetsPath;
    /**
     * Creates new {@link RuleSetsLoaderApi}.
     *
     * @param ruleSetsPath Path to rule sets directory.
     */
    constructor(ruleSetsPath) {
        this.ruleSetsPath = ruleSetsPath;
        if (RuleSetsLoaderApi.ruleSetsCachePath !== ruleSetsPath) {
            RuleSetsLoaderApi.ruleSetsCachePath = ruleSetsPath;
            RuleSetsLoaderApi.ruleSetsCache = new Map();
        }
    }
    /**
     * If the rule set with the provided ID is already loaded, it will
     * be returned from the cache. Otherwise, it will create a new {@link IRuleSet}
     * from the provided ID and list of {@link IFilter|filters} with lazy
     * loading of this rule set contents.
     *
     * @param ruleSetId Rule set id.
     * @param filterList List of all available {@link IFilter|filters}.
     *
     * @returns New {@link IRuleSet}.
     */
    async createRuleSet(ruleSetId, filterList) {
        const ruleSetCache = RuleSetsLoaderApi.ruleSetsCache.get(ruleSetId);
        if (ruleSetCache) {
            return ruleSetCache;
        }
        const loadFileText = async (url) => {
            const file = await fetch(url);
            return file.text();
        };
        const rawData = await loadFileText(browser.runtime.getURL(`${this.ruleSetsPath}/${ruleSetId}/${METADATA_FILENAME}`));
        const loadLazyData = () => loadFileText(browser.runtime.getURL(`${this.ruleSetsPath}/${ruleSetId}/${LAZY_METADATA_FILENAME}`));
        const loadDeclarativeRules = () => loadFileText(browser.runtime.getURL(`${this.ruleSetsPath}/${ruleSetId}/${ruleSetId}.json`));
        const { data: { regexpRulesCount, rulesCount, ruleSetHashMapRaw, badFilterRulesRaw, }, ruleSetContentProvider, } = await RuleSet.deserialize(ruleSetId, rawData, loadLazyData, loadDeclarativeRules, filterList);
        const sources = RulesHashMap.deserializeSources(ruleSetHashMapRaw);
        const ruleSetHashMap = new RulesHashMap(sources);
        // We don't need filter id and line index because this
        // indexedRulesWithHash will be used only for matching $badfilter rules.
        const badFilterRules = badFilterRulesRaw
            .map((rawString) => IndexedNetworkRuleWithHash.createFromNode(0, 0, RuleParser.parse(rawString)))
            .flat();
        const ruleset = new RuleSet(ruleSetId, rulesCount, regexpRulesCount, ruleSetContentProvider, badFilterRules, ruleSetHashMap);
        RuleSetsLoaderApi.ruleSetsCache.set(ruleSetId, ruleset);
        return ruleset;
    }
}

/**
 * Custom filter list configuration validator for MV3.
 */
const customFilterMV3Validator = _adguard_tsurlfilter__WEBPACK_IMPORTED_MODULE_1__/* .preprocessedFilterListValidator.extend */ .k$.extend({
    /**
     * Filter identifier.
     */
    filterId: zod__WEBPACK_IMPORTED_MODULE_3__.z.number(),
    /**
     * Filter trusted flag.
     */
    trusted: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
});
const settingsConfigMV3 = settingsConfigValidator.extend({
    /**
     * Path to the content script that set GPC Signal.
     * Necessary for `Do Not Track` stealth option.
     */
    gpcScriptUrl: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    /**
     * Path to the content script that hide document referrer.
     * Necessary for `Hide Search Queries` stealth option.
     */
    hideDocumentReferrerScriptUrl: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
});
/**
 * Configuration validator for MV3.
 */
const configurationMV3Validator = configurationValidator.extend({
    /**
     * List of static filters ids.
     * The content for these filters will be loaded by the tswebextension
     * from the "filtersPath" provided when needed.
     */
    staticFiltersIds: zod__WEBPACK_IMPORTED_MODULE_3__.z.number().array(),
    /**
     * List of custom filters that can be added/edited/deleted by the user.
     */
    customFilters: customFilterMV3Validator.array(),
    /**
     * Path to directory with filters' text rules.
     */
    filtersPath: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    /**
     * Path to directory with converted rule sets.
     * Note: it's better to convert filters with tsurlfilter.convertFilters.
     */
    ruleSetsPath: zod__WEBPACK_IMPORTED_MODULE_3__.z.string(),
    /**
     * Enables logging declarative rules, which will increase used memory,
     * because to extract matched source rule text we need to load ruleset
     * in memory.
     */
    declarativeLogEnabled: zod__WEBPACK_IMPORTED_MODULE_3__.z.boolean(),
    /**
     * List of hotfix rules which should applied dynamically.
     */
    quickFixesRules: customFilterMV3Validator.omit({ filterId: true }),
    settings: settingsConfigMV3,
    /**
     * List of rules added by user.
     */
    userrules: customFilterMV3Validator.omit({ filterId: true }),
});

/**
 * Cosmetic frame processor.
 */
class CosmeticFrameProcessor {
    /**
     * Time threshold to consider two events as part of the same frame.
     * The value is chosen experimentally; in most cases, 100 ms is sufficient to consider the onBeforeNavigate
     * and onBeforeRequest events as related to the same frame. It is also small enough to ignore manual page
     * reloads by the user.
     */
    static SAME_FRAME_THRESHOLD_MS = (/* unused pure expression or super */ null && (100));
    /**
     * Check if recalculation should be skipped.
     * If the time passed between two events is less than the threshold,
     * we consider it part of the same frame and do not recalculate.
     * Additionally, we check if the URL has changed.
     *
     * @param tabId Tab id.
     * @param frameId Frame id.
     * @param url Url.
     * @param timeStamp Event timestamp.
     * @returns True if recalculation should be skipped.
     */
    static shouldSkipRecalculation(tabId, frameId, url, timeStamp) {
        const frameContext = tabsApi.getFrameContext(tabId, frameId);
        if (!frameContext) {
            return false;
        }
        // do not skip recalculation if the URL has changed
        if (frameContext.url !== url) {
            return false;
        }
        const timeDiff = Math.abs(frameContext.timeStamp - timeStamp);
        return timeDiff < CosmeticFrameProcessor.SAME_FRAME_THRESHOLD_MS;
    }
    /**
     * Handle sub frame without url.
     * @param props Handle sub frame without url props.
     */
    static handleSubFrameWithoutUrl(props) {
        const { tabId, frameId, mainFrameUrl, parentDocumentId, } = props;
        let parentFrame;
        let tempParentDocumentId = parentDocumentId;
        while (tempParentDocumentId) {
            parentFrame = tabsApi.getByDocumentId(tabId, tempParentDocumentId);
            tempParentDocumentId = parentFrame?.parentDocumentId;
            if (isHttpRequest(parentFrame?.url)) {
                break;
            }
        }
        if (parentFrame) {
            tabsApi.updateFrameContext(tabId, frameId, {
                preparedCosmeticResult: parentFrame.preparedCosmeticResult,
                mainFrameUrl,
            });
        }
    }
    /**
     * Handle sub frame with url.
     * @param props Handle sub frame with url props.
     */
    static handleSubFrameWithUrl(props) {
        const { url, tabId, frameId, mainFrameUrl, mainFrameRule, } = props;
        const result = engineApi.matchRequest({
            requestUrl: url,
            frameUrl: mainFrameUrl || url,
            requestType: RequestType$2.SubDocument,
            frameRule: mainFrameRule,
        });
        if (!result) {
            return;
        }
        const cosmeticResult = engineApi.getCosmeticResult(url, result.getCosmeticOption());
        const { scriptTexts, scriptletDataList, } = CosmeticApi.getScriptsAndScriptletsData(cosmeticResult);
        const cssText = CosmeticApi.getCssText(cosmeticResult);
        tabsApi.updateFrameContext(tabId, frameId, {
            mainFrameUrl,
            matchingResult: result,
            cosmeticResult,
            preparedCosmeticResult: {
                scriptTexts,
                scriptletDataList,
                cssText,
            },
        });
    }
    /**
     * Handle main frame.
     * @param props Handle main frame props.
     */
    static handleMainFrame(props) {
        const { url, tabId, frameId, } = props;
        if (!isHttpRequest(url)) {
            return;
        }
        tabsApi.resetBlockedRequestsCount(tabId);
        const mainFrameRule = DocumentApi.matchFrame(url);
        if (mainFrameRule) {
            tabsApi.updateFrameContext(tabId, frameId, { frameRule: mainFrameRule });
        }
        const result = engineApi.matchRequest({
            requestUrl: url,
            frameUrl: url,
            requestType: RequestType$2.Document,
            frameRule: mainFrameRule,
        });
        if (!result) {
            return;
        }
        const cosmeticResult = engineApi.getCosmeticResult(url, result.getCosmeticOption());
        const { scriptTexts, scriptletDataList, } = CosmeticApi.getScriptsAndScriptletsData(cosmeticResult);
        const cssText = CosmeticApi.getCssText(cosmeticResult);
        tabsApi.updateFrameContext(tabId, frameId, {
            matchingResult: result,
            cosmeticResult,
            preparedCosmeticResult: {
                scriptTexts,
                scriptletDataList,
                cssText,
            },
        });
    }
    /**
     * Handles frames used here and in the {@link TabsCosmeticInjector}.
     * @param props Precalculate cosmetic props.
     */
    static handleFrame(props) {
        const { tabId, frameId, url, parentDocumentId, } = props;
        const isMainFrame = frameId === MAIN_FRAME_ID;
        if (isMainFrame) {
            CosmeticFrameProcessor.handleMainFrame({
                url,
                tabId,
                frameId,
            });
        }
        else {
            const mainFrame = tabsApi.getFrameContext(tabId, MAIN_FRAME_ID);
            const mainFrameRule = mainFrame?.frameRule;
            const mainFrameUrl = mainFrame?.url;
            if (!isHttpRequest(url)) {
                CosmeticFrameProcessor.handleSubFrameWithoutUrl({
                    tabId,
                    frameId,
                    mainFrameUrl,
                    parentDocumentId,
                });
            }
            else {
                CosmeticFrameProcessor.handleSubFrameWithUrl({
                    url,
                    tabId,
                    frameId,
                    mainFrameUrl,
                    mainFrameRule,
                });
            }
        }
    }
    /**
     * Precalculate cosmetic rules for the request.
     * This method used in the webNavigation.onBeforeNavigate event and webRequest.onBeforeRequest event.
     *
     * @param props Precalculate cosmetic props.
     */
    static precalculateCosmetics(props) {
        const { tabId, frameId, url, timeStamp, parentDocumentId, documentId, } = props;
        if (this.shouldSkipRecalculation(tabId, frameId, url, timeStamp)) {
            return;
        }
        // set in the beginning to let other events know that cosmetic result will be calculated in this event to
        // avoid double calculation
        tabsApi.setFrameContext(tabId, frameId, new Frame({
            tabId,
            frameId,
            url,
            timeStamp,
            documentId,
            parentDocumentId,
        }));
        CosmeticFrameProcessor.handleFrame(props);
    }
}

/**
 * Injects cosmetic rules into tabs, opened before app initialization.
 */
class TabsCosmeticInjector {
    /**
     * Creates contexts for tabs opened before api initialization and
     * applies cosmetic rules for each frame.
     */
    static async processOpenTabs() {
        const currentTabs = await browser.tabs.query({});
        const tasks = currentTabs.map((tab) => TabsCosmeticInjector.processOpenTab(tab));
        const promises = await Promise.allSettled(tasks);
        // Handles errors
        promises.forEach((promise) => {
            if (promise.status === 'rejected') {
                logger.error('[tswebextension.processOpenTabs]: cannot inject cosmetic to open tab: ', promise.reason);
            }
        });
        appContext.cosmeticsInjectedOnStartup = true;
    }
    /**
     * Creates context for tab opened before api initialization and
     * applies cosmetic rules for each frame.
     *
     * @param tab Tab details.
     */
    static async processOpenTab(tab) {
        if (!TabContext.isBrowserTab(tab)) {
            return;
        }
        const tabContext = new TabContext(tab);
        const tabId = tab.id;
        tabsApi.context.set(tabId, tabContext);
        tabsApi.updateTabMainFrameRule(tabId);
        const frames = await chrome.webNavigation.getAllFrames({ tabId });
        if (!frames) {
            return;
        }
        const currentTime = Date.now();
        frames.forEach((frameDetails) => {
            const { url, frameId, parentDocumentId, documentId, } = frameDetails;
            tabsApi.setFrameContext(tabId, frameId, new Frame({
                tabId,
                frameId,
                url,
                timeStamp: currentTime,
                parentDocumentId,
                documentId,
            }));
            CosmeticFrameProcessor.handleFrame({
                tabId,
                frameId,
                url,
                timeStamp: currentTime,
                parentDocumentId,
                documentId,
            });
            // TODO: Instead of this, it’s better to use the runtime.onStartup and runtime.onInstalled
            // events to inject cosmetics once during the extension's initialization
            // and browser startup without flags.
            // However, this would require big refactoring of the extension.
            /**
             * This condition prevents applying cosmetic rules to the tab multiple times.
             * Applying them once after the extension's initialization is enough.
             */
            if (appContext.cosmeticsInjectedOnStartup) {
                return;
            }
            // Note: this is an async function, but we will not await it because
            // events do not support async listeners.
            Promise.all([
                CosmeticApi.applyJsFuncsByTabAndFrame(tabId, frameId),
                CosmeticApi.applyCssByTabAndFrame(tabId, frameId),
                CosmeticApi.applyScriptletsByTabAndFrame(tabId, frameId),
            ]).catch((e) => logger.error(e));
            const frameContext = tabsApi.getFrameContext(tabId, frameId);
            if (!frameContext?.cosmeticResult) {
                // eslint-disable-next-line max-len
                logger.debug(`[tswebextension.processOpenTab]: cannot log script rules due to not having cosmetic result for tabId: ${tabId}, frameId: ${frameId}.`);
                return;
            }
            const isMainFrame = frameId === MAIN_FRAME_ID;
            CosmeticApi.logScriptRules({
                url,
                tabId,
                cosmeticResult: frameContext.cosmeticResult,
                timestamp: currentTime,
                contentType: isMainFrame ? ContentType.Document : ContentType.Subdocument,
            });
        });
    }
}

/**
 * IMPORTANT: if 'import' is used, the path will be resolved to the actual file in the bundled index.mv3.ts
 * but we need the same relative path (to dist file) since the data will be replaced after the build,
 * so it should be 'require' instead of 'import'.
 */
const { rawCompaniesDb } = __webpack_require__(18721);
/**
 * Service for working with companies database.
 */
class CompaniesDbService {
    /**
     * Category name for unknown domains.
     *
     * @see {@link https://github.com/AdguardTeam/companiesdb/blob/6a8fbfc3bff4fdffc4c8bae30756530afc2635bd/dist/trackers.json#L15}
     */
    static UNKNOWN_CATEGORY_NAME = 'unknown';
    /**
     * Companies database.
     */
    companiesDb = rawCompaniesDb;
    /**
     * Returns categories from the companiesdb data where
     * - key — numeric category id
     * - value — category name.
     *
     * @returns Categories from the companiesdb data.
     *
     * @throws Error if companies database is not loaded.
     */
    getCompaniesDbCategories() {
        if (!this.companiesDb) {
            throw new Error('[CompaniesDbService] Companies database is not loaded');
        }
        return this.companiesDb.categories;
    }
    /**
     * Matches a URL to a tracker category id.
     *
     * List of categories ids can be found in {@link companiesDb.categories}.
     *
     * @param url Request URL to match.
     *
     * @returns Matched company category name,
     * or {@link CompaniesDbService.UNKNOWN_CATEGORY_NAME} if the category is unknown.
     */
    match(url) {
        if (!this.companiesDb || !this.companiesDb.trackerDomains) {
            return CompaniesDbService.UNKNOWN_CATEGORY_NAME;
        }
        const domain = (0,tldts__WEBPACK_IMPORTED_MODULE_0__/* .getDomain */ .ge)(url);
        if (!domain) {
            return CompaniesDbService.UNKNOWN_CATEGORY_NAME;
        }
        const companyCategoryId = this.companiesDb.trackerDomains[domain];
        if (!companyCategoryId) {
            return CompaniesDbService.UNKNOWN_CATEGORY_NAME;
        }
        const companyCategoryName = this.companiesDb.categories[companyCategoryId];
        if (!companyCategoryName) {
            return CompaniesDbService.UNKNOWN_CATEGORY_NAME;
        }
        return companyCategoryName;
    }
}
const companiesDbService = new CompaniesDbService();

/**
 * Api for processing request filtering.
 *
 * Method {@link getBlockingResponse} processes rule applying for request and computes response
 * for {@link WebRequestApi.onBeforeRequest} listener.
 *
 * Method {@link shouldCollapseElement} checks, if initializer for request should be collapsed by content-script.
 *
 * This class also provides method {@link isRequestBlockedByRule} for checking, if rule is blocking rule.
 */
class RequestBlockingApi {
    /**
     * Checks if request rule is blocked.
     *
     * @param requestRule Request network rule or null.
     * @returns True, if rule is request blocking, else returns false.
     */
    static isRequestBlockedByRule(requestRule) {
        return !!requestRule
            && !requestRule.isAllowlist()
            && !requestRule.isOptionEnabled(NetworkRuleOption$1.Replace)
            && !requestRule.isOptionEnabled(NetworkRuleOption$1.Redirect);
    }
    /**
     * Closes the tab which considered as a popup.
     *
     * @param data Needed data for logging closing of tab.
     * @param appliedRule Network rule which was applied to request. This field
     * is needed because data contains two rules: one for the request and
     * one for the popup. And we should log only the rule which was applied
     * to the request.
     *
     * @returns Response for {@link RequestApi.onBeforeRequest} listener.
     */
    static closeTab(data, appliedRule) {
        RequestBlockingApi.logRuleApplying(data, appliedRule);
        browser.tabs.remove(data.tabId);
        return { cancel: true };
    }
    /**
     * Processes rule applying for request and compute response for {@link WebRequestApi.onBeforeRequest} listener.
     *
     * @param data Data for request processing.
     *
     * @returns Response for {@link WebRequestApi.onBeforeRequest} listener.
     */
    static getBlockingResponse(data) {
        const { rule, popupRule, requestType, tabId, eventId, requestId, requestUrl, contentType, referrerUrl, } = data;
        if (!rule) {
            return undefined;
        }
        // popup rule will be handled in the condition with requestType === document below
        if (popupRule === rule && requestType !== RequestType$2.Document) {
            return undefined;
        }
        if (rule.isAllowlist()) {
            RequestBlockingApi.logRuleApplying(data, rule);
            return undefined;
        }
        if (rule.isOptionEnabled(NetworkRuleOption$1.Redirect)) {
            defaultFilteringLog.publishEvent({
                type: FilteringEventType.ApplyBasicRule,
                data: {
                    tabId,
                    eventId,
                    requestType: contentType,
                    frameUrl: referrerUrl,
                    requestId,
                    requestUrl,
                    companyCategoryName: companiesDbService.match(requestUrl),
                    filterId: rule.getFilterListId(),
                    ruleIndex: rule.getIndex(),
                    isAllowlist: rule.isAllowlist(),
                    isImportant: rule.isOptionEnabled(NetworkRuleOption$1.Important),
                    isDocumentLevel: rule.isDocumentLevelAllowlistRule(),
                    isCsp: rule.isOptionEnabled(NetworkRuleOption$1.Csp),
                    isCookie: rule.isOptionEnabled(NetworkRuleOption$1.Cookie),
                    advancedModifier: rule.getAdvancedModifierValue(),
                    isAssuredlyBlocked: true,
                },
            });
            // TODO: Check that redirected url exists in our resources as in mv2.
            return { redirectUrl: '' };
        }
        // Basic rules for blocking requests are applied only to sub-requests
        // so `||example.com^` will not block the main page
        // https://adguard.com/kb/general/ad-filtering/create-own-filters/#basic-rules
        // For document requests we need to show blocking page or close tab.
        if (requestType === RequestType$2.Document) {
            // Blocking rule can be with $popup modifier - in this case we need
            // to close the tab as soon as possible.
            // https://adguard.com/kb/general/ad-filtering/create-own-filters/#popup-modifier
            if (popupRule && tabsApi.isNewPopupTab(tabId)) {
                return RequestBlockingApi.closeTab(data, popupRule);
            }
            // to handle rules with $all modifier, where popup was added implicitly
            if (rule.isOptionEnabled(NetworkRuleOption$1.Popup) && tabsApi.isNewPopupTab(tabId)) {
                return RequestBlockingApi.closeTab(data, rule);
            }
            // we do not want to block the main page if rule has only $popup modifier
            if (rule === popupRule && !tabsApi.isNewPopupTab(tabId)) {
                return undefined;
            }
            // but if the blocking rule has $document modifier, blocking page should be shown
            // e.g. `||example.com^$document`
            if ((rule.getPermittedRequestTypes() & RequestType$2.Document) === RequestType$2.Document) {
                RequestBlockingApi.logRuleApplying(data, rule);
                return { cancel: true };
            }
            return undefined;
        }
        RequestBlockingApi.logRuleApplying(data, rule);
        return { cancel: true };
    }
    /**
     * Creates {@link FilteringLog} event of rule applying for processed request.
     *
     * @param data Data for request processing.
     * @param appliedRule Network rule which was applied to request.
     */
    static logRuleApplying(data, appliedRule) {
        const { tabId, eventId, referrerUrl, requestId, requestUrl, requestType, contentType, } = data;
        if (!appliedRule || requestType === 0) {
            return;
        }
        defaultFilteringLog.publishEvent({
            type: FilteringEventType.ApplyBasicRule,
            data: {
                tabId,
                eventId,
                requestType: contentType,
                frameUrl: referrerUrl,
                requestId,
                requestUrl,
                filterId: appliedRule.getFilterListId(),
                ruleIndex: appliedRule.getIndex(),
                isAllowlist: appliedRule.isAllowlist(),
                isImportant: appliedRule.isOptionEnabled(NetworkRuleOption$1.Important),
                isDocumentLevel: appliedRule.isDocumentLevelAllowlistRule(),
                isCsp: appliedRule.isOptionEnabled(NetworkRuleOption$1.Csp),
                isCookie: appliedRule.isOptionEnabled(NetworkRuleOption$1.Cookie),
                advancedModifier: appliedRule.getAdvancedModifierValue(),
            },
        });
    }
}

/**
 * Content Security Policy Headers filtering service module.
 */
class CspService {
    /**
     * Applies CSP rules to response headers and returns modified headers.
     * It is applied when webRequest.onHeadersReceived event is fired.
     *
     * @param context Request context.
     */
    static onHeadersReceived(context) {
        const { matchingResult, responseHeaders, requestId, tabId, requestUrl, referrerUrl, } = context;
        if (!matchingResult) {
            return;
        }
        const cspHeaders = [];
        const cspRules = matchingResult.getCspRules();
        for (let i = 0; i < cspRules.length; i += 1) {
            const rule = cspRules[i];
            if (rule.isOptionEnabled(NetworkRuleOption$1.Header)) {
                const responseHeaderMatch = rule.matchResponseHeaders(responseHeaders);
                if (!responseHeaderMatch || rule.isAllowlist()) {
                    continue;
                }
            }
            // Don't forget: getCspRules returns all $csp rules, we must directly check that the rule is blocking.
            if (RequestBlockingApi.isRequestBlockedByRule(rule)) {
                const cspHeaderValue = rule.getAdvancedModifierValue();
                if (cspHeaderValue) {
                    cspHeaders.push({
                        name: CSP_HEADER_NAME$1,
                        value: cspHeaderValue,
                    });
                }
            }
            defaultFilteringLog.publishEvent({
                type: FilteringEventType.ApplyCspRule,
                data: {
                    tabId,
                    eventId: nanoid(),
                    requestUrl,
                    frameUrl: referrerUrl,
                    frameDomain: getDomain$1(referrerUrl),
                    requestType: ContentType.Csp,
                    filterId: rule.getFilterListId(),
                    ruleIndex: rule.getIndex(),
                    timestamp: Date.now(),
                    isAllowlist: rule.isAllowlist(),
                    isImportant: rule.isOptionEnabled(NetworkRuleOption$1.Important),
                    isDocumentLevel: rule.isDocumentLevelAllowlistRule(),
                    isCsp: rule.isOptionEnabled(NetworkRuleOption$1.Csp),
                    isCookie: rule.isOptionEnabled(NetworkRuleOption$1.Cookie),
                    advancedModifier: rule.getAdvancedModifierValue(),
                },
            });
        }
        if (cspHeaders.length > 0) {
            requestContextStorage.update(requestId, {
                responseHeaders: responseHeaders ? [...responseHeaders, ...cspHeaders] : cspHeaders,
            });
        }
    }
}

/**
 * Permissions Policy service.
 */
class PermissionsPolicyService {
    /**
     * Checks if a network rule is sub document rule.
     *
     * @param rule Rule to check.
     * @returns `true` if the rule is sub document rule.
     */
    static isSubDocumentRule(rule) {
        return (rule.getPermittedRequestTypes() & RequestType$2.SubDocument) === RequestType$2.SubDocument;
    }
    /**
     * Applies permissions policy directives to the response headers.
     * @param context Request context.
     */
    static onHeadersReceived(context) {
        const { matchingResult, responseHeaders, requestId, requestType, tabId, requestUrl, referrerUrl, } = context;
        if (!matchingResult) {
            return;
        }
        const permissionsPolicyRules = matchingResult.getPermissionsPolicyRules();
        const permissionsPolicyHeaders = [];
        if (permissionsPolicyRules.length === 0) {
            return;
        }
        // Check if a global allowlist rule is present.
        if (permissionsPolicyRules.some((rule) => rule.isAllowlist()
            && !rule.getAdvancedModifierValue()
            && !PermissionsPolicyService.isSubDocumentRule(rule))) {
            return;
        }
        for (let i = 0; i < permissionsPolicyRules.length; i += 1) {
            const rule = permissionsPolicyRules[i];
            // Sub frames can only be affected by a rule where the $subdocument modifier has been set.
            if (PermissionsPolicyService.isSubDocumentRule(rule) !== (requestType === RequestType$2.SubDocument)) {
                continue;
            }
            const directives = rule.getAdvancedModifierValue();
            if (directives) {
                if (!rule.isAllowlist()) {
                    permissionsPolicyHeaders.push({
                        name: PERMISSIONS_POLICY_HEADER_NAME$1,
                        value: directives,
                    });
                }
                defaultFilteringLog.publishEvent({
                    type: FilteringEventType.ApplyPermissionsRule,
                    data: {
                        tabId,
                        eventId: nanoid(),
                        requestUrl,
                        frameUrl: referrerUrl,
                        frameDomain: getDomain$1(referrerUrl),
                        requestType: ContentType.PermissionsPolicy,
                        filterId: rule.getFilterListId(),
                        ruleIndex: rule.getIndex(),
                        timestamp: Date.now(),
                        isAllowlist: rule.isAllowlist(),
                        isImportant: rule.isOptionEnabled(NetworkRuleOption$1.Important),
                        isDocumentLevel: rule.isDocumentLevelAllowlistRule(),
                        isCsp: rule.isOptionEnabled(NetworkRuleOption$1.Csp),
                        isCookie: rule.isOptionEnabled(NetworkRuleOption$1.Cookie),
                        advancedModifier: rule.getAdvancedModifierValue(),
                    },
                });
            }
        }
        requestContextStorage.update(requestId, {
            responseHeaders: responseHeaders ? [
                ...responseHeaders,
                ...permissionsPolicyHeaders,
            ] : permissionsPolicyHeaders,
        });
    }
}

/**
 * @file
 * API for applying rules from background service
 * by handling web Request API and web navigation events.
 *
 * This scheme describes flow for MV3.
 *
 * Event data is aggregated into two contexts: {@link RequestContext},
 * which contains data about the specified request
 * and {@link TabContext} which contains data about the specified tab and frames inside it.
 *
 * Applying {@link NetworkRule} from the background page:
 *
 * The cssText, scriptText, scriptletDataList for specified frame are calculated and stored in tab context storage,
 * at the time {@link RequestEvents.onBeforeRequest} or {@link WebNavigation.onBeforeNavigate} is processed.
 * In the most cases the onBeforeNavigate event is processed before onBeforeRequest.
 *
 * At {@link RequestEvents.onBeforeSendHeaders}, the request headers will be parsed to apply $cookie rules
 * based on the {@link MatchingResult} stored in {@link requestContextStorage}.
 * At {@link RequestEvents.onHeadersReceived}, the response headers are handled in the same way.
 *
 * At {@link RequestEvents.onErrorOccurred}, the blocked request url will be matched by {@link companiesDbService}
 * for collecting precise statistics of blocked requests.
 *
 * The specified {@link RequestContext} or frame context {@link Frame} will be removed from the storage
 * on {@link WebNavigation.onCommitted} after injection or {@link RequestEvents.onErrorOccurred} events.
 *
 *
 * Web Request API Event Handling:
 *
 *                                       ┌─────────────────────────────┐
 * Matches {@link MatchingResult}        │                             │
 * for the request.                      │       onBeforeRequest       ◄─┐
 * If this is a frame request,           │                             │ │
 * also matches the                      └──────────────┬──────────────┘ │
 * {@link CosmeticResult}                               │                │
 *                                                      │                │
 *                                                      │                │
 *                                       ┌──────────────▼──────────────┐ │
 * Parses request headers and applies    │                             │ │
 * $cookie rules based on                │      onBeforeSendHeaders    ◄─┼─┐
 * {@link MatchingResult}.               │                             │ │ │
 *                                       └──────────────┬──────────────┘ │ │
 *                                                      │                │ │
 *                                       ┌──────────────▼──────────────┐ │ │
 *                                       │                             │ │ │
 *                                       │        onSendHeaders        │ │ │
 *                                       │                             │ │ │
 *                                       └──────────────┬──────────────┘ │ │
 *                                                      │                │ │
 *                                       ┌──────────────▼──────────────┐ │ │
 * Parses response headers and applies   │                             │ │ │
 * $cookie rules based on              ┌─┤      onHeadersReceived      │ │ │
 * {@link MatchingResult}.             │ │                             │ │ │
 *                                     │ └─────────────────────────────┘ │ │
 *                                     │                                 │ │
 *                                     │ ┌─────────────────────────────┐ │ │
 *                                     │ │                             │ │ │
 *                                     ├─►       onBeforeRedirect      ├─┘ │
 *                                     │ │                             │   │
 *                                     │ └─────────────────────────────┘   │
 *                                     │                                   │
 *                                     │ ┌─────────────────────────────┐   │
 *                                     │ │                             │   │
 *                                     ├─►        onAuthRequired       ├───┘
 *                                     │ │                             │
 *                                     │ └─────────────────────────────┘
 *                                     │
 *   On response started               │ ┌─────────────────────────────┐
 *   We try to inject js               │ │                             │
 *                                     └─►      onResponseStarted      │
 *                                       │                             │
 *                                       └──────────────┬──────────────┘
 *                                                      │
 *                                       ┌──────────────▼──────────────┐
 *                                       │                             │
 * Removes the request information       │         onCompleted         │
 * from {@link requestContextStorage}.   │                             │
 *                                       └─────────────────────────────┘.
 *
 *                                       ┌─────────────────────────────┐
 * Matches blocked request url           │                             │
 * by {@link companiesDbService}         │                             │
 * for collecting statistics.            │       onErrorOccurred       │
 * Also removes the request information  │                             │
 * from {@link requestContextStorage}.   │                             │
 *                                       └─────────────────────────────┘.
 *
 *
 *  Web Navigation API Event Handling:
 *
 *                                       ┌─────────────────────────────┐
 *                                       │                             │
 *                                       │  onCreatedNavigationTarget  │
 *                                       │                             │
 *                                       └──────────────┬──────────────┘
 *                                                      │
 *                                       ┌──────────────▼──────────────┐
 * Update main frame data with           │                             │
 * {@link updateMainFrameData}           │       onBeforeNavigate      │
 * and matches CosmeticResult            │                             │
 *                                       └──────────────┬──────────────┘
 *                                                      │
 *                                       ┌──────────────▼──────────────┐
 * Try injecting js and css              │                             │
 * into the frame with source            │         onCommitted         │
 * based on {@link CosmeticRule}.        │                             │
 * and remove data from the              └──────────────┬──────────────┘
 * {@link RequestContextStorage}                        │
 *                                       ┌──────────────▼──────────────┐
 *                                       │                             │
 *                                       │      onDOMContentLoaded     ├─┐
 *                                       │                             │ │
 *                                       └──────────────┬──────────────┘ │
 *                                                      │                │
 *                                       ┌──────────────▼──────────────┐ │
 * Remove the frame data                 │                             │ │
 * from {@link TabContext}.            ┌─┤         onCompleted         │ │
 *                                     │ │                             │ │
 *                                     │ └─────────────────────────────┘ │
 *                                     │                                 │
 *                                     │ ┌─────────────────────────────┐ │
 *                                     │ │                             │ │
 *                                     ├─►    onHistoryStateUpdated    ◄─┤
 *                                     │ │                             │ │
 *                                     │ └─────────────────────────────┘ │
 *                                     │                                 │
 *                                     │ ┌─────────────────────────────┐ │
 *                                     │ │                             │ │
 *                                     └─►  onReferenceFragmentUpdated ◄─┘
 *                                       │                             │
 *                                       └─────────────────────────────┘.
 *
 *                                       ┌─────────────────────────────┐
 * Remove the frame data                 │                             │
 * from {@link TabContext}.              │       onErrorOccurred       │
 *                                       │                             │
 *                                       └─────────────────────────────┘.
 */
/**
 * API for applying rules from background service by handling
 * Web Request API and web navigation events.
 *
 * Calculates matchingResult and cosmeticResult and saves them to the cache
 * related to pair tabId+documentId to save execution time of future requests
 * cosmetic rules from content-script.
 */
class WebRequestApi {
    /**
     * Value of the parent frame id if no parent frame exists.
     *
     * @see {@link WebRequest.OnBeforeRequestDetailsType#parentFrameId}
     */
    static NO_PARENT_FRAME_ID = (/* unused pure expression or super */ null && (-1));
    /**
     * Adds listeners to web request events.
     */
    static start() {
        // browser.webRequest Events
        RequestEvents.onBeforeRequest.addListener(WebRequestApi.onBeforeRequest);
        RequestEvents.onResponseStarted.addListener(WebRequestApi.onResponseStarted);
        RequestEvents.onBeforeSendHeaders.addListener(WebRequestApi.onBeforeSendHeaders);
        RequestEvents.onHeadersReceived.addListener(WebRequestApi.onHeadersReceived);
        RequestEvents.onErrorOccurred.addListener(WebRequestApi.onErrorOccurred);
        RequestEvents.onCompleted.addListener(WebRequestApi.onCompleted);
        // browser.webNavigation Events
        // 'chrome' is used here because MV3 is mainly for Chrome,
        // and it provides better types compared to 'browser' from webextension-polyfill.
        chrome.webNavigation.onBeforeNavigate.addListener(WebRequestApi.onBeforeNavigate);
        chrome.webNavigation.onCommitted.addListener(WebRequestApi.onCommitted);
        browser.webNavigation.onErrorOccurred.addListener(WebRequestApi.deleteFrameContext);
        browser.webNavigation.onCompleted.addListener(WebRequestApi.deleteFrameContext);
    }
    /**
     * Removes web request event handlers.
     */
    static stop() {
        // browser.webRequest Events
        RequestEvents.onBeforeRequest.removeListener(WebRequestApi.onBeforeRequest);
        RequestEvents.onResponseStarted.removeListener(WebRequestApi.onResponseStarted);
        RequestEvents.onBeforeSendHeaders.removeListener(WebRequestApi.onBeforeSendHeaders);
        RequestEvents.onHeadersReceived.removeListener(WebRequestApi.onHeadersReceived);
        RequestEvents.onErrorOccurred.removeListener(WebRequestApi.onErrorOccurred);
        RequestEvents.onCompleted.removeListener(WebRequestApi.onCompleted);
        // browser.webNavigation Events
        chrome.webNavigation.onBeforeNavigate.removeListener(WebRequestApi.onBeforeNavigate);
        chrome.webNavigation.onCommitted.removeListener(WebRequestApi.onCommitted);
        browser.webNavigation.onErrorOccurred.removeListener(WebRequestApi.deleteFrameContext);
        browser.webNavigation.onCompleted.removeListener(WebRequestApi.deleteFrameContext);
    }
    /**
     * Flush browser in-memory cache.
     *
     * This function is called after an engine update or filtering switch to ensure
     * that new rules are applied to requests that may have been cached by the browser.
     */
    static async flushMemoryCache() {
        try {
            await browser.webRequest.handlerBehaviorChanged();
        }
        catch (e) {
            const errorMessage = getErrorMessage(e);
            throw new Error(`Cannot flush memory cache and call browser.handlerBehaviorChanged: ${errorMessage}`);
        }
    }
    /**
     * On before request event handler. This is the earliest event in the chain of the web request events.
     *
     * @param details Request details.
     * @param details.context Request context.
     */
    static onBeforeRequest({ context }) {
        if (!context) {
            return;
        }
        // TODO: In getBlockingResponse we need extract requestType from context
        // to save it for filtering log. Check, if we really need this in MV3.
        const { requestType, requestUrl, referrerUrl, requestId, method, tabId, frameId, eventId, contentType, timestamp, thirdParty, } = context;
        if (!isHttpOrWsRequest(requestUrl)) {
            return;
        }
        // We do not check for exists request context here (as it was in MV2),
        // because in MV3 $removeparam rules are applied by browser and does not
        // require page reload after the applying.
        if (requestType === RequestType$2.Document) {
            // dispatch filtering log reload event
            defaultFilteringLog.publishEvent({
                type: FilteringEventType.TabReload,
                data: { tabId },
            });
        }
        defaultFilteringLog.publishEvent({
            type: FilteringEventType.SendRequest,
            data: {
                tabId,
                eventId,
                requestUrl,
                requestDomain: getDomain(requestUrl),
                frameUrl: referrerUrl,
                frameDomain: getDomain(referrerUrl),
                requestType: contentType,
                timestamp,
                requestThirdParty: thirdParty,
                method,
            },
        });
        let frameRule;
        if (requestType === RequestType$2.SubDocument) {
            frameRule = DocumentApi.matchFrame(referrerUrl);
        }
        else {
            frameRule = tabsApi.getTabFrameRule(tabId);
        }
        const result = engineApi.matchRequest({
            requestUrl,
            frameUrl: referrerUrl,
            requestType,
            frameRule,
            method,
        });
        if (!result) {
            return;
        }
        // Save matching result to the request context
        requestContextStorage.update(requestId, {
            matchingResult: result,
        });
        if (requestType === RequestType$2.Document || requestType === RequestType$2.SubDocument) {
            CosmeticFrameProcessor.precalculateCosmetics({
                tabId,
                frameId,
                url: requestUrl,
                timeStamp: timestamp,
            });
        }
        const basicResult = result.getBasicResult();
        const response = RequestBlockingApi.getBlockingResponse({
            rule: basicResult,
            popupRule: result.getPopupRule(),
            eventId,
            requestId,
            requestUrl,
            referrerUrl,
            requestType,
            contentType,
            tabId,
        });
        // redirects should be considered as blocked for the tab blocked request count
        // which is displayed on the extension badge
        // https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2443
        if (response?.cancel || response?.redirectUrl !== undefined) {
            tabsApi.incrementTabBlockedRequestCount(tabId, referrerUrl);
        }
    }
    /**
     * On response started event handler.
     *
     * @param event On response started event.
     * @param event.context Event context.
     */
    static onResponseStarted({ context }) {
        if (!context) {
            return;
        }
        const { requestType, tabId, frameId } = context;
        if (requestType !== RequestType$2.Document
            && requestType !== RequestType$2.SubDocument) {
            return;
        }
        CosmeticApi.applyJsFuncsByTabAndFrame(tabId, frameId);
        CosmeticApi.applyScriptletsByTabAndFrame(tabId, frameId);
    }
    /**
     * On before send headers event handler.
     *
     * @param details On before send headers details.
     * @param details.context Details context.
     */
    static onBeforeSendHeaders({ context }) {
        if (!context) {
            return;
        }
        const { referrerUrl, tabId, } = context;
        /**
         * TODO: Remove Cookie header from requests initiated by the background
         * extension via Declarative Net Request to implement SanitizeApi
         * functionality from MV2.
         */
        if (tabId === BACKGROUND_TAB_ID && isExtensionUrl(referrerUrl)) {
            return;
        }
        // If the current request does not comply with any rules - we do not
        // need to call any other processing services (e.g. cookie, header)
        if (context?.matchingResult) {
            cookieFiltering.onBeforeSendHeaders(context);
        }
    }
    /**
     * On headers received event handler.
     *
     * @param event On headers received event.
     * @param event.context Event context.
     * @param event.details On headers received details.
     */
    static onHeadersReceived({ context, details, }) {
        if (!context) {
            return;
        }
        defaultFilteringLog.publishEvent({
            type: FilteringEventType.ReceiveResponse,
            data: {
                tabId: context.tabId,
                // It's important to use same eventId as onBeforeRequest to match
                // the request in the filtering log and update it's status.
                eventId: context.eventId,
                statusCode: details.statusCode,
            },
        });
        const { requestUrl, requestType } = context;
        if (requestUrl && (requestType === RequestType$2.Document || requestType === RequestType$2.SubDocument)) {
            CspService.onHeadersReceived(context);
            PermissionsPolicyService.onHeadersReceived(context);
        }
        cookieFiltering.onHeadersReceived(context);
    }
    /**
     * On before navigate web navigation event handler.
     *
     * @param details Event details.
     */
    static async onBeforeNavigate(details) {
        const { tabId, frameId, url, parentDocumentId, timeStamp, } = details;
        CosmeticFrameProcessor.precalculateCosmetics({
            tabId,
            frameId,
            url,
            timeStamp,
            parentDocumentId,
        });
    }
    /**
     * Event handler for onErrorOccurred event. It fires when an error occurs, e.g. request is blocked.
     * So if the request is blocked by DNR rule,
     * we should log this event for collecting statistics due to {@link companiesDbService}.
     *
     * @param event On error occurred event.
     * @param event.details On error occurred event details.
     */
    static onErrorOccurred({ details, }) {
        const { tabId, requestId, url, parentFrameId, error, } = details;
        /**
         * Error related to request blocking by DNR rule.
         */
        const CLIENT_BLOCKED_ERROR = 'net::ERR_BLOCKED_BY_CLIENT';
        // filter out non-related errors, e.g. 'net::ERR_ABORTED'
        if (error !== CLIENT_BLOCKED_ERROR) {
            return;
        }
        const context = requestContextStorage.get(requestId);
        if (!context) {
            return;
        }
        const { eventId, referrerUrl, contentType, } = context;
        // TODO: we consider that only we block requests,
        // so we do not care (for now) if the request is blocked by other browser extension.
        // it may be handled by checking the matchingResult in the context.
        const companyCategoryName = companiesDbService.match(url);
        defaultFilteringLog.publishEvent({
            type: FilteringEventType.ApplyBasicRule,
            data: {
                tabId,
                eventId,
                requestType: contentType,
                frameUrl: referrerUrl,
                requestId,
                requestUrl: url,
                companyCategoryName,
                filterId: null,
                ruleIndex: null,
                isAllowlist: false,
                isImportant: false,
                isDocumentLevel: parentFrameId === WebRequestApi.NO_PARENT_FRAME_ID,
                isCsp: false,
                isCookie: false,
                advancedModifier: null,
                isAssuredlyBlocked: true,
            },
        });
        WebRequestApi.deleteRequestContext(details.requestId);
    }
    /**
     * Handler for the last event in the request lifecycle.
     *
     * @param event The event that occurred upon completion of the request.
     * @param event.context The context of the completed event.
     */
    static onCompleted({ context, }) {
        if (!context) {
            return;
        }
        const { tabId, frameId, requestUrl, requestType, contentType, timestamp, } = context;
        if (requestType === RequestType$2.Document || requestType === RequestType$2.SubDocument) {
            const frameContext = tabsApi.getFrameContext(tabId, frameId);
            if (!frameContext?.cosmeticResult) {
                // eslint-disable-next-line max-len
                logger.debug(`[RequestEvents.onCompleted]: cannot log script rules due to not having cosmetic result for tabId: ${tabId}, frameId: ${frameId}.`);
                return;
            }
            CosmeticApi.logScriptRules({
                tabId,
                cosmeticResult: frameContext.cosmeticResult,
                url: requestUrl,
                contentType,
                timestamp,
            });
        }
        WebRequestApi.deleteRequestContext(context.requestId);
    }
    /**
     * Deletes the request context immediately or after a timeout,
     * depending on whether declarativeFilteringLog is listening.
     *
     * @param requestId The ID of the request.
     */
    static deleteRequestContext(requestId) {
        // If declarativeFilteringLog is listening, wait for a specified timeout
        // before deleting the request context to extract the context event ID,
        // allowing the request to be linked with the matched declarative rule.
        if (declarativeFilteringLog.isListening) {
            setTimeout(() => {
                requestContextStorage.delete(requestId);
            }, FRAME_DELETION_TIMEOUT_MS);
        }
        else {
            requestContextStorage.delete(requestId);
        }
    }
    /**
     * Delete frame data from tab context when navigation is finished.
     * @param details Navigation event details.
     */
    static deleteFrameContext(details) {
        const { tabId, frameId } = details;
        setTimeout(() => {
            tabsApi.deleteFrameContext(tabId, frameId, FRAME_DELETION_TIMEOUT_MS);
        }, FRAME_DELETION_TIMEOUT_MS);
    }
    /**
     * On WebNavigation.onCommitted event we will try to inject scripts into tab.
     *
     * @param details Navigation event details.
     */
    static onCommitted(details) {
        const { tabId, frameId, documentId } = details;
        // This is necessary mainly to update documentId
        tabsApi.updateFrameContext(tabId, frameId, { documentId });
        // Note: this is an async function, but we will not await it because
        // events do not support async listeners.
        Promise.all([
            CosmeticApi.applyJsFuncsByTabAndFrame(tabId, frameId),
            CosmeticApi.applyCssByTabAndFrame(tabId, frameId),
            CosmeticApi.applyScriptletsByTabAndFrame(tabId, frameId),
        ]).catch((e) => logger.error(e));
    }
}

const searchEngineDomains = (/* unused pure expression or super */ null && ([
    // Google domains
    // src: https://www.google.com/supported_domains
    'google.com',
    'google.ad',
    'google.ae',
    'google.com.af',
    'google.com.ag',
    'google.al',
    'google.am',
    'google.co.ao',
    'google.com.ar',
    'google.as',
    'google.at',
    'google.com.au',
    'google.az',
    'google.ba',
    'google.com.bd',
    'google.be',
    'google.bf',
    'google.bg',
    'google.com.bh',
    'google.bi',
    'google.bj',
    'google.com.bn',
    'google.com.bo',
    'google.com.br',
    'google.bs',
    'google.bt',
    'google.co.bw',
    'google.by',
    'google.com.bz',
    'google.ca',
    'google.cd',
    'google.cf',
    'google.cg',
    'google.ch',
    'google.ci',
    'google.co.ck',
    'google.cl',
    'google.cm',
    'google.cn',
    'google.com.co',
    'google.co.cr',
    'google.com.cu',
    'google.cv',
    'google.com.cy',
    'google.cz',
    'google.de',
    'google.dj',
    'google.dk',
    'google.dm',
    'google.com.do',
    'google.dz',
    'google.com.ec',
    'google.ee',
    'google.com.eg',
    'google.es',
    'google.com.et',
    'google.fi',
    'google.com.fj',
    'google.fm',
    'google.fr',
    'google.ga',
    'google.ge',
    'google.gg',
    'google.com.gh',
    'google.com.gi',
    'google.gl',
    'google.gm',
    'google.gr',
    'google.com.gt',
    'google.gy',
    'google.com.hk',
    'google.hn',
    'google.hr',
    'google.ht',
    'google.hu',
    'google.co.id',
    'google.ie',
    'google.co.il',
    'google.im',
    'google.co.in',
    'google.iq',
    'google.is',
    'google.it',
    'google.je',
    'google.com.jm',
    'google.jo',
    'google.co.jp',
    'google.co.ke',
    'google.com.kh',
    'google.ki',
    'google.kg',
    'google.co.kr',
    'google.com.kw',
    'google.kz',
    'google.la',
    'google.com.lb',
    'google.li',
    'google.lk',
    'google.co.ls',
    'google.lt',
    'google.lu',
    'google.lv',
    'google.com.ly',
    'google.co.ma',
    'google.md',
    'google.me',
    'google.mg',
    'google.mk',
    'google.ml',
    'google.com.mm',
    'google.mn',
    'google.com.mt',
    'google.mu',
    'google.mv',
    'google.mw',
    'google.com.mx',
    'google.com.my',
    'google.co.mz',
    'google.com.na',
    'google.com.ng',
    'google.com.ni',
    'google.ne',
    'google.nl',
    'google.no',
    'google.com.np',
    'google.nr',
    'google.nu',
    'google.co.nz',
    'google.com.om',
    'google.com.pa',
    'google.com.pe',
    'google.com.pg',
    'google.com.ph',
    'google.com.pk',
    'google.pl',
    'google.pn',
    'google.com.pr',
    'google.ps',
    'google.pt',
    'google.com.py',
    'google.com.qa',
    'google.ro',
    'google.ru',
    'google.rw',
    'google.com.sa',
    'google.com.sb',
    'google.sc',
    'google.se',
    'google.com.sg',
    'google.sh',
    'google.si',
    'google.sk',
    'google.com.sl',
    'google.sn',
    'google.so',
    'google.sm',
    'google.sr',
    'google.st',
    'google.com.sv',
    'google.td',
    'google.tg',
    'google.co.th',
    'google.com.tj',
    'google.tl',
    'google.tm',
    'google.tn',
    'google.to',
    'google.com.tr',
    'google.tt',
    'google.com.tw',
    'google.co.tz',
    'google.com.ua',
    'google.co.ug',
    'google.co.uk',
    'google.com.uy',
    'google.co.uz',
    'google.com.vc',
    'google.co.ve',
    'google.co.vi',
    'google.com.vn',
    'google.vu',
    'google.ws',
    'google.rs',
    'google.co.za',
    'google.co.zm',
    'google.co.zw',
    'google.cat',
    // Yandex domains
    // src: https://serpapi.com/yandex-domains
    'yandex.com',
    'yandex.ru',
    'ya.ru',
    'yandex.by',
    'yandex.kz',
    'yandex.uz',
    'yandex.com.tr',
    'yandex.fr',
    'yandex.az',
    'yandex.com.ge',
    'yandex.com.am',
    'yandex.co.il',
    'yandex.lv',
    'yandex.lt',
    'yandex.ee',
    'yandex.md',
    'yandex.tm',
    'yandex.tj',
    'yandex.eu',
    // Other search engines
    'yahoo.com',
    'bing.com',
    'go.mail.ru',
    'ask.com',
    'aol.com',
    'baidu.com',
    'seznam.cz',
]));

/**
 * Reserved stealth rule ids for the DNR.
 */
var StealthRuleId;
(function (StealthRuleId) {
    StealthRuleId[StealthRuleId["HideReferrer"] = 1] = "HideReferrer";
    StealthRuleId[StealthRuleId["BlockChromeClientData"] = 2] = "BlockChromeClientData";
    StealthRuleId[StealthRuleId["SendDoNotTrack"] = 3] = "SendDoNotTrack";
    StealthRuleId[StealthRuleId["HideSearchQueries"] = 4] = "HideSearchQueries";
})(StealthRuleId || (StealthRuleId = {}));
/**
 * Reserved stealth content script ids.
 */
var StealthContentScriptId;
(function (StealthContentScriptId) {
    StealthContentScriptId["Gpc"] = "gpc";
    StealthContentScriptId["DocumentReferrer"] = "documentReferrer";
})(StealthContentScriptId || (StealthContentScriptId = {}));
/**
 * Stealth service module.
 */
class StealthService {
    /**
     * Required permissions for the stealth options related to browser settings.
     */
    static REQUIRED_PERMISSIONS = (/* unused pure expression or super */ null && (['privacy']));
    /**
     * Scope of the applied browser setting related to the stealth options.
     * Regular scope means that the setting is applied to the both incognito and regular windows.
     */
    static SETTING_SCOPE = (/* unused pure expression or super */ null && ('regular'));
    /**
     * Types of resources to apply the stealth declarative network rules.
     *
     * @returns Array of resource types.
     */
    static get RESOURCE_TYPES() {
        return [
            chrome.declarativeNetRequest.ResourceType.MAIN_FRAME,
            chrome.declarativeNetRequest.ResourceType.SUB_FRAME,
            chrome.declarativeNetRequest.ResourceType.STYLESHEET,
            chrome.declarativeNetRequest.ResourceType.SCRIPT,
            chrome.declarativeNetRequest.ResourceType.IMAGE,
            chrome.declarativeNetRequest.ResourceType.FONT,
            chrome.declarativeNetRequest.ResourceType.OBJECT,
            chrome.declarativeNetRequest.ResourceType.XMLHTTPREQUEST,
            chrome.declarativeNetRequest.ResourceType.PING,
            chrome.declarativeNetRequest.ResourceType.CSP_REPORT,
            chrome.declarativeNetRequest.ResourceType.MEDIA,
            chrome.declarativeNetRequest.ResourceType.WEBSOCKET,
            chrome.declarativeNetRequest.ResourceType.OTHER,
        ];
    }
    /**
     * Applies the stealth options from the settings configuration.
     * @param settingsConfig Settings configuration.
     */
    static async applySettings(settingsConfig) {
        const { stealthModeEnabled, stealth, gpcScriptUrl, hideDocumentReferrerScriptUrl, } = settingsConfig;
        const result = await Promise.allSettled([
            StealthService.setHideReferrer(stealthModeEnabled && stealth.hideReferrer),
            StealthService.setDisableWebRTC(stealthModeEnabled && stealth.blockWebRTC),
            StealthService.setBlockChromeClientData(stealthModeEnabled && stealth.blockChromeClientData),
            StealthService.setSendDoNotTrack(stealthModeEnabled && stealth.sendDoNotTrack, gpcScriptUrl),
            StealthService.setHideSearchQueries(stealthModeEnabled && stealth.hideSearchQueries, hideDocumentReferrerScriptUrl),
        ]);
        // FIXME: dispatch event/message to display error in extension UI
        // or update ConfigurationResult record in `app.ts`
        result.forEach((promise) => {
            if (promise.status === 'rejected') {
                logger.error('[tswebextension.applySettings]: error on applying stealth settings: ', promise.reason);
            }
        });
    }
    /**
     * Set the referrer header to be hidden.
     *
     * @param isReferrerHidden Flag that determines if the referrer should be hidden.
     * @returns Promise that resolves when the referrer setting is set.
     */
    static async setHideReferrer(isReferrerHidden) {
        if (!isReferrerHidden) {
            return StealthService.removeSessionRule(StealthRuleId.HideReferrer);
        }
        return StealthService.setSessionRule({
            id: StealthRuleId.HideReferrer,
            action: {
                type: chrome.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,
                requestHeaders: [{
                        header: 'Referer',
                        operation: chrome.declarativeNetRequest.HeaderOperation.REMOVE,
                    }],
            },
            condition: {
                urlFilter: '*',
                resourceTypes: StealthService.RESOURCE_TYPES,
            },
        });
    }
    /**
     * If {@link isBlockChromeClientData} is true, add the declarative network rule to remove
     * `X-Client-Data` header from every request.
     *
     * @param isBlockChromeClientData Flag that determines if the `X-Client-Data` header is removed.
     * @returns Promise that resolves when the rule is set or removed.
     */
    static async setBlockChromeClientData(isBlockChromeClientData) {
        if (!isBlockChromeClientData) {
            return StealthService.removeSessionRule(StealthRuleId.BlockChromeClientData);
        }
        return StealthService.setSessionRule({
            id: StealthRuleId.BlockChromeClientData,
            action: {
                type: chrome.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,
                requestHeaders: [{
                        header: 'X-Client-Data',
                        operation: chrome.declarativeNetRequest.HeaderOperation.REMOVE,
                    }],
            },
            condition: {
                urlFilter: '*',
                resourceTypes: StealthService.RESOURCE_TYPES,
            },
        });
    }
    /**
     * If {@link isSendDoNotTrack} is true, add the declarative network rule to set `DNT`
     * and `Sec-GPC` headers for every request.
     *
     * @param isSendDoNotTrack Flag that determines if the `Do Not Track` and `Global Privacy Control` signals is set.
     * @param gpcScriptUrl Path to content script for injecting GPC signal.
     * @returns Promise that resolves when the rule is set or removed.
     */
    static async setSendDoNotTrack(isSendDoNotTrack, gpcScriptUrl) {
        if (!isSendDoNotTrack) {
            await Promise.all([
                StealthService.removeSessionRule(StealthRuleId.SendDoNotTrack),
                StealthService.removeContentScript(StealthContentScriptId.Gpc),
            ]);
            return;
        }
        await Promise.all([
            StealthService.setSessionRule({
                id: StealthRuleId.SendDoNotTrack,
                action: {
                    type: chrome.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,
                    requestHeaders: [{
                            header: 'DNT',
                            operation: chrome.declarativeNetRequest.HeaderOperation.SET,
                            value: '1',
                        }, {
                            header: 'Sec-GPC',
                            operation: chrome.declarativeNetRequest.HeaderOperation.SET,
                            value: '1',
                        }],
                },
                condition: {
                    urlFilter: '*',
                    resourceTypes: StealthService.RESOURCE_TYPES,
                },
            }),
            StealthService.setContentScript({
                id: StealthContentScriptId.Gpc,
                js: [gpcScriptUrl],
                world: 'MAIN',
                runAt: 'document_start',
                matches: [
                    'http://*/*',
                    'https://*/*',
                ],
                persistAcrossSessions: false,
            }),
        ]);
    }
    /**
     * If {@link isHideSearchQueries} is true, adds the declarative network rule to set the
     * `Referrer-Policy` header to `no-referrer` for the search pages like Google, Bing, etc.
     *
     * @param isHideSearchQueries Flag that determines if the search queries should be hidden.
     * @param hideDocumentReferrerScriptUrl Path to content script for hiding the document referrer.
     * @returns Promise that resolves when the rule is set or removed.
     */
    static async setHideSearchQueries(isHideSearchQueries, hideDocumentReferrerScriptUrl) {
        if (!isHideSearchQueries) {
            await Promise.all([
                StealthService.removeSessionRule(StealthRuleId.HideSearchQueries),
                StealthService.removeContentScript(StealthContentScriptId.DocumentReferrer),
            ]);
            return;
        }
        await Promise.all([
            StealthService.setSessionRule({
                id: StealthRuleId.HideSearchQueries,
                action: {
                    type: chrome.declarativeNetRequest.RuleActionType.MODIFY_HEADERS,
                    requestHeaders: [{
                            header: 'Referer',
                            operation: chrome.declarativeNetRequest.HeaderOperation.REMOVE,
                        }],
                },
                condition: {
                    urlFilter: '*',
                    resourceTypes: StealthService.RESOURCE_TYPES,
                    initiatorDomains: searchEngineDomains,
                },
            }),
            StealthService.setContentScript({
                id: StealthContentScriptId.DocumentReferrer,
                js: [hideDocumentReferrerScriptUrl],
                world: 'MAIN',
                runAt: 'document_start',
                matches: [
                    'http://*/*',
                    'https://*/*',
                ],
                persistAcrossSessions: false,
            }),
        ]);
    }
    /**
     * If {@link isWebRTCDisabled} is true, sets the browser IP policy to `disable_non_proxied_udp`,
     * otherwise restore default policy.
     *
     * @param isWebRTCDisabled Flag that determines if the WebRTC should be disabled.
     * @throws Error if the permissions are not granted, but required to set the WebRTC policy.
     * @returns Promise that resolves when the WebRTC policy is set or restored.
     */
    static async setDisableWebRTC(isWebRTCDisabled) {
        const isPermissionGranted = await chrome.permissions.contains({
            permissions: StealthService.REQUIRED_PERMISSIONS,
        });
        if (!isPermissionGranted) {
            // If the option is disabled, do nothing.
            if (!isWebRTCDisabled) {
                return;
            }
            // Otherwise, throw an error.
            throw new Error(`Permissions are not granted: ${StealthService.REQUIRED_PERMISSIONS.join(', ')}`);
        }
        const setting = chrome.privacy.network.webRTCIPHandlingPolicy;
        if (isWebRTCDisabled) {
            await StealthService.setSetting(setting, 'disable_non_proxied_udp');
        }
        else {
            await StealthService.clearSetting(setting);
        }
    }
    /**
     * Sets the browser settings value.
     *
     * @param setting Webextension setting API.
     * @param value Setting value to set.
     * @returns Resolves when the setting is set.
     * @throws Error if the setting is not controllable or controlled by other extensions.
     */
    static async setSetting(setting, value) {
        await StealthService.validateLevelOfControl(setting);
        return new Promise((resolve, reject) => {
            setting.set({
                value,
                scope: StealthService.SETTING_SCOPE,
            }, () => {
                if (chrome.runtime.lastError) {
                    reject(chrome.runtime.lastError);
                }
                else {
                    resolve();
                }
            });
        });
    }
    /**
     * Gets the browser settings value and webextension level of control.
     * @param setting Webextension browser setting API.
     * @returns Resolved promise with the setting value and level of control.
     * @throws Error if something went wrong.
     */
    static async getSetting(setting) {
        return new Promise((resolve, reject) => {
            setting.get({}, (details) => {
                if (chrome.runtime.lastError) {
                    reject(chrome.runtime.lastError);
                }
                else {
                    resolve(details);
                }
            });
        });
    }
    /**
     * Sets the browser settings value to the default.
     * @param setting Webextension browser setting API.
     * @returns Resolved promise when the setting is cleared.
     * @throws Error if something went wrong.
     */
    static async clearSetting(setting) {
        await StealthService.validateLevelOfControl(setting);
        return new Promise((resolve, reject) => {
            setting.clear({
                scope: StealthService.SETTING_SCOPE,
            }, () => {
                if (chrome.runtime.lastError) {
                    reject(chrome.runtime.lastError);
                }
                else {
                    resolve();
                }
            });
        });
    }
    /**
     * Checks if the setting is controllable.
     *
     * @param setting Webextension browser setting API.
     * @throws Error, if setting is not controllable.
     */
    static async validateLevelOfControl(setting) {
        const { levelOfControl } = await StealthService.getSetting(setting);
        if (levelOfControl === 'not_controllable') {
            throw new Error('Setting is not controllable');
        }
        if (levelOfControl === 'controlled_by_other_extensions') {
            throw new Error('Setting is controlled by other extensions');
        }
    }
    /**
     * Set the stealth rule in the session ruleset.
     * If the rule with the same id already exists, it will be replaced.
     *
     * @param rule Stealth rule to set.
     * @returns Resolved promise when the rule is set.
     */
    static async setSessionRule(rule) {
        return chrome.declarativeNetRequest.updateSessionRules({
            addRules: [rule],
            removeRuleIds: [rule.id],
        });
    }
    /**
     * Remove the stealth rule from the session ruleset.
     *
     * @param ruleId Stealth rule id.
     * @returns Resolved promise when the rule is removed.
     */
    static async removeSessionRule(ruleId) {
        return chrome.declarativeNetRequest.updateSessionRules({
            removeRuleIds: [ruleId],
        });
    }
    /**
     * Unregister content script with specified {@link contentScriptId}.
     * If content script is not found, do nothing.
     * @param contentScriptId Content script id.
     */
    static async removeContentScript(contentScriptId) {
        const existedContentScripts = await chrome.scripting.getRegisteredContentScripts({
            ids: [contentScriptId],
        });
        if (existedContentScripts.length > 0) {
            await chrome.scripting.unregisterContentScripts({
                ids: existedContentScripts.map(((script) => script.id)),
            });
        }
    }
    /**
     * Register content script.
     * If content script with {@link contentScript} has already registered, update it.
     * @param contentScript Content script to set.
     */
    static async setContentScript(contentScript) {
        await StealthService.removeContentScript(contentScript.id);
        await chrome.scripting.registerContentScripts([contentScript]);
    }
    /**
     * Removes all stealth rules and content scripts.
     */
    static async clearAll() {
        const ruleIds = Object.keys(StealthRuleId)
            .map((key) => Number(key))
            .filter((keyNumber) => !Number.isNaN(keyNumber));
        await chrome.declarativeNetRequest.updateSessionRules({ removeRuleIds: ruleIds });
        const contentScriptIds = Object.values(StealthContentScriptId);
        contentScriptIds.forEach(async (id) => {
            await StealthService.removeContentScript(id);
        });
    }
}

/**
 * The TsWebExtension class is a facade for working with the Chrome
 * declarativeNetRequest module: enabling/disabling static filters,
 * adding/editing/deleting custom filters or custom rules,
 * starting/stopping declarative filtering log.
 */
class TsWebExtension {
    /**
     * Fires on filtering log event.
     */
    onFilteringLogEvent = defaultFilteringLog.onLogEvent;
    /**
     * Fires when a rule has been created from the helper.
     */
    onAssistantCreateRule = Assistant.onCreateRule;
    /**
     * This is where the configuration is stored, excluding "heavy" fields:
     * the contents of filters, custom rules and the allowlist.
     *
     * @returns Configuration context.
     */
    // eslint-disable-next-line class-methods-use-this
    get configuration() {
        return appContext.configuration;
    }
    /**
     * Sets app configuration context.
     *
     * @param value Status value.
     */
    // eslint-disable-next-line class-methods-use-this
    set configuration(value) {
        appContext.configuration = value;
    }
    /**
     * Whether filtering is enabled or not.
     */
    isStarted = false;
    /**
     * Stores the initialize promise to prevent multiple initialize calls when
     * a large number of messages are received when the service worker
     * starts or wakes up.
     */
    startPromise;
    /**
     * Web accessible resources path in the result bundle
     * relative to the root dir. Should start with leading slash '/'.
     */
    webAccessibleResourcesPath;
    /**
     * Creates new {@link TsWebExtension} class.
     *
     * @param webAccessibleResourcesPath Path to resources.
     *
     * @see {@link TsWebExtension.webAccessibleResourcesPath} for details.
     */
    constructor(webAccessibleResourcesPath) {
        this.webAccessibleResourcesPath = webAccessibleResourcesPath;
    }
    /**
     * Starts the configuration process, keeping the promise to prevent multiple
     * initialize calls, and executes scripts after configuration.
     *
     * @param config {@link ConfigurationMV3} Configuration object which contains all
     * needed information to start.
     *
     * @returns Promise resolved with result of configuration
     * {@link ConfigurationResult}.
     */
    async innerStart(config) {
        logger.debug('[tswebextension.innerStart]: start');
        if (!appContext.startTimeMs) {
            appContext.startTimeMs = Date.now();
        }
        try {
            const res = await this.configure(config);
            // Start listening for request events.
            RequestEvents.init();
            // Start handle request events.
            WebRequestApi.start();
            // Start handle onRuleMatchedDebug event.
            declarativeFilteringLog.start();
            // Add tabs listeners
            await tabsApi.start();
            // Compute and save matching result for tabs, opened before app initialization.
            await TabsCosmeticInjector.processOpenTabs();
            appContext.isAppStarted = true;
            this.isStarted = true;
            this.startPromise = undefined;
            logger.debug('[tswebextension.innerStart]: started');
            return res;
        }
        catch (e) {
            this.startPromise = undefined;
            logger.debug('[tswebextension.innerStart]: failed due to ', getErrorMessage(e));
            throw new Error('Cannot be started: ', { cause: e });
        }
    }
    /**
     * Starts filtering along with launching the tab listener, which will record
     * tab urls to work correctly with domain blocking/allowing rules, for
     * example: cosmetic rules in iframes.
     *
     * @param config {@link ConfigurationMV3} Configuration object to start with.
     *
     * @returns Promise resolved with result of configuration {@link ConfigurationResult}.
     */
    async start(config) {
        // Update log level before first log message.
        TsWebExtension.updateLogLevel(config.logLevel);
        logger.debug('[tswebextension.start]: is started ', this.isStarted);
        if (this.isStarted) {
            throw new Error('Already started');
        }
        if (this.startPromise) {
            logger.debug('[tswebextension.start]: already called start, waiting');
            const res = await this.startPromise;
            logger.debug('[tswebextension.start]: awaited start');
            return res;
        }
        // Call and wait for promise for allow multiple calling start
        this.startPromise = this.innerStart(config);
        return this.startPromise;
    }
    /**
     * Removes all static and dynamic DNR rules and stops tsurlfilter engine.
     */
    static async removeAllFilteringRules() {
        await DynamicRulesApi.removeAllRules();
        const disableFiltersIds = await FiltersApi.getEnabledRuleSets();
        await FiltersApi.updateFiltering(disableFiltersIds);
        await StealthService.clearAll();
        TsWebExtension.updateRuleSetsForFilteringLog([], false);
        engineApi.stopEngine();
    }
    /**
     * Stops service, disables all user rules and filters.
     */
    async stop() {
        // Stop handle onRuleMatchedDebug event.
        // It should be stopped before removing rules,
        // otherwise, it may try to log applying of removed rules. AG-36068.
        declarativeFilteringLog.stop();
        await TsWebExtension.removeAllFilteringRules();
        // Stop handle request events.
        WebRequestApi.stop();
        // Stop handle request events.
        WebRequestApi.stop();
        // Remove tabs listeners and clear context storage
        tabsApi.stop();
        appContext.isAppStarted = false;
        this.isStarted = false;
    }
    /**
     * Applies new configuration: enables/disables static filters, creates rule
     * sets from provided filters, updates dynamic filters (converts custom
     * filters and user rules on the fly to a single merged rule set), starts
     * declarative filtering log and restarts the engine to reload cosmetic
     * rules.
     *
     * @param config A {@link ConfigurationMV3} to apply.
     *
     * @returns ConfigurationResult {@link ConfigurationResult} which contains:
     * - list of errors for static filters, if any of them has been thrown
     * - converted dynamic rule set with rule set, errors and limitations.
     * @see {@link ConversionResult}
     */
    async configure(config) {
        // Update log level before first log message.
        TsWebExtension.updateLogLevel(config.logLevel);
        // Exclude binary fields from logged config.
        const binaryFields = ['userrules', 'sourceMap', 'rawFilterList', 'filterList', 'conversionMap'];
        logger.debug('[tswebextension.configure]: start with ', stringifyObjectWithoutKeys(config, binaryFields));
        const configuration = configurationMV3Validator.parse(config);
        const res = {
            staticFiltersStatus: {
                errors: [],
            },
            staticFilters: [],
        };
        if (configuration.settings.filteringEnabled) {
            await StealthService.applySettings(configuration.settings);
            // Extract filters info from configuration and wrap them into IFilters.
            const { staticFilters, customFilters, filtersIdsToEnable, filtersIdsToDisable, } = await TsWebExtension.getFiltersUpdateInfo(configuration);
            // Update list of enabled static filters
            res.staticFiltersStatus = await FiltersApi.updateFiltering(filtersIdsToDisable, filtersIdsToEnable);
            // Create static rulesets.
            const staticRuleSets = await TsWebExtension.loadStaticRuleSets(configuration.ruleSetsPath, staticFilters);
            // Update allowlist settings.
            allowlistApi.configure(configuration);
            // Combine all allowlist rules into one network rule.
            const combinedAllowlistRules = allowlistApi.combineAllowListRulesForDNR();
            const userRulesFilter = new Filter(USER_FILTER_ID, { getContent: () => Promise.resolve(configuration.userrules) }, true);
            const allowlistFilter = new Filter(ALLOWLIST_FILTER_ID, 
            // TODO: Generate AST directly for allowlist rules.
            { getContent: () => Promise.resolve(FilterListPreprocessor.preprocess(combinedAllowlistRules)) }, true);
            const quickFixesFilter = new Filter(QUICK_FIXES_FILTER_ID, { getContent: () => Promise.resolve(configuration.quickFixesRules) }, true);
            // Convert quick fixes rules, allowlist, custom filters and user
            // rules into one rule set and apply it.
            res.dynamicRules = await DynamicRulesApi.updateDynamicFiltering(quickFixesFilter, allowlistFilter, userRulesFilter, customFilters, staticRuleSets, this.webAccessibleResourcesPath);
            // Reload engine for cosmetic rules
            engineApi.waitingForEngine = engineApi.startEngine({
                filters: [
                    ...staticFilters,
                    ...customFilters,
                ],
                userrules: configuration.userrules,
                quickFixesRules: configuration.quickFixesRules,
            });
            await engineApi.waitingForEngine;
            // TODO: Recreate only dynamic rule set, because static cannot be changed
            const ruleSets = [
                ...staticRuleSets,
                res.dynamicRules.ruleSet,
            ];
            // Update rulesets in declarative filtering log.
            TsWebExtension.updateRuleSetsForFilteringLog(ruleSets, configuration.declarativeLogEnabled);
            res.staticFilters = staticRuleSets;
        }
        else {
            await TsWebExtension.removeAllFilteringRules();
        }
        this.configuration = TsWebExtension.createConfigurationContext(configuration);
        // Update previously opened tabs with new rules - find for each tab
        // new main frame rule.
        await tabsApi.updateCurrentTabsMainFrameRules();
        // Reload request events listeners.
        await WebRequestApi.flushMemoryCache();
        logger.debug('[tswebextension.configure]: end');
        return res;
    }
    /**
     * Sets prebuild local **script** rules.
     *
     * @param localScriptRules Object with pre-build JS rules. @see {@link LocalScriptRulesService}.
     */
    static setLocalScriptRules(localScriptRules) {
        localScriptRulesService.setLocalScriptRules(localScriptRules);
    }
    /**
     * Updates `hideReferrer` stealth config value without re-initialization of engine.
     *
     * @throws Error if {@link configuration} not set.
     * @param isHideReferrer `isHideReferrer` stealth config value.
     */
    async setHideReferrer(isHideReferrer) {
        if (!this.configuration) {
            throw new Error('Configuration not set');
        }
        await StealthService.setHideReferrer(isHideReferrer);
        this.configuration.settings.stealth.hideReferrer = isHideReferrer;
    }
    /**
     * Updates `blockWebRTC` stealth config value without re-initialization of engine.
     * Also updates webRTC privacy.network settings on demand.
     *
     * @throws Error if {@link configuration} not set.
     * @param isBlockWebRTC `blockWebRTC` stealth config value.
     */
    async setBlockWebRTC(isBlockWebRTC) {
        if (!this.configuration) {
            throw new Error('Configuration not set');
        }
        await StealthService.setDisableWebRTC(isBlockWebRTC);
        this.configuration.settings.stealth.blockWebRTC = isBlockWebRTC;
    }
    /**
     * Updates `blockChromeClientData` stealth config value without re-initialization of engine.
     *
     * @throws Error if {@link configuration} not set.
     * @param isBlockChromeClientData `blockChromeClientData` stealth config value.
     */
    async setBlockChromeClientData(isBlockChromeClientData) {
        if (!this.configuration) {
            throw new Error('Configuration not set');
        }
        await StealthService.setBlockChromeClientData(isBlockChromeClientData);
        this.configuration.settings.stealth.blockChromeClientData = isBlockChromeClientData;
    }
    /**
     * Updates `sendDoNotTrack` stealth config value without re-initialization of engine.
     *
     * @throws Error if {@link configuration} not set.
     * @param isSendDoNotTrack `sendDoNotTrack` stealth config value.
     */
    async setSendDoNotTrack(isSendDoNotTrack) {
        if (!this.configuration) {
            throw new Error('Configuration not set');
        }
        await StealthService.setSendDoNotTrack(isSendDoNotTrack, this.configuration.settings.gpcScriptUrl);
        this.configuration.settings.stealth.sendDoNotTrack = isSendDoNotTrack;
    }
    /**
     * Updates `hideSearchQueries` stealth config value without re-initialization of engine.
     *
     * @throws Error if {@link configuration} not set.
     * @param isHideSearchQueries `hideSearchQueries` stealth config value.
     */
    async setHideSearchQueries(isHideSearchQueries) {
        if (!this.configuration) {
            throw new Error('Configuration not set');
        }
        await StealthService.setHideSearchQueries(isHideSearchQueries, this.configuration.settings.hideDocumentReferrerScriptUrl);
        this.configuration.settings.stealth.hideSearchQueries = isHideSearchQueries;
    }
    /**
     * Opens the AdGuard assistant in the specified tab.
     *
     * @param tabId The ID of the tab where is needed to open
     * the AdGuard assistant.
     */
    // eslint-disable-next-line class-methods-use-this
    async openAssistant(tabId) {
        await Assistant.openAssistant(tabId);
    }
    /**
     * Closes the AdGuard assistant in the specified tab.
     *
     * @param tabId The ID of the tab where is needed to close
     * the AdGuard assistant.
     */
    // TODO: deprecated?
    // eslint-disable-next-line class-methods-use-this
    async closeAssistant(tabId) {
        await Assistant.closeAssistant(tabId);
    }
    /**
     * Gets current loaded rules in the filtering engine
     * (except declarative rules).
     *
     * @returns Number of loaded rules in the filtering engine.
     */
    // eslint-disable-next-line class-methods-use-this
    getRulesCount() {
        return engineApi.getRulesCount();
    }
    /**
     * Returns a message handler that will listen to internal messages,
     * for example: get css for content-script, or start/stop declarative
     * filtering log.
     *
     * @returns Messages handler.
     */
    getMessageHandler() {
        // Keep app context when handle message.
        const messagesApi = new MessagesApi(this, tabsApi, defaultFilteringLog);
        return messagesApi.handleMessage;
    }
    /**
     * Extract partial configuration {@link ConfigurationMV3Context} from whole
     * {@link ConfigurationMV3}, excluding heavyweight fields which
     * contains rules.
     *
     * @param configuration Configuration.
     *
     * @returns ConfigurationContext.
     */
    static createConfigurationContext(configuration) {
        const { staticFiltersIds, customFilters, verbose, settings, filtersPath, ruleSetsPath, declarativeLogEnabled, } = configuration;
        return {
            staticFiltersIds,
            customFilters: customFilters.map(({ filterId }) => filterId),
            filtersPath,
            ruleSetsPath,
            declarativeLogEnabled,
            verbose,
            settings,
        };
    }
    /**
     * Extract configuration update info from already parsed configuration.
     *
     * @param parsedConfiguration Already parsed {@link ConfigurationMV3}.
     *
     * @returns Item of {@link FiltersUpdateInfo}.
     */
    static async getFiltersUpdateInfo(parsedConfiguration) {
        // Wrap filters to tsurlfilter.IFilter
        const staticFilters = FiltersApi.createStaticFilters(parsedConfiguration.staticFiltersIds, parsedConfiguration.filtersPath);
        const customFilters = FiltersApi.createCustomFilters(parsedConfiguration.customFilters);
        const filtersIdsToEnable = staticFilters
            .map((filter) => filter.getId());
        const enabledRuleSetsIds = await FiltersApi.getEnabledRuleSets();
        const filtersIdsToDisable = enabledRuleSetsIds
            .filter((id) => !filtersIdsToEnable.includes(id));
        return {
            staticFilters,
            customFilters,
            filtersIdsToEnable,
            filtersIdsToDisable,
        };
    }
    /**
     * Wraps static filters into rule sets.
     *
     * @param ruleSetsPath Path to the rule set metadata.
     * @param staticFilters List of static {@link IFilter}.
     *
     * @returns A list of static {@link IRuleSet}, or an empty list if an error
     * occurred during the rule scanning step.
     */
    static async loadStaticRuleSets(ruleSetsPath, staticFilters) {
        // Wrap filters into rule sets
        const ruleSetsLoaderApi = new RuleSetsLoaderApi(ruleSetsPath);
        const manifest = browser.runtime.getManifest();
        if (!manifest.declarative_net_request) {
            throw new Error('Cannot find declarative_net_request in manifest');
        }
        // Note: we cannot create rulesets only for enabled filters because we
        // need to get all rulesets' counters for checking limits on the client.
        const manifestRuleSets = manifest.declarative_net_request.rule_resources;
        const staticRuleSetsTasks = manifestRuleSets.map(({ id }) => {
            return ruleSetsLoaderApi.createRuleSet(id, staticFilters);
        });
        try {
            const staticRuleSets = await Promise.all(staticRuleSetsTasks);
            return staticRuleSets;
        }
        catch (e) {
            const filterListIds = staticFilters.map((f) => f.getId());
            // eslint-disable-next-line max-len
            logger.error(`[tswebextension.loadStaticRuleSets]: Cannot scan rules of filter list with ids ${filterListIds} due to: ${getErrorMessage(e)}`);
            return [];
        }
    }
    /**
     * Set provided list of rule sets to a filtering log.
     *
     * @param allRuleSets List of {@link IRuleSet}.
     * @param declarativeLogEnabled Should we log matched declarative rules.
     */
    static updateRuleSetsForFilteringLog(allRuleSets, declarativeLogEnabled) {
        declarativeFilteringLog.ruleSets = allRuleSets;
        if (declarativeLogEnabled) {
            declarativeFilteringLog.start();
        }
        else {
            declarativeFilteringLog.stop();
        }
    }
    /**
     * Initialize app persistent data.
     * This method called as soon as possible and allows access
     * to the actual context before the app is started.
     */
    // eslint-disable-next-line class-methods-use-this
    async initStorage() {
        await extSessionStorage.init();
        appContext.isStorageInitialized = true;
    }
    /**
     * Sets the debug scriptlets state.
     *
     * @throws Error if {@link configuration} not set.
     * @param debug Debug filtering state.
     */
    setDebugScriptlets(debug) {
        if (!this.configuration) {
            throw new Error('Configuration not set');
        }
        this.configuration.settings.debugScriptlets = debug;
    }
    /**
     * Updates `collectStats` configuration value without re-initialization of engine.
     *
     * @throws Error if {@link configuration} not set.
     * @param isCollectStats `collectStats` config value.
     */
    setCollectHitStats(isCollectStats) {
        if (!this.configuration) {
            throw new Error('Configuration not set');
        }
        this.configuration.settings.collectStats = isCollectStats;
    }
    /**
     * Updates the log level.
     *
     * @param logLevel Log level.
     */
    static updateLogLevel(logLevel) {
        try {
            logger.currentLevel = logLevel || LogLevel.Info;
        }
        catch (e) {
            logger.currentLevel = LogLevel.Info;
        }
    }
    /**
     * Retrieves rule node from a dynamic filter.
     * Dynamic filters are filters that are not loaded from the storage but
     * created on the fly: now only for allowlist.
     *
     * @param filterId Filter id.
     * @param ruleIndex Rule index.
     * @returns Rule node or null.
     */
    // eslint-disable-next-line class-methods-use-this
    retrieveDynamicRuleNode(filterId, ruleIndex) {
        return engineApi.retrieveDynamicRuleNode(filterId, ruleIndex);
    }
}

/**
 * Stealth action bitwise masks used on the background page and on the filtering log page.
 */
var StealthActions;
(function (StealthActions) {
    StealthActions[StealthActions["None"] = 0] = "None";
    StealthActions[StealthActions["HideReferrer"] = 1] = "HideReferrer";
    StealthActions[StealthActions["HideSearchQueries"] = 2] = "HideSearchQueries";
    StealthActions[StealthActions["BlockChromeClientData"] = 4] = "BlockChromeClientData";
    StealthActions[StealthActions["SendDoNotTrack"] = 8] = "SendDoNotTrack";
    // TODO check where this enums are used, and add comments
    StealthActions[StealthActions["FirstPartyCookies"] = 16] = "FirstPartyCookies";
    StealthActions[StealthActions["ThirdPartyCookies"] = 32] = "ThirdPartyCookies";
})(StealthActions || (StealthActions = {}));




/***/ }),

/***/ 14271:
/***/ ((module, exports) => {

var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
	Copyright (c) 2018 Jed Watson.
	Licensed under the MIT License (MIT), see
	http://jedwatson.github.io/classnames
*/
/* global define */

(function () {
	'use strict';

	var hasOwn = {}.hasOwnProperty;
	var nativeCodeString = '[native code]';

	function classNames() {
		var classes = [];

		for (var i = 0; i < arguments.length; i++) {
			var arg = arguments[i];
			if (!arg) continue;

			var argType = typeof arg;

			if (argType === 'string' || argType === 'number') {
				classes.push(arg);
			} else if (Array.isArray(arg)) {
				if (arg.length) {
					var inner = classNames.apply(null, arg);
					if (inner) {
						classes.push(inner);
					}
				}
			} else if (argType === 'object') {
				if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
					classes.push(arg.toString());
					continue;
				}

				for (var key in arg) {
					if (hasOwn.call(arg, key) && arg[key]) {
						classes.push(key);
					}
				}
			}
		}

		return classes.join(' ');
	}

	if ( true && module.exports) {
		classNames.default = classNames;
		module.exports = classNames;
	} else if (true) {
		// register as 'classnames', consistent with npm package name
		!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
			return classNames;
		}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
	} else {}
}());


/***/ }),

/***/ 54274:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var isCallable = __webpack_require__(35340);
var tryToString = __webpack_require__(82910);

var $TypeError = TypeError;

// `Assert: IsCallable(argument) is true`
module.exports = function (argument) {
  if (isCallable(argument)) return argument;
  throw $TypeError(tryToString(argument) + ' is not a function');
};


/***/ }),

/***/ 21704:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var isCallable = __webpack_require__(35340);

var $String = String;
var $TypeError = TypeError;

module.exports = function (argument) {
  if (typeof argument == 'object' || isCallable(argument)) return argument;
  throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
};


/***/ }),

/***/ 3303:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var wellKnownSymbol = __webpack_require__(37366);
var create = __webpack_require__(92760);
var defineProperty = (__webpack_require__(70784).f);

var UNSCOPABLES = wellKnownSymbol('unscopables');
var ArrayPrototype = Array.prototype;

// Array.prototype[@@unscopables]
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
if (ArrayPrototype[UNSCOPABLES] == undefined) {
  defineProperty(ArrayPrototype, UNSCOPABLES, {
    configurable: true,
    value: create(null)
  });
}

// add a key to Array.prototype[@@unscopables]
module.exports = function (key) {
  ArrayPrototype[UNSCOPABLES][key] = true;
};


/***/ }),

/***/ 70517:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var isObject = __webpack_require__(48159);

var $String = String;
var $TypeError = TypeError;

// `Assert: Type(argument) is Object`
module.exports = function (argument) {
  if (isObject(argument)) return argument;
  throw $TypeError($String(argument) + ' is not an object');
};


/***/ }),

/***/ 6170:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var toIndexedObject = __webpack_require__(65065);
var toAbsoluteIndex = __webpack_require__(3343);
var lengthOfArrayLike = __webpack_require__(35119);

// `Array.prototype.{ indexOf, includes }` methods implementation
var createMethod = function (IS_INCLUDES) {
  return function ($this, el, fromIndex) {
    var O = toIndexedObject($this);
    var length = lengthOfArrayLike(O);
    var index = toAbsoluteIndex(fromIndex, length);
    var value;
    // Array#includes uses SameValueZero equality algorithm
    // eslint-disable-next-line no-self-compare -- NaN check
    if (IS_INCLUDES && el != el) while (length > index) {
      value = O[index++];
      // eslint-disable-next-line no-self-compare -- NaN check
      if (value != value) return true;
    // Array#indexOf ignores holes, Array#includes - not
    } else for (;length > index; index++) {
      if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
    } return !IS_INCLUDES && -1;
  };
};

module.exports = {
  // `Array.prototype.includes` method
  // https://tc39.es/ecma262/#sec-array.prototype.includes
  includes: createMethod(true),
  // `Array.prototype.indexOf` method
  // https://tc39.es/ecma262/#sec-array.prototype.indexof
  indexOf: createMethod(false)
};


/***/ }),

/***/ 29722:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var fails = __webpack_require__(62728);

module.exports = function (METHOD_NAME, argument) {
  var method = [][METHOD_NAME];
  return !!method && fails(function () {
    // eslint-disable-next-line no-useless-call -- required for testing
    method.call(null, argument || function () { return 1; }, 1);
  });
};


/***/ }),

/***/ 9237:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var aCallable = __webpack_require__(54274);
var toObject = __webpack_require__(80358);
var IndexedObject = __webpack_require__(91546);
var lengthOfArrayLike = __webpack_require__(35119);

var $TypeError = TypeError;

// `Array.prototype.{ reduce, reduceRight }` methods implementation
var createMethod = function (IS_RIGHT) {
  return function (that, callbackfn, argumentsLength, memo) {
    aCallable(callbackfn);
    var O = toObject(that);
    var self = IndexedObject(O);
    var length = lengthOfArrayLike(O);
    var index = IS_RIGHT ? length - 1 : 0;
    var i = IS_RIGHT ? -1 : 1;
    if (argumentsLength < 2) while (true) {
      if (index in self) {
        memo = self[index];
        index += i;
        break;
      }
      index += i;
      if (IS_RIGHT ? index < 0 : length <= index) {
        throw $TypeError('Reduce of empty array with no initial value');
      }
    }
    for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
      memo = callbackfn(memo, self[index], index, O);
    }
    return memo;
  };
};

module.exports = {
  // `Array.prototype.reduce` method
  // https://tc39.es/ecma262/#sec-array.prototype.reduce
  left: createMethod(false),
  // `Array.prototype.reduceRight` method
  // https://tc39.es/ecma262/#sec-array.prototype.reduceright
  right: createMethod(true)
};


/***/ }),

/***/ 51491:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var DESCRIPTORS = __webpack_require__(97581);
var isArray = __webpack_require__(17106);

var $TypeError = TypeError;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

// Safari < 13 does not throw an error in this case
var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
  // makes no sense without proper strict mode support
  if (this !== undefined) return true;
  try {
    // eslint-disable-next-line es/no-object-defineproperty -- safe
    Object.defineProperty([], 'length', { writable: false }).length = 1;
  } catch (error) {
    return error instanceof TypeError;
  }
}();

module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
  if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
    throw $TypeError('Cannot set read only .length');
  } return O.length = length;
} : function (O, length) {
  return O.length = length;
};


/***/ }),

/***/ 95258:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var uncurryThis = __webpack_require__(76891);

var toString = uncurryThis({}.toString);
var stringSlice = uncurryThis(''.slice);

module.exports = function (it) {
  return stringSlice(toString(it), 8, -1);
};


/***/ }),

/***/ 34688:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var TO_STRING_TAG_SUPPORT = __webpack_require__(24278);
var isCallable = __webpack_require__(35340);
var classofRaw = __webpack_require__(95258);
var wellKnownSymbol = __webpack_require__(37366);

var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var $Object = Object;

// ES3 wrong here
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';

// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
  try {
    return it[key];
  } catch (error) { /* empty */ }
};

// getting tag from ES6+ `Object.prototype.toString`
module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  var O, tag, result;
  return it === undefined ? 'Undefined' : it === null ? 'Null'
    // @@toStringTag case
    : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
    // builtinTag case
    : CORRECT_ARGUMENTS ? classofRaw(O)
    // ES3 arguments fallback
    : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
};


/***/ }),

/***/ 28932:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var hasOwn = __webpack_require__(93120);
var ownKeys = __webpack_require__(55275);
var getOwnPropertyDescriptorModule = __webpack_require__(67685);
var definePropertyModule = __webpack_require__(70784);

module.exports = function (target, source, exceptions) {
  var keys = ownKeys(source);
  var defineProperty = definePropertyModule.f;
  var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  for (var i = 0; i < keys.length; i++) {
    var key = keys[i];
    if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
      defineProperty(target, key, getOwnPropertyDescriptor(source, key));
    }
  }
};


/***/ }),

/***/ 29671:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var DESCRIPTORS = __webpack_require__(97581);
var definePropertyModule = __webpack_require__(70784);
var createPropertyDescriptor = __webpack_require__(87567);

module.exports = DESCRIPTORS ? function (object, key, value) {
  return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
} : function (object, key, value) {
  object[key] = value;
  return object;
};


/***/ }),

/***/ 87567:
/***/ ((module) => {

"use strict";

module.exports = function (bitmap, value) {
  return {
    enumerable: !(bitmap & 1),
    configurable: !(bitmap & 2),
    writable: !(bitmap & 4),
    value: value
  };
};


/***/ }),

/***/ 70636:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var makeBuiltIn = __webpack_require__(96386);
var defineProperty = __webpack_require__(70784);

module.exports = function (target, name, descriptor) {
  if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
  if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
  return defineProperty.f(target, name, descriptor);
};


/***/ }),

/***/ 27919:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var isCallable = __webpack_require__(35340);
var definePropertyModule = __webpack_require__(70784);
var makeBuiltIn = __webpack_require__(96386);
var defineGlobalProperty = __webpack_require__(43637);

module.exports = function (O, key, value, options) {
  if (!options) options = {};
  var simple = options.enumerable;
  var name = options.name !== undefined ? options.name : key;
  if (isCallable(value)) makeBuiltIn(value, name, options);
  if (options.global) {
    if (simple) O[key] = value;
    else defineGlobalProperty(key, value);
  } else {
    try {
      if (!options.unsafe) delete O[key];
      else if (O[key]) simple = true;
    } catch (error) { /* empty */ }
    if (simple) O[key] = value;
    else definePropertyModule.f(O, key, {
      value: value,
      enumerable: false,
      configurable: !options.nonConfigurable,
      writable: !options.nonWritable
    });
  } return O;
};


/***/ }),

/***/ 43637:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var global = __webpack_require__(17773);

// eslint-disable-next-line es/no-object-defineproperty -- safe
var defineProperty = Object.defineProperty;

module.exports = function (key, value) {
  try {
    defineProperty(global, key, { value: value, configurable: true, writable: true });
  } catch (error) {
    global[key] = value;
  } return value;
};


/***/ }),

/***/ 97581:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var fails = __webpack_require__(62728);

// Detect IE8's incomplete defineProperty implementation
module.exports = !fails(function () {
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
});


/***/ }),

/***/ 34900:
/***/ ((module) => {

"use strict";

var documentAll = typeof document == 'object' && document.all;

// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
var IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;

module.exports = {
  all: documentAll,
  IS_HTMLDDA: IS_HTMLDDA
};


/***/ }),

/***/ 63019:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var global = __webpack_require__(17773);
var isObject = __webpack_require__(48159);

var document = global.document;
// typeof document.createElement is 'object' in old IE
var EXISTS = isObject(document) && isObject(document.createElement);

module.exports = function (it) {
  return EXISTS ? document.createElement(it) : {};
};


/***/ }),

/***/ 73929:
/***/ ((module) => {

"use strict";

var $TypeError = TypeError;
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991

module.exports = function (it) {
  if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
  return it;
};


/***/ }),

/***/ 17567:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var classof = __webpack_require__(95258);

module.exports = typeof process != 'undefined' && classof(process) == 'process';


/***/ }),

/***/ 64857:
/***/ ((module) => {

"use strict";

module.exports = typeof navigator != 'undefined' && String(navigator.userAgent) || '';


/***/ }),

/***/ 48051:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var global = __webpack_require__(17773);
var userAgent = __webpack_require__(64857);

var process = global.process;
var Deno = global.Deno;
var versions = process && process.versions || Deno && Deno.version;
var v8 = versions && versions.v8;
var match, version;

if (v8) {
  match = v8.split('.');
  // in old Chrome, versions of V8 isn't V8 = Chrome / 10
  // but their correct versions are not interesting for us
  version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
}

// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
// so check `userAgent` even if `.v8` exists, but 0
if (!version && userAgent) {
  match = userAgent.match(/Edge\/(\d+)/);
  if (!match || match[1] >= 74) {
    match = userAgent.match(/Chrome\/(\d+)/);
    if (match) version = +match[1];
  }
}

module.exports = version;


/***/ }),

/***/ 62071:
/***/ ((module) => {

"use strict";

// IE8- don't enum bug keys
module.exports = [
  'constructor',
  'hasOwnProperty',
  'isPrototypeOf',
  'propertyIsEnumerable',
  'toLocaleString',
  'toString',
  'valueOf'
];


/***/ }),

/***/ 70179:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var uncurryThis = __webpack_require__(76891);

var $Error = Error;
var replace = uncurryThis(''.replace);

var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
// eslint-disable-next-line redos/no-vulnerable -- safe
var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);

module.exports = function (stack, dropEntries) {
  if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
    while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
  } return stack;
};


/***/ }),

/***/ 11496:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var createNonEnumerableProperty = __webpack_require__(29671);
var clearErrorStack = __webpack_require__(70179);
var ERROR_STACK_INSTALLABLE = __webpack_require__(7791);

// non-standard V8
var captureStackTrace = Error.captureStackTrace;

module.exports = function (error, C, stack, dropEntries) {
  if (ERROR_STACK_INSTALLABLE) {
    if (captureStackTrace) captureStackTrace(error, C);
    else createNonEnumerableProperty(error, 'stack', clearErrorStack(stack, dropEntries));
  }
};


/***/ }),

/***/ 7791:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var fails = __webpack_require__(62728);
var createPropertyDescriptor = __webpack_require__(87567);

module.exports = !fails(function () {
  var error = Error('a');
  if (!('stack' in error)) return true;
  // eslint-disable-next-line es/no-object-defineproperty -- safe
  Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
  return error.stack !== 7;
});


/***/ }),

/***/ 24134:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var global = __webpack_require__(17773);
var getOwnPropertyDescriptor = (__webpack_require__(67685).f);
var createNonEnumerableProperty = __webpack_require__(29671);
var defineBuiltIn = __webpack_require__(27919);
var defineGlobalProperty = __webpack_require__(43637);
var copyConstructorProperties = __webpack_require__(28932);
var isForced = __webpack_require__(68465);

/*
  options.target         - name of the target object
  options.global         - target is the global object
  options.stat           - export as static methods of target
  options.proto          - export as prototype methods of target
  options.real           - real prototype method for the `pure` version
  options.forced         - export even if the native feature is available
  options.bind           - bind methods to the target, required for the `pure` version
  options.wrap           - wrap constructors to preventing global pollution, required for the `pure` version
  options.unsafe         - use the simple assignment of property instead of delete + defineProperty
  options.sham           - add a flag to not completely full polyfills
  options.enumerable     - export as enumerable property
  options.dontCallGetSet - prevent calling a getter on target
  options.name           - the .name of the function if it does not match the key
*/
module.exports = function (options, source) {
  var TARGET = options.target;
  var GLOBAL = options.global;
  var STATIC = options.stat;
  var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  if (GLOBAL) {
    target = global;
  } else if (STATIC) {
    target = global[TARGET] || defineGlobalProperty(TARGET, {});
  } else {
    target = (global[TARGET] || {}).prototype;
  }
  if (target) for (key in source) {
    sourceProperty = source[key];
    if (options.dontCallGetSet) {
      descriptor = getOwnPropertyDescriptor(target, key);
      targetProperty = descriptor && descriptor.value;
    } else targetProperty = target[key];
    FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
    // contained in target
    if (!FORCED && targetProperty !== undefined) {
      if (typeof sourceProperty == typeof targetProperty) continue;
      copyConstructorProperties(sourceProperty, targetProperty);
    }
    // add a flag to not completely full polyfills
    if (options.sham || (targetProperty && targetProperty.sham)) {
      createNonEnumerableProperty(sourceProperty, 'sham', true);
    }
    defineBuiltIn(target, key, sourceProperty, options);
  }
};


/***/ }),

/***/ 62728:
/***/ ((module) => {

"use strict";

module.exports = function (exec) {
  try {
    return !!exec();
  } catch (error) {
    return true;
  }
};


/***/ }),

/***/ 72504:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var NATIVE_BIND = __webpack_require__(15257);

var FunctionPrototype = Function.prototype;
var apply = FunctionPrototype.apply;
var call = FunctionPrototype.call;

// eslint-disable-next-line es/no-reflect -- safe
module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
  return call.apply(apply, arguments);
});


/***/ }),

/***/ 15257:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var fails = __webpack_require__(62728);

module.exports = !fails(function () {
  // eslint-disable-next-line es/no-function-prototype-bind -- safe
  var test = (function () { /* empty */ }).bind();
  // eslint-disable-next-line no-prototype-builtins -- safe
  return typeof test != 'function' || test.hasOwnProperty('prototype');
});


/***/ }),

/***/ 21327:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var NATIVE_BIND = __webpack_require__(15257);

var call = Function.prototype.call;

module.exports = NATIVE_BIND ? call.bind(call) : function () {
  return call.apply(call, arguments);
};


/***/ }),

/***/ 23096:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var DESCRIPTORS = __webpack_require__(97581);
var hasOwn = __webpack_require__(93120);

var FunctionPrototype = Function.prototype;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;

var EXISTS = hasOwn(FunctionPrototype, 'name');
// additional protection from minified / mangled / dropped function names
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));

module.exports = {
  EXISTS: EXISTS,
  PROPER: PROPER,
  CONFIGURABLE: CONFIGURABLE
};


/***/ }),

/***/ 54809:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var uncurryThis = __webpack_require__(76891);
var aCallable = __webpack_require__(54274);

module.exports = function (object, key, method) {
  try {
    // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
    return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));
  } catch (error) { /* empty */ }
};


/***/ }),

/***/ 76891:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var NATIVE_BIND = __webpack_require__(15257);

var FunctionPrototype = Function.prototype;
var call = FunctionPrototype.call;
var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);

module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
  return function () {
    return call.apply(fn, arguments);
  };
};


/***/ }),

/***/ 33492:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var global = __webpack_require__(17773);
var isCallable = __webpack_require__(35340);

var aFunction = function (argument) {
  return isCallable(argument) ? argument : undefined;
};

module.exports = function (namespace, method) {
  return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
};


/***/ }),

/***/ 79570:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var aCallable = __webpack_require__(54274);
var isNullOrUndefined = __webpack_require__(8276);

// `GetMethod` abstract operation
// https://tc39.es/ecma262/#sec-getmethod
module.exports = function (V, P) {
  var func = V[P];
  return isNullOrUndefined(func) ? undefined : aCallable(func);
};


/***/ }),

/***/ 17773:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {

"use strict";

var check = function (it) {
  return it && it.Math == Math && it;
};

// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
module.exports =
  // eslint-disable-next-line es/no-global-this -- safe
  check(typeof globalThis == 'object' && globalThis) ||
  check(typeof window == 'object' && window) ||
  // eslint-disable-next-line no-restricted-globals -- safe
  check(typeof self == 'object' && self) ||
  check(typeof __webpack_require__.g == 'object' && __webpack_require__.g) ||
  // eslint-disable-next-line no-new-func -- fallback
  (function () { return this; })() || this || Function('return this')();


/***/ }),

/***/ 93120:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var uncurryThis = __webpack_require__(76891);
var toObject = __webpack_require__(80358);

var hasOwnProperty = uncurryThis({}.hasOwnProperty);

// `HasOwnProperty` abstract operation
// https://tc39.es/ecma262/#sec-hasownproperty
// eslint-disable-next-line es/no-object-hasown -- safe
module.exports = Object.hasOwn || function hasOwn(it, key) {
  return hasOwnProperty(toObject(it), key);
};


/***/ }),

/***/ 43698:
/***/ ((module) => {

"use strict";

module.exports = {};


/***/ }),

/***/ 6631:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var getBuiltIn = __webpack_require__(33492);

module.exports = getBuiltIn('document', 'documentElement');


/***/ }),

/***/ 717:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var DESCRIPTORS = __webpack_require__(97581);
var fails = __webpack_require__(62728);
var createElement = __webpack_require__(63019);

// Thanks to IE8 for its funny defineProperty
module.exports = !DESCRIPTORS && !fails(function () {
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  return Object.defineProperty(createElement('div'), 'a', {
    get: function () { return 7; }
  }).a != 7;
});


/***/ }),

/***/ 91546:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var uncurryThis = __webpack_require__(76891);
var fails = __webpack_require__(62728);
var classof = __webpack_require__(95258);

var $Object = Object;
var split = uncurryThis(''.split);

// fallback for non-array-like ES3 and non-enumerable old V8 strings
module.exports = fails(function () {
  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  // eslint-disable-next-line no-prototype-builtins -- safe
  return !$Object('z').propertyIsEnumerable(0);
}) ? function (it) {
  return classof(it) == 'String' ? split(it, '') : $Object(it);
} : $Object;


/***/ }),

/***/ 19525:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var isCallable = __webpack_require__(35340);
var isObject = __webpack_require__(48159);
var setPrototypeOf = __webpack_require__(36718);

// makes subclassing work correct for wrapped built-ins
module.exports = function ($this, dummy, Wrapper) {
  var NewTarget, NewTargetPrototype;
  if (
    // it can work only with native `setPrototypeOf`
    setPrototypeOf &&
    // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
    isCallable(NewTarget = dummy.constructor) &&
    NewTarget !== Wrapper &&
    isObject(NewTargetPrototype = NewTarget.prototype) &&
    NewTargetPrototype !== Wrapper.prototype
  ) setPrototypeOf($this, NewTargetPrototype);
  return $this;
};


/***/ }),

/***/ 21538:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var uncurryThis = __webpack_require__(76891);
var isCallable = __webpack_require__(35340);
var store = __webpack_require__(88655);

var functionToString = uncurryThis(Function.toString);

// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
if (!isCallable(store.inspectSource)) {
  store.inspectSource = function (it) {
    return functionToString(it);
  };
}

module.exports = store.inspectSource;


/***/ }),

/***/ 59710:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var isObject = __webpack_require__(48159);
var createNonEnumerableProperty = __webpack_require__(29671);

// `InstallErrorCause` abstract operation
// https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
module.exports = function (O, options) {
  if (isObject(options) && 'cause' in options) {
    createNonEnumerableProperty(O, 'cause', options.cause);
  }
};


/***/ }),

/***/ 14928:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var NATIVE_WEAK_MAP = __webpack_require__(40114);
var global = __webpack_require__(17773);
var isObject = __webpack_require__(48159);
var createNonEnumerableProperty = __webpack_require__(29671);
var hasOwn = __webpack_require__(93120);
var shared = __webpack_require__(88655);
var sharedKey = __webpack_require__(95174);
var hiddenKeys = __webpack_require__(43698);

var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
var TypeError = global.TypeError;
var WeakMap = global.WeakMap;
var set, get, has;

var enforce = function (it) {
  return has(it) ? get(it) : set(it, {});
};

var getterFor = function (TYPE) {
  return function (it) {
    var state;
    if (!isObject(it) || (state = get(it)).type !== TYPE) {
      throw TypeError('Incompatible receiver, ' + TYPE + ' required');
    } return state;
  };
};

if (NATIVE_WEAK_MAP || shared.state) {
  var store = shared.state || (shared.state = new WeakMap());
  /* eslint-disable no-self-assign -- prototype methods protection */
  store.get = store.get;
  store.has = store.has;
  store.set = store.set;
  /* eslint-enable no-self-assign -- prototype methods protection */
  set = function (it, metadata) {
    if (store.has(it)) throw TypeError(OBJECT_ALREADY_INITIALIZED);
    metadata.facade = it;
    store.set(it, metadata);
    return metadata;
  };
  get = function (it) {
    return store.get(it) || {};
  };
  has = function (it) {
    return store.has(it);
  };
} else {
  var STATE = sharedKey('state');
  hiddenKeys[STATE] = true;
  set = function (it, metadata) {
    if (hasOwn(it, STATE)) throw TypeError(OBJECT_ALREADY_INITIALIZED);
    metadata.facade = it;
    createNonEnumerableProperty(it, STATE, metadata);
    return metadata;
  };
  get = function (it) {
    return hasOwn(it, STATE) ? it[STATE] : {};
  };
  has = function (it) {
    return hasOwn(it, STATE);
  };
}

module.exports = {
  set: set,
  get: get,
  has: has,
  enforce: enforce,
  getterFor: getterFor
};


/***/ }),

/***/ 17106:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var classof = __webpack_require__(95258);

// `IsArray` abstract operation
// https://tc39.es/ecma262/#sec-isarray
// eslint-disable-next-line es/no-array-isarray -- safe
module.exports = Array.isArray || function isArray(argument) {
  return classof(argument) == 'Array';
};


/***/ }),

/***/ 35340:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var $documentAll = __webpack_require__(34900);

var documentAll = $documentAll.all;

// `IsCallable` abstract operation
// https://tc39.es/ecma262/#sec-iscallable
module.exports = $documentAll.IS_HTMLDDA ? function (argument) {
  return typeof argument == 'function' || argument === documentAll;
} : function (argument) {
  return typeof argument == 'function';
};


/***/ }),

/***/ 68465:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var fails = __webpack_require__(62728);
var isCallable = __webpack_require__(35340);

var replacement = /#|\.prototype\./;

var isForced = function (feature, detection) {
  var value = data[normalize(feature)];
  return value == POLYFILL ? true
    : value == NATIVE ? false
    : isCallable(detection) ? fails(detection)
    : !!detection;
};

var normalize = isForced.normalize = function (string) {
  return String(string).replace(replacement, '.').toLowerCase();
};

var data = isForced.data = {};
var NATIVE = isForced.NATIVE = 'N';
var POLYFILL = isForced.POLYFILL = 'P';

module.exports = isForced;


/***/ }),

/***/ 8276:
/***/ ((module) => {

"use strict";

// we can't use just `it == null` since of `document.all` special case
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
module.exports = function (it) {
  return it === null || it === undefined;
};


/***/ }),

/***/ 48159:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var isCallable = __webpack_require__(35340);
var $documentAll = __webpack_require__(34900);

var documentAll = $documentAll.all;

module.exports = $documentAll.IS_HTMLDDA ? function (it) {
  return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll;
} : function (it) {
  return typeof it == 'object' ? it !== null : isCallable(it);
};


/***/ }),

/***/ 37259:
/***/ ((module) => {

"use strict";

module.exports = false;


/***/ }),

/***/ 48136:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var getBuiltIn = __webpack_require__(33492);
var isCallable = __webpack_require__(35340);
var isPrototypeOf = __webpack_require__(85726);
var USE_SYMBOL_AS_UID = __webpack_require__(14167);

var $Object = Object;

module.exports = USE_SYMBOL_AS_UID ? function (it) {
  return typeof it == 'symbol';
} : function (it) {
  var $Symbol = getBuiltIn('Symbol');
  return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
};


/***/ }),

/***/ 35119:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var toLength = __webpack_require__(93292);

// `LengthOfArrayLike` abstract operation
// https://tc39.es/ecma262/#sec-lengthofarraylike
module.exports = function (obj) {
  return toLength(obj.length);
};


/***/ }),

/***/ 96386:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var uncurryThis = __webpack_require__(76891);
var fails = __webpack_require__(62728);
var isCallable = __webpack_require__(35340);
var hasOwn = __webpack_require__(93120);
var DESCRIPTORS = __webpack_require__(97581);
var CONFIGURABLE_FUNCTION_NAME = (__webpack_require__(23096).CONFIGURABLE);
var inspectSource = __webpack_require__(21538);
var InternalStateModule = __webpack_require__(14928);

var enforceInternalState = InternalStateModule.enforce;
var getInternalState = InternalStateModule.get;
var $String = String;
// eslint-disable-next-line es/no-object-defineproperty -- safe
var defineProperty = Object.defineProperty;
var stringSlice = uncurryThis(''.slice);
var replace = uncurryThis(''.replace);
var join = uncurryThis([].join);

var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
  return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
});

var TEMPLATE = String(String).split('String');

var makeBuiltIn = module.exports = function (value, name, options) {
  if (stringSlice($String(name), 0, 7) === 'Symbol(') {
    name = '[' + replace($String(name), /^Symbol\(([^)]*)\)/, '$1') + ']';
  }
  if (options && options.getter) name = 'get ' + name;
  if (options && options.setter) name = 'set ' + name;
  if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
    if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });
    else value.name = name;
  }
  if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
    defineProperty(value, 'length', { value: options.arity });
  }
  try {
    if (options && hasOwn(options, 'constructor') && options.constructor) {
      if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });
    // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
    } else if (value.prototype) value.prototype = undefined;
  } catch (error) { /* empty */ }
  var state = enforceInternalState(value);
  if (!hasOwn(state, 'source')) {
    state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
  } return value;
};

// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
// eslint-disable-next-line no-extend-native -- required
Function.prototype.toString = makeBuiltIn(function toString() {
  return isCallable(this) && getInternalState(this).source || inspectSource(this);
}, 'toString');


/***/ }),

/***/ 54279:
/***/ ((module) => {

"use strict";

var ceil = Math.ceil;
var floor = Math.floor;

// `Math.trunc` method
// https://tc39.es/ecma262/#sec-math.trunc
// eslint-disable-next-line es/no-math-trunc -- safe
module.exports = Math.trunc || function trunc(x) {
  var n = +x;
  return (n > 0 ? floor : ceil)(n);
};


/***/ }),

/***/ 21160:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var toString = __webpack_require__(87257);

module.exports = function (argument, $default) {
  return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
};


/***/ }),

/***/ 92760:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

/* global ActiveXObject -- old IE, WSH */
var anObject = __webpack_require__(70517);
var definePropertiesModule = __webpack_require__(14253);
var enumBugKeys = __webpack_require__(62071);
var hiddenKeys = __webpack_require__(43698);
var html = __webpack_require__(6631);
var documentCreateElement = __webpack_require__(63019);
var sharedKey = __webpack_require__(95174);

var GT = '>';
var LT = '<';
var PROTOTYPE = 'prototype';
var SCRIPT = 'script';
var IE_PROTO = sharedKey('IE_PROTO');

var EmptyConstructor = function () { /* empty */ };

var scriptTag = function (content) {
  return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
};

// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
var NullProtoObjectViaActiveX = function (activeXDocument) {
  activeXDocument.write(scriptTag(''));
  activeXDocument.close();
  var temp = activeXDocument.parentWindow.Object;
  activeXDocument = null; // avoid memory leak
  return temp;
};

// Create object with fake `null` prototype: use iframe Object with cleared prototype
var NullProtoObjectViaIFrame = function () {
  // Thrash, waste and sodomy: IE GC bug
  var iframe = documentCreateElement('iframe');
  var JS = 'java' + SCRIPT + ':';
  var iframeDocument;
  iframe.style.display = 'none';
  html.appendChild(iframe);
  // https://github.com/zloirock/core-js/issues/475
  iframe.src = String(JS);
  iframeDocument = iframe.contentWindow.document;
  iframeDocument.open();
  iframeDocument.write(scriptTag('document.F=Object'));
  iframeDocument.close();
  return iframeDocument.F;
};

// Check for document.domain and active x support
// No need to use active x approach when document.domain is not set
// see https://github.com/es-shims/es5-shim/issues/150
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
// avoid IE GC bug
var activeXDocument;
var NullProtoObject = function () {
  try {
    activeXDocument = new ActiveXObject('htmlfile');
  } catch (error) { /* ignore */ }
  NullProtoObject = typeof document != 'undefined'
    ? document.domain && activeXDocument
      ? NullProtoObjectViaActiveX(activeXDocument) // old IE
      : NullProtoObjectViaIFrame()
    : NullProtoObjectViaActiveX(activeXDocument); // WSH
  var length = enumBugKeys.length;
  while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  return NullProtoObject();
};

hiddenKeys[IE_PROTO] = true;

// `Object.create` method
// https://tc39.es/ecma262/#sec-object.create
// eslint-disable-next-line es/no-object-create -- safe
module.exports = Object.create || function create(O, Properties) {
  var result;
  if (O !== null) {
    EmptyConstructor[PROTOTYPE] = anObject(O);
    result = new EmptyConstructor();
    EmptyConstructor[PROTOTYPE] = null;
    // add "__proto__" for Object.getPrototypeOf polyfill
    result[IE_PROTO] = O;
  } else result = NullProtoObject();
  return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
};


/***/ }),

/***/ 14253:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

var DESCRIPTORS = __webpack_require__(97581);
var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(74060);
var definePropertyModule = __webpack_require__(70784);
var anObject = __webpack_require__(70517);
var toIndexedObject = __webpack_require__(65065);
var objectKeys = __webpack_require__(95075);

// `Object.defineProperties` method
// https://tc39.es/ecma262/#sec-object.defineproperties
// eslint-disable-next-line es/no-object-defineproperties -- safe
exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
  anObject(O);
  var props = toIndexedObject(Properties);
  var keys = objectKeys(Properties);
  var length = keys.length;
  var index = 0;
  var key;
  while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
  return O;
};


/***/ }),

/***/ 70784:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

var DESCRIPTORS = __webpack_require__(97581);
var IE8_DOM_DEFINE = __webpack_require__(717);
var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(74060);
var anObject = __webpack_require__(70517);
var toPropertyKey = __webpack_require__(3255);

var $TypeError = TypeError;
// eslint-disable-next-line es/no-object-defineproperty -- safe
var $defineProperty = Object.defineProperty;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var ENUMERABLE = 'enumerable';
var CONFIGURABLE = 'configurable';
var WRITABLE = 'writable';

// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  anObject(O);
  P = toPropertyKey(P);
  anObject(Attributes);
  if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
    var current = $getOwnPropertyDescriptor(O, P);
    if (current && current[WRITABLE]) {
      O[P] = Attributes.value;
      Attributes = {
        configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
        enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
        writable: false
      };
    }
  } return $defineProperty(O, P, Attributes);
} : $defineProperty : function defineProperty(O, P, Attributes) {
  anObject(O);
  P = toPropertyKey(P);
  anObject(Attributes);
  if (IE8_DOM_DEFINE) try {
    return $defineProperty(O, P, Attributes);
  } catch (error) { /* empty */ }
  if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
  if ('value' in Attributes) O[P] = Attributes.value;
  return O;
};


/***/ }),

/***/ 67685:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

var DESCRIPTORS = __webpack_require__(97581);
var call = __webpack_require__(21327);
var propertyIsEnumerableModule = __webpack_require__(79804);
var createPropertyDescriptor = __webpack_require__(87567);
var toIndexedObject = __webpack_require__(65065);
var toPropertyKey = __webpack_require__(3255);
var hasOwn = __webpack_require__(93120);
var IE8_DOM_DEFINE = __webpack_require__(717);

// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

// `Object.getOwnPropertyDescriptor` method
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  O = toIndexedObject(O);
  P = toPropertyKey(P);
  if (IE8_DOM_DEFINE) try {
    return $getOwnPropertyDescriptor(O, P);
  } catch (error) { /* empty */ }
  if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
};


/***/ }),

/***/ 94255:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

var internalObjectKeys = __webpack_require__(87122);
var enumBugKeys = __webpack_require__(62071);

var hiddenKeys = enumBugKeys.concat('length', 'prototype');

// `Object.getOwnPropertyNames` method
// https://tc39.es/ecma262/#sec-object.getownpropertynames
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  return internalObjectKeys(O, hiddenKeys);
};


/***/ }),

/***/ 77489:
/***/ ((__unused_webpack_module, exports) => {

"use strict";

// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
exports.f = Object.getOwnPropertySymbols;


/***/ }),

/***/ 85726:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var uncurryThis = __webpack_require__(76891);

module.exports = uncurryThis({}.isPrototypeOf);


/***/ }),

/***/ 87122:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var uncurryThis = __webpack_require__(76891);
var hasOwn = __webpack_require__(93120);
var toIndexedObject = __webpack_require__(65065);
var indexOf = (__webpack_require__(6170).indexOf);
var hiddenKeys = __webpack_require__(43698);

var push = uncurryThis([].push);

module.exports = function (object, names) {
  var O = toIndexedObject(object);
  var i = 0;
  var result = [];
  var key;
  for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  // Don't enum bug & hidden keys
  while (names.length > i) if (hasOwn(O, key = names[i++])) {
    ~indexOf(result, key) || push(result, key);
  }
  return result;
};


/***/ }),

/***/ 95075:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var internalObjectKeys = __webpack_require__(87122);
var enumBugKeys = __webpack_require__(62071);

// `Object.keys` method
// https://tc39.es/ecma262/#sec-object.keys
// eslint-disable-next-line es/no-object-keys -- safe
module.exports = Object.keys || function keys(O) {
  return internalObjectKeys(O, enumBugKeys);
};


/***/ }),

/***/ 79804:
/***/ ((__unused_webpack_module, exports) => {

"use strict";

var $propertyIsEnumerable = {}.propertyIsEnumerable;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

// Nashorn ~ JDK8 bug
var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);

// `Object.prototype.propertyIsEnumerable` method implementation
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  var descriptor = getOwnPropertyDescriptor(this, V);
  return !!descriptor && descriptor.enumerable;
} : $propertyIsEnumerable;


/***/ }),

/***/ 36718:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

/* eslint-disable no-proto -- safe */
var uncurryThisAccessor = __webpack_require__(54809);
var anObject = __webpack_require__(70517);
var aPossiblePrototype = __webpack_require__(21704);

// `Object.setPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.setprototypeof
// Works with __proto__ only. Old v8 can't work with null proto objects.
// eslint-disable-next-line es/no-object-setprototypeof -- safe
module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  var CORRECT_SETTER = false;
  var test = {};
  var setter;
  try {
    setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
    setter(test, []);
    CORRECT_SETTER = test instanceof Array;
  } catch (error) { /* empty */ }
  return function setPrototypeOf(O, proto) {
    anObject(O);
    aPossiblePrototype(proto);
    if (CORRECT_SETTER) setter(O, proto);
    else O.__proto__ = proto;
    return O;
  };
}() : undefined);


/***/ }),

/***/ 10735:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var call = __webpack_require__(21327);
var isCallable = __webpack_require__(35340);
var isObject = __webpack_require__(48159);

var $TypeError = TypeError;

// `OrdinaryToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
module.exports = function (input, pref) {
  var fn, val;
  if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
  if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
  if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
  throw $TypeError("Can't convert object to primitive value");
};


/***/ }),

/***/ 55275:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var getBuiltIn = __webpack_require__(33492);
var uncurryThis = __webpack_require__(76891);
var getOwnPropertyNamesModule = __webpack_require__(94255);
var getOwnPropertySymbolsModule = __webpack_require__(77489);
var anObject = __webpack_require__(70517);

var concat = uncurryThis([].concat);

// all object keys, includes non-enumerable and symbols
module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  var keys = getOwnPropertyNamesModule.f(anObject(it));
  var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
};


/***/ }),

/***/ 62556:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var defineProperty = (__webpack_require__(70784).f);

module.exports = function (Target, Source, key) {
  key in Target || defineProperty(Target, key, {
    configurable: true,
    get: function () { return Source[key]; },
    set: function (it) { Source[key] = it; }
  });
};


/***/ }),

/***/ 64405:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var isNullOrUndefined = __webpack_require__(8276);

var $TypeError = TypeError;

// `RequireObjectCoercible` abstract operation
// https://tc39.es/ecma262/#sec-requireobjectcoercible
module.exports = function (it) {
  if (isNullOrUndefined(it)) throw $TypeError("Can't call method on " + it);
  return it;
};


/***/ }),

/***/ 95174:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var shared = __webpack_require__(53762);
var uid = __webpack_require__(37135);

var keys = shared('keys');

module.exports = function (key) {
  return keys[key] || (keys[key] = uid(key));
};


/***/ }),

/***/ 88655:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var global = __webpack_require__(17773);
var defineGlobalProperty = __webpack_require__(43637);

var SHARED = '__core-js_shared__';
var store = global[SHARED] || defineGlobalProperty(SHARED, {});

module.exports = store;


/***/ }),

/***/ 53762:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var IS_PURE = __webpack_require__(37259);
var store = __webpack_require__(88655);

(module.exports = function (key, value) {
  return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
  version: '3.32.0',
  mode: IS_PURE ? 'pure' : 'global',
  copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
  license: 'https://github.com/zloirock/core-js/blob/v3.32.0/LICENSE',
  source: 'https://github.com/zloirock/core-js'
});


/***/ }),

/***/ 78223:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

/* eslint-disable es/no-symbol -- required for testing */
var V8_VERSION = __webpack_require__(48051);
var fails = __webpack_require__(62728);
var global = __webpack_require__(17773);

var $String = global.String;

// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  var symbol = Symbol();
  // Chrome 38 Symbol has incorrect toString conversion
  // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
  // of course, fail.
  return !$String(symbol) || !(Object(symbol) instanceof Symbol) ||
    // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
    !Symbol.sham && V8_VERSION && V8_VERSION < 41;
});


/***/ }),

/***/ 3343:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var toIntegerOrInfinity = __webpack_require__(75147);

var max = Math.max;
var min = Math.min;

// Helper for a popular repeating case of the spec:
// Let integer be ? ToInteger(index).
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
module.exports = function (index, length) {
  var integer = toIntegerOrInfinity(index);
  return integer < 0 ? max(integer + length, 0) : min(integer, length);
};


/***/ }),

/***/ 65065:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

// toObject with fallback for non-array-like ES3 strings
var IndexedObject = __webpack_require__(91546);
var requireObjectCoercible = __webpack_require__(64405);

module.exports = function (it) {
  return IndexedObject(requireObjectCoercible(it));
};


/***/ }),

/***/ 75147:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var trunc = __webpack_require__(54279);

// `ToIntegerOrInfinity` abstract operation
// https://tc39.es/ecma262/#sec-tointegerorinfinity
module.exports = function (argument) {
  var number = +argument;
  // eslint-disable-next-line no-self-compare -- NaN check
  return number !== number || number === 0 ? 0 : trunc(number);
};


/***/ }),

/***/ 93292:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var toIntegerOrInfinity = __webpack_require__(75147);

var min = Math.min;

// `ToLength` abstract operation
// https://tc39.es/ecma262/#sec-tolength
module.exports = function (argument) {
  return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
};


/***/ }),

/***/ 80358:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var requireObjectCoercible = __webpack_require__(64405);

var $Object = Object;

// `ToObject` abstract operation
// https://tc39.es/ecma262/#sec-toobject
module.exports = function (argument) {
  return $Object(requireObjectCoercible(argument));
};


/***/ }),

/***/ 73178:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var call = __webpack_require__(21327);
var isObject = __webpack_require__(48159);
var isSymbol = __webpack_require__(48136);
var getMethod = __webpack_require__(79570);
var ordinaryToPrimitive = __webpack_require__(10735);
var wellKnownSymbol = __webpack_require__(37366);

var $TypeError = TypeError;
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');

// `ToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-toprimitive
module.exports = function (input, pref) {
  if (!isObject(input) || isSymbol(input)) return input;
  var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  var result;
  if (exoticToPrim) {
    if (pref === undefined) pref = 'default';
    result = call(exoticToPrim, input, pref);
    if (!isObject(result) || isSymbol(result)) return result;
    throw $TypeError("Can't convert object to primitive value");
  }
  if (pref === undefined) pref = 'number';
  return ordinaryToPrimitive(input, pref);
};


/***/ }),

/***/ 3255:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var toPrimitive = __webpack_require__(73178);
var isSymbol = __webpack_require__(48136);

// `ToPropertyKey` abstract operation
// https://tc39.es/ecma262/#sec-topropertykey
module.exports = function (argument) {
  var key = toPrimitive(argument, 'string');
  return isSymbol(key) ? key : key + '';
};


/***/ }),

/***/ 24278:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var wellKnownSymbol = __webpack_require__(37366);

var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var test = {};

test[TO_STRING_TAG] = 'z';

module.exports = String(test) === '[object z]';


/***/ }),

/***/ 87257:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var classof = __webpack_require__(34688);

var $String = String;

module.exports = function (argument) {
  if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
  return $String(argument);
};


/***/ }),

/***/ 82910:
/***/ ((module) => {

"use strict";

var $String = String;

module.exports = function (argument) {
  try {
    return $String(argument);
  } catch (error) {
    return 'Object';
  }
};


/***/ }),

/***/ 37135:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var uncurryThis = __webpack_require__(76891);

var id = 0;
var postfix = Math.random();
var toString = uncurryThis(1.0.toString);

module.exports = function (key) {
  return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
};


/***/ }),

/***/ 14167:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

/* eslint-disable es/no-symbol -- required for testing */
var NATIVE_SYMBOL = __webpack_require__(78223);

module.exports = NATIVE_SYMBOL
  && !Symbol.sham
  && typeof Symbol.iterator == 'symbol';


/***/ }),

/***/ 74060:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var DESCRIPTORS = __webpack_require__(97581);
var fails = __webpack_require__(62728);

// V8 ~ Chrome 36-
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
module.exports = DESCRIPTORS && fails(function () {
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  return Object.defineProperty(function () { /* empty */ }, 'prototype', {
    value: 42,
    writable: false
  }).prototype != 42;
});


/***/ }),

/***/ 6427:
/***/ ((module) => {

"use strict";

var $TypeError = TypeError;

module.exports = function (passed, required) {
  if (passed < required) throw $TypeError('Not enough arguments');
  return passed;
};


/***/ }),

/***/ 40114:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var global = __webpack_require__(17773);
var isCallable = __webpack_require__(35340);

var WeakMap = global.WeakMap;

module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));


/***/ }),

/***/ 37366:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var global = __webpack_require__(17773);
var shared = __webpack_require__(53762);
var hasOwn = __webpack_require__(93120);
var uid = __webpack_require__(37135);
var NATIVE_SYMBOL = __webpack_require__(78223);
var USE_SYMBOL_AS_UID = __webpack_require__(14167);

var Symbol = global.Symbol;
var WellKnownSymbolsStore = shared('wks');
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;

module.exports = function (name) {
  if (!hasOwn(WellKnownSymbolsStore, name)) {
    WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name)
      ? Symbol[name]
      : createWellKnownSymbol('Symbol.' + name);
  } return WellKnownSymbolsStore[name];
};


/***/ }),

/***/ 1450:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var getBuiltIn = __webpack_require__(33492);
var hasOwn = __webpack_require__(93120);
var createNonEnumerableProperty = __webpack_require__(29671);
var isPrototypeOf = __webpack_require__(85726);
var setPrototypeOf = __webpack_require__(36718);
var copyConstructorProperties = __webpack_require__(28932);
var proxyAccessor = __webpack_require__(62556);
var inheritIfRequired = __webpack_require__(19525);
var normalizeStringArgument = __webpack_require__(21160);
var installErrorCause = __webpack_require__(59710);
var installErrorStack = __webpack_require__(11496);
var DESCRIPTORS = __webpack_require__(97581);
var IS_PURE = __webpack_require__(37259);

module.exports = function (FULL_NAME, wrapper, FORCED, IS_AGGREGATE_ERROR) {
  var STACK_TRACE_LIMIT = 'stackTraceLimit';
  var OPTIONS_POSITION = IS_AGGREGATE_ERROR ? 2 : 1;
  var path = FULL_NAME.split('.');
  var ERROR_NAME = path[path.length - 1];
  var OriginalError = getBuiltIn.apply(null, path);

  if (!OriginalError) return;

  var OriginalErrorPrototype = OriginalError.prototype;

  // V8 9.3- bug https://bugs.chromium.org/p/v8/issues/detail?id=12006
  if (!IS_PURE && hasOwn(OriginalErrorPrototype, 'cause')) delete OriginalErrorPrototype.cause;

  if (!FORCED) return OriginalError;

  var BaseError = getBuiltIn('Error');

  var WrappedError = wrapper(function (a, b) {
    var message = normalizeStringArgument(IS_AGGREGATE_ERROR ? b : a, undefined);
    var result = IS_AGGREGATE_ERROR ? new OriginalError(a) : new OriginalError();
    if (message !== undefined) createNonEnumerableProperty(result, 'message', message);
    installErrorStack(result, WrappedError, result.stack, 2);
    if (this && isPrototypeOf(OriginalErrorPrototype, this)) inheritIfRequired(result, this, WrappedError);
    if (arguments.length > OPTIONS_POSITION) installErrorCause(result, arguments[OPTIONS_POSITION]);
    return result;
  });

  WrappedError.prototype = OriginalErrorPrototype;

  if (ERROR_NAME !== 'Error') {
    if (setPrototypeOf) setPrototypeOf(WrappedError, BaseError);
    else copyConstructorProperties(WrappedError, BaseError, { name: true });
  } else if (DESCRIPTORS && STACK_TRACE_LIMIT in OriginalError) {
    proxyAccessor(WrappedError, OriginalError, STACK_TRACE_LIMIT);
    proxyAccessor(WrappedError, OriginalError, 'prepareStackTrace');
  }

  copyConstructorProperties(WrappedError, OriginalError);

  if (!IS_PURE) try {
    // Safari 13- bug: WebAssembly errors does not have a proper `.name`
    if (OriginalErrorPrototype.name !== ERROR_NAME) {
      createNonEnumerableProperty(OriginalErrorPrototype, 'name', ERROR_NAME);
    }
    OriginalErrorPrototype.constructor = WrappedError;
  } catch (error) { /* empty */ }

  return WrappedError;
};


/***/ }),

/***/ 89718:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var $ = __webpack_require__(24134);
var $includes = (__webpack_require__(6170).includes);
var fails = __webpack_require__(62728);
var addToUnscopables = __webpack_require__(3303);

// FF99+ bug
var BROKEN_ON_SPARSE = fails(function () {
  // eslint-disable-next-line es/no-array-prototype-includes -- detection
  return !Array(1).includes();
});

// `Array.prototype.includes` method
// https://tc39.es/ecma262/#sec-array.prototype.includes
$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
  includes: function includes(el /* , fromIndex = 0 */) {
    return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  }
});

// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables('includes');


/***/ }),

/***/ 12106:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var $ = __webpack_require__(24134);
var toObject = __webpack_require__(80358);
var lengthOfArrayLike = __webpack_require__(35119);
var setArrayLength = __webpack_require__(51491);
var doesNotExceedSafeInteger = __webpack_require__(73929);
var fails = __webpack_require__(62728);

var INCORRECT_TO_LENGTH = fails(function () {
  return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
});

// V8 and Safari <= 15.4, FF < 23 throws InternalError
// https://bugs.chromium.org/p/v8/issues/detail?id=12681
var properErrorOnNonWritableLength = function () {
  try {
    // eslint-disable-next-line es/no-object-defineproperty -- safe
    Object.defineProperty([], 'length', { writable: false }).push();
  } catch (error) {
    return error instanceof TypeError;
  }
};

var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();

// `Array.prototype.push` method
// https://tc39.es/ecma262/#sec-array.prototype.push
$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
  // eslint-disable-next-line no-unused-vars -- required for `.length`
  push: function push(item) {
    var O = toObject(this);
    var len = lengthOfArrayLike(O);
    var argCount = arguments.length;
    doesNotExceedSafeInteger(len + argCount);
    for (var i = 0; i < argCount; i++) {
      O[len] = arguments[i];
      len++;
    }
    setArrayLength(O, len);
    return len;
  }
});


/***/ }),

/***/ 15004:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var $ = __webpack_require__(24134);
var $reduce = (__webpack_require__(9237).left);
var arrayMethodIsStrict = __webpack_require__(29722);
var CHROME_VERSION = __webpack_require__(48051);
var IS_NODE = __webpack_require__(17567);

// Chrome 80-82 has a critical bug
// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
var FORCED = CHROME_BUG || !arrayMethodIsStrict('reduce');

// `Array.prototype.reduce` method
// https://tc39.es/ecma262/#sec-array.prototype.reduce
$({ target: 'Array', proto: true, forced: FORCED }, {
  reduce: function reduce(callbackfn /* , initialValue */) {
    var length = arguments.length;
    return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
  }
});


/***/ }),

/***/ 82514:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

/* eslint-disable no-unused-vars -- required for functions `.length` */
var $ = __webpack_require__(24134);
var global = __webpack_require__(17773);
var apply = __webpack_require__(72504);
var wrapErrorConstructorWithCause = __webpack_require__(1450);

var WEB_ASSEMBLY = 'WebAssembly';
var WebAssembly = global[WEB_ASSEMBLY];

var FORCED = Error('e', { cause: 7 }).cause !== 7;

var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) {
  var O = {};
  O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED);
  $({ global: true, constructor: true, arity: 1, forced: FORCED }, O);
};

var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
  if (WebAssembly && WebAssembly[ERROR_NAME]) {
    var O = {};
    O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED);
    $({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED }, O);
  }
};

// https://tc39.es/ecma262/#sec-nativeerror
exportGlobalErrorCauseWrapper('Error', function (init) {
  return function Error(message) { return apply(init, this, arguments); };
});
exportGlobalErrorCauseWrapper('EvalError', function (init) {
  return function EvalError(message) { return apply(init, this, arguments); };
});
exportGlobalErrorCauseWrapper('RangeError', function (init) {
  return function RangeError(message) { return apply(init, this, arguments); };
});
exportGlobalErrorCauseWrapper('ReferenceError', function (init) {
  return function ReferenceError(message) { return apply(init, this, arguments); };
});
exportGlobalErrorCauseWrapper('SyntaxError', function (init) {
  return function SyntaxError(message) { return apply(init, this, arguments); };
});
exportGlobalErrorCauseWrapper('TypeError', function (init) {
  return function TypeError(message) { return apply(init, this, arguments); };
});
exportGlobalErrorCauseWrapper('URIError', function (init) {
  return function URIError(message) { return apply(init, this, arguments); };
});
exportWebAssemblyErrorCauseWrapper('CompileError', function (init) {
  return function CompileError(message) { return apply(init, this, arguments); };
});
exportWebAssemblyErrorCauseWrapper('LinkError', function (init) {
  return function LinkError(message) { return apply(init, this, arguments); };
});
exportWebAssemblyErrorCauseWrapper('RuntimeError', function (init) {
  return function RuntimeError(message) { return apply(init, this, arguments); };
});


/***/ }),

/***/ 44088:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var $ = __webpack_require__(24134);
var global = __webpack_require__(17773);
var defineBuiltInAccessor = __webpack_require__(70636);
var DESCRIPTORS = __webpack_require__(97581);

var $TypeError = TypeError;
// eslint-disable-next-line es/no-object-defineproperty -- safe
var defineProperty = Object.defineProperty;
var INCORRECT_VALUE = global.self !== global;

// `self` getter
// https://html.spec.whatwg.org/multipage/window-object.html#dom-self
try {
  if (DESCRIPTORS) {
    // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
    var descriptor = Object.getOwnPropertyDescriptor(global, 'self');
    // some engines have `self`, but with incorrect descriptor
    // https://github.com/denoland/deno/issues/15765
    if (INCORRECT_VALUE || !descriptor || !descriptor.get || !descriptor.enumerable) {
      defineBuiltInAccessor(global, 'self', {
        get: function self() {
          return global;
        },
        set: function self(value) {
          if (this !== global) throw $TypeError('Illegal invocation');
          defineProperty(global, 'self', {
            value: value,
            writable: true,
            configurable: true,
            enumerable: true
          });
        },
        configurable: true,
        enumerable: true
      });
    }
  } else $({ global: true, simple: true, forced: INCORRECT_VALUE }, {
    self: global
  });
} catch (error) { /* empty */ }


/***/ }),

/***/ 46379:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var defineBuiltIn = __webpack_require__(27919);
var uncurryThis = __webpack_require__(76891);
var toString = __webpack_require__(87257);
var validateArgumentsLength = __webpack_require__(6427);

var $URLSearchParams = URLSearchParams;
var URLSearchParamsPrototype = $URLSearchParams.prototype;
var append = uncurryThis(URLSearchParamsPrototype.append);
var $delete = uncurryThis(URLSearchParamsPrototype['delete']);
var forEach = uncurryThis(URLSearchParamsPrototype.forEach);
var push = uncurryThis([].push);
var params = new $URLSearchParams('a=1&a=2&b=3');

params['delete']('a', 1);
// `undefined` case is a Chromium 117 bug
// https://bugs.chromium.org/p/v8/issues/detail?id=14222
params['delete']('b', undefined);

if (params + '' !== 'a=2') {
  defineBuiltIn(URLSearchParamsPrototype, 'delete', function (name /* , value */) {
    var length = arguments.length;
    var $value = length < 2 ? undefined : arguments[1];
    if (length && $value === undefined) return $delete(this, name);
    var entries = [];
    forEach(this, function (v, k) { // also validates `this`
      push(entries, { key: k, value: v });
    });
    validateArgumentsLength(length, 1);
    var key = toString(name);
    var value = toString($value);
    var index = 0;
    var dindex = 0;
    var found = false;
    var entriesLength = entries.length;
    var entry;
    while (index < entriesLength) {
      entry = entries[index++];
      if (found || entry.key === key) {
        found = true;
        $delete(this, entry.key);
      } else dindex++;
    }
    while (dindex < entriesLength) {
      entry = entries[dindex++];
      if (!(entry.key === key && entry.value === value)) append(this, entry.key, entry.value);
    }
  }, { enumerable: true, unsafe: true });
}


/***/ }),

/***/ 79250:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var defineBuiltIn = __webpack_require__(27919);
var uncurryThis = __webpack_require__(76891);
var toString = __webpack_require__(87257);
var validateArgumentsLength = __webpack_require__(6427);

var $URLSearchParams = URLSearchParams;
var URLSearchParamsPrototype = $URLSearchParams.prototype;
var getAll = uncurryThis(URLSearchParamsPrototype.getAll);
var $has = uncurryThis(URLSearchParamsPrototype.has);
var params = new $URLSearchParams('a=1');

// `undefined` case is a Chromium 117 bug
// https://bugs.chromium.org/p/v8/issues/detail?id=14222
if (params.has('a', 2) || !params.has('a', undefined)) {
  defineBuiltIn(URLSearchParamsPrototype, 'has', function has(name /* , value */) {
    var length = arguments.length;
    var $value = length < 2 ? undefined : arguments[1];
    if (length && $value === undefined) return $has(this, name);
    var values = getAll(this, name); // also validates `this`
    validateArgumentsLength(length, 1);
    var value = toString($value);
    var index = 0;
    while (index < values.length) {
      if (values[index++] === value) return true;
    } return false;
  }, { enumerable: true, unsafe: true });
}


/***/ }),

/***/ 32551:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {

"use strict";

var DESCRIPTORS = __webpack_require__(97581);
var uncurryThis = __webpack_require__(76891);
var defineBuiltInAccessor = __webpack_require__(70636);

var URLSearchParamsPrototype = URLSearchParams.prototype;
var forEach = uncurryThis(URLSearchParamsPrototype.forEach);

// `URLSearchParams.prototype.size` getter
// https://github.com/whatwg/url/pull/734
if (DESCRIPTORS && !('size' in URLSearchParamsPrototype)) {
  defineBuiltInAccessor(URLSearchParamsPrototype, 'size', {
    get: function size() {
      var count = 0;
      forEach(this, function () { count++; });
      return count;
    },
    configurable: true,
    enumerable: true
  });
}


/***/ }),

/***/ 26226:
/***/ ((module) => {

"use strict";


/*
  MIT License http://www.opensource.org/licenses/mit-license.php
  Author Tobias Koppers @sokra
*/
module.exports = function (cssWithMappingToString) {
  var list = [];

  // return the list of modules as css string
  list.toString = function toString() {
    return this.map(function (item) {
      var content = "";
      var needLayer = typeof item[5] !== "undefined";
      if (item[4]) {
        content += "@supports (".concat(item[4], ") {");
      }
      if (item[2]) {
        content += "@media ".concat(item[2], " {");
      }
      if (needLayer) {
        content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
      }
      content += cssWithMappingToString(item);
      if (needLayer) {
        content += "}";
      }
      if (item[2]) {
        content += "}";
      }
      if (item[4]) {
        content += "}";
      }
      return content;
    }).join("");
  };

  // import a list of modules into the list
  list.i = function i(modules, media, dedupe, supports, layer) {
    if (typeof modules === "string") {
      modules = [[null, modules, undefined]];
    }
    var alreadyImportedModules = {};
    if (dedupe) {
      for (var k = 0; k < this.length; k++) {
        var id = this[k][0];
        if (id != null) {
          alreadyImportedModules[id] = true;
        }
      }
    }
    for (var _k = 0; _k < modules.length; _k++) {
      var item = [].concat(modules[_k]);
      if (dedupe && alreadyImportedModules[item[0]]) {
        continue;
      }
      if (typeof layer !== "undefined") {
        if (typeof item[5] === "undefined") {
          item[5] = layer;
        } else {
          item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
          item[5] = layer;
        }
      }
      if (media) {
        if (!item[2]) {
          item[2] = media;
        } else {
          item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
          item[2] = media;
        }
      }
      if (supports) {
        if (!item[4]) {
          item[4] = "".concat(supports);
        } else {
          item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
          item[4] = supports;
        }
      }
      list.push(item);
    }
  };
  return list;
};

/***/ }),

/***/ 52229:
/***/ ((module) => {

"use strict";


module.exports = function (i) {
  return i[1];
};

/***/ }),

/***/ 57696:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "Z": () => (/* binding */ format)
});

;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/requiredArgs/index.js
function requiredArgs(required, args) {
  if (args.length < required) {
    throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
  }
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isDate/index.js
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }


/**
 * @name isDate
 * @category Common Helpers
 * @summary Is the given value a date?
 *
 * @description
 * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
 *
 * @param {*} value - the value to check
 * @returns {boolean} true if the given value is a date
 * @throws {TypeError} 1 arguments required
 *
 * @example
 * // For a valid date:
 * const result = isDate(new Date())
 * //=> true
 *
 * @example
 * // For an invalid date:
 * const result = isDate(new Date(NaN))
 * //=> true
 *
 * @example
 * // For some value:
 * const result = isDate('2014-02-31')
 * //=> false
 *
 * @example
 * // For an object:
 * const result = isDate({})
 * //=> false
 */

function isDate(value) {
  requiredArgs(1, arguments);
  return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/toDate/index.js
function toDate_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { toDate_typeof = function _typeof(obj) { return typeof obj; }; } else { toDate_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return toDate_typeof(obj); }


/**
 * @name toDate
 * @category Common Helpers
 * @summary Convert the given argument to an instance of Date.
 *
 * @description
 * Convert the given argument to an instance of Date.
 *
 * If the argument is an instance of Date, the function returns its clone.
 *
 * If the argument is a number, it is treated as a timestamp.
 *
 * If the argument is none of the above, the function returns Invalid Date.
 *
 * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
 *
 * @param {Date|Number} argument - the value to convert
 * @returns {Date} the parsed date in the local time zone
 * @throws {TypeError} 1 argument required
 *
 * @example
 * // Clone the date:
 * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
 * //=> Tue Feb 11 2014 11:30:30
 *
 * @example
 * // Convert the timestamp to date:
 * const result = toDate(1392098430000)
 * //=> Tue Feb 11 2014 11:30:30
 */

function toDate(argument) {
  requiredArgs(1, arguments);
  var argStr = Object.prototype.toString.call(argument); // Clone the date

  if (argument instanceof Date || toDate_typeof(argument) === 'object' && argStr === '[object Date]') {
    // Prevent the date to lose the milliseconds when passed to new Date() in IE10
    return new Date(argument.getTime());
  } else if (typeof argument === 'number' || argStr === '[object Number]') {
    return new Date(argument);
  } else {
    if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
      // eslint-disable-next-line no-console
      console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); // eslint-disable-next-line no-console

      console.warn(new Error().stack);
    }

    return new Date(NaN);
  }
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isValid/index.js



/**
 * @name isValid
 * @category Common Helpers
 * @summary Is the given date valid?
 *
 * @description
 * Returns false if argument is Invalid Date and true otherwise.
 * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
 * Invalid Date is a Date, whose time value is NaN.
 *
 * Time value of Date: http://es5.github.io/#x15.9.1.1
 *
 * @param {*} date - the date to check
 * @returns {Boolean} the date is valid
 * @throws {TypeError} 1 argument required
 *
 * @example
 * // For the valid date:
 * const result = isValid(new Date(2014, 1, 31))
 * //=> true
 *
 * @example
 * // For the value, convertable into a date:
 * const result = isValid(1393804800000)
 * //=> true
 *
 * @example
 * // For the invalid date:
 * const result = isValid(new Date(''))
 * //=> false
 */

function isValid(dirtyDate) {
  requiredArgs(1, arguments);

  if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
    return false;
  }

  var date = toDate(dirtyDate);
  return !isNaN(Number(date));
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/toInteger/index.js
function toInteger(dirtyNumber) {
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
    return NaN;
  }

  var number = Number(dirtyNumber);

  if (isNaN(number)) {
    return number;
  }

  return number < 0 ? Math.ceil(number) : Math.floor(number);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/addMilliseconds/index.js



/**
 * @name addMilliseconds
 * @category Millisecond Helpers
 * @summary Add the specified number of milliseconds to the given date.
 *
 * @description
 * Add the specified number of milliseconds to the given date.
 *
 * @param {Date|Number} date - the date to be changed
 * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
 * @returns {Date} the new date with the milliseconds added
 * @throws {TypeError} 2 arguments required
 *
 * @example
 * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
 * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
 * //=> Thu Jul 10 2014 12:45:30.750
 */

function addMilliseconds(dirtyDate, dirtyAmount) {
  requiredArgs(2, arguments);
  var timestamp = toDate(dirtyDate).getTime();
  var amount = toInteger(dirtyAmount);
  return new Date(timestamp + amount);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/subMilliseconds/index.js



/**
 * @name subMilliseconds
 * @category Millisecond Helpers
 * @summary Subtract the specified number of milliseconds from the given date.
 *
 * @description
 * Subtract the specified number of milliseconds from the given date.
 *
 * @param {Date|Number} date - the date to be changed
 * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
 * @returns {Date} the new date with the milliseconds subtracted
 * @throws {TypeError} 2 arguments required
 *
 * @example
 * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
 * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
 * //=> Thu Jul 10 2014 12:45:29.250
 */

function subMilliseconds(dirtyDate, dirtyAmount) {
  requiredArgs(2, arguments);
  var amount = toInteger(dirtyAmount);
  return addMilliseconds(dirtyDate, -amount);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js


var MILLISECONDS_IN_DAY = 86400000;
function getUTCDayOfYear(dirtyDate) {
  requiredArgs(1, arguments);
  var date = toDate(dirtyDate);
  var timestamp = date.getTime();
  date.setUTCMonth(0, 1);
  date.setUTCHours(0, 0, 0, 0);
  var startOfYearTimestamp = date.getTime();
  var difference = timestamp - startOfYearTimestamp;
  return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js


function startOfUTCISOWeek(dirtyDate) {
  requiredArgs(1, arguments);
  var weekStartsOn = 1;
  var date = toDate(dirtyDate);
  var day = date.getUTCDay();
  var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
  date.setUTCDate(date.getUTCDate() - diff);
  date.setUTCHours(0, 0, 0, 0);
  return date;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js



function getUTCISOWeekYear(dirtyDate) {
  requiredArgs(1, arguments);
  var date = toDate(dirtyDate);
  var year = date.getUTCFullYear();
  var fourthOfJanuaryOfNextYear = new Date(0);
  fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
  fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
  var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
  var fourthOfJanuaryOfThisYear = new Date(0);
  fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
  fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
  var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);

  if (date.getTime() >= startOfNextYear.getTime()) {
    return year + 1;
  } else if (date.getTime() >= startOfThisYear.getTime()) {
    return year;
  } else {
    return year - 1;
  }
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js



function startOfUTCISOWeekYear(dirtyDate) {
  requiredArgs(1, arguments);
  var year = getUTCISOWeekYear(dirtyDate);
  var fourthOfJanuary = new Date(0);
  fourthOfJanuary.setUTCFullYear(year, 0, 4);
  fourthOfJanuary.setUTCHours(0, 0, 0, 0);
  var date = startOfUTCISOWeek(fourthOfJanuary);
  return date;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js




var MILLISECONDS_IN_WEEK = 604800000;
function getUTCISOWeek(dirtyDate) {
  requiredArgs(1, arguments);
  var date = toDate(dirtyDate);
  var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
  // because the number of milliseconds in a week is not constant
  // (e.g. it's different in the week of the daylight saving time clock shift)

  return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/defaultOptions/index.js
var defaultOptions = {};
function getDefaultOptions() {
  return defaultOptions;
}
function setDefaultOptions(newOptions) {
  defaultOptions = newOptions;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js




function startOfUTCWeek(dirtyDate, options) {
  var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;

  requiredArgs(1, arguments);
  var defaultOptions = getDefaultOptions();
  var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN

  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
    throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
  }

  var date = toDate(dirtyDate);
  var day = date.getUTCDay();
  var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
  date.setUTCDate(date.getUTCDate() - diff);
  date.setUTCHours(0, 0, 0, 0);
  return date;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js





function getUTCWeekYear(dirtyDate, options) {
  var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;

  requiredArgs(1, arguments);
  var date = toDate(dirtyDate);
  var year = date.getUTCFullYear();
  var defaultOptions = getDefaultOptions();
  var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN

  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
    throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
  }

  var firstWeekOfNextYear = new Date(0);
  firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
  firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
  var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
  var firstWeekOfThisYear = new Date(0);
  firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
  firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
  var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);

  if (date.getTime() >= startOfNextYear.getTime()) {
    return year + 1;
  } else if (date.getTime() >= startOfThisYear.getTime()) {
    return year;
  } else {
    return year - 1;
  }
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js





function startOfUTCWeekYear(dirtyDate, options) {
  var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;

  requiredArgs(1, arguments);
  var defaultOptions = getDefaultOptions();
  var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
  var year = getUTCWeekYear(dirtyDate, options);
  var firstWeek = new Date(0);
  firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
  firstWeek.setUTCHours(0, 0, 0, 0);
  var date = startOfUTCWeek(firstWeek, options);
  return date;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCWeek/index.js




var getUTCWeek_MILLISECONDS_IN_WEEK = 604800000;
function getUTCWeek(dirtyDate, options) {
  requiredArgs(1, arguments);
  var date = toDate(dirtyDate);
  var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
  // because the number of milliseconds in a week is not constant
  // (e.g. it's different in the week of the daylight saving time clock shift)

  return Math.round(diff / getUTCWeek_MILLISECONDS_IN_WEEK) + 1;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/addLeadingZeros/index.js
function addLeadingZeros(number, targetLength) {
  var sign = number < 0 ? '-' : '';
  var output = Math.abs(number).toString();

  while (output.length < targetLength) {
    output = '0' + output;
  }

  return sign + output;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/format/lightFormatters/index.js

/*
 * |     | Unit                           |     | Unit                           |
 * |-----|--------------------------------|-----|--------------------------------|
 * |  a  | AM, PM                         |  A* |                                |
 * |  d  | Day of month                   |  D  |                                |
 * |  h  | Hour [1-12]                    |  H  | Hour [0-23]                    |
 * |  m  | Minute                         |  M  | Month                          |
 * |  s  | Second                         |  S  | Fraction of second             |
 * |  y  | Year (abs)                     |  Y  |                                |
 *
 * Letters marked by * are not implemented but reserved by Unicode standard.
 */

var formatters = {
  // Year
  y: function y(date, token) {
    // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
    // | Year     |     y | yy |   yyy |  yyyy | yyyyy |
    // |----------|-------|----|-------|-------|-------|
    // | AD 1     |     1 | 01 |   001 |  0001 | 00001 |
    // | AD 12    |    12 | 12 |   012 |  0012 | 00012 |
    // | AD 123   |   123 | 23 |   123 |  0123 | 00123 |
    // | AD 1234  |  1234 | 34 |  1234 |  1234 | 01234 |
    // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
    var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)

    var year = signedYear > 0 ? signedYear : 1 - signedYear;
    return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
  },
  // Month
  M: function M(date, token) {
    var month = date.getUTCMonth();
    return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
  },
  // Day of the month
  d: function d(date, token) {
    return addLeadingZeros(date.getUTCDate(), token.length);
  },
  // AM or PM
  a: function a(date, token) {
    var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';

    switch (token) {
      case 'a':
      case 'aa':
        return dayPeriodEnumValue.toUpperCase();

      case 'aaa':
        return dayPeriodEnumValue;

      case 'aaaaa':
        return dayPeriodEnumValue[0];

      case 'aaaa':
      default:
        return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
    }
  },
  // Hour [1-12]
  h: function h(date, token) {
    return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
  },
  // Hour [0-23]
  H: function H(date, token) {
    return addLeadingZeros(date.getUTCHours(), token.length);
  },
  // Minute
  m: function m(date, token) {
    return addLeadingZeros(date.getUTCMinutes(), token.length);
  },
  // Second
  s: function s(date, token) {
    return addLeadingZeros(date.getUTCSeconds(), token.length);
  },
  // Fraction of second
  S: function S(date, token) {
    var numberOfDigits = token.length;
    var milliseconds = date.getUTCMilliseconds();
    var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
    return addLeadingZeros(fractionalSeconds, token.length);
  }
};
/* harmony default export */ const lightFormatters = (formatters);
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/format/formatters/index.js







var dayPeriodEnum = {
  am: 'am',
  pm: 'pm',
  midnight: 'midnight',
  noon: 'noon',
  morning: 'morning',
  afternoon: 'afternoon',
  evening: 'evening',
  night: 'night'
};

/*
 * |     | Unit                           |     | Unit                           |
 * |-----|--------------------------------|-----|--------------------------------|
 * |  a  | AM, PM                         |  A* | Milliseconds in day            |
 * |  b  | AM, PM, noon, midnight         |  B  | Flexible day period            |
 * |  c  | Stand-alone local day of week  |  C* | Localized hour w/ day period   |
 * |  d  | Day of month                   |  D  | Day of year                    |
 * |  e  | Local day of week              |  E  | Day of week                    |
 * |  f  |                                |  F* | Day of week in month           |
 * |  g* | Modified Julian day            |  G  | Era                            |
 * |  h  | Hour [1-12]                    |  H  | Hour [0-23]                    |
 * |  i! | ISO day of week                |  I! | ISO week of year               |
 * |  j* | Localized hour w/ day period   |  J* | Localized hour w/o day period  |
 * |  k  | Hour [1-24]                    |  K  | Hour [0-11]                    |
 * |  l* | (deprecated)                   |  L  | Stand-alone month              |
 * |  m  | Minute                         |  M  | Month                          |
 * |  n  |                                |  N  |                                |
 * |  o! | Ordinal number modifier        |  O  | Timezone (GMT)                 |
 * |  p! | Long localized time            |  P! | Long localized date            |
 * |  q  | Stand-alone quarter            |  Q  | Quarter                        |
 * |  r* | Related Gregorian year         |  R! | ISO week-numbering year        |
 * |  s  | Second                         |  S  | Fraction of second             |
 * |  t! | Seconds timestamp              |  T! | Milliseconds timestamp         |
 * |  u  | Extended year                  |  U* | Cyclic year                    |
 * |  v* | Timezone (generic non-locat.)  |  V* | Timezone (location)            |
 * |  w  | Local week of year             |  W* | Week of month                  |
 * |  x  | Timezone (ISO-8601 w/o Z)      |  X  | Timezone (ISO-8601)            |
 * |  y  | Year (abs)                     |  Y  | Local week-numbering year      |
 * |  z  | Timezone (specific non-locat.) |  Z* | Timezone (aliases)             |
 *
 * Letters marked by * are not implemented but reserved by Unicode standard.
 *
 * Letters marked by ! are non-standard, but implemented by date-fns:
 * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
 * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
 *   i.e. 7 for Sunday, 1 for Monday, etc.
 * - `I` is ISO week of year, as opposed to `w` which is local week of year.
 * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
 *   `R` is supposed to be used in conjunction with `I` and `i`
 *   for universal ISO week-numbering date, whereas
 *   `Y` is supposed to be used in conjunction with `w` and `e`
 *   for week-numbering date specific to the locale.
 * - `P` is long localized date format
 * - `p` is long localized time format
 */
var formatters_formatters = {
  // Era
  G: function G(date, token, localize) {
    var era = date.getUTCFullYear() > 0 ? 1 : 0;

    switch (token) {
      // AD, BC
      case 'G':
      case 'GG':
      case 'GGG':
        return localize.era(era, {
          width: 'abbreviated'
        });
      // A, B

      case 'GGGGG':
        return localize.era(era, {
          width: 'narrow'
        });
      // Anno Domini, Before Christ

      case 'GGGG':
      default:
        return localize.era(era, {
          width: 'wide'
        });
    }
  },
  // Year
  y: function y(date, token, localize) {
    // Ordinal number
    if (token === 'yo') {
      var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)

      var year = signedYear > 0 ? signedYear : 1 - signedYear;
      return localize.ordinalNumber(year, {
        unit: 'year'
      });
    }

    return lightFormatters.y(date, token);
  },
  // Local week-numbering year
  Y: function Y(date, token, localize, options) {
    var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)

    var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year

    if (token === 'YY') {
      var twoDigitYear = weekYear % 100;
      return addLeadingZeros(twoDigitYear, 2);
    } // Ordinal number


    if (token === 'Yo') {
      return localize.ordinalNumber(weekYear, {
        unit: 'year'
      });
    } // Padding


    return addLeadingZeros(weekYear, token.length);
  },
  // ISO week-numbering year
  R: function R(date, token) {
    var isoWeekYear = getUTCISOWeekYear(date); // Padding

    return addLeadingZeros(isoWeekYear, token.length);
  },
  // Extended year. This is a single number designating the year of this calendar system.
  // The main difference between `y` and `u` localizers are B.C. years:
  // | Year | `y` | `u` |
  // |------|-----|-----|
  // | AC 1 |   1 |   1 |
  // | BC 1 |   1 |   0 |
  // | BC 2 |   2 |  -1 |
  // Also `yy` always returns the last two digits of a year,
  // while `uu` pads single digit years to 2 characters and returns other years unchanged.
  u: function u(date, token) {
    var year = date.getUTCFullYear();
    return addLeadingZeros(year, token.length);
  },
  // Quarter
  Q: function Q(date, token, localize) {
    var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);

    switch (token) {
      // 1, 2, 3, 4
      case 'Q':
        return String(quarter);
      // 01, 02, 03, 04

      case 'QQ':
        return addLeadingZeros(quarter, 2);
      // 1st, 2nd, 3rd, 4th

      case 'Qo':
        return localize.ordinalNumber(quarter, {
          unit: 'quarter'
        });
      // Q1, Q2, Q3, Q4

      case 'QQQ':
        return localize.quarter(quarter, {
          width: 'abbreviated',
          context: 'formatting'
        });
      // 1, 2, 3, 4 (narrow quarter; could be not numerical)

      case 'QQQQQ':
        return localize.quarter(quarter, {
          width: 'narrow',
          context: 'formatting'
        });
      // 1st quarter, 2nd quarter, ...

      case 'QQQQ':
      default:
        return localize.quarter(quarter, {
          width: 'wide',
          context: 'formatting'
        });
    }
  },
  // Stand-alone quarter
  q: function q(date, token, localize) {
    var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);

    switch (token) {
      // 1, 2, 3, 4
      case 'q':
        return String(quarter);
      // 01, 02, 03, 04

      case 'qq':
        return addLeadingZeros(quarter, 2);
      // 1st, 2nd, 3rd, 4th

      case 'qo':
        return localize.ordinalNumber(quarter, {
          unit: 'quarter'
        });
      // Q1, Q2, Q3, Q4

      case 'qqq':
        return localize.quarter(quarter, {
          width: 'abbreviated',
          context: 'standalone'
        });
      // 1, 2, 3, 4 (narrow quarter; could be not numerical)

      case 'qqqqq':
        return localize.quarter(quarter, {
          width: 'narrow',
          context: 'standalone'
        });
      // 1st quarter, 2nd quarter, ...

      case 'qqqq':
      default:
        return localize.quarter(quarter, {
          width: 'wide',
          context: 'standalone'
        });
    }
  },
  // Month
  M: function M(date, token, localize) {
    var month = date.getUTCMonth();

    switch (token) {
      case 'M':
      case 'MM':
        return lightFormatters.M(date, token);
      // 1st, 2nd, ..., 12th

      case 'Mo':
        return localize.ordinalNumber(month + 1, {
          unit: 'month'
        });
      // Jan, Feb, ..., Dec

      case 'MMM':
        return localize.month(month, {
          width: 'abbreviated',
          context: 'formatting'
        });
      // J, F, ..., D

      case 'MMMMM':
        return localize.month(month, {
          width: 'narrow',
          context: 'formatting'
        });
      // January, February, ..., December

      case 'MMMM':
      default:
        return localize.month(month, {
          width: 'wide',
          context: 'formatting'
        });
    }
  },
  // Stand-alone month
  L: function L(date, token, localize) {
    var month = date.getUTCMonth();

    switch (token) {
      // 1, 2, ..., 12
      case 'L':
        return String(month + 1);
      // 01, 02, ..., 12

      case 'LL':
        return addLeadingZeros(month + 1, 2);
      // 1st, 2nd, ..., 12th

      case 'Lo':
        return localize.ordinalNumber(month + 1, {
          unit: 'month'
        });
      // Jan, Feb, ..., Dec

      case 'LLL':
        return localize.month(month, {
          width: 'abbreviated',
          context: 'standalone'
        });
      // J, F, ..., D

      case 'LLLLL':
        return localize.month(month, {
          width: 'narrow',
          context: 'standalone'
        });
      // January, February, ..., December

      case 'LLLL':
      default:
        return localize.month(month, {
          width: 'wide',
          context: 'standalone'
        });
    }
  },
  // Local week of year
  w: function w(date, token, localize, options) {
    var week = getUTCWeek(date, options);

    if (token === 'wo') {
      return localize.ordinalNumber(week, {
        unit: 'week'
      });
    }

    return addLeadingZeros(week, token.length);
  },
  // ISO week of year
  I: function I(date, token, localize) {
    var isoWeek = getUTCISOWeek(date);

    if (token === 'Io') {
      return localize.ordinalNumber(isoWeek, {
        unit: 'week'
      });
    }

    return addLeadingZeros(isoWeek, token.length);
  },
  // Day of the month
  d: function d(date, token, localize) {
    if (token === 'do') {
      return localize.ordinalNumber(date.getUTCDate(), {
        unit: 'date'
      });
    }

    return lightFormatters.d(date, token);
  },
  // Day of year
  D: function D(date, token, localize) {
    var dayOfYear = getUTCDayOfYear(date);

    if (token === 'Do') {
      return localize.ordinalNumber(dayOfYear, {
        unit: 'dayOfYear'
      });
    }

    return addLeadingZeros(dayOfYear, token.length);
  },
  // Day of week
  E: function E(date, token, localize) {
    var dayOfWeek = date.getUTCDay();

    switch (token) {
      // Tue
      case 'E':
      case 'EE':
      case 'EEE':
        return localize.day(dayOfWeek, {
          width: 'abbreviated',
          context: 'formatting'
        });
      // T

      case 'EEEEE':
        return localize.day(dayOfWeek, {
          width: 'narrow',
          context: 'formatting'
        });
      // Tu

      case 'EEEEEE':
        return localize.day(dayOfWeek, {
          width: 'short',
          context: 'formatting'
        });
      // Tuesday

      case 'EEEE':
      default:
        return localize.day(dayOfWeek, {
          width: 'wide',
          context: 'formatting'
        });
    }
  },
  // Local day of week
  e: function e(date, token, localize, options) {
    var dayOfWeek = date.getUTCDay();
    var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;

    switch (token) {
      // Numerical value (Nth day of week with current locale or weekStartsOn)
      case 'e':
        return String(localDayOfWeek);
      // Padded numerical value

      case 'ee':
        return addLeadingZeros(localDayOfWeek, 2);
      // 1st, 2nd, ..., 7th

      case 'eo':
        return localize.ordinalNumber(localDayOfWeek, {
          unit: 'day'
        });

      case 'eee':
        return localize.day(dayOfWeek, {
          width: 'abbreviated',
          context: 'formatting'
        });
      // T

      case 'eeeee':
        return localize.day(dayOfWeek, {
          width: 'narrow',
          context: 'formatting'
        });
      // Tu

      case 'eeeeee':
        return localize.day(dayOfWeek, {
          width: 'short',
          context: 'formatting'
        });
      // Tuesday

      case 'eeee':
      default:
        return localize.day(dayOfWeek, {
          width: 'wide',
          context: 'formatting'
        });
    }
  },
  // Stand-alone local day of week
  c: function c(date, token, localize, options) {
    var dayOfWeek = date.getUTCDay();
    var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;

    switch (token) {
      // Numerical value (same as in `e`)
      case 'c':
        return String(localDayOfWeek);
      // Padded numerical value

      case 'cc':
        return addLeadingZeros(localDayOfWeek, token.length);
      // 1st, 2nd, ..., 7th

      case 'co':
        return localize.ordinalNumber(localDayOfWeek, {
          unit: 'day'
        });

      case 'ccc':
        return localize.day(dayOfWeek, {
          width: 'abbreviated',
          context: 'standalone'
        });
      // T

      case 'ccccc':
        return localize.day(dayOfWeek, {
          width: 'narrow',
          context: 'standalone'
        });
      // Tu

      case 'cccccc':
        return localize.day(dayOfWeek, {
          width: 'short',
          context: 'standalone'
        });
      // Tuesday

      case 'cccc':
      default:
        return localize.day(dayOfWeek, {
          width: 'wide',
          context: 'standalone'
        });
    }
  },
  // ISO day of week
  i: function i(date, token, localize) {
    var dayOfWeek = date.getUTCDay();
    var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;

    switch (token) {
      // 2
      case 'i':
        return String(isoDayOfWeek);
      // 02

      case 'ii':
        return addLeadingZeros(isoDayOfWeek, token.length);
      // 2nd

      case 'io':
        return localize.ordinalNumber(isoDayOfWeek, {
          unit: 'day'
        });
      // Tue

      case 'iii':
        return localize.day(dayOfWeek, {
          width: 'abbreviated',
          context: 'formatting'
        });
      // T

      case 'iiiii':
        return localize.day(dayOfWeek, {
          width: 'narrow',
          context: 'formatting'
        });
      // Tu

      case 'iiiiii':
        return localize.day(dayOfWeek, {
          width: 'short',
          context: 'formatting'
        });
      // Tuesday

      case 'iiii':
      default:
        return localize.day(dayOfWeek, {
          width: 'wide',
          context: 'formatting'
        });
    }
  },
  // AM or PM
  a: function a(date, token, localize) {
    var hours = date.getUTCHours();
    var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';

    switch (token) {
      case 'a':
      case 'aa':
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: 'abbreviated',
          context: 'formatting'
        });

      case 'aaa':
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: 'abbreviated',
          context: 'formatting'
        }).toLowerCase();

      case 'aaaaa':
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: 'narrow',
          context: 'formatting'
        });

      case 'aaaa':
      default:
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: 'wide',
          context: 'formatting'
        });
    }
  },
  // AM, PM, midnight, noon
  b: function b(date, token, localize) {
    var hours = date.getUTCHours();
    var dayPeriodEnumValue;

    if (hours === 12) {
      dayPeriodEnumValue = dayPeriodEnum.noon;
    } else if (hours === 0) {
      dayPeriodEnumValue = dayPeriodEnum.midnight;
    } else {
      dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
    }

    switch (token) {
      case 'b':
      case 'bb':
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: 'abbreviated',
          context: 'formatting'
        });

      case 'bbb':
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: 'abbreviated',
          context: 'formatting'
        }).toLowerCase();

      case 'bbbbb':
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: 'narrow',
          context: 'formatting'
        });

      case 'bbbb':
      default:
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: 'wide',
          context: 'formatting'
        });
    }
  },
  // in the morning, in the afternoon, in the evening, at night
  B: function B(date, token, localize) {
    var hours = date.getUTCHours();
    var dayPeriodEnumValue;

    if (hours >= 17) {
      dayPeriodEnumValue = dayPeriodEnum.evening;
    } else if (hours >= 12) {
      dayPeriodEnumValue = dayPeriodEnum.afternoon;
    } else if (hours >= 4) {
      dayPeriodEnumValue = dayPeriodEnum.morning;
    } else {
      dayPeriodEnumValue = dayPeriodEnum.night;
    }

    switch (token) {
      case 'B':
      case 'BB':
      case 'BBB':
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: 'abbreviated',
          context: 'formatting'
        });

      case 'BBBBB':
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: 'narrow',
          context: 'formatting'
        });

      case 'BBBB':
      default:
        return localize.dayPeriod(dayPeriodEnumValue, {
          width: 'wide',
          context: 'formatting'
        });
    }
  },
  // Hour [1-12]
  h: function h(date, token, localize) {
    if (token === 'ho') {
      var hours = date.getUTCHours() % 12;
      if (hours === 0) hours = 12;
      return localize.ordinalNumber(hours, {
        unit: 'hour'
      });
    }

    return lightFormatters.h(date, token);
  },
  // Hour [0-23]
  H: function H(date, token, localize) {
    if (token === 'Ho') {
      return localize.ordinalNumber(date.getUTCHours(), {
        unit: 'hour'
      });
    }

    return lightFormatters.H(date, token);
  },
  // Hour [0-11]
  K: function K(date, token, localize) {
    var hours = date.getUTCHours() % 12;

    if (token === 'Ko') {
      return localize.ordinalNumber(hours, {
        unit: 'hour'
      });
    }

    return addLeadingZeros(hours, token.length);
  },
  // Hour [1-24]
  k: function k(date, token, localize) {
    var hours = date.getUTCHours();
    if (hours === 0) hours = 24;

    if (token === 'ko') {
      return localize.ordinalNumber(hours, {
        unit: 'hour'
      });
    }

    return addLeadingZeros(hours, token.length);
  },
  // Minute
  m: function m(date, token, localize) {
    if (token === 'mo') {
      return localize.ordinalNumber(date.getUTCMinutes(), {
        unit: 'minute'
      });
    }

    return lightFormatters.m(date, token);
  },
  // Second
  s: function s(date, token, localize) {
    if (token === 'so') {
      return localize.ordinalNumber(date.getUTCSeconds(), {
        unit: 'second'
      });
    }

    return lightFormatters.s(date, token);
  },
  // Fraction of second
  S: function S(date, token) {
    return lightFormatters.S(date, token);
  },
  // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
  X: function X(date, token, _localize, options) {
    var originalDate = options._originalDate || date;
    var timezoneOffset = originalDate.getTimezoneOffset();

    if (timezoneOffset === 0) {
      return 'Z';
    }

    switch (token) {
      // Hours and optional minutes
      case 'X':
        return formatTimezoneWithOptionalMinutes(timezoneOffset);
      // Hours, minutes and optional seconds without `:` delimiter
      // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
      // so this token always has the same output as `XX`

      case 'XXXX':
      case 'XX':
        // Hours and minutes without `:` delimiter
        return formatTimezone(timezoneOffset);
      // Hours, minutes and optional seconds with `:` delimiter
      // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
      // so this token always has the same output as `XXX`

      case 'XXXXX':
      case 'XXX': // Hours and minutes with `:` delimiter

      default:
        return formatTimezone(timezoneOffset, ':');
    }
  },
  // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
  x: function x(date, token, _localize, options) {
    var originalDate = options._originalDate || date;
    var timezoneOffset = originalDate.getTimezoneOffset();

    switch (token) {
      // Hours and optional minutes
      case 'x':
        return formatTimezoneWithOptionalMinutes(timezoneOffset);
      // Hours, minutes and optional seconds without `:` delimiter
      // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
      // so this token always has the same output as `xx`

      case 'xxxx':
      case 'xx':
        // Hours and minutes without `:` delimiter
        return formatTimezone(timezoneOffset);
      // Hours, minutes and optional seconds with `:` delimiter
      // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
      // so this token always has the same output as `xxx`

      case 'xxxxx':
      case 'xxx': // Hours and minutes with `:` delimiter

      default:
        return formatTimezone(timezoneOffset, ':');
    }
  },
  // Timezone (GMT)
  O: function O(date, token, _localize, options) {
    var originalDate = options._originalDate || date;
    var timezoneOffset = originalDate.getTimezoneOffset();

    switch (token) {
      // Short
      case 'O':
      case 'OO':
      case 'OOO':
        return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
      // Long

      case 'OOOO':
      default:
        return 'GMT' + formatTimezone(timezoneOffset, ':');
    }
  },
  // Timezone (specific non-location)
  z: function z(date, token, _localize, options) {
    var originalDate = options._originalDate || date;
    var timezoneOffset = originalDate.getTimezoneOffset();

    switch (token) {
      // Short
      case 'z':
      case 'zz':
      case 'zzz':
        return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
      // Long

      case 'zzzz':
      default:
        return 'GMT' + formatTimezone(timezoneOffset, ':');
    }
  },
  // Seconds timestamp
  t: function t(date, token, _localize, options) {
    var originalDate = options._originalDate || date;
    var timestamp = Math.floor(originalDate.getTime() / 1000);
    return addLeadingZeros(timestamp, token.length);
  },
  // Milliseconds timestamp
  T: function T(date, token, _localize, options) {
    var originalDate = options._originalDate || date;
    var timestamp = originalDate.getTime();
    return addLeadingZeros(timestamp, token.length);
  }
};

function formatTimezoneShort(offset, dirtyDelimiter) {
  var sign = offset > 0 ? '-' : '+';
  var absOffset = Math.abs(offset);
  var hours = Math.floor(absOffset / 60);
  var minutes = absOffset % 60;

  if (minutes === 0) {
    return sign + String(hours);
  }

  var delimiter = dirtyDelimiter || '';
  return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
}

function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
  if (offset % 60 === 0) {
    var sign = offset > 0 ? '-' : '+';
    return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
  }

  return formatTimezone(offset, dirtyDelimiter);
}

function formatTimezone(offset, dirtyDelimiter) {
  var delimiter = dirtyDelimiter || '';
  var sign = offset > 0 ? '-' : '+';
  var absOffset = Math.abs(offset);
  var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
  var minutes = addLeadingZeros(absOffset % 60, 2);
  return sign + hours + delimiter + minutes;
}

/* harmony default export */ const format_formatters = (formatters_formatters);
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/format/longFormatters/index.js
var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
  switch (pattern) {
    case 'P':
      return formatLong.date({
        width: 'short'
      });

    case 'PP':
      return formatLong.date({
        width: 'medium'
      });

    case 'PPP':
      return formatLong.date({
        width: 'long'
      });

    case 'PPPP':
    default:
      return formatLong.date({
        width: 'full'
      });
  }
};

var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
  switch (pattern) {
    case 'p':
      return formatLong.time({
        width: 'short'
      });

    case 'pp':
      return formatLong.time({
        width: 'medium'
      });

    case 'ppp':
      return formatLong.time({
        width: 'long'
      });

    case 'pppp':
    default:
      return formatLong.time({
        width: 'full'
      });
  }
};

var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
  var matchResult = pattern.match(/(P+)(p+)?/) || [];
  var datePattern = matchResult[1];
  var timePattern = matchResult[2];

  if (!timePattern) {
    return dateLongFormatter(pattern, formatLong);
  }

  var dateTimeFormat;

  switch (datePattern) {
    case 'P':
      dateTimeFormat = formatLong.dateTime({
        width: 'short'
      });
      break;

    case 'PP':
      dateTimeFormat = formatLong.dateTime({
        width: 'medium'
      });
      break;

    case 'PPP':
      dateTimeFormat = formatLong.dateTime({
        width: 'long'
      });
      break;

    case 'PPPP':
    default:
      dateTimeFormat = formatLong.dateTime({
        width: 'full'
      });
      break;
  }

  return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
};

var longFormatters = {
  p: timeLongFormatter,
  P: dateTimeLongFormatter
};
/* harmony default export */ const format_longFormatters = (longFormatters);
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js
/**
 * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
 * They usually appear for dates that denote time before the timezones were introduced
 * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
 * and GMT+01:00:00 after that date)
 *
 * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
 * which would lead to incorrect calculations.
 *
 * This function returns the timezone offset in milliseconds that takes seconds in account.
 */
function getTimezoneOffsetInMilliseconds(date) {
  var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
  utcDate.setUTCFullYear(date.getFullYear());
  return date.getTime() - utcDate.getTime();
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/protectedTokens/index.js
var protectedDayOfYearTokens = ['D', 'DD'];
var protectedWeekYearTokens = ['YY', 'YYYY'];
function isProtectedDayOfYearToken(token) {
  return protectedDayOfYearTokens.indexOf(token) !== -1;
}
function isProtectedWeekYearToken(token) {
  return protectedWeekYearTokens.indexOf(token) !== -1;
}
function throwProtectedError(token, format, input) {
  if (token === 'YYYY') {
    throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
  } else if (token === 'YY') {
    throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
  } else if (token === 'D') {
    throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
  } else if (token === 'DD') {
    throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
  }
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js
var formatDistanceLocale = {
  lessThanXSeconds: {
    one: 'less than a second',
    other: 'less than {{count}} seconds'
  },
  xSeconds: {
    one: '1 second',
    other: '{{count}} seconds'
  },
  halfAMinute: 'half a minute',
  lessThanXMinutes: {
    one: 'less than a minute',
    other: 'less than {{count}} minutes'
  },
  xMinutes: {
    one: '1 minute',
    other: '{{count}} minutes'
  },
  aboutXHours: {
    one: 'about 1 hour',
    other: 'about {{count}} hours'
  },
  xHours: {
    one: '1 hour',
    other: '{{count}} hours'
  },
  xDays: {
    one: '1 day',
    other: '{{count}} days'
  },
  aboutXWeeks: {
    one: 'about 1 week',
    other: 'about {{count}} weeks'
  },
  xWeeks: {
    one: '1 week',
    other: '{{count}} weeks'
  },
  aboutXMonths: {
    one: 'about 1 month',
    other: 'about {{count}} months'
  },
  xMonths: {
    one: '1 month',
    other: '{{count}} months'
  },
  aboutXYears: {
    one: 'about 1 year',
    other: 'about {{count}} years'
  },
  xYears: {
    one: '1 year',
    other: '{{count}} years'
  },
  overXYears: {
    one: 'over 1 year',
    other: 'over {{count}} years'
  },
  almostXYears: {
    one: 'almost 1 year',
    other: 'almost {{count}} years'
  }
};

var formatDistance = function formatDistance(token, count, options) {
  var result;
  var tokenValue = formatDistanceLocale[token];

  if (typeof tokenValue === 'string') {
    result = tokenValue;
  } else if (count === 1) {
    result = tokenValue.one;
  } else {
    result = tokenValue.other.replace('{{count}}', count.toString());
  }

  if (options !== null && options !== void 0 && options.addSuffix) {
    if (options.comparison && options.comparison > 0) {
      return 'in ' + result;
    } else {
      return result + ' ago';
    }
  }

  return result;
};

/* harmony default export */ const _lib_formatDistance = (formatDistance);
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js
function buildFormatLongFn(args) {
  return function () {
    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    // TODO: Remove String()
    var width = options.width ? String(options.width) : args.defaultWidth;
    var format = args.formats[width] || args.formats[args.defaultWidth];
    return format;
  };
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js

var dateFormats = {
  full: 'EEEE, MMMM do, y',
  long: 'MMMM do, y',
  medium: 'MMM d, y',
  short: 'MM/dd/yyyy'
};
var timeFormats = {
  full: 'h:mm:ss a zzzz',
  long: 'h:mm:ss a z',
  medium: 'h:mm:ss a',
  short: 'h:mm a'
};
var dateTimeFormats = {
  full: "{{date}} 'at' {{time}}",
  long: "{{date}} 'at' {{time}}",
  medium: '{{date}}, {{time}}',
  short: '{{date}}, {{time}}'
};
var formatLong = {
  date: buildFormatLongFn({
    formats: dateFormats,
    defaultWidth: 'full'
  }),
  time: buildFormatLongFn({
    formats: timeFormats,
    defaultWidth: 'full'
  }),
  dateTime: buildFormatLongFn({
    formats: dateTimeFormats,
    defaultWidth: 'full'
  })
};
/* harmony default export */ const _lib_formatLong = (formatLong);
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js
var formatRelativeLocale = {
  lastWeek: "'last' eeee 'at' p",
  yesterday: "'yesterday at' p",
  today: "'today at' p",
  tomorrow: "'tomorrow at' p",
  nextWeek: "eeee 'at' p",
  other: 'P'
};

var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
  return formatRelativeLocale[token];
};

/* harmony default export */ const _lib_formatRelative = (formatRelative);
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js
function buildLocalizeFn(args) {
  return function (dirtyIndex, options) {
    var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
    var valuesArray;

    if (context === 'formatting' && args.formattingValues) {
      var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
      var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
      valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
    } else {
      var _defaultWidth = args.defaultWidth;

      var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;

      valuesArray = args.values[_width] || args.values[_defaultWidth];
    }

    var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!

    return valuesArray[index];
  };
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js

var eraValues = {
  narrow: ['B', 'A'],
  abbreviated: ['BC', 'AD'],
  wide: ['Before Christ', 'Anno Domini']
};
var quarterValues = {
  narrow: ['1', '2', '3', '4'],
  abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
  wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
}; // Note: in English, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.

var monthValues = {
  narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
  abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
};
var dayValues = {
  narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
  short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
  abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
};
var dayPeriodValues = {
  narrow: {
    am: 'a',
    pm: 'p',
    midnight: 'mi',
    noon: 'n',
    morning: 'morning',
    afternoon: 'afternoon',
    evening: 'evening',
    night: 'night'
  },
  abbreviated: {
    am: 'AM',
    pm: 'PM',
    midnight: 'midnight',
    noon: 'noon',
    morning: 'morning',
    afternoon: 'afternoon',
    evening: 'evening',
    night: 'night'
  },
  wide: {
    am: 'a.m.',
    pm: 'p.m.',
    midnight: 'midnight',
    noon: 'noon',
    morning: 'morning',
    afternoon: 'afternoon',
    evening: 'evening',
    night: 'night'
  }
};
var formattingDayPeriodValues = {
  narrow: {
    am: 'a',
    pm: 'p',
    midnight: 'mi',
    noon: 'n',
    morning: 'in the morning',
    afternoon: 'in the afternoon',
    evening: 'in the evening',
    night: 'at night'
  },
  abbreviated: {
    am: 'AM',
    pm: 'PM',
    midnight: 'midnight',
    noon: 'noon',
    morning: 'in the morning',
    afternoon: 'in the afternoon',
    evening: 'in the evening',
    night: 'at night'
  },
  wide: {
    am: 'a.m.',
    pm: 'p.m.',
    midnight: 'midnight',
    noon: 'noon',
    morning: 'in the morning',
    afternoon: 'in the afternoon',
    evening: 'in the evening',
    night: 'at night'
  }
};

var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
  var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
  // if they are different for different grammatical genders,
  // use `options.unit`.
  //
  // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
  // 'day', 'hour', 'minute', 'second'.

  var rem100 = number % 100;

  if (rem100 > 20 || rem100 < 10) {
    switch (rem100 % 10) {
      case 1:
        return number + 'st';

      case 2:
        return number + 'nd';

      case 3:
        return number + 'rd';
    }
  }

  return number + 'th';
};

var localize = {
  ordinalNumber: ordinalNumber,
  era: buildLocalizeFn({
    values: eraValues,
    defaultWidth: 'wide'
  }),
  quarter: buildLocalizeFn({
    values: quarterValues,
    defaultWidth: 'wide',
    argumentCallback: function argumentCallback(quarter) {
      return quarter - 1;
    }
  }),
  month: buildLocalizeFn({
    values: monthValues,
    defaultWidth: 'wide'
  }),
  day: buildLocalizeFn({
    values: dayValues,
    defaultWidth: 'wide'
  }),
  dayPeriod: buildLocalizeFn({
    values: dayPeriodValues,
    defaultWidth: 'wide',
    formattingValues: formattingDayPeriodValues,
    defaultFormattingWidth: 'wide'
  })
};
/* harmony default export */ const _lib_localize = (localize);
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js
function buildMatchFn(args) {
  return function (string) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    var width = options.width;
    var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
    var matchResult = string.match(matchPattern);

    if (!matchResult) {
      return null;
    }

    var matchedString = matchResult[0];
    var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
    var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
      return pattern.test(matchedString);
    }) : findKey(parsePatterns, function (pattern) {
      return pattern.test(matchedString);
    });
    var value;
    value = args.valueCallback ? args.valueCallback(key) : key;
    value = options.valueCallback ? options.valueCallback(value) : value;
    var rest = string.slice(matchedString.length);
    return {
      value: value,
      rest: rest
    };
  };
}

function findKey(object, predicate) {
  for (var key in object) {
    if (object.hasOwnProperty(key) && predicate(object[key])) {
      return key;
    }
  }

  return undefined;
}

function findIndex(array, predicate) {
  for (var key = 0; key < array.length; key++) {
    if (predicate(array[key])) {
      return key;
    }
  }

  return undefined;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js
function buildMatchPatternFn(args) {
  return function (string) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    var matchResult = string.match(args.matchPattern);
    if (!matchResult) return null;
    var matchedString = matchResult[0];
    var parseResult = string.match(args.parsePattern);
    if (!parseResult) return null;
    var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
    value = options.valueCallback ? options.valueCallback(value) : value;
    var rest = string.slice(matchedString.length);
    return {
      value: value,
      rest: rest
    };
  };
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/match/index.js


var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
var parseOrdinalNumberPattern = /\d+/i;
var matchEraPatterns = {
  narrow: /^(b|a)/i,
  abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
  wide: /^(before christ|before common era|anno domini|common era)/i
};
var parseEraPatterns = {
  any: [/^b/i, /^(a|c)/i]
};
var matchQuarterPatterns = {
  narrow: /^[1234]/i,
  abbreviated: /^q[1234]/i,
  wide: /^[1234](th|st|nd|rd)? quarter/i
};
var parseQuarterPatterns = {
  any: [/1/i, /2/i, /3/i, /4/i]
};
var matchMonthPatterns = {
  narrow: /^[jfmasond]/i,
  abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
  wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
};
var parseMonthPatterns = {
  narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
  any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
};
var matchDayPatterns = {
  narrow: /^[smtwf]/i,
  short: /^(su|mo|tu|we|th|fr|sa)/i,
  abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
  wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
};
var parseDayPatterns = {
  narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
  any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
};
var matchDayPeriodPatterns = {
  narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
  any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
};
var parseDayPeriodPatterns = {
  any: {
    am: /^a/i,
    pm: /^p/i,
    midnight: /^mi/i,
    noon: /^no/i,
    morning: /morning/i,
    afternoon: /afternoon/i,
    evening: /evening/i,
    night: /night/i
  }
};
var match = {
  ordinalNumber: buildMatchPatternFn({
    matchPattern: matchOrdinalNumberPattern,
    parsePattern: parseOrdinalNumberPattern,
    valueCallback: function valueCallback(value) {
      return parseInt(value, 10);
    }
  }),
  era: buildMatchFn({
    matchPatterns: matchEraPatterns,
    defaultMatchWidth: 'wide',
    parsePatterns: parseEraPatterns,
    defaultParseWidth: 'any'
  }),
  quarter: buildMatchFn({
    matchPatterns: matchQuarterPatterns,
    defaultMatchWidth: 'wide',
    parsePatterns: parseQuarterPatterns,
    defaultParseWidth: 'any',
    valueCallback: function valueCallback(index) {
      return index + 1;
    }
  }),
  month: buildMatchFn({
    matchPatterns: matchMonthPatterns,
    defaultMatchWidth: 'wide',
    parsePatterns: parseMonthPatterns,
    defaultParseWidth: 'any'
  }),
  day: buildMatchFn({
    matchPatterns: matchDayPatterns,
    defaultMatchWidth: 'wide',
    parsePatterns: parseDayPatterns,
    defaultParseWidth: 'any'
  }),
  dayPeriod: buildMatchFn({
    matchPatterns: matchDayPeriodPatterns,
    defaultMatchWidth: 'any',
    parsePatterns: parseDayPeriodPatterns,
    defaultParseWidth: 'any'
  })
};
/* harmony default export */ const _lib_match = (match);
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/index.js






/**
 * @type {Locale}
 * @category Locales
 * @summary English locale (United States).
 * @language English
 * @iso-639-2 eng
 * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
 * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
 */
var locale = {
  code: 'en-US',
  formatDistance: _lib_formatDistance,
  formatLong: _lib_formatLong,
  formatRelative: _lib_formatRelative,
  localize: _lib_localize,
  match: _lib_match,
  options: {
    weekStartsOn: 0
    /* Sunday */
    ,
    firstWeekContainsDate: 1
  }
};
/* harmony default export */ const en_US = (locale);
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/defaultLocale/index.js

/* harmony default export */ const defaultLocale = (en_US);
;// CONCATENATED MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/format/index.js










 // This RegExp consists of three parts separated by `|`:
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
//   (one of the certain letters followed by `o`)
// - (\w)\1* matches any sequences of the same letter
// - '' matches two quote characters in a row
// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
//   except a single quote symbol, which ends the sequence.
//   Two quote characters do not end the sequence.
//   If there is no matching single quote
//   then the sequence will continue until the end of the string.
// - . matches any single character unmatched by previous parts of the RegExps

var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`

var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
var escapedStringRegExp = /^'([^]*?)'?$/;
var doubleQuoteRegExp = /''/g;
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
/**
 * @name format
 * @category Common Helpers
 * @summary Format the date.
 *
 * @description
 * Return the formatted date string in the given format. The result may vary by locale.
 *
 * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
 * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 *
 * The characters wrapped between two single quotes characters (') are escaped.
 * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
 * (see the last example)
 *
 * Format of the string is based on Unicode Technical Standard #35:
 * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
 * with a few additions (see note 7 below the table).
 *
 * Accepted patterns:
 * | Unit                            | Pattern | Result examples                   | Notes |
 * |---------------------------------|---------|-----------------------------------|-------|
 * | Era                             | G..GGG  | AD, BC                            |       |
 * |                                 | GGGG    | Anno Domini, Before Christ        | 2     |
 * |                                 | GGGGG   | A, B                              |       |
 * | Calendar year                   | y       | 44, 1, 1900, 2017                 | 5     |
 * |                                 | yo      | 44th, 1st, 0th, 17th              | 5,7   |
 * |                                 | yy      | 44, 01, 00, 17                    | 5     |
 * |                                 | yyy     | 044, 001, 1900, 2017              | 5     |
 * |                                 | yyyy    | 0044, 0001, 1900, 2017            | 5     |
 * |                                 | yyyyy   | ...                               | 3,5   |
 * | Local week-numbering year       | Y       | 44, 1, 1900, 2017                 | 5     |
 * |                                 | Yo      | 44th, 1st, 1900th, 2017th         | 5,7   |
 * |                                 | YY      | 44, 01, 00, 17                    | 5,8   |
 * |                                 | YYY     | 044, 001, 1900, 2017              | 5     |
 * |                                 | YYYY    | 0044, 0001, 1900, 2017            | 5,8   |
 * |                                 | YYYYY   | ...                               | 3,5   |
 * | ISO week-numbering year         | R       | -43, 0, 1, 1900, 2017             | 5,7   |
 * |                                 | RR      | -43, 00, 01, 1900, 2017           | 5,7   |
 * |                                 | RRR     | -043, 000, 001, 1900, 2017        | 5,7   |
 * |                                 | RRRR    | -0043, 0000, 0001, 1900, 2017     | 5,7   |
 * |                                 | RRRRR   | ...                               | 3,5,7 |
 * | Extended year                   | u       | -43, 0, 1, 1900, 2017             | 5     |
 * |                                 | uu      | -43, 01, 1900, 2017               | 5     |
 * |                                 | uuu     | -043, 001, 1900, 2017             | 5     |
 * |                                 | uuuu    | -0043, 0001, 1900, 2017           | 5     |
 * |                                 | uuuuu   | ...                               | 3,5   |
 * | Quarter (formatting)            | Q       | 1, 2, 3, 4                        |       |
 * |                                 | Qo      | 1st, 2nd, 3rd, 4th                | 7     |
 * |                                 | QQ      | 01, 02, 03, 04                    |       |
 * |                                 | QQQ     | Q1, Q2, Q3, Q4                    |       |
 * |                                 | QQQQ    | 1st quarter, 2nd quarter, ...     | 2     |
 * |                                 | QQQQQ   | 1, 2, 3, 4                        | 4     |
 * | Quarter (stand-alone)           | q       | 1, 2, 3, 4                        |       |
 * |                                 | qo      | 1st, 2nd, 3rd, 4th                | 7     |
 * |                                 | qq      | 01, 02, 03, 04                    |       |
 * |                                 | qqq     | Q1, Q2, Q3, Q4                    |       |
 * |                                 | qqqq    | 1st quarter, 2nd quarter, ...     | 2     |
 * |                                 | qqqqq   | 1, 2, 3, 4                        | 4     |
 * | Month (formatting)              | M       | 1, 2, ..., 12                     |       |
 * |                                 | Mo      | 1st, 2nd, ..., 12th               | 7     |
 * |                                 | MM      | 01, 02, ..., 12                   |       |
 * |                                 | MMM     | Jan, Feb, ..., Dec                |       |
 * |                                 | MMMM    | January, February, ..., December  | 2     |
 * |                                 | MMMMM   | J, F, ..., D                      |       |
 * | Month (stand-alone)             | L       | 1, 2, ..., 12                     |       |
 * |                                 | Lo      | 1st, 2nd, ..., 12th               | 7     |
 * |                                 | LL      | 01, 02, ..., 12                   |       |
 * |                                 | LLL     | Jan, Feb, ..., Dec                |       |
 * |                                 | LLLL    | January, February, ..., December  | 2     |
 * |                                 | LLLLL   | J, F, ..., D                      |       |
 * | Local week of year              | w       | 1, 2, ..., 53                     |       |
 * |                                 | wo      | 1st, 2nd, ..., 53th               | 7     |
 * |                                 | ww      | 01, 02, ..., 53                   |       |
 * | ISO week of year                | I       | 1, 2, ..., 53                     | 7     |
 * |                                 | Io      | 1st, 2nd, ..., 53th               | 7     |
 * |                                 | II      | 01, 02, ..., 53                   | 7     |
 * | Day of month                    | d       | 1, 2, ..., 31                     |       |
 * |                                 | do      | 1st, 2nd, ..., 31st               | 7     |
 * |                                 | dd      | 01, 02, ..., 31                   |       |
 * | Day of year                     | D       | 1, 2, ..., 365, 366               | 9     |
 * |                                 | Do      | 1st, 2nd, ..., 365th, 366th       | 7     |
 * |                                 | DD      | 01, 02, ..., 365, 366             | 9     |
 * |                                 | DDD     | 001, 002, ..., 365, 366           |       |
 * |                                 | DDDD    | ...                               | 3     |
 * | Day of week (formatting)        | E..EEE  | Mon, Tue, Wed, ..., Sun           |       |
 * |                                 | EEEE    | Monday, Tuesday, ..., Sunday      | 2     |
 * |                                 | EEEEE   | M, T, W, T, F, S, S               |       |
 * |                                 | EEEEEE  | Mo, Tu, We, Th, Fr, Sa, Su        |       |
 * | ISO day of week (formatting)    | i       | 1, 2, 3, ..., 7                   | 7     |
 * |                                 | io      | 1st, 2nd, ..., 7th                | 7     |
 * |                                 | ii      | 01, 02, ..., 07                   | 7     |
 * |                                 | iii     | Mon, Tue, Wed, ..., Sun           | 7     |
 * |                                 | iiii    | Monday, Tuesday, ..., Sunday      | 2,7   |
 * |                                 | iiiii   | M, T, W, T, F, S, S               | 7     |
 * |                                 | iiiiii  | Mo, Tu, We, Th, Fr, Sa, Su        | 7     |
 * | Local day of week (formatting)  | e       | 2, 3, 4, ..., 1                   |       |
 * |                                 | eo      | 2nd, 3rd, ..., 1st                | 7     |
 * |                                 | ee      | 02, 03, ..., 01                   |       |
 * |                                 | eee     | Mon, Tue, Wed, ..., Sun           |       |
 * |                                 | eeee    | Monday, Tuesday, ..., Sunday      | 2     |
 * |                                 | eeeee   | M, T, W, T, F, S, S               |       |
 * |                                 | eeeeee  | Mo, Tu, We, Th, Fr, Sa, Su        |       |
 * | Local day of week (stand-alone) | c       | 2, 3, 4, ..., 1                   |       |
 * |                                 | co      | 2nd, 3rd, ..., 1st                | 7     |
 * |                                 | cc      | 02, 03, ..., 01                   |       |
 * |                                 | ccc     | Mon, Tue, Wed, ..., Sun           |       |
 * |                                 | cccc    | Monday, Tuesday, ..., Sunday      | 2     |
 * |                                 | ccccc   | M, T, W, T, F, S, S               |       |
 * |                                 | cccccc  | Mo, Tu, We, Th, Fr, Sa, Su        |       |
 * | AM, PM                          | a..aa   | AM, PM                            |       |
 * |                                 | aaa     | am, pm                            |       |
 * |                                 | aaaa    | a.m., p.m.                        | 2     |
 * |                                 | aaaaa   | a, p                              |       |
 * | AM, PM, noon, midnight          | b..bb   | AM, PM, noon, midnight            |       |
 * |                                 | bbb     | am, pm, noon, midnight            |       |
 * |                                 | bbbb    | a.m., p.m., noon, midnight        | 2     |
 * |                                 | bbbbb   | a, p, n, mi                       |       |
 * | Flexible day period             | B..BBB  | at night, in the morning, ...     |       |
 * |                                 | BBBB    | at night, in the morning, ...     | 2     |
 * |                                 | BBBBB   | at night, in the morning, ...     |       |
 * | Hour [1-12]                     | h       | 1, 2, ..., 11, 12                 |       |
 * |                                 | ho      | 1st, 2nd, ..., 11th, 12th         | 7     |
 * |                                 | hh      | 01, 02, ..., 11, 12               |       |
 * | Hour [0-23]                     | H       | 0, 1, 2, ..., 23                  |       |
 * |                                 | Ho      | 0th, 1st, 2nd, ..., 23rd          | 7     |
 * |                                 | HH      | 00, 01, 02, ..., 23               |       |
 * | Hour [0-11]                     | K       | 1, 2, ..., 11, 0                  |       |
 * |                                 | Ko      | 1st, 2nd, ..., 11th, 0th          | 7     |
 * |                                 | KK      | 01, 02, ..., 11, 00               |       |
 * | Hour [1-24]                     | k       | 24, 1, 2, ..., 23                 |       |
 * |                                 | ko      | 24th, 1st, 2nd, ..., 23rd         | 7     |
 * |                                 | kk      | 24, 01, 02, ..., 23               |       |
 * | Minute                          | m       | 0, 1, ..., 59                     |       |
 * |                                 | mo      | 0th, 1st, ..., 59th               | 7     |
 * |                                 | mm      | 00, 01, ..., 59                   |       |
 * | Second                          | s       | 0, 1, ..., 59                     |       |
 * |                                 | so      | 0th, 1st, ..., 59th               | 7     |
 * |                                 | ss      | 00, 01, ..., 59                   |       |
 * | Fraction of second              | S       | 0, 1, ..., 9                      |       |
 * |                                 | SS      | 00, 01, ..., 99                   |       |
 * |                                 | SSS     | 000, 001, ..., 999                |       |
 * |                                 | SSSS    | ...                               | 3     |
 * | Timezone (ISO-8601 w/ Z)        | X       | -08, +0530, Z                     |       |
 * |                                 | XX      | -0800, +0530, Z                   |       |
 * |                                 | XXX     | -08:00, +05:30, Z                 |       |
 * |                                 | XXXX    | -0800, +0530, Z, +123456          | 2     |
 * |                                 | XXXXX   | -08:00, +05:30, Z, +12:34:56      |       |
 * | Timezone (ISO-8601 w/o Z)       | x       | -08, +0530, +00                   |       |
 * |                                 | xx      | -0800, +0530, +0000               |       |
 * |                                 | xxx     | -08:00, +05:30, +00:00            | 2     |
 * |                                 | xxxx    | -0800, +0530, +0000, +123456      |       |
 * |                                 | xxxxx   | -08:00, +05:30, +00:00, +12:34:56 |       |
 * | Timezone (GMT)                  | O...OOO | GMT-8, GMT+5:30, GMT+0            |       |
 * |                                 | OOOO    | GMT-08:00, GMT+05:30, GMT+00:00   | 2     |
 * | Timezone (specific non-locat.)  | z...zzz | GMT-8, GMT+5:30, GMT+0            | 6     |
 * |                                 | zzzz    | GMT-08:00, GMT+05:30, GMT+00:00   | 2,6   |
 * | Seconds timestamp               | t       | 512969520                         | 7     |
 * |                                 | tt      | ...                               | 3,7   |
 * | Milliseconds timestamp          | T       | 512969520900                      | 7     |
 * |                                 | TT      | ...                               | 3,7   |
 * | Long localized date             | P       | 04/29/1453                        | 7     |
 * |                                 | PP      | Apr 29, 1453                      | 7     |
 * |                                 | PPP     | April 29th, 1453                  | 7     |
 * |                                 | PPPP    | Friday, April 29th, 1453          | 2,7   |
 * | Long localized time             | p       | 12:00 AM                          | 7     |
 * |                                 | pp      | 12:00:00 AM                       | 7     |
 * |                                 | ppp     | 12:00:00 AM GMT+2                 | 7     |
 * |                                 | pppp    | 12:00:00 AM GMT+02:00             | 2,7   |
 * | Combination of date and time    | Pp      | 04/29/1453, 12:00 AM              | 7     |
 * |                                 | PPpp    | Apr 29, 1453, 12:00:00 AM         | 7     |
 * |                                 | PPPppp  | April 29th, 1453 at ...           | 7     |
 * |                                 | PPPPpppp| Friday, April 29th, 1453 at ...   | 2,7   |
 * Notes:
 * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
 *    are the same as "stand-alone" units, but are different in some languages.
 *    "Formatting" units are declined according to the rules of the language
 *    in the context of a date. "Stand-alone" units are always nominative singular:
 *
 *    `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
 *
 *    `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
 *
 * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
 *    the single quote characters (see below).
 *    If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
 *    the output will be the same as default pattern for this unit, usually
 *    the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
 *    are marked with "2" in the last column of the table.
 *
 *    `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
 *
 *    `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
 *
 *    `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
 *
 *    `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
 *
 *    `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
 *
 * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
 *    The output will be padded with zeros to match the length of the pattern.
 *
 *    `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
 *
 * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
 *    These tokens represent the shortest form of the quarter.
 *
 * 5. The main difference between `y` and `u` patterns are B.C. years:
 *
 *    | Year | `y` | `u` |
 *    |------|-----|-----|
 *    | AC 1 |   1 |   1 |
 *    | BC 1 |   1 |   0 |
 *    | BC 2 |   2 |  -1 |
 *
 *    Also `yy` always returns the last two digits of a year,
 *    while `uu` pads single digit years to 2 characters and returns other years unchanged:
 *
 *    | Year | `yy` | `uu` |
 *    |------|------|------|
 *    | 1    |   01 |   01 |
 *    | 14   |   14 |   14 |
 *    | 376  |   76 |  376 |
 *    | 1453 |   53 | 1453 |
 *
 *    The same difference is true for local and ISO week-numbering years (`Y` and `R`),
 *    except local week-numbering years are dependent on `options.weekStartsOn`
 *    and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
 *    and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
 *
 * 6. Specific non-location timezones are currently unavailable in `date-fns`,
 *    so right now these tokens fall back to GMT timezones.
 *
 * 7. These patterns are not in the Unicode Technical Standard #35:
 *    - `i`: ISO day of week
 *    - `I`: ISO week of year
 *    - `R`: ISO week-numbering year
 *    - `t`: seconds timestamp
 *    - `T`: milliseconds timestamp
 *    - `o`: ordinal number modifier
 *    - `P`: long localized date
 *    - `p`: long localized time
 *
 * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
 *    You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 *
 * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
 *    You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 *
 * @param {Date|Number} date - the original date
 * @param {String} format - the string of tokens
 * @param {Object} [options] - an object with options.
 * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
 * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
 * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
 * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
 *   see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
 *   see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 * @returns {String} the formatted date string
 * @throws {TypeError} 2 arguments required
 * @throws {RangeError} `date` must not be Invalid Date
 * @throws {RangeError} `options.locale` must contain `localize` property
 * @throws {RangeError} `options.locale` must contain `formatLong` property
 * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
 * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
 * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
 * @throws {RangeError} format string contains an unescaped latin alphabet character
 *
 * @example
 * // Represent 11 February 2014 in middle-endian format:
 * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
 * //=> '02/11/2014'
 *
 * @example
 * // Represent 2 July 2014 in Esperanto:
 * import { eoLocale } from 'date-fns/locale/eo'
 * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
 *   locale: eoLocale
 * })
 * //=> '2-a de julio 2014'
 *
 * @example
 * // Escape string by single quote characters:
 * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
 * //=> "3 o'clock"
 */

function format(dirtyDate, dirtyFormatStr, options) {
  var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;

  requiredArgs(2, arguments);
  var formatStr = String(dirtyFormatStr);
  var defaultOptions = getDefaultOptions();
  var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
  var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN

  if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
    throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
  }

  var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN

  if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
    throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
  }

  if (!locale.localize) {
    throw new RangeError('locale must contain localize property');
  }

  if (!locale.formatLong) {
    throw new RangeError('locale must contain formatLong property');
  }

  var originalDate = toDate(dirtyDate);

  if (!isValid(originalDate)) {
    throw new RangeError('Invalid time value');
  } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
  // This ensures that when UTC functions will be implemented, locales will be compatible with them.
  // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376


  var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
  var utcDate = subMilliseconds(originalDate, timezoneOffset);
  var formatterOptions = {
    firstWeekContainsDate: firstWeekContainsDate,
    weekStartsOn: weekStartsOn,
    locale: locale,
    _originalDate: originalDate
  };
  var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
    var firstCharacter = substring[0];

    if (firstCharacter === 'p' || firstCharacter === 'P') {
      var longFormatter = format_longFormatters[firstCharacter];
      return longFormatter(substring, locale.formatLong);
    }

    return substring;
  }).join('').match(formattingTokensRegExp).map(function (substring) {
    // Replace two single quote characters with one single quote character
    if (substring === "''") {
      return "'";
    }

    var firstCharacter = substring[0];

    if (firstCharacter === "'") {
      return cleanEscapedString(substring);
    }

    var formatter = format_formatters[firstCharacter];

    if (formatter) {
      if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
        throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
      }

      if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
        throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
      }

      return formatter(utcDate, substring, locale.localize, formatterOptions);
    }

    if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
      throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
    }

    return substring;
  }).join('');
  return result;
}

function cleanEscapedString(input) {
  var matched = input.match(escapedStringRegExp);

  if (!matched) {
    return input;
  }

  return matched[1].replace(doubleQuoteRegExp, "'");
}

/***/ }),

/***/ 50284:
/***/ ((module, exports, __webpack_require__) => {

var __WEBPACK_AMD_DEFINE_RESULT__;/*!
  Copyright (c) 2015 Jed Watson.
  Based on code that is Copyright 2013-2015, Facebook, Inc.
  All rights reserved.
*/
/* global define */

(function () {
	'use strict';

	var canUseDOM = !!(
		typeof window !== 'undefined' &&
		window.document &&
		window.document.createElement
	);

	var ExecutionEnvironment = {

		canUseDOM: canUseDOM,

		canUseWorkers: typeof Worker !== 'undefined',

		canUseEventListeners:
			canUseDOM && !!(window.addEventListener || window.attachEvent),

		canUseViewport: canUseDOM && !!window.screen

	};

	if (true) {
		!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
			return ExecutionEnvironment;
		}).call(exports, __webpack_require__, exports, module),
		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
	} else {}

}());


/***/ }),

/***/ 59440:
/***/ ((module, exports, __webpack_require__) => {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jshint node:true */
/* globals define */
/*
  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.

*/



/**
The following batches are equivalent:

var beautify_js = require('js-beautify');
var beautify_js = require('js-beautify').js;
var beautify_js = require('js-beautify').js_beautify;

var beautify_css = require('js-beautify').css;
var beautify_css = require('js-beautify').css_beautify;

var beautify_html = require('js-beautify').html;
var beautify_html = require('js-beautify').html_beautify;

All methods returned accept two arguments, the source string and an options object.
**/

function get_beautify(js_beautify, css_beautify, html_beautify) {
  // the default is js
  var beautify = function(src, config) {
    return js_beautify.js_beautify(src, config);
  };

  // short aliases
  beautify.js = js_beautify.js_beautify;
  beautify.css = css_beautify.css_beautify;
  beautify.html = html_beautify.html_beautify;

  // legacy aliases
  beautify.js_beautify = js_beautify.js_beautify;
  beautify.css_beautify = css_beautify.css_beautify;
  beautify.html_beautify = html_beautify.html_beautify;

  return beautify;
}

if (true) {
  // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- )
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
    __webpack_require__(20370),
    __webpack_require__(97332),
    __webpack_require__(54649)
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function(js_beautify, css_beautify, html_beautify) {
    return get_beautify(js_beautify, css_beautify, html_beautify);
  }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}

/***/ }),

/***/ 97332:
/***/ ((module, exports) => {

var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* AUTO-GENERATED. DO NOT MODIFY. */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.


 CSS Beautifier
---------------

    Written by Harutyun Amirjanyan, (amirjanyan@gmail.com)

    Based on code initially developed by: Einar Lielmanis, <einar@beautifier.io>
        https://beautifier.io/

    Usage:
        css_beautify(source_text);
        css_beautify(source_text, options);

    The options are (default in brackets):
        indent_size (4)                         — indentation size,
        indent_char (space)                     — character to indent with,
        selector_separator_newline (true)       - separate selectors with newline or
                                                  not (e.g. "a,\nbr" or "a, br")
        end_with_newline (false)                - end with a newline
        newline_between_rules (true)            - add a new line after every css rule
        space_around_selector_separator (false) - ensure space around selector separators:
                                                  '>', '+', '~' (e.g. "a>b" -> "a > b")
    e.g

    css_beautify(css_source_text, {
      'indent_size': 1,
      'indent_char': '\t',
      'selector_separator': ' ',
      'end_with_newline': false,
      'newline_between_rules': true,
      'space_around_selector_separator': true
    });
*/

// http://www.w3.org/TR/CSS21/syndata.html#tokenization
// http://www.w3.org/TR/css3-syntax/

(function() {

/* GENERATED_BUILD_OUTPUT */
var legacy_beautify_css;
/******/ (function() { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ([
/* 0 */,
/* 1 */,
/* 2 */
/***/ (function(module) {

/*jshint node:true */
/*
  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function OutputLine(parent) {
  this.__parent = parent;
  this.__character_count = 0;
  // use indent_count as a marker for this.__lines that have preserved indentation
  this.__indent_count = -1;
  this.__alignment_count = 0;
  this.__wrap_point_index = 0;
  this.__wrap_point_character_count = 0;
  this.__wrap_point_indent_count = -1;
  this.__wrap_point_alignment_count = 0;

  this.__items = [];
}

OutputLine.prototype.clone_empty = function() {
  var line = new OutputLine(this.__parent);
  line.set_indent(this.__indent_count, this.__alignment_count);
  return line;
};

OutputLine.prototype.item = function(index) {
  if (index < 0) {
    return this.__items[this.__items.length + index];
  } else {
    return this.__items[index];
  }
};

OutputLine.prototype.has_match = function(pattern) {
  for (var lastCheckedOutput = this.__items.length - 1; lastCheckedOutput >= 0; lastCheckedOutput--) {
    if (this.__items[lastCheckedOutput].match(pattern)) {
      return true;
    }
  }
  return false;
};

OutputLine.prototype.set_indent = function(indent, alignment) {
  if (this.is_empty()) {
    this.__indent_count = indent || 0;
    this.__alignment_count = alignment || 0;
    this.__character_count = this.__parent.get_indent_size(this.__indent_count, this.__alignment_count);
  }
};

OutputLine.prototype._set_wrap_point = function() {
  if (this.__parent.wrap_line_length) {
    this.__wrap_point_index = this.__items.length;
    this.__wrap_point_character_count = this.__character_count;
    this.__wrap_point_indent_count = this.__parent.next_line.__indent_count;
    this.__wrap_point_alignment_count = this.__parent.next_line.__alignment_count;
  }
};

OutputLine.prototype._should_wrap = function() {
  return this.__wrap_point_index &&
    this.__character_count > this.__parent.wrap_line_length &&
    this.__wrap_point_character_count > this.__parent.next_line.__character_count;
};

OutputLine.prototype._allow_wrap = function() {
  if (this._should_wrap()) {
    this.__parent.add_new_line();
    var next = this.__parent.current_line;
    next.set_indent(this.__wrap_point_indent_count, this.__wrap_point_alignment_count);
    next.__items = this.__items.slice(this.__wrap_point_index);
    this.__items = this.__items.slice(0, this.__wrap_point_index);

    next.__character_count += this.__character_count - this.__wrap_point_character_count;
    this.__character_count = this.__wrap_point_character_count;

    if (next.__items[0] === " ") {
      next.__items.splice(0, 1);
      next.__character_count -= 1;
    }
    return true;
  }
  return false;
};

OutputLine.prototype.is_empty = function() {
  return this.__items.length === 0;
};

OutputLine.prototype.last = function() {
  if (!this.is_empty()) {
    return this.__items[this.__items.length - 1];
  } else {
    return null;
  }
};

OutputLine.prototype.push = function(item) {
  this.__items.push(item);
  var last_newline_index = item.lastIndexOf('\n');
  if (last_newline_index !== -1) {
    this.__character_count = item.length - last_newline_index;
  } else {
    this.__character_count += item.length;
  }
};

OutputLine.prototype.pop = function() {
  var item = null;
  if (!this.is_empty()) {
    item = this.__items.pop();
    this.__character_count -= item.length;
  }
  return item;
};


OutputLine.prototype._remove_indent = function() {
  if (this.__indent_count > 0) {
    this.__indent_count -= 1;
    this.__character_count -= this.__parent.indent_size;
  }
};

OutputLine.prototype._remove_wrap_indent = function() {
  if (this.__wrap_point_indent_count > 0) {
    this.__wrap_point_indent_count -= 1;
  }
};
OutputLine.prototype.trim = function() {
  while (this.last() === ' ') {
    this.__items.pop();
    this.__character_count -= 1;
  }
};

OutputLine.prototype.toString = function() {
  var result = '';
  if (this.is_empty()) {
    if (this.__parent.indent_empty_lines) {
      result = this.__parent.get_indent_string(this.__indent_count);
    }
  } else {
    result = this.__parent.get_indent_string(this.__indent_count, this.__alignment_count);
    result += this.__items.join('');
  }
  return result;
};

function IndentStringCache(options, baseIndentString) {
  this.__cache = [''];
  this.__indent_size = options.indent_size;
  this.__indent_string = options.indent_char;
  if (!options.indent_with_tabs) {
    this.__indent_string = new Array(options.indent_size + 1).join(options.indent_char);
  }

  // Set to null to continue support for auto detection of base indent
  baseIndentString = baseIndentString || '';
  if (options.indent_level > 0) {
    baseIndentString = new Array(options.indent_level + 1).join(this.__indent_string);
  }

  this.__base_string = baseIndentString;
  this.__base_string_length = baseIndentString.length;
}

IndentStringCache.prototype.get_indent_size = function(indent, column) {
  var result = this.__base_string_length;
  column = column || 0;
  if (indent < 0) {
    result = 0;
  }
  result += indent * this.__indent_size;
  result += column;
  return result;
};

IndentStringCache.prototype.get_indent_string = function(indent_level, column) {
  var result = this.__base_string;
  column = column || 0;
  if (indent_level < 0) {
    indent_level = 0;
    result = '';
  }
  column += indent_level * this.__indent_size;
  this.__ensure_cache(column);
  result += this.__cache[column];
  return result;
};

IndentStringCache.prototype.__ensure_cache = function(column) {
  while (column >= this.__cache.length) {
    this.__add_column();
  }
};

IndentStringCache.prototype.__add_column = function() {
  var column = this.__cache.length;
  var indent = 0;
  var result = '';
  if (this.__indent_size && column >= this.__indent_size) {
    indent = Math.floor(column / this.__indent_size);
    column -= indent * this.__indent_size;
    result = new Array(indent + 1).join(this.__indent_string);
  }
  if (column) {
    result += new Array(column + 1).join(' ');
  }

  this.__cache.push(result);
};

function Output(options, baseIndentString) {
  this.__indent_cache = new IndentStringCache(options, baseIndentString);
  this.raw = false;
  this._end_with_newline = options.end_with_newline;
  this.indent_size = options.indent_size;
  this.wrap_line_length = options.wrap_line_length;
  this.indent_empty_lines = options.indent_empty_lines;
  this.__lines = [];
  this.previous_line = null;
  this.current_line = null;
  this.next_line = new OutputLine(this);
  this.space_before_token = false;
  this.non_breaking_space = false;
  this.previous_token_wrapped = false;
  // initialize
  this.__add_outputline();
}

Output.prototype.__add_outputline = function() {
  this.previous_line = this.current_line;
  this.current_line = this.next_line.clone_empty();
  this.__lines.push(this.current_line);
};

Output.prototype.get_line_number = function() {
  return this.__lines.length;
};

Output.prototype.get_indent_string = function(indent, column) {
  return this.__indent_cache.get_indent_string(indent, column);
};

Output.prototype.get_indent_size = function(indent, column) {
  return this.__indent_cache.get_indent_size(indent, column);
};

Output.prototype.is_empty = function() {
  return !this.previous_line && this.current_line.is_empty();
};

Output.prototype.add_new_line = function(force_newline) {
  // never newline at the start of file
  // otherwise, newline only if we didn't just add one or we're forced
  if (this.is_empty() ||
    (!force_newline && this.just_added_newline())) {
    return false;
  }

  // if raw output is enabled, don't print additional newlines,
  // but still return True as though you had
  if (!this.raw) {
    this.__add_outputline();
  }
  return true;
};

Output.prototype.get_code = function(eol) {
  this.trim(true);

  // handle some edge cases where the last tokens
  // has text that ends with newline(s)
  var last_item = this.current_line.pop();
  if (last_item) {
    if (last_item[last_item.length - 1] === '\n') {
      last_item = last_item.replace(/\n+$/g, '');
    }
    this.current_line.push(last_item);
  }

  if (this._end_with_newline) {
    this.__add_outputline();
  }

  var sweet_code = this.__lines.join('\n');

  if (eol !== '\n') {
    sweet_code = sweet_code.replace(/[\n]/g, eol);
  }
  return sweet_code;
};

Output.prototype.set_wrap_point = function() {
  this.current_line._set_wrap_point();
};

Output.prototype.set_indent = function(indent, alignment) {
  indent = indent || 0;
  alignment = alignment || 0;

  // Next line stores alignment values
  this.next_line.set_indent(indent, alignment);

  // Never indent your first output indent at the start of the file
  if (this.__lines.length > 1) {
    this.current_line.set_indent(indent, alignment);
    return true;
  }

  this.current_line.set_indent();
  return false;
};

Output.prototype.add_raw_token = function(token) {
  for (var x = 0; x < token.newlines; x++) {
    this.__add_outputline();
  }
  this.current_line.set_indent(-1);
  this.current_line.push(token.whitespace_before);
  this.current_line.push(token.text);
  this.space_before_token = false;
  this.non_breaking_space = false;
  this.previous_token_wrapped = false;
};

Output.prototype.add_token = function(printable_token) {
  this.__add_space_before_token();
  this.current_line.push(printable_token);
  this.space_before_token = false;
  this.non_breaking_space = false;
  this.previous_token_wrapped = this.current_line._allow_wrap();
};

Output.prototype.__add_space_before_token = function() {
  if (this.space_before_token && !this.just_added_newline()) {
    if (!this.non_breaking_space) {
      this.set_wrap_point();
    }
    this.current_line.push(' ');
  }
};

Output.prototype.remove_indent = function(index) {
  var output_length = this.__lines.length;
  while (index < output_length) {
    this.__lines[index]._remove_indent();
    index++;
  }
  this.current_line._remove_wrap_indent();
};

Output.prototype.trim = function(eat_newlines) {
  eat_newlines = (eat_newlines === undefined) ? false : eat_newlines;

  this.current_line.trim();

  while (eat_newlines && this.__lines.length > 1 &&
    this.current_line.is_empty()) {
    this.__lines.pop();
    this.current_line = this.__lines[this.__lines.length - 1];
    this.current_line.trim();
  }

  this.previous_line = this.__lines.length > 1 ?
    this.__lines[this.__lines.length - 2] : null;
};

Output.prototype.just_added_newline = function() {
  return this.current_line.is_empty();
};

Output.prototype.just_added_blankline = function() {
  return this.is_empty() ||
    (this.current_line.is_empty() && this.previous_line.is_empty());
};

Output.prototype.ensure_empty_line_above = function(starts_with, ends_with) {
  var index = this.__lines.length - 2;
  while (index >= 0) {
    var potentialEmptyLine = this.__lines[index];
    if (potentialEmptyLine.is_empty()) {
      break;
    } else if (potentialEmptyLine.item(0).indexOf(starts_with) !== 0 &&
      potentialEmptyLine.item(-1) !== ends_with) {
      this.__lines.splice(index + 1, 0, new OutputLine(this));
      this.previous_line = this.__lines[this.__lines.length - 2];
      break;
    }
    index--;
  }
};

module.exports.Output = Output;


/***/ }),
/* 3 */,
/* 4 */,
/* 5 */,
/* 6 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function Options(options, merge_child_field) {
  this.raw_options = _mergeOpts(options, merge_child_field);

  // Support passing the source text back with no change
  this.disabled = this._get_boolean('disabled');

  this.eol = this._get_characters('eol', 'auto');
  this.end_with_newline = this._get_boolean('end_with_newline');
  this.indent_size = this._get_number('indent_size', 4);
  this.indent_char = this._get_characters('indent_char', ' ');
  this.indent_level = this._get_number('indent_level');

  this.preserve_newlines = this._get_boolean('preserve_newlines', true);
  this.max_preserve_newlines = this._get_number('max_preserve_newlines', 32786);
  if (!this.preserve_newlines) {
    this.max_preserve_newlines = 0;
  }

  this.indent_with_tabs = this._get_boolean('indent_with_tabs', this.indent_char === '\t');
  if (this.indent_with_tabs) {
    this.indent_char = '\t';

    // indent_size behavior changed after 1.8.6
    // It used to be that indent_size would be
    // set to 1 for indent_with_tabs. That is no longer needed and
    // actually doesn't make sense - why not use spaces? Further,
    // that might produce unexpected behavior - tabs being used
    // for single-column alignment. So, when indent_with_tabs is true
    // and indent_size is 1, reset indent_size to 4.
    if (this.indent_size === 1) {
      this.indent_size = 4;
    }
  }

  // Backwards compat with 1.3.x
  this.wrap_line_length = this._get_number('wrap_line_length', this._get_number('max_char'));

  this.indent_empty_lines = this._get_boolean('indent_empty_lines');

  // valid templating languages ['django', 'erb', 'handlebars', 'php', 'smarty']
  // For now, 'auto' = all off for javascript, all on for html (and inline javascript).
  // other values ignored
  this.templating = this._get_selection_list('templating', ['auto', 'none', 'django', 'erb', 'handlebars', 'php', 'smarty'], ['auto']);
}

Options.prototype._get_array = function(name, default_value) {
  var option_value = this.raw_options[name];
  var result = default_value || [];
  if (typeof option_value === 'object') {
    if (option_value !== null && typeof option_value.concat === 'function') {
      result = option_value.concat();
    }
  } else if (typeof option_value === 'string') {
    result = option_value.split(/[^a-zA-Z0-9_\/\-]+/);
  }
  return result;
};

Options.prototype._get_boolean = function(name, default_value) {
  var option_value = this.raw_options[name];
  var result = option_value === undefined ? !!default_value : !!option_value;
  return result;
};

Options.prototype._get_characters = function(name, default_value) {
  var option_value = this.raw_options[name];
  var result = default_value || '';
  if (typeof option_value === 'string') {
    result = option_value.replace(/\\r/, '\r').replace(/\\n/, '\n').replace(/\\t/, '\t');
  }
  return result;
};

Options.prototype._get_number = function(name, default_value) {
  var option_value = this.raw_options[name];
  default_value = parseInt(default_value, 10);
  if (isNaN(default_value)) {
    default_value = 0;
  }
  var result = parseInt(option_value, 10);
  if (isNaN(result)) {
    result = default_value;
  }
  return result;
};

Options.prototype._get_selection = function(name, selection_list, default_value) {
  var result = this._get_selection_list(name, selection_list, default_value);
  if (result.length !== 1) {
    throw new Error(
      "Invalid Option Value: The option '" + name + "' can only be one of the following values:\n" +
      selection_list + "\nYou passed in: '" + this.raw_options[name] + "'");
  }

  return result[0];
};


Options.prototype._get_selection_list = function(name, selection_list, default_value) {
  if (!selection_list || selection_list.length === 0) {
    throw new Error("Selection list cannot be empty.");
  }

  default_value = default_value || [selection_list[0]];
  if (!this._is_valid_selection(default_value, selection_list)) {
    throw new Error("Invalid Default Value!");
  }

  var result = this._get_array(name, default_value);
  if (!this._is_valid_selection(result, selection_list)) {
    throw new Error(
      "Invalid Option Value: The option '" + name + "' can contain only the following values:\n" +
      selection_list + "\nYou passed in: '" + this.raw_options[name] + "'");
  }

  return result;
};

Options.prototype._is_valid_selection = function(result, selection_list) {
  return result.length && selection_list.length &&
    !result.some(function(item) { return selection_list.indexOf(item) === -1; });
};


// merges child options up with the parent options object
// Example: obj = {a: 1, b: {a: 2}}
//          mergeOpts(obj, 'b')
//
//          Returns: {a: 2}
function _mergeOpts(allOptions, childFieldName) {
  var finalOpts = {};
  allOptions = _normalizeOpts(allOptions);
  var name;

  for (name in allOptions) {
    if (name !== childFieldName) {
      finalOpts[name] = allOptions[name];
    }
  }

  //merge in the per type settings for the childFieldName
  if (childFieldName && allOptions[childFieldName]) {
    for (name in allOptions[childFieldName]) {
      finalOpts[name] = allOptions[childFieldName][name];
    }
  }
  return finalOpts;
}

function _normalizeOpts(options) {
  var convertedOpts = {};
  var key;

  for (key in options) {
    var newKey = key.replace(/-/g, "_");
    convertedOpts[newKey] = options[key];
  }
  return convertedOpts;
}

module.exports.Options = Options;
module.exports.normalizeOpts = _normalizeOpts;
module.exports.mergeOpts = _mergeOpts;


/***/ }),
/* 7 */,
/* 8 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var regexp_has_sticky = RegExp.prototype.hasOwnProperty('sticky');

function InputScanner(input_string) {
  this.__input = input_string || '';
  this.__input_length = this.__input.length;
  this.__position = 0;
}

InputScanner.prototype.restart = function() {
  this.__position = 0;
};

InputScanner.prototype.back = function() {
  if (this.__position > 0) {
    this.__position -= 1;
  }
};

InputScanner.prototype.hasNext = function() {
  return this.__position < this.__input_length;
};

InputScanner.prototype.next = function() {
  var val = null;
  if (this.hasNext()) {
    val = this.__input.charAt(this.__position);
    this.__position += 1;
  }
  return val;
};

InputScanner.prototype.peek = function(index) {
  var val = null;
  index = index || 0;
  index += this.__position;
  if (index >= 0 && index < this.__input_length) {
    val = this.__input.charAt(index);
  }
  return val;
};

// This is a JavaScript only helper function (not in python)
// Javascript doesn't have a match method
// and not all implementation support "sticky" flag.
// If they do not support sticky then both this.match() and this.test() method
// must get the match and check the index of the match.
// If sticky is supported and set, this method will use it.
// Otherwise it will check that global is set, and fall back to the slower method.
InputScanner.prototype.__match = function(pattern, index) {
  pattern.lastIndex = index;
  var pattern_match = pattern.exec(this.__input);

  if (pattern_match && !(regexp_has_sticky && pattern.sticky)) {
    if (pattern_match.index !== index) {
      pattern_match = null;
    }
  }

  return pattern_match;
};

InputScanner.prototype.test = function(pattern, index) {
  index = index || 0;
  index += this.__position;

  if (index >= 0 && index < this.__input_length) {
    return !!this.__match(pattern, index);
  } else {
    return false;
  }
};

InputScanner.prototype.testChar = function(pattern, index) {
  // test one character regex match
  var val = this.peek(index);
  pattern.lastIndex = 0;
  return val !== null && pattern.test(val);
};

InputScanner.prototype.match = function(pattern) {
  var pattern_match = this.__match(pattern, this.__position);
  if (pattern_match) {
    this.__position += pattern_match[0].length;
  } else {
    pattern_match = null;
  }
  return pattern_match;
};

InputScanner.prototype.read = function(starting_pattern, until_pattern, until_after) {
  var val = '';
  var match;
  if (starting_pattern) {
    match = this.match(starting_pattern);
    if (match) {
      val += match[0];
    }
  }
  if (until_pattern && (match || !starting_pattern)) {
    val += this.readUntil(until_pattern, until_after);
  }
  return val;
};

InputScanner.prototype.readUntil = function(pattern, until_after) {
  var val = '';
  var match_index = this.__position;
  pattern.lastIndex = this.__position;
  var pattern_match = pattern.exec(this.__input);
  if (pattern_match) {
    match_index = pattern_match.index;
    if (until_after) {
      match_index += pattern_match[0].length;
    }
  } else {
    match_index = this.__input_length;
  }

  val = this.__input.substring(this.__position, match_index);
  this.__position = match_index;
  return val;
};

InputScanner.prototype.readUntilAfter = function(pattern) {
  return this.readUntil(pattern, true);
};

InputScanner.prototype.get_regexp = function(pattern, match_from) {
  var result = null;
  var flags = 'g';
  if (match_from && regexp_has_sticky) {
    flags = 'y';
  }
  // strings are converted to regexp
  if (typeof pattern === "string" && pattern !== '') {
    // result = new RegExp(pattern.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), flags);
    result = new RegExp(pattern, flags);
  } else if (pattern) {
    result = new RegExp(pattern.source, flags);
  }
  return result;
};

InputScanner.prototype.get_literal_regexp = function(literal_string) {
  return RegExp(literal_string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'));
};

/* css beautifier legacy helpers */
InputScanner.prototype.peekUntilAfter = function(pattern) {
  var start = this.__position;
  var val = this.readUntilAfter(pattern);
  this.__position = start;
  return val;
};

InputScanner.prototype.lookBack = function(testVal) {
  var start = this.__position - 1;
  return start >= testVal.length && this.__input.substring(start - testVal.length, start)
    .toLowerCase() === testVal;
};

module.exports.InputScanner = InputScanner;


/***/ }),
/* 9 */,
/* 10 */,
/* 11 */,
/* 12 */,
/* 13 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function Directives(start_block_pattern, end_block_pattern) {
  start_block_pattern = typeof start_block_pattern === 'string' ? start_block_pattern : start_block_pattern.source;
  end_block_pattern = typeof end_block_pattern === 'string' ? end_block_pattern : end_block_pattern.source;
  this.__directives_block_pattern = new RegExp(start_block_pattern + / beautify( \w+[:]\w+)+ /.source + end_block_pattern, 'g');
  this.__directive_pattern = / (\w+)[:](\w+)/g;

  this.__directives_end_ignore_pattern = new RegExp(start_block_pattern + /\sbeautify\signore:end\s/.source + end_block_pattern, 'g');
}

Directives.prototype.get_directives = function(text) {
  if (!text.match(this.__directives_block_pattern)) {
    return null;
  }

  var directives = {};
  this.__directive_pattern.lastIndex = 0;
  var directive_match = this.__directive_pattern.exec(text);

  while (directive_match) {
    directives[directive_match[1]] = directive_match[2];
    directive_match = this.__directive_pattern.exec(text);
  }

  return directives;
};

Directives.prototype.readIgnored = function(input) {
  return input.readUntilAfter(this.__directives_end_ignore_pattern);
};


module.exports.Directives = Directives;


/***/ }),
/* 14 */,
/* 15 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_30126__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var Beautifier = (__nested_webpack_require_30126__(16).Beautifier),
  Options = (__nested_webpack_require_30126__(17).Options);

function css_beautify(source_text, options) {
  var beautifier = new Beautifier(source_text, options);
  return beautifier.beautify();
}

module.exports = css_beautify;
module.exports.defaultOptions = function() {
  return new Options();
};


/***/ }),
/* 16 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_31754__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var Options = (__nested_webpack_require_31754__(17).Options);
var Output = (__nested_webpack_require_31754__(2).Output);
var InputScanner = (__nested_webpack_require_31754__(8).InputScanner);
var Directives = (__nested_webpack_require_31754__(13).Directives);

var directives_core = new Directives(/\/\*/, /\*\//);

var lineBreak = /\r\n|[\r\n]/;
var allLineBreaks = /\r\n|[\r\n]/g;

// tokenizer
var whitespaceChar = /\s/;
var whitespacePattern = /(?:\s|\n)+/g;
var block_comment_pattern = /\/\*(?:[\s\S]*?)((?:\*\/)|$)/g;
var comment_pattern = /\/\/(?:[^\n\r\u2028\u2029]*)/g;

function Beautifier(source_text, options) {
  this._source_text = source_text || '';
  // Allow the setting of language/file-type specific options
  // with inheritance of overall settings
  this._options = new Options(options);
  this._ch = null;
  this._input = null;

  // https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule
  this.NESTED_AT_RULE = {
    "@page": true,
    "@font-face": true,
    "@keyframes": true,
    // also in CONDITIONAL_GROUP_RULE below
    "@media": true,
    "@supports": true,
    "@document": true
  };
  this.CONDITIONAL_GROUP_RULE = {
    "@media": true,
    "@supports": true,
    "@document": true
  };
  this.NON_SEMICOLON_NEWLINE_PROPERTY = [
    "grid-template-areas",
    "grid-template"
  ];

}

Beautifier.prototype.eatString = function(endChars) {
  var result = '';
  this._ch = this._input.next();
  while (this._ch) {
    result += this._ch;
    if (this._ch === "\\") {
      result += this._input.next();
    } else if (endChars.indexOf(this._ch) !== -1 || this._ch === "\n") {
      break;
    }
    this._ch = this._input.next();
  }
  return result;
};

// Skips any white space in the source text from the current position.
// When allowAtLeastOneNewLine is true, will output new lines for each
// newline character found; if the user has preserve_newlines off, only
// the first newline will be output
Beautifier.prototype.eatWhitespace = function(allowAtLeastOneNewLine) {
  var result = whitespaceChar.test(this._input.peek());
  var newline_count = 0;
  while (whitespaceChar.test(this._input.peek())) {
    this._ch = this._input.next();
    if (allowAtLeastOneNewLine && this._ch === '\n') {
      if (newline_count === 0 || newline_count < this._options.max_preserve_newlines) {
        newline_count++;
        this._output.add_new_line(true);
      }
    }
  }
  return result;
};

// Nested pseudo-class if we are insideRule
// and the next special character found opens
// a new block
Beautifier.prototype.foundNestedPseudoClass = function() {
  var openParen = 0;
  var i = 1;
  var ch = this._input.peek(i);
  while (ch) {
    if (ch === "{") {
      return true;
    } else if (ch === '(') {
      // pseudoclasses can contain ()
      openParen += 1;
    } else if (ch === ')') {
      if (openParen === 0) {
        return false;
      }
      openParen -= 1;
    } else if (ch === ";" || ch === "}") {
      return false;
    }
    i++;
    ch = this._input.peek(i);
  }
  return false;
};

Beautifier.prototype.print_string = function(output_string) {
  this._output.set_indent(this._indentLevel);
  this._output.non_breaking_space = true;
  this._output.add_token(output_string);
};

Beautifier.prototype.preserveSingleSpace = function(isAfterSpace) {
  if (isAfterSpace) {
    this._output.space_before_token = true;
  }
};

Beautifier.prototype.indent = function() {
  this._indentLevel++;
};

Beautifier.prototype.outdent = function() {
  if (this._indentLevel > 0) {
    this._indentLevel--;
  }
};

/*_____________________--------------------_____________________*/

Beautifier.prototype.beautify = function() {
  if (this._options.disabled) {
    return this._source_text;
  }

  var source_text = this._source_text;
  var eol = this._options.eol;
  if (eol === 'auto') {
    eol = '\n';
    if (source_text && lineBreak.test(source_text || '')) {
      eol = source_text.match(lineBreak)[0];
    }
  }


  // HACK: newline parsing inconsistent. This brute force normalizes the this._input.
  source_text = source_text.replace(allLineBreaks, '\n');

  // reset
  var baseIndentString = source_text.match(/^[\t ]*/)[0];

  this._output = new Output(this._options, baseIndentString);
  this._input = new InputScanner(source_text);
  this._indentLevel = 0;
  this._nestedLevel = 0;

  this._ch = null;
  var parenLevel = 0;

  var insideRule = false;
  // This is the value side of a property value pair (blue in the following ex)
  // label { content: blue }
  var insidePropertyValue = false;
  var enteringConditionalGroup = false;
  var insideAtExtend = false;
  var insideAtImport = false;
  var insideScssMap = false;
  var topCharacter = this._ch;
  var insideNonSemiColonValues = false;
  var whitespace;
  var isAfterSpace;
  var previous_ch;

  while (true) {
    whitespace = this._input.read(whitespacePattern);
    isAfterSpace = whitespace !== '';
    previous_ch = topCharacter;
    this._ch = this._input.next();
    if (this._ch === '\\' && this._input.hasNext()) {
      this._ch += this._input.next();
    }
    topCharacter = this._ch;

    if (!this._ch) {
      break;
    } else if (this._ch === '/' && this._input.peek() === '*') {
      // /* css comment */
      // Always start block comments on a new line.
      // This handles scenarios where a block comment immediately
      // follows a property definition on the same line or where
      // minified code is being beautified.
      this._output.add_new_line();
      this._input.back();

      var comment = this._input.read(block_comment_pattern);

      // Handle ignore directive
      var directives = directives_core.get_directives(comment);
      if (directives && directives.ignore === 'start') {
        comment += directives_core.readIgnored(this._input);
      }

      this.print_string(comment);

      // Ensures any new lines following the comment are preserved
      this.eatWhitespace(true);

      // Block comments are followed by a new line so they don't
      // share a line with other properties
      this._output.add_new_line();
    } else if (this._ch === '/' && this._input.peek() === '/') {
      // // single line comment
      // Preserves the space before a comment
      // on the same line as a rule
      this._output.space_before_token = true;
      this._input.back();
      this.print_string(this._input.read(comment_pattern));

      // Ensures any new lines following the comment are preserved
      this.eatWhitespace(true);
    } else if (this._ch === '@' || this._ch === '$') {
      this.preserveSingleSpace(isAfterSpace);

      // deal with less propery mixins @{...}
      if (this._input.peek() === '{') {
        this.print_string(this._ch + this.eatString('}'));
      } else {
        this.print_string(this._ch);

        // strip trailing space, if present, for hash property checks
        var variableOrRule = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);

        if (variableOrRule.match(/[ :]$/)) {
          // we have a variable or pseudo-class, add it and insert one space before continuing
          variableOrRule = this.eatString(": ").replace(/\s$/, '');
          this.print_string(variableOrRule);
          this._output.space_before_token = true;
        }

        variableOrRule = variableOrRule.replace(/\s$/, '');

        if (variableOrRule === 'extend') {
          insideAtExtend = true;
        } else if (variableOrRule === 'import') {
          insideAtImport = true;
        }

        // might be a nesting at-rule
        if (variableOrRule in this.NESTED_AT_RULE) {
          this._nestedLevel += 1;
          if (variableOrRule in this.CONDITIONAL_GROUP_RULE) {
            enteringConditionalGroup = true;
          }
          // might be less variable
        } else if (!insideRule && parenLevel === 0 && variableOrRule.indexOf(':') !== -1) {
          insidePropertyValue = true;
          this.indent();
        }
      }
    } else if (this._ch === '#' && this._input.peek() === '{') {
      this.preserveSingleSpace(isAfterSpace);
      this.print_string(this._ch + this.eatString('}'));
    } else if (this._ch === '{') {
      if (insidePropertyValue) {
        insidePropertyValue = false;
        this.outdent();
      }

      // when entering conditional groups, only rulesets are allowed
      if (enteringConditionalGroup) {
        enteringConditionalGroup = false;
        insideRule = (this._indentLevel >= this._nestedLevel);
      } else {
        // otherwise, declarations are also allowed
        insideRule = (this._indentLevel >= this._nestedLevel - 1);
      }
      if (this._options.newline_between_rules && insideRule) {
        if (this._output.previous_line && this._output.previous_line.item(-1) !== '{') {
          this._output.ensure_empty_line_above('/', ',');
        }
      }

      this._output.space_before_token = true;

      // The difference in print_string and indent order is necessary to indent the '{' correctly
      if (this._options.brace_style === 'expand') {
        this._output.add_new_line();
        this.print_string(this._ch);
        this.indent();
        this._output.set_indent(this._indentLevel);
      } else {
        // inside mixin and first param is object
        if (previous_ch === '(') {
          this._output.space_before_token = false;
        } else if (previous_ch !== ',') {
          this.indent();
        }
        this.print_string(this._ch);
      }

      this.eatWhitespace(true);
      this._output.add_new_line();
    } else if (this._ch === '}') {
      this.outdent();
      this._output.add_new_line();
      if (previous_ch === '{') {
        this._output.trim(true);
      }
      insideAtImport = false;
      insideAtExtend = false;
      if (insidePropertyValue) {
        this.outdent();
        insidePropertyValue = false;
      }
      this.print_string(this._ch);
      insideRule = false;
      if (this._nestedLevel) {
        this._nestedLevel--;
      }

      this.eatWhitespace(true);
      this._output.add_new_line();

      if (this._options.newline_between_rules && !this._output.just_added_blankline()) {
        if (this._input.peek() !== '}') {
          this._output.add_new_line(true);
        }
      }
      if (this._input.peek() === ')') {
        this._output.trim(true);
        if (this._options.brace_style === "expand") {
          this._output.add_new_line(true);
        }
      }
    } else if (this._ch === ":") {

      for (var i = 0; i < this.NON_SEMICOLON_NEWLINE_PROPERTY.length; i++) {
        if (this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[i])) {
          insideNonSemiColonValues = true;
          break;
        }
      }

      if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && parenLevel === 0) {
        // 'property: value' delimiter
        // which could be in a conditional group query
        this.print_string(':');
        if (!insidePropertyValue) {
          insidePropertyValue = true;
          this._output.space_before_token = true;
          this.eatWhitespace(true);
          this.indent();
        }
      } else {
        // sass/less parent reference don't use a space
        // sass nested pseudo-class don't use a space

        // preserve space before pseudoclasses/pseudoelements, as it means "in any child"
        if (this._input.lookBack(" ")) {
          this._output.space_before_token = true;
        }
        if (this._input.peek() === ":") {
          // pseudo-element
          this._ch = this._input.next();
          this.print_string("::");
        } else {
          // pseudo-class
          this.print_string(':');
        }
      }
    } else if (this._ch === '"' || this._ch === '\'') {
      var preserveQuoteSpace = previous_ch === '"' || previous_ch === '\'';
      this.preserveSingleSpace(preserveQuoteSpace || isAfterSpace);
      this.print_string(this._ch + this.eatString(this._ch));
      this.eatWhitespace(true);
    } else if (this._ch === ';') {
      insideNonSemiColonValues = false;
      if (parenLevel === 0) {
        if (insidePropertyValue) {
          this.outdent();
          insidePropertyValue = false;
        }
        insideAtExtend = false;
        insideAtImport = false;
        this.print_string(this._ch);
        this.eatWhitespace(true);

        // This maintains single line comments on the same
        // line. Block comments are also affected, but
        // a new line is always output before one inside
        // that section
        if (this._input.peek() !== '/') {
          this._output.add_new_line();
        }
      } else {
        this.print_string(this._ch);
        this.eatWhitespace(true);
        this._output.space_before_token = true;
      }
    } else if (this._ch === '(') { // may be a url
      if (this._input.lookBack("url")) {
        this.print_string(this._ch);
        this.eatWhitespace();
        parenLevel++;
        this.indent();
        this._ch = this._input.next();
        if (this._ch === ')' || this._ch === '"' || this._ch === '\'') {
          this._input.back();
        } else if (this._ch) {
          this.print_string(this._ch + this.eatString(')'));
          if (parenLevel) {
            parenLevel--;
            this.outdent();
          }
        }
      } else {
        var space_needed = false;
        if (this._input.lookBack("with")) {
          // look back is not an accurate solution, we need tokens to confirm without whitespaces
          space_needed = true;
        }
        this.preserveSingleSpace(isAfterSpace || space_needed);
        this.print_string(this._ch);

        // handle scss/sass map
        if (insidePropertyValue && previous_ch === "$" && this._options.selector_separator_newline) {
          this._output.add_new_line();
          insideScssMap = true;
        } else {
          this.eatWhitespace();
          parenLevel++;
          this.indent();
        }
      }
    } else if (this._ch === ')') {
      if (parenLevel) {
        parenLevel--;
        this.outdent();
      }
      if (insideScssMap && this._input.peek() === ";" && this._options.selector_separator_newline) {
        insideScssMap = false;
        this.outdent();
        this._output.add_new_line();
      }
      this.print_string(this._ch);
    } else if (this._ch === ',') {
      this.print_string(this._ch);
      this.eatWhitespace(true);
      if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideAtImport && !insideAtExtend) {
        this._output.add_new_line();
      } else {
        this._output.space_before_token = true;
      }
    } else if ((this._ch === '>' || this._ch === '+' || this._ch === '~') && !insidePropertyValue && parenLevel === 0) {
      //handle combinator spacing
      if (this._options.space_around_combinator) {
        this._output.space_before_token = true;
        this.print_string(this._ch);
        this._output.space_before_token = true;
      } else {
        this.print_string(this._ch);
        this.eatWhitespace();
        // squash extra whitespace
        if (this._ch && whitespaceChar.test(this._ch)) {
          this._ch = '';
        }
      }
    } else if (this._ch === ']') {
      this.print_string(this._ch);
    } else if (this._ch === '[') {
      this.preserveSingleSpace(isAfterSpace);
      this.print_string(this._ch);
    } else if (this._ch === '=') { // no whitespace before or after
      this.eatWhitespace();
      this.print_string('=');
      if (whitespaceChar.test(this._ch)) {
        this._ch = '';
      }
    } else if (this._ch === '!' && !this._input.lookBack("\\")) { // !important
      this._output.space_before_token = true;
      this.print_string(this._ch);
    } else {
      var preserveAfterSpace = previous_ch === '"' || previous_ch === '\'';
      this.preserveSingleSpace(preserveAfterSpace || isAfterSpace);
      this.print_string(this._ch);

      if (!this._output.just_added_newline() && this._input.peek() === '\n' && insideNonSemiColonValues) {
        this._output.add_new_line();
      }
    }
  }

  var sweetCode = this._output.get_code(eol);

  return sweetCode;
};

module.exports.Beautifier = Beautifier;


/***/ }),
/* 17 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_49314__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var BaseOptions = (__nested_webpack_require_49314__(6).Options);

function Options(options) {
  BaseOptions.call(this, options, 'css');

  this.selector_separator_newline = this._get_boolean('selector_separator_newline', true);
  this.newline_between_rules = this._get_boolean('newline_between_rules', true);
  var space_around_selector_separator = this._get_boolean('space_around_selector_separator');
  this.space_around_combinator = this._get_boolean('space_around_combinator') || space_around_selector_separator;

  var brace_style_split = this._get_selection_list('brace_style', ['collapse', 'expand', 'end-expand', 'none', 'preserve-inline']);
  this.brace_style = 'collapse';
  for (var bs = 0; bs < brace_style_split.length; bs++) {
    if (brace_style_split[bs] !== 'expand') {
      // default to collapse, as only collapse|expand is implemented for now
      this.brace_style = 'collapse';
    } else {
      this.brace_style = brace_style_split[bs];
    }
  }
}
Options.prototype = new BaseOptions();



module.exports.Options = Options;


/***/ })
/******/ 	]);
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __nested_webpack_require_51794__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_51794__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module is referenced by other modules so it can't be inlined
/******/ 	var __nested_webpack_exports__ = __nested_webpack_require_51794__(15);
/******/ 	legacy_beautify_css = __nested_webpack_exports__;
/******/ 	
/******/ })()
;
var css_beautify = legacy_beautify_css;
/* Footer */
if (true) {
    // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- )
    !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
        return {
            css_beautify: css_beautify
        };
    }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}

}());


/***/ }),

/***/ 54649:
/***/ ((module, exports, __webpack_require__) => {

var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* AUTO-GENERATED. DO NOT MODIFY. */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.


 Style HTML
---------------

  Written by Nochum Sossonko, (nsossonko@hotmail.com)

  Based on code initially developed by: Einar Lielmanis, <einar@beautifier.io>
    https://beautifier.io/

  Usage:
    style_html(html_source);

    style_html(html_source, options);

  The options are:
    indent_inner_html (default false)  — indent <head> and <body> sections,
    indent_size (default 4)          — indentation size,
    indent_char (default space)      — character to indent with,
    wrap_line_length (default 250)            -  maximum amount of characters per line (0 = disable)
    brace_style (default "collapse") - "collapse" | "expand" | "end-expand" | "none"
            put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are.
    inline (defaults to inline tags) - list of tags to be considered inline tags
    unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted
    content_unformatted (defaults to ["pre", "textarea"] tags) - list of tags, whose content shouldn't be reformatted
    indent_scripts (default normal)  - "keep"|"separate"|"normal"
    preserve_newlines (default true) - whether existing line breaks before elements should be preserved
                                        Only works before elements, not inside tags or for text.
    max_preserve_newlines (default unlimited) - maximum number of line breaks to be preserved in one chunk
    indent_handlebars (default false) - format and indent {{#foo}} and {{/foo}}
    end_with_newline (false)          - end with a newline
    extra_liners (default [head,body,/html]) -List of tags that should have an extra newline before them.

    e.g.

    style_html(html_source, {
      'indent_inner_html': false,
      'indent_size': 2,
      'indent_char': ' ',
      'wrap_line_length': 78,
      'brace_style': 'expand',
      'preserve_newlines': true,
      'max_preserve_newlines': 5,
      'indent_handlebars': false,
      'extra_liners': ['/html']
    });
*/

(function() {

/* GENERATED_BUILD_OUTPUT */
var legacy_beautify_html;
/******/ (function() { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ([
/* 0 */,
/* 1 */,
/* 2 */
/***/ (function(module) {

/*jshint node:true */
/*
  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function OutputLine(parent) {
  this.__parent = parent;
  this.__character_count = 0;
  // use indent_count as a marker for this.__lines that have preserved indentation
  this.__indent_count = -1;
  this.__alignment_count = 0;
  this.__wrap_point_index = 0;
  this.__wrap_point_character_count = 0;
  this.__wrap_point_indent_count = -1;
  this.__wrap_point_alignment_count = 0;

  this.__items = [];
}

OutputLine.prototype.clone_empty = function() {
  var line = new OutputLine(this.__parent);
  line.set_indent(this.__indent_count, this.__alignment_count);
  return line;
};

OutputLine.prototype.item = function(index) {
  if (index < 0) {
    return this.__items[this.__items.length + index];
  } else {
    return this.__items[index];
  }
};

OutputLine.prototype.has_match = function(pattern) {
  for (var lastCheckedOutput = this.__items.length - 1; lastCheckedOutput >= 0; lastCheckedOutput--) {
    if (this.__items[lastCheckedOutput].match(pattern)) {
      return true;
    }
  }
  return false;
};

OutputLine.prototype.set_indent = function(indent, alignment) {
  if (this.is_empty()) {
    this.__indent_count = indent || 0;
    this.__alignment_count = alignment || 0;
    this.__character_count = this.__parent.get_indent_size(this.__indent_count, this.__alignment_count);
  }
};

OutputLine.prototype._set_wrap_point = function() {
  if (this.__parent.wrap_line_length) {
    this.__wrap_point_index = this.__items.length;
    this.__wrap_point_character_count = this.__character_count;
    this.__wrap_point_indent_count = this.__parent.next_line.__indent_count;
    this.__wrap_point_alignment_count = this.__parent.next_line.__alignment_count;
  }
};

OutputLine.prototype._should_wrap = function() {
  return this.__wrap_point_index &&
    this.__character_count > this.__parent.wrap_line_length &&
    this.__wrap_point_character_count > this.__parent.next_line.__character_count;
};

OutputLine.prototype._allow_wrap = function() {
  if (this._should_wrap()) {
    this.__parent.add_new_line();
    var next = this.__parent.current_line;
    next.set_indent(this.__wrap_point_indent_count, this.__wrap_point_alignment_count);
    next.__items = this.__items.slice(this.__wrap_point_index);
    this.__items = this.__items.slice(0, this.__wrap_point_index);

    next.__character_count += this.__character_count - this.__wrap_point_character_count;
    this.__character_count = this.__wrap_point_character_count;

    if (next.__items[0] === " ") {
      next.__items.splice(0, 1);
      next.__character_count -= 1;
    }
    return true;
  }
  return false;
};

OutputLine.prototype.is_empty = function() {
  return this.__items.length === 0;
};

OutputLine.prototype.last = function() {
  if (!this.is_empty()) {
    return this.__items[this.__items.length - 1];
  } else {
    return null;
  }
};

OutputLine.prototype.push = function(item) {
  this.__items.push(item);
  var last_newline_index = item.lastIndexOf('\n');
  if (last_newline_index !== -1) {
    this.__character_count = item.length - last_newline_index;
  } else {
    this.__character_count += item.length;
  }
};

OutputLine.prototype.pop = function() {
  var item = null;
  if (!this.is_empty()) {
    item = this.__items.pop();
    this.__character_count -= item.length;
  }
  return item;
};


OutputLine.prototype._remove_indent = function() {
  if (this.__indent_count > 0) {
    this.__indent_count -= 1;
    this.__character_count -= this.__parent.indent_size;
  }
};

OutputLine.prototype._remove_wrap_indent = function() {
  if (this.__wrap_point_indent_count > 0) {
    this.__wrap_point_indent_count -= 1;
  }
};
OutputLine.prototype.trim = function() {
  while (this.last() === ' ') {
    this.__items.pop();
    this.__character_count -= 1;
  }
};

OutputLine.prototype.toString = function() {
  var result = '';
  if (this.is_empty()) {
    if (this.__parent.indent_empty_lines) {
      result = this.__parent.get_indent_string(this.__indent_count);
    }
  } else {
    result = this.__parent.get_indent_string(this.__indent_count, this.__alignment_count);
    result += this.__items.join('');
  }
  return result;
};

function IndentStringCache(options, baseIndentString) {
  this.__cache = [''];
  this.__indent_size = options.indent_size;
  this.__indent_string = options.indent_char;
  if (!options.indent_with_tabs) {
    this.__indent_string = new Array(options.indent_size + 1).join(options.indent_char);
  }

  // Set to null to continue support for auto detection of base indent
  baseIndentString = baseIndentString || '';
  if (options.indent_level > 0) {
    baseIndentString = new Array(options.indent_level + 1).join(this.__indent_string);
  }

  this.__base_string = baseIndentString;
  this.__base_string_length = baseIndentString.length;
}

IndentStringCache.prototype.get_indent_size = function(indent, column) {
  var result = this.__base_string_length;
  column = column || 0;
  if (indent < 0) {
    result = 0;
  }
  result += indent * this.__indent_size;
  result += column;
  return result;
};

IndentStringCache.prototype.get_indent_string = function(indent_level, column) {
  var result = this.__base_string;
  column = column || 0;
  if (indent_level < 0) {
    indent_level = 0;
    result = '';
  }
  column += indent_level * this.__indent_size;
  this.__ensure_cache(column);
  result += this.__cache[column];
  return result;
};

IndentStringCache.prototype.__ensure_cache = function(column) {
  while (column >= this.__cache.length) {
    this.__add_column();
  }
};

IndentStringCache.prototype.__add_column = function() {
  var column = this.__cache.length;
  var indent = 0;
  var result = '';
  if (this.__indent_size && column >= this.__indent_size) {
    indent = Math.floor(column / this.__indent_size);
    column -= indent * this.__indent_size;
    result = new Array(indent + 1).join(this.__indent_string);
  }
  if (column) {
    result += new Array(column + 1).join(' ');
  }

  this.__cache.push(result);
};

function Output(options, baseIndentString) {
  this.__indent_cache = new IndentStringCache(options, baseIndentString);
  this.raw = false;
  this._end_with_newline = options.end_with_newline;
  this.indent_size = options.indent_size;
  this.wrap_line_length = options.wrap_line_length;
  this.indent_empty_lines = options.indent_empty_lines;
  this.__lines = [];
  this.previous_line = null;
  this.current_line = null;
  this.next_line = new OutputLine(this);
  this.space_before_token = false;
  this.non_breaking_space = false;
  this.previous_token_wrapped = false;
  // initialize
  this.__add_outputline();
}

Output.prototype.__add_outputline = function() {
  this.previous_line = this.current_line;
  this.current_line = this.next_line.clone_empty();
  this.__lines.push(this.current_line);
};

Output.prototype.get_line_number = function() {
  return this.__lines.length;
};

Output.prototype.get_indent_string = function(indent, column) {
  return this.__indent_cache.get_indent_string(indent, column);
};

Output.prototype.get_indent_size = function(indent, column) {
  return this.__indent_cache.get_indent_size(indent, column);
};

Output.prototype.is_empty = function() {
  return !this.previous_line && this.current_line.is_empty();
};

Output.prototype.add_new_line = function(force_newline) {
  // never newline at the start of file
  // otherwise, newline only if we didn't just add one or we're forced
  if (this.is_empty() ||
    (!force_newline && this.just_added_newline())) {
    return false;
  }

  // if raw output is enabled, don't print additional newlines,
  // but still return True as though you had
  if (!this.raw) {
    this.__add_outputline();
  }
  return true;
};

Output.prototype.get_code = function(eol) {
  this.trim(true);

  // handle some edge cases where the last tokens
  // has text that ends with newline(s)
  var last_item = this.current_line.pop();
  if (last_item) {
    if (last_item[last_item.length - 1] === '\n') {
      last_item = last_item.replace(/\n+$/g, '');
    }
    this.current_line.push(last_item);
  }

  if (this._end_with_newline) {
    this.__add_outputline();
  }

  var sweet_code = this.__lines.join('\n');

  if (eol !== '\n') {
    sweet_code = sweet_code.replace(/[\n]/g, eol);
  }
  return sweet_code;
};

Output.prototype.set_wrap_point = function() {
  this.current_line._set_wrap_point();
};

Output.prototype.set_indent = function(indent, alignment) {
  indent = indent || 0;
  alignment = alignment || 0;

  // Next line stores alignment values
  this.next_line.set_indent(indent, alignment);

  // Never indent your first output indent at the start of the file
  if (this.__lines.length > 1) {
    this.current_line.set_indent(indent, alignment);
    return true;
  }

  this.current_line.set_indent();
  return false;
};

Output.prototype.add_raw_token = function(token) {
  for (var x = 0; x < token.newlines; x++) {
    this.__add_outputline();
  }
  this.current_line.set_indent(-1);
  this.current_line.push(token.whitespace_before);
  this.current_line.push(token.text);
  this.space_before_token = false;
  this.non_breaking_space = false;
  this.previous_token_wrapped = false;
};

Output.prototype.add_token = function(printable_token) {
  this.__add_space_before_token();
  this.current_line.push(printable_token);
  this.space_before_token = false;
  this.non_breaking_space = false;
  this.previous_token_wrapped = this.current_line._allow_wrap();
};

Output.prototype.__add_space_before_token = function() {
  if (this.space_before_token && !this.just_added_newline()) {
    if (!this.non_breaking_space) {
      this.set_wrap_point();
    }
    this.current_line.push(' ');
  }
};

Output.prototype.remove_indent = function(index) {
  var output_length = this.__lines.length;
  while (index < output_length) {
    this.__lines[index]._remove_indent();
    index++;
  }
  this.current_line._remove_wrap_indent();
};

Output.prototype.trim = function(eat_newlines) {
  eat_newlines = (eat_newlines === undefined) ? false : eat_newlines;

  this.current_line.trim();

  while (eat_newlines && this.__lines.length > 1 &&
    this.current_line.is_empty()) {
    this.__lines.pop();
    this.current_line = this.__lines[this.__lines.length - 1];
    this.current_line.trim();
  }

  this.previous_line = this.__lines.length > 1 ?
    this.__lines[this.__lines.length - 2] : null;
};

Output.prototype.just_added_newline = function() {
  return this.current_line.is_empty();
};

Output.prototype.just_added_blankline = function() {
  return this.is_empty() ||
    (this.current_line.is_empty() && this.previous_line.is_empty());
};

Output.prototype.ensure_empty_line_above = function(starts_with, ends_with) {
  var index = this.__lines.length - 2;
  while (index >= 0) {
    var potentialEmptyLine = this.__lines[index];
    if (potentialEmptyLine.is_empty()) {
      break;
    } else if (potentialEmptyLine.item(0).indexOf(starts_with) !== 0 &&
      potentialEmptyLine.item(-1) !== ends_with) {
      this.__lines.splice(index + 1, 0, new OutputLine(this));
      this.previous_line = this.__lines[this.__lines.length - 2];
      break;
    }
    index--;
  }
};

module.exports.Output = Output;


/***/ }),
/* 3 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function Token(type, text, newlines, whitespace_before) {
  this.type = type;
  this.text = text;

  // comments_before are
  // comments that have a new line before them
  // and may or may not have a newline after
  // this is a set of comments before
  this.comments_before = null; /* inline comment*/


  // this.comments_after =  new TokenStream(); // no new line before and newline after
  this.newlines = newlines || 0;
  this.whitespace_before = whitespace_before || '';
  this.parent = null;
  this.next = null;
  this.previous = null;
  this.opened = null;
  this.closed = null;
  this.directives = null;
}


module.exports.Token = Token;


/***/ }),
/* 4 */,
/* 5 */,
/* 6 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function Options(options, merge_child_field) {
  this.raw_options = _mergeOpts(options, merge_child_field);

  // Support passing the source text back with no change
  this.disabled = this._get_boolean('disabled');

  this.eol = this._get_characters('eol', 'auto');
  this.end_with_newline = this._get_boolean('end_with_newline');
  this.indent_size = this._get_number('indent_size', 4);
  this.indent_char = this._get_characters('indent_char', ' ');
  this.indent_level = this._get_number('indent_level');

  this.preserve_newlines = this._get_boolean('preserve_newlines', true);
  this.max_preserve_newlines = this._get_number('max_preserve_newlines', 32786);
  if (!this.preserve_newlines) {
    this.max_preserve_newlines = 0;
  }

  this.indent_with_tabs = this._get_boolean('indent_with_tabs', this.indent_char === '\t');
  if (this.indent_with_tabs) {
    this.indent_char = '\t';

    // indent_size behavior changed after 1.8.6
    // It used to be that indent_size would be
    // set to 1 for indent_with_tabs. That is no longer needed and
    // actually doesn't make sense - why not use spaces? Further,
    // that might produce unexpected behavior - tabs being used
    // for single-column alignment. So, when indent_with_tabs is true
    // and indent_size is 1, reset indent_size to 4.
    if (this.indent_size === 1) {
      this.indent_size = 4;
    }
  }

  // Backwards compat with 1.3.x
  this.wrap_line_length = this._get_number('wrap_line_length', this._get_number('max_char'));

  this.indent_empty_lines = this._get_boolean('indent_empty_lines');

  // valid templating languages ['django', 'erb', 'handlebars', 'php', 'smarty']
  // For now, 'auto' = all off for javascript, all on for html (and inline javascript).
  // other values ignored
  this.templating = this._get_selection_list('templating', ['auto', 'none', 'django', 'erb', 'handlebars', 'php', 'smarty'], ['auto']);
}

Options.prototype._get_array = function(name, default_value) {
  var option_value = this.raw_options[name];
  var result = default_value || [];
  if (typeof option_value === 'object') {
    if (option_value !== null && typeof option_value.concat === 'function') {
      result = option_value.concat();
    }
  } else if (typeof option_value === 'string') {
    result = option_value.split(/[^a-zA-Z0-9_\/\-]+/);
  }
  return result;
};

Options.prototype._get_boolean = function(name, default_value) {
  var option_value = this.raw_options[name];
  var result = option_value === undefined ? !!default_value : !!option_value;
  return result;
};

Options.prototype._get_characters = function(name, default_value) {
  var option_value = this.raw_options[name];
  var result = default_value || '';
  if (typeof option_value === 'string') {
    result = option_value.replace(/\\r/, '\r').replace(/\\n/, '\n').replace(/\\t/, '\t');
  }
  return result;
};

Options.prototype._get_number = function(name, default_value) {
  var option_value = this.raw_options[name];
  default_value = parseInt(default_value, 10);
  if (isNaN(default_value)) {
    default_value = 0;
  }
  var result = parseInt(option_value, 10);
  if (isNaN(result)) {
    result = default_value;
  }
  return result;
};

Options.prototype._get_selection = function(name, selection_list, default_value) {
  var result = this._get_selection_list(name, selection_list, default_value);
  if (result.length !== 1) {
    throw new Error(
      "Invalid Option Value: The option '" + name + "' can only be one of the following values:\n" +
      selection_list + "\nYou passed in: '" + this.raw_options[name] + "'");
  }

  return result[0];
};


Options.prototype._get_selection_list = function(name, selection_list, default_value) {
  if (!selection_list || selection_list.length === 0) {
    throw new Error("Selection list cannot be empty.");
  }

  default_value = default_value || [selection_list[0]];
  if (!this._is_valid_selection(default_value, selection_list)) {
    throw new Error("Invalid Default Value!");
  }

  var result = this._get_array(name, default_value);
  if (!this._is_valid_selection(result, selection_list)) {
    throw new Error(
      "Invalid Option Value: The option '" + name + "' can contain only the following values:\n" +
      selection_list + "\nYou passed in: '" + this.raw_options[name] + "'");
  }

  return result;
};

Options.prototype._is_valid_selection = function(result, selection_list) {
  return result.length && selection_list.length &&
    !result.some(function(item) { return selection_list.indexOf(item) === -1; });
};


// merges child options up with the parent options object
// Example: obj = {a: 1, b: {a: 2}}
//          mergeOpts(obj, 'b')
//
//          Returns: {a: 2}
function _mergeOpts(allOptions, childFieldName) {
  var finalOpts = {};
  allOptions = _normalizeOpts(allOptions);
  var name;

  for (name in allOptions) {
    if (name !== childFieldName) {
      finalOpts[name] = allOptions[name];
    }
  }

  //merge in the per type settings for the childFieldName
  if (childFieldName && allOptions[childFieldName]) {
    for (name in allOptions[childFieldName]) {
      finalOpts[name] = allOptions[childFieldName][name];
    }
  }
  return finalOpts;
}

function _normalizeOpts(options) {
  var convertedOpts = {};
  var key;

  for (key in options) {
    var newKey = key.replace(/-/g, "_");
    convertedOpts[newKey] = options[key];
  }
  return convertedOpts;
}

module.exports.Options = Options;
module.exports.normalizeOpts = _normalizeOpts;
module.exports.mergeOpts = _mergeOpts;


/***/ }),
/* 7 */,
/* 8 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var regexp_has_sticky = RegExp.prototype.hasOwnProperty('sticky');

function InputScanner(input_string) {
  this.__input = input_string || '';
  this.__input_length = this.__input.length;
  this.__position = 0;
}

InputScanner.prototype.restart = function() {
  this.__position = 0;
};

InputScanner.prototype.back = function() {
  if (this.__position > 0) {
    this.__position -= 1;
  }
};

InputScanner.prototype.hasNext = function() {
  return this.__position < this.__input_length;
};

InputScanner.prototype.next = function() {
  var val = null;
  if (this.hasNext()) {
    val = this.__input.charAt(this.__position);
    this.__position += 1;
  }
  return val;
};

InputScanner.prototype.peek = function(index) {
  var val = null;
  index = index || 0;
  index += this.__position;
  if (index >= 0 && index < this.__input_length) {
    val = this.__input.charAt(index);
  }
  return val;
};

// This is a JavaScript only helper function (not in python)
// Javascript doesn't have a match method
// and not all implementation support "sticky" flag.
// If they do not support sticky then both this.match() and this.test() method
// must get the match and check the index of the match.
// If sticky is supported and set, this method will use it.
// Otherwise it will check that global is set, and fall back to the slower method.
InputScanner.prototype.__match = function(pattern, index) {
  pattern.lastIndex = index;
  var pattern_match = pattern.exec(this.__input);

  if (pattern_match && !(regexp_has_sticky && pattern.sticky)) {
    if (pattern_match.index !== index) {
      pattern_match = null;
    }
  }

  return pattern_match;
};

InputScanner.prototype.test = function(pattern, index) {
  index = index || 0;
  index += this.__position;

  if (index >= 0 && index < this.__input_length) {
    return !!this.__match(pattern, index);
  } else {
    return false;
  }
};

InputScanner.prototype.testChar = function(pattern, index) {
  // test one character regex match
  var val = this.peek(index);
  pattern.lastIndex = 0;
  return val !== null && pattern.test(val);
};

InputScanner.prototype.match = function(pattern) {
  var pattern_match = this.__match(pattern, this.__position);
  if (pattern_match) {
    this.__position += pattern_match[0].length;
  } else {
    pattern_match = null;
  }
  return pattern_match;
};

InputScanner.prototype.read = function(starting_pattern, until_pattern, until_after) {
  var val = '';
  var match;
  if (starting_pattern) {
    match = this.match(starting_pattern);
    if (match) {
      val += match[0];
    }
  }
  if (until_pattern && (match || !starting_pattern)) {
    val += this.readUntil(until_pattern, until_after);
  }
  return val;
};

InputScanner.prototype.readUntil = function(pattern, until_after) {
  var val = '';
  var match_index = this.__position;
  pattern.lastIndex = this.__position;
  var pattern_match = pattern.exec(this.__input);
  if (pattern_match) {
    match_index = pattern_match.index;
    if (until_after) {
      match_index += pattern_match[0].length;
    }
  } else {
    match_index = this.__input_length;
  }

  val = this.__input.substring(this.__position, match_index);
  this.__position = match_index;
  return val;
};

InputScanner.prototype.readUntilAfter = function(pattern) {
  return this.readUntil(pattern, true);
};

InputScanner.prototype.get_regexp = function(pattern, match_from) {
  var result = null;
  var flags = 'g';
  if (match_from && regexp_has_sticky) {
    flags = 'y';
  }
  // strings are converted to regexp
  if (typeof pattern === "string" && pattern !== '') {
    // result = new RegExp(pattern.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), flags);
    result = new RegExp(pattern, flags);
  } else if (pattern) {
    result = new RegExp(pattern.source, flags);
  }
  return result;
};

InputScanner.prototype.get_literal_regexp = function(literal_string) {
  return RegExp(literal_string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'));
};

/* css beautifier legacy helpers */
InputScanner.prototype.peekUntilAfter = function(pattern) {
  var start = this.__position;
  var val = this.readUntilAfter(pattern);
  this.__position = start;
  return val;
};

InputScanner.prototype.lookBack = function(testVal) {
  var start = this.__position - 1;
  return start >= testVal.length && this.__input.substring(start - testVal.length, start)
    .toLowerCase() === testVal;
};

module.exports.InputScanner = InputScanner;


/***/ }),
/* 9 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_30287__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var InputScanner = (__nested_webpack_require_30287__(8).InputScanner);
var Token = (__nested_webpack_require_30287__(3).Token);
var TokenStream = (__nested_webpack_require_30287__(10).TokenStream);
var WhitespacePattern = (__nested_webpack_require_30287__(11).WhitespacePattern);

var TOKEN = {
  START: 'TK_START',
  RAW: 'TK_RAW',
  EOF: 'TK_EOF'
};

var Tokenizer = function(input_string, options) {
  this._input = new InputScanner(input_string);
  this._options = options || {};
  this.__tokens = null;

  this._patterns = {};
  this._patterns.whitespace = new WhitespacePattern(this._input);
};

Tokenizer.prototype.tokenize = function() {
  this._input.restart();
  this.__tokens = new TokenStream();

  this._reset();

  var current;
  var previous = new Token(TOKEN.START, '');
  var open_token = null;
  var open_stack = [];
  var comments = new TokenStream();

  while (previous.type !== TOKEN.EOF) {
    current = this._get_next_token(previous, open_token);
    while (this._is_comment(current)) {
      comments.add(current);
      current = this._get_next_token(previous, open_token);
    }

    if (!comments.isEmpty()) {
      current.comments_before = comments;
      comments = new TokenStream();
    }

    current.parent = open_token;

    if (this._is_opening(current)) {
      open_stack.push(open_token);
      open_token = current;
    } else if (open_token && this._is_closing(current, open_token)) {
      current.opened = open_token;
      open_token.closed = current;
      open_token = open_stack.pop();
      current.parent = open_token;
    }

    current.previous = previous;
    previous.next = current;

    this.__tokens.add(current);
    previous = current;
  }

  return this.__tokens;
};


Tokenizer.prototype._is_first_token = function() {
  return this.__tokens.isEmpty();
};

Tokenizer.prototype._reset = function() {};

Tokenizer.prototype._get_next_token = function(previous_token, open_token) { // jshint unused:false
  this._readWhitespace();
  var resulting_string = this._input.read(/.+/g);
  if (resulting_string) {
    return this._create_token(TOKEN.RAW, resulting_string);
  } else {
    return this._create_token(TOKEN.EOF, '');
  }
};

Tokenizer.prototype._is_comment = function(current_token) { // jshint unused:false
  return false;
};

Tokenizer.prototype._is_opening = function(current_token) { // jshint unused:false
  return false;
};

Tokenizer.prototype._is_closing = function(current_token, open_token) { // jshint unused:false
  return false;
};

Tokenizer.prototype._create_token = function(type, text) {
  var token = new Token(type, text,
    this._patterns.whitespace.newline_count,
    this._patterns.whitespace.whitespace_before_token);
  return token;
};

Tokenizer.prototype._readWhitespace = function() {
  return this._patterns.whitespace.read();
};



module.exports.Tokenizer = Tokenizer;
module.exports.TOKEN = TOKEN;


/***/ }),
/* 10 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function TokenStream(parent_token) {
  // private
  this.__tokens = [];
  this.__tokens_length = this.__tokens.length;
  this.__position = 0;
  this.__parent_token = parent_token;
}

TokenStream.prototype.restart = function() {
  this.__position = 0;
};

TokenStream.prototype.isEmpty = function() {
  return this.__tokens_length === 0;
};

TokenStream.prototype.hasNext = function() {
  return this.__position < this.__tokens_length;
};

TokenStream.prototype.next = function() {
  var val = null;
  if (this.hasNext()) {
    val = this.__tokens[this.__position];
    this.__position += 1;
  }
  return val;
};

TokenStream.prototype.peek = function(index) {
  var val = null;
  index = index || 0;
  index += this.__position;
  if (index >= 0 && index < this.__tokens_length) {
    val = this.__tokens[index];
  }
  return val;
};

TokenStream.prototype.add = function(token) {
  if (this.__parent_token) {
    token.parent = this.__parent_token;
  }
  this.__tokens.push(token);
  this.__tokens_length += 1;
};

module.exports.TokenStream = TokenStream;


/***/ }),
/* 11 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_36707__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var Pattern = (__nested_webpack_require_36707__(12).Pattern);

function WhitespacePattern(input_scanner, parent) {
  Pattern.call(this, input_scanner, parent);
  if (parent) {
    this._line_regexp = this._input.get_regexp(parent._line_regexp);
  } else {
    this.__set_whitespace_patterns('', '');
  }

  this.newline_count = 0;
  this.whitespace_before_token = '';
}
WhitespacePattern.prototype = new Pattern();

WhitespacePattern.prototype.__set_whitespace_patterns = function(whitespace_chars, newline_chars) {
  whitespace_chars += '\\t ';
  newline_chars += '\\n\\r';

  this._match_pattern = this._input.get_regexp(
    '[' + whitespace_chars + newline_chars + ']+', true);
  this._newline_regexp = this._input.get_regexp(
    '\\r\\n|[' + newline_chars + ']');
};

WhitespacePattern.prototype.read = function() {
  this.newline_count = 0;
  this.whitespace_before_token = '';

  var resulting_string = this._input.read(this._match_pattern);
  if (resulting_string === ' ') {
    this.whitespace_before_token = ' ';
  } else if (resulting_string) {
    var matches = this.__split(this._newline_regexp, resulting_string);
    this.newline_count = matches.length - 1;
    this.whitespace_before_token = matches[this.newline_count];
  }

  return resulting_string;
};

WhitespacePattern.prototype.matching = function(whitespace_chars, newline_chars) {
  var result = this._create();
  result.__set_whitespace_patterns(whitespace_chars, newline_chars);
  result._update();
  return result;
};

WhitespacePattern.prototype._create = function() {
  return new WhitespacePattern(this._input, this);
};

WhitespacePattern.prototype.__split = function(regexp, input_string) {
  regexp.lastIndex = 0;
  var start_index = 0;
  var result = [];
  var next_match = regexp.exec(input_string);
  while (next_match) {
    result.push(input_string.substring(start_index, next_match.index));
    start_index = next_match.index + next_match[0].length;
    next_match = regexp.exec(input_string);
  }

  if (start_index < input_string.length) {
    result.push(input_string.substring(start_index, input_string.length));
  } else {
    result.push('');
  }

  return result;
};



module.exports.WhitespacePattern = WhitespacePattern;


/***/ }),
/* 12 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function Pattern(input_scanner, parent) {
  this._input = input_scanner;
  this._starting_pattern = null;
  this._match_pattern = null;
  this._until_pattern = null;
  this._until_after = false;

  if (parent) {
    this._starting_pattern = this._input.get_regexp(parent._starting_pattern, true);
    this._match_pattern = this._input.get_regexp(parent._match_pattern, true);
    this._until_pattern = this._input.get_regexp(parent._until_pattern);
    this._until_after = parent._until_after;
  }
}

Pattern.prototype.read = function() {
  var result = this._input.read(this._starting_pattern);
  if (!this._starting_pattern || result) {
    result += this._input.read(this._match_pattern, this._until_pattern, this._until_after);
  }
  return result;
};

Pattern.prototype.read_match = function() {
  return this._input.match(this._match_pattern);
};

Pattern.prototype.until_after = function(pattern) {
  var result = this._create();
  result._until_after = true;
  result._until_pattern = this._input.get_regexp(pattern);
  result._update();
  return result;
};

Pattern.prototype.until = function(pattern) {
  var result = this._create();
  result._until_after = false;
  result._until_pattern = this._input.get_regexp(pattern);
  result._update();
  return result;
};

Pattern.prototype.starting_with = function(pattern) {
  var result = this._create();
  result._starting_pattern = this._input.get_regexp(pattern, true);
  result._update();
  return result;
};

Pattern.prototype.matching = function(pattern) {
  var result = this._create();
  result._match_pattern = this._input.get_regexp(pattern, true);
  result._update();
  return result;
};

Pattern.prototype._create = function() {
  return new Pattern(this._input, this);
};

Pattern.prototype._update = function() {};

module.exports.Pattern = Pattern;


/***/ }),
/* 13 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function Directives(start_block_pattern, end_block_pattern) {
  start_block_pattern = typeof start_block_pattern === 'string' ? start_block_pattern : start_block_pattern.source;
  end_block_pattern = typeof end_block_pattern === 'string' ? end_block_pattern : end_block_pattern.source;
  this.__directives_block_pattern = new RegExp(start_block_pattern + / beautify( \w+[:]\w+)+ /.source + end_block_pattern, 'g');
  this.__directive_pattern = / (\w+)[:](\w+)/g;

  this.__directives_end_ignore_pattern = new RegExp(start_block_pattern + /\sbeautify\signore:end\s/.source + end_block_pattern, 'g');
}

Directives.prototype.get_directives = function(text) {
  if (!text.match(this.__directives_block_pattern)) {
    return null;
  }

  var directives = {};
  this.__directive_pattern.lastIndex = 0;
  var directive_match = this.__directive_pattern.exec(text);

  while (directive_match) {
    directives[directive_match[1]] = directive_match[2];
    directive_match = this.__directive_pattern.exec(text);
  }

  return directives;
};

Directives.prototype.readIgnored = function(input) {
  return input.readUntilAfter(this.__directives_end_ignore_pattern);
};


module.exports.Directives = Directives;


/***/ }),
/* 14 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_45694__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var Pattern = (__nested_webpack_require_45694__(12).Pattern);


var template_names = {
  django: false,
  erb: false,
  handlebars: false,
  php: false,
  smarty: false
};

// This lets templates appear anywhere we would do a readUntil
// The cost is higher but it is pay to play.
function TemplatablePattern(input_scanner, parent) {
  Pattern.call(this, input_scanner, parent);
  this.__template_pattern = null;
  this._disabled = Object.assign({}, template_names);
  this._excluded = Object.assign({}, template_names);

  if (parent) {
    this.__template_pattern = this._input.get_regexp(parent.__template_pattern);
    this._excluded = Object.assign(this._excluded, parent._excluded);
    this._disabled = Object.assign(this._disabled, parent._disabled);
  }
  var pattern = new Pattern(input_scanner);
  this.__patterns = {
    handlebars_comment: pattern.starting_with(/{{!--/).until_after(/--}}/),
    handlebars_unescaped: pattern.starting_with(/{{{/).until_after(/}}}/),
    handlebars: pattern.starting_with(/{{/).until_after(/}}/),
    php: pattern.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),
    erb: pattern.starting_with(/<%[^%]/).until_after(/[^%]%>/),
    // django coflicts with handlebars a bit.
    django: pattern.starting_with(/{%/).until_after(/%}/),
    django_value: pattern.starting_with(/{{/).until_after(/}}/),
    django_comment: pattern.starting_with(/{#/).until_after(/#}/),
    smarty: pattern.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),
    smarty_comment: pattern.starting_with(/{\*/).until_after(/\*}/),
    smarty_literal: pattern.starting_with(/{literal}/).until_after(/{\/literal}/)
  };
}
TemplatablePattern.prototype = new Pattern();

TemplatablePattern.prototype._create = function() {
  return new TemplatablePattern(this._input, this);
};

TemplatablePattern.prototype._update = function() {
  this.__set_templated_pattern();
};

TemplatablePattern.prototype.disable = function(language) {
  var result = this._create();
  result._disabled[language] = true;
  result._update();
  return result;
};

TemplatablePattern.prototype.read_options = function(options) {
  var result = this._create();
  for (var language in template_names) {
    result._disabled[language] = options.templating.indexOf(language) === -1;
  }
  result._update();
  return result;
};

TemplatablePattern.prototype.exclude = function(language) {
  var result = this._create();
  result._excluded[language] = true;
  result._update();
  return result;
};

TemplatablePattern.prototype.read = function() {
  var result = '';
  if (this._match_pattern) {
    result = this._input.read(this._starting_pattern);
  } else {
    result = this._input.read(this._starting_pattern, this.__template_pattern);
  }
  var next = this._read_template();
  while (next) {
    if (this._match_pattern) {
      next += this._input.read(this._match_pattern);
    } else {
      next += this._input.readUntil(this.__template_pattern);
    }
    result += next;
    next = this._read_template();
  }

  if (this._until_after) {
    result += this._input.readUntilAfter(this._until_pattern);
  }
  return result;
};

TemplatablePattern.prototype.__set_templated_pattern = function() {
  var items = [];

  if (!this._disabled.php) {
    items.push(this.__patterns.php._starting_pattern.source);
  }
  if (!this._disabled.handlebars) {
    items.push(this.__patterns.handlebars._starting_pattern.source);
  }
  if (!this._disabled.erb) {
    items.push(this.__patterns.erb._starting_pattern.source);
  }
  if (!this._disabled.django) {
    items.push(this.__patterns.django._starting_pattern.source);
    // The starting pattern for django is more complex because it has different
    // patterns for value, comment, and other sections
    items.push(this.__patterns.django_value._starting_pattern.source);
    items.push(this.__patterns.django_comment._starting_pattern.source);
  }
  if (!this._disabled.smarty) {
    items.push(this.__patterns.smarty._starting_pattern.source);
  }

  if (this._until_pattern) {
    items.push(this._until_pattern.source);
  }
  this.__template_pattern = this._input.get_regexp('(?:' + items.join('|') + ')');
};

TemplatablePattern.prototype._read_template = function() {
  var resulting_string = '';
  var c = this._input.peek();
  if (c === '<') {
    var peek1 = this._input.peek(1);
    //if we're in a comment, do something special
    // We treat all comments as literals, even more than preformatted tags
    // we just look for the appropriate close tag
    if (!this._disabled.php && !this._excluded.php && peek1 === '?') {
      resulting_string = resulting_string ||
        this.__patterns.php.read();
    }
    if (!this._disabled.erb && !this._excluded.erb && peek1 === '%') {
      resulting_string = resulting_string ||
        this.__patterns.erb.read();
    }
  } else if (c === '{') {
    if (!this._disabled.handlebars && !this._excluded.handlebars) {
      resulting_string = resulting_string ||
        this.__patterns.handlebars_comment.read();
      resulting_string = resulting_string ||
        this.__patterns.handlebars_unescaped.read();
      resulting_string = resulting_string ||
        this.__patterns.handlebars.read();
    }
    if (!this._disabled.django) {
      // django coflicts with handlebars a bit.
      if (!this._excluded.django && !this._excluded.handlebars) {
        resulting_string = resulting_string ||
          this.__patterns.django_value.read();
      }
      if (!this._excluded.django) {
        resulting_string = resulting_string ||
          this.__patterns.django_comment.read();
        resulting_string = resulting_string ||
          this.__patterns.django.read();
      }
    }
    if (!this._disabled.smarty) {
      // smarty cannot be enabled with django or handlebars enabled
      if (this._disabled.django && this._disabled.handlebars) {
        resulting_string = resulting_string ||
          this.__patterns.smarty_comment.read();
        resulting_string = resulting_string ||
          this.__patterns.smarty_literal.read();
        resulting_string = resulting_string ||
          this.__patterns.smarty.read();
      }
    }
  }
  return resulting_string;
};


module.exports.TemplatablePattern = TemplatablePattern;


/***/ }),
/* 15 */,
/* 16 */,
/* 17 */,
/* 18 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_53240__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var Beautifier = (__nested_webpack_require_53240__(19).Beautifier),
  Options = (__nested_webpack_require_53240__(20).Options);

function style_html(html_source, options, js_beautify, css_beautify) {
  var beautifier = new Beautifier(html_source, options, js_beautify, css_beautify);
  return beautifier.beautify();
}

module.exports = style_html;
module.exports.defaultOptions = function() {
  return new Options();
};


/***/ }),
/* 19 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_54918__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var Options = (__nested_webpack_require_54918__(20).Options);
var Output = (__nested_webpack_require_54918__(2).Output);
var Tokenizer = (__nested_webpack_require_54918__(21).Tokenizer);
var TOKEN = (__nested_webpack_require_54918__(21).TOKEN);

var lineBreak = /\r\n|[\r\n]/;
var allLineBreaks = /\r\n|[\r\n]/g;

var Printer = function(options, base_indent_string) { //handles input/output and some other printing functions

  this.indent_level = 0;
  this.alignment_size = 0;
  this.max_preserve_newlines = options.max_preserve_newlines;
  this.preserve_newlines = options.preserve_newlines;

  this._output = new Output(options, base_indent_string);

};

Printer.prototype.current_line_has_match = function(pattern) {
  return this._output.current_line.has_match(pattern);
};

Printer.prototype.set_space_before_token = function(value, non_breaking) {
  this._output.space_before_token = value;
  this._output.non_breaking_space = non_breaking;
};

Printer.prototype.set_wrap_point = function() {
  this._output.set_indent(this.indent_level, this.alignment_size);
  this._output.set_wrap_point();
};


Printer.prototype.add_raw_token = function(token) {
  this._output.add_raw_token(token);
};

Printer.prototype.print_preserved_newlines = function(raw_token) {
  var newlines = 0;
  if (raw_token.type !== TOKEN.TEXT && raw_token.previous.type !== TOKEN.TEXT) {
    newlines = raw_token.newlines ? 1 : 0;
  }

  if (this.preserve_newlines) {
    newlines = raw_token.newlines < this.max_preserve_newlines + 1 ? raw_token.newlines : this.max_preserve_newlines + 1;
  }
  for (var n = 0; n < newlines; n++) {
    this.print_newline(n > 0);
  }

  return newlines !== 0;
};

Printer.prototype.traverse_whitespace = function(raw_token) {
  if (raw_token.whitespace_before || raw_token.newlines) {
    if (!this.print_preserved_newlines(raw_token)) {
      this._output.space_before_token = true;
    }
    return true;
  }
  return false;
};

Printer.prototype.previous_token_wrapped = function() {
  return this._output.previous_token_wrapped;
};

Printer.prototype.print_newline = function(force) {
  this._output.add_new_line(force);
};

Printer.prototype.print_token = function(token) {
  if (token.text) {
    this._output.set_indent(this.indent_level, this.alignment_size);
    this._output.add_token(token.text);
  }
};

Printer.prototype.indent = function() {
  this.indent_level++;
};

Printer.prototype.get_full_indent = function(level) {
  level = this.indent_level + (level || 0);
  if (level < 1) {
    return '';
  }

  return this._output.get_indent_string(level);
};

var get_type_attribute = function(start_token) {
  var result = null;
  var raw_token = start_token.next;

  // Search attributes for a type attribute
  while (raw_token.type !== TOKEN.EOF && start_token.closed !== raw_token) {
    if (raw_token.type === TOKEN.ATTRIBUTE && raw_token.text === 'type') {
      if (raw_token.next && raw_token.next.type === TOKEN.EQUALS &&
        raw_token.next.next && raw_token.next.next.type === TOKEN.VALUE) {
        result = raw_token.next.next.text;
      }
      break;
    }
    raw_token = raw_token.next;
  }

  return result;
};

var get_custom_beautifier_name = function(tag_check, raw_token) {
  var typeAttribute = null;
  var result = null;

  if (!raw_token.closed) {
    return null;
  }

  if (tag_check === 'script') {
    typeAttribute = 'text/javascript';
  } else if (tag_check === 'style') {
    typeAttribute = 'text/css';
  }

  typeAttribute = get_type_attribute(raw_token) || typeAttribute;

  // For script and style tags that have a type attribute, only enable custom beautifiers for matching values
  // For those without a type attribute use default;
  if (typeAttribute.search('text/css') > -1) {
    result = 'css';
  } else if (typeAttribute.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/) > -1) {
    result = 'javascript';
  } else if (typeAttribute.search(/(text|application|dojo)\/(x-)?(html)/) > -1) {
    result = 'html';
  } else if (typeAttribute.search(/test\/null/) > -1) {
    // Test only mime-type for testing the beautifier when null is passed as beautifing function
    result = 'null';
  }

  return result;
};

function in_array(what, arr) {
  return arr.indexOf(what) !== -1;
}

function TagFrame(parent, parser_token, indent_level) {
  this.parent = parent || null;
  this.tag = parser_token ? parser_token.tag_name : '';
  this.indent_level = indent_level || 0;
  this.parser_token = parser_token || null;
}

function TagStack(printer) {
  this._printer = printer;
  this._current_frame = null;
}

TagStack.prototype.get_parser_token = function() {
  return this._current_frame ? this._current_frame.parser_token : null;
};

TagStack.prototype.record_tag = function(parser_token) { //function to record a tag and its parent in this.tags Object
  var new_frame = new TagFrame(this._current_frame, parser_token, this._printer.indent_level);
  this._current_frame = new_frame;
};

TagStack.prototype._try_pop_frame = function(frame) { //function to retrieve the opening tag to the corresponding closer
  var parser_token = null;

  if (frame) {
    parser_token = frame.parser_token;
    this._printer.indent_level = frame.indent_level;
    this._current_frame = frame.parent;
  }

  return parser_token;
};

TagStack.prototype._get_frame = function(tag_list, stop_list) { //function to retrieve the opening tag to the corresponding closer
  var frame = this._current_frame;

  while (frame) { //till we reach '' (the initial value);
    if (tag_list.indexOf(frame.tag) !== -1) { //if this is it use it
      break;
    } else if (stop_list && stop_list.indexOf(frame.tag) !== -1) {
      frame = null;
      break;
    }
    frame = frame.parent;
  }

  return frame;
};

TagStack.prototype.try_pop = function(tag, stop_list) { //function to retrieve the opening tag to the corresponding closer
  var frame = this._get_frame([tag], stop_list);
  return this._try_pop_frame(frame);
};

TagStack.prototype.indent_to_tag = function(tag_list) {
  var frame = this._get_frame(tag_list);
  if (frame) {
    this._printer.indent_level = frame.indent_level;
  }
};

function Beautifier(source_text, options, js_beautify, css_beautify) {
  //Wrapper function to invoke all the necessary constructors and deal with the output.
  this._source_text = source_text || '';
  options = options || {};
  this._js_beautify = js_beautify;
  this._css_beautify = css_beautify;
  this._tag_stack = null;

  // Allow the setting of language/file-type specific options
  // with inheritance of overall settings
  var optionHtml = new Options(options, 'html');

  this._options = optionHtml;

  this._is_wrap_attributes_force = this._options.wrap_attributes.substr(0, 'force'.length) === 'force';
  this._is_wrap_attributes_force_expand_multiline = (this._options.wrap_attributes === 'force-expand-multiline');
  this._is_wrap_attributes_force_aligned = (this._options.wrap_attributes === 'force-aligned');
  this._is_wrap_attributes_aligned_multiple = (this._options.wrap_attributes === 'aligned-multiple');
  this._is_wrap_attributes_preserve = this._options.wrap_attributes.substr(0, 'preserve'.length) === 'preserve';
  this._is_wrap_attributes_preserve_aligned = (this._options.wrap_attributes === 'preserve-aligned');
}

Beautifier.prototype.beautify = function() {

  // if disabled, return the input unchanged.
  if (this._options.disabled) {
    return this._source_text;
  }

  var source_text = this._source_text;
  var eol = this._options.eol;
  if (this._options.eol === 'auto') {
    eol = '\n';
    if (source_text && lineBreak.test(source_text)) {
      eol = source_text.match(lineBreak)[0];
    }
  }

  // HACK: newline parsing inconsistent. This brute force normalizes the input.
  source_text = source_text.replace(allLineBreaks, '\n');

  var baseIndentString = source_text.match(/^[\t ]*/)[0];

  var last_token = {
    text: '',
    type: ''
  };

  var last_tag_token = new TagOpenParserToken();

  var printer = new Printer(this._options, baseIndentString);
  var tokens = new Tokenizer(source_text, this._options).tokenize();

  this._tag_stack = new TagStack(printer);

  var parser_token = null;
  var raw_token = tokens.next();
  while (raw_token.type !== TOKEN.EOF) {

    if (raw_token.type === TOKEN.TAG_OPEN || raw_token.type === TOKEN.COMMENT) {
      parser_token = this._handle_tag_open(printer, raw_token, last_tag_token, last_token);
      last_tag_token = parser_token;
    } else if ((raw_token.type === TOKEN.ATTRIBUTE || raw_token.type === TOKEN.EQUALS || raw_token.type === TOKEN.VALUE) ||
      (raw_token.type === TOKEN.TEXT && !last_tag_token.tag_complete)) {
      parser_token = this._handle_inside_tag(printer, raw_token, last_tag_token, tokens);
    } else if (raw_token.type === TOKEN.TAG_CLOSE) {
      parser_token = this._handle_tag_close(printer, raw_token, last_tag_token);
    } else if (raw_token.type === TOKEN.TEXT) {
      parser_token = this._handle_text(printer, raw_token, last_tag_token);
    } else {
      // This should never happen, but if it does. Print the raw token
      printer.add_raw_token(raw_token);
    }

    last_token = parser_token;

    raw_token = tokens.next();
  }
  var sweet_code = printer._output.get_code(eol);

  return sweet_code;
};

Beautifier.prototype._handle_tag_close = function(printer, raw_token, last_tag_token) {
  var parser_token = {
    text: raw_token.text,
    type: raw_token.type
  };
  printer.alignment_size = 0;
  last_tag_token.tag_complete = true;

  printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== '', true);
  if (last_tag_token.is_unformatted) {
    printer.add_raw_token(raw_token);
  } else {
    if (last_tag_token.tag_start_char === '<') {
      printer.set_space_before_token(raw_token.text[0] === '/', true); // space before />, no space before >
      if (this._is_wrap_attributes_force_expand_multiline && last_tag_token.has_wrapped_attrs) {
        printer.print_newline(false);
      }
    }
    printer.print_token(raw_token);

  }

  if (last_tag_token.indent_content &&
    !(last_tag_token.is_unformatted || last_tag_token.is_content_unformatted)) {
    printer.indent();

    // only indent once per opened tag
    last_tag_token.indent_content = false;
  }

  if (!last_tag_token.is_inline_element &&
    !(last_tag_token.is_unformatted || last_tag_token.is_content_unformatted)) {
    printer.set_wrap_point();
  }

  return parser_token;
};

Beautifier.prototype._handle_inside_tag = function(printer, raw_token, last_tag_token, tokens) {
  var wrapped = last_tag_token.has_wrapped_attrs;
  var parser_token = {
    text: raw_token.text,
    type: raw_token.type
  };

  printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== '', true);
  if (last_tag_token.is_unformatted) {
    printer.add_raw_token(raw_token);
  } else if (last_tag_token.tag_start_char === '{' && raw_token.type === TOKEN.TEXT) {
    // For the insides of handlebars allow newlines or a single space between open and contents
    if (printer.print_preserved_newlines(raw_token)) {
      raw_token.newlines = 0;
      printer.add_raw_token(raw_token);
    } else {
      printer.print_token(raw_token);
    }
  } else {
    if (raw_token.type === TOKEN.ATTRIBUTE) {
      printer.set_space_before_token(true);
      last_tag_token.attr_count += 1;
    } else if (raw_token.type === TOKEN.EQUALS) { //no space before =
      printer.set_space_before_token(false);
    } else if (raw_token.type === TOKEN.VALUE && raw_token.previous.type === TOKEN.EQUALS) { //no space before value
      printer.set_space_before_token(false);
    }

    if (raw_token.type === TOKEN.ATTRIBUTE && last_tag_token.tag_start_char === '<') {
      if (this._is_wrap_attributes_preserve || this._is_wrap_attributes_preserve_aligned) {
        printer.traverse_whitespace(raw_token);
        wrapped = wrapped || raw_token.newlines !== 0;
      }


      if (this._is_wrap_attributes_force) {
        var force_attr_wrap = last_tag_token.attr_count > 1;
        if (this._is_wrap_attributes_force_expand_multiline && last_tag_token.attr_count === 1) {
          var is_only_attribute = true;
          var peek_index = 0;
          var peek_token;
          do {
            peek_token = tokens.peek(peek_index);
            if (peek_token.type === TOKEN.ATTRIBUTE) {
              is_only_attribute = false;
              break;
            }
            peek_index += 1;
          } while (peek_index < 4 && peek_token.type !== TOKEN.EOF && peek_token.type !== TOKEN.TAG_CLOSE);

          force_attr_wrap = !is_only_attribute;
        }

        if (force_attr_wrap) {
          printer.print_newline(false);
          wrapped = true;
        }
      }
    }
    printer.print_token(raw_token);
    wrapped = wrapped || printer.previous_token_wrapped();
    last_tag_token.has_wrapped_attrs = wrapped;
  }
  return parser_token;
};

Beautifier.prototype._handle_text = function(printer, raw_token, last_tag_token) {
  var parser_token = {
    text: raw_token.text,
    type: 'TK_CONTENT'
  };
  if (last_tag_token.custom_beautifier_name) { //check if we need to format javascript
    this._print_custom_beatifier_text(printer, raw_token, last_tag_token);
  } else if (last_tag_token.is_unformatted || last_tag_token.is_content_unformatted) {
    printer.add_raw_token(raw_token);
  } else {
    printer.traverse_whitespace(raw_token);
    printer.print_token(raw_token);
  }
  return parser_token;
};

Beautifier.prototype._print_custom_beatifier_text = function(printer, raw_token, last_tag_token) {
  var local = this;
  if (raw_token.text !== '') {

    var text = raw_token.text,
      _beautifier,
      script_indent_level = 1,
      pre = '',
      post = '';
    if (last_tag_token.custom_beautifier_name === 'javascript' && typeof this._js_beautify === 'function') {
      _beautifier = this._js_beautify;
    } else if (last_tag_token.custom_beautifier_name === 'css' && typeof this._css_beautify === 'function') {
      _beautifier = this._css_beautify;
    } else if (last_tag_token.custom_beautifier_name === 'html') {
      _beautifier = function(html_source, options) {
        var beautifier = new Beautifier(html_source, options, local._js_beautify, local._css_beautify);
        return beautifier.beautify();
      };
    }

    if (this._options.indent_scripts === "keep") {
      script_indent_level = 0;
    } else if (this._options.indent_scripts === "separate") {
      script_indent_level = -printer.indent_level;
    }

    var indentation = printer.get_full_indent(script_indent_level);

    // if there is at least one empty line at the end of this text, strip it
    // we'll be adding one back after the text but before the containing tag.
    text = text.replace(/\n[ \t]*$/, '');

    // Handle the case where content is wrapped in a comment or cdata.
    if (last_tag_token.custom_beautifier_name !== 'html' &&
      text[0] === '<' && text.match(/^(<!--|<!\[CDATA\[)/)) {
      var matched = /^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(text);

      // if we start to wrap but don't finish, print raw
      if (!matched) {
        printer.add_raw_token(raw_token);
        return;
      }

      pre = indentation + matched[1] + '\n';
      text = matched[4];
      if (matched[5]) {
        post = indentation + matched[5];
      }

      // if there is at least one empty line at the end of this text, strip it
      // we'll be adding one back after the text but before the containing tag.
      text = text.replace(/\n[ \t]*$/, '');

      if (matched[2] || matched[3].indexOf('\n') !== -1) {
        // if the first line of the non-comment text has spaces
        // use that as the basis for indenting in null case.
        matched = matched[3].match(/[ \t]+$/);
        if (matched) {
          raw_token.whitespace_before = matched[0];
        }
      }
    }

    if (text) {
      if (_beautifier) {

        // call the Beautifier if avaliable
        var Child_options = function() {
          this.eol = '\n';
        };
        Child_options.prototype = this._options.raw_options;
        var child_options = new Child_options();
        text = _beautifier(indentation + text, child_options);
      } else {
        // simply indent the string otherwise
        var white = raw_token.whitespace_before;
        if (white) {
          text = text.replace(new RegExp('\n(' + white + ')?', 'g'), '\n');
        }

        text = indentation + text.replace(/\n/g, '\n' + indentation);
      }
    }

    if (pre) {
      if (!text) {
        text = pre + post;
      } else {
        text = pre + text + '\n' + post;
      }
    }

    printer.print_newline(false);
    if (text) {
      raw_token.text = text;
      raw_token.whitespace_before = '';
      raw_token.newlines = 0;
      printer.add_raw_token(raw_token);
      printer.print_newline(true);
    }
  }
};

Beautifier.prototype._handle_tag_open = function(printer, raw_token, last_tag_token, last_token) {
  var parser_token = this._get_tag_open_token(raw_token);

  if ((last_tag_token.is_unformatted || last_tag_token.is_content_unformatted) &&
    !last_tag_token.is_empty_element &&
    raw_token.type === TOKEN.TAG_OPEN && raw_token.text.indexOf('</') === 0) {
    // End element tags for unformatted or content_unformatted elements
    // are printed raw to keep any newlines inside them exactly the same.
    printer.add_raw_token(raw_token);
    parser_token.start_tag_token = this._tag_stack.try_pop(parser_token.tag_name);
  } else {
    printer.traverse_whitespace(raw_token);
    this._set_tag_position(printer, raw_token, parser_token, last_tag_token, last_token);
    if (!parser_token.is_inline_element) {
      printer.set_wrap_point();
    }
    printer.print_token(raw_token);
  }

  //indent attributes an auto, forced, aligned or forced-align line-wrap
  if (this._is_wrap_attributes_force_aligned || this._is_wrap_attributes_aligned_multiple || this._is_wrap_attributes_preserve_aligned) {
    parser_token.alignment_size = raw_token.text.length + 1;
  }

  if (!parser_token.tag_complete && !parser_token.is_unformatted) {
    printer.alignment_size = parser_token.alignment_size;
  }

  return parser_token;
};

var TagOpenParserToken = function(parent, raw_token) {
  this.parent = parent || null;
  this.text = '';
  this.type = 'TK_TAG_OPEN';
  this.tag_name = '';
  this.is_inline_element = false;
  this.is_unformatted = false;
  this.is_content_unformatted = false;
  this.is_empty_element = false;
  this.is_start_tag = false;
  this.is_end_tag = false;
  this.indent_content = false;
  this.multiline_content = false;
  this.custom_beautifier_name = null;
  this.start_tag_token = null;
  this.attr_count = 0;
  this.has_wrapped_attrs = false;
  this.alignment_size = 0;
  this.tag_complete = false;
  this.tag_start_char = '';
  this.tag_check = '';

  if (!raw_token) {
    this.tag_complete = true;
  } else {
    var tag_check_match;

    this.tag_start_char = raw_token.text[0];
    this.text = raw_token.text;

    if (this.tag_start_char === '<') {
      tag_check_match = raw_token.text.match(/^<([^\s>]*)/);
      this.tag_check = tag_check_match ? tag_check_match[1] : '';
    } else {
      tag_check_match = raw_token.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/);
      this.tag_check = tag_check_match ? tag_check_match[1] : '';

      // handle "{{#> myPartial}}" or "{{~#> myPartial}}"
      if ((raw_token.text.startsWith('{{#>') || raw_token.text.startsWith('{{~#>')) && this.tag_check[0] === '>') {
        if (this.tag_check === '>' && raw_token.next !== null) {
          this.tag_check = raw_token.next.text.split(' ')[0];
        } else {
          this.tag_check = raw_token.text.split('>')[1];
        }
      }
    }

    this.tag_check = this.tag_check.toLowerCase();

    if (raw_token.type === TOKEN.COMMENT) {
      this.tag_complete = true;
    }

    this.is_start_tag = this.tag_check.charAt(0) !== '/';
    this.tag_name = !this.is_start_tag ? this.tag_check.substr(1) : this.tag_check;
    this.is_end_tag = !this.is_start_tag ||
      (raw_token.closed && raw_token.closed.text === '/>');

    // if whitespace handler ~ included (i.e. {{~#if true}}), handlebars tags start at pos 3 not pos 2
    var handlebar_starts = 2;
    if (this.tag_start_char === '{' && this.text.length >= 3) {
      if (this.text.charAt(2) === '~') {
        handlebar_starts = 3;
      }
    }

    // handlebars tags that don't start with # or ^ are single_tags, and so also start and end.
    this.is_end_tag = this.is_end_tag ||
      (this.tag_start_char === '{' && (this.text.length < 3 || (/[^#\^]/.test(this.text.charAt(handlebar_starts)))));
  }
};

Beautifier.prototype._get_tag_open_token = function(raw_token) { //function to get a full tag and parse its type
  var parser_token = new TagOpenParserToken(this._tag_stack.get_parser_token(), raw_token);

  parser_token.alignment_size = this._options.wrap_attributes_indent_size;

  parser_token.is_end_tag = parser_token.is_end_tag ||
    in_array(parser_token.tag_check, this._options.void_elements);

  parser_token.is_empty_element = parser_token.tag_complete ||
    (parser_token.is_start_tag && parser_token.is_end_tag);

  parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted);
  parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted);
  parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_name.includes("-") || parser_token.tag_start_char === '{';

  return parser_token;
};

Beautifier.prototype._set_tag_position = function(printer, raw_token, parser_token, last_tag_token, last_token) {

  if (!parser_token.is_empty_element) {
    if (parser_token.is_end_tag) { //this tag is a double tag so check for tag-ending
      parser_token.start_tag_token = this._tag_stack.try_pop(parser_token.tag_name); //remove it and all ancestors
    } else { // it's a start-tag
      // check if this tag is starting an element that has optional end element
      // and do an ending needed
      if (this._do_optional_end_element(parser_token)) {
        if (!parser_token.is_inline_element) {
          printer.print_newline(false);
        }
      }

      this._tag_stack.record_tag(parser_token); //push it on the tag stack

      if ((parser_token.tag_name === 'script' || parser_token.tag_name === 'style') &&
        !(parser_token.is_unformatted || parser_token.is_content_unformatted)) {
        parser_token.custom_beautifier_name = get_custom_beautifier_name(parser_token.tag_check, raw_token);
      }
    }
  }

  if (in_array(parser_token.tag_check, this._options.extra_liners)) { //check if this double needs an extra line
    printer.print_newline(false);
    if (!printer._output.just_added_blankline()) {
      printer.print_newline(true);
    }
  }

  if (parser_token.is_empty_element) { //if this tag name is a single tag type (either in the list or has a closing /)

    // if you hit an else case, reset the indent level if you are inside an:
    // 'if', 'unless', or 'each' block.
    if (parser_token.tag_start_char === '{' && parser_token.tag_check === 'else') {
      this._tag_stack.indent_to_tag(['if', 'unless', 'each']);
      parser_token.indent_content = true;
      // Don't add a newline if opening {{#if}} tag is on the current line
      var foundIfOnCurrentLine = printer.current_line_has_match(/{{#if/);
      if (!foundIfOnCurrentLine) {
        printer.print_newline(false);
      }
    }

    // Don't add a newline before elements that should remain where they are.
    if (parser_token.tag_name === '!--' && last_token.type === TOKEN.TAG_CLOSE &&
      last_tag_token.is_end_tag && parser_token.text.indexOf('\n') === -1) {
      //Do nothing. Leave comments on same line.
    } else {
      if (!(parser_token.is_inline_element || parser_token.is_unformatted)) {
        printer.print_newline(false);
      }
      this._calcluate_parent_multiline(printer, parser_token);
    }
  } else if (parser_token.is_end_tag) { //this tag is a double tag so check for tag-ending
    var do_end_expand = false;

    // deciding whether a block is multiline should not be this hard
    do_end_expand = parser_token.start_tag_token && parser_token.start_tag_token.multiline_content;
    do_end_expand = do_end_expand || (!parser_token.is_inline_element &&
      !(last_tag_token.is_inline_element || last_tag_token.is_unformatted) &&
      !(last_token.type === TOKEN.TAG_CLOSE && parser_token.start_tag_token === last_tag_token) &&
      last_token.type !== 'TK_CONTENT'
    );

    if (parser_token.is_content_unformatted || parser_token.is_unformatted) {
      do_end_expand = false;
    }

    if (do_end_expand) {
      printer.print_newline(false);
    }
  } else { // it's a start-tag
    parser_token.indent_content = !parser_token.custom_beautifier_name;

    if (parser_token.tag_start_char === '<') {
      if (parser_token.tag_name === 'html') {
        parser_token.indent_content = this._options.indent_inner_html;
      } else if (parser_token.tag_name === 'head') {
        parser_token.indent_content = this._options.indent_head_inner_html;
      } else if (parser_token.tag_name === 'body') {
        parser_token.indent_content = this._options.indent_body_inner_html;
      }
    }

    if (!(parser_token.is_inline_element || parser_token.is_unformatted) &&
      (last_token.type !== 'TK_CONTENT' || parser_token.is_content_unformatted)) {
      printer.print_newline(false);
    }

    this._calcluate_parent_multiline(printer, parser_token);
  }
};

Beautifier.prototype._calcluate_parent_multiline = function(printer, parser_token) {
  if (parser_token.parent && printer._output.just_added_newline() &&
    !((parser_token.is_inline_element || parser_token.is_unformatted) && parser_token.parent.is_inline_element)) {
    parser_token.parent.multiline_content = true;
  }
};

//To be used for <p> tag special case:
var p_closers = ['address', 'article', 'aside', 'blockquote', 'details', 'div', 'dl', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'main', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'];
var p_parent_excludes = ['a', 'audio', 'del', 'ins', 'map', 'noscript', 'video'];

Beautifier.prototype._do_optional_end_element = function(parser_token) {
  var result = null;
  // NOTE: cases of "if there is no more content in the parent element"
  // are handled automatically by the beautifier.
  // It assumes parent or ancestor close tag closes all children.
  // https://www.w3.org/TR/html5/syntax.html#optional-tags
  if (parser_token.is_empty_element || !parser_token.is_start_tag || !parser_token.parent) {
    return;

  }

  if (parser_token.tag_name === 'body') {
    // A head element’s end tag may be omitted if the head element is not immediately followed by a space character or a comment.
    result = result || this._tag_stack.try_pop('head');

    //} else if (parser_token.tag_name === 'body') {
    // DONE: A body element’s end tag may be omitted if the body element is not immediately followed by a comment.

  } else if (parser_token.tag_name === 'li') {
    // An li element’s end tag may be omitted if the li element is immediately followed by another li element or if there is no more content in the parent element.
    result = result || this._tag_stack.try_pop('li', ['ol', 'ul']);

  } else if (parser_token.tag_name === 'dd' || parser_token.tag_name === 'dt') {
    // A dd element’s end tag may be omitted if the dd element is immediately followed by another dd element or a dt element, or if there is no more content in the parent element.
    // A dt element’s end tag may be omitted if the dt element is immediately followed by another dt element or a dd element.
    result = result || this._tag_stack.try_pop('dt', ['dl']);
    result = result || this._tag_stack.try_pop('dd', ['dl']);


  } else if (parser_token.parent.tag_name === 'p' && p_closers.indexOf(parser_token.tag_name) !== -1) {
    // IMPORTANT: this else-if works because p_closers has no overlap with any other element we look for in this method
    // check for the parent element is an HTML element that is not an <a>, <audio>, <del>, <ins>, <map>, <noscript>, or <video> element,  or an autonomous custom element.
    // To do this right, this needs to be coded as an inclusion of the inverse of the exclusion above.
    // But to start with (if we ignore "autonomous custom elements") the exclusion would be fine.
    var p_parent = parser_token.parent.parent;
    if (!p_parent || p_parent_excludes.indexOf(p_parent.tag_name) === -1) {
      result = result || this._tag_stack.try_pop('p');
    }
  } else if (parser_token.tag_name === 'rp' || parser_token.tag_name === 'rt') {
    // An rt element’s end tag may be omitted if the rt element is immediately followed by an rt or rp element, or if there is no more content in the parent element.
    // An rp element’s end tag may be omitted if the rp element is immediately followed by an rt or rp element, or if there is no more content in the parent element.
    result = result || this._tag_stack.try_pop('rt', ['ruby', 'rtc']);
    result = result || this._tag_stack.try_pop('rp', ['ruby', 'rtc']);

  } else if (parser_token.tag_name === 'optgroup') {
    // An optgroup element’s end tag may be omitted if the optgroup element is immediately followed by another optgroup element, or if there is no more content in the parent element.
    // An option element’s end tag may be omitted if the option element is immediately followed by another option element, or if it is immediately followed by an optgroup element, or if there is no more content in the parent element.
    result = result || this._tag_stack.try_pop('optgroup', ['select']);
    //result = result || this._tag_stack.try_pop('option', ['select']);

  } else if (parser_token.tag_name === 'option') {
    // An option element’s end tag may be omitted if the option element is immediately followed by another option element, or if it is immediately followed by an optgroup element, or if there is no more content in the parent element.
    result = result || this._tag_stack.try_pop('option', ['select', 'datalist', 'optgroup']);

  } else if (parser_token.tag_name === 'colgroup') {
    // DONE: A colgroup element’s end tag may be omitted if the colgroup element is not immediately followed by a space character or a comment.
    // A caption element's end tag may be ommitted if a colgroup, thead, tfoot, tbody, or tr element is started.
    result = result || this._tag_stack.try_pop('caption', ['table']);

  } else if (parser_token.tag_name === 'thead') {
    // A colgroup element's end tag may be ommitted if a thead, tfoot, tbody, or tr element is started.
    // A caption element's end tag may be ommitted if a colgroup, thead, tfoot, tbody, or tr element is started.
    result = result || this._tag_stack.try_pop('caption', ['table']);
    result = result || this._tag_stack.try_pop('colgroup', ['table']);

    //} else if (parser_token.tag_name === 'caption') {
    // DONE: A caption element’s end tag may be omitted if the caption element is not immediately followed by a space character or a comment.

  } else if (parser_token.tag_name === 'tbody' || parser_token.tag_name === 'tfoot') {
    // A thead element’s end tag may be omitted if the thead element is immediately followed by a tbody or tfoot element.
    // A tbody element’s end tag may be omitted if the tbody element is immediately followed by a tbody or tfoot element, or if there is no more content in the parent element.
    // A colgroup element's end tag may be ommitted if a thead, tfoot, tbody, or tr element is started.
    // A caption element's end tag may be ommitted if a colgroup, thead, tfoot, tbody, or tr element is started.
    result = result || this._tag_stack.try_pop('caption', ['table']);
    result = result || this._tag_stack.try_pop('colgroup', ['table']);
    result = result || this._tag_stack.try_pop('thead', ['table']);
    result = result || this._tag_stack.try_pop('tbody', ['table']);

    //} else if (parser_token.tag_name === 'tfoot') {
    // DONE: A tfoot element’s end tag may be omitted if there is no more content in the parent element.

  } else if (parser_token.tag_name === 'tr') {
    // A tr element’s end tag may be omitted if the tr element is immediately followed by another tr element, or if there is no more content in the parent element.
    // A colgroup element's end tag may be ommitted if a thead, tfoot, tbody, or tr element is started.
    // A caption element's end tag may be ommitted if a colgroup, thead, tfoot, tbody, or tr element is started.
    result = result || this._tag_stack.try_pop('caption', ['table']);
    result = result || this._tag_stack.try_pop('colgroup', ['table']);
    result = result || this._tag_stack.try_pop('tr', ['table', 'thead', 'tbody', 'tfoot']);

  } else if (parser_token.tag_name === 'th' || parser_token.tag_name === 'td') {
    // A td element’s end tag may be omitted if the td element is immediately followed by a td or th element, or if there is no more content in the parent element.
    // A th element’s end tag may be omitted if the th element is immediately followed by a td or th element, or if there is no more content in the parent element.
    result = result || this._tag_stack.try_pop('td', ['table', 'thead', 'tbody', 'tfoot', 'tr']);
    result = result || this._tag_stack.try_pop('th', ['table', 'thead', 'tbody', 'tfoot', 'tr']);
  }

  // Start element omission not handled currently
  // A head element’s start tag may be omitted if the element is empty, or if the first thing inside the head element is an element.
  // A tbody element’s start tag may be omitted if the first thing inside the tbody element is a tr element, and if the element is not immediately preceded by a tbody, thead, or tfoot element whose end tag has been omitted. (It can’t be omitted if the element is empty.)
  // A colgroup element’s start tag may be omitted if the first thing inside the colgroup element is a col element, and if the element is not immediately preceded by another colgroup element whose end tag has been omitted. (It can’t be omitted if the element is empty.)

  // Fix up the parent of the parser token
  parser_token.parent = this._tag_stack.get_parser_token();

  return result;
};

module.exports.Beautifier = Beautifier;


/***/ }),
/* 20 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_90821__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var BaseOptions = (__nested_webpack_require_90821__(6).Options);

function Options(options) {
  BaseOptions.call(this, options, 'html');
  if (this.templating.length === 1 && this.templating[0] === 'auto') {
    this.templating = ['django', 'erb', 'handlebars', 'php'];
  }

  this.indent_inner_html = this._get_boolean('indent_inner_html');
  this.indent_body_inner_html = this._get_boolean('indent_body_inner_html', true);
  this.indent_head_inner_html = this._get_boolean('indent_head_inner_html', true);

  this.indent_handlebars = this._get_boolean('indent_handlebars', true);
  this.wrap_attributes = this._get_selection('wrap_attributes',
    ['auto', 'force', 'force-aligned', 'force-expand-multiline', 'aligned-multiple', 'preserve', 'preserve-aligned']);
  this.wrap_attributes_indent_size = this._get_number('wrap_attributes_indent_size', this.indent_size);
  this.extra_liners = this._get_array('extra_liners', ['head', 'body', '/html']);

  // Block vs inline elements
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
  // https://www.w3.org/TR/html5/dom.html#phrasing-content
  this.inline = this._get_array('inline', [
    'a', 'abbr', 'area', 'audio', 'b', 'bdi', 'bdo', 'br', 'button', 'canvas', 'cite',
    'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'i', 'iframe', 'img',
    'input', 'ins', 'kbd', 'keygen', 'label', 'map', 'mark', 'math', 'meter', 'noscript',
    'object', 'output', 'progress', 'q', 'ruby', 's', 'samp', /* 'script', */ 'select', 'small',
    'span', 'strong', 'sub', 'sup', 'svg', 'template', 'textarea', 'time', 'u', 'var',
    'video', 'wbr', 'text',
    // obsolete inline tags
    'acronym', 'big', 'strike', 'tt'
  ]);
  this.void_elements = this._get_array('void_elements', [
    // HTLM void elements - aka self-closing tags - aka singletons
    // https://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements
    'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen',
    'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr',
    // NOTE: Optional tags are too complex for a simple list
    // they are hard coded in _do_optional_end_element

    // Doctype and xml elements
    '!doctype', '?xml',

    // obsolete tags
    // basefont: https://www.computerhope.com/jargon/h/html-basefont-tag.htm
    // isndex: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/isindex
    'basefont', 'isindex'
  ]);
  this.unformatted = this._get_array('unformatted', []);
  this.content_unformatted = this._get_array('content_unformatted', [
    'pre', 'textarea'
  ]);
  this.unformatted_content_delimiter = this._get_characters('unformatted_content_delimiter');
  this.indent_scripts = this._get_selection('indent_scripts', ['normal', 'keep', 'separate']);

}
Options.prototype = new BaseOptions();



module.exports.Options = Options;


/***/ }),
/* 21 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_95020__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var BaseTokenizer = (__nested_webpack_require_95020__(9).Tokenizer);
var BASETOKEN = (__nested_webpack_require_95020__(9).TOKEN);
var Directives = (__nested_webpack_require_95020__(13).Directives);
var TemplatablePattern = (__nested_webpack_require_95020__(14).TemplatablePattern);
var Pattern = (__nested_webpack_require_95020__(12).Pattern);

var TOKEN = {
  TAG_OPEN: 'TK_TAG_OPEN',
  TAG_CLOSE: 'TK_TAG_CLOSE',
  ATTRIBUTE: 'TK_ATTRIBUTE',
  EQUALS: 'TK_EQUALS',
  VALUE: 'TK_VALUE',
  COMMENT: 'TK_COMMENT',
  TEXT: 'TK_TEXT',
  UNKNOWN: 'TK_UNKNOWN',
  START: BASETOKEN.START,
  RAW: BASETOKEN.RAW,
  EOF: BASETOKEN.EOF
};

var directives_core = new Directives(/<\!--/, /-->/);

var Tokenizer = function(input_string, options) {
  BaseTokenizer.call(this, input_string, options);
  this._current_tag_name = '';

  // Words end at whitespace or when a tag starts
  // if we are indenting handlebars, they are considered tags
  var templatable_reader = new TemplatablePattern(this._input).read_options(this._options);
  var pattern_reader = new Pattern(this._input);

  this.__patterns = {
    word: templatable_reader.until(/[\n\r\t <]/),
    single_quote: templatable_reader.until_after(/'/),
    double_quote: templatable_reader.until_after(/"/),
    attribute: templatable_reader.until(/[\n\r\t =>]|\/>/),
    element_name: templatable_reader.until(/[\n\r\t >\/]/),

    handlebars_comment: pattern_reader.starting_with(/{{!--/).until_after(/--}}/),
    handlebars: pattern_reader.starting_with(/{{/).until_after(/}}/),
    handlebars_open: pattern_reader.until(/[\n\r\t }]/),
    handlebars_raw_close: pattern_reader.until(/}}/),
    comment: pattern_reader.starting_with(/<!--/).until_after(/-->/),
    cdata: pattern_reader.starting_with(/<!\[CDATA\[/).until_after(/]]>/),
    // https://en.wikipedia.org/wiki/Conditional_comment
    conditional_comment: pattern_reader.starting_with(/<!\[/).until_after(/]>/),
    processing: pattern_reader.starting_with(/<\?/).until_after(/\?>/)
  };

  if (this._options.indent_handlebars) {
    this.__patterns.word = this.__patterns.word.exclude('handlebars');
  }

  this._unformatted_content_delimiter = null;

  if (this._options.unformatted_content_delimiter) {
    var literal_regexp = this._input.get_literal_regexp(this._options.unformatted_content_delimiter);
    this.__patterns.unformatted_content_delimiter =
      pattern_reader.matching(literal_regexp)
      .until_after(literal_regexp);
  }
};
Tokenizer.prototype = new BaseTokenizer();

Tokenizer.prototype._is_comment = function(current_token) { // jshint unused:false
  return false; //current_token.type === TOKEN.COMMENT || current_token.type === TOKEN.UNKNOWN;
};

Tokenizer.prototype._is_opening = function(current_token) {
  return current_token.type === TOKEN.TAG_OPEN;
};

Tokenizer.prototype._is_closing = function(current_token, open_token) {
  return current_token.type === TOKEN.TAG_CLOSE &&
    (open_token && (
      ((current_token.text === '>' || current_token.text === '/>') && open_token.text[0] === '<') ||
      (current_token.text === '}}' && open_token.text[0] === '{' && open_token.text[1] === '{')));
};

Tokenizer.prototype._reset = function() {
  this._current_tag_name = '';
};

Tokenizer.prototype._get_next_token = function(previous_token, open_token) { // jshint unused:false
  var token = null;
  this._readWhitespace();
  var c = this._input.peek();

  if (c === null) {
    return this._create_token(TOKEN.EOF, '');
  }

  token = token || this._read_open_handlebars(c, open_token);
  token = token || this._read_attribute(c, previous_token, open_token);
  token = token || this._read_close(c, open_token);
  token = token || this._read_raw_content(c, previous_token, open_token);
  token = token || this._read_content_word(c);
  token = token || this._read_comment_or_cdata(c);
  token = token || this._read_processing(c);
  token = token || this._read_open(c, open_token);
  token = token || this._create_token(TOKEN.UNKNOWN, this._input.next());

  return token;
};

Tokenizer.prototype._read_comment_or_cdata = function(c) { // jshint unused:false
  var token = null;
  var resulting_string = null;
  var directives = null;

  if (c === '<') {
    var peek1 = this._input.peek(1);
    // We treat all comments as literals, even more than preformatted tags
    // we only look for the appropriate closing marker
    if (peek1 === '!') {
      resulting_string = this.__patterns.comment.read();

      // only process directive on html comments
      if (resulting_string) {
        directives = directives_core.get_directives(resulting_string);
        if (directives && directives.ignore === 'start') {
          resulting_string += directives_core.readIgnored(this._input);
        }
      } else {
        resulting_string = this.__patterns.cdata.read();
      }
    }

    if (resulting_string) {
      token = this._create_token(TOKEN.COMMENT, resulting_string);
      token.directives = directives;
    }
  }

  return token;
};

Tokenizer.prototype._read_processing = function(c) { // jshint unused:false
  var token = null;
  var resulting_string = null;
  var directives = null;

  if (c === '<') {
    var peek1 = this._input.peek(1);
    if (peek1 === '!' || peek1 === '?') {
      resulting_string = this.__patterns.conditional_comment.read();
      resulting_string = resulting_string || this.__patterns.processing.read();
    }

    if (resulting_string) {
      token = this._create_token(TOKEN.COMMENT, resulting_string);
      token.directives = directives;
    }
  }

  return token;
};

Tokenizer.prototype._read_open = function(c, open_token) {
  var resulting_string = null;
  var token = null;
  if (!open_token) {
    if (c === '<') {

      resulting_string = this._input.next();
      if (this._input.peek() === '/') {
        resulting_string += this._input.next();
      }
      resulting_string += this.__patterns.element_name.read();
      token = this._create_token(TOKEN.TAG_OPEN, resulting_string);
    }
  }
  return token;
};

Tokenizer.prototype._read_open_handlebars = function(c, open_token) {
  var resulting_string = null;
  var token = null;
  if (!open_token) {
    if (this._options.indent_handlebars && c === '{' && this._input.peek(1) === '{') {
      if (this._input.peek(2) === '!') {
        resulting_string = this.__patterns.handlebars_comment.read();
        resulting_string = resulting_string || this.__patterns.handlebars.read();
        token = this._create_token(TOKEN.COMMENT, resulting_string);
      } else {
        resulting_string = this.__patterns.handlebars_open.read();
        token = this._create_token(TOKEN.TAG_OPEN, resulting_string);
      }
    }
  }
  return token;
};


Tokenizer.prototype._read_close = function(c, open_token) {
  var resulting_string = null;
  var token = null;
  if (open_token) {
    if (open_token.text[0] === '<' && (c === '>' || (c === '/' && this._input.peek(1) === '>'))) {
      resulting_string = this._input.next();
      if (c === '/') { //  for close tag "/>"
        resulting_string += this._input.next();
      }
      token = this._create_token(TOKEN.TAG_CLOSE, resulting_string);
    } else if (open_token.text[0] === '{' && c === '}' && this._input.peek(1) === '}') {
      this._input.next();
      this._input.next();
      token = this._create_token(TOKEN.TAG_CLOSE, '}}');
    }
  }

  return token;
};

Tokenizer.prototype._read_attribute = function(c, previous_token, open_token) {
  var token = null;
  var resulting_string = '';
  if (open_token && open_token.text[0] === '<') {

    if (c === '=') {
      token = this._create_token(TOKEN.EQUALS, this._input.next());
    } else if (c === '"' || c === "'") {
      var content = this._input.next();
      if (c === '"') {
        content += this.__patterns.double_quote.read();
      } else {
        content += this.__patterns.single_quote.read();
      }
      token = this._create_token(TOKEN.VALUE, content);
    } else {
      resulting_string = this.__patterns.attribute.read();

      if (resulting_string) {
        if (previous_token.type === TOKEN.EQUALS) {
          token = this._create_token(TOKEN.VALUE, resulting_string);
        } else {
          token = this._create_token(TOKEN.ATTRIBUTE, resulting_string);
        }
      }
    }
  }
  return token;
};

Tokenizer.prototype._is_content_unformatted = function(tag_name) {
  // void_elements have no content and so cannot have unformatted content
  // script and style tags should always be read as unformatted content
  // finally content_unformatted and unformatted element contents are unformatted
  return this._options.void_elements.indexOf(tag_name) === -1 &&
    (this._options.content_unformatted.indexOf(tag_name) !== -1 ||
      this._options.unformatted.indexOf(tag_name) !== -1);
};


Tokenizer.prototype._read_raw_content = function(c, previous_token, open_token) { // jshint unused:false
  var resulting_string = '';
  if (open_token && open_token.text[0] === '{') {
    resulting_string = this.__patterns.handlebars_raw_close.read();
  } else if (previous_token.type === TOKEN.TAG_CLOSE &&
    previous_token.opened.text[0] === '<' && previous_token.text[0] !== '/') {
    // ^^ empty tag has no content 
    var tag_name = previous_token.opened.text.substr(1).toLowerCase();
    if (tag_name === 'script' || tag_name === 'style') {
      // Script and style tags are allowed to have comments wrapping their content
      // or just have regular content.
      var token = this._read_comment_or_cdata(c);
      if (token) {
        token.type = TOKEN.TEXT;
        return token;
      }
      resulting_string = this._input.readUntil(new RegExp('</' + tag_name + '[\\n\\r\\t ]*?>', 'ig'));
    } else if (this._is_content_unformatted(tag_name)) {

      resulting_string = this._input.readUntil(new RegExp('</' + tag_name + '[\\n\\r\\t ]*?>', 'ig'));
    }
  }

  if (resulting_string) {
    return this._create_token(TOKEN.TEXT, resulting_string);
  }

  return null;
};

Tokenizer.prototype._read_content_word = function(c) {
  var resulting_string = '';
  if (this._options.unformatted_content_delimiter) {
    if (c === this._options.unformatted_content_delimiter[0]) {
      resulting_string = this.__patterns.unformatted_content_delimiter.read();
    }
  }

  if (!resulting_string) {
    resulting_string = this.__patterns.word.read();
  }
  if (resulting_string) {
    return this._create_token(TOKEN.TEXT, resulting_string);
  }
};

module.exports.Tokenizer = Tokenizer;
module.exports.TOKEN = TOKEN;


/***/ })
/******/ 	]);
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __nested_webpack_require_106914__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_106914__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module is referenced by other modules so it can't be inlined
/******/ 	var __nested_webpack_exports__ = __nested_webpack_require_106914__(18);
/******/ 	legacy_beautify_html = __nested_webpack_exports__;
/******/ 	
/******/ })()
;
var style_html = legacy_beautify_html;
/* Footer */
if (true) {
    // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- )
    !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, __webpack_require__(20370), __webpack_require__(97332)], __WEBPACK_AMD_DEFINE_RESULT__ = (function(requireamd) {
        var js_beautify = __webpack_require__(20370);
        var css_beautify = __webpack_require__(97332);

        return {
            html_beautify: function(html_source, options) {
                return style_html(html_source, options, js_beautify.js_beautify, css_beautify.css_beautify);
            }
        };
    }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var css_beautify, js_beautify; }

}());


/***/ }),

/***/ 20370:
/***/ ((module, exports) => {

var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* AUTO-GENERATED. DO NOT MODIFY. */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.

 JS Beautifier
---------------


  Written by Einar Lielmanis, <einar@beautifier.io>
      https://beautifier.io/

  Originally converted to javascript by Vital, <vital76@gmail.com>
  "End braces on own line" added by Chris J. Shull, <chrisjshull@gmail.com>
  Parsing improvements for brace-less statements by Liam Newman <bitwiseman@beautifier.io>


  Usage:
    js_beautify(js_source_text);
    js_beautify(js_source_text, options);

  The options are:
    indent_size (default 4)          - indentation size,
    indent_char (default space)      - character to indent with,
    preserve_newlines (default true) - whether existing line breaks should be preserved,
    max_preserve_newlines (default unlimited) - maximum number of line breaks to be preserved in one chunk,

    jslint_happy (default false) - if true, then jslint-stricter mode is enforced.

            jslint_happy        !jslint_happy
            ---------------------------------
            function ()         function()

            switch () {         switch() {
            case 1:               case 1:
              break;                break;
            }                   }

    space_after_anon_function (default false) - should the space before an anonymous function's parens be added, "function()" vs "function ()",
          NOTE: This option is overriden by jslint_happy (i.e. if jslint_happy is true, space_after_anon_function is true by design)

    brace_style (default "collapse") - "collapse" | "expand" | "end-expand" | "none" | any of the former + ",preserve-inline"
            put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are.
            preserve-inline will try to preserve inline blocks of curly braces

    space_before_conditional (default true) - should the space before conditional statement be added, "if(true)" vs "if (true)",

    unescape_strings (default false) - should printable characters in strings encoded in \xNN notation be unescaped, "example" vs "\x65\x78\x61\x6d\x70\x6c\x65"

    wrap_line_length (default unlimited) - lines should wrap at next opportunity after this number of characters.
          NOTE: This is not a hard limit. Lines will continue until a point where a newline would
                be preserved if it were present.

    end_with_newline (default false)  - end output with a newline


    e.g

    js_beautify(js_source_text, {
      'indent_size': 1,
      'indent_char': '\t'
    });

*/

(function() {

/* GENERATED_BUILD_OUTPUT */
var legacy_beautify_js;
/******/ (function() { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ([
/* 0 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_3999__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var Beautifier = (__nested_webpack_require_3999__(1).Beautifier),
  Options = (__nested_webpack_require_3999__(5).Options);

function js_beautify(js_source_text, options) {
  var beautifier = new Beautifier(js_source_text, options);
  return beautifier.beautify();
}

module.exports = js_beautify;
module.exports.defaultOptions = function() {
  return new Options();
};


/***/ }),
/* 1 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_5628__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var Output = (__nested_webpack_require_5628__(2).Output);
var Token = (__nested_webpack_require_5628__(3).Token);
var acorn = __nested_webpack_require_5628__(4);
var Options = (__nested_webpack_require_5628__(5).Options);
var Tokenizer = (__nested_webpack_require_5628__(7).Tokenizer);
var line_starters = (__nested_webpack_require_5628__(7).line_starters);
var positionable_operators = (__nested_webpack_require_5628__(7).positionable_operators);
var TOKEN = (__nested_webpack_require_5628__(7).TOKEN);


function in_array(what, arr) {
  return arr.indexOf(what) !== -1;
}

function ltrim(s) {
  return s.replace(/^\s+/g, '');
}

function generateMapFromStrings(list) {
  var result = {};
  for (var x = 0; x < list.length; x++) {
    // make the mapped names underscored instead of dash
    result[list[x].replace(/-/g, '_')] = list[x];
  }
  return result;
}

function reserved_word(token, word) {
  return token && token.type === TOKEN.RESERVED && token.text === word;
}

function reserved_array(token, words) {
  return token && token.type === TOKEN.RESERVED && in_array(token.text, words);
}
// Unsure of what they mean, but they work. Worth cleaning up in future.
var special_words = ['case', 'return', 'do', 'if', 'throw', 'else', 'await', 'break', 'continue', 'async'];

var validPositionValues = ['before-newline', 'after-newline', 'preserve-newline'];

// Generate map from array
var OPERATOR_POSITION = generateMapFromStrings(validPositionValues);

var OPERATOR_POSITION_BEFORE_OR_PRESERVE = [OPERATOR_POSITION.before_newline, OPERATOR_POSITION.preserve_newline];

var MODE = {
  BlockStatement: 'BlockStatement', // 'BLOCK'
  Statement: 'Statement', // 'STATEMENT'
  ObjectLiteral: 'ObjectLiteral', // 'OBJECT',
  ArrayLiteral: 'ArrayLiteral', //'[EXPRESSION]',
  ForInitializer: 'ForInitializer', //'(FOR-EXPRESSION)',
  Conditional: 'Conditional', //'(COND-EXPRESSION)',
  Expression: 'Expression' //'(EXPRESSION)'
};

function remove_redundant_indentation(output, frame) {
  // This implementation is effective but has some issues:
  //     - can cause line wrap to happen too soon due to indent removal
  //           after wrap points are calculated
  // These issues are minor compared to ugly indentation.

  if (frame.multiline_frame ||
    frame.mode === MODE.ForInitializer ||
    frame.mode === MODE.Conditional) {
    return;
  }

  // remove one indent from each line inside this section
  output.remove_indent(frame.start_line_index);
}

// we could use just string.split, but
// IE doesn't like returning empty strings
function split_linebreaks(s) {
  //return s.split(/\x0d\x0a|\x0a/);

  s = s.replace(acorn.allLineBreaks, '\n');
  var out = [],
    idx = s.indexOf("\n");
  while (idx !== -1) {
    out.push(s.substring(0, idx));
    s = s.substring(idx + 1);
    idx = s.indexOf("\n");
  }
  if (s.length) {
    out.push(s);
  }
  return out;
}

function is_array(mode) {
  return mode === MODE.ArrayLiteral;
}

function is_expression(mode) {
  return in_array(mode, [MODE.Expression, MODE.ForInitializer, MODE.Conditional]);
}

function all_lines_start_with(lines, c) {
  for (var i = 0; i < lines.length; i++) {
    var line = lines[i].trim();
    if (line.charAt(0) !== c) {
      return false;
    }
  }
  return true;
}

function each_line_matches_indent(lines, indent) {
  var i = 0,
    len = lines.length,
    line;
  for (; i < len; i++) {
    line = lines[i];
    // allow empty lines to pass through
    if (line && line.indexOf(indent) !== 0) {
      return false;
    }
  }
  return true;
}


function Beautifier(source_text, options) {
  options = options || {};
  this._source_text = source_text || '';

  this._output = null;
  this._tokens = null;
  this._last_last_text = null;
  this._flags = null;
  this._previous_flags = null;

  this._flag_store = null;
  this._options = new Options(options);
}

Beautifier.prototype.create_flags = function(flags_base, mode) {
  var next_indent_level = 0;
  if (flags_base) {
    next_indent_level = flags_base.indentation_level;
    if (!this._output.just_added_newline() &&
      flags_base.line_indent_level > next_indent_level) {
      next_indent_level = flags_base.line_indent_level;
    }
  }

  var next_flags = {
    mode: mode,
    parent: flags_base,
    last_token: flags_base ? flags_base.last_token : new Token(TOKEN.START_BLOCK, ''), // last token text
    last_word: flags_base ? flags_base.last_word : '', // last TOKEN.WORD passed
    declaration_statement: false,
    declaration_assignment: false,
    multiline_frame: false,
    inline_frame: false,
    if_block: false,
    else_block: false,
    class_start_block: false, // class A { INSIDE HERE } or class B extends C { INSIDE HERE }
    do_block: false,
    do_while: false,
    import_block: false,
    in_case_statement: false, // switch(..){ INSIDE HERE }
    in_case: false, // we're on the exact line with "case 0:"
    case_body: false, // the indented case-action block
    case_block: false, // the indented case-action block is wrapped with {}
    indentation_level: next_indent_level,
    alignment: 0,
    line_indent_level: flags_base ? flags_base.line_indent_level : next_indent_level,
    start_line_index: this._output.get_line_number(),
    ternary_depth: 0
  };
  return next_flags;
};

Beautifier.prototype._reset = function(source_text) {
  var baseIndentString = source_text.match(/^[\t ]*/)[0];

  this._last_last_text = ''; // pre-last token text
  this._output = new Output(this._options, baseIndentString);

  // If testing the ignore directive, start with output disable set to true
  this._output.raw = this._options.test_output_raw;


  // Stack of parsing/formatting states, including MODE.
  // We tokenize, parse, and output in an almost purely a forward-only stream of token input
  // and formatted output.  This makes the beautifier less accurate than full parsers
  // but also far more tolerant of syntax errors.
  //
  // For example, the default mode is MODE.BlockStatement. If we see a '{' we push a new frame of type
  // MODE.BlockStatement on the the stack, even though it could be object literal.  If we later
  // encounter a ":", we'll switch to to MODE.ObjectLiteral.  If we then see a ";",
  // most full parsers would die, but the beautifier gracefully falls back to
  // MODE.BlockStatement and continues on.
  this._flag_store = [];
  this.set_mode(MODE.BlockStatement);
  var tokenizer = new Tokenizer(source_text, this._options);
  this._tokens = tokenizer.tokenize();
  return source_text;
};

Beautifier.prototype.beautify = function() {
  // if disabled, return the input unchanged.
  if (this._options.disabled) {
    return this._source_text;
  }

  var sweet_code;
  var source_text = this._reset(this._source_text);

  var eol = this._options.eol;
  if (this._options.eol === 'auto') {
    eol = '\n';
    if (source_text && acorn.lineBreak.test(source_text || '')) {
      eol = source_text.match(acorn.lineBreak)[0];
    }
  }

  var current_token = this._tokens.next();
  while (current_token) {
    this.handle_token(current_token);

    this._last_last_text = this._flags.last_token.text;
    this._flags.last_token = current_token;

    current_token = this._tokens.next();
  }

  sweet_code = this._output.get_code(eol);

  return sweet_code;
};

Beautifier.prototype.handle_token = function(current_token, preserve_statement_flags) {
  if (current_token.type === TOKEN.START_EXPR) {
    this.handle_start_expr(current_token);
  } else if (current_token.type === TOKEN.END_EXPR) {
    this.handle_end_expr(current_token);
  } else if (current_token.type === TOKEN.START_BLOCK) {
    this.handle_start_block(current_token);
  } else if (current_token.type === TOKEN.END_BLOCK) {
    this.handle_end_block(current_token);
  } else if (current_token.type === TOKEN.WORD) {
    this.handle_word(current_token);
  } else if (current_token.type === TOKEN.RESERVED) {
    this.handle_word(current_token);
  } else if (current_token.type === TOKEN.SEMICOLON) {
    this.handle_semicolon(current_token);
  } else if (current_token.type === TOKEN.STRING) {
    this.handle_string(current_token);
  } else if (current_token.type === TOKEN.EQUALS) {
    this.handle_equals(current_token);
  } else if (current_token.type === TOKEN.OPERATOR) {
    this.handle_operator(current_token);
  } else if (current_token.type === TOKEN.COMMA) {
    this.handle_comma(current_token);
  } else if (current_token.type === TOKEN.BLOCK_COMMENT) {
    this.handle_block_comment(current_token, preserve_statement_flags);
  } else if (current_token.type === TOKEN.COMMENT) {
    this.handle_comment(current_token, preserve_statement_flags);
  } else if (current_token.type === TOKEN.DOT) {
    this.handle_dot(current_token);
  } else if (current_token.type === TOKEN.EOF) {
    this.handle_eof(current_token);
  } else if (current_token.type === TOKEN.UNKNOWN) {
    this.handle_unknown(current_token, preserve_statement_flags);
  } else {
    this.handle_unknown(current_token, preserve_statement_flags);
  }
};

Beautifier.prototype.handle_whitespace_and_comments = function(current_token, preserve_statement_flags) {
  var newlines = current_token.newlines;
  var keep_whitespace = this._options.keep_array_indentation && is_array(this._flags.mode);

  if (current_token.comments_before) {
    var comment_token = current_token.comments_before.next();
    while (comment_token) {
      // The cleanest handling of inline comments is to treat them as though they aren't there.
      // Just continue formatting and the behavior should be logical.
      // Also ignore unknown tokens.  Again, this should result in better behavior.
      this.handle_whitespace_and_comments(comment_token, preserve_statement_flags);
      this.handle_token(comment_token, preserve_statement_flags);
      comment_token = current_token.comments_before.next();
    }
  }

  if (keep_whitespace) {
    for (var i = 0; i < newlines; i += 1) {
      this.print_newline(i > 0, preserve_statement_flags);
    }
  } else {
    if (this._options.max_preserve_newlines && newlines > this._options.max_preserve_newlines) {
      newlines = this._options.max_preserve_newlines;
    }

    if (this._options.preserve_newlines) {
      if (newlines > 1) {
        this.print_newline(false, preserve_statement_flags);
        for (var j = 1; j < newlines; j += 1) {
          this.print_newline(true, preserve_statement_flags);
        }
      }
    }
  }

};

var newline_restricted_tokens = ['async', 'break', 'continue', 'return', 'throw', 'yield'];

Beautifier.prototype.allow_wrap_or_preserved_newline = function(current_token, force_linewrap) {
  force_linewrap = (force_linewrap === undefined) ? false : force_linewrap;

  // Never wrap the first token on a line
  if (this._output.just_added_newline()) {
    return;
  }

  var shouldPreserveOrForce = (this._options.preserve_newlines && current_token.newlines) || force_linewrap;
  var operatorLogicApplies = in_array(this._flags.last_token.text, positionable_operators) ||
    in_array(current_token.text, positionable_operators);

  if (operatorLogicApplies) {
    var shouldPrintOperatorNewline = (
        in_array(this._flags.last_token.text, positionable_operators) &&
        in_array(this._options.operator_position, OPERATOR_POSITION_BEFORE_OR_PRESERVE)
      ) ||
      in_array(current_token.text, positionable_operators);
    shouldPreserveOrForce = shouldPreserveOrForce && shouldPrintOperatorNewline;
  }

  if (shouldPreserveOrForce) {
    this.print_newline(false, true);
  } else if (this._options.wrap_line_length) {
    if (reserved_array(this._flags.last_token, newline_restricted_tokens)) {
      // These tokens should never have a newline inserted
      // between them and the following expression.
      return;
    }
    this._output.set_wrap_point();
  }
};

Beautifier.prototype.print_newline = function(force_newline, preserve_statement_flags) {
  if (!preserve_statement_flags) {
    if (this._flags.last_token.text !== ';' && this._flags.last_token.text !== ',' && this._flags.last_token.text !== '=' && (this._flags.last_token.type !== TOKEN.OPERATOR || this._flags.last_token.text === '--' || this._flags.last_token.text === '++')) {
      var next_token = this._tokens.peek();
      while (this._flags.mode === MODE.Statement &&
        !(this._flags.if_block && reserved_word(next_token, 'else')) &&
        !this._flags.do_block) {
        this.restore_mode();
      }
    }
  }

  if (this._output.add_new_line(force_newline)) {
    this._flags.multiline_frame = true;
  }
};

Beautifier.prototype.print_token_line_indentation = function(current_token) {
  if (this._output.just_added_newline()) {
    if (this._options.keep_array_indentation &&
      current_token.newlines &&
      (current_token.text === '[' || is_array(this._flags.mode))) {
      this._output.current_line.set_indent(-1);
      this._output.current_line.push(current_token.whitespace_before);
      this._output.space_before_token = false;
    } else if (this._output.set_indent(this._flags.indentation_level, this._flags.alignment)) {
      this._flags.line_indent_level = this._flags.indentation_level;
    }
  }
};

Beautifier.prototype.print_token = function(current_token) {
  if (this._output.raw) {
    this._output.add_raw_token(current_token);
    return;
  }

  if (this._options.comma_first && current_token.previous && current_token.previous.type === TOKEN.COMMA &&
    this._output.just_added_newline()) {
    if (this._output.previous_line.last() === ',') {
      var popped = this._output.previous_line.pop();
      // if the comma was already at the start of the line,
      // pull back onto that line and reprint the indentation
      if (this._output.previous_line.is_empty()) {
        this._output.previous_line.push(popped);
        this._output.trim(true);
        this._output.current_line.pop();
        this._output.trim();
      }

      // add the comma in front of the next token
      this.print_token_line_indentation(current_token);
      this._output.add_token(',');
      this._output.space_before_token = true;
    }
  }

  this.print_token_line_indentation(current_token);
  this._output.non_breaking_space = true;
  this._output.add_token(current_token.text);
  if (this._output.previous_token_wrapped) {
    this._flags.multiline_frame = true;
  }
};

Beautifier.prototype.indent = function() {
  this._flags.indentation_level += 1;
  this._output.set_indent(this._flags.indentation_level, this._flags.alignment);
};

Beautifier.prototype.deindent = function() {
  if (this._flags.indentation_level > 0 &&
    ((!this._flags.parent) || this._flags.indentation_level > this._flags.parent.indentation_level)) {
    this._flags.indentation_level -= 1;
    this._output.set_indent(this._flags.indentation_level, this._flags.alignment);
  }
};

Beautifier.prototype.set_mode = function(mode) {
  if (this._flags) {
    this._flag_store.push(this._flags);
    this._previous_flags = this._flags;
  } else {
    this._previous_flags = this.create_flags(null, mode);
  }

  this._flags = this.create_flags(this._previous_flags, mode);
  this._output.set_indent(this._flags.indentation_level, this._flags.alignment);
};


Beautifier.prototype.restore_mode = function() {
  if (this._flag_store.length > 0) {
    this._previous_flags = this._flags;
    this._flags = this._flag_store.pop();
    if (this._previous_flags.mode === MODE.Statement) {
      remove_redundant_indentation(this._output, this._previous_flags);
    }
    this._output.set_indent(this._flags.indentation_level, this._flags.alignment);
  }
};

Beautifier.prototype.start_of_object_property = function() {
  return this._flags.parent.mode === MODE.ObjectLiteral && this._flags.mode === MODE.Statement && (
    (this._flags.last_token.text === ':' && this._flags.ternary_depth === 0) || (reserved_array(this._flags.last_token, ['get', 'set'])));
};

Beautifier.prototype.start_of_statement = function(current_token) {
  var start = false;
  start = start || reserved_array(this._flags.last_token, ['var', 'let', 'const']) && current_token.type === TOKEN.WORD;
  start = start || reserved_word(this._flags.last_token, 'do');
  start = start || (!(this._flags.parent.mode === MODE.ObjectLiteral && this._flags.mode === MODE.Statement)) && reserved_array(this._flags.last_token, newline_restricted_tokens) && !current_token.newlines;
  start = start || reserved_word(this._flags.last_token, 'else') &&
    !(reserved_word(current_token, 'if') && !current_token.comments_before);
  start = start || (this._flags.last_token.type === TOKEN.END_EXPR && (this._previous_flags.mode === MODE.ForInitializer || this._previous_flags.mode === MODE.Conditional));
  start = start || (this._flags.last_token.type === TOKEN.WORD && this._flags.mode === MODE.BlockStatement &&
    !this._flags.in_case &&
    !(current_token.text === '--' || current_token.text === '++') &&
    this._last_last_text !== 'function' &&
    current_token.type !== TOKEN.WORD && current_token.type !== TOKEN.RESERVED);
  start = start || (this._flags.mode === MODE.ObjectLiteral && (
    (this._flags.last_token.text === ':' && this._flags.ternary_depth === 0) || reserved_array(this._flags.last_token, ['get', 'set'])));

  if (start) {
    this.set_mode(MODE.Statement);
    this.indent();

    this.handle_whitespace_and_comments(current_token, true);

    // Issue #276:
    // If starting a new statement with [if, for, while, do], push to a new line.
    // if (a) if (b) if(c) d(); else e(); else f();
    if (!this.start_of_object_property()) {
      this.allow_wrap_or_preserved_newline(current_token,
        reserved_array(current_token, ['do', 'for', 'if', 'while']));
    }
    return true;
  }
  return false;
};

Beautifier.prototype.handle_start_expr = function(current_token) {
  // The conditional starts the statement if appropriate.
  if (!this.start_of_statement(current_token)) {
    this.handle_whitespace_and_comments(current_token);
  }

  var next_mode = MODE.Expression;
  if (current_token.text === '[') {

    if (this._flags.last_token.type === TOKEN.WORD || this._flags.last_token.text === ')') {
      // this is array index specifier, break immediately
      // a[x], fn()[x]
      if (reserved_array(this._flags.last_token, line_starters)) {
        this._output.space_before_token = true;
      }
      this.print_token(current_token);
      this.set_mode(next_mode);
      this.indent();
      if (this._options.space_in_paren) {
        this._output.space_before_token = true;
      }
      return;
    }

    next_mode = MODE.ArrayLiteral;
    if (is_array(this._flags.mode)) {
      if (this._flags.last_token.text === '[' ||
        (this._flags.last_token.text === ',' && (this._last_last_text === ']' || this._last_last_text === '}'))) {
        // ], [ goes to new line
        // }, [ goes to new line
        if (!this._options.keep_array_indentation) {
          this.print_newline();
        }
      }
    }

    if (!in_array(this._flags.last_token.type, [TOKEN.START_EXPR, TOKEN.END_EXPR, TOKEN.WORD, TOKEN.OPERATOR, TOKEN.DOT])) {
      this._output.space_before_token = true;
    }
  } else {
    if (this._flags.last_token.type === TOKEN.RESERVED) {
      if (this._flags.last_token.text === 'for') {
        this._output.space_before_token = this._options.space_before_conditional;
        next_mode = MODE.ForInitializer;
      } else if (in_array(this._flags.last_token.text, ['if', 'while', 'switch'])) {
        this._output.space_before_token = this._options.space_before_conditional;
        next_mode = MODE.Conditional;
      } else if (in_array(this._flags.last_word, ['await', 'async'])) {
        // Should be a space between await and an IIFE, or async and an arrow function
        this._output.space_before_token = true;
      } else if (this._flags.last_token.text === 'import' && current_token.whitespace_before === '') {
        this._output.space_before_token = false;
      } else if (in_array(this._flags.last_token.text, line_starters) || this._flags.last_token.text === 'catch') {
        this._output.space_before_token = true;
      }
    } else if (this._flags.last_token.type === TOKEN.EQUALS || this._flags.last_token.type === TOKEN.OPERATOR) {
      // Support of this kind of newline preservation.
      // a = (b &&
      //     (c || d));
      if (!this.start_of_object_property()) {
        this.allow_wrap_or_preserved_newline(current_token);
      }
    } else if (this._flags.last_token.type === TOKEN.WORD) {
      this._output.space_before_token = false;

      // function name() vs function name ()
      // function* name() vs function* name ()
      // async name() vs async name ()
      // In ES6, you can also define the method properties of an object
      // var obj = {a: function() {}}
      // It can be abbreviated
      // var obj = {a() {}}
      // var obj = { a() {}} vs var obj = { a () {}}
      // var obj = { * a() {}} vs var obj = { * a () {}}
      var peek_back_two = this._tokens.peek(-3);
      if (this._options.space_after_named_function && peek_back_two) {
        // peek starts at next character so -1 is current token
        var peek_back_three = this._tokens.peek(-4);
        if (reserved_array(peek_back_two, ['async', 'function']) ||
          (peek_back_two.text === '*' && reserved_array(peek_back_three, ['async', 'function']))) {
          this._output.space_before_token = true;
        } else if (this._flags.mode === MODE.ObjectLiteral) {
          if ((peek_back_two.text === '{' || peek_back_two.text === ',') ||
            (peek_back_two.text === '*' && (peek_back_three.text === '{' || peek_back_three.text === ','))) {
            this._output.space_before_token = true;
          }
        } else if (this._flags.parent && this._flags.parent.class_start_block) {
          this._output.space_before_token = true;
        }
      }
    } else {
      // Support preserving wrapped arrow function expressions
      // a.b('c',
      //     () => d.e
      // )
      this.allow_wrap_or_preserved_newline(current_token);
    }

    // function() vs function ()
    // yield*() vs yield* ()
    // function*() vs function* ()
    if ((this._flags.last_token.type === TOKEN.RESERVED && (this._flags.last_word === 'function' || this._flags.last_word === 'typeof')) ||
      (this._flags.last_token.text === '*' &&
        (in_array(this._last_last_text, ['function', 'yield']) ||
          (this._flags.mode === MODE.ObjectLiteral && in_array(this._last_last_text, ['{', ',']))))) {
      this._output.space_before_token = this._options.space_after_anon_function;
    }
  }

  if (this._flags.last_token.text === ';' || this._flags.last_token.type === TOKEN.START_BLOCK) {
    this.print_newline();
  } else if (this._flags.last_token.type === TOKEN.END_EXPR || this._flags.last_token.type === TOKEN.START_EXPR || this._flags.last_token.type === TOKEN.END_BLOCK || this._flags.last_token.text === '.' || this._flags.last_token.type === TOKEN.COMMA) {
    // do nothing on (( and )( and ][ and ]( and .(
    // TODO: Consider whether forcing this is required.  Review failing tests when removed.
    this.allow_wrap_or_preserved_newline(current_token, current_token.newlines);
  }

  this.print_token(current_token);
  this.set_mode(next_mode);
  if (this._options.space_in_paren) {
    this._output.space_before_token = true;
  }

  // In all cases, if we newline while inside an expression it should be indented.
  this.indent();
};

Beautifier.prototype.handle_end_expr = function(current_token) {
  // statements inside expressions are not valid syntax, but...
  // statements must all be closed when their container closes
  while (this._flags.mode === MODE.Statement) {
    this.restore_mode();
  }

  this.handle_whitespace_and_comments(current_token);

  if (this._flags.multiline_frame) {
    this.allow_wrap_or_preserved_newline(current_token,
      current_token.text === ']' && is_array(this._flags.mode) && !this._options.keep_array_indentation);
  }

  if (this._options.space_in_paren) {
    if (this._flags.last_token.type === TOKEN.START_EXPR && !this._options.space_in_empty_paren) {
      // () [] no inner space in empty parens like these, ever, ref #320
      this._output.trim();
      this._output.space_before_token = false;
    } else {
      this._output.space_before_token = true;
    }
  }
  this.deindent();
  this.print_token(current_token);
  this.restore_mode();

  remove_redundant_indentation(this._output, this._previous_flags);

  // do {} while () // no statement required after
  if (this._flags.do_while && this._previous_flags.mode === MODE.Conditional) {
    this._previous_flags.mode = MODE.Expression;
    this._flags.do_block = false;
    this._flags.do_while = false;

  }
};

Beautifier.prototype.handle_start_block = function(current_token) {
  this.handle_whitespace_and_comments(current_token);

  // Check if this is should be treated as a ObjectLiteral
  var next_token = this._tokens.peek();
  var second_token = this._tokens.peek(1);
  if (this._flags.last_word === 'switch' && this._flags.last_token.type === TOKEN.END_EXPR) {
    this.set_mode(MODE.BlockStatement);
    this._flags.in_case_statement = true;
  } else if (this._flags.case_body) {
    this.set_mode(MODE.BlockStatement);
  } else if (second_token && (
      (in_array(second_token.text, [':', ',']) && in_array(next_token.type, [TOKEN.STRING, TOKEN.WORD, TOKEN.RESERVED])) ||
      (in_array(next_token.text, ['get', 'set', '...']) && in_array(second_token.type, [TOKEN.WORD, TOKEN.RESERVED]))
    )) {
    // We don't support TypeScript,but we didn't break it for a very long time.
    // We'll try to keep not breaking it.
    if (in_array(this._last_last_text, ['class', 'interface']) && !in_array(second_token.text, [':', ','])) {
      this.set_mode(MODE.BlockStatement);
    } else {
      this.set_mode(MODE.ObjectLiteral);
    }
  } else if (this._flags.last_token.type === TOKEN.OPERATOR && this._flags.last_token.text === '=>') {
    // arrow function: (param1, paramN) => { statements }
    this.set_mode(MODE.BlockStatement);
  } else if (in_array(this._flags.last_token.type, [TOKEN.EQUALS, TOKEN.START_EXPR, TOKEN.COMMA, TOKEN.OPERATOR]) ||
    reserved_array(this._flags.last_token, ['return', 'throw', 'import', 'default'])
  ) {
    // Detecting shorthand function syntax is difficult by scanning forward,
    //     so check the surrounding context.
    // If the block is being returned, imported, export default, passed as arg,
    //     assigned with = or assigned in a nested object, treat as an ObjectLiteral.
    this.set_mode(MODE.ObjectLiteral);
  } else {
    this.set_mode(MODE.BlockStatement);
  }

  if (this._flags.last_token) {
    if (reserved_array(this._flags.last_token.previous, ['class', 'extends'])) {
      this._flags.class_start_block = true;
    }
  }

  var empty_braces = !next_token.comments_before && next_token.text === '}';
  var empty_anonymous_function = empty_braces && this._flags.last_word === 'function' &&
    this._flags.last_token.type === TOKEN.END_EXPR;

  if (this._options.brace_preserve_inline) // check for inline, set inline_frame if so
  {
    // search forward for a newline wanted inside this block
    var index = 0;
    var check_token = null;
    this._flags.inline_frame = true;
    do {
      index += 1;
      check_token = this._tokens.peek(index - 1);
      if (check_token.newlines) {
        this._flags.inline_frame = false;
        break;
      }
    } while (check_token.type !== TOKEN.EOF &&
      !(check_token.type === TOKEN.END_BLOCK && check_token.opened === current_token));
  }

  if ((this._options.brace_style === "expand" ||
      (this._options.brace_style === "none" && current_token.newlines)) &&
    !this._flags.inline_frame) {
    if (this._flags.last_token.type !== TOKEN.OPERATOR &&
      (empty_anonymous_function ||
        this._flags.last_token.type === TOKEN.EQUALS ||
        (reserved_array(this._flags.last_token, special_words) && this._flags.last_token.text !== 'else'))) {
      this._output.space_before_token = true;
    } else {
      this.print_newline(false, true);
    }
  } else { // collapse || inline_frame
    if (is_array(this._previous_flags.mode) && (this._flags.last_token.type === TOKEN.START_EXPR || this._flags.last_token.type === TOKEN.COMMA)) {
      if (this._flags.last_token.type === TOKEN.COMMA || this._options.space_in_paren) {
        this._output.space_before_token = true;
      }

      if (this._flags.last_token.type === TOKEN.COMMA || (this._flags.last_token.type === TOKEN.START_EXPR && this._flags.inline_frame)) {
        this.allow_wrap_or_preserved_newline(current_token);
        this._previous_flags.multiline_frame = this._previous_flags.multiline_frame || this._flags.multiline_frame;
        this._flags.multiline_frame = false;
      }
    }
    if (this._flags.last_token.type !== TOKEN.OPERATOR && this._flags.last_token.type !== TOKEN.START_EXPR) {
      if (this._flags.last_token.type === TOKEN.START_BLOCK && !this._flags.inline_frame) {
        this.print_newline();
      } else {
        this._output.space_before_token = true;
      }
    }
  }
  this.print_token(current_token);
  this.indent();

  // Except for specific cases, open braces are followed by a new line.
  if (!empty_braces && !(this._options.brace_preserve_inline && this._flags.inline_frame)) {
    this.print_newline();
  }
};

Beautifier.prototype.handle_end_block = function(current_token) {
  // statements must all be closed when their container closes
  this.handle_whitespace_and_comments(current_token);

  while (this._flags.mode === MODE.Statement) {
    this.restore_mode();
  }

  var empty_braces = this._flags.last_token.type === TOKEN.START_BLOCK;

  if (this._flags.inline_frame && !empty_braces) { // try inline_frame (only set if this._options.braces-preserve-inline) first
    this._output.space_before_token = true;
  } else if (this._options.brace_style === "expand") {
    if (!empty_braces) {
      this.print_newline();
    }
  } else {
    // skip {}
    if (!empty_braces) {
      if (is_array(this._flags.mode) && this._options.keep_array_indentation) {
        // we REALLY need a newline here, but newliner would skip that
        this._options.keep_array_indentation = false;
        this.print_newline();
        this._options.keep_array_indentation = true;

      } else {
        this.print_newline();
      }
    }
  }
  this.restore_mode();
  this.print_token(current_token);
};

Beautifier.prototype.handle_word = function(current_token) {
  if (current_token.type === TOKEN.RESERVED) {
    if (in_array(current_token.text, ['set', 'get']) && this._flags.mode !== MODE.ObjectLiteral) {
      current_token.type = TOKEN.WORD;
    } else if (current_token.text === 'import' && in_array(this._tokens.peek().text, ['(', '.'])) {
      current_token.type = TOKEN.WORD;
    } else if (in_array(current_token.text, ['as', 'from']) && !this._flags.import_block) {
      current_token.type = TOKEN.WORD;
    } else if (this._flags.mode === MODE.ObjectLiteral) {
      var next_token = this._tokens.peek();
      if (next_token.text === ':') {
        current_token.type = TOKEN.WORD;
      }
    }
  }

  if (this.start_of_statement(current_token)) {
    // The conditional starts the statement if appropriate.
    if (reserved_array(this._flags.last_token, ['var', 'let', 'const']) && current_token.type === TOKEN.WORD) {
      this._flags.declaration_statement = true;
    }
  } else if (current_token.newlines && !is_expression(this._flags.mode) &&
    (this._flags.last_token.type !== TOKEN.OPERATOR || (this._flags.last_token.text === '--' || this._flags.last_token.text === '++')) &&
    this._flags.last_token.type !== TOKEN.EQUALS &&
    (this._options.preserve_newlines || !reserved_array(this._flags.last_token, ['var', 'let', 'const', 'set', 'get']))) {
    this.handle_whitespace_and_comments(current_token);
    this.print_newline();
  } else {
    this.handle_whitespace_and_comments(current_token);
  }

  if (this._flags.do_block && !this._flags.do_while) {
    if (reserved_word(current_token, 'while')) {
      // do {} ## while ()
      this._output.space_before_token = true;
      this.print_token(current_token);
      this._output.space_before_token = true;
      this._flags.do_while = true;
      return;
    } else {
      // do {} should always have while as the next word.
      // if we don't see the expected while, recover
      this.print_newline();
      this._flags.do_block = false;
    }
  }

  // if may be followed by else, or not
  // Bare/inline ifs are tricky
  // Need to unwind the modes correctly: if (a) if (b) c(); else d(); else e();
  if (this._flags.if_block) {
    if (!this._flags.else_block && reserved_word(current_token, 'else')) {
      this._flags.else_block = true;
    } else {
      while (this._flags.mode === MODE.Statement) {
        this.restore_mode();
      }
      this._flags.if_block = false;
      this._flags.else_block = false;
    }
  }

  if (this._flags.in_case_statement && reserved_array(current_token, ['case', 'default'])) {
    this.print_newline();
    if (!this._flags.case_block && (this._flags.case_body || this._options.jslint_happy)) {
      // switch cases following one another
      this.deindent();
    }
    this._flags.case_body = false;

    this.print_token(current_token);
    this._flags.in_case = true;
    return;
  }

  if (this._flags.last_token.type === TOKEN.COMMA || this._flags.last_token.type === TOKEN.START_EXPR || this._flags.last_token.type === TOKEN.EQUALS || this._flags.last_token.type === TOKEN.OPERATOR) {
    if (!this.start_of_object_property()) {
      this.allow_wrap_or_preserved_newline(current_token);
    }
  }

  if (reserved_word(current_token, 'function')) {
    if (in_array(this._flags.last_token.text, ['}', ';']) ||
      (this._output.just_added_newline() && !(in_array(this._flags.last_token.text, ['(', '[', '{', ':', '=', ',']) || this._flags.last_token.type === TOKEN.OPERATOR))) {
      // make sure there is a nice clean space of at least one blank line
      // before a new function definition
      if (!this._output.just_added_blankline() && !current_token.comments_before) {
        this.print_newline();
        this.print_newline(true);
      }
    }
    if (this._flags.last_token.type === TOKEN.RESERVED || this._flags.last_token.type === TOKEN.WORD) {
      if (reserved_array(this._flags.last_token, ['get', 'set', 'new', 'export']) ||
        reserved_array(this._flags.last_token, newline_restricted_tokens)) {
        this._output.space_before_token = true;
      } else if (reserved_word(this._flags.last_token, 'default') && this._last_last_text === 'export') {
        this._output.space_before_token = true;
      } else if (this._flags.last_token.text === 'declare') {
        // accomodates Typescript declare function formatting
        this._output.space_before_token = true;
      } else {
        this.print_newline();
      }
    } else if (this._flags.last_token.type === TOKEN.OPERATOR || this._flags.last_token.text === '=') {
      // foo = function
      this._output.space_before_token = true;
    } else if (!this._flags.multiline_frame && (is_expression(this._flags.mode) || is_array(this._flags.mode))) {
      // (function
    } else {
      this.print_newline();
    }

    this.print_token(current_token);
    this._flags.last_word = current_token.text;
    return;
  }

  var prefix = 'NONE';

  if (this._flags.last_token.type === TOKEN.END_BLOCK) {

    if (this._previous_flags.inline_frame) {
      prefix = 'SPACE';
    } else if (!reserved_array(current_token, ['else', 'catch', 'finally', 'from'])) {
      prefix = 'NEWLINE';
    } else {
      if (this._options.brace_style === "expand" ||
        this._options.brace_style === "end-expand" ||
        (this._options.brace_style === "none" && current_token.newlines)) {
        prefix = 'NEWLINE';
      } else {
        prefix = 'SPACE';
        this._output.space_before_token = true;
      }
    }
  } else if (this._flags.last_token.type === TOKEN.SEMICOLON && this._flags.mode === MODE.BlockStatement) {
    // TODO: Should this be for STATEMENT as well?
    prefix = 'NEWLINE';
  } else if (this._flags.last_token.type === TOKEN.SEMICOLON && is_expression(this._flags.mode)) {
    prefix = 'SPACE';
  } else if (this._flags.last_token.type === TOKEN.STRING) {
    prefix = 'NEWLINE';
  } else if (this._flags.last_token.type === TOKEN.RESERVED || this._flags.last_token.type === TOKEN.WORD ||
    (this._flags.last_token.text === '*' &&
      (in_array(this._last_last_text, ['function', 'yield']) ||
        (this._flags.mode === MODE.ObjectLiteral && in_array(this._last_last_text, ['{', ',']))))) {
    prefix = 'SPACE';
  } else if (this._flags.last_token.type === TOKEN.START_BLOCK) {
    if (this._flags.inline_frame) {
      prefix = 'SPACE';
    } else {
      prefix = 'NEWLINE';
    }
  } else if (this._flags.last_token.type === TOKEN.END_EXPR) {
    this._output.space_before_token = true;
    prefix = 'NEWLINE';
  }

  if (reserved_array(current_token, line_starters) && this._flags.last_token.text !== ')') {
    if (this._flags.inline_frame || this._flags.last_token.text === 'else' || this._flags.last_token.text === 'export') {
      prefix = 'SPACE';
    } else {
      prefix = 'NEWLINE';
    }

  }

  if (reserved_array(current_token, ['else', 'catch', 'finally'])) {
    if ((!(this._flags.last_token.type === TOKEN.END_BLOCK && this._previous_flags.mode === MODE.BlockStatement) ||
        this._options.brace_style === "expand" ||
        this._options.brace_style === "end-expand" ||
        (this._options.brace_style === "none" && current_token.newlines)) &&
      !this._flags.inline_frame) {
      this.print_newline();
    } else {
      this._output.trim(true);
      var line = this._output.current_line;
      // If we trimmed and there's something other than a close block before us
      // put a newline back in.  Handles '} // comment' scenario.
      if (line.last() !== '}') {
        this.print_newline();
      }
      this._output.space_before_token = true;
    }
  } else if (prefix === 'NEWLINE') {
    if (reserved_array(this._flags.last_token, special_words)) {
      // no newline between 'return nnn'
      this._output.space_before_token = true;
    } else if (this._flags.last_token.text === 'declare' && reserved_array(current_token, ['var', 'let', 'const'])) {
      // accomodates Typescript declare formatting
      this._output.space_before_token = true;
    } else if (this._flags.last_token.type !== TOKEN.END_EXPR) {
      if ((this._flags.last_token.type !== TOKEN.START_EXPR || !reserved_array(current_token, ['var', 'let', 'const'])) && this._flags.last_token.text !== ':') {
        // no need to force newline on 'var': for (var x = 0...)
        if (reserved_word(current_token, 'if') && reserved_word(current_token.previous, 'else')) {
          // no newline for } else if {
          this._output.space_before_token = true;
        } else {
          this.print_newline();
        }
      }
    } else if (reserved_array(current_token, line_starters) && this._flags.last_token.text !== ')') {
      this.print_newline();
    }
  } else if (this._flags.multiline_frame && is_array(this._flags.mode) && this._flags.last_token.text === ',' && this._last_last_text === '}') {
    this.print_newline(); // }, in lists get a newline treatment
  } else if (prefix === 'SPACE') {
    this._output.space_before_token = true;
  }
  if (current_token.previous && (current_token.previous.type === TOKEN.WORD || current_token.previous.type === TOKEN.RESERVED)) {
    this._output.space_before_token = true;
  }
  this.print_token(current_token);
  this._flags.last_word = current_token.text;

  if (current_token.type === TOKEN.RESERVED) {
    if (current_token.text === 'do') {
      this._flags.do_block = true;
    } else if (current_token.text === 'if') {
      this._flags.if_block = true;
    } else if (current_token.text === 'import') {
      this._flags.import_block = true;
    } else if (this._flags.import_block && reserved_word(current_token, 'from')) {
      this._flags.import_block = false;
    }
  }
};

Beautifier.prototype.handle_semicolon = function(current_token) {
  if (this.start_of_statement(current_token)) {
    // The conditional starts the statement if appropriate.
    // Semicolon can be the start (and end) of a statement
    this._output.space_before_token = false;
  } else {
    this.handle_whitespace_and_comments(current_token);
  }

  var next_token = this._tokens.peek();
  while (this._flags.mode === MODE.Statement &&
    !(this._flags.if_block && reserved_word(next_token, 'else')) &&
    !this._flags.do_block) {
    this.restore_mode();
  }

  // hacky but effective for the moment
  if (this._flags.import_block) {
    this._flags.import_block = false;
  }
  this.print_token(current_token);
};

Beautifier.prototype.handle_string = function(current_token) {
  if (current_token.text.startsWith("`") && current_token.newlines === 0 && current_token.whitespace_before === '' && (current_token.previous.text === ')' || this._flags.last_token.type === TOKEN.WORD)) {
    //Conditional for detectign backtick strings
  } else if (this.start_of_statement(current_token)) {
    // The conditional starts the statement if appropriate.
    // One difference - strings want at least a space before
    this._output.space_before_token = true;
  } else {
    this.handle_whitespace_and_comments(current_token);
    if (this._flags.last_token.type === TOKEN.RESERVED || this._flags.last_token.type === TOKEN.WORD || this._flags.inline_frame) {
      this._output.space_before_token = true;
    } else if (this._flags.last_token.type === TOKEN.COMMA || this._flags.last_token.type === TOKEN.START_EXPR || this._flags.last_token.type === TOKEN.EQUALS || this._flags.last_token.type === TOKEN.OPERATOR) {
      if (!this.start_of_object_property()) {
        this.allow_wrap_or_preserved_newline(current_token);
      }
    } else if ((current_token.text.startsWith("`") && this._flags.last_token.type === TOKEN.END_EXPR && (current_token.previous.text === ']' || current_token.previous.text === ')') && current_token.newlines === 0)) {
      this._output.space_before_token = true;
    } else {
      this.print_newline();
    }
  }
  this.print_token(current_token);
};

Beautifier.prototype.handle_equals = function(current_token) {
  if (this.start_of_statement(current_token)) {
    // The conditional starts the statement if appropriate.
  } else {
    this.handle_whitespace_and_comments(current_token);
  }

  if (this._flags.declaration_statement) {
    // just got an '=' in a var-line, different formatting/line-breaking, etc will now be done
    this._flags.declaration_assignment = true;
  }
  this._output.space_before_token = true;
  this.print_token(current_token);
  this._output.space_before_token = true;
};

Beautifier.prototype.handle_comma = function(current_token) {
  this.handle_whitespace_and_comments(current_token, true);

  this.print_token(current_token);
  this._output.space_before_token = true;
  if (this._flags.declaration_statement) {
    if (is_expression(this._flags.parent.mode)) {
      // do not break on comma, for(var a = 1, b = 2)
      this._flags.declaration_assignment = false;
    }

    if (this._flags.declaration_assignment) {
      this._flags.declaration_assignment = false;
      this.print_newline(false, true);
    } else if (this._options.comma_first) {
      // for comma-first, we want to allow a newline before the comma
      // to turn into a newline after the comma, which we will fixup later
      this.allow_wrap_or_preserved_newline(current_token);
    }
  } else if (this._flags.mode === MODE.ObjectLiteral ||
    (this._flags.mode === MODE.Statement && this._flags.parent.mode === MODE.ObjectLiteral)) {
    if (this._flags.mode === MODE.Statement) {
      this.restore_mode();
    }

    if (!this._flags.inline_frame) {
      this.print_newline();
    }
  } else if (this._options.comma_first) {
    // EXPR or DO_BLOCK
    // for comma-first, we want to allow a newline before the comma
    // to turn into a newline after the comma, which we will fixup later
    this.allow_wrap_or_preserved_newline(current_token);
  }
};

Beautifier.prototype.handle_operator = function(current_token) {
  var isGeneratorAsterisk = current_token.text === '*' &&
    (reserved_array(this._flags.last_token, ['function', 'yield']) ||
      (in_array(this._flags.last_token.type, [TOKEN.START_BLOCK, TOKEN.COMMA, TOKEN.END_BLOCK, TOKEN.SEMICOLON]))
    );
  var isUnary = in_array(current_token.text, ['-', '+']) && (
    in_array(this._flags.last_token.type, [TOKEN.START_BLOCK, TOKEN.START_EXPR, TOKEN.EQUALS, TOKEN.OPERATOR]) ||
    in_array(this._flags.last_token.text, line_starters) ||
    this._flags.last_token.text === ','
  );

  if (this.start_of_statement(current_token)) {
    // The conditional starts the statement if appropriate.
  } else {
    var preserve_statement_flags = !isGeneratorAsterisk;
    this.handle_whitespace_and_comments(current_token, preserve_statement_flags);
  }

  // hack for actionscript's import .*;
  if (current_token.text === '*' && this._flags.last_token.type === TOKEN.DOT) {
    this.print_token(current_token);
    return;
  }

  if (current_token.text === '::') {
    // no spaces around exotic namespacing syntax operator
    this.print_token(current_token);
    return;
  }

  // Allow line wrapping between operators when operator_position is
  //   set to before or preserve
  if (this._flags.last_token.type === TOKEN.OPERATOR && in_array(this._options.operator_position, OPERATOR_POSITION_BEFORE_OR_PRESERVE)) {
    this.allow_wrap_or_preserved_newline(current_token);
  }

  if (current_token.text === ':' && this._flags.in_case) {
    this.print_token(current_token);

    this._flags.in_case = false;
    this._flags.case_body = true;
    if (this._tokens.peek().type !== TOKEN.START_BLOCK) {
      this.indent();
      this.print_newline();
      this._flags.case_block = false;
    } else {
      this._flags.case_block = true;
      this._output.space_before_token = true;
    }
    return;
  }

  var space_before = true;
  var space_after = true;
  var in_ternary = false;
  if (current_token.text === ':') {
    if (this._flags.ternary_depth === 0) {
      // Colon is invalid javascript outside of ternary and object, but do our best to guess what was meant.
      space_before = false;
    } else {
      this._flags.ternary_depth -= 1;
      in_ternary = true;
    }
  } else if (current_token.text === '?') {
    this._flags.ternary_depth += 1;
  }

  // let's handle the operator_position option prior to any conflicting logic
  if (!isUnary && !isGeneratorAsterisk && this._options.preserve_newlines && in_array(current_token.text, positionable_operators)) {
    var isColon = current_token.text === ':';
    var isTernaryColon = (isColon && in_ternary);
    var isOtherColon = (isColon && !in_ternary);

    switch (this._options.operator_position) {
      case OPERATOR_POSITION.before_newline:
        // if the current token is : and it's not a ternary statement then we set space_before to false
        this._output.space_before_token = !isOtherColon;

        this.print_token(current_token);

        if (!isColon || isTernaryColon) {
          this.allow_wrap_or_preserved_newline(current_token);
        }

        this._output.space_before_token = true;
        return;

      case OPERATOR_POSITION.after_newline:
        // if the current token is anything but colon, or (via deduction) it's a colon and in a ternary statement,
        //   then print a newline.

        this._output.space_before_token = true;

        if (!isColon || isTernaryColon) {
          if (this._tokens.peek().newlines) {
            this.print_newline(false, true);
          } else {
            this.allow_wrap_or_preserved_newline(current_token);
          }
        } else {
          this._output.space_before_token = false;
        }

        this.print_token(current_token);

        this._output.space_before_token = true;
        return;

      case OPERATOR_POSITION.preserve_newline:
        if (!isOtherColon) {
          this.allow_wrap_or_preserved_newline(current_token);
        }

        // if we just added a newline, or the current token is : and it's not a ternary statement,
        //   then we set space_before to false
        space_before = !(this._output.just_added_newline() || isOtherColon);

        this._output.space_before_token = space_before;
        this.print_token(current_token);
        this._output.space_before_token = true;
        return;
    }
  }

  if (isGeneratorAsterisk) {
    this.allow_wrap_or_preserved_newline(current_token);
    space_before = false;
    var next_token = this._tokens.peek();
    space_after = next_token && in_array(next_token.type, [TOKEN.WORD, TOKEN.RESERVED]);
  } else if (current_token.text === '...') {
    this.allow_wrap_or_preserved_newline(current_token);
    space_before = this._flags.last_token.type === TOKEN.START_BLOCK;
    space_after = false;
  } else if (in_array(current_token.text, ['--', '++', '!', '~']) || isUnary) {
    // unary operators (and binary +/- pretending to be unary) special cases
    if (this._flags.last_token.type === TOKEN.COMMA || this._flags.last_token.type === TOKEN.START_EXPR) {
      this.allow_wrap_or_preserved_newline(current_token);
    }

    space_before = false;
    space_after = false;

    // http://www.ecma-international.org/ecma-262/5.1/#sec-7.9.1
    // if there is a newline between -- or ++ and anything else we should preserve it.
    if (current_token.newlines && (current_token.text === '--' || current_token.text === '++' || current_token.text === '~')) {
      var new_line_needed = reserved_array(this._flags.last_token, special_words) && current_token.newlines;
      if (new_line_needed && (this._previous_flags.if_block || this._previous_flags.else_block)) {
        this.restore_mode();
      }
      this.print_newline(new_line_needed, true);
    }

    if (this._flags.last_token.text === ';' && is_expression(this._flags.mode)) {
      // for (;; ++i)
      //        ^^^
      space_before = true;
    }

    if (this._flags.last_token.type === TOKEN.RESERVED) {
      space_before = true;
    } else if (this._flags.last_token.type === TOKEN.END_EXPR) {
      space_before = !(this._flags.last_token.text === ']' && (current_token.text === '--' || current_token.text === '++'));
    } else if (this._flags.last_token.type === TOKEN.OPERATOR) {
      // a++ + ++b;
      // a - -b
      space_before = in_array(current_token.text, ['--', '-', '++', '+']) && in_array(this._flags.last_token.text, ['--', '-', '++', '+']);
      // + and - are not unary when preceeded by -- or ++ operator
      // a-- + b
      // a * +b
      // a - -b
      if (in_array(current_token.text, ['+', '-']) && in_array(this._flags.last_token.text, ['--', '++'])) {
        space_after = true;
      }
    }


    if (((this._flags.mode === MODE.BlockStatement && !this._flags.inline_frame) || this._flags.mode === MODE.Statement) &&
      (this._flags.last_token.text === '{' || this._flags.last_token.text === ';')) {
      // { foo; --i }
      // foo(); --bar;
      this.print_newline();
    }
  }

  this._output.space_before_token = this._output.space_before_token || space_before;
  this.print_token(current_token);
  this._output.space_before_token = space_after;
};

Beautifier.prototype.handle_block_comment = function(current_token, preserve_statement_flags) {
  if (this._output.raw) {
    this._output.add_raw_token(current_token);
    if (current_token.directives && current_token.directives.preserve === 'end') {
      // If we're testing the raw output behavior, do not allow a directive to turn it off.
      this._output.raw = this._options.test_output_raw;
    }
    return;
  }

  if (current_token.directives) {
    this.print_newline(false, preserve_statement_flags);
    this.print_token(current_token);
    if (current_token.directives.preserve === 'start') {
      this._output.raw = true;
    }
    this.print_newline(false, true);
    return;
  }

  // inline block
  if (!acorn.newline.test(current_token.text) && !current_token.newlines) {
    this._output.space_before_token = true;
    this.print_token(current_token);
    this._output.space_before_token = true;
    return;
  } else {
    this.print_block_commment(current_token, preserve_statement_flags);
  }
};

Beautifier.prototype.print_block_commment = function(current_token, preserve_statement_flags) {
  var lines = split_linebreaks(current_token.text);
  var j; // iterator for this case
  var javadoc = false;
  var starless = false;
  var lastIndent = current_token.whitespace_before;
  var lastIndentLength = lastIndent.length;

  // block comment starts with a new line
  this.print_newline(false, preserve_statement_flags);

  // first line always indented
  this.print_token_line_indentation(current_token);
  this._output.add_token(lines[0]);
  this.print_newline(false, preserve_statement_flags);


  if (lines.length > 1) {
    lines = lines.slice(1);
    javadoc = all_lines_start_with(lines, '*');
    starless = each_line_matches_indent(lines, lastIndent);

    if (javadoc) {
      this._flags.alignment = 1;
    }

    for (j = 0; j < lines.length; j++) {
      if (javadoc) {
        // javadoc: reformat and re-indent
        this.print_token_line_indentation(current_token);
        this._output.add_token(ltrim(lines[j]));
      } else if (starless && lines[j]) {
        // starless: re-indent non-empty content, avoiding trim
        this.print_token_line_indentation(current_token);
        this._output.add_token(lines[j].substring(lastIndentLength));
      } else {
        // normal comments output raw
        this._output.current_line.set_indent(-1);
        this._output.add_token(lines[j]);
      }

      // for comments on their own line or  more than one line, make sure there's a new line after
      this.print_newline(false, preserve_statement_flags);
    }

    this._flags.alignment = 0;
  }
};


Beautifier.prototype.handle_comment = function(current_token, preserve_statement_flags) {
  if (current_token.newlines) {
    this.print_newline(false, preserve_statement_flags);
  } else {
    this._output.trim(true);
  }

  this._output.space_before_token = true;
  this.print_token(current_token);
  this.print_newline(false, preserve_statement_flags);
};

Beautifier.prototype.handle_dot = function(current_token) {
  if (this.start_of_statement(current_token)) {
    // The conditional starts the statement if appropriate.
  } else {
    this.handle_whitespace_and_comments(current_token, true);
  }

  if (this._flags.last_token.text.match('^[0-9]+$')) {
    this._output.space_before_token = true;
  }

  if (reserved_array(this._flags.last_token, special_words)) {
    this._output.space_before_token = false;
  } else {
    // allow preserved newlines before dots in general
    // force newlines on dots after close paren when break_chained - for bar().baz()
    this.allow_wrap_or_preserved_newline(current_token,
      this._flags.last_token.text === ')' && this._options.break_chained_methods);
  }

  // Only unindent chained method dot if this dot starts a new line.
  // Otherwise the automatic extra indentation removal will handle the over indent
  if (this._options.unindent_chained_methods && this._output.just_added_newline()) {
    this.deindent();
  }

  this.print_token(current_token);
};

Beautifier.prototype.handle_unknown = function(current_token, preserve_statement_flags) {
  this.print_token(current_token);

  if (current_token.text[current_token.text.length - 1] === '\n') {
    this.print_newline(false, preserve_statement_flags);
  }
};

Beautifier.prototype.handle_eof = function(current_token) {
  // Unwind any open statements
  while (this._flags.mode === MODE.Statement) {
    this.restore_mode();
  }
  this.handle_whitespace_and_comments(current_token);
};

module.exports.Beautifier = Beautifier;


/***/ }),
/* 2 */
/***/ (function(module) {

/*jshint node:true */
/*
  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function OutputLine(parent) {
  this.__parent = parent;
  this.__character_count = 0;
  // use indent_count as a marker for this.__lines that have preserved indentation
  this.__indent_count = -1;
  this.__alignment_count = 0;
  this.__wrap_point_index = 0;
  this.__wrap_point_character_count = 0;
  this.__wrap_point_indent_count = -1;
  this.__wrap_point_alignment_count = 0;

  this.__items = [];
}

OutputLine.prototype.clone_empty = function() {
  var line = new OutputLine(this.__parent);
  line.set_indent(this.__indent_count, this.__alignment_count);
  return line;
};

OutputLine.prototype.item = function(index) {
  if (index < 0) {
    return this.__items[this.__items.length + index];
  } else {
    return this.__items[index];
  }
};

OutputLine.prototype.has_match = function(pattern) {
  for (var lastCheckedOutput = this.__items.length - 1; lastCheckedOutput >= 0; lastCheckedOutput--) {
    if (this.__items[lastCheckedOutput].match(pattern)) {
      return true;
    }
  }
  return false;
};

OutputLine.prototype.set_indent = function(indent, alignment) {
  if (this.is_empty()) {
    this.__indent_count = indent || 0;
    this.__alignment_count = alignment || 0;
    this.__character_count = this.__parent.get_indent_size(this.__indent_count, this.__alignment_count);
  }
};

OutputLine.prototype._set_wrap_point = function() {
  if (this.__parent.wrap_line_length) {
    this.__wrap_point_index = this.__items.length;
    this.__wrap_point_character_count = this.__character_count;
    this.__wrap_point_indent_count = this.__parent.next_line.__indent_count;
    this.__wrap_point_alignment_count = this.__parent.next_line.__alignment_count;
  }
};

OutputLine.prototype._should_wrap = function() {
  return this.__wrap_point_index &&
    this.__character_count > this.__parent.wrap_line_length &&
    this.__wrap_point_character_count > this.__parent.next_line.__character_count;
};

OutputLine.prototype._allow_wrap = function() {
  if (this._should_wrap()) {
    this.__parent.add_new_line();
    var next = this.__parent.current_line;
    next.set_indent(this.__wrap_point_indent_count, this.__wrap_point_alignment_count);
    next.__items = this.__items.slice(this.__wrap_point_index);
    this.__items = this.__items.slice(0, this.__wrap_point_index);

    next.__character_count += this.__character_count - this.__wrap_point_character_count;
    this.__character_count = this.__wrap_point_character_count;

    if (next.__items[0] === " ") {
      next.__items.splice(0, 1);
      next.__character_count -= 1;
    }
    return true;
  }
  return false;
};

OutputLine.prototype.is_empty = function() {
  return this.__items.length === 0;
};

OutputLine.prototype.last = function() {
  if (!this.is_empty()) {
    return this.__items[this.__items.length - 1];
  } else {
    return null;
  }
};

OutputLine.prototype.push = function(item) {
  this.__items.push(item);
  var last_newline_index = item.lastIndexOf('\n');
  if (last_newline_index !== -1) {
    this.__character_count = item.length - last_newline_index;
  } else {
    this.__character_count += item.length;
  }
};

OutputLine.prototype.pop = function() {
  var item = null;
  if (!this.is_empty()) {
    item = this.__items.pop();
    this.__character_count -= item.length;
  }
  return item;
};


OutputLine.prototype._remove_indent = function() {
  if (this.__indent_count > 0) {
    this.__indent_count -= 1;
    this.__character_count -= this.__parent.indent_size;
  }
};

OutputLine.prototype._remove_wrap_indent = function() {
  if (this.__wrap_point_indent_count > 0) {
    this.__wrap_point_indent_count -= 1;
  }
};
OutputLine.prototype.trim = function() {
  while (this.last() === ' ') {
    this.__items.pop();
    this.__character_count -= 1;
  }
};

OutputLine.prototype.toString = function() {
  var result = '';
  if (this.is_empty()) {
    if (this.__parent.indent_empty_lines) {
      result = this.__parent.get_indent_string(this.__indent_count);
    }
  } else {
    result = this.__parent.get_indent_string(this.__indent_count, this.__alignment_count);
    result += this.__items.join('');
  }
  return result;
};

function IndentStringCache(options, baseIndentString) {
  this.__cache = [''];
  this.__indent_size = options.indent_size;
  this.__indent_string = options.indent_char;
  if (!options.indent_with_tabs) {
    this.__indent_string = new Array(options.indent_size + 1).join(options.indent_char);
  }

  // Set to null to continue support for auto detection of base indent
  baseIndentString = baseIndentString || '';
  if (options.indent_level > 0) {
    baseIndentString = new Array(options.indent_level + 1).join(this.__indent_string);
  }

  this.__base_string = baseIndentString;
  this.__base_string_length = baseIndentString.length;
}

IndentStringCache.prototype.get_indent_size = function(indent, column) {
  var result = this.__base_string_length;
  column = column || 0;
  if (indent < 0) {
    result = 0;
  }
  result += indent * this.__indent_size;
  result += column;
  return result;
};

IndentStringCache.prototype.get_indent_string = function(indent_level, column) {
  var result = this.__base_string;
  column = column || 0;
  if (indent_level < 0) {
    indent_level = 0;
    result = '';
  }
  column += indent_level * this.__indent_size;
  this.__ensure_cache(column);
  result += this.__cache[column];
  return result;
};

IndentStringCache.prototype.__ensure_cache = function(column) {
  while (column >= this.__cache.length) {
    this.__add_column();
  }
};

IndentStringCache.prototype.__add_column = function() {
  var column = this.__cache.length;
  var indent = 0;
  var result = '';
  if (this.__indent_size && column >= this.__indent_size) {
    indent = Math.floor(column / this.__indent_size);
    column -= indent * this.__indent_size;
    result = new Array(indent + 1).join(this.__indent_string);
  }
  if (column) {
    result += new Array(column + 1).join(' ');
  }

  this.__cache.push(result);
};

function Output(options, baseIndentString) {
  this.__indent_cache = new IndentStringCache(options, baseIndentString);
  this.raw = false;
  this._end_with_newline = options.end_with_newline;
  this.indent_size = options.indent_size;
  this.wrap_line_length = options.wrap_line_length;
  this.indent_empty_lines = options.indent_empty_lines;
  this.__lines = [];
  this.previous_line = null;
  this.current_line = null;
  this.next_line = new OutputLine(this);
  this.space_before_token = false;
  this.non_breaking_space = false;
  this.previous_token_wrapped = false;
  // initialize
  this.__add_outputline();
}

Output.prototype.__add_outputline = function() {
  this.previous_line = this.current_line;
  this.current_line = this.next_line.clone_empty();
  this.__lines.push(this.current_line);
};

Output.prototype.get_line_number = function() {
  return this.__lines.length;
};

Output.prototype.get_indent_string = function(indent, column) {
  return this.__indent_cache.get_indent_string(indent, column);
};

Output.prototype.get_indent_size = function(indent, column) {
  return this.__indent_cache.get_indent_size(indent, column);
};

Output.prototype.is_empty = function() {
  return !this.previous_line && this.current_line.is_empty();
};

Output.prototype.add_new_line = function(force_newline) {
  // never newline at the start of file
  // otherwise, newline only if we didn't just add one or we're forced
  if (this.is_empty() ||
    (!force_newline && this.just_added_newline())) {
    return false;
  }

  // if raw output is enabled, don't print additional newlines,
  // but still return True as though you had
  if (!this.raw) {
    this.__add_outputline();
  }
  return true;
};

Output.prototype.get_code = function(eol) {
  this.trim(true);

  // handle some edge cases where the last tokens
  // has text that ends with newline(s)
  var last_item = this.current_line.pop();
  if (last_item) {
    if (last_item[last_item.length - 1] === '\n') {
      last_item = last_item.replace(/\n+$/g, '');
    }
    this.current_line.push(last_item);
  }

  if (this._end_with_newline) {
    this.__add_outputline();
  }

  var sweet_code = this.__lines.join('\n');

  if (eol !== '\n') {
    sweet_code = sweet_code.replace(/[\n]/g, eol);
  }
  return sweet_code;
};

Output.prototype.set_wrap_point = function() {
  this.current_line._set_wrap_point();
};

Output.prototype.set_indent = function(indent, alignment) {
  indent = indent || 0;
  alignment = alignment || 0;

  // Next line stores alignment values
  this.next_line.set_indent(indent, alignment);

  // Never indent your first output indent at the start of the file
  if (this.__lines.length > 1) {
    this.current_line.set_indent(indent, alignment);
    return true;
  }

  this.current_line.set_indent();
  return false;
};

Output.prototype.add_raw_token = function(token) {
  for (var x = 0; x < token.newlines; x++) {
    this.__add_outputline();
  }
  this.current_line.set_indent(-1);
  this.current_line.push(token.whitespace_before);
  this.current_line.push(token.text);
  this.space_before_token = false;
  this.non_breaking_space = false;
  this.previous_token_wrapped = false;
};

Output.prototype.add_token = function(printable_token) {
  this.__add_space_before_token();
  this.current_line.push(printable_token);
  this.space_before_token = false;
  this.non_breaking_space = false;
  this.previous_token_wrapped = this.current_line._allow_wrap();
};

Output.prototype.__add_space_before_token = function() {
  if (this.space_before_token && !this.just_added_newline()) {
    if (!this.non_breaking_space) {
      this.set_wrap_point();
    }
    this.current_line.push(' ');
  }
};

Output.prototype.remove_indent = function(index) {
  var output_length = this.__lines.length;
  while (index < output_length) {
    this.__lines[index]._remove_indent();
    index++;
  }
  this.current_line._remove_wrap_indent();
};

Output.prototype.trim = function(eat_newlines) {
  eat_newlines = (eat_newlines === undefined) ? false : eat_newlines;

  this.current_line.trim();

  while (eat_newlines && this.__lines.length > 1 &&
    this.current_line.is_empty()) {
    this.__lines.pop();
    this.current_line = this.__lines[this.__lines.length - 1];
    this.current_line.trim();
  }

  this.previous_line = this.__lines.length > 1 ?
    this.__lines[this.__lines.length - 2] : null;
};

Output.prototype.just_added_newline = function() {
  return this.current_line.is_empty();
};

Output.prototype.just_added_blankline = function() {
  return this.is_empty() ||
    (this.current_line.is_empty() && this.previous_line.is_empty());
};

Output.prototype.ensure_empty_line_above = function(starts_with, ends_with) {
  var index = this.__lines.length - 2;
  while (index >= 0) {
    var potentialEmptyLine = this.__lines[index];
    if (potentialEmptyLine.is_empty()) {
      break;
    } else if (potentialEmptyLine.item(0).indexOf(starts_with) !== 0 &&
      potentialEmptyLine.item(-1) !== ends_with) {
      this.__lines.splice(index + 1, 0, new OutputLine(this));
      this.previous_line = this.__lines[this.__lines.length - 2];
      break;
    }
    index--;
  }
};

module.exports.Output = Output;


/***/ }),
/* 3 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function Token(type, text, newlines, whitespace_before) {
  this.type = type;
  this.text = text;

  // comments_before are
  // comments that have a new line before them
  // and may or may not have a newline after
  // this is a set of comments before
  this.comments_before = null; /* inline comment*/


  // this.comments_after =  new TokenStream(); // no new line before and newline after
  this.newlines = newlines || 0;
  this.whitespace_before = whitespace_before || '';
  this.parent = null;
  this.next = null;
  this.previous = null;
  this.opened = null;
  this.closed = null;
  this.directives = null;
}


module.exports.Token = Token;


/***/ }),
/* 4 */
/***/ (function(__unused_webpack_module, exports) {

/* jshint node: true, curly: false */
// Parts of this section of code is taken from acorn.
//
// Acorn was written by Marijn Haverbeke and released under an MIT
// license. The Unicode regexps (for identifiers and whitespace) were
// taken from [Esprima](http://esprima.org) by Ariya Hidayat.
//
// Git repositories for Acorn are available at
//
//     http://marijnhaverbeke.nl/git/acorn
//     https://github.com/marijnh/acorn.git

// ## Character categories




// acorn used char codes to squeeze the last bit of performance out
// Beautifier is okay without that, so we're using regex
// permit # (23), $ (36), and @ (64). @ is used in ES7 decorators.
// 65 through 91 are uppercase letters.
// permit _ (95).
// 97 through 123 are lowercase letters.
var baseASCIIidentifierStartChars = "\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a";

// inside an identifier @ is not allowed but 0-9 are.
var baseASCIIidentifierChars = "\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a";

// Big ugly regular expressions that match characters in the
// whitespace, identifier, and identifier-start categories. These
// are only applied when a character is found to actually have a
// code point above 128.
var nonASCIIidentifierStartChars = "\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc";
var nonASCIIidentifierChars = "\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f";
//var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
//var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");

var identifierStart = "(?:\\\\u[0-9a-fA-F]{4}|[" + baseASCIIidentifierStartChars + nonASCIIidentifierStartChars + "])";
var identifierChars = "(?:\\\\u[0-9a-fA-F]{4}|[" + baseASCIIidentifierChars + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "])*";

exports.identifier = new RegExp(identifierStart + identifierChars, 'g');
exports.identifierStart = new RegExp(identifierStart);
exports.identifierMatch = new RegExp("(?:\\\\u[0-9a-fA-F]{4}|[" + baseASCIIidentifierChars + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "])+");

var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/; // jshint ignore:line

// Whether a single character denotes a newline.

exports.newline = /[\n\r\u2028\u2029]/;

// Matches a whole line break (where CRLF is considered a single
// line break). Used to count lines.

// in javascript, these two differ
// in python they are the same, different methods are called on them
exports.lineBreak = new RegExp('\r\n|' + exports.newline.source);
exports.allLineBreaks = new RegExp(exports.lineBreak.source, 'g');


/***/ }),
/* 5 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_87234__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var BaseOptions = (__nested_webpack_require_87234__(6).Options);

var validPositionValues = ['before-newline', 'after-newline', 'preserve-newline'];

function Options(options) {
  BaseOptions.call(this, options, 'js');

  // compatibility, re
  var raw_brace_style = this.raw_options.brace_style || null;
  if (raw_brace_style === "expand-strict") { //graceful handling of deprecated option
    this.raw_options.brace_style = "expand";
  } else if (raw_brace_style === "collapse-preserve-inline") { //graceful handling of deprecated option
    this.raw_options.brace_style = "collapse,preserve-inline";
  } else if (this.raw_options.braces_on_own_line !== undefined) { //graceful handling of deprecated option
    this.raw_options.brace_style = this.raw_options.braces_on_own_line ? "expand" : "collapse";
    // } else if (!raw_brace_style) { //Nothing exists to set it
    //   raw_brace_style = "collapse";
  }

  //preserve-inline in delimited string will trigger brace_preserve_inline, everything
  //else is considered a brace_style and the last one only will have an effect

  var brace_style_split = this._get_selection_list('brace_style', ['collapse', 'expand', 'end-expand', 'none', 'preserve-inline']);

  this.brace_preserve_inline = false; //Defaults in case one or other was not specified in meta-option
  this.brace_style = "collapse";

  for (var bs = 0; bs < brace_style_split.length; bs++) {
    if (brace_style_split[bs] === "preserve-inline") {
      this.brace_preserve_inline = true;
    } else {
      this.brace_style = brace_style_split[bs];
    }
  }

  this.unindent_chained_methods = this._get_boolean('unindent_chained_methods');
  this.break_chained_methods = this._get_boolean('break_chained_methods');
  this.space_in_paren = this._get_boolean('space_in_paren');
  this.space_in_empty_paren = this._get_boolean('space_in_empty_paren');
  this.jslint_happy = this._get_boolean('jslint_happy');
  this.space_after_anon_function = this._get_boolean('space_after_anon_function');
  this.space_after_named_function = this._get_boolean('space_after_named_function');
  this.keep_array_indentation = this._get_boolean('keep_array_indentation');
  this.space_before_conditional = this._get_boolean('space_before_conditional', true);
  this.unescape_strings = this._get_boolean('unescape_strings');
  this.e4x = this._get_boolean('e4x');
  this.comma_first = this._get_boolean('comma_first');
  this.operator_position = this._get_selection('operator_position', validPositionValues);

  // For testing of beautify preserve:start directive
  this.test_output_raw = this._get_boolean('test_output_raw');

  // force this._options.space_after_anon_function to true if this._options.jslint_happy
  if (this.jslint_happy) {
    this.space_after_anon_function = true;
  }

}
Options.prototype = new BaseOptions();



module.exports.Options = Options;


/***/ }),
/* 6 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function Options(options, merge_child_field) {
  this.raw_options = _mergeOpts(options, merge_child_field);

  // Support passing the source text back with no change
  this.disabled = this._get_boolean('disabled');

  this.eol = this._get_characters('eol', 'auto');
  this.end_with_newline = this._get_boolean('end_with_newline');
  this.indent_size = this._get_number('indent_size', 4);
  this.indent_char = this._get_characters('indent_char', ' ');
  this.indent_level = this._get_number('indent_level');

  this.preserve_newlines = this._get_boolean('preserve_newlines', true);
  this.max_preserve_newlines = this._get_number('max_preserve_newlines', 32786);
  if (!this.preserve_newlines) {
    this.max_preserve_newlines = 0;
  }

  this.indent_with_tabs = this._get_boolean('indent_with_tabs', this.indent_char === '\t');
  if (this.indent_with_tabs) {
    this.indent_char = '\t';

    // indent_size behavior changed after 1.8.6
    // It used to be that indent_size would be
    // set to 1 for indent_with_tabs. That is no longer needed and
    // actually doesn't make sense - why not use spaces? Further,
    // that might produce unexpected behavior - tabs being used
    // for single-column alignment. So, when indent_with_tabs is true
    // and indent_size is 1, reset indent_size to 4.
    if (this.indent_size === 1) {
      this.indent_size = 4;
    }
  }

  // Backwards compat with 1.3.x
  this.wrap_line_length = this._get_number('wrap_line_length', this._get_number('max_char'));

  this.indent_empty_lines = this._get_boolean('indent_empty_lines');

  // valid templating languages ['django', 'erb', 'handlebars', 'php', 'smarty']
  // For now, 'auto' = all off for javascript, all on for html (and inline javascript).
  // other values ignored
  this.templating = this._get_selection_list('templating', ['auto', 'none', 'django', 'erb', 'handlebars', 'php', 'smarty'], ['auto']);
}

Options.prototype._get_array = function(name, default_value) {
  var option_value = this.raw_options[name];
  var result = default_value || [];
  if (typeof option_value === 'object') {
    if (option_value !== null && typeof option_value.concat === 'function') {
      result = option_value.concat();
    }
  } else if (typeof option_value === 'string') {
    result = option_value.split(/[^a-zA-Z0-9_\/\-]+/);
  }
  return result;
};

Options.prototype._get_boolean = function(name, default_value) {
  var option_value = this.raw_options[name];
  var result = option_value === undefined ? !!default_value : !!option_value;
  return result;
};

Options.prototype._get_characters = function(name, default_value) {
  var option_value = this.raw_options[name];
  var result = default_value || '';
  if (typeof option_value === 'string') {
    result = option_value.replace(/\\r/, '\r').replace(/\\n/, '\n').replace(/\\t/, '\t');
  }
  return result;
};

Options.prototype._get_number = function(name, default_value) {
  var option_value = this.raw_options[name];
  default_value = parseInt(default_value, 10);
  if (isNaN(default_value)) {
    default_value = 0;
  }
  var result = parseInt(option_value, 10);
  if (isNaN(result)) {
    result = default_value;
  }
  return result;
};

Options.prototype._get_selection = function(name, selection_list, default_value) {
  var result = this._get_selection_list(name, selection_list, default_value);
  if (result.length !== 1) {
    throw new Error(
      "Invalid Option Value: The option '" + name + "' can only be one of the following values:\n" +
      selection_list + "\nYou passed in: '" + this.raw_options[name] + "'");
  }

  return result[0];
};


Options.prototype._get_selection_list = function(name, selection_list, default_value) {
  if (!selection_list || selection_list.length === 0) {
    throw new Error("Selection list cannot be empty.");
  }

  default_value = default_value || [selection_list[0]];
  if (!this._is_valid_selection(default_value, selection_list)) {
    throw new Error("Invalid Default Value!");
  }

  var result = this._get_array(name, default_value);
  if (!this._is_valid_selection(result, selection_list)) {
    throw new Error(
      "Invalid Option Value: The option '" + name + "' can contain only the following values:\n" +
      selection_list + "\nYou passed in: '" + this.raw_options[name] + "'");
  }

  return result;
};

Options.prototype._is_valid_selection = function(result, selection_list) {
  return result.length && selection_list.length &&
    !result.some(function(item) { return selection_list.indexOf(item) === -1; });
};


// merges child options up with the parent options object
// Example: obj = {a: 1, b: {a: 2}}
//          mergeOpts(obj, 'b')
//
//          Returns: {a: 2}
function _mergeOpts(allOptions, childFieldName) {
  var finalOpts = {};
  allOptions = _normalizeOpts(allOptions);
  var name;

  for (name in allOptions) {
    if (name !== childFieldName) {
      finalOpts[name] = allOptions[name];
    }
  }

  //merge in the per type settings for the childFieldName
  if (childFieldName && allOptions[childFieldName]) {
    for (name in allOptions[childFieldName]) {
      finalOpts[name] = allOptions[childFieldName][name];
    }
  }
  return finalOpts;
}

function _normalizeOpts(options) {
  var convertedOpts = {};
  var key;

  for (key in options) {
    var newKey = key.replace(/-/g, "_");
    convertedOpts[newKey] = options[key];
  }
  return convertedOpts;
}

module.exports.Options = Options;
module.exports.normalizeOpts = _normalizeOpts;
module.exports.mergeOpts = _mergeOpts;


/***/ }),
/* 7 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_98130__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var InputScanner = (__nested_webpack_require_98130__(8).InputScanner);
var BaseTokenizer = (__nested_webpack_require_98130__(9).Tokenizer);
var BASETOKEN = (__nested_webpack_require_98130__(9).TOKEN);
var Directives = (__nested_webpack_require_98130__(13).Directives);
var acorn = __nested_webpack_require_98130__(4);
var Pattern = (__nested_webpack_require_98130__(12).Pattern);
var TemplatablePattern = (__nested_webpack_require_98130__(14).TemplatablePattern);


function in_array(what, arr) {
  return arr.indexOf(what) !== -1;
}


var TOKEN = {
  START_EXPR: 'TK_START_EXPR',
  END_EXPR: 'TK_END_EXPR',
  START_BLOCK: 'TK_START_BLOCK',
  END_BLOCK: 'TK_END_BLOCK',
  WORD: 'TK_WORD',
  RESERVED: 'TK_RESERVED',
  SEMICOLON: 'TK_SEMICOLON',
  STRING: 'TK_STRING',
  EQUALS: 'TK_EQUALS',
  OPERATOR: 'TK_OPERATOR',
  COMMA: 'TK_COMMA',
  BLOCK_COMMENT: 'TK_BLOCK_COMMENT',
  COMMENT: 'TK_COMMENT',
  DOT: 'TK_DOT',
  UNKNOWN: 'TK_UNKNOWN',
  START: BASETOKEN.START,
  RAW: BASETOKEN.RAW,
  EOF: BASETOKEN.EOF
};


var directives_core = new Directives(/\/\*/, /\*\//);

var number_pattern = /0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/;

var digit = /[0-9]/;

// Dot "." must be distinguished from "..." and decimal
var dot_pattern = /[^\d\.]/;

var positionable_operators = (
  ">>> === !== &&= ??= ||= " +
  "<< && >= ** != == <= >> || ?? |> " +
  "< / - + > : & % ? ^ | *").split(' ');

// IMPORTANT: this must be sorted longest to shortest or tokenizing many not work.
// Also, you must update possitionable operators separately from punct
var punct =
  ">>>= " +
  "... >>= <<= === >>> !== **= &&= ??= ||= " +
  "=> ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> " +
  "= ! ? > < : / ^ - + * & % ~ |";

punct = punct.replace(/[-[\]{}()*+?.,\\^$|#]/g, "\\$&");
// ?. but not if followed by a number 
punct = '\\?\\.(?!\\d) ' + punct;
punct = punct.replace(/ /g, '|');

var punct_pattern = new RegExp(punct);

// words which should always start on new line.
var line_starters = 'continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export'.split(',');
var reserved_words = line_starters.concat(['do', 'in', 'of', 'else', 'get', 'set', 'new', 'catch', 'finally', 'typeof', 'yield', 'async', 'await', 'from', 'as', 'class', 'extends']);
var reserved_word_pattern = new RegExp('^(?:' + reserved_words.join('|') + ')$');

// var template_pattern = /(?:(?:<\?php|<\?=)[\s\S]*?\?>)|(?:<%[\s\S]*?%>)/g;

var in_html_comment;

var Tokenizer = function(input_string, options) {
  BaseTokenizer.call(this, input_string, options);

  this._patterns.whitespace = this._patterns.whitespace.matching(
    /\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,
    /\u2028\u2029/.source);

  var pattern_reader = new Pattern(this._input);
  var templatable = new TemplatablePattern(this._input)
    .read_options(this._options);

  this.__patterns = {
    template: templatable,
    identifier: templatable.starting_with(acorn.identifier).matching(acorn.identifierMatch),
    number: pattern_reader.matching(number_pattern),
    punct: pattern_reader.matching(punct_pattern),
    // comment ends just before nearest linefeed or end of file
    comment: pattern_reader.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),
    //  /* ... */ comment ends with nearest */ or end of file
    block_comment: pattern_reader.starting_with(/\/\*/).until_after(/\*\//),
    html_comment_start: pattern_reader.matching(/<!--/),
    html_comment_end: pattern_reader.matching(/-->/),
    include: pattern_reader.starting_with(/#include/).until_after(acorn.lineBreak),
    shebang: pattern_reader.starting_with(/#!/).until_after(acorn.lineBreak),
    xml: pattern_reader.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),
    single_quote: templatable.until(/['\\\n\r\u2028\u2029]/),
    double_quote: templatable.until(/["\\\n\r\u2028\u2029]/),
    template_text: templatable.until(/[`\\$]/),
    template_expression: templatable.until(/[`}\\]/)
  };

};
Tokenizer.prototype = new BaseTokenizer();

Tokenizer.prototype._is_comment = function(current_token) {
  return current_token.type === TOKEN.COMMENT || current_token.type === TOKEN.BLOCK_COMMENT || current_token.type === TOKEN.UNKNOWN;
};

Tokenizer.prototype._is_opening = function(current_token) {
  return current_token.type === TOKEN.START_BLOCK || current_token.type === TOKEN.START_EXPR;
};

Tokenizer.prototype._is_closing = function(current_token, open_token) {
  return (current_token.type === TOKEN.END_BLOCK || current_token.type === TOKEN.END_EXPR) &&
    (open_token && (
      (current_token.text === ']' && open_token.text === '[') ||
      (current_token.text === ')' && open_token.text === '(') ||
      (current_token.text === '}' && open_token.text === '{')));
};

Tokenizer.prototype._reset = function() {
  in_html_comment = false;
};

Tokenizer.prototype._get_next_token = function(previous_token, open_token) { // jshint unused:false
  var token = null;
  this._readWhitespace();
  var c = this._input.peek();

  if (c === null) {
    return this._create_token(TOKEN.EOF, '');
  }

  token = token || this._read_non_javascript(c);
  token = token || this._read_string(c);
  token = token || this._read_word(previous_token);
  token = token || this._read_singles(c);
  token = token || this._read_comment(c);
  token = token || this._read_regexp(c, previous_token);
  token = token || this._read_xml(c, previous_token);
  token = token || this._read_punctuation();
  token = token || this._create_token(TOKEN.UNKNOWN, this._input.next());

  return token;
};

Tokenizer.prototype._read_word = function(previous_token) {
  var resulting_string;
  resulting_string = this.__patterns.identifier.read();
  if (resulting_string !== '') {
    resulting_string = resulting_string.replace(acorn.allLineBreaks, '\n');
    if (!(previous_token.type === TOKEN.DOT ||
        (previous_token.type === TOKEN.RESERVED && (previous_token.text === 'set' || previous_token.text === 'get'))) &&
      reserved_word_pattern.test(resulting_string)) {
      if ((resulting_string === 'in' || resulting_string === 'of') &&
        (previous_token.type === TOKEN.WORD || previous_token.type === TOKEN.STRING)) { // hack for 'in' and 'of' operators
        return this._create_token(TOKEN.OPERATOR, resulting_string);
      }
      return this._create_token(TOKEN.RESERVED, resulting_string);
    }
    return this._create_token(TOKEN.WORD, resulting_string);
  }

  resulting_string = this.__patterns.number.read();
  if (resulting_string !== '') {
    return this._create_token(TOKEN.WORD, resulting_string);
  }
};

Tokenizer.prototype._read_singles = function(c) {
  var token = null;
  if (c === '(' || c === '[') {
    token = this._create_token(TOKEN.START_EXPR, c);
  } else if (c === ')' || c === ']') {
    token = this._create_token(TOKEN.END_EXPR, c);
  } else if (c === '{') {
    token = this._create_token(TOKEN.START_BLOCK, c);
  } else if (c === '}') {
    token = this._create_token(TOKEN.END_BLOCK, c);
  } else if (c === ';') {
    token = this._create_token(TOKEN.SEMICOLON, c);
  } else if (c === '.' && dot_pattern.test(this._input.peek(1))) {
    token = this._create_token(TOKEN.DOT, c);
  } else if (c === ',') {
    token = this._create_token(TOKEN.COMMA, c);
  }

  if (token) {
    this._input.next();
  }
  return token;
};

Tokenizer.prototype._read_punctuation = function() {
  var resulting_string = this.__patterns.punct.read();

  if (resulting_string !== '') {
    if (resulting_string === '=') {
      return this._create_token(TOKEN.EQUALS, resulting_string);
    } else if (resulting_string === '?.') {
      return this._create_token(TOKEN.DOT, resulting_string);
    } else {
      return this._create_token(TOKEN.OPERATOR, resulting_string);
    }
  }
};

Tokenizer.prototype._read_non_javascript = function(c) {
  var resulting_string = '';

  if (c === '#') {
    if (this._is_first_token()) {
      resulting_string = this.__patterns.shebang.read();

      if (resulting_string) {
        return this._create_token(TOKEN.UNKNOWN, resulting_string.trim() + '\n');
      }
    }

    // handles extendscript #includes
    resulting_string = this.__patterns.include.read();

    if (resulting_string) {
      return this._create_token(TOKEN.UNKNOWN, resulting_string.trim() + '\n');
    }

    c = this._input.next();

    // Spidermonkey-specific sharp variables for circular references. Considered obsolete.
    var sharp = '#';
    if (this._input.hasNext() && this._input.testChar(digit)) {
      do {
        c = this._input.next();
        sharp += c;
      } while (this._input.hasNext() && c !== '#' && c !== '=');
      if (c === '#') {
        //
      } else if (this._input.peek() === '[' && this._input.peek(1) === ']') {
        sharp += '[]';
        this._input.next();
        this._input.next();
      } else if (this._input.peek() === '{' && this._input.peek(1) === '}') {
        sharp += '{}';
        this._input.next();
        this._input.next();
      }
      return this._create_token(TOKEN.WORD, sharp);
    }

    this._input.back();

  } else if (c === '<' && this._is_first_token()) {
    resulting_string = this.__patterns.html_comment_start.read();
    if (resulting_string) {
      while (this._input.hasNext() && !this._input.testChar(acorn.newline)) {
        resulting_string += this._input.next();
      }
      in_html_comment = true;
      return this._create_token(TOKEN.COMMENT, resulting_string);
    }
  } else if (in_html_comment && c === '-') {
    resulting_string = this.__patterns.html_comment_end.read();
    if (resulting_string) {
      in_html_comment = false;
      return this._create_token(TOKEN.COMMENT, resulting_string);
    }
  }

  return null;
};

Tokenizer.prototype._read_comment = function(c) {
  var token = null;
  if (c === '/') {
    var comment = '';
    if (this._input.peek(1) === '*') {
      // peek for comment /* ... */
      comment = this.__patterns.block_comment.read();
      var directives = directives_core.get_directives(comment);
      if (directives && directives.ignore === 'start') {
        comment += directives_core.readIgnored(this._input);
      }
      comment = comment.replace(acorn.allLineBreaks, '\n');
      token = this._create_token(TOKEN.BLOCK_COMMENT, comment);
      token.directives = directives;
    } else if (this._input.peek(1) === '/') {
      // peek for comment // ...
      comment = this.__patterns.comment.read();
      token = this._create_token(TOKEN.COMMENT, comment);
    }
  }
  return token;
};

Tokenizer.prototype._read_string = function(c) {
  if (c === '`' || c === "'" || c === '"') {
    var resulting_string = this._input.next();
    this.has_char_escapes = false;

    if (c === '`') {
      resulting_string += this._read_string_recursive('`', true, '${');
    } else {
      resulting_string += this._read_string_recursive(c);
    }

    if (this.has_char_escapes && this._options.unescape_strings) {
      resulting_string = unescape_string(resulting_string);
    }

    if (this._input.peek() === c) {
      resulting_string += this._input.next();
    }

    resulting_string = resulting_string.replace(acorn.allLineBreaks, '\n');

    return this._create_token(TOKEN.STRING, resulting_string);
  }

  return null;
};

Tokenizer.prototype._allow_regexp_or_xml = function(previous_token) {
  // regex and xml can only appear in specific locations during parsing
  return (previous_token.type === TOKEN.RESERVED && in_array(previous_token.text, ['return', 'case', 'throw', 'else', 'do', 'typeof', 'yield'])) ||
    (previous_token.type === TOKEN.END_EXPR && previous_token.text === ')' &&
      previous_token.opened.previous.type === TOKEN.RESERVED && in_array(previous_token.opened.previous.text, ['if', 'while', 'for'])) ||
    (in_array(previous_token.type, [TOKEN.COMMENT, TOKEN.START_EXPR, TOKEN.START_BLOCK, TOKEN.START,
      TOKEN.END_BLOCK, TOKEN.OPERATOR, TOKEN.EQUALS, TOKEN.EOF, TOKEN.SEMICOLON, TOKEN.COMMA
    ]));
};

Tokenizer.prototype._read_regexp = function(c, previous_token) {

  if (c === '/' && this._allow_regexp_or_xml(previous_token)) {
    // handle regexp
    //
    var resulting_string = this._input.next();
    var esc = false;

    var in_char_class = false;
    while (this._input.hasNext() &&
      ((esc || in_char_class || this._input.peek() !== c) &&
        !this._input.testChar(acorn.newline))) {
      resulting_string += this._input.peek();
      if (!esc) {
        esc = this._input.peek() === '\\';
        if (this._input.peek() === '[') {
          in_char_class = true;
        } else if (this._input.peek() === ']') {
          in_char_class = false;
        }
      } else {
        esc = false;
      }
      this._input.next();
    }

    if (this._input.peek() === c) {
      resulting_string += this._input.next();

      // regexps may have modifiers /regexp/MOD , so fetch those, too
      // Only [gim] are valid, but if the user puts in garbage, do what we can to take it.
      resulting_string += this._input.read(acorn.identifier);
    }
    return this._create_token(TOKEN.STRING, resulting_string);
  }
  return null;
};

Tokenizer.prototype._read_xml = function(c, previous_token) {

  if (this._options.e4x && c === "<" && this._allow_regexp_or_xml(previous_token)) {
    var xmlStr = '';
    var match = this.__patterns.xml.read_match();
    // handle e4x xml literals
    //
    if (match) {
      // Trim root tag to attempt to
      var rootTag = match[2].replace(/^{\s+/, '{').replace(/\s+}$/, '}');
      var isCurlyRoot = rootTag.indexOf('{') === 0;
      var depth = 0;
      while (match) {
        var isEndTag = !!match[1];
        var tagName = match[2];
        var isSingletonTag = (!!match[match.length - 1]) || (tagName.slice(0, 8) === "![CDATA[");
        if (!isSingletonTag &&
          (tagName === rootTag || (isCurlyRoot && tagName.replace(/^{\s+/, '{').replace(/\s+}$/, '}')))) {
          if (isEndTag) {
            --depth;
          } else {
            ++depth;
          }
        }
        xmlStr += match[0];
        if (depth <= 0) {
          break;
        }
        match = this.__patterns.xml.read_match();
      }
      // if we didn't close correctly, keep unformatted.
      if (!match) {
        xmlStr += this._input.match(/[\s\S]*/g)[0];
      }
      xmlStr = xmlStr.replace(acorn.allLineBreaks, '\n');
      return this._create_token(TOKEN.STRING, xmlStr);
    }
  }

  return null;
};

function unescape_string(s) {
  // You think that a regex would work for this
  // return s.replace(/\\x([0-9a-f]{2})/gi, function(match, val) {
  //         return String.fromCharCode(parseInt(val, 16));
  //     })
  // However, dealing with '\xff', '\\xff', '\\\xff' makes this more fun.
  var out = '',
    escaped = 0;

  var input_scan = new InputScanner(s);
  var matched = null;

  while (input_scan.hasNext()) {
    // Keep any whitespace, non-slash characters
    // also keep slash pairs.
    matched = input_scan.match(/([\s]|[^\\]|\\\\)+/g);

    if (matched) {
      out += matched[0];
    }

    if (input_scan.peek() === '\\') {
      input_scan.next();
      if (input_scan.peek() === 'x') {
        matched = input_scan.match(/x([0-9A-Fa-f]{2})/g);
      } else if (input_scan.peek() === 'u') {
        matched = input_scan.match(/u([0-9A-Fa-f]{4})/g);
      } else {
        out += '\\';
        if (input_scan.hasNext()) {
          out += input_scan.next();
        }
        continue;
      }

      // If there's some error decoding, return the original string
      if (!matched) {
        return s;
      }

      escaped = parseInt(matched[1], 16);

      if (escaped > 0x7e && escaped <= 0xff && matched[0].indexOf('x') === 0) {
        // we bail out on \x7f..\xff,
        // leaving whole string escaped,
        // as it's probably completely binary
        return s;
      } else if (escaped >= 0x00 && escaped < 0x20) {
        // leave 0x00...0x1f escaped
        out += '\\' + matched[0];
        continue;
      } else if (escaped === 0x22 || escaped === 0x27 || escaped === 0x5c) {
        // single-quote, apostrophe, backslash - escape these
        out += '\\' + String.fromCharCode(escaped);
      } else {
        out += String.fromCharCode(escaped);
      }
    }
  }

  return out;
}

// handle string
//
Tokenizer.prototype._read_string_recursive = function(delimiter, allow_unescaped_newlines, start_sub) {
  var current_char;
  var pattern;
  if (delimiter === '\'') {
    pattern = this.__patterns.single_quote;
  } else if (delimiter === '"') {
    pattern = this.__patterns.double_quote;
  } else if (delimiter === '`') {
    pattern = this.__patterns.template_text;
  } else if (delimiter === '}') {
    pattern = this.__patterns.template_expression;
  }

  var resulting_string = pattern.read();
  var next = '';
  while (this._input.hasNext()) {
    next = this._input.next();
    if (next === delimiter ||
      (!allow_unescaped_newlines && acorn.newline.test(next))) {
      this._input.back();
      break;
    } else if (next === '\\' && this._input.hasNext()) {
      current_char = this._input.peek();

      if (current_char === 'x' || current_char === 'u') {
        this.has_char_escapes = true;
      } else if (current_char === '\r' && this._input.peek(1) === '\n') {
        this._input.next();
      }
      next += this._input.next();
    } else if (start_sub) {
      if (start_sub === '${' && next === '$' && this._input.peek() === '{') {
        next += this._input.next();
      }

      if (start_sub === next) {
        if (delimiter === '`') {
          next += this._read_string_recursive('}', allow_unescaped_newlines, '`');
        } else {
          next += this._read_string_recursive('`', allow_unescaped_newlines, '${');
        }
        if (this._input.hasNext()) {
          next += this._input.next();
        }
      }
    }
    next += pattern.read();
    resulting_string += next;
  }

  return resulting_string;
};

module.exports.Tokenizer = Tokenizer;
module.exports.TOKEN = TOKEN;
module.exports.positionable_operators = positionable_operators.slice();
module.exports.line_starters = line_starters.slice();


/***/ }),
/* 8 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var regexp_has_sticky = RegExp.prototype.hasOwnProperty('sticky');

function InputScanner(input_string) {
  this.__input = input_string || '';
  this.__input_length = this.__input.length;
  this.__position = 0;
}

InputScanner.prototype.restart = function() {
  this.__position = 0;
};

InputScanner.prototype.back = function() {
  if (this.__position > 0) {
    this.__position -= 1;
  }
};

InputScanner.prototype.hasNext = function() {
  return this.__position < this.__input_length;
};

InputScanner.prototype.next = function() {
  var val = null;
  if (this.hasNext()) {
    val = this.__input.charAt(this.__position);
    this.__position += 1;
  }
  return val;
};

InputScanner.prototype.peek = function(index) {
  var val = null;
  index = index || 0;
  index += this.__position;
  if (index >= 0 && index < this.__input_length) {
    val = this.__input.charAt(index);
  }
  return val;
};

// This is a JavaScript only helper function (not in python)
// Javascript doesn't have a match method
// and not all implementation support "sticky" flag.
// If they do not support sticky then both this.match() and this.test() method
// must get the match and check the index of the match.
// If sticky is supported and set, this method will use it.
// Otherwise it will check that global is set, and fall back to the slower method.
InputScanner.prototype.__match = function(pattern, index) {
  pattern.lastIndex = index;
  var pattern_match = pattern.exec(this.__input);

  if (pattern_match && !(regexp_has_sticky && pattern.sticky)) {
    if (pattern_match.index !== index) {
      pattern_match = null;
    }
  }

  return pattern_match;
};

InputScanner.prototype.test = function(pattern, index) {
  index = index || 0;
  index += this.__position;

  if (index >= 0 && index < this.__input_length) {
    return !!this.__match(pattern, index);
  } else {
    return false;
  }
};

InputScanner.prototype.testChar = function(pattern, index) {
  // test one character regex match
  var val = this.peek(index);
  pattern.lastIndex = 0;
  return val !== null && pattern.test(val);
};

InputScanner.prototype.match = function(pattern) {
  var pattern_match = this.__match(pattern, this.__position);
  if (pattern_match) {
    this.__position += pattern_match[0].length;
  } else {
    pattern_match = null;
  }
  return pattern_match;
};

InputScanner.prototype.read = function(starting_pattern, until_pattern, until_after) {
  var val = '';
  var match;
  if (starting_pattern) {
    match = this.match(starting_pattern);
    if (match) {
      val += match[0];
    }
  }
  if (until_pattern && (match || !starting_pattern)) {
    val += this.readUntil(until_pattern, until_after);
  }
  return val;
};

InputScanner.prototype.readUntil = function(pattern, until_after) {
  var val = '';
  var match_index = this.__position;
  pattern.lastIndex = this.__position;
  var pattern_match = pattern.exec(this.__input);
  if (pattern_match) {
    match_index = pattern_match.index;
    if (until_after) {
      match_index += pattern_match[0].length;
    }
  } else {
    match_index = this.__input_length;
  }

  val = this.__input.substring(this.__position, match_index);
  this.__position = match_index;
  return val;
};

InputScanner.prototype.readUntilAfter = function(pattern) {
  return this.readUntil(pattern, true);
};

InputScanner.prototype.get_regexp = function(pattern, match_from) {
  var result = null;
  var flags = 'g';
  if (match_from && regexp_has_sticky) {
    flags = 'y';
  }
  // strings are converted to regexp
  if (typeof pattern === "string" && pattern !== '') {
    // result = new RegExp(pattern.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), flags);
    result = new RegExp(pattern, flags);
  } else if (pattern) {
    result = new RegExp(pattern.source, flags);
  }
  return result;
};

InputScanner.prototype.get_literal_regexp = function(literal_string) {
  return RegExp(literal_string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'));
};

/* css beautifier legacy helpers */
InputScanner.prototype.peekUntilAfter = function(pattern) {
  var start = this.__position;
  var val = this.readUntilAfter(pattern);
  this.__position = start;
  return val;
};

InputScanner.prototype.lookBack = function(testVal) {
  var start = this.__position - 1;
  return start >= testVal.length && this.__input.substring(start - testVal.length, start)
    .toLowerCase() === testVal;
};

module.exports.InputScanner = InputScanner;


/***/ }),
/* 9 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_123385__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var InputScanner = (__nested_webpack_require_123385__(8).InputScanner);
var Token = (__nested_webpack_require_123385__(3).Token);
var TokenStream = (__nested_webpack_require_123385__(10).TokenStream);
var WhitespacePattern = (__nested_webpack_require_123385__(11).WhitespacePattern);

var TOKEN = {
  START: 'TK_START',
  RAW: 'TK_RAW',
  EOF: 'TK_EOF'
};

var Tokenizer = function(input_string, options) {
  this._input = new InputScanner(input_string);
  this._options = options || {};
  this.__tokens = null;

  this._patterns = {};
  this._patterns.whitespace = new WhitespacePattern(this._input);
};

Tokenizer.prototype.tokenize = function() {
  this._input.restart();
  this.__tokens = new TokenStream();

  this._reset();

  var current;
  var previous = new Token(TOKEN.START, '');
  var open_token = null;
  var open_stack = [];
  var comments = new TokenStream();

  while (previous.type !== TOKEN.EOF) {
    current = this._get_next_token(previous, open_token);
    while (this._is_comment(current)) {
      comments.add(current);
      current = this._get_next_token(previous, open_token);
    }

    if (!comments.isEmpty()) {
      current.comments_before = comments;
      comments = new TokenStream();
    }

    current.parent = open_token;

    if (this._is_opening(current)) {
      open_stack.push(open_token);
      open_token = current;
    } else if (open_token && this._is_closing(current, open_token)) {
      current.opened = open_token;
      open_token.closed = current;
      open_token = open_stack.pop();
      current.parent = open_token;
    }

    current.previous = previous;
    previous.next = current;

    this.__tokens.add(current);
    previous = current;
  }

  return this.__tokens;
};


Tokenizer.prototype._is_first_token = function() {
  return this.__tokens.isEmpty();
};

Tokenizer.prototype._reset = function() {};

Tokenizer.prototype._get_next_token = function(previous_token, open_token) { // jshint unused:false
  this._readWhitespace();
  var resulting_string = this._input.read(/.+/g);
  if (resulting_string) {
    return this._create_token(TOKEN.RAW, resulting_string);
  } else {
    return this._create_token(TOKEN.EOF, '');
  }
};

Tokenizer.prototype._is_comment = function(current_token) { // jshint unused:false
  return false;
};

Tokenizer.prototype._is_opening = function(current_token) { // jshint unused:false
  return false;
};

Tokenizer.prototype._is_closing = function(current_token, open_token) { // jshint unused:false
  return false;
};

Tokenizer.prototype._create_token = function(type, text) {
  var token = new Token(type, text,
    this._patterns.whitespace.newline_count,
    this._patterns.whitespace.whitespace_before_token);
  return token;
};

Tokenizer.prototype._readWhitespace = function() {
  return this._patterns.whitespace.read();
};



module.exports.Tokenizer = Tokenizer;
module.exports.TOKEN = TOKEN;


/***/ }),
/* 10 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function TokenStream(parent_token) {
  // private
  this.__tokens = [];
  this.__tokens_length = this.__tokens.length;
  this.__position = 0;
  this.__parent_token = parent_token;
}

TokenStream.prototype.restart = function() {
  this.__position = 0;
};

TokenStream.prototype.isEmpty = function() {
  return this.__tokens_length === 0;
};

TokenStream.prototype.hasNext = function() {
  return this.__position < this.__tokens_length;
};

TokenStream.prototype.next = function() {
  var val = null;
  if (this.hasNext()) {
    val = this.__tokens[this.__position];
    this.__position += 1;
  }
  return val;
};

TokenStream.prototype.peek = function(index) {
  var val = null;
  index = index || 0;
  index += this.__position;
  if (index >= 0 && index < this.__tokens_length) {
    val = this.__tokens[index];
  }
  return val;
};

TokenStream.prototype.add = function(token) {
  if (this.__parent_token) {
    token.parent = this.__parent_token;
  }
  this.__tokens.push(token);
  this.__tokens_length += 1;
};

module.exports.TokenStream = TokenStream;


/***/ }),
/* 11 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_129805__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var Pattern = (__nested_webpack_require_129805__(12).Pattern);

function WhitespacePattern(input_scanner, parent) {
  Pattern.call(this, input_scanner, parent);
  if (parent) {
    this._line_regexp = this._input.get_regexp(parent._line_regexp);
  } else {
    this.__set_whitespace_patterns('', '');
  }

  this.newline_count = 0;
  this.whitespace_before_token = '';
}
WhitespacePattern.prototype = new Pattern();

WhitespacePattern.prototype.__set_whitespace_patterns = function(whitespace_chars, newline_chars) {
  whitespace_chars += '\\t ';
  newline_chars += '\\n\\r';

  this._match_pattern = this._input.get_regexp(
    '[' + whitespace_chars + newline_chars + ']+', true);
  this._newline_regexp = this._input.get_regexp(
    '\\r\\n|[' + newline_chars + ']');
};

WhitespacePattern.prototype.read = function() {
  this.newline_count = 0;
  this.whitespace_before_token = '';

  var resulting_string = this._input.read(this._match_pattern);
  if (resulting_string === ' ') {
    this.whitespace_before_token = ' ';
  } else if (resulting_string) {
    var matches = this.__split(this._newline_regexp, resulting_string);
    this.newline_count = matches.length - 1;
    this.whitespace_before_token = matches[this.newline_count];
  }

  return resulting_string;
};

WhitespacePattern.prototype.matching = function(whitespace_chars, newline_chars) {
  var result = this._create();
  result.__set_whitespace_patterns(whitespace_chars, newline_chars);
  result._update();
  return result;
};

WhitespacePattern.prototype._create = function() {
  return new WhitespacePattern(this._input, this);
};

WhitespacePattern.prototype.__split = function(regexp, input_string) {
  regexp.lastIndex = 0;
  var start_index = 0;
  var result = [];
  var next_match = regexp.exec(input_string);
  while (next_match) {
    result.push(input_string.substring(start_index, next_match.index));
    start_index = next_match.index + next_match[0].length;
    next_match = regexp.exec(input_string);
  }

  if (start_index < input_string.length) {
    result.push(input_string.substring(start_index, input_string.length));
  } else {
    result.push('');
  }

  return result;
};



module.exports.WhitespacePattern = WhitespacePattern;


/***/ }),
/* 12 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function Pattern(input_scanner, parent) {
  this._input = input_scanner;
  this._starting_pattern = null;
  this._match_pattern = null;
  this._until_pattern = null;
  this._until_after = false;

  if (parent) {
    this._starting_pattern = this._input.get_regexp(parent._starting_pattern, true);
    this._match_pattern = this._input.get_regexp(parent._match_pattern, true);
    this._until_pattern = this._input.get_regexp(parent._until_pattern);
    this._until_after = parent._until_after;
  }
}

Pattern.prototype.read = function() {
  var result = this._input.read(this._starting_pattern);
  if (!this._starting_pattern || result) {
    result += this._input.read(this._match_pattern, this._until_pattern, this._until_after);
  }
  return result;
};

Pattern.prototype.read_match = function() {
  return this._input.match(this._match_pattern);
};

Pattern.prototype.until_after = function(pattern) {
  var result = this._create();
  result._until_after = true;
  result._until_pattern = this._input.get_regexp(pattern);
  result._update();
  return result;
};

Pattern.prototype.until = function(pattern) {
  var result = this._create();
  result._until_after = false;
  result._until_pattern = this._input.get_regexp(pattern);
  result._update();
  return result;
};

Pattern.prototype.starting_with = function(pattern) {
  var result = this._create();
  result._starting_pattern = this._input.get_regexp(pattern, true);
  result._update();
  return result;
};

Pattern.prototype.matching = function(pattern) {
  var result = this._create();
  result._match_pattern = this._input.get_regexp(pattern, true);
  result._update();
  return result;
};

Pattern.prototype._create = function() {
  return new Pattern(this._input, this);
};

Pattern.prototype._update = function() {};

module.exports.Pattern = Pattern;


/***/ }),
/* 13 */
/***/ (function(module) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



function Directives(start_block_pattern, end_block_pattern) {
  start_block_pattern = typeof start_block_pattern === 'string' ? start_block_pattern : start_block_pattern.source;
  end_block_pattern = typeof end_block_pattern === 'string' ? end_block_pattern : end_block_pattern.source;
  this.__directives_block_pattern = new RegExp(start_block_pattern + / beautify( \w+[:]\w+)+ /.source + end_block_pattern, 'g');
  this.__directive_pattern = / (\w+)[:](\w+)/g;

  this.__directives_end_ignore_pattern = new RegExp(start_block_pattern + /\sbeautify\signore:end\s/.source + end_block_pattern, 'g');
}

Directives.prototype.get_directives = function(text) {
  if (!text.match(this.__directives_block_pattern)) {
    return null;
  }

  var directives = {};
  this.__directive_pattern.lastIndex = 0;
  var directive_match = this.__directive_pattern.exec(text);

  while (directive_match) {
    directives[directive_match[1]] = directive_match[2];
    directive_match = this.__directive_pattern.exec(text);
  }

  return directives;
};

Directives.prototype.readIgnored = function(input) {
  return input.readUntilAfter(this.__directives_end_ignore_pattern);
};


module.exports.Directives = Directives;


/***/ }),
/* 14 */
/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_138792__) {

/*jshint node:true */
/*

  The MIT License (MIT)

  Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files
  (the "Software"), to deal in the Software without restriction,
  including without limitation the rights to use, copy, modify, merge,
  publish, distribute, sublicense, and/or sell copies of the Software,
  and to permit persons to whom the Software is furnished to do so,
  subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.
*/



var Pattern = (__nested_webpack_require_138792__(12).Pattern);


var template_names = {
  django: false,
  erb: false,
  handlebars: false,
  php: false,
  smarty: false
};

// This lets templates appear anywhere we would do a readUntil
// The cost is higher but it is pay to play.
function TemplatablePattern(input_scanner, parent) {
  Pattern.call(this, input_scanner, parent);
  this.__template_pattern = null;
  this._disabled = Object.assign({}, template_names);
  this._excluded = Object.assign({}, template_names);

  if (parent) {
    this.__template_pattern = this._input.get_regexp(parent.__template_pattern);
    this._excluded = Object.assign(this._excluded, parent._excluded);
    this._disabled = Object.assign(this._disabled, parent._disabled);
  }
  var pattern = new Pattern(input_scanner);
  this.__patterns = {
    handlebars_comment: pattern.starting_with(/{{!--/).until_after(/--}}/),
    handlebars_unescaped: pattern.starting_with(/{{{/).until_after(/}}}/),
    handlebars: pattern.starting_with(/{{/).until_after(/}}/),
    php: pattern.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),
    erb: pattern.starting_with(/<%[^%]/).until_after(/[^%]%>/),
    // django coflicts with handlebars a bit.
    django: pattern.starting_with(/{%/).until_after(/%}/),
    django_value: pattern.starting_with(/{{/).until_after(/}}/),
    django_comment: pattern.starting_with(/{#/).until_after(/#}/),
    smarty: pattern.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),
    smarty_comment: pattern.starting_with(/{\*/).until_after(/\*}/),
    smarty_literal: pattern.starting_with(/{literal}/).until_after(/{\/literal}/)
  };
}
TemplatablePattern.prototype = new Pattern();

TemplatablePattern.prototype._create = function() {
  return new TemplatablePattern(this._input, this);
};

TemplatablePattern.prototype._update = function() {
  this.__set_templated_pattern();
};

TemplatablePattern.prototype.disable = function(language) {
  var result = this._create();
  result._disabled[language] = true;
  result._update();
  return result;
};

TemplatablePattern.prototype.read_options = function(options) {
  var result = this._create();
  for (var language in template_names) {
    result._disabled[language] = options.templating.indexOf(language) === -1;
  }
  result._update();
  return result;
};

TemplatablePattern.prototype.exclude = function(language) {
  var result = this._create();
  result._excluded[language] = true;
  result._update();
  return result;
};

TemplatablePattern.prototype.read = function() {
  var result = '';
  if (this._match_pattern) {
    result = this._input.read(this._starting_pattern);
  } else {
    result = this._input.read(this._starting_pattern, this.__template_pattern);
  }
  var next = this._read_template();
  while (next) {
    if (this._match_pattern) {
      next += this._input.read(this._match_pattern);
    } else {
      next += this._input.readUntil(this.__template_pattern);
    }
    result += next;
    next = this._read_template();
  }

  if (this._until_after) {
    result += this._input.readUntilAfter(this._until_pattern);
  }
  return result;
};

TemplatablePattern.prototype.__set_templated_pattern = function() {
  var items = [];

  if (!this._disabled.php) {
    items.push(this.__patterns.php._starting_pattern.source);
  }
  if (!this._disabled.handlebars) {
    items.push(this.__patterns.handlebars._starting_pattern.source);
  }
  if (!this._disabled.erb) {
    items.push(this.__patterns.erb._starting_pattern.source);
  }
  if (!this._disabled.django) {
    items.push(this.__patterns.django._starting_pattern.source);
    // The starting pattern for django is more complex because it has different
    // patterns for value, comment, and other sections
    items.push(this.__patterns.django_value._starting_pattern.source);
    items.push(this.__patterns.django_comment._starting_pattern.source);
  }
  if (!this._disabled.smarty) {
    items.push(this.__patterns.smarty._starting_pattern.source);
  }

  if (this._until_pattern) {
    items.push(this._until_pattern.source);
  }
  this.__template_pattern = this._input.get_regexp('(?:' + items.join('|') + ')');
};

TemplatablePattern.prototype._read_template = function() {
  var resulting_string = '';
  var c = this._input.peek();
  if (c === '<') {
    var peek1 = this._input.peek(1);
    //if we're in a comment, do something special
    // We treat all comments as literals, even more than preformatted tags
    // we just look for the appropriate close tag
    if (!this._disabled.php && !this._excluded.php && peek1 === '?') {
      resulting_string = resulting_string ||
        this.__patterns.php.read();
    }
    if (!this._disabled.erb && !this._excluded.erb && peek1 === '%') {
      resulting_string = resulting_string ||
        this.__patterns.erb.read();
    }
  } else if (c === '{') {
    if (!this._disabled.handlebars && !this._excluded.handlebars) {
      resulting_string = resulting_string ||
        this.__patterns.handlebars_comment.read();
      resulting_string = resulting_string ||
        this.__patterns.handlebars_unescaped.read();
      resulting_string = resulting_string ||
        this.__patterns.handlebars.read();
    }
    if (!this._disabled.django) {
      // django coflicts with handlebars a bit.
      if (!this._excluded.django && !this._excluded.handlebars) {
        resulting_string = resulting_string ||
          this.__patterns.django_value.read();
      }
      if (!this._excluded.django) {
        resulting_string = resulting_string ||
          this.__patterns.django_comment.read();
        resulting_string = resulting_string ||
          this.__patterns.django.read();
      }
    }
    if (!this._disabled.smarty) {
      // smarty cannot be enabled with django or handlebars enabled
      if (this._disabled.django && this._disabled.handlebars) {
        resulting_string = resulting_string ||
          this.__patterns.smarty_comment.read();
        resulting_string = resulting_string ||
          this.__patterns.smarty_literal.read();
        resulting_string = resulting_string ||
          this.__patterns.smarty.read();
      }
    }
  }
  return resulting_string;
};


module.exports.TemplatablePattern = TemplatablePattern;


/***/ })
/******/ 	]);
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __nested_webpack_require_146467__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_146467__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module is referenced by other modules so it can't be inlined
/******/ 	var __nested_webpack_exports__ = __nested_webpack_require_146467__(0);
/******/ 	legacy_beautify_js = __nested_webpack_exports__;
/******/ 	
/******/ })()
;
var js_beautify = legacy_beautify_js;
/* Footer */
if (true) {
    // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- )
    !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
        return { js_beautify: js_beautify };
    }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}

}());



/***/ }),

/***/ 42166:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "Pi": () => (/* binding */ mobxreact_esm_observer)
});

// UNUSED EXPORTS: MobXProviderContext, Observer, PropTypes, Provider, disposeOnUnmount, enableStaticRendering, inject, isUsingStaticRendering, observerBatching, useAsObservableSource, useLocalObservable, useLocalStore, useObserver, useStaticRendering

// EXTERNAL MODULE: ./node_modules/.pnpm/mobx@6.9.0/node_modules/mobx/dist/mobx.esm.js
var mobx_esm = __webpack_require__(1299);
// EXTERNAL MODULE: ./node_modules/.pnpm/react@17.0.2/node_modules/react/index.js
var react = __webpack_require__(70654);
;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/utils/assertEnvironment.js


if (!react.useState) {
    throw new Error("mobx-react-lite requires React with Hooks support");
}
if (!mobx_esm/* makeObservable */.rC) {
    throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");
}

// EXTERNAL MODULE: ./node_modules/.pnpm/react-dom@17.0.2_react@17.0.2/node_modules/react-dom/index.js
var react_dom = __webpack_require__(75940);
;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/utils/reactBatchedUpdates.js


;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/utils/observerBatching.js

function defaultNoopBatch(callback) {
    callback();
}
function observerBatching(reactionScheduler) {
    if (!reactionScheduler) {
        reactionScheduler = defaultNoopBatch;
        if (false) {}
    }
    (0,mobx_esm/* configure */.jQ)({ reactionScheduler: reactionScheduler });
}
var isObserverBatched = function () {
    if (false) {}
    return true;
};

;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/utils/printDebugValue.js

function printDebugValue(v) {
    return (0,mobx_esm/* getDependencyTree */.Gf)(v);
}

;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/utils/UniversalFinalizationRegistry.js
var REGISTRY_FINALIZE_AFTER = 10000;
var REGISTRY_SWEEP_INTERVAL = 10000;
var TimerBasedFinalizationRegistry = /** @class */ (function () {
    function TimerBasedFinalizationRegistry(finalize) {
        var _this = this;
        Object.defineProperty(this, "finalize", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: finalize
        });
        Object.defineProperty(this, "registrations", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: new Map()
        });
        Object.defineProperty(this, "sweepTimeout", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: void 0
        });
        // Bound so it can be used directly as setTimeout callback.
        Object.defineProperty(this, "sweep", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: function (maxAge) {
                if (maxAge === void 0) { maxAge = REGISTRY_FINALIZE_AFTER; }
                // cancel timeout so we can force sweep anytime
                clearTimeout(_this.sweepTimeout);
                _this.sweepTimeout = undefined;
                var now = Date.now();
                _this.registrations.forEach(function (registration, token) {
                    if (now - registration.registeredAt >= maxAge) {
                        _this.finalize(registration.value);
                        _this.registrations.delete(token);
                    }
                });
                if (_this.registrations.size > 0) {
                    _this.scheduleSweep();
                }
            }
        });
        // Bound so it can be exported directly as clearTimers test utility.
        Object.defineProperty(this, "finalizeAllImmediately", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: function () {
                _this.sweep(0);
            }
        });
    }
    // Token is actually required with this impl
    Object.defineProperty(TimerBasedFinalizationRegistry.prototype, "register", {
        enumerable: false,
        configurable: true,
        writable: true,
        value: function (target, value, token) {
            this.registrations.set(token, {
                value: value,
                registeredAt: Date.now()
            });
            this.scheduleSweep();
        }
    });
    Object.defineProperty(TimerBasedFinalizationRegistry.prototype, "unregister", {
        enumerable: false,
        configurable: true,
        writable: true,
        value: function (token) {
            this.registrations.delete(token);
        }
    });
    Object.defineProperty(TimerBasedFinalizationRegistry.prototype, "scheduleSweep", {
        enumerable: false,
        configurable: true,
        writable: true,
        value: function () {
            if (this.sweepTimeout === undefined) {
                this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL);
            }
        }
    });
    return TimerBasedFinalizationRegistry;
}());

var UniversalFinalizationRegistry = typeof FinalizationRegistry !== "undefined"
    ? FinalizationRegistry
    : TimerBasedFinalizationRegistry;

;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/utils/observerFinalizationRegistry.js

var observerFinalizationRegistry = new UniversalFinalizationRegistry(function (adm) {
    var _a;
    (_a = adm.reaction) === null || _a === void 0 ? void 0 : _a.dispose();
    adm.reaction = null;
});

;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/staticRendering.js
var globalIsUsingStaticRendering = false;
function staticRendering_enableStaticRendering(enable) {
    globalIsUsingStaticRendering = enable;
}
function isUsingStaticRendering() {
    return globalIsUsingStaticRendering;
}

;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/useObserver.js
var __read = (undefined && undefined.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};





function observerComponentNameFor(baseComponentName) {
    return "observer".concat(baseComponentName);
}
/**
 * We use class to make it easier to detect in heap snapshots by name
 */
var ObjectToBeRetainedByReact = /** @class */ (function () {
    function ObjectToBeRetainedByReact() {
    }
    return ObjectToBeRetainedByReact;
}());
function objectToBeRetainedByReactFactory() {
    return new ObjectToBeRetainedByReact();
}
function useObserver(fn, baseComponentName) {
    if (baseComponentName === void 0) { baseComponentName = "observed"; }
    if (isUsingStaticRendering()) {
        return fn();
    }
    var _a = __read(react.useState(objectToBeRetainedByReactFactory), 1), objectRetainedByReact = _a[0];
    // Force update, see #2982
    var _b = __read(react.useState(), 2), setState = _b[1];
    var forceUpdate = function () { return setState([]); };
    // StrictMode/ConcurrentMode/Suspense may mean that our component is
    // rendered and abandoned multiple times, so we need to track leaked
    // Reactions.
    var admRef = react.useRef(null);
    if (!admRef.current) {
        // First render
        admRef.current = {
            reaction: null,
            mounted: false,
            changedBeforeMount: false
        };
    }
    var adm = admRef.current;
    if (!adm.reaction) {
        // First render or component was not committed and reaction was disposed by registry
        adm.reaction = new mobx_esm/* Reaction */.le(observerComponentNameFor(baseComponentName), function () {
            // Observable has changed, meaning we want to re-render
            // BUT if we're a component that hasn't yet got to the useEffect()
            // stage, we might be a component that _started_ to render, but
            // got dropped, and we don't want to make state changes then.
            // (It triggers warnings in StrictMode, for a start.)
            if (adm.mounted) {
                // We have reached useEffect(), so we're mounted, and can trigger an update
                forceUpdate();
            }
            else {
                // We haven't yet reached useEffect(), so we'll need to trigger a re-render
                // when (and if) useEffect() arrives.
                adm.changedBeforeMount = true;
            }
        });
        observerFinalizationRegistry.register(objectRetainedByReact, adm, adm);
    }
    react.useDebugValue(adm.reaction, printDebugValue);
    react.useEffect(function () {
        observerFinalizationRegistry.unregister(adm);
        adm.mounted = true;
        if (adm.reaction) {
            if (adm.changedBeforeMount) {
                // Got a change before mount, force an update
                adm.changedBeforeMount = false;
                forceUpdate();
            }
        }
        else {
            // The reaction we set up in our render has been disposed.
            // This can be due to bad timings of renderings, e.g. our
            // component was paused for a _very_ long time, and our
            // reaction got cleaned up
            // Re-create the reaction
            adm.reaction = new mobx_esm/* Reaction */.le(observerComponentNameFor(baseComponentName), function () {
                // We've definitely already been mounted at this point
                forceUpdate();
            });
            forceUpdate();
        }
        return function () {
            adm.reaction.dispose();
            adm.reaction = null;
            adm.mounted = false;
            adm.changedBeforeMount = false;
        };
    }, []);
    // render the original component, but have the
    // reaction track the observables, so that rendering
    // can be invalidated (see above) once a dependency changes
    var rendering;
    var exception;
    adm.reaction.track(function () {
        try {
            rendering = fn();
        }
        catch (e) {
            exception = e;
        }
    });
    if (exception) {
        throw exception; // re-throw any exceptions caught during rendering
    }
    return rendering;
}

;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/observer.js



var warnObserverOptionsDeprecated = true;
var hasSymbol = typeof Symbol === "function" && Symbol.for;
// Using react-is had some issues (and operates on elements, not on types), see #608 / #609
var ReactForwardRefSymbol = hasSymbol
    ? Symbol.for("react.forward_ref")
    : typeof react.forwardRef === "function" && (0,react.forwardRef)(function (props) { return null; })["$$typeof"];
var ReactMemoSymbol = hasSymbol
    ? Symbol.for("react.memo")
    : typeof react.memo === "function" && (0,react.memo)(function (props) { return null; })["$$typeof"];
// n.b. base case is not used for actual typings or exported in the typing files
function observer(baseComponent, 
// TODO remove in next major
options) {
    var _a;
    if (false) {}
    if (ReactMemoSymbol && baseComponent["$$typeof"] === ReactMemoSymbol) {
        throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");
    }
    // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307
    if (isUsingStaticRendering()) {
        return baseComponent;
    }
    var useForwardRef = (_a = options === null || options === void 0 ? void 0 : options.forwardRef) !== null && _a !== void 0 ? _a : false;
    var render = baseComponent;
    var baseComponentName = baseComponent.displayName || baseComponent.name;
    // If already wrapped with forwardRef, unwrap,
    // so we can patch render and apply memo
    if (ReactForwardRefSymbol && baseComponent["$$typeof"] === ReactForwardRefSymbol) {
        useForwardRef = true;
        render = baseComponent["render"];
        if (typeof render !== "function") {
            throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");
        }
    }
    var observerComponent = function (props, ref) {
        return useObserver(function () { return render(props, ref); }, baseComponentName);
    };
    // Don't set `displayName` for anonymous components,
    // so the `displayName` can be customized by user, see #3192.
    if (baseComponentName !== "") {
        ;
        observerComponent.displayName = baseComponentName;
    }
    // Support legacy context: `contextTypes` must be applied before `memo`
    if (baseComponent.contextTypes) {
        ;
        observerComponent.contextTypes = baseComponent.contextTypes;
    }
    if (useForwardRef) {
        // `forwardRef` must be applied prior `memo`
        // `forwardRef(observer(cmp))` throws:
        // "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))"
        observerComponent = (0,react.forwardRef)(observerComponent);
    }
    // memo; we are not interested in deep updates
    // in props; we assume that if deep objects are changed,
    // this is in observables, which would have been tracked anyway
    observerComponent = (0,react.memo)(observerComponent);
    copyStaticProperties(baseComponent, observerComponent);
    if (false) {}
    return observerComponent;
}
// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js
var hoistBlackList = {
    $$typeof: true,
    render: true,
    compare: true,
    type: true,
    // Don't redefine `displayName`,
    // it's defined as getter-setter pair on `memo` (see #3192).
    displayName: true
};
function copyStaticProperties(base, target) {
    Object.keys(base).forEach(function (key) {
        if (!hoistBlackList[key]) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key));
        }
    });
}

;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/ObserverComponent.js

function ObserverComponent(_a) {
    var children = _a.children, render = _a.render;
    var component = children || render;
    if (typeof component !== "function") {
        return null;
    }
    return useObserver(component);
}
if (false) {}
ObserverComponent.displayName = "Observer";

function ObserverPropsCheck(props, key, componentName, location, propFullName) {
    var extraKey = key === "children" ? "render" : "children";
    var hasProp = typeof props[key] === "function";
    var hasExtraProp = typeof props[extraKey] === "function";
    if (hasProp && hasExtraProp) {
        return new Error("MobX Observer: Do not use children and render in the same time in`" + componentName);
    }
    if (hasProp || hasExtraProp) {
        return null;
    }
    return new Error("Invalid prop `" +
        propFullName +
        "` of type `" +
        typeof props[key] +
        "` supplied to" +
        " `" +
        componentName +
        "`, expected `function`.");
}

;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/useLocalObservable.js


function useLocalObservable(initializer, annotations) {
    return useState(function () { return observable(initializer(), annotations, { autoBind: true }); })[0];
}

;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/useAsObservableSource.js
var useAsObservableSource_read = (undefined && undefined.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};



function useAsObservableSource_useAsObservableSource(current) {
    if (false)
        {}
    var _a = useAsObservableSource_read(useState(function () { return observable(current, {}, { deep: false }); }), 1), res = _a[0];
    runInAction(function () {
        Object.assign(res, current);
    });
    return res;
}

;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/useLocalStore.js




function useLocalStore(initializer, current) {
    if (false)
        {}
    var source = current && useAsObservableSource(current);
    return useState(function () { return observable(initializer(source), undefined, { autoBind: true }); })[0];
}

;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react-lite@3.4.3_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react-lite/es/index.js
var _a;







observerBatching(react_dom.unstable_batchedUpdates);






var clearTimers = (_a = observerFinalizationRegistry.finalizeAllImmediately) !== null && _a !== void 0 ? _a : (function () { });
function es_useObserver(fn, baseComponentName) {
    if (baseComponentName === void 0) { baseComponentName = "observed"; }
    if (false) {}
    return useObserverOriginal(fn, baseComponentName);
}

function useStaticRendering(enable) {
    if (false) {}
    enableStaticRendering(enable);
}

;// CONCATENATED MODULE: ./node_modules/.pnpm/mobx-react@7.6.0_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react/dist/mobxreact.esm.js





var symbolId = 0;

function createSymbol(name) {
  if (typeof Symbol === "function") {
    return Symbol(name);
  }

  var symbol = "__$mobx-react " + name + " (" + symbolId + ")";
  symbolId++;
  return symbol;
}

var createdSymbols = {};
function newSymbol(name) {
  if (!createdSymbols[name]) {
    createdSymbols[name] = createSymbol(name);
  }

  return createdSymbols[name];
}
function shallowEqual(objA, objB) {
  //From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
  if (is(objA, objB)) {
    return true;
  }

  if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
    return false;
  }

  var keysA = Object.keys(objA);
  var keysB = Object.keys(objB);

  if (keysA.length !== keysB.length) {
    return false;
  }

  for (var i = 0; i < keysA.length; i++) {
    if (!Object.hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
      return false;
    }
  }

  return true;
}

function is(x, y) {
  // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
  if (x === y) {
    return x !== 0 || 1 / x === 1 / y;
  } else {
    return x !== x && y !== y;
  }
} // based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js


var mobxreact_esm_hoistBlackList = {
  $$typeof: 1,
  render: 1,
  compare: 1,
  type: 1,
  childContextTypes: 1,
  contextType: 1,
  contextTypes: 1,
  defaultProps: 1,
  getDefaultProps: 1,
  getDerivedStateFromError: 1,
  getDerivedStateFromProps: 1,
  mixins: 1,
  displayName: 1,
  propTypes: 1
};
function mobxreact_esm_copyStaticProperties(base, target) {
  var protoProps = Object.getOwnPropertyNames(Object.getPrototypeOf(base));
  Object.getOwnPropertyNames(base).forEach(function (key) {
    if (!mobxreact_esm_hoistBlackList[key] && protoProps.indexOf(key) === -1) {
      Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key));
    }
  });
}
/**
 * Helper to set `prop` to `this` as non-enumerable (hidden prop)
 * @param target
 * @param prop
 * @param value
 */

function setHiddenProp(target, prop, value) {
  if (!Object.hasOwnProperty.call(target, prop)) {
    Object.defineProperty(target, prop, {
      enumerable: false,
      configurable: true,
      writable: true,
      value: value
    });
  } else {
    target[prop] = value;
  }
}
/**
 * Utilities for patching componentWillUnmount, to make sure @disposeOnUnmount works correctly icm with user defined hooks
 * and the handler provided by mobx-react
 */

var mobxMixins = /*#__PURE__*/newSymbol("patchMixins");
var mobxPatchedDefinition = /*#__PURE__*/newSymbol("patchedDefinition");

function getMixins(target, methodName) {
  var mixins = target[mobxMixins] = target[mobxMixins] || {};
  var methodMixins = mixins[methodName] = mixins[methodName] || {};
  methodMixins.locks = methodMixins.locks || 0;
  methodMixins.methods = methodMixins.methods || [];
  return methodMixins;
}

function wrapper(realMethod, mixins) {
  var _this = this;

  for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
    args[_key - 2] = arguments[_key];
  }

  // locks are used to ensure that mixins are invoked only once per invocation, even on recursive calls
  mixins.locks++;

  try {
    var retVal;

    if (realMethod !== undefined && realMethod !== null) {
      retVal = realMethod.apply(this, args);
    }

    return retVal;
  } finally {
    mixins.locks--;

    if (mixins.locks === 0) {
      mixins.methods.forEach(function (mx) {
        mx.apply(_this, args);
      });
    }
  }
}

function wrapFunction(realMethod, mixins) {
  var fn = function fn() {
    for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
      args[_key2] = arguments[_key2];
    }

    wrapper.call.apply(wrapper, [this, realMethod, mixins].concat(args));
  };

  return fn;
}

function patch(target, methodName, mixinMethod) {
  var mixins = getMixins(target, methodName);

  if (mixins.methods.indexOf(mixinMethod) < 0) {
    mixins.methods.push(mixinMethod);
  }

  var oldDefinition = Object.getOwnPropertyDescriptor(target, methodName);

  if (oldDefinition && oldDefinition[mobxPatchedDefinition]) {
    // already patched definition, do not repatch
    return;
  }

  var originalMethod = target[methodName];
  var newDefinition = createDefinition(target, methodName, oldDefinition ? oldDefinition.enumerable : undefined, mixins, originalMethod);
  Object.defineProperty(target, methodName, newDefinition);
}

function createDefinition(target, methodName, enumerable, mixins, originalMethod) {
  var _ref;

  var wrappedFunc = wrapFunction(originalMethod, mixins);
  return _ref = {}, _ref[mobxPatchedDefinition] = true, _ref.get = function get() {
    return wrappedFunc;
  }, _ref.set = function set(value) {
    if (this === target) {
      wrappedFunc = wrapFunction(value, mixins);
    } else {
      // when it is an instance of the prototype/a child prototype patch that particular case again separately
      // since we need to store separate values depending on wether it is the actual instance, the prototype, etc
      // e.g. the method for super might not be the same as the method for the prototype which might be not the same
      // as the method for the instance
      var newDefinition = createDefinition(this, methodName, enumerable, mixins, value);
      Object.defineProperty(this, methodName, newDefinition);
    }
  }, _ref.configurable = true, _ref.enumerable = enumerable, _ref;
}

var mobxAdminProperty = mobx_esm/* $mobx */.so || "$mobx"; // BC

var mobxObserverProperty = /*#__PURE__*/newSymbol("isMobXReactObserver");
var mobxIsUnmounted = /*#__PURE__*/newSymbol("isUnmounted");
var skipRenderKey = /*#__PURE__*/newSymbol("skipRender");
var isForcingUpdateKey = /*#__PURE__*/newSymbol("isForcingUpdate");
function makeClassComponentObserver(componentClass) {
  var target = componentClass.prototype;

  if (componentClass[mobxObserverProperty]) {
    var displayName = getDisplayName(target);
    console.warn("The provided component class (" + displayName + ")\n                has already been declared as an observer component.");
  } else {
    componentClass[mobxObserverProperty] = true;
  }

  if (target.componentWillReact) {
    throw new Error("The componentWillReact life-cycle event is no longer supported");
  }

  if (componentClass["__proto__"] !== react.PureComponent) {
    if (!target.shouldComponentUpdate) {
      target.shouldComponentUpdate = observerSCU;
    } else if (target.shouldComponentUpdate !== observerSCU) {
      // n.b. unequal check, instead of existence check, as @observer might be on superclass as well
      throw new Error("It is not allowed to use shouldComponentUpdate in observer based components.");
    }
  } // this.props and this.state are made observable, just to make sure @computed fields that
  // are defined inside the component, and which rely on state or props, re-compute if state or props change
  // (otherwise the computed wouldn't update and become stale on props change, since props are not observable)
  // However, this solution is not without it's own problems: https://github.com/mobxjs/mobx-react/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Aobservable-props-or-not+


  makeObservableProp(target, "props");
  makeObservableProp(target, "state");

  if (componentClass.contextType) {
    makeObservableProp(target, "context");
  }

  var originalRender = target.render;

  if (typeof originalRender !== "function") {
    var _displayName = getDisplayName(target);

    throw new Error("[mobx-react] class component (" + _displayName + ") is missing `render` method." + "\n`observer` requires `render` being a function defined on prototype." + "\n`render = () => {}` or `render = function() {}` is not supported.");
  }

  target.render = function () {
    this.render = isUsingStaticRendering() ? originalRender : createReactiveRender.call(this, originalRender);
    return this.render();
  };

  patch(target, "componentDidMount", function () {
    this[mobxIsUnmounted] = false;

    if (!this.render[mobxAdminProperty]) {
      // Reaction is re-created automatically during render, but a component can re-mount and skip render #3395.
      // To re-create the reaction and re-subscribe to relevant observables we have to force an update.
      react.Component.prototype.forceUpdate.call(this);
    }
  });
  patch(target, "componentWillUnmount", function () {
    if (isUsingStaticRendering()) {
      return;
    }

    var reaction = this.render[mobxAdminProperty];

    if (reaction) {
      reaction.dispose(); // Forces reaction to be re-created on next render

      this.render[mobxAdminProperty] = null;
    } else {
      // Render may have been hot-swapped and/or overridden by a subclass.
      var _displayName2 = getDisplayName(this);

      console.warn("The reactive render of an observer class component (" + _displayName2 + ")\n                was overridden after MobX attached. This may result in a memory leak if the\n                overridden reactive render was not properly disposed.");
    }

    this[mobxIsUnmounted] = true;
  });
  return componentClass;
} // Generates a friendly name for debugging

function getDisplayName(comp) {
  return comp.displayName || comp.name || comp.constructor && (comp.constructor.displayName || comp.constructor.name) || "<component>";
}

function createReactiveRender(originalRender) {
  var _this = this;

  /**
   * If props are shallowly modified, react will render anyway,
   * so atom.reportChanged() should not result in yet another re-render
   */
  setHiddenProp(this, skipRenderKey, false);
  /**
   * forceUpdate will re-assign this.props. We don't want that to cause a loop,
   * so detect these changes
   */

  setHiddenProp(this, isForcingUpdateKey, false);
  var initialName = getDisplayName(this);
  var boundOriginalRender = originalRender.bind(this);
  var isRenderingPending = false;

  var createReaction = function createReaction() {
    var reaction = new mobx_esm/* Reaction */.le(initialName + ".render()", function () {
      if (!isRenderingPending) {
        // N.B. Getting here *before mounting* means that a component constructor has side effects (see the relevant test in misc.test.tsx)
        // This unidiomatic React usage but React will correctly warn about this so we continue as usual
        // See #85 / Pull #44
        isRenderingPending = true;

        if (_this[mobxIsUnmounted] !== true) {
          var hasError = true;

          try {
            setHiddenProp(_this, isForcingUpdateKey, true);

            if (!_this[skipRenderKey]) {
              react.Component.prototype.forceUpdate.call(_this);
            }

            hasError = false;
          } finally {
            setHiddenProp(_this, isForcingUpdateKey, false);

            if (hasError) {
              reaction.dispose(); // Forces reaction to be re-created on next render

              _this.render[mobxAdminProperty] = null;
            }
          }
        }
      }
    });
    reaction["reactComponent"] = _this;
    return reaction;
  };

  function reactiveRender() {
    var _reactiveRender$mobxA;

    isRenderingPending = false; // Create reaction lazily to support re-mounting #3395

    var reaction = (_reactiveRender$mobxA = reactiveRender[mobxAdminProperty]) != null ? _reactiveRender$mobxA : reactiveRender[mobxAdminProperty] = createReaction();
    var exception = undefined;
    var rendering = undefined;
    reaction.track(function () {
      try {
        // TODO@major
        // Optimization: replace with _allowStateChangesStart/End (not available in mobx@6.0.0)
        rendering = (0,mobx_esm/* _allowStateChanges */.$$)(false, boundOriginalRender);
      } catch (e) {
        exception = e;
      }
    });

    if (exception) {
      throw exception;
    }

    return rendering;
  }

  return reactiveRender;
}

function observerSCU(nextProps, nextState) {
  if (isUsingStaticRendering()) {
    console.warn("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side.");
  } // update on any state changes (as is the default)


  if (this.state !== nextState) {
    return true;
  } // update if props are shallowly not equal, inspired by PureRenderMixin
  // we could return just 'false' here, and avoid the `skipRender` checks etc
  // however, it is nicer if lifecycle events are triggered like usually,
  // so we return true here if props are shallowly modified.


  return !shallowEqual(this.props, nextProps);
}

function makeObservableProp(target, propName) {
  var valueHolderKey = newSymbol("reactProp_" + propName + "_valueHolder");
  var atomHolderKey = newSymbol("reactProp_" + propName + "_atomHolder");

  function getAtom() {
    if (!this[atomHolderKey]) {
      setHiddenProp(this, atomHolderKey, (0,mobx_esm/* createAtom */.cp)("reactive " + propName));
    }

    return this[atomHolderKey];
  }

  Object.defineProperty(target, propName, {
    configurable: true,
    enumerable: true,
    get: function get() {
      var prevReadState = false; // Why this check? BC?
      // @ts-expect-error

      if (mobx_esm/* _allowStateReadsStart */.wM && mobx_esm/* _allowStateReadsEnd */.mJ) {
        prevReadState = (0,mobx_esm/* _allowStateReadsStart */.wM)(true);
      }

      getAtom.call(this).reportObserved(); // Why this check? BC?
      // @ts-expect-error

      if (mobx_esm/* _allowStateReadsStart */.wM && mobx_esm/* _allowStateReadsEnd */.mJ) {
        (0,mobx_esm/* _allowStateReadsEnd */.mJ)(prevReadState);
      }

      return this[valueHolderKey];
    },
    set: function set(v) {
      if (!this[isForcingUpdateKey] && !shallowEqual(this[valueHolderKey], v)) {
        setHiddenProp(this, valueHolderKey, v);
        setHiddenProp(this, skipRenderKey, true);
        getAtom.call(this).reportChanged();
        setHiddenProp(this, skipRenderKey, false);
      } else {
        setHiddenProp(this, valueHolderKey, v);
      }
    }
  });
}

/**
 * Observer function / decorator
 */

function mobxreact_esm_observer(component) {
  if (component["isMobxInjector"] === true) {
    console.warn("Mobx observer: You are trying to use `observer` on a component that already has `inject`. Please apply `observer` before applying `inject`");
  }

  if (Object.prototype.isPrototypeOf.call(react.Component, component) || Object.prototype.isPrototypeOf.call(react.PureComponent, component)) {
    // Class component
    return makeClassComponentObserver(component);
  } else {
    // Function component
    return observer(component);
  }
}

function _extends() {
  _extends = Object.assign || function (target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];

      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }

    return target;
  };

  return _extends.apply(this, arguments);
}

function _objectWithoutPropertiesLoose(source, excluded) {
  if (source == null) return {};
  var target = {};
  var sourceKeys = Object.keys(source);
  var key, i;

  for (i = 0; i < sourceKeys.length; i++) {
    key = sourceKeys[i];
    if (excluded.indexOf(key) >= 0) continue;
    target[key] = source[key];
  }

  return target;
}

var _excluded = ["children"];
var MobXProviderContext = /*#__PURE__*/react.createContext({});
function Provider(props) {
  var children = props.children,
      stores = _objectWithoutPropertiesLoose(props, _excluded);

  var parentValue = react.useContext(MobXProviderContext);
  var mutableProviderRef = react.useRef(_extends({}, parentValue, stores));
  var value = mutableProviderRef.current;

  if (false) { var newValue; }

  return react.createElement(MobXProviderContext.Provider, {
    value: value
  }, children);
}
Provider.displayName = "MobXProvider";

/**
 * Store Injection
 */

function createStoreInjector(grabStoresFn, component, injectNames, makeReactive) {
  // Support forward refs
  var Injector = React__default.forwardRef(function (props, ref) {
    var newProps = _extends({}, props);

    var context = React__default.useContext(MobXProviderContext);
    Object.assign(newProps, grabStoresFn(context || {}, newProps) || {});

    if (ref) {
      newProps.ref = ref;
    }

    return React__default.createElement(component, newProps);
  });
  if (makeReactive) Injector = mobxreact_esm_observer(Injector);
  Injector["isMobxInjector"] = true; // assigned late to suppress observer warning
  // Static fields from component should be visible on the generated Injector

  mobxreact_esm_copyStaticProperties(component, Injector);
  Injector["wrappedComponent"] = component;
  Injector.displayName = getInjectName(component, injectNames);
  return Injector;
}

function getInjectName(component, injectNames) {
  var displayName;
  var componentName = component.displayName || component.name || component.constructor && component.constructor.name || "Component";
  if (injectNames) displayName = "inject-with-" + injectNames + "(" + componentName + ")";else displayName = "inject(" + componentName + ")";
  return displayName;
}

function grabStoresByName(storeNames) {
  return function (baseStores, nextProps) {
    storeNames.forEach(function (storeName) {
      if (storeName in nextProps // prefer props over stores
      ) return;
      if (!(storeName in baseStores)) throw new Error("MobX injector: Store '" + storeName + "' is not available! Make sure it is provided by some Provider");
      nextProps[storeName] = baseStores[storeName];
    });
    return nextProps;
  };
}
/**
 * higher order component that injects stores to a child.
 * takes either a varargs list of strings, which are stores read from the context,
 * or a function that manually maps the available stores from the context to props:
 * storesToProps(mobxStores, props, context) => newProps
 */


function inject() {
  for (var _len = arguments.length, storeNames = new Array(_len), _key = 0; _key < _len; _key++) {
    storeNames[_key] = arguments[_key];
  }

  if (typeof arguments[0] === "function") {
    var grabStoresFn = arguments[0];
    return function (componentClass) {
      return createStoreInjector(grabStoresFn, componentClass, grabStoresFn.name, true);
    };
  } else {
    return function (componentClass) {
      return createStoreInjector(grabStoresByName(storeNames), componentClass, storeNames.join("-"), false);
    };
  }
}

var protoStoreKey = /*#__PURE__*/(/* unused pure expression or super */ null && (newSymbol("disposeOnUnmountProto")));
var instStoreKey = /*#__PURE__*/(/* unused pure expression or super */ null && (newSymbol("disposeOnUnmountInst")));

function runDisposersOnWillUnmount() {
  var _this = this;
  [].concat(this[protoStoreKey] || [], this[instStoreKey] || []).forEach(function (propKeyOrFunction) {
    var prop = typeof propKeyOrFunction === "string" ? _this[propKeyOrFunction] : propKeyOrFunction;

    if (prop !== undefined && prop !== null) {
      if (Array.isArray(prop)) prop.map(function (f) {
        return f();
      });else prop();
    }
  });
}

function disposeOnUnmount(target, propertyKeyOrFunction) {
  if (Array.isArray(propertyKeyOrFunction)) {
    return propertyKeyOrFunction.map(function (fn) {
      return disposeOnUnmount(target, fn);
    });
  }

  var c = Object.getPrototypeOf(target).constructor;
  var c2 = Object.getPrototypeOf(target.constructor); // Special case for react-hot-loader

  var c3 = Object.getPrototypeOf(Object.getPrototypeOf(target));

  if (!(c === React__default.Component || c === React__default.PureComponent || c2 === React__default.Component || c2 === React__default.PureComponent || c3 === React__default.Component || c3 === React__default.PureComponent)) {
    throw new Error("[mobx-react] disposeOnUnmount only supports direct subclasses of React.Component or React.PureComponent.");
  }

  if (typeof propertyKeyOrFunction !== "string" && typeof propertyKeyOrFunction !== "function" && !Array.isArray(propertyKeyOrFunction)) {
    throw new Error("[mobx-react] disposeOnUnmount only works if the parameter is either a property key or a function.");
  } // decorator's target is the prototype, so it doesn't have any instance properties like props


  var isDecorator = typeof propertyKeyOrFunction === "string"; // add property key / function we want run (disposed) to the store

  var componentWasAlreadyModified = !!target[protoStoreKey] || !!target[instStoreKey];
  var store = isDecorator ? // decorators are added to the prototype store
  target[protoStoreKey] || (target[protoStoreKey] = []) : // functions are added to the instance store
  target[instStoreKey] || (target[instStoreKey] = []);
  store.push(propertyKeyOrFunction); // tweak the component class componentWillUnmount if not done already

  if (!componentWasAlreadyModified) {
    patch(target, "componentWillUnmount", runDisposersOnWillUnmount);
  } // return the disposer as is if invoked as a non decorator


  if (typeof propertyKeyOrFunction !== "string") {
    return propertyKeyOrFunction;
  }
}

function createChainableTypeChecker(validator) {
  function checkType(isRequired, props, propName, componentName, location, propFullName) {
    for (var _len = arguments.length, rest = new Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) {
      rest[_key - 6] = arguments[_key];
    }

    return (0,mobx_esm/* untracked */.rg)(function () {
      componentName = componentName || "<<anonymous>>";
      propFullName = propFullName || propName;

      if (props[propName] == null) {
        if (isRequired) {
          var actual = props[propName] === null ? "null" : "undefined";
          return new Error("The " + location + " `" + propFullName + "` is marked as required " + "in `" + componentName + "`, but its value is `" + actual + "`.");
        }

        return null;
      } else {
        // @ts-ignore rest arg is necessary for some React internals - fails tests otherwise
        return validator.apply(void 0, [props, propName, componentName, location, propFullName].concat(rest));
      }
    });
  }

  var chainedCheckType = checkType.bind(null, false); // Add isRequired to satisfy Requirable

  chainedCheckType.isRequired = checkType.bind(null, true);
  return chainedCheckType;
} // Copied from React.PropTypes


function isSymbol(propType, propValue) {
  // Native Symbol.
  if (propType === "symbol") {
    return true;
  } // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'


  if (propValue["@@toStringTag"] === "Symbol") {
    return true;
  } // Fallback for non-spec compliant Symbols which are polyfilled.


  if (typeof Symbol === "function" && propValue instanceof Symbol) {
    return true;
  }

  return false;
} // Copied from React.PropTypes


function getPropType(propValue) {
  var propType = typeof propValue;

  if (Array.isArray(propValue)) {
    return "array";
  }

  if (propValue instanceof RegExp) {
    // Old webkits (at least until Android 4.0) return 'function' rather than
    // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
    // passes PropTypes.object.
    return "object";
  }

  if (isSymbol(propType, propValue)) {
    return "symbol";
  }

  return propType;
} // This handles more types than `getPropType`. Only used for error messages.
// Copied from React.PropTypes


function getPreciseType(propValue) {
  var propType = getPropType(propValue);

  if (propType === "object") {
    if (propValue instanceof Date) {
      return "date";
    } else if (propValue instanceof RegExp) {
      return "regexp";
    }
  }

  return propType;
}

function createObservableTypeCheckerCreator(allowNativeType, mobxType) {
  return createChainableTypeChecker(function (props, propName, componentName, location, propFullName) {
    return (0,mobx_esm/* untracked */.rg)(function () {
      if (allowNativeType) {
        if (getPropType(props[propName]) === mobxType.toLowerCase()) return null;
      }

      var mobxChecker;

      switch (mobxType) {
        case "Array":
          mobxChecker = mobx_esm/* isObservableArray */.Ei;
          break;

        case "Object":
          mobxChecker = mobx_esm/* isObservableObject */.Pb;
          break;

        case "Map":
          mobxChecker = mobx_esm/* isObservableMap */.LJ;
          break;

        default:
          throw new Error("Unexpected mobxType: " + mobxType);
      }

      var propValue = props[propName];

      if (!mobxChecker(propValue)) {
        var preciseType = getPreciseType(propValue);
        var nativeTypeExpectationMessage = allowNativeType ? " or javascript `" + mobxType.toLowerCase() + "`" : "";
        return new Error("Invalid prop `" + propFullName + "` of type `" + preciseType + "` supplied to" + " `" + componentName + "`, expected `mobx.Observable" + mobxType + "`" + nativeTypeExpectationMessage + ".");
      }

      return null;
    });
  });
}

function createObservableArrayOfTypeChecker(allowNativeType, typeChecker) {
  return createChainableTypeChecker(function (props, propName, componentName, location, propFullName) {
    for (var _len2 = arguments.length, rest = new Array(_len2 > 5 ? _len2 - 5 : 0), _key2 = 5; _key2 < _len2; _key2++) {
      rest[_key2 - 5] = arguments[_key2];
    }

    return (0,mobx_esm/* untracked */.rg)(function () {
      if (typeof typeChecker !== "function") {
        return new Error("Property `" + propFullName + "` of component `" + componentName + "` has " + "invalid PropType notation.");
      } else {
        var error = createObservableTypeCheckerCreator(allowNativeType, "Array")(props, propName, componentName, location, propFullName);
        if (error instanceof Error) return error;
        var propValue = props[propName];

        for (var i = 0; i < propValue.length; i++) {
          error = typeChecker.apply(void 0, [propValue, i, componentName, location, propFullName + "[" + i + "]"].concat(rest));
          if (error instanceof Error) return error;
        }

        return null;
      }
    });
  });
}

var observableArray = /*#__PURE__*/createObservableTypeCheckerCreator(false, "Array");
var observableArrayOf = /*#__PURE__*/createObservableArrayOfTypeChecker.bind(null, false);
var observableMap = /*#__PURE__*/createObservableTypeCheckerCreator(false, "Map");
var observableObject = /*#__PURE__*/createObservableTypeCheckerCreator(false, "Object");
var arrayOrObservableArray = /*#__PURE__*/createObservableTypeCheckerCreator(true, "Array");
var arrayOrObservableArrayOf = /*#__PURE__*/createObservableArrayOfTypeChecker.bind(null, true);
var objectOrObservableObject = /*#__PURE__*/createObservableTypeCheckerCreator(true, "Object");
var PropTypes = {
  observableArray: observableArray,
  observableArrayOf: observableArrayOf,
  observableMap: observableMap,
  observableObject: observableObject,
  arrayOrObservableArray: arrayOrObservableArray,
  arrayOrObservableArrayOf: arrayOrObservableArrayOf,
  objectOrObservableObject: objectOrObservableObject
};

if (!react.Component) throw new Error("mobx-react requires React to be available");
if (!mobx_esm/* observable */.LO) throw new Error("mobx-react requires mobx to be available");




/***/ }),

/***/ 34682:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";
/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */



var ReactPropTypesSecret = __webpack_require__(53666);

function emptyFunction() {}
function emptyFunctionWithReset() {}
emptyFunctionWithReset.resetWarningCache = emptyFunction;

module.exports = function() {
  function shim(props, propName, componentName, location, propFullName, secret) {
    if (secret === ReactPropTypesSecret) {
      // It is still safe when called from React.
      return;
    }
    var err = new Error(
      'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
      'Use PropTypes.checkPropTypes() to call them. ' +
      'Read more at http://fb.me/use-check-prop-types'
    );
    err.name = 'Invariant Violation';
    throw err;
  };
  shim.isRequired = shim;
  function getShim() {
    return shim;
  };
  // Important!
  // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
  var ReactPropTypes = {
    array: shim,
    bigint: shim,
    bool: shim,
    func: shim,
    number: shim,
    object: shim,
    string: shim,
    symbol: shim,

    any: shim,
    arrayOf: getShim,
    element: shim,
    elementType: shim,
    instanceOf: getShim,
    node: shim,
    objectOf: getShim,
    oneOf: getShim,
    oneOfType: getShim,
    shape: getShim,
    exact: getShim,

    checkPropTypes: emptyFunctionWithReset,
    resetWarningCache: emptyFunction
  };

  ReactPropTypes.PropTypes = ReactPropTypes;

  return ReactPropTypes;
};


/***/ }),

/***/ 16891:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

if (false) { var throwOnDirectAccess, ReactIs; } else {
  // By explicitly using `prop-types` you are opting into new production behavior.
  // http://fb.me/prop-types-in-prod
  module.exports = __webpack_require__(34682)();
}


/***/ }),

/***/ 53666:
/***/ ((module) => {

"use strict";
/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */



var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';

module.exports = ReactPropTypesSecret;


/***/ }),

/***/ 59121:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "ZP": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* unused harmony exports ucs2decode, ucs2encode, decode, encode, toASCII, toUnicode */


/** Highest positive signed 32-bit float value */
const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1

/** Bootstring parameters */
const base = 36;
const tMin = 1;
const tMax = 26;
const skew = 38;
const damp = 700;
const initialBias = 72;
const initialN = 128; // 0x80
const delimiter = '-'; // '\x2D'

/** Regular expressions */
const regexPunycode = /^xn--/;
const regexNonASCII = /[^\0-\x7F]/; // Note: U+007F DEL is excluded too.
const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators

/** Error messages */
const errors = {
	'overflow': 'Overflow: input needs wider integers to process',
	'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
	'invalid-input': 'Invalid input'
};

/** Convenience shortcuts */
const baseMinusTMin = base - tMin;
const floor = Math.floor;
const stringFromCharCode = String.fromCharCode;

/*--------------------------------------------------------------------------*/

/**
 * A generic error utility function.
 * @private
 * @param {String} type The error type.
 * @returns {Error} Throws a `RangeError` with the applicable error message.
 */
function error(type) {
	throw new RangeError(errors[type]);
}

/**
 * A generic `Array#map` utility function.
 * @private
 * @param {Array} array The array to iterate over.
 * @param {Function} callback The function that gets called for every array
 * item.
 * @returns {Array} A new array of values returned by the callback function.
 */
function map(array, callback) {
	const result = [];
	let length = array.length;
	while (length--) {
		result[length] = callback(array[length]);
	}
	return result;
}

/**
 * A simple `Array#map`-like wrapper to work with domain name strings or email
 * addresses.
 * @private
 * @param {String} domain The domain name or email address.
 * @param {Function} callback The function that gets called for every
 * character.
 * @returns {String} A new string of characters returned by the callback
 * function.
 */
function mapDomain(domain, callback) {
	const parts = domain.split('@');
	let result = '';
	if (parts.length > 1) {
		// In email addresses, only the domain name should be punycoded. Leave
		// the local part (i.e. everything up to `@`) intact.
		result = parts[0] + '@';
		domain = parts[1];
	}
	// Avoid `split(regex)` for IE8 compatibility. See #17.
	domain = domain.replace(regexSeparators, '\x2E');
	const labels = domain.split('.');
	const encoded = map(labels, callback).join('.');
	return result + encoded;
}

/**
 * Creates an array containing the numeric code points of each Unicode
 * character in the string. While JavaScript uses UCS-2 internally,
 * this function will convert a pair of surrogate halves (each of which
 * UCS-2 exposes as separate characters) into a single code point,
 * matching UTF-16.
 * @see `punycode.ucs2.encode`
 * @see <https://mathiasbynens.be/notes/javascript-encoding>
 * @memberOf punycode.ucs2
 * @name decode
 * @param {String} string The Unicode input string (UCS-2).
 * @returns {Array} The new array of code points.
 */
function ucs2decode(string) {
	const output = [];
	let counter = 0;
	const length = string.length;
	while (counter < length) {
		const value = string.charCodeAt(counter++);
		if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
			// It's a high surrogate, and there is a next character.
			const extra = string.charCodeAt(counter++);
			if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.
				output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
			} else {
				// It's an unmatched surrogate; only append this code unit, in case the
				// next code unit is the high surrogate of a surrogate pair.
				output.push(value);
				counter--;
			}
		} else {
			output.push(value);
		}
	}
	return output;
}

/**
 * Creates a string based on an array of numeric code points.
 * @see `punycode.ucs2.decode`
 * @memberOf punycode.ucs2
 * @name encode
 * @param {Array} codePoints The array of numeric code points.
 * @returns {String} The new Unicode string (UCS-2).
 */
const ucs2encode = codePoints => String.fromCodePoint(...codePoints);

/**
 * Converts a basic code point into a digit/integer.
 * @see `digitToBasic()`
 * @private
 * @param {Number} codePoint The basic numeric code point value.
 * @returns {Number} The numeric value of a basic code point (for use in
 * representing integers) in the range `0` to `base - 1`, or `base` if
 * the code point does not represent a value.
 */
const basicToDigit = function(codePoint) {
	if (codePoint >= 0x30 && codePoint < 0x3A) {
		return 26 + (codePoint - 0x30);
	}
	if (codePoint >= 0x41 && codePoint < 0x5B) {
		return codePoint - 0x41;
	}
	if (codePoint >= 0x61 && codePoint < 0x7B) {
		return codePoint - 0x61;
	}
	return base;
};

/**
 * Converts a digit/integer into a basic code point.
 * @see `basicToDigit()`
 * @private
 * @param {Number} digit The numeric value of a basic code point.
 * @returns {Number} The basic code point whose value (when used for
 * representing integers) is `digit`, which needs to be in the range
 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
 * used; else, the lowercase form is used. The behavior is undefined
 * if `flag` is non-zero and `digit` has no uppercase form.
 */
const digitToBasic = function(digit, flag) {
	//  0..25 map to ASCII a..z or A..Z
	// 26..35 map to ASCII 0..9
	return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
};

/**
 * Bias adaptation function as per section 3.4 of RFC 3492.
 * https://tools.ietf.org/html/rfc3492#section-3.4
 * @private
 */
const adapt = function(delta, numPoints, firstTime) {
	let k = 0;
	delta = firstTime ? floor(delta / damp) : delta >> 1;
	delta += floor(delta / numPoints);
	for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
		delta = floor(delta / baseMinusTMin);
	}
	return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
};

/**
 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
 * symbols.
 * @memberOf punycode
 * @param {String} input The Punycode string of ASCII-only symbols.
 * @returns {String} The resulting string of Unicode symbols.
 */
const decode = function(input) {
	// Don't use UCS-2.
	const output = [];
	const inputLength = input.length;
	let i = 0;
	let n = initialN;
	let bias = initialBias;

	// Handle the basic code points: let `basic` be the number of input code
	// points before the last delimiter, or `0` if there is none, then copy
	// the first basic code points to the output.

	let basic = input.lastIndexOf(delimiter);
	if (basic < 0) {
		basic = 0;
	}

	for (let j = 0; j < basic; ++j) {
		// if it's not a basic code point
		if (input.charCodeAt(j) >= 0x80) {
			error('not-basic');
		}
		output.push(input.charCodeAt(j));
	}

	// Main decoding loop: start just after the last delimiter if any basic code
	// points were copied; start at the beginning otherwise.

	for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {

		// `index` is the index of the next character to be consumed.
		// Decode a generalized variable-length integer into `delta`,
		// which gets added to `i`. The overflow checking is easier
		// if we increase `i` as we go, then subtract off its starting
		// value at the end to obtain `delta`.
		const oldi = i;
		for (let w = 1, k = base; /* no condition */; k += base) {

			if (index >= inputLength) {
				error('invalid-input');
			}

			const digit = basicToDigit(input.charCodeAt(index++));

			if (digit >= base) {
				error('invalid-input');
			}
			if (digit > floor((maxInt - i) / w)) {
				error('overflow');
			}

			i += digit * w;
			const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);

			if (digit < t) {
				break;
			}

			const baseMinusT = base - t;
			if (w > floor(maxInt / baseMinusT)) {
				error('overflow');
			}

			w *= baseMinusT;

		}

		const out = output.length + 1;
		bias = adapt(i - oldi, out, oldi == 0);

		// `i` was supposed to wrap around from `out` to `0`,
		// incrementing `n` each time, so we'll fix that now:
		if (floor(i / out) > maxInt - n) {
			error('overflow');
		}

		n += floor(i / out);
		i %= out;

		// Insert `n` at position `i` of the output.
		output.splice(i++, 0, n);

	}

	return String.fromCodePoint(...output);
};

/**
 * Converts a string of Unicode symbols (e.g. a domain name label) to a
 * Punycode string of ASCII-only symbols.
 * @memberOf punycode
 * @param {String} input The string of Unicode symbols.
 * @returns {String} The resulting Punycode string of ASCII-only symbols.
 */
const encode = function(input) {
	const output = [];

	// Convert the input in UCS-2 to an array of Unicode code points.
	input = ucs2decode(input);

	// Cache the length.
	const inputLength = input.length;

	// Initialize the state.
	let n = initialN;
	let delta = 0;
	let bias = initialBias;

	// Handle the basic code points.
	for (const currentValue of input) {
		if (currentValue < 0x80) {
			output.push(stringFromCharCode(currentValue));
		}
	}

	const basicLength = output.length;
	let handledCPCount = basicLength;

	// `handledCPCount` is the number of code points that have been handled;
	// `basicLength` is the number of basic code points.

	// Finish the basic string with a delimiter unless it's empty.
	if (basicLength) {
		output.push(delimiter);
	}

	// Main encoding loop:
	while (handledCPCount < inputLength) {

		// All non-basic code points < n have been handled already. Find the next
		// larger one:
		let m = maxInt;
		for (const currentValue of input) {
			if (currentValue >= n && currentValue < m) {
				m = currentValue;
			}
		}

		// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
		// but guard against overflow.
		const handledCPCountPlusOne = handledCPCount + 1;
		if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
			error('overflow');
		}

		delta += (m - n) * handledCPCountPlusOne;
		n = m;

		for (const currentValue of input) {
			if (currentValue < n && ++delta > maxInt) {
				error('overflow');
			}
			if (currentValue === n) {
				// Represent delta as a generalized variable-length integer.
				let q = delta;
				for (let k = base; /* no condition */; k += base) {
					const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
					if (q < t) {
						break;
					}
					const qMinusT = q - t;
					const baseMinusT = base - t;
					output.push(
						stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
					);
					q = floor(qMinusT / baseMinusT);
				}

				output.push(stringFromCharCode(digitToBasic(q, 0)));
				bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
				delta = 0;
				++handledCPCount;
			}
		}

		++delta;
		++n;

	}
	return output.join('');
};

/**
 * Converts a Punycode string representing a domain name or an email address
 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
 * it doesn't matter if you call it on a string that has already been
 * converted to Unicode.
 * @memberOf punycode
 * @param {String} input The Punycoded domain name or email address to
 * convert to Unicode.
 * @returns {String} The Unicode representation of the given Punycode
 * string.
 */
const toUnicode = function(input) {
	return mapDomain(input, function(string) {
		return regexPunycode.test(string)
			? decode(string.slice(4).toLowerCase())
			: string;
	});
};

/**
 * Converts a Unicode string representing a domain name or an email address to
 * Punycode. Only the non-ASCII parts of the domain name will be converted,
 * i.e. it doesn't matter if you call it with a domain that's already in
 * ASCII.
 * @memberOf punycode
 * @param {String} input The domain name or email address to convert, as a
 * Unicode string.
 * @returns {String} The Punycode representation of the given domain name or
 * email address.
 */
const toASCII = function(input) {
	return mapDomain(input, function(string) {
		return regexNonASCII.test(string)
			? 'xn--' + encode(string)
			: string;
	});
};

/*--------------------------------------------------------------------------*/

/** Define the public API */
const punycode = {
	/**
	 * A string representing the current Punycode.js version number.
	 * @memberOf punycode
	 * @type String
	 */
	'version': '2.3.1',
	/**
	 * An object of methods to convert from JavaScript's internal character
	 * representation (UCS-2) to Unicode code points, and back.
	 * @see <https://mathiasbynens.be/notes/javascript-encoding>
	 * @memberOf punycode
	 * @type Object
	 */
	'ucs2': {
		'decode': ucs2decode,
		'encode': ucs2encode
	},
	'decode': decode,
	'encode': encode,
	'toASCII': toASCII,
	'toUnicode': toUnicode
};


/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (punycode);


/***/ }),

/***/ 9995:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "polyfill": () => (/* binding */ polyfill)
/* harmony export */ });
/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

function componentWillMount() {
  // Call this.constructor.gDSFP to support sub-classes.
  var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
  if (state !== null && state !== undefined) {
    this.setState(state);
  }
}

function componentWillReceiveProps(nextProps) {
  // Call this.constructor.gDSFP to support sub-classes.
  // Use the setState() updater to ensure state isn't stale in certain edge cases.
  function updater(prevState) {
    var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
    return state !== null && state !== undefined ? state : null;
  }
  // Binding "this" is important for shallow renderer support.
  this.setState(updater.bind(this));
}

function componentWillUpdate(nextProps, nextState) {
  try {
    var prevProps = this.props;
    var prevState = this.state;
    this.props = nextProps;
    this.state = nextState;
    this.__reactInternalSnapshotFlag = true;
    this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
      prevProps,
      prevState
    );
  } finally {
    this.props = prevProps;
    this.state = prevState;
  }
}

// React may warn about cWM/cWRP/cWU methods being deprecated.
// Add a flag to suppress these warnings for this special case.
componentWillMount.__suppressDeprecationWarning = true;
componentWillReceiveProps.__suppressDeprecationWarning = true;
componentWillUpdate.__suppressDeprecationWarning = true;

function polyfill(Component) {
  var prototype = Component.prototype;

  if (!prototype || !prototype.isReactComponent) {
    throw new Error('Can only polyfill class components');
  }

  if (
    typeof Component.getDerivedStateFromProps !== 'function' &&
    typeof prototype.getSnapshotBeforeUpdate !== 'function'
  ) {
    return Component;
  }

  // If new component APIs are defined, "unsafe" lifecycles won't be called.
  // Error if any of these lifecycles are present,
  // Because they would work differently between older and newer (16.3+) versions of React.
  var foundWillMountName = null;
  var foundWillReceivePropsName = null;
  var foundWillUpdateName = null;
  if (typeof prototype.componentWillMount === 'function') {
    foundWillMountName = 'componentWillMount';
  } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
    foundWillMountName = 'UNSAFE_componentWillMount';
  }
  if (typeof prototype.componentWillReceiveProps === 'function') {
    foundWillReceivePropsName = 'componentWillReceiveProps';
  } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
    foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
  }
  if (typeof prototype.componentWillUpdate === 'function') {
    foundWillUpdateName = 'componentWillUpdate';
  } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
    foundWillUpdateName = 'UNSAFE_componentWillUpdate';
  }
  if (
    foundWillMountName !== null ||
    foundWillReceivePropsName !== null ||
    foundWillUpdateName !== null
  ) {
    var componentName = Component.displayName || Component.name;
    var newApiName =
      typeof Component.getDerivedStateFromProps === 'function'
        ? 'getDerivedStateFromProps()'
        : 'getSnapshotBeforeUpdate()';

    throw Error(
      'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
        componentName +
        ' uses ' +
        newApiName +
        ' but also contains the following legacy lifecycles:' +
        (foundWillMountName !== null ? '\n  ' + foundWillMountName : '') +
        (foundWillReceivePropsName !== null
          ? '\n  ' + foundWillReceivePropsName
          : '') +
        (foundWillUpdateName !== null ? '\n  ' + foundWillUpdateName : '') +
        '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' +
        'https://fb.me/react-async-component-lifecycle-hooks'
    );
  }

  // React <= 16.2 does not support static getDerivedStateFromProps.
  // As a workaround, use cWM and cWRP to invoke the new static lifecycle.
  // Newer versions of React will ignore these lifecycles if gDSFP exists.
  if (typeof Component.getDerivedStateFromProps === 'function') {
    prototype.componentWillMount = componentWillMount;
    prototype.componentWillReceiveProps = componentWillReceiveProps;
  }

  // React <= 16.2 does not support getSnapshotBeforeUpdate.
  // As a workaround, use cWU to invoke the new lifecycle.
  // Newer versions of React will ignore that lifecycle if gSBU exists.
  if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
    if (typeof prototype.componentDidUpdate !== 'function') {
      throw new Error(
        'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'
      );
    }

    prototype.componentWillUpdate = componentWillUpdate;

    var componentDidUpdate = prototype.componentDidUpdate;

    prototype.componentDidUpdate = function componentDidUpdatePolyfill(
      prevProps,
      prevState,
      maybeSnapshot
    ) {
      // 16.3+ will not execute our will-update method;
      // It will pass a snapshot value to did-update though.
      // Older versions will require our polyfilled will-update value.
      // We need to handle both cases, but can't just check for the presence of "maybeSnapshot",
      // Because for <= 15.x versions this might be a "prevContext" object.
      // We also can't just check "__reactInternalSnapshot",
      // Because get-snapshot might return a falsy value.
      // So check for the explicit __reactInternalSnapshotFlag flag to determine behavior.
      var snapshot = this.__reactInternalSnapshotFlag
        ? this.__reactInternalSnapshot
        : maybeSnapshot;

      componentDidUpdate.call(this, prevProps, prevState, snapshot);
    };
  }

  return Component;
}




/***/ }),

/***/ 29763:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";


Object.defineProperty(exports, "__esModule", ({
  value: true
}));
exports.bodyOpenClassName = exports.portalClassName = undefined;

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = __webpack_require__(70654);

var _react2 = _interopRequireDefault(_react);

var _reactDom = __webpack_require__(75940);

var _reactDom2 = _interopRequireDefault(_reactDom);

var _propTypes = __webpack_require__(16891);

var _propTypes2 = _interopRequireDefault(_propTypes);

var _ModalPortal = __webpack_require__(6179);

var _ModalPortal2 = _interopRequireDefault(_ModalPortal);

var _ariaAppHider = __webpack_require__(54530);

var ariaAppHider = _interopRequireWildcard(_ariaAppHider);

var _safeHTMLElement = __webpack_require__(62640);

var _safeHTMLElement2 = _interopRequireDefault(_safeHTMLElement);

var _reactLifecyclesCompat = __webpack_require__(9995);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var portalClassName = exports.portalClassName = "ReactModalPortal";
var bodyOpenClassName = exports.bodyOpenClassName = "ReactModal__Body--open";

var isReact16 = _safeHTMLElement.canUseDOM && _reactDom2.default.createPortal !== undefined;

var createHTMLElement = function createHTMLElement(name) {
  return document.createElement(name);
};

var getCreatePortal = function getCreatePortal() {
  return isReact16 ? _reactDom2.default.createPortal : _reactDom2.default.unstable_renderSubtreeIntoContainer;
};

function getParentElement(parentSelector) {
  return parentSelector();
}

var Modal = function (_Component) {
  _inherits(Modal, _Component);

  function Modal() {
    var _ref;

    var _temp, _this, _ret;

    _classCallCheck(this, Modal);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Modal.__proto__ || Object.getPrototypeOf(Modal)).call.apply(_ref, [this].concat(args))), _this), _this.removePortal = function () {
      !isReact16 && _reactDom2.default.unmountComponentAtNode(_this.node);
      var parent = getParentElement(_this.props.parentSelector);
      if (parent && parent.contains(_this.node)) {
        parent.removeChild(_this.node);
      } else {
        // eslint-disable-next-line no-console
        console.warn('React-Modal: "parentSelector" prop did not returned any DOM ' + "element. Make sure that the parent element is unmounted to " + "avoid any memory leaks.");
      }
    }, _this.portalRef = function (ref) {
      _this.portal = ref;
    }, _this.renderPortal = function (props) {
      var createPortal = getCreatePortal();
      var portal = createPortal(_this, _react2.default.createElement(_ModalPortal2.default, _extends({ defaultStyles: Modal.defaultStyles }, props)), _this.node);
      _this.portalRef(portal);
    }, _temp), _possibleConstructorReturn(_this, _ret);
  }

  _createClass(Modal, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      if (!_safeHTMLElement.canUseDOM) return;

      if (!isReact16) {
        this.node = createHTMLElement("div");
      }
      this.node.className = this.props.portalClassName;

      var parent = getParentElement(this.props.parentSelector);
      parent.appendChild(this.node);

      !isReact16 && this.renderPortal(this.props);
    }
  }, {
    key: "getSnapshotBeforeUpdate",
    value: function getSnapshotBeforeUpdate(prevProps) {
      var prevParent = getParentElement(prevProps.parentSelector);
      var nextParent = getParentElement(this.props.parentSelector);
      return { prevParent: prevParent, nextParent: nextParent };
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, _, snapshot) {
      if (!_safeHTMLElement.canUseDOM) return;
      var _props = this.props,
          isOpen = _props.isOpen,
          portalClassName = _props.portalClassName;


      if (prevProps.portalClassName !== portalClassName) {
        this.node.className = portalClassName;
      }

      var prevParent = snapshot.prevParent,
          nextParent = snapshot.nextParent;

      if (nextParent !== prevParent) {
        prevParent.removeChild(this.node);
        nextParent.appendChild(this.node);
      }

      // Stop unnecessary renders if modal is remaining closed
      if (!prevProps.isOpen && !isOpen) return;

      !isReact16 && this.renderPortal(this.props);
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      if (!_safeHTMLElement.canUseDOM || !this.node || !this.portal) return;

      var state = this.portal.state;
      var now = Date.now();
      var closesAt = state.isOpen && this.props.closeTimeoutMS && (state.closesAt || now + this.props.closeTimeoutMS);

      if (closesAt) {
        if (!state.beforeClose) {
          this.portal.closeWithTimeout();
        }

        setTimeout(this.removePortal, closesAt - now);
      } else {
        this.removePortal();
      }
    }
  }, {
    key: "render",
    value: function render() {
      if (!_safeHTMLElement.canUseDOM || !isReact16) {
        return null;
      }

      if (!this.node && isReact16) {
        this.node = createHTMLElement("div");
      }

      var createPortal = getCreatePortal();
      return createPortal(_react2.default.createElement(_ModalPortal2.default, _extends({
        ref: this.portalRef,
        defaultStyles: Modal.defaultStyles
      }, this.props)), this.node);
    }
  }], [{
    key: "setAppElement",
    value: function setAppElement(element) {
      ariaAppHider.setElement(element);
    }

    /* eslint-disable react/no-unused-prop-types */

    /* eslint-enable react/no-unused-prop-types */

  }]);

  return Modal;
}(_react.Component);

Modal.propTypes = {
  isOpen: _propTypes2.default.bool.isRequired,
  style: _propTypes2.default.shape({
    content: _propTypes2.default.object,
    overlay: _propTypes2.default.object
  }),
  portalClassName: _propTypes2.default.string,
  bodyOpenClassName: _propTypes2.default.string,
  htmlOpenClassName: _propTypes2.default.string,
  className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({
    base: _propTypes2.default.string.isRequired,
    afterOpen: _propTypes2.default.string.isRequired,
    beforeClose: _propTypes2.default.string.isRequired
  })]),
  overlayClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({
    base: _propTypes2.default.string.isRequired,
    afterOpen: _propTypes2.default.string.isRequired,
    beforeClose: _propTypes2.default.string.isRequired
  })]),
  appElement: _propTypes2.default.oneOfType([_propTypes2.default.instanceOf(_safeHTMLElement2.default), _propTypes2.default.instanceOf(_safeHTMLElement.SafeHTMLCollection), _propTypes2.default.instanceOf(_safeHTMLElement.SafeNodeList), _propTypes2.default.arrayOf(_propTypes2.default.instanceOf(_safeHTMLElement2.default))]),
  onAfterOpen: _propTypes2.default.func,
  onRequestClose: _propTypes2.default.func,
  closeTimeoutMS: _propTypes2.default.number,
  ariaHideApp: _propTypes2.default.bool,
  shouldFocusAfterRender: _propTypes2.default.bool,
  shouldCloseOnOverlayClick: _propTypes2.default.bool,
  shouldReturnFocusAfterClose: _propTypes2.default.bool,
  preventScroll: _propTypes2.default.bool,
  parentSelector: _propTypes2.default.func,
  aria: _propTypes2.default.object,
  data: _propTypes2.default.object,
  role: _propTypes2.default.string,
  contentLabel: _propTypes2.default.string,
  shouldCloseOnEsc: _propTypes2.default.bool,
  overlayRef: _propTypes2.default.func,
  contentRef: _propTypes2.default.func,
  id: _propTypes2.default.string,
  overlayElement: _propTypes2.default.func,
  contentElement: _propTypes2.default.func
};
Modal.defaultProps = {
  isOpen: false,
  portalClassName: portalClassName,
  bodyOpenClassName: bodyOpenClassName,
  role: "dialog",
  ariaHideApp: true,
  closeTimeoutMS: 0,
  shouldFocusAfterRender: true,
  shouldCloseOnEsc: true,
  shouldCloseOnOverlayClick: true,
  shouldReturnFocusAfterClose: true,
  preventScroll: false,
  parentSelector: function parentSelector() {
    return document.body;
  },
  overlayElement: function overlayElement(props, contentEl) {
    return _react2.default.createElement(
      "div",
      props,
      contentEl
    );
  },
  contentElement: function contentElement(props, children) {
    return _react2.default.createElement(
      "div",
      props,
      children
    );
  }
};
Modal.defaultStyles = {
  overlay: {
    position: "fixed",
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    backgroundColor: "rgba(255, 255, 255, 0.75)"
  },
  content: {
    position: "absolute",
    top: "40px",
    left: "40px",
    right: "40px",
    bottom: "40px",
    border: "1px solid #ccc",
    background: "#fff",
    overflow: "auto",
    WebkitOverflowScrolling: "touch",
    borderRadius: "4px",
    outline: "none",
    padding: "20px"
  }
};


(0, _reactLifecyclesCompat.polyfill)(Modal);

if (false) {}

exports["default"] = Modal;

/***/ }),

/***/ 6179:
/***/ ((module, exports, __webpack_require__) => {

"use strict";


Object.defineProperty(exports, "__esModule", ({
  value: true
}));

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = __webpack_require__(70654);

var _propTypes = __webpack_require__(16891);

var _propTypes2 = _interopRequireDefault(_propTypes);

var _focusManager = __webpack_require__(26555);

var focusManager = _interopRequireWildcard(_focusManager);

var _scopeTab = __webpack_require__(57577);

var _scopeTab2 = _interopRequireDefault(_scopeTab);

var _ariaAppHider = __webpack_require__(54530);

var ariaAppHider = _interopRequireWildcard(_ariaAppHider);

var _classList = __webpack_require__(93170);

var classList = _interopRequireWildcard(_classList);

var _safeHTMLElement = __webpack_require__(62640);

var _safeHTMLElement2 = _interopRequireDefault(_safeHTMLElement);

var _portalOpenInstances = __webpack_require__(18451);

var _portalOpenInstances2 = _interopRequireDefault(_portalOpenInstances);

__webpack_require__(91873);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

// so that our CSS is statically analyzable
var CLASS_NAMES = {
  overlay: "ReactModal__Overlay",
  content: "ReactModal__Content"
};

/**
 * We need to support the deprecated `KeyboardEvent.keyCode` in addition to
 * `KeyboardEvent.code` for apps that still support IE11. Can be removed when
 * `react-modal` only supports React >18 (which dropped IE support).
 */
var isTabKey = function isTabKey(event) {
  return event.code === "Tab" || event.keyCode === 9;
};
var isEscKey = function isEscKey(event) {
  return event.code === "Escape" || event.keyCode === 27;
};

var ariaHiddenInstances = 0;

var ModalPortal = function (_Component) {
  _inherits(ModalPortal, _Component);

  function ModalPortal(props) {
    _classCallCheck(this, ModalPortal);

    var _this = _possibleConstructorReturn(this, (ModalPortal.__proto__ || Object.getPrototypeOf(ModalPortal)).call(this, props));

    _this.setOverlayRef = function (overlay) {
      _this.overlay = overlay;
      _this.props.overlayRef && _this.props.overlayRef(overlay);
    };

    _this.setContentRef = function (content) {
      _this.content = content;
      _this.props.contentRef && _this.props.contentRef(content);
    };

    _this.afterClose = function () {
      var _this$props = _this.props,
          appElement = _this$props.appElement,
          ariaHideApp = _this$props.ariaHideApp,
          htmlOpenClassName = _this$props.htmlOpenClassName,
          bodyOpenClassName = _this$props.bodyOpenClassName,
          parentSelector = _this$props.parentSelector;


      var parentDocument = parentSelector && parentSelector().ownerDocument || document;

      // Remove classes.
      bodyOpenClassName && classList.remove(parentDocument.body, bodyOpenClassName);

      htmlOpenClassName && classList.remove(parentDocument.getElementsByTagName("html")[0], htmlOpenClassName);

      // Reset aria-hidden attribute if all modals have been removed
      if (ariaHideApp && ariaHiddenInstances > 0) {
        ariaHiddenInstances -= 1;

        if (ariaHiddenInstances === 0) {
          ariaAppHider.show(appElement);
        }
      }

      if (_this.props.shouldFocusAfterRender) {
        if (_this.props.shouldReturnFocusAfterClose) {
          focusManager.returnFocus(_this.props.preventScroll);
          focusManager.teardownScopedFocus();
        } else {
          focusManager.popWithoutFocus();
        }
      }

      if (_this.props.onAfterClose) {
        _this.props.onAfterClose();
      }

      _portalOpenInstances2.default.deregister(_this);
    };

    _this.open = function () {
      _this.beforeOpen();
      if (_this.state.afterOpen && _this.state.beforeClose) {
        clearTimeout(_this.closeTimer);
        _this.setState({ beforeClose: false });
      } else {
        if (_this.props.shouldFocusAfterRender) {
          focusManager.setupScopedFocus(_this.node);
          focusManager.markForFocusLater();
        }

        _this.setState({ isOpen: true }, function () {
          _this.openAnimationFrame = requestAnimationFrame(function () {
            _this.setState({ afterOpen: true });

            if (_this.props.isOpen && _this.props.onAfterOpen) {
              _this.props.onAfterOpen({
                overlayEl: _this.overlay,
                contentEl: _this.content
              });
            }
          });
        });
      }
    };

    _this.close = function () {
      if (_this.props.closeTimeoutMS > 0) {
        _this.closeWithTimeout();
      } else {
        _this.closeWithoutTimeout();
      }
    };

    _this.focusContent = function () {
      return _this.content && !_this.contentHasFocus() && _this.content.focus({ preventScroll: true });
    };

    _this.closeWithTimeout = function () {
      var closesAt = Date.now() + _this.props.closeTimeoutMS;
      _this.setState({ beforeClose: true, closesAt: closesAt }, function () {
        _this.closeTimer = setTimeout(_this.closeWithoutTimeout, _this.state.closesAt - Date.now());
      });
    };

    _this.closeWithoutTimeout = function () {
      _this.setState({
        beforeClose: false,
        isOpen: false,
        afterOpen: false,
        closesAt: null
      }, _this.afterClose);
    };

    _this.handleKeyDown = function (event) {
      if (isTabKey(event)) {
        (0, _scopeTab2.default)(_this.content, event);
      }

      if (_this.props.shouldCloseOnEsc && isEscKey(event)) {
        event.stopPropagation();
        _this.requestClose(event);
      }
    };

    _this.handleOverlayOnClick = function (event) {
      if (_this.shouldClose === null) {
        _this.shouldClose = true;
      }

      if (_this.shouldClose && _this.props.shouldCloseOnOverlayClick) {
        if (_this.ownerHandlesClose()) {
          _this.requestClose(event);
        } else {
          _this.focusContent();
        }
      }
      _this.shouldClose = null;
    };

    _this.handleContentOnMouseUp = function () {
      _this.shouldClose = false;
    };

    _this.handleOverlayOnMouseDown = function (event) {
      if (!_this.props.shouldCloseOnOverlayClick && event.target == _this.overlay) {
        event.preventDefault();
      }
    };

    _this.handleContentOnClick = function () {
      _this.shouldClose = false;
    };

    _this.handleContentOnMouseDown = function () {
      _this.shouldClose = false;
    };

    _this.requestClose = function (event) {
      return _this.ownerHandlesClose() && _this.props.onRequestClose(event);
    };

    _this.ownerHandlesClose = function () {
      return _this.props.onRequestClose;
    };

    _this.shouldBeClosed = function () {
      return !_this.state.isOpen && !_this.state.beforeClose;
    };

    _this.contentHasFocus = function () {
      return document.activeElement === _this.content || _this.content.contains(document.activeElement);
    };

    _this.buildClassName = function (which, additional) {
      var classNames = (typeof additional === "undefined" ? "undefined" : _typeof(additional)) === "object" ? additional : {
        base: CLASS_NAMES[which],
        afterOpen: CLASS_NAMES[which] + "--after-open",
        beforeClose: CLASS_NAMES[which] + "--before-close"
      };
      var className = classNames.base;
      if (_this.state.afterOpen) {
        className = className + " " + classNames.afterOpen;
      }
      if (_this.state.beforeClose) {
        className = className + " " + classNames.beforeClose;
      }
      return typeof additional === "string" && additional ? className + " " + additional : className;
    };

    _this.attributesFromObject = function (prefix, items) {
      return Object.keys(items).reduce(function (acc, name) {
        acc[prefix + "-" + name] = items[name];
        return acc;
      }, {});
    };

    _this.state = {
      afterOpen: false,
      beforeClose: false
    };

    _this.shouldClose = null;
    _this.moveFromContentToOverlay = null;
    return _this;
  }

  _createClass(ModalPortal, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      if (this.props.isOpen) {
        this.open();
      }
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      if (false) {}

      if (this.props.isOpen && !prevProps.isOpen) {
        this.open();
      } else if (!this.props.isOpen && prevProps.isOpen) {
        this.close();
      }

      // Focus only needs to be set once when the modal is being opened
      if (this.props.shouldFocusAfterRender && this.state.isOpen && !prevState.isOpen) {
        this.focusContent();
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      if (this.state.isOpen) {
        this.afterClose();
      }
      clearTimeout(this.closeTimer);
      cancelAnimationFrame(this.openAnimationFrame);
    }
  }, {
    key: "beforeOpen",
    value: function beforeOpen() {
      var _props = this.props,
          appElement = _props.appElement,
          ariaHideApp = _props.ariaHideApp,
          htmlOpenClassName = _props.htmlOpenClassName,
          bodyOpenClassName = _props.bodyOpenClassName,
          parentSelector = _props.parentSelector;


      var parentDocument = parentSelector && parentSelector().ownerDocument || document;

      // Add classes.
      bodyOpenClassName && classList.add(parentDocument.body, bodyOpenClassName);

      htmlOpenClassName && classList.add(parentDocument.getElementsByTagName("html")[0], htmlOpenClassName);

      if (ariaHideApp) {
        ariaHiddenInstances += 1;
        ariaAppHider.hide(appElement);
      }

      _portalOpenInstances2.default.register(this);
    }

    // Don't steal focus from inner elements

  }, {
    key: "render",
    value: function render() {
      var _props2 = this.props,
          id = _props2.id,
          className = _props2.className,
          overlayClassName = _props2.overlayClassName,
          defaultStyles = _props2.defaultStyles,
          children = _props2.children;

      var contentStyles = className ? {} : defaultStyles.content;
      var overlayStyles = overlayClassName ? {} : defaultStyles.overlay;

      if (this.shouldBeClosed()) {
        return null;
      }

      var overlayProps = {
        ref: this.setOverlayRef,
        className: this.buildClassName("overlay", overlayClassName),
        style: _extends({}, overlayStyles, this.props.style.overlay),
        onClick: this.handleOverlayOnClick,
        onMouseDown: this.handleOverlayOnMouseDown
      };

      var contentProps = _extends({
        id: id,
        ref: this.setContentRef,
        style: _extends({}, contentStyles, this.props.style.content),
        className: this.buildClassName("content", className),
        tabIndex: "-1",
        onKeyDown: this.handleKeyDown,
        onMouseDown: this.handleContentOnMouseDown,
        onMouseUp: this.handleContentOnMouseUp,
        onClick: this.handleContentOnClick,
        role: this.props.role,
        "aria-label": this.props.contentLabel
      }, this.attributesFromObject("aria", _extends({ modal: true }, this.props.aria)), this.attributesFromObject("data", this.props.data || {}), {
        "data-testid": this.props.testId
      });

      var contentElement = this.props.contentElement(contentProps, children);
      return this.props.overlayElement(overlayProps, contentElement);
    }
  }]);

  return ModalPortal;
}(_react.Component);

ModalPortal.defaultProps = {
  style: {
    overlay: {},
    content: {}
  },
  defaultStyles: {}
};
ModalPortal.propTypes = {
  isOpen: _propTypes2.default.bool.isRequired,
  defaultStyles: _propTypes2.default.shape({
    content: _propTypes2.default.object,
    overlay: _propTypes2.default.object
  }),
  style: _propTypes2.default.shape({
    content: _propTypes2.default.object,
    overlay: _propTypes2.default.object
  }),
  className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),
  overlayClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),
  parentSelector: _propTypes2.default.func,
  bodyOpenClassName: _propTypes2.default.string,
  htmlOpenClassName: _propTypes2.default.string,
  ariaHideApp: _propTypes2.default.bool,
  appElement: _propTypes2.default.oneOfType([_propTypes2.default.instanceOf(_safeHTMLElement2.default), _propTypes2.default.instanceOf(_safeHTMLElement.SafeHTMLCollection), _propTypes2.default.instanceOf(_safeHTMLElement.SafeNodeList), _propTypes2.default.arrayOf(_propTypes2.default.instanceOf(_safeHTMLElement2.default))]),
  onAfterOpen: _propTypes2.default.func,
  onAfterClose: _propTypes2.default.func,
  onRequestClose: _propTypes2.default.func,
  closeTimeoutMS: _propTypes2.default.number,
  shouldFocusAfterRender: _propTypes2.default.bool,
  shouldCloseOnOverlayClick: _propTypes2.default.bool,
  shouldReturnFocusAfterClose: _propTypes2.default.bool,
  preventScroll: _propTypes2.default.bool,
  role: _propTypes2.default.string,
  contentLabel: _propTypes2.default.string,
  aria: _propTypes2.default.object,
  data: _propTypes2.default.object,
  children: _propTypes2.default.node,
  shouldCloseOnEsc: _propTypes2.default.bool,
  overlayRef: _propTypes2.default.func,
  contentRef: _propTypes2.default.func,
  id: _propTypes2.default.string,
  overlayElement: _propTypes2.default.func,
  contentElement: _propTypes2.default.func,
  testId: _propTypes2.default.string
};
exports["default"] = ModalPortal;
module.exports = exports["default"];

/***/ }),

/***/ 54530:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";


Object.defineProperty(exports, "__esModule", ({
  value: true
}));
exports.resetState = resetState;
exports.log = log;
exports.assertNodeList = assertNodeList;
exports.setElement = setElement;
exports.validateElement = validateElement;
exports.hide = hide;
exports.show = show;
exports.documentNotReadyOrSSRTesting = documentNotReadyOrSSRTesting;

var _warning = __webpack_require__(49486);

var _warning2 = _interopRequireDefault(_warning);

var _safeHTMLElement = __webpack_require__(62640);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var globalElement = null;

/* eslint-disable no-console */
/* istanbul ignore next */
function resetState() {
  if (globalElement) {
    if (globalElement.removeAttribute) {
      globalElement.removeAttribute("aria-hidden");
    } else if (globalElement.length != null) {
      globalElement.forEach(function (element) {
        return element.removeAttribute("aria-hidden");
      });
    } else {
      document.querySelectorAll(globalElement).forEach(function (element) {
        return element.removeAttribute("aria-hidden");
      });
    }
  }
  globalElement = null;
}

/* istanbul ignore next */
function log() {
  if (false) { var check; }
}
/* eslint-enable no-console */

function assertNodeList(nodeList, selector) {
  if (!nodeList || !nodeList.length) {
    throw new Error("react-modal: No elements were found for selector " + selector + ".");
  }
}

function setElement(element) {
  var useElement = element;
  if (typeof useElement === "string" && _safeHTMLElement.canUseDOM) {
    var el = document.querySelectorAll(useElement);
    assertNodeList(el, useElement);
    useElement = el;
  }
  globalElement = useElement || globalElement;
  return globalElement;
}

function validateElement(appElement) {
  var el = appElement || globalElement;
  if (el) {
    return Array.isArray(el) || el instanceof HTMLCollection || el instanceof NodeList ? el : [el];
  } else {
    (0, _warning2.default)(false, ["react-modal: App element is not defined.", "Please use `Modal.setAppElement(el)` or set `appElement={el}`.", "This is needed so screen readers don't see main content", "when modal is opened. It is not recommended, but you can opt-out", "by setting `ariaHideApp={false}`."].join(" "));

    return [];
  }
}

function hide(appElement) {
  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = validateElement(appElement)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var el = _step.value;

      el.setAttribute("aria-hidden", "true");
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }
}

function show(appElement) {
  var _iteratorNormalCompletion2 = true;
  var _didIteratorError2 = false;
  var _iteratorError2 = undefined;

  try {
    for (var _iterator2 = validateElement(appElement)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
      var el = _step2.value;

      el.removeAttribute("aria-hidden");
    }
  } catch (err) {
    _didIteratorError2 = true;
    _iteratorError2 = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion2 && _iterator2.return) {
        _iterator2.return();
      }
    } finally {
      if (_didIteratorError2) {
        throw _iteratorError2;
      }
    }
  }
}

function documentNotReadyOrSSRTesting() {
  globalElement = null;
}

/***/ }),

/***/ 91873:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";


Object.defineProperty(exports, "__esModule", ({
  value: true
}));
exports.resetState = resetState;
exports.log = log;

var _portalOpenInstances = __webpack_require__(18451);

var _portalOpenInstances2 = _interopRequireDefault(_portalOpenInstances);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Body focus trap see Issue #742

var before = void 0,
    after = void 0,
    instances = [];

/* eslint-disable no-console */
/* istanbul ignore next */
function resetState() {
  var _arr = [before, after];

  for (var _i = 0; _i < _arr.length; _i++) {
    var item = _arr[_i];
    if (!item) continue;
    item.parentNode && item.parentNode.removeChild(item);
  }
  before = after = null;
  instances = [];
}

/* istanbul ignore next */
function log() {
  console.log("bodyTrap ----------");
  console.log(instances.length);
  var _arr2 = [before, after];
  for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
    var item = _arr2[_i2];
    var check = item || {};
    console.log(check.nodeName, check.className, check.id);
  }
  console.log("edn bodyTrap ----------");
}
/* eslint-enable no-console */

function focusContent() {
  if (instances.length === 0) {
    if (false) {}
    return;
  }
  instances[instances.length - 1].focusContent();
}

function bodyTrap(eventType, openInstances) {
  if (!before && !after) {
    before = document.createElement("div");
    before.setAttribute("data-react-modal-body-trap", "");
    before.style.position = "absolute";
    before.style.opacity = "0";
    before.setAttribute("tabindex", "0");
    before.addEventListener("focus", focusContent);
    after = before.cloneNode();
    after.addEventListener("focus", focusContent);
  }

  instances = openInstances;

  if (instances.length > 0) {
    // Add focus trap
    if (document.body.firstChild !== before) {
      document.body.insertBefore(before, document.body.firstChild);
    }
    if (document.body.lastChild !== after) {
      document.body.appendChild(after);
    }
  } else {
    // Remove focus trap
    if (before.parentElement) {
      before.parentElement.removeChild(before);
    }
    if (after.parentElement) {
      after.parentElement.removeChild(after);
    }
  }
}

_portalOpenInstances2.default.subscribe(bodyTrap);

/***/ }),

/***/ 93170:
/***/ ((__unused_webpack_module, exports) => {

"use strict";


Object.defineProperty(exports, "__esModule", ({
  value: true
}));
exports.resetState = resetState;
exports.log = log;
var htmlClassList = {};
var docBodyClassList = {};

/* eslint-disable no-console */
/* istanbul ignore next */
function removeClass(at, cls) {
  at.classList.remove(cls);
}

/* istanbul ignore next */
function resetState() {
  var htmlElement = document.getElementsByTagName("html")[0];
  for (var cls in htmlClassList) {
    removeClass(htmlElement, htmlClassList[cls]);
  }

  var body = document.body;
  for (var _cls in docBodyClassList) {
    removeClass(body, docBodyClassList[_cls]);
  }

  htmlClassList = {};
  docBodyClassList = {};
}

/* istanbul ignore next */
function log() {
  if (false) { var _x, x, buffer, classes; }
}
/* eslint-enable no-console */

/**
 * Track the number of reference of a class.
 * @param {object} poll The poll to receive the reference.
 * @param {string} className The class name.
 * @return {string}
 */
var incrementReference = function incrementReference(poll, className) {
  if (!poll[className]) {
    poll[className] = 0;
  }
  poll[className] += 1;
  return className;
};

/**
 * Drop the reference of a class.
 * @param {object} poll The poll to receive the reference.
 * @param {string} className The class name.
 * @return {string}
 */
var decrementReference = function decrementReference(poll, className) {
  if (poll[className]) {
    poll[className] -= 1;
  }
  return className;
};

/**
 * Track a class and add to the given class list.
 * @param {Object} classListRef A class list of an element.
 * @param {Object} poll         The poll to be used.
 * @param {Array}  classes      The list of classes to be tracked.
 */
var trackClass = function trackClass(classListRef, poll, classes) {
  classes.forEach(function (className) {
    incrementReference(poll, className);
    classListRef.add(className);
  });
};

/**
 * Untrack a class and remove from the given class list if the reference
 * reaches 0.
 * @param {Object} classListRef A class list of an element.
 * @param {Object} poll         The poll to be used.
 * @param {Array}  classes      The list of classes to be untracked.
 */
var untrackClass = function untrackClass(classListRef, poll, classes) {
  classes.forEach(function (className) {
    decrementReference(poll, className);
    poll[className] === 0 && classListRef.remove(className);
  });
};

/**
 * Public inferface to add classes to the document.body.
 * @param {string} bodyClass The class string to be added.
 *                           It may contain more then one class
 *                           with ' ' as separator.
 */
var add = exports.add = function add(element, classString) {
  return trackClass(element.classList, element.nodeName.toLowerCase() == "html" ? htmlClassList : docBodyClassList, classString.split(" "));
};

/**
 * Public inferface to remove classes from the document.body.
 * @param {string} bodyClass The class string to be added.
 *                           It may contain more then one class
 *                           with ' ' as separator.
 */
var remove = exports.remove = function remove(element, classString) {
  return untrackClass(element.classList, element.nodeName.toLowerCase() == "html" ? htmlClassList : docBodyClassList, classString.split(" "));
};

/***/ }),

/***/ 26555:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";


Object.defineProperty(exports, "__esModule", ({
  value: true
}));
exports.resetState = resetState;
exports.log = log;
exports.handleBlur = handleBlur;
exports.handleFocus = handleFocus;
exports.markForFocusLater = markForFocusLater;
exports.returnFocus = returnFocus;
exports.popWithoutFocus = popWithoutFocus;
exports.setupScopedFocus = setupScopedFocus;
exports.teardownScopedFocus = teardownScopedFocus;

var _tabbable = __webpack_require__(11282);

var _tabbable2 = _interopRequireDefault(_tabbable);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var focusLaterElements = [];
var modalElement = null;
var needToFocus = false;

/* eslint-disable no-console */
/* istanbul ignore next */
function resetState() {
  focusLaterElements = [];
}

/* istanbul ignore next */
function log() {
  if (false) {}
}
/* eslint-enable no-console */

function handleBlur() {
  needToFocus = true;
}

function handleFocus() {
  if (needToFocus) {
    needToFocus = false;
    if (!modalElement) {
      return;
    }
    // need to see how jQuery shims document.on('focusin') so we don't need the
    // setTimeout, firefox doesn't support focusin, if it did, we could focus
    // the element outside of a setTimeout. Side-effect of this implementation
    // is that the document.body gets focus, and then we focus our element right
    // after, seems fine.
    setTimeout(function () {
      if (modalElement.contains(document.activeElement)) {
        return;
      }
      var el = (0, _tabbable2.default)(modalElement)[0] || modalElement;
      el.focus();
    }, 0);
  }
}

function markForFocusLater() {
  focusLaterElements.push(document.activeElement);
}

/* eslint-disable no-console */
function returnFocus() {
  var preventScroll = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

  var toFocus = null;
  try {
    if (focusLaterElements.length !== 0) {
      toFocus = focusLaterElements.pop();
      toFocus.focus({ preventScroll: preventScroll });
    }
    return;
  } catch (e) {
    console.warn(["You tried to return focus to", toFocus, "but it is not in the DOM anymore"].join(" "));
  }
}
/* eslint-enable no-console */

function popWithoutFocus() {
  focusLaterElements.length > 0 && focusLaterElements.pop();
}

function setupScopedFocus(element) {
  modalElement = element;

  if (window.addEventListener) {
    window.addEventListener("blur", handleBlur, false);
    document.addEventListener("focus", handleFocus, true);
  } else {
    window.attachEvent("onBlur", handleBlur);
    document.attachEvent("onFocus", handleFocus);
  }
}

function teardownScopedFocus() {
  modalElement = null;

  if (window.addEventListener) {
    window.removeEventListener("blur", handleBlur);
    document.removeEventListener("focus", handleFocus);
  } else {
    window.detachEvent("onBlur", handleBlur);
    document.detachEvent("onFocus", handleFocus);
  }
}

/***/ }),

/***/ 18451:
/***/ ((__unused_webpack_module, exports) => {

"use strict";


Object.defineProperty(exports, "__esModule", ({
  value: true
}));
exports.log = log;
exports.resetState = resetState;

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

// Tracks portals that are open and emits events to subscribers

var PortalOpenInstances = function PortalOpenInstances() {
  var _this = this;

  _classCallCheck(this, PortalOpenInstances);

  this.register = function (openInstance) {
    if (_this.openInstances.indexOf(openInstance) !== -1) {
      if (false) {}
      return;
    }
    _this.openInstances.push(openInstance);
    _this.emit("register");
  };

  this.deregister = function (openInstance) {
    var index = _this.openInstances.indexOf(openInstance);
    if (index === -1) {
      if (false) {}
      return;
    }
    _this.openInstances.splice(index, 1);
    _this.emit("deregister");
  };

  this.subscribe = function (callback) {
    _this.subscribers.push(callback);
  };

  this.emit = function (eventType) {
    _this.subscribers.forEach(function (subscriber) {
      return subscriber(eventType,
      // shallow copy to avoid accidental mutation
      _this.openInstances.slice());
    });
  };

  this.openInstances = [];
  this.subscribers = [];
};

var portalOpenInstances = new PortalOpenInstances();

/* eslint-disable no-console */
/* istanbul ignore next */
function log() {
  console.log("portalOpenInstances ----------");
  console.log(portalOpenInstances.openInstances.length);
  portalOpenInstances.openInstances.forEach(function (p) {
    return console.log(p);
  });
  console.log("end portalOpenInstances ----------");
}

/* istanbul ignore next */
function resetState() {
  portalOpenInstances = new PortalOpenInstances();
}
/* eslint-enable no-console */

exports["default"] = portalOpenInstances;

/***/ }),

/***/ 62640:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";


Object.defineProperty(exports, "__esModule", ({
  value: true
}));
exports.canUseDOM = exports.SafeNodeList = exports.SafeHTMLCollection = undefined;

var _exenv = __webpack_require__(50284);

var _exenv2 = _interopRequireDefault(_exenv);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var EE = _exenv2.default;

var SafeHTMLElement = EE.canUseDOM ? window.HTMLElement : {};

var SafeHTMLCollection = exports.SafeHTMLCollection = EE.canUseDOM ? window.HTMLCollection : {};

var SafeNodeList = exports.SafeNodeList = EE.canUseDOM ? window.NodeList : {};

var canUseDOM = exports.canUseDOM = EE.canUseDOM;

exports["default"] = SafeHTMLElement;

/***/ }),

/***/ 57577:
/***/ ((module, exports, __webpack_require__) => {

"use strict";


Object.defineProperty(exports, "__esModule", ({
  value: true
}));
exports["default"] = scopeTab;

var _tabbable = __webpack_require__(11282);

var _tabbable2 = _interopRequireDefault(_tabbable);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function getActiveElement() {
  var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;

  return el.activeElement.shadowRoot ? getActiveElement(el.activeElement.shadowRoot) : el.activeElement;
}

function scopeTab(node, event) {
  var tabbable = (0, _tabbable2.default)(node);

  if (!tabbable.length) {
    // Do nothing, since there are no elements that can receive focus.
    event.preventDefault();
    return;
  }

  var target = void 0;

  var shiftKey = event.shiftKey;
  var head = tabbable[0];
  var tail = tabbable[tabbable.length - 1];
  var activeElement = getActiveElement();

  // proceed with default browser behavior on tab.
  // Focus on last element on shift + tab.
  if (node === activeElement) {
    if (!shiftKey) return;
    target = tail;
  }

  if (tail === activeElement && !shiftKey) {
    target = head;
  }

  if (head === activeElement && shiftKey) {
    target = tail;
  }

  if (target) {
    event.preventDefault();
    target.focus();
    return;
  }

  // Safari radio issue.
  //
  // Safari does not move the focus to the radio button,
  // so we need to force it to really walk through all elements.
  //
  // This is very error prone, since we are trying to guess
  // if it is a safari browser from the first occurence between
  // chrome or safari.
  //
  // The chrome user agent contains the first ocurrence
  // as the 'chrome/version' and later the 'safari/version'.
  var checkSafari = /(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);
  var isSafariDesktop = checkSafari != null && checkSafari[1] != "Chrome" && /\biPod\b|\biPad\b/g.exec(navigator.userAgent) == null;

  // If we are not in safari desktop, let the browser control
  // the focus
  if (!isSafariDesktop) return;

  var x = tabbable.indexOf(activeElement);

  if (x > -1) {
    x += shiftKey ? -1 : 1;
  }

  target = tabbable[x];

  // If the tabbable element does not exist,
  // focus head/tail based on shiftKey
  if (typeof target === "undefined") {
    event.preventDefault();
    target = shiftKey ? tail : head;
    target.focus();
    return;
  }

  event.preventDefault();

  target.focus();
}
module.exports = exports["default"];

/***/ }),

/***/ 11282:
/***/ ((module, exports) => {

"use strict";


Object.defineProperty(exports, "__esModule", ({
  value: true
}));
exports["default"] = findTabbableDescendants;
/*!
 * Adapted from jQuery UI core
 *
 * http://jqueryui.com
 *
 * Copyright 2014 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/category/ui-core/
 */

var DISPLAY_NONE = "none";
var DISPLAY_CONTENTS = "contents";

var tabbableNode = /input|select|textarea|button|object|iframe/;

function isNotOverflowing(element, style) {
  return style.getPropertyValue("overflow") !== "visible" ||
  // if 'overflow: visible' set, check if there is actually any overflow
  element.scrollWidth <= 0 && element.scrollHeight <= 0;
}

function hidesContents(element) {
  var zeroSize = element.offsetWidth <= 0 && element.offsetHeight <= 0;

  // If the node is empty, this is good enough
  if (zeroSize && !element.innerHTML) return true;

  try {
    // Otherwise we need to check some styles
    var style = window.getComputedStyle(element);
    var displayValue = style.getPropertyValue("display");
    return zeroSize ? displayValue !== DISPLAY_CONTENTS && isNotOverflowing(element, style) : displayValue === DISPLAY_NONE;
  } catch (exception) {
    // eslint-disable-next-line no-console
    console.warn("Failed to inspect element style");
    return false;
  }
}

function visible(element) {
  var parentElement = element;
  var rootNode = element.getRootNode && element.getRootNode();
  while (parentElement) {
    if (parentElement === document.body) break;

    // if we are not hidden yet, skip to checking outside the Web Component
    if (rootNode && parentElement === rootNode) parentElement = rootNode.host.parentNode;

    if (hidesContents(parentElement)) return false;
    parentElement = parentElement.parentNode;
  }
  return true;
}

function focusable(element, isTabIndexNotNaN) {
  var nodeName = element.nodeName.toLowerCase();
  var res = tabbableNode.test(nodeName) && !element.disabled || (nodeName === "a" ? element.href || isTabIndexNotNaN : isTabIndexNotNaN);
  return res && visible(element);
}

function tabbable(element) {
  var tabIndex = element.getAttribute("tabindex");
  if (tabIndex === null) tabIndex = undefined;
  var isTabIndexNaN = isNaN(tabIndex);
  return (isTabIndexNaN || tabIndex >= 0) && focusable(element, !isTabIndexNaN);
}

function findTabbableDescendants(element) {
  var descendants = [].slice.call(element.querySelectorAll("*"), 0).reduce(function (finished, el) {
    return finished.concat(!el.shadowRoot ? [el] : findTabbableDescendants(el.shadowRoot));
  }, []);
  return descendants.filter(tabbable);
}
module.exports = exports["default"];

/***/ }),

/***/ 34936:
/***/ ((module, exports, __webpack_require__) => {

"use strict";


Object.defineProperty(exports, "__esModule", ({
  value: true
}));

var _Modal = __webpack_require__(29763);

var _Modal2 = _interopRequireDefault(_Modal);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports["default"] = _Modal2.default;
module.exports = exports["default"];

/***/ }),

/***/ 2829:
/***/ ((module) => {

"use strict";


var stylesInDOM = [];
function getIndexByIdentifier(identifier) {
  var result = -1;
  for (var i = 0; i < stylesInDOM.length; i++) {
    if (stylesInDOM[i].identifier === identifier) {
      result = i;
      break;
    }
  }
  return result;
}
function modulesToDom(list, options) {
  var idCountMap = {};
  var identifiers = [];
  for (var i = 0; i < list.length; i++) {
    var item = list[i];
    var id = options.base ? item[0] + options.base : item[0];
    var count = idCountMap[id] || 0;
    var identifier = "".concat(id, " ").concat(count);
    idCountMap[id] = count + 1;
    var indexByIdentifier = getIndexByIdentifier(identifier);
    var obj = {
      css: item[1],
      media: item[2],
      sourceMap: item[3],
      supports: item[4],
      layer: item[5]
    };
    if (indexByIdentifier !== -1) {
      stylesInDOM[indexByIdentifier].references++;
      stylesInDOM[indexByIdentifier].updater(obj);
    } else {
      var updater = addElementStyle(obj, options);
      options.byIndex = i;
      stylesInDOM.splice(i, 0, {
        identifier: identifier,
        updater: updater,
        references: 1
      });
    }
    identifiers.push(identifier);
  }
  return identifiers;
}
function addElementStyle(obj, options) {
  var api = options.domAPI(options);
  api.update(obj);
  var updater = function updater(newObj) {
    if (newObj) {
      if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {
        return;
      }
      api.update(obj = newObj);
    } else {
      api.remove();
    }
  };
  return updater;
}
module.exports = function (list, options) {
  options = options || {};
  list = list || [];
  var lastIdentifiers = modulesToDom(list, options);
  return function update(newList) {
    newList = newList || [];
    for (var i = 0; i < lastIdentifiers.length; i++) {
      var identifier = lastIdentifiers[i];
      var index = getIndexByIdentifier(identifier);
      stylesInDOM[index].references--;
    }
    var newLastIdentifiers = modulesToDom(newList, options);
    for (var _i = 0; _i < lastIdentifiers.length; _i++) {
      var _identifier = lastIdentifiers[_i];
      var _index = getIndexByIdentifier(_identifier);
      if (stylesInDOM[_index].references === 0) {
        stylesInDOM[_index].updater();
        stylesInDOM.splice(_index, 1);
      }
    }
    lastIdentifiers = newLastIdentifiers;
  };
};

/***/ }),

/***/ 29927:
/***/ ((module) => {

"use strict";


var memo = {};

/* istanbul ignore next  */
function getTarget(target) {
  if (typeof memo[target] === "undefined") {
    var styleTarget = document.querySelector(target);

    // Special case to return head of iframe instead of iframe itself
    if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
      try {
        // This will throw an exception if access to iframe is blocked
        // due to cross-origin restrictions
        styleTarget = styleTarget.contentDocument.head;
      } catch (e) {
        // istanbul ignore next
        styleTarget = null;
      }
    }
    memo[target] = styleTarget;
  }
  return memo[target];
}

/* istanbul ignore next  */
function insertBySelector(insert, style) {
  var target = getTarget(insert);
  if (!target) {
    throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
  }
  target.appendChild(style);
}
module.exports = insertBySelector;

/***/ }),

/***/ 53062:
/***/ ((module) => {

"use strict";


/* istanbul ignore next  */
function insertStyleElement(options) {
  var element = document.createElement("style");
  options.setAttributes(element, options.attributes);
  options.insert(element, options.options);
  return element;
}
module.exports = insertStyleElement;

/***/ }),

/***/ 68323:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


/* istanbul ignore next  */
function setAttributesWithoutAttributes(styleElement) {
  var nonce =  true ? __webpack_require__.nc : 0;
  if (nonce) {
    styleElement.setAttribute("nonce", nonce);
  }
}
module.exports = setAttributesWithoutAttributes;

/***/ }),

/***/ 65281:
/***/ ((module) => {

"use strict";


/* istanbul ignore next  */
function apply(styleElement, options, obj) {
  var css = "";
  if (obj.supports) {
    css += "@supports (".concat(obj.supports, ") {");
  }
  if (obj.media) {
    css += "@media ".concat(obj.media, " {");
  }
  var needLayer = typeof obj.layer !== "undefined";
  if (needLayer) {
    css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {");
  }
  css += obj.css;
  if (needLayer) {
    css += "}";
  }
  if (obj.media) {
    css += "}";
  }
  if (obj.supports) {
    css += "}";
  }
  var sourceMap = obj.sourceMap;
  if (sourceMap && typeof btoa !== "undefined") {
    css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
  }

  // For old IE
  /* istanbul ignore if  */
  options.styleTagTransform(css, styleElement, options.options);
}
function removeStyleElement(styleElement) {
  // istanbul ignore if
  if (styleElement.parentNode === null) {
    return false;
  }
  styleElement.parentNode.removeChild(styleElement);
}

/* istanbul ignore next  */
function domAPI(options) {
  if (typeof document === "undefined") {
    return {
      update: function update() {},
      remove: function remove() {}
    };
  }
  var styleElement = options.insertStyleElement(options);
  return {
    update: function update(obj) {
      apply(styleElement, options, obj);
    },
    remove: function remove() {
      removeStyleElement(styleElement);
    }
  };
}
module.exports = domAPI;

/***/ }),

/***/ 84051:
/***/ ((module) => {

"use strict";


/* istanbul ignore next  */
function styleTagTransform(css, styleElement) {
  if (styleElement.styleSheet) {
    styleElement.styleSheet.cssText = css;
  } else {
    while (styleElement.firstChild) {
      styleElement.removeChild(styleElement.firstChild);
    }
    styleElement.appendChild(document.createTextNode(css));
  }
}
module.exports = styleTagTransform;

/***/ }),

/***/ 51218:
/***/ (function(module, exports, __webpack_require__) {

var __WEBPACK_AMD_DEFINE_RESULT__;/////////////////////////////////////////////////////////////////////////////////
/* UAParser.js v1.0.36
   Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
   MIT License *//*
   Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
   Supports browser & node.js environment. 
   Demo   : https://faisalman.github.io/ua-parser-js
   Source : https://github.com/faisalman/ua-parser-js */
/////////////////////////////////////////////////////////////////////////////////

(function (window, undefined) {

    'use strict';

    //////////////
    // Constants
    /////////////


    var LIBVERSION  = '1.0.36',
        EMPTY       = '',
        UNKNOWN     = '?',
        FUNC_TYPE   = 'function',
        UNDEF_TYPE  = 'undefined',
        OBJ_TYPE    = 'object',
        STR_TYPE    = 'string',
        MAJOR       = 'major',
        MODEL       = 'model',
        NAME        = 'name',
        TYPE        = 'type',
        VENDOR      = 'vendor',
        VERSION     = 'version',
        ARCHITECTURE= 'architecture',
        CONSOLE     = 'console',
        MOBILE      = 'mobile',
        TABLET      = 'tablet',
        SMARTTV     = 'smarttv',
        WEARABLE    = 'wearable',
        EMBEDDED    = 'embedded',
        UA_MAX_LENGTH = 350;

    var AMAZON  = 'Amazon',
        APPLE   = 'Apple',
        ASUS    = 'ASUS',
        BLACKBERRY = 'BlackBerry',
        BROWSER = 'Browser',
        CHROME  = 'Chrome',
        EDGE    = 'Edge',
        FIREFOX = 'Firefox',
        GOOGLE  = 'Google',
        HUAWEI  = 'Huawei',
        LG      = 'LG',
        MICROSOFT = 'Microsoft',
        MOTOROLA  = 'Motorola',
        OPERA   = 'Opera',
        SAMSUNG = 'Samsung',
        SHARP   = 'Sharp',
        SONY    = 'Sony',
        VIERA   = 'Viera',
        XIAOMI  = 'Xiaomi',
        ZEBRA   = 'Zebra',
        FACEBOOK    = 'Facebook',
        CHROMIUM_OS = 'Chromium OS',
        MAC_OS  = 'Mac OS';

    ///////////
    // Helper
    //////////

    var extend = function (regexes, extensions) {
            var mergedRegexes = {};
            for (var i in regexes) {
                if (extensions[i] && extensions[i].length % 2 === 0) {
                    mergedRegexes[i] = extensions[i].concat(regexes[i]);
                } else {
                    mergedRegexes[i] = regexes[i];
                }
            }
            return mergedRegexes;
        },
        enumerize = function (arr) {
            var enums = {};
            for (var i=0; i<arr.length; i++) {
                enums[arr[i].toUpperCase()] = arr[i];
            }
            return enums;
        },
        has = function (str1, str2) {
            return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;
        },
        lowerize = function (str) {
            return str.toLowerCase();
        },
        majorize = function (version) {
            return typeof(version) === STR_TYPE ? version.replace(/[^\d\.]/g, EMPTY).split('.')[0] : undefined;
        },
        trim = function (str, len) {
            if (typeof(str) === STR_TYPE) {
                str = str.replace(/^\s\s*/, EMPTY);
                return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
            }
    };

    ///////////////
    // Map helper
    //////////////

    var rgxMapper = function (ua, arrays) {

            var i = 0, j, k, p, q, matches, match;

            // loop through all regexes maps
            while (i < arrays.length && !matches) {

                var regex = arrays[i],       // even sequence (0,2,4,..)
                    props = arrays[i + 1];   // odd sequence (1,3,5,..)
                j = k = 0;

                // try matching uastring with regexes
                while (j < regex.length && !matches) {

                    if (!regex[j]) { break; }
                    matches = regex[j++].exec(ua);

                    if (!!matches) {
                        for (p = 0; p < props.length; p++) {
                            match = matches[++k];
                            q = props[p];
                            // check if given property is actually array
                            if (typeof q === OBJ_TYPE && q.length > 0) {
                                if (q.length === 2) {
                                    if (typeof q[1] == FUNC_TYPE) {
                                        // assign modified match
                                        this[q[0]] = q[1].call(this, match);
                                    } else {
                                        // assign given value, ignore regex match
                                        this[q[0]] = q[1];
                                    }
                                } else if (q.length === 3) {
                                    // check whether function or regex
                                    if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {
                                        // call function (usually string mapper)
                                        this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
                                    } else {
                                        // sanitize match using given regex
                                        this[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
                                    }
                                } else if (q.length === 4) {
                                        this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
                                }
                            } else {
                                this[q] = match ? match : undefined;
                            }
                        }
                    }
                }
                i += 2;
            }
        },

        strMapper = function (str, map) {

            for (var i in map) {
                // check if current value is array
                if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {
                    for (var j = 0; j < map[i].length; j++) {
                        if (has(map[i][j], str)) {
                            return (i === UNKNOWN) ? undefined : i;
                        }
                    }
                } else if (has(map[i], str)) {
                    return (i === UNKNOWN) ? undefined : i;
                }
            }
            return str;
    };

    ///////////////
    // String map
    //////////////

    // Safari < 3.0
    var oldSafariMap = {
            '1.0'   : '/8',
            '1.2'   : '/1',
            '1.3'   : '/3',
            '2.0'   : '/412',
            '2.0.2' : '/416',
            '2.0.3' : '/417',
            '2.0.4' : '/419',
            '?'     : '/'
        },
        windowsVersionMap = {
            'ME'        : '4.90',
            'NT 3.11'   : 'NT3.51',
            'NT 4.0'    : 'NT4.0',
            '2000'      : 'NT 5.0',
            'XP'        : ['NT 5.1', 'NT 5.2'],
            'Vista'     : 'NT 6.0',
            '7'         : 'NT 6.1',
            '8'         : 'NT 6.2',
            '8.1'       : 'NT 6.3',
            '10'        : ['NT 6.4', 'NT 10.0'],
            'RT'        : 'ARM'
    };

    //////////////
    // Regex map
    /////////////

    var regexes = {

        browser : [[

            /\b(?:crmo|crios)\/([\w\.]+)/i                                      // Chrome for Android/iOS
            ], [VERSION, [NAME, 'Chrome']], [
            /edg(?:e|ios|a)?\/([\w\.]+)/i                                       // Microsoft Edge
            ], [VERSION, [NAME, 'Edge']], [

            // Presto based
            /(opera mini)\/([-\w\.]+)/i,                                        // Opera Mini
            /(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,                 // Opera Mobi/Tablet
            /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i                           // Opera
            ], [NAME, VERSION], [
            /opios[\/ ]+([\w\.]+)/i                                             // Opera mini on iphone >= 8.0
            ], [VERSION, [NAME, OPERA+' Mini']], [
            /\bopr\/([\w\.]+)/i                                                 // Opera Webkit
            ], [VERSION, [NAME, OPERA]], [

            // Mixed
            /(kindle)\/([\w\.]+)/i,                                             // Kindle
            /(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,      // Lunascape/Maxthon/Netfront/Jasmine/Blazer
            // Trident based
            /(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,               // Avant/IEMobile/SlimBrowser
            /(ba?idubrowser)[\/ ]?([\w\.]+)/i,                                  // Baidu Browser
            /(?:ms|\()(ie) ([\w\.]+)/i,                                         // Internet Explorer

            // Webkit/KHTML based                                               // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
            /(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,
                                                                                // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ
            /(heytap|ovi)browser\/([\d\.]+)/i,                                  // Heytap/Ovi
            /(weibo)__([\d\.]+)/i                                               // Weibo
            ], [NAME, VERSION], [
            /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i                 // UCBrowser
            ], [VERSION, [NAME, 'UC'+BROWSER]], [
            /microm.+\bqbcore\/([\w\.]+)/i,                                     // WeChat Desktop for Windows Built-in Browser
            /\bqbcore\/([\w\.]+).+microm/i
            ], [VERSION, [NAME, 'WeChat(Win) Desktop']], [
            /micromessenger\/([\w\.]+)/i                                        // WeChat
            ], [VERSION, [NAME, 'WeChat']], [
            /konqueror\/([\w\.]+)/i                                             // Konqueror
            ], [VERSION, [NAME, 'Konqueror']], [
            /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i                       // IE11
            ], [VERSION, [NAME, 'IE']], [
            /ya(?:search)?browser\/([\w\.]+)/i                                  // Yandex
            ], [VERSION, [NAME, 'Yandex']], [
            /(avast|avg)\/([\w\.]+)/i                                           // Avast/AVG Secure Browser
            ], [[NAME, /(.+)/, '$1 Secure '+BROWSER], VERSION], [
            /\bfocus\/([\w\.]+)/i                                               // Firefox Focus
            ], [VERSION, [NAME, FIREFOX+' Focus']], [
            /\bopt\/([\w\.]+)/i                                                 // Opera Touch
            ], [VERSION, [NAME, OPERA+' Touch']], [
            /coc_coc\w+\/([\w\.]+)/i                                            // Coc Coc Browser
            ], [VERSION, [NAME, 'Coc Coc']], [
            /dolfin\/([\w\.]+)/i                                                // Dolphin
            ], [VERSION, [NAME, 'Dolphin']], [
            /coast\/([\w\.]+)/i                                                 // Opera Coast
            ], [VERSION, [NAME, OPERA+' Coast']], [
            /miuibrowser\/([\w\.]+)/i                                           // MIUI Browser
            ], [VERSION, [NAME, 'MIUI '+BROWSER]], [
            /fxios\/([-\w\.]+)/i                                                // Firefox for iOS
            ], [VERSION, [NAME, FIREFOX]], [
            /\bqihu|(qi?ho?o?|360)browser/i                                     // 360
            ], [[NAME, '360 '+BROWSER]], [
            /(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i
            ], [[NAME, /(.+)/, '$1 '+BROWSER], VERSION], [                      // Oculus/Samsung/Sailfish/Huawei Browser
            /(comodo_dragon)\/([\w\.]+)/i                                       // Comodo Dragon
            ], [[NAME, /_/g, ' '], VERSION], [
            /(electron)\/([\w\.]+) safari/i,                                    // Electron-based App
            /(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,                   // Tesla
            /m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i            // QQBrowser/Baidu App/2345 Browser
            ], [NAME, VERSION], [
            /(metasr)[\/ ]?([\w\.]+)/i,                                         // SouGouBrowser
            /(lbbrowser)/i,                                                     // LieBao Browser
            /\[(linkedin)app\]/i                                                // LinkedIn App for iOS & Android
            ], [NAME], [

            // WebView
            /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i       // Facebook App for iOS & Android
            ], [[NAME, FACEBOOK], VERSION], [
            /(kakao(?:talk|story))[\/ ]([\w\.]+)/i,                             // Kakao App
            /(naver)\(.*?(\d+\.[\w\.]+).*\)/i,                                  // Naver InApp
            /safari (line)\/([\w\.]+)/i,                                        // Line App for iOS
            /\b(line)\/([\w\.]+)\/iab/i,                                        // Line App for Android
            /(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i                     // Chromium/Instagram/Snapchat
            ], [NAME, VERSION], [
            /\bgsa\/([\w\.]+) .*safari\//i                                      // Google Search Appliance on iOS
            ], [VERSION, [NAME, 'GSA']], [
            /musical_ly(?:.+app_?version\/|_)([\w\.]+)/i                        // TikTok
            ], [VERSION, [NAME, 'TikTok']], [

            /headlesschrome(?:\/([\w\.]+)| )/i                                  // Chrome Headless
            ], [VERSION, [NAME, CHROME+' Headless']], [

            / wv\).+(chrome)\/([\w\.]+)/i                                       // Chrome WebView
            ], [[NAME, CHROME+' WebView'], VERSION], [

            /droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i           // Android Browser
            ], [VERSION, [NAME, 'Android '+BROWSER]], [

            /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i       // Chrome/OmniWeb/Arora/Tizen/Nokia
            ], [NAME, VERSION], [

            /version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i                      // Mobile Safari
            ], [VERSION, [NAME, 'Mobile Safari']], [
            /version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i                // Safari & Safari Mobile
            ], [VERSION, NAME], [
            /webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i                      // Safari < 3.0
            ], [NAME, [VERSION, strMapper, oldSafariMap]], [

            /(webkit|khtml)\/([\w\.]+)/i
            ], [NAME, VERSION], [

            // Gecko based
            /(navigator|netscape\d?)\/([-\w\.]+)/i                              // Netscape
            ], [[NAME, 'Netscape'], VERSION], [
            /mobile vr; rv:([\w\.]+)\).+firefox/i                               // Firefox Reality
            ], [VERSION, [NAME, FIREFOX+' Reality']], [
            /ekiohf.+(flow)\/([\w\.]+)/i,                                       // Flow
            /(swiftfox)/i,                                                      // Swiftfox
            /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,
                                                                                // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar
            /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,
                                                                                // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
            /(firefox)\/([\w\.]+)/i,                                            // Other Firefox-based
            /(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,                         // Mozilla

            // Other
            /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
                                                                                // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser
            /(links) \(([\w\.]+)/i,                                             // Links
            /panasonic;(viera)/i                                                // Panasonic Viera
            ], [NAME, VERSION], [
            
            /(cobalt)\/([\w\.]+)/i                                              // Cobalt
            ], [NAME, [VERSION, /master.|lts./, ""]]
        ],

        cpu : [[

            /(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i                     // AMD64 (x64)
            ], [[ARCHITECTURE, 'amd64']], [

            /(ia32(?=;))/i                                                      // IA32 (quicktime)
            ], [[ARCHITECTURE, lowerize]], [

            /((?:i[346]|x)86)[;\)]/i                                            // IA32 (x86)
            ], [[ARCHITECTURE, 'ia32']], [

            /\b(aarch64|arm(v?8e?l?|_?64))\b/i                                 // ARM64
            ], [[ARCHITECTURE, 'arm64']], [

            /\b(arm(?:v[67])?ht?n?[fl]p?)\b/i                                   // ARMHF
            ], [[ARCHITECTURE, 'armhf']], [

            // PocketPC mistakenly identified as PowerPC
            /windows (ce|mobile); ppc;/i
            ], [[ARCHITECTURE, 'arm']], [

            /((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i                            // PowerPC
            ], [[ARCHITECTURE, /ower/, EMPTY, lowerize]], [

            /(sun4\w)[;\)]/i                                                    // SPARC
            ], [[ARCHITECTURE, 'sparc']], [

            /((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i
                                                                                // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
            ], [[ARCHITECTURE, lowerize]]
        ],

        device : [[

            //////////////////////////
            // MOBILES & TABLETS
            /////////////////////////

            // Samsung
            /\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i
            ], [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]], [
            /\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,
            /samsung[- ]([-\w]+)/i,
            /sec-(sgh\w+)/i
            ], [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]], [

            // Apple
            /(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i                          // iPod/iPhone
            ], [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]], [
            /\((ipad);[-\w\),; ]+apple/i,                                       // iPad
            /applecoremedia\/[\w\.]+ \((ipad)/i,
            /\b(ipad)\d\d?,\d\d?[;\]].+ios/i
            ], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [
            /(macintosh);/i
            ], [MODEL, [VENDOR, APPLE]], [

            // Sharp
            /\b(sh-?[altvz]?\d\d[a-ekm]?)/i
            ], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [

            // Huawei
            /\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i
            ], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [
            /(?:huawei|honor)([-\w ]+)[;\)]/i,
            /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i
            ], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [

            // Xiaomi
            /\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,                  // Xiaomi POCO
            /\b; (\w+) build\/hm\1/i,                                           // Xiaomi Hongmi 'numeric' models
            /\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,                             // Xiaomi Hongmi
            /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,                   // Xiaomi Redmi
            /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
            ], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [
            /\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i                        // Mi Pad tablets
            ],[[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, TABLET]], [

            // OPPO
            /; (\w+) bui.+ oppo/i,
            /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
            ], [MODEL, [VENDOR, 'OPPO'], [TYPE, MOBILE]], [

            // Vivo
            /vivo (\w+)(?: bui|\))/i,
            /\b(v[12]\d{3}\w?[at])(?: bui|;)/i
            ], [MODEL, [VENDOR, 'Vivo'], [TYPE, MOBILE]], [

            // Realme
            /\b(rmx[12]\d{3})(?: bui|;|\))/i
            ], [MODEL, [VENDOR, 'Realme'], [TYPE, MOBILE]], [

            // Motorola
            /\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,
            /\bmot(?:orola)?[- ](\w*)/i,
            /((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i
            ], [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]], [
            /\b(mz60\d|xoom[2 ]{0,2}) build\//i
            ], [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]], [

            // LG
            /((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
            ], [MODEL, [VENDOR, LG], [TYPE, TABLET]], [
            /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
            /\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,
            /\blg-?([\d\w]+) bui/i
            ], [MODEL, [VENDOR, LG], [TYPE, MOBILE]], [

            // Lenovo
            /(ideatab[-\w ]+)/i,
            /lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i
            ], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [

            // Nokia
            /(?:maemo|nokia).*(n900|lumia \d+)/i,
            /nokia[-_ ]?([-\w\.]*)/i
            ], [[MODEL, /_/g, ' '], [VENDOR, 'Nokia'], [TYPE, MOBILE]], [

            // Google
            /(pixel c)\b/i                                                      // Google Pixel C
            ], [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]], [
            /droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i                         // Google Pixel
            ], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [

            // Sony
            /droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
            ], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [
            /sony tablet [ps]/i,
            /\b(?:sony)?sgp\w+(?: bui|\))/i
            ], [[MODEL, 'Xperia Tablet'], [VENDOR, SONY], [TYPE, TABLET]], [

            // OnePlus
            / (kb2005|in20[12]5|be20[12][59])\b/i,
            /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
            ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [

            // Amazon
            /(alexa)webm/i,
            /(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,                             // Kindle Fire without Silk / Echo Show
            /(kf[a-z]+)( bui|\)).+silk\//i                                      // Kindle Fire HD
            ], [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]], [
            /((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i                     // Fire Phone
            ], [[MODEL, /(.+)/g, 'Fire Phone $1'], [VENDOR, AMAZON], [TYPE, MOBILE]], [

            // BlackBerry
            /(playbook);[-\w\),; ]+(rim)/i                                      // BlackBerry PlayBook
            ], [MODEL, VENDOR, [TYPE, TABLET]], [
            /\b((?:bb[a-f]|st[hv])100-\d)/i,
            /\(bb10; (\w+)/i                                                    // BlackBerry 10
            ], [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]], [

            // Asus
            /(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
            ], [MODEL, [VENDOR, ASUS], [TYPE, TABLET]], [
            / (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
            ], [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]], [

            // HTC
            /(nexus 9)/i                                                        // HTC Nexus 9
            ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [
            /(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,                         // HTC

            // ZTE
            /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,
            /(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i         // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
            ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [

            // Acer
            /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
            ], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [

            // Meizu
            /droid.+; (m[1-5] note) bui/i,
            /\bmz-([-\w]{2,})/i
            ], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [

            // MIXED
            /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,
                                                                                // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron
            /(hp) ([\w ]+\w)/i,                                                 // HP iPAQ
            /(asus)-?(\w+)/i,                                                   // Asus
            /(microsoft); (lumia[\w ]+)/i,                                      // Microsoft Lumia
            /(lenovo)[-_ ]?([-\w]+)/i,                                          // Lenovo
            /(jolla)/i,                                                         // Jolla
            /(oppo) ?([\w ]+) bui/i                                             // OPPO
            ], [VENDOR, MODEL, [TYPE, MOBILE]], [

            /(kobo)\s(ereader|touch)/i,                                         // Kobo
            /(archos) (gamepad2?)/i,                                            // Archos
            /(hp).+(touchpad(?!.+tablet)|tablet)/i,                             // HP TouchPad
            /(kindle)\/([\w\.]+)/i,                                             // Kindle
            /(nook)[\w ]+build\/(\w+)/i,                                        // Nook
            /(dell) (strea[kpr\d ]*[\dko])/i,                                   // Dell Streak
            /(le[- ]+pan)[- ]+(\w{1,9}) bui/i,                                  // Le Pan Tablets
            /(trinity)[- ]*(t\d{3}) bui/i,                                      // Trinity Tablets
            /(gigaset)[- ]+(q\w{1,9}) bui/i,                                    // Gigaset Tablets
            /(vodafone) ([\w ]+)(?:\)| bui)/i                                   // Vodafone
            ], [VENDOR, MODEL, [TYPE, TABLET]], [

            /(surface duo)/i                                                    // Surface Duo
            ], [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]], [
            /droid [\d\.]+; (fp\du?)(?: b|\))/i                                 // Fairphone
            ], [MODEL, [VENDOR, 'Fairphone'], [TYPE, MOBILE]], [
            /(u304aa)/i                                                         // AT&T
            ], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [
            /\bsie-(\w*)/i                                                      // Siemens
            ], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [
            /\b(rct\w+) b/i                                                     // RCA Tablets
            ], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [
            /\b(venue[\d ]{2,7}) b/i                                            // Dell Venue Tablets
            ], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [
            /\b(q(?:mv|ta)\w+) b/i                                              // Verizon Tablet
            ], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [
            /\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i                       // Barnes & Noble Tablet
            ], [MODEL, [VENDOR, 'Barnes & Noble'], [TYPE, TABLET]], [
            /\b(tm\d{3}\w+) b/i
            ], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [
            /\b(k88) b/i                                                        // ZTE K Series Tablet
            ], [MODEL, [VENDOR, 'ZTE'], [TYPE, TABLET]], [
            /\b(nx\d{3}j) b/i                                                   // ZTE Nubia
            ], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [
            /\b(gen\d{3}) b.+49h/i                                              // Swiss GEN Mobile
            ], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [
            /\b(zur\d{3}) b/i                                                   // Swiss ZUR Tablet
            ], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [
            /\b((zeki)?tb.*\b) b/i                                              // Zeki Tablets
            ], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [
            /\b([yr]\d{2}) b/i,
            /\b(dragon[- ]+touch |dt)(\w{5}) b/i                                // Dragon Touch Tablet
            ], [[VENDOR, 'Dragon Touch'], MODEL, [TYPE, TABLET]], [
            /\b(ns-?\w{0,9}) b/i                                                // Insignia Tablets
            ], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [
            /\b((nxa|next)-?\w{0,9}) b/i                                        // NextBook Tablets
            ], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [
            /\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i                  // Voice Xtreme Phones
            ], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [
            /\b(lvtel\-)?(v1[12]) b/i                                           // LvTel Phones
            ], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [
            /\b(ph-1) /i                                                        // Essential PH-1
            ], [MODEL, [VENDOR, 'Essential'], [TYPE, MOBILE]], [
            /\b(v(100md|700na|7011|917g).*\b) b/i                               // Envizen Tablets
            ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [
            /\b(trio[-\w\. ]+) b/i                                              // MachSpeed Tablets
            ], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [
            /\btu_(1491) b/i                                                    // Rotor Tablets
            ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [
            /(shield[\w ]+) b/i                                                 // Nvidia Shield Tablets
            ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, TABLET]], [
            /(sprint) (\w+)/i                                                   // Sprint Phones
            ], [VENDOR, MODEL, [TYPE, MOBILE]], [
            /(kin\.[onetw]{3})/i                                                // Microsoft Kin
            ], [[MODEL, /\./g, ' '], [VENDOR, MICROSOFT], [TYPE, MOBILE]], [
            /droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i             // Zebra
            ], [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]], [
            /droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
            ], [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]], [

            ///////////////////
            // SMARTTVS
            ///////////////////

            /smart-tv.+(samsung)/i                                              // Samsung
            ], [VENDOR, [TYPE, SMARTTV]], [
            /hbbtv.+maple;(\d+)/i
            ], [[MODEL, /^/, 'SmartTV'], [VENDOR, SAMSUNG], [TYPE, SMARTTV]], [
            /(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i        // LG SmartTV
            ], [[VENDOR, LG], [TYPE, SMARTTV]], [
            /(apple) ?tv/i                                                      // Apple TV
            ], [VENDOR, [MODEL, APPLE+' TV'], [TYPE, SMARTTV]], [
            /crkey/i                                                            // Google Chromecast
            ], [[MODEL, CHROME+'cast'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
            /droid.+aft(\w+)( bui|\))/i                                         // Fire TV
            ], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [
            /\(dtv[\);].+(aquos)/i,
            /(aquos-tv[\w ]+)\)/i                                               // Sharp
            ], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],[
            /(bravia[\w ]+)( bui|\))/i                                              // Sony
            ], [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]], [
            /(mitv-\w{5}) bui/i                                                 // Xiaomi
            ], [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]], [
            /Hbbtv.*(technisat) (.*);/i                                         // TechniSAT
            ], [VENDOR, MODEL, [TYPE, SMARTTV]], [
            /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,                          // Roku
            /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i         // HbbTV devices
            ], [[VENDOR, trim], [MODEL, trim], [TYPE, SMARTTV]], [
            /\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i                   // SmartTV from Unidentified Vendors
            ], [[TYPE, SMARTTV]], [

            ///////////////////
            // CONSOLES
            ///////////////////

            /(ouya)/i,                                                          // Ouya
            /(nintendo) ([wids3utch]+)/i                                        // Nintendo
            ], [VENDOR, MODEL, [TYPE, CONSOLE]], [
            /droid.+; (shield) bui/i                                            // Nvidia
            ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [
            /(playstation [345portablevi]+)/i                                   // Playstation
            ], [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]], [
            /\b(xbox(?: one)?(?!; xbox))[\); ]/i                                // Microsoft Xbox
            ], [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]], [

            ///////////////////
            // WEARABLES
            ///////////////////

            /((pebble))app/i                                                    // Pebble
            ], [VENDOR, MODEL, [TYPE, WEARABLE]], [
            /(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i                              // Apple Watch
            ], [MODEL, [VENDOR, APPLE], [TYPE, WEARABLE]], [
            /droid.+; (glass) \d/i                                              // Google Glass
            ], [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]], [
            /droid.+; (wt63?0{2,3})\)/i
            ], [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]], [
            /(quest( 2| pro)?)/i                                                // Oculus Quest
            ], [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]], [

            ///////////////////
            // EMBEDDED
            ///////////////////

            /(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i                              // Tesla
            ], [VENDOR, [TYPE, EMBEDDED]], [
            /(aeobc)\b/i                                                        // Echo Dot
            ], [MODEL, [VENDOR, AMAZON], [TYPE, EMBEDDED]], [

            ////////////////////
            // MIXED (GENERIC)
            ///////////////////

            /droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i           // Android Phones from Unidentified Vendors
            ], [MODEL, [TYPE, MOBILE]], [
            /droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i       // Android Tablets from Unidentified Vendors
            ], [MODEL, [TYPE, TABLET]], [
            /\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i                      // Unidentifiable Tablet
            ], [[TYPE, TABLET]], [
            /(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i    // Unidentifiable Mobile
            ], [[TYPE, MOBILE]], [
            /(android[-\w\. ]{0,9});.+buil/i                                    // Generic Android Device
            ], [MODEL, [VENDOR, 'Generic']]
        ],

        engine : [[

            /windows.+ edge\/([\w\.]+)/i                                       // EdgeHTML
            ], [VERSION, [NAME, EDGE+'HTML']], [

            /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i                         // Blink
            ], [VERSION, [NAME, 'Blink']], [

            /(presto)\/([\w\.]+)/i,                                             // Presto
            /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna
            /ekioh(flow)\/([\w\.]+)/i,                                          // Flow
            /(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,                           // KHTML/Tasman/Links
            /(icab)[\/ ]([23]\.[\d\.]+)/i,                                      // iCab
            /\b(libweb)/i
            ], [NAME, VERSION], [

            /rv\:([\w\.]{1,9})\b.+(gecko)/i                                     // Gecko
            ], [VERSION, NAME]
        ],

        os : [[

            // Windows
            /microsoft (windows) (vista|xp)/i                                   // Windows (iTunes)
            ], [NAME, VERSION], [
            /(windows) nt 6\.2; (arm)/i,                                        // Windows RT
            /(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,            // Windows Phone
            /(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i
            ], [NAME, [VERSION, strMapper, windowsVersionMap]], [
            /(win(?=3|9|n)|win 9x )([nt\d\.]+)/i
            ], [[NAME, 'Windows'], [VERSION, strMapper, windowsVersionMap]], [

            // iOS/macOS
            /ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,              // iOS
            /(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,
            /cfnetwork\/.+darwin/i
            ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [
            /(mac os x) ?([\w\. ]*)/i,
            /(macintosh|mac_powerpc\b)(?!.+haiku)/i                             // Mac OS
            ], [[NAME, MAC_OS], [VERSION, /_/g, '.']], [

            // Mobile OSes
            /droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i                    // Android-x86/HarmonyOS
            ], [VERSION, NAME], [                                               // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS
            /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,
            /(blackberry)\w*\/([\w\.]*)/i,                                      // Blackberry
            /(tizen|kaios)[\/ ]([\w\.]+)/i,                                     // Tizen/KaiOS
            /\((series40);/i                                                    // Series 40
            ], [NAME, VERSION], [
            /\(bb(10);/i                                                        // BlackBerry 10
            ], [VERSION, [NAME, BLACKBERRY]], [
            /(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i         // Symbian
            ], [VERSION, [NAME, 'Symbian']], [
            /mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS
            ], [VERSION, [NAME, FIREFOX+' OS']], [
            /web0s;.+rt(tv)/i,
            /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i                              // WebOS
            ], [VERSION, [NAME, 'webOS']], [
            /watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i                              // watchOS
            ], [VERSION, [NAME, 'watchOS']], [

            // Google Chromecast
            /crkey\/([\d\.]+)/i                                                 // Google Chromecast
            ], [VERSION, [NAME, CHROME+'cast']], [
            /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i                                  // Chromium OS
            ], [[NAME, CHROMIUM_OS], VERSION],[

            // Smart TVs
            /panasonic;(viera)/i,                                               // Panasonic Viera
            /(netrange)mmh/i,                                                   // Netrange
            /(nettv)\/(\d+\.[\w\.]+)/i,                                         // NetTV

            // Console
            /(nintendo|playstation) ([wids345portablevuch]+)/i,                 // Nintendo/Playstation
            /(xbox); +xbox ([^\);]+)/i,                                         // Microsoft Xbox (360, One, X, S, Series X, Series S)

            // Other
            /\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,                            // Joli/Palm
            /(mint)[\/\(\) ]?(\w*)/i,                                           // Mint
            /(mageia|vectorlinux)[; ]/i,                                        // Mageia/VectorLinux
            /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,
                                                                                // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire
            /(hurd|linux) ?([\w\.]*)/i,                                         // Hurd/Linux
            /(gnu) ?([\w\.]*)/i,                                                // GNU
            /\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly
            /(haiku) (\w+)/i                                                    // Haiku
            ], [NAME, VERSION], [
            /(sunos) ?([\w\.\d]*)/i                                             // Solaris
            ], [[NAME, 'Solaris'], VERSION], [
            /((?:open)?solaris)[-\/ ]?([\w\.]*)/i,                              // Solaris
            /(aix) ((\d)(?=\.|\)| )[\w\.])*/i,                                  // AIX
            /\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i, // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX/SerenityOS
            /(unix) ?([\w\.]*)/i                                                // UNIX
            ], [NAME, VERSION]
        ]
    };

    /////////////////
    // Constructor
    ////////////////

    var UAParser = function (ua, extensions) {

        if (typeof ua === OBJ_TYPE) {
            extensions = ua;
            ua = undefined;
        }

        if (!(this instanceof UAParser)) {
            return new UAParser(ua, extensions).getResult();
        }

        var _navigator = (typeof window !== UNDEF_TYPE && window.navigator) ? window.navigator : undefined;
        var _ua = ua || ((_navigator && _navigator.userAgent) ? _navigator.userAgent : EMPTY);
        var _uach = (_navigator && _navigator.userAgentData) ? _navigator.userAgentData : undefined;
        var _rgxmap = extensions ? extend(regexes, extensions) : regexes;
        var _isSelfNav = _navigator && _navigator.userAgent == _ua;

        this.getBrowser = function () {
            var _browser = {};
            _browser[NAME] = undefined;
            _browser[VERSION] = undefined;
            rgxMapper.call(_browser, _ua, _rgxmap.browser);
            _browser[MAJOR] = majorize(_browser[VERSION]);
            // Brave-specific detection
            if (_isSelfNav && _navigator && _navigator.brave && typeof _navigator.brave.isBrave == FUNC_TYPE) {
                _browser[NAME] = 'Brave';
            }
            return _browser;
        };
        this.getCPU = function () {
            var _cpu = {};
            _cpu[ARCHITECTURE] = undefined;
            rgxMapper.call(_cpu, _ua, _rgxmap.cpu);
            return _cpu;
        };
        this.getDevice = function () {
            var _device = {};
            _device[VENDOR] = undefined;
            _device[MODEL] = undefined;
            _device[TYPE] = undefined;
            rgxMapper.call(_device, _ua, _rgxmap.device);
            if (_isSelfNav && !_device[TYPE] && _uach && _uach.mobile) {
                _device[TYPE] = MOBILE;
            }
            // iPadOS-specific detection: identified as Mac, but has some iOS-only properties
            if (_isSelfNav && _device[MODEL] == 'Macintosh' && _navigator && typeof _navigator.standalone !== UNDEF_TYPE && _navigator.maxTouchPoints && _navigator.maxTouchPoints > 2) {
                _device[MODEL] = 'iPad';
                _device[TYPE] = TABLET;
            }
            return _device;
        };
        this.getEngine = function () {
            var _engine = {};
            _engine[NAME] = undefined;
            _engine[VERSION] = undefined;
            rgxMapper.call(_engine, _ua, _rgxmap.engine);
            return _engine;
        };
        this.getOS = function () {
            var _os = {};
            _os[NAME] = undefined;
            _os[VERSION] = undefined;
            rgxMapper.call(_os, _ua, _rgxmap.os);
            if (_isSelfNav && !_os[NAME] && _uach && _uach.platform != 'Unknown') {
                _os[NAME] = _uach.platform  
                                    .replace(/chrome os/i, CHROMIUM_OS)
                                    .replace(/macos/i, MAC_OS);           // backward compatibility
            }
            return _os;
        };
        this.getResult = function () {
            return {
                ua      : this.getUA(),
                browser : this.getBrowser(),
                engine  : this.getEngine(),
                os      : this.getOS(),
                device  : this.getDevice(),
                cpu     : this.getCPU()
            };
        };
        this.getUA = function () {
            return _ua;
        };
        this.setUA = function (ua) {
            _ua = (typeof ua === STR_TYPE && ua.length > UA_MAX_LENGTH) ? trim(ua, UA_MAX_LENGTH) : ua;
            return this;
        };
        this.setUA(_ua);
        return this;
    };

    UAParser.VERSION = LIBVERSION;
    UAParser.BROWSER =  enumerize([NAME, VERSION, MAJOR]);
    UAParser.CPU = enumerize([ARCHITECTURE]);
    UAParser.DEVICE = enumerize([MODEL, VENDOR, TYPE, CONSOLE, MOBILE, SMARTTV, TABLET, WEARABLE, EMBEDDED]);
    UAParser.ENGINE = UAParser.OS = enumerize([NAME, VERSION]);

    ///////////
    // Export
    //////////

    // check js environment
    if (typeof(exports) !== UNDEF_TYPE) {
        // nodejs env
        if ("object" !== UNDEF_TYPE && module.exports) {
            exports = module.exports = UAParser;
        }
        exports.UAParser = UAParser;
    } else {
        // requirejs env (optional)
        if ("function" === FUNC_TYPE && __webpack_require__.amdO) {
            !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
                return UAParser;
            }).call(exports, __webpack_require__, exports, module),
		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
        } else if (typeof window !== UNDEF_TYPE) {
            // browser env
            window.UAParser = UAParser;
        }
    }

    // jQuery/Zepto specific (optional)
    // Note:
    //   In AMD env the global scope should be kept clean, but jQuery is an exception.
    //   jQuery always exports to global scope, unless jQuery.noConflict(true) is used,
    //   and we should catch that.
    var $ = typeof window !== UNDEF_TYPE && (window.jQuery || window.Zepto);
    if ($ && !$.ua) {
        var parser = new UAParser();
        $.ua = parser.getResult();
        $.ua.get = function () {
            return parser.getUA();
        };
        $.ua.set = function (ua) {
            parser.setUA(ua);
            var result = parser.getResult();
            for (var prop in result) {
                $.ua[prop] = result[prop];
            }
        };
    }

})(typeof window === 'object' ? window : this);


/***/ }),

/***/ 20445:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";
/**
 * @license React
 * use-sync-external-store-shim.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var e=__webpack_require__(70654);function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}
function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;


/***/ }),

/***/ 5250:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";
var __webpack_unused_export__;
/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var h=__webpack_require__(70654),n=__webpack_require__(39009);function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q="function"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;
__webpack_unused_export__=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);
u(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};


/***/ }),

/***/ 39009:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


if (true) {
  module.exports = __webpack_require__(20445);
} else {}


/***/ }),

/***/ 10344:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


if (true) {
  /* unused reexport */ __webpack_require__(5250);
} else {}


/***/ }),

/***/ 49486:
/***/ ((module) => {

"use strict";
/**
 * Copyright (c) 2014-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */



/**
 * Similar to invariant but only logs a warning if the condition is not met.
 * This can be used to log issues in development environments in critical
 * paths. Removing the logging code for production environments will keep the
 * same logic and follow the same code paths.
 */

var __DEV__ = "production" !== 'production';

var warning = function() {};

if (__DEV__) {
  var printWarning = function printWarning(format, args) {
    var len = arguments.length;
    args = new Array(len > 1 ? len - 1 : 0);
    for (var key = 1; key < len; key++) {
      args[key - 1] = arguments[key];
    }
    var argIndex = 0;
    var message = 'Warning: ' +
      format.replace(/%s/g, function() {
        return args[argIndex++];
      });
    if (typeof console !== 'undefined') {
      console.error(message);
    }
    try {
      // --- Welcome to debugging React ---
      // This error was thrown as a convenience so that you can use this stack
      // to find the callsite that caused this warning to fire.
      throw new Error(message);
    } catch (x) {}
  }

  warning = function(condition, format, args) {
    var len = arguments.length;
    args = new Array(len > 2 ? len - 2 : 0);
    for (var key = 2; key < len; key++) {
      args[key - 2] = arguments[key];
    }
    if (format === undefined) {
      throw new Error(
          '`warning(condition, format, ...args)` requires a warning ' +
          'message argument'
      );
    }
    if (!condition) {
      printWarning.apply(null, [format].concat(args));
    }
  };
}

module.exports = warning;


/***/ }),

/***/ 19167:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";

// EXTERNAL MODULE: ./node_modules/.pnpm/react@17.0.2/node_modules/react/index.js
var react = __webpack_require__(70654);
// EXTERNAL MODULE: ./node_modules/.pnpm/react-dom@17.0.2_react@17.0.2/node_modules/react-dom/index.js
var react_dom = __webpack_require__(75940);
// EXTERNAL MODULE: ./Extension/src/common/translators/reactTranslator.ts
var reactTranslator = __webpack_require__(47562);
// EXTERNAL MODULE: ./Extension/src/common/translators/i18n.ts
var i18n = __webpack_require__(85242);
// EXTERNAL MODULE: ./node_modules/.pnpm/mobx-react@7.6.0_mobx@6.9.0_react-dom@17.0.2_react@17.0.2/node_modules/mobx-react/dist/mobxreact.esm.js + 14 modules
var mobxreact_esm = __webpack_require__(42166);
// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/throttle.js
var throttle = __webpack_require__(22002);
// EXTERNAL MODULE: ./node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js
var classnames = __webpack_require__(14271);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: ./Extension/src/common/translators/translator.ts
var translator = __webpack_require__(88325);
// EXTERNAL MODULE: ./node_modules/.pnpm/mobx@6.9.0/node_modules/mobx/dist/mobx.esm.js
var mobx_esm = __webpack_require__(1299);
// EXTERNAL MODULE: ./node_modules/.pnpm/core-js@3.32.0/node_modules/core-js/modules/es.array.includes.js
var es_array_includes = __webpack_require__(89718);
// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseToString.js
var _baseToString = __webpack_require__(43123);
;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSlice.js
/**
 * The base implementation of `_.slice` without an iteratee call guard.
 *
 * @private
 * @param {Array} array The array to slice.
 * @param {number} [start=0] The start position.
 * @param {number} [end=array.length] The end position.
 * @returns {Array} Returns the slice of `array`.
 */
function baseSlice(array, start, end) {
  var index = -1,
      length = array.length;

  if (start < 0) {
    start = -start > length ? 0 : (length + start);
  }
  end = end > length ? length : end;
  if (end < 0) {
    end += length;
  }
  length = start > end ? 0 : ((end - start) >>> 0);
  start >>>= 0;

  var result = Array(length);
  while (++index < length) {
    result[index] = array[index + start];
  }
  return result;
}

/* harmony default export */ const _baseSlice = (baseSlice);

;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_castSlice.js


/**
 * Casts `array` to a slice if it's needed.
 *
 * @private
 * @param {Array} array The array to inspect.
 * @param {number} start The start position.
 * @param {number} [end=array.length] The end position.
 * @returns {Array} Returns the cast slice.
 */
function castSlice(array, start, end) {
  var length = array.length;
  end = end === undefined ? length : end;
  return (!start && end >= length) ? array : _baseSlice(array, start, end);
}

/* harmony default export */ const _castSlice = (castSlice);

;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hasUnicode.js
/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
    rsComboMarksRange = '\\u0300-\\u036f',
    reComboHalfMarksRange = '\\ufe20-\\ufe2f',
    rsComboSymbolsRange = '\\u20d0-\\u20ff',
    rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
    rsVarRange = '\\ufe0e\\ufe0f';

/** Used to compose unicode capture groups. */
var rsZWJ = '\\u200d';

/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange  + rsComboRange + rsVarRange + ']');

/**
 * Checks if `string` contains Unicode symbols.
 *
 * @private
 * @param {string} string The string to inspect.
 * @returns {boolean} Returns `true` if a symbol is found, else `false`.
 */
function hasUnicode(string) {
  return reHasUnicode.test(string);
}

/* harmony default export */ const _hasUnicode = (hasUnicode);

// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js
var isObject = __webpack_require__(62893);
// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js
var _baseGetTag = __webpack_require__(85086);
// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js
var isObjectLike = __webpack_require__(95690);
;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsRegExp.js



/** `Object#toString` result references. */
var regexpTag = '[object RegExp]';

/**
 * The base implementation of `_.isRegExp` without Node.js optimizations.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
 */
function baseIsRegExp(value) {
  return (0,isObjectLike/* default */.Z)(value) && (0,_baseGetTag/* default */.Z)(value) == regexpTag;
}

/* harmony default export */ const _baseIsRegExp = (baseIsRegExp);

// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js
var _baseUnary = __webpack_require__(31862);
// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js
var _nodeUtil = __webpack_require__(76773);
;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isRegExp.js




/* Node.js helper references. */
var nodeIsRegExp = _nodeUtil/* default */.Z && _nodeUtil/* default.isRegExp */.Z.isRegExp;

/**
 * Checks if `value` is classified as a `RegExp` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
 * @example
 *
 * _.isRegExp(/abc/);
 * // => true
 *
 * _.isRegExp('/abc/');
 * // => false
 */
var isRegExp = nodeIsRegExp ? (0,_baseUnary/* default */.Z)(nodeIsRegExp) : _baseIsRegExp;

/* harmony default export */ const lodash_es_isRegExp = (isRegExp);

// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseProperty.js
var _baseProperty = __webpack_require__(35661);
;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_asciiSize.js


/**
 * Gets the size of an ASCII `string`.
 *
 * @private
 * @param {string} string The string inspect.
 * @returns {number} Returns the string size.
 */
var asciiSize = (0,_baseProperty/* default */.Z)('length');

/* harmony default export */ const _asciiSize = (asciiSize);

;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_unicodeSize.js
/** Used to compose unicode character classes. */
var _unicodeSize_rsAstralRange = '\\ud800-\\udfff',
    _unicodeSize_rsComboMarksRange = '\\u0300-\\u036f',
    _unicodeSize_reComboHalfMarksRange = '\\ufe20-\\ufe2f',
    _unicodeSize_rsComboSymbolsRange = '\\u20d0-\\u20ff',
    _unicodeSize_rsComboRange = _unicodeSize_rsComboMarksRange + _unicodeSize_reComboHalfMarksRange + _unicodeSize_rsComboSymbolsRange,
    _unicodeSize_rsVarRange = '\\ufe0e\\ufe0f';

/** Used to compose unicode capture groups. */
var rsAstral = '[' + _unicodeSize_rsAstralRange + ']',
    rsCombo = '[' + _unicodeSize_rsComboRange + ']',
    rsFitz = '\\ud83c[\\udffb-\\udfff]',
    rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
    rsNonAstral = '[^' + _unicodeSize_rsAstralRange + ']',
    rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
    rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
    _unicodeSize_rsZWJ = '\\u200d';

/** Used to compose unicode regexes. */
var reOptMod = rsModifier + '?',
    rsOptVar = '[' + _unicodeSize_rsVarRange + ']?',
    rsOptJoin = '(?:' + _unicodeSize_rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
    rsSeq = rsOptVar + reOptMod + rsOptJoin,
    rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';

/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');

/**
 * Gets the size of a Unicode `string`.
 *
 * @private
 * @param {string} string The string inspect.
 * @returns {number} Returns the string size.
 */
function unicodeSize(string) {
  var result = reUnicode.lastIndex = 0;
  while (reUnicode.test(string)) {
    ++result;
  }
  return result;
}

/* harmony default export */ const _unicodeSize = (unicodeSize);

;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stringSize.js




/**
 * Gets the number of symbols in `string`.
 *
 * @private
 * @param {string} string The string to inspect.
 * @returns {number} Returns the string size.
 */
function stringSize(string) {
  return _hasUnicode(string)
    ? _unicodeSize(string)
    : _asciiSize(string);
}

/* harmony default export */ const _stringSize = (stringSize);

;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_asciiToArray.js
/**
 * Converts an ASCII `string` to an array.
 *
 * @private
 * @param {string} string The string to convert.
 * @returns {Array} Returns the converted array.
 */
function asciiToArray(string) {
  return string.split('');
}

/* harmony default export */ const _asciiToArray = (asciiToArray);

;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_unicodeToArray.js
/** Used to compose unicode character classes. */
var _unicodeToArray_rsAstralRange = '\\ud800-\\udfff',
    _unicodeToArray_rsComboMarksRange = '\\u0300-\\u036f',
    _unicodeToArray_reComboHalfMarksRange = '\\ufe20-\\ufe2f',
    _unicodeToArray_rsComboSymbolsRange = '\\u20d0-\\u20ff',
    _unicodeToArray_rsComboRange = _unicodeToArray_rsComboMarksRange + _unicodeToArray_reComboHalfMarksRange + _unicodeToArray_rsComboSymbolsRange,
    _unicodeToArray_rsVarRange = '\\ufe0e\\ufe0f';

/** Used to compose unicode capture groups. */
var _unicodeToArray_rsAstral = '[' + _unicodeToArray_rsAstralRange + ']',
    _unicodeToArray_rsCombo = '[' + _unicodeToArray_rsComboRange + ']',
    _unicodeToArray_rsFitz = '\\ud83c[\\udffb-\\udfff]',
    _unicodeToArray_rsModifier = '(?:' + _unicodeToArray_rsCombo + '|' + _unicodeToArray_rsFitz + ')',
    _unicodeToArray_rsNonAstral = '[^' + _unicodeToArray_rsAstralRange + ']',
    _unicodeToArray_rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
    _unicodeToArray_rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
    _unicodeToArray_rsZWJ = '\\u200d';

/** Used to compose unicode regexes. */
var _unicodeToArray_reOptMod = _unicodeToArray_rsModifier + '?',
    _unicodeToArray_rsOptVar = '[' + _unicodeToArray_rsVarRange + ']?',
    _unicodeToArray_rsOptJoin = '(?:' + _unicodeToArray_rsZWJ + '(?:' + [_unicodeToArray_rsNonAstral, _unicodeToArray_rsRegional, _unicodeToArray_rsSurrPair].join('|') + ')' + _unicodeToArray_rsOptVar + _unicodeToArray_reOptMod + ')*',
    _unicodeToArray_rsSeq = _unicodeToArray_rsOptVar + _unicodeToArray_reOptMod + _unicodeToArray_rsOptJoin,
    _unicodeToArray_rsSymbol = '(?:' + [_unicodeToArray_rsNonAstral + _unicodeToArray_rsCombo + '?', _unicodeToArray_rsCombo, _unicodeToArray_rsRegional, _unicodeToArray_rsSurrPair, _unicodeToArray_rsAstral].join('|') + ')';

/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var _unicodeToArray_reUnicode = RegExp(_unicodeToArray_rsFitz + '(?=' + _unicodeToArray_rsFitz + ')|' + _unicodeToArray_rsSymbol + _unicodeToArray_rsSeq, 'g');

/**
 * Converts a Unicode `string` to an array.
 *
 * @private
 * @param {string} string The string to convert.
 * @returns {Array} Returns the converted array.
 */
function unicodeToArray(string) {
  return string.match(_unicodeToArray_reUnicode) || [];
}

/* harmony default export */ const _unicodeToArray = (unicodeToArray);

;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stringToArray.js




/**
 * Converts `string` to an array.
 *
 * @private
 * @param {string} string The string to convert.
 * @returns {Array} Returns the converted array.
 */
function stringToArray(string) {
  return _hasUnicode(string)
    ? _unicodeToArray(string)
    : _asciiToArray(string);
}

/* harmony default export */ const _stringToArray = (stringToArray);

// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js
var toNumber = __webpack_require__(97400);
;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toFinite.js


/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0,
    MAX_INTEGER = 1.7976931348623157e+308;

/**
 * Converts `value` to a finite number.
 *
 * @static
 * @memberOf _
 * @since 4.12.0
 * @category Lang
 * @param {*} value The value to convert.
 * @returns {number} Returns the converted number.
 * @example
 *
 * _.toFinite(3.2);
 * // => 3.2
 *
 * _.toFinite(Number.MIN_VALUE);
 * // => 5e-324
 *
 * _.toFinite(Infinity);
 * // => 1.7976931348623157e+308
 *
 * _.toFinite('3.2');
 * // => 3.2
 */
function toFinite(value) {
  if (!value) {
    return value === 0 ? value : 0;
  }
  value = (0,toNumber/* default */.Z)(value);
  if (value === INFINITY || value === -INFINITY) {
    var sign = (value < 0 ? -1 : 1);
    return sign * MAX_INTEGER;
  }
  return value === value ? value : 0;
}

/* harmony default export */ const lodash_es_toFinite = (toFinite);

;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toInteger.js


/**
 * Converts `value` to an integer.
 *
 * **Note:** This method is loosely based on
 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to convert.
 * @returns {number} Returns the converted integer.
 * @example
 *
 * _.toInteger(3.2);
 * // => 3
 *
 * _.toInteger(Number.MIN_VALUE);
 * // => 0
 *
 * _.toInteger(Infinity);
 * // => 1.7976931348623157e+308
 *
 * _.toInteger('3.2');
 * // => 3
 */
function toInteger(value) {
  var result = lodash_es_toFinite(value),
      remainder = result % 1;

  return result === result ? (remainder ? result - remainder : result) : 0;
}

/* harmony default export */ const lodash_es_toInteger = (toInteger);

// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toString.js
var lodash_es_toString = __webpack_require__(18316);
;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/truncate.js










/** Used as default options for `_.truncate`. */
var DEFAULT_TRUNC_LENGTH = 30,
    DEFAULT_TRUNC_OMISSION = '...';

/** Used to match `RegExp` flags from their coerced string values. */
var reFlags = /\w*$/;

/**
 * Truncates `string` if it's longer than the given maximum string length.
 * The last characters of the truncated string are replaced with the omission
 * string which defaults to "...".
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category String
 * @param {string} [string=''] The string to truncate.
 * @param {Object} [options={}] The options object.
 * @param {number} [options.length=30] The maximum string length.
 * @param {string} [options.omission='...'] The string to indicate text is omitted.
 * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
 * @returns {string} Returns the truncated string.
 * @example
 *
 * _.truncate('hi-diddly-ho there, neighborino');
 * // => 'hi-diddly-ho there, neighbo...'
 *
 * _.truncate('hi-diddly-ho there, neighborino', {
 *   'length': 24,
 *   'separator': ' '
 * });
 * // => 'hi-diddly-ho there,...'
 *
 * _.truncate('hi-diddly-ho there, neighborino', {
 *   'length': 24,
 *   'separator': /,? +/
 * });
 * // => 'hi-diddly-ho there...'
 *
 * _.truncate('hi-diddly-ho there, neighborino', {
 *   'omission': ' [...]'
 * });
 * // => 'hi-diddly-ho there, neig [...]'
 */
function truncate(string, options) {
  var length = DEFAULT_TRUNC_LENGTH,
      omission = DEFAULT_TRUNC_OMISSION;

  if ((0,isObject/* default */.Z)(options)) {
    var separator = 'separator' in options ? options.separator : separator;
    length = 'length' in options ? lodash_es_toInteger(options.length) : length;
    omission = 'omission' in options ? (0,_baseToString/* default */.Z)(options.omission) : omission;
  }
  string = (0,lodash_es_toString/* default */.Z)(string);

  var strLength = string.length;
  if (_hasUnicode(string)) {
    var strSymbols = _stringToArray(string);
    strLength = strSymbols.length;
  }
  if (length >= strLength) {
    return string;
  }
  var end = length - _stringSize(omission);
  if (end < 1) {
    return omission;
  }
  var result = strSymbols
    ? _castSlice(strSymbols, 0, end).join('')
    : string.slice(0, end);

  if (separator === undefined) {
    return result + omission;
  }
  if (strSymbols) {
    end += (result.length - end);
  }
  if (lodash_es_isRegExp(separator)) {
    if (string.slice(end).search(separator)) {
      var match,
          substring = result;

      if (!separator.global) {
        separator = RegExp(separator.source, (0,lodash_es_toString/* default */.Z)(reFlags.exec(separator)) + 'g');
      }
      separator.lastIndex = 0;
      while ((match = separator.exec(substring))) {
        var newEnd = match.index;
      }
      result = result.slice(0, newEnd === undefined ? end : newEnd);
    }
  } else if (string.indexOf((0,_baseToString/* default */.Z)(separator), end) != end) {
    var index = result.lastIndexOf(separator);
    if (index > -1) {
      result = result.slice(0, index);
    }
  }
  return result + omission;
}

/* harmony default export */ const lodash_es_truncate = (truncate);

// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIteratee.js + 29 modules
var _baseIteratee = __webpack_require__(45981);
// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js
var isArrayLike = __webpack_require__(2762);
// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js + 2 modules
var keys = __webpack_require__(12395);
;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createFind.js




/**
 * Creates a `_.find` or `_.findLast` function.
 *
 * @private
 * @param {Function} findIndexFunc The function to find the collection index.
 * @returns {Function} Returns the new find function.
 */
function createFind(findIndexFunc) {
  return function(collection, predicate, fromIndex) {
    var iterable = Object(collection);
    if (!(0,isArrayLike/* default */.Z)(collection)) {
      var iteratee = (0,_baseIteratee/* default */.Z)(predicate, 3);
      collection = (0,keys/* default */.Z)(collection);
      predicate = function(key) { return iteratee(iterable[key], key, iterable); };
    }
    var index = findIndexFunc(collection, predicate, fromIndex);
    return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  };
}

/* harmony default export */ const _createFind = (createFind);

;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFindIndex.js
/**
 * The base implementation of `_.findIndex` and `_.findLastIndex` without
 * support for iteratee shorthands.
 *
 * @private
 * @param {Array} array The array to inspect.
 * @param {Function} predicate The function invoked per iteration.
 * @param {number} fromIndex The index to search from.
 * @param {boolean} [fromRight] Specify iterating from right to left.
 * @returns {number} Returns the index of the matched value, else `-1`.
 */
function baseFindIndex(array, predicate, fromIndex, fromRight) {
  var length = array.length,
      index = fromIndex + (fromRight ? 1 : -1);

  while ((fromRight ? index-- : ++index < length)) {
    if (predicate(array[index], index, array)) {
      return index;
    }
  }
  return -1;
}

/* harmony default export */ const _baseFindIndex = (baseFindIndex);

;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/findIndex.js




/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;

/**
 * This method is like `_.find` except that it returns the index of the first
 * element `predicate` returns truthy for instead of the element itself.
 *
 * @static
 * @memberOf _
 * @since 1.1.0
 * @category Array
 * @param {Array} array The array to inspect.
 * @param {Function} [predicate=_.identity] The function invoked per iteration.
 * @param {number} [fromIndex=0] The index to search from.
 * @returns {number} Returns the index of the found element, else `-1`.
 * @example
 *
 * var users = [
 *   { 'user': 'barney',  'active': false },
 *   { 'user': 'fred',    'active': false },
 *   { 'user': 'pebbles', 'active': true }
 * ];
 *
 * _.findIndex(users, function(o) { return o.user == 'barney'; });
 * // => 0
 *
 * // The `_.matches` iteratee shorthand.
 * _.findIndex(users, { 'user': 'fred', 'active': false });
 * // => 1
 *
 * // The `_.matchesProperty` iteratee shorthand.
 * _.findIndex(users, ['active', false]);
 * // => 0
 *
 * // The `_.property` iteratee shorthand.
 * _.findIndex(users, 'active');
 * // => 2
 */
function findIndex(array, predicate, fromIndex) {
  var length = array == null ? 0 : array.length;
  if (!length) {
    return -1;
  }
  var index = fromIndex == null ? 0 : lodash_es_toInteger(fromIndex);
  if (index < 0) {
    index = nativeMax(length + index, 0);
  }
  return _baseFindIndex(array, (0,_baseIteratee/* default */.Z)(predicate, 3), index);
}

/* harmony default export */ const lodash_es_findIndex = (findIndex);

;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/find.js



/**
 * Iterates over elements of `collection`, returning the first element
 * `predicate` returns truthy for. The predicate is invoked with three
 * arguments: (value, index|key, collection).
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Collection
 * @param {Array|Object} collection The collection to inspect.
 * @param {Function} [predicate=_.identity] The function invoked per iteration.
 * @param {number} [fromIndex=0] The index to search from.
 * @returns {*} Returns the matched element, else `undefined`.
 * @example
 *
 * var users = [
 *   { 'user': 'barney',  'age': 36, 'active': true },
 *   { 'user': 'fred',    'age': 40, 'active': false },
 *   { 'user': 'pebbles', 'age': 1,  'active': true }
 * ];
 *
 * _.find(users, function(o) { return o.age < 40; });
 * // => object for 'barney'
 *
 * // The `_.matches` iteratee shorthand.
 * _.find(users, { 'age': 1, 'active': true });
 * // => object for 'pebbles'
 *
 * // The `_.matchesProperty` iteratee shorthand.
 * _.find(users, ['active', false]);
 * // => object for 'fred'
 *
 * // The `_.property` iteratee shorthand.
 * _.find(users, 'active');
 * // => object for 'barney'
 */
var find = _createFind(lodash_es_findIndex);

/* harmony default export */ const lodash_es_find = (find);

// EXTERNAL MODULE: ./node_modules/.pnpm/@adguard+tswebextension@2.4.0-alpha.11_@adguard+re2-wasm@1.2.0/node_modules/@adguard/tswebextension/dist/index.mv3.js
var index_mv3 = __webpack_require__(62256);
;// CONCATENATED MODULE: ./Extension/src/background/tswebextension/tswebextension-mv3.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ // Re-export everything from tswebextension/mv3.


// EXTERNAL MODULE: ./Extension/src/pages/services/messenger.ts
var messenger = __webpack_require__(13979);
// EXTERNAL MODULE: ./node_modules/.pnpm/core-js@3.32.0/node_modules/core-js/modules/web.url-search-params.delete.js
var web_url_search_params_delete = __webpack_require__(46379);
// EXTERNAL MODULE: ./node_modules/.pnpm/core-js@3.32.0/node_modules/core-js/modules/web.url-search-params.has.js
var web_url_search_params_has = __webpack_require__(79250);
// EXTERNAL MODULE: ./node_modules/.pnpm/core-js@3.32.0/node_modules/core-js/modules/web.url-search-params.size.js
var web_url_search_params_size = __webpack_require__(32551);
// EXTERNAL MODULE: ./Extension/src/common/constants.ts
var constants = __webpack_require__(45276);
// EXTERNAL MODULE: ./node_modules/.pnpm/core-js@3.32.0/node_modules/core-js/modules/es.array.push.js
var es_array_push = __webpack_require__(12106);
;// CONCATENATED MODULE: ./Extension/src/common/strings.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ /**
 * Util class for work with strings
 */ 
const strings = (()=>{
    const StringUtils = {
        isEmpty (str) {
            return !str || str.trim().length === 0;
        },
        startWith (str, prefix) {
            return str && str.indexOf(prefix) === 0;
        },
        endsWith (str, postfix) {
            return str.endsWith(postfix);
        },
        substringAfter (str, separator) {
            if (!str) {
                return str;
            }
            const index = str.indexOf(separator);
            return index < 0 ? '' : str.substring(index + separator.length);
        },
        substringBefore (str, separator) {
            if (!str || !separator) {
                return str;
            }
            const index = str.indexOf(separator);
            return index < 0 ? str : str.substring(0, index);
        },
        contains (str, searchString) {
            return str && str.indexOf(searchString) >= 0;
        },
        containsIgnoreCase (str, searchString) {
            return str && searchString && str.toUpperCase().indexOf(searchString.toUpperCase()) >= 0;
        },
        replaceAll (str, find, replace) {
            if (!str) {
                return str;
            }
            return str.split(find).join(replace);
        },
        join (array, separator, startIndex, endIndex) {
            if (!array) {
                return null;
            }
            if (!startIndex) {
                startIndex = 0;
            }
            if (!endIndex) {
                endIndex = array.length;
            }
            if (startIndex >= endIndex) {
                return '';
            }
            const buf = [];
            for(let i = startIndex; i < endIndex; i += 1){
                buf.push(array[i]);
            }
            return buf.join(separator);
        },
        /**
         * Returns string before regexp first match
         *
         * @param {string} str
         * @param {RegExp} rx
         */ getBeforeRegExp (str, rx) {
            const index = str.search(rx);
            return str.substring(0, index);
        },
        /**
         * Look for any symbol from "chars" array starting at "start" index or from the start of the string
         *
         * @param str   String to search
         * @param chars Chars to search for
         * @param start Start index (optional, inclusive)
         * @returns int Index of the element found or null
         */ indexOfAny (str, chars, start) {
            start = start || 0;
            if (typeof str === 'string' && str.length <= start) {
                return -1;
            }
            for(let i = start; i < str.length; i += 1){
                const c = str.charAt(i);
                if (chars.indexOf(c) > -1) {
                    return i;
                }
            }
            return -1;
        },
        /**
         * Splits string by a delimiter, ignoring escaped delimiters
         *
         * @param str               String to split
         * @param delimiter         Delimiter
         * @param escapeCharacter   Escape character
         * @param preserveAllTokens If true - preserve empty entries.
         */ splitByDelimiterWithEscapeCharacter (str, delimiter, escapeCharacter, preserveAllTokens) {
            const parts = [];
            if (this.isEmpty(str)) {
                return parts;
            }
            let sb = [];
            for(let i = 0; i < str.length; i += 1){
                const c = str.charAt(i);
                if (c === delimiter) {
                    if (i === 0) {
                    // Ignore
                    } else if (str.charAt(i - 1) === escapeCharacter) {
                        sb.splice(sb.length - 1, 1);
                        sb.push(c);
                    } else if (preserveAllTokens || sb.length > 0) {
                        const part = sb.join('');
                        parts.push(part);
                        sb = [];
                    }
                } else {
                    sb.push(c);
                }
            }
            if (preserveAllTokens || sb.length > 0) {
                parts.push(sb.join(''));
            }
            return parts;
        },
        /**
         * Serialize HTML element
         *
         * @param element
         */ elementToString (element) {
            const s = [];
            s.push('<');
            s.push(element.localName);
            const { attributes } = element;
            for(let i = 0; i < attributes.length; i += 1){
                const attr = attributes[i];
                s.push(' ');
                s.push(attr.name);
                s.push('="');
                const value = attr.value === null ? '' : attr.value.replace(/"/g, '\\"');
                s.push(value);
                s.push('"');
            }
            s.push('>');
            return s.join('');
        },
        /**
         * Checks if the specified string starts with a substr at the specified index.
         *
         * @param str - String to check
         * @param startIndex - Index to start checking from
         * @param substr - Substring to check
         * @returns boolean true if it does start
         */ startsAtIndexWith (str, startIndex, substr) {
            if (str.length - startIndex < substr.length) {
                return false;
            }
            for(let i = 0; i < substr.length; i += 1){
                if (str.charAt(startIndex + i) !== substr.charAt(i)) {
                    return false;
                }
            }
            return true;
        },
        /**
         * Checks if str has unquoted substr
         *
         * @param str
         * @param substr
         */ hasUnquotedSubstring (str, substr) {
            const quotes = [
                '"',
                "'",
                '/'
            ];
            const stack = [];
            for(let i = 0; i < str.length; i += 1){
                const cursor = str[i];
                if (stack.length === 0) {
                    if (this.startsAtIndexWith(str, i, substr)) {
                        return true;
                    }
                }
                if (quotes.indexOf(cursor) >= 0 && (i === 0 || str[i - 1] !== '\\')) {
                    const last = stack.pop();
                    if (!last) {
                        stack.push(cursor);
                    } else if (last !== cursor) {
                        stack.push(last);
                        stack.push(cursor);
                    }
                }
            }
            return false;
        }
    };
    return StringUtils;
})();

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/utils.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 






/**
 * Url utils
 *
 * @type {{getUrlWithoutScheme, isHierarchicUrl, getProtocol, getCookieDomain}}
 */ const UrlUtils = {
    /**
     * Returns protocol for the given URL.
     *
     * @param url URL to process.
     *
     * @returns URL protocol.
     */ getProtocol (url) {
        try {
            const urlObject = new URL(url);
            return urlObject.protocol;
        } catch (e) {
            return '';
        }
    },
    /**
     * Removes protocol from URL and `www.` if url starts with it.
     *
     * @param url URL to process.
     *
     * @returns URL without protocol and `www.`.
     */ getUrlWithoutScheme (url) {
        let resultUrl;
        const protocol = this.getProtocol(url);
        if (this.isHierarchicUrl(url)) {
            resultUrl = url.replace(`${protocol}//`, '');
        } else {
            resultUrl = url.replace(protocol, '');
        }
        return strings.startWith(resultUrl, 'www.') ? resultUrl.substring(4) : resultUrl;
    },
    /**
     * Checks the given URL whether is hierarchical or not.
     *
     * @param url Url to check.
     *
     * @returns True if the URL is hierarchical, false otherwise.
     */ isHierarchicUrl (url) {
        return url.indexOf('//') !== -1;
    },
    /**
     * Returns domain for cookie rule.
     *
     * @param frameDomain Frame domain.
     *
     * @returns Domain for cookie rule.
     */ getCookieDomain (frameDomain) {
        if (!frameDomain) {
            return '';
        }
        return frameDomain[0] === '.' ? frameDomain.substring(1) : frameDomain;
    }
};
/**
 * Returns filter name for filterId.
 *
 * @param filterId Filter id.
 * @param filtersMetadata Filters metadata.
 *
 * @returns Filter name for filterId
 */ const getFilterName = (filterId, filtersMetadata)=>{
    if (filterId === undefined) {
        return null;
    }
    if (filterId === constants/* AntiBannerFiltersId.UserFilterId */.m6.UserFilterId) {
        return translator/* translator.getMessage */.O.getMessage('options_userfilter');
    }
    if (filterId === constants/* AntiBannerFiltersId.AllowlistFilterId */.m6.AllowlistFilterId) {
        return translator/* translator.getMessage */.O.getMessage('options_allowlist');
    }
    const filterMetadata = filtersMetadata === null || filtersMetadata === void 0 ? void 0 : filtersMetadata.filter((el)=>el.filterId === filterId)[0];
    return filterMetadata ? filterMetadata.name : null;
};
/**
 * Returns request type for the given event.
 *
 * @param event Filtering log event.
 *
 * @returns Request type for the given event.
 */ const getRequestEventType = (event)=>{
    const { requestType, requestRule, cspReportBlocked, removeHeader, removeParam, isModifyingCookieRule } = event;
    let requestEventType = requestType;
    if ((requestRule === null || requestRule === void 0 ? void 0 : requestRule.cookieRule) || isModifyingCookieRule) {
        requestEventType = index_mv3/* ContentType.Cookie */.zc.Cookie;
    } else if (cspReportBlocked) {
        // By default csp requests in firefox have other request type,
        // but if event cspReportBlocked is true
        // we consider such request to have "CSP report" type
        requestEventType = index_mv3/* ContentType.CspReport */.zc.CspReport;
    } else if (removeHeader) {
        return 'REMOVEHEADER';
    } else if (removeParam) {
        return 'REMOVEPARAM';
    }
    switch(requestEventType){
        case index_mv3/* ContentType.Document */.zc.Document:
        case index_mv3/* ContentType.Subdocument */.zc.Subdocument:
            return 'HTML';
        case index_mv3/* ContentType.Stylesheet */.zc.Stylesheet:
            return 'CSS';
        case index_mv3/* ContentType.Script */.zc.Script:
            return 'JavaScript';
        case index_mv3/* ContentType.XmlHttpRequest */.zc.XmlHttpRequest:
            return 'XHR';
        case index_mv3/* ContentType.Image */.zc.Image:
            return 'Image';
        case index_mv3/* ContentType.Object */.zc.Object:
        case index_mv3/* ContentType.Media */.zc.Media:
            return 'Media';
        case index_mv3/* ContentType.Font */.zc.Font:
            return 'Font';
        case index_mv3/* ContentType.Websocket */.zc.Websocket:
            return 'WebSocket';
        case index_mv3/* ContentType.WebRtc */.zc.WebRtc:
            return 'WebRTC';
        case index_mv3/* ContentType.Csp */.zc.Csp:
            return 'CSP';
        case index_mv3/* ContentType.CspReport */.zc.CspReport:
            return 'CSP report';
        case index_mv3/* ContentType.PermissionsPolicy */.zc.PermissionsPolicy:
            return 'Permissions Policy';
        case index_mv3/* ContentType.Cookie */.zc.Cookie:
            return 'Cookie';
        case index_mv3/* ContentType.Ping */.zc.Ping:
            return 'Ping';
        case index_mv3/* ContentType.Other */.zc.Other:
            return 'Other';
        default:
            return '';
    }
};
/**
 * Returns data for cookie event.
 *
 * @param event Filtering log event.
 *
 * @returns Cookie data as a string or null.
 */ const getCookieData = (event)=>{
    var _event_requestRule;
    if (!((_event_requestRule = event.requestRule) === null || _event_requestRule === void 0 ? void 0 : _event_requestRule.cookieRule) || !(event === null || event === void 0 ? void 0 : event.cookieName)) {
        return null;
    }
    return event.cookieValue ? `${event.cookieName} = ${event.cookieValue}` : event.cookieName;
};
/**
 * Returns filter name for a rule
 *
 * @param selectedEvent filtering event
 * @param {RegularFilterMetadata} filtersMetadata filters metadata
 * @returns {string|null} filter name or null, if filter is not found or there are multiple rules
 */ const getRuleFilterName = (selectedEvent, filtersMetadata)=>{
    const { requestRule, replaceRules, stealthAllowlistRules, declarativeRuleInfo } = selectedEvent;
    if (declarativeRuleInfo === null || declarativeRuleInfo === void 0 ? void 0 : declarativeRuleInfo.sourceRules) {
        var _declarativeRuleInfo_sourceRules_;
        // Here we assume that the set of triggered rules is always from one
        // filter and therefore we extract the first one and based on it we
        // get the filter name.
        const firstRule = (_declarativeRuleInfo_sourceRules_ = declarativeRuleInfo.sourceRules[0]) === null || _declarativeRuleInfo_sourceRules_ === void 0 ? void 0 : _declarativeRuleInfo_sourceRules_.filterId;
        return getFilterName(firstRule, filtersMetadata);
    }
    if (requestRule) {
        return getFilterName(requestRule.filterId, filtersMetadata);
    }
    if ((replaceRules === null || replaceRules === void 0 ? void 0 : replaceRules.length) === 1) {
        var _replaceRules_;
        return getFilterName((_replaceRules_ = replaceRules[0]) === null || _replaceRules_ === void 0 ? void 0 : _replaceRules_.filterId, filtersMetadata);
    }
    if ((stealthAllowlistRules === null || stealthAllowlistRules === void 0 ? void 0 : stealthAllowlistRules.length) === 1) {
        var _stealthAllowlistRules_;
        return getFilterName((_stealthAllowlistRules_ = stealthAllowlistRules[0]) === null || _stealthAllowlistRules_ === void 0 ? void 0 : _stealthAllowlistRules_.filterId, filtersMetadata);
    }
    return null;
};

// EXTERNAL MODULE: ./node_modules/.pnpm/zod@3.21.4/node_modules/zod/lib/index.mjs
var lib = __webpack_require__(44945);
// EXTERNAL MODULE: ./node_modules/.pnpm/@adguard+agtree@2.1.2/node_modules/@adguard/agtree/dist/agtree.mjs + 3 modules
var agtree = __webpack_require__(94287);
// EXTERNAL MODULE: ./node_modules/.pnpm/tldts@5.6.45/node_modules/tldts/dist/es6/index.js + 2 modules
var es6 = __webpack_require__(85258);
// EXTERNAL MODULE: ./node_modules/.pnpm/@adguard+scriptlets@1.12.1/node_modules/@adguard/scriptlets/dist/umd/scriptlets.umd.js
var scriptlets_umd = __webpack_require__(97730);
var scriptlets_umd_default = /*#__PURE__*/__webpack_require__.n(scriptlets_umd);
// EXTERNAL MODULE: ./node_modules/.pnpm/is-cidr@4.0.2/node_modules/is-cidr/index.js
var is_cidr = __webpack_require__(69918);
var is_cidr_default = /*#__PURE__*/__webpack_require__.n(is_cidr);
// EXTERNAL MODULE: ./node_modules/.pnpm/is-ip@3.1.0/node_modules/is-ip/index.js
var is_ip = __webpack_require__(13997);
var is_ip_default = /*#__PURE__*/__webpack_require__.n(is_ip);
// EXTERNAL MODULE: ./node_modules/.pnpm/cidr-tools@6.4.1/node_modules/cidr-tools/index.js + 3 modules
var cidr_tools = __webpack_require__(21289);
// EXTERNAL MODULE: ./node_modules/.pnpm/@adguard+css-tokenizer@1.1.1/node_modules/@adguard/css-tokenizer/dist/csstokenizer.mjs
var csstokenizer = __webpack_require__(97094);
// EXTERNAL MODULE: ./node_modules/.pnpm/punycode@2.3.1/node_modules/punycode/punycode.es6.js
var punycode_es6 = __webpack_require__(59121);
;// CONCATENATED MODULE: ./node_modules/.pnpm/@adguard+tsurlfilter@3.1.0-alpha.7_@adguard+re2-wasm@1.2.0/node_modules/@adguard/tsurlfilter/dist/es/declarative-converter.js










var extendStatics = function(d, b) {
    extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
    return extendStatics(d, b);
};
function __extends(d, b) {
    if (typeof b !== "function" && b !== null)
        throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
    extendStatics(d, b);
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
    __assign = Object.assign || function __assign(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
function __awaiter(thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
}
function __generator(thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
}
function __makeTemplateObject(cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
}

/**
 * Checks if error has message.
 *
 * @param error Error object.
 * @returns If param is error.
 */
function isErrorWithMessage(error) {
    return (typeof error === 'object'
        && error !== null
        && 'message' in error
        && typeof error.message === 'string');
}
/**
 * Converts error to the error with message.
 *
 * @param maybeError Possible error.
 * @returns Error with message.
 */
function toErrorWithMessage(maybeError) {
    if (isErrorWithMessage(maybeError)) {
        return maybeError;
    }
    try {
        return new Error(JSON.stringify(maybeError));
    }
    catch (_a) {
        // fallback in case there's an error stringifying the maybeError
        // like with circular references for example.
        return new Error(String(maybeError));
    }
}
/**
 * Converts error object to error with message. This method might be helpful to handle thrown errors.
 *
 * @param error Error object.
 *
 * @returns Message of the error.
 */
function getErrorMessage(error) {
    return toErrorWithMessage(error).message;
}

var ErrorStatusCodes;
(function (ErrorStatusCodes) {
    ErrorStatusCodes[ErrorStatusCodes["ComplexRegex"] = 1001] = "ComplexRegex";
    ErrorStatusCodes[ErrorStatusCodes["RuleLimit"] = 1002] = "RuleLimit";
    ErrorStatusCodes[ErrorStatusCodes["RegexpRuleLimit"] = 1003] = "RegexpRuleLimit";
    ErrorStatusCodes[ErrorStatusCodes["RemoveparamRegexpIsNotSupported"] = 1004] = "RemoveparamRegexpIsNotSupported";
    ErrorStatusCodes[ErrorStatusCodes["RemoveparamInversionIsNotSupported"] = 1005] = "RemoveparamInversionIsNotSupported";
})(ErrorStatusCodes || (ErrorStatusCodes = {}));
var EMPTY_STRING = '';
var SEPARATOR = '|';
var SPACE = ' ';
var WILDCARD = '*';
var LF = '\n';
var CR = '\r';
var FF = '\f';

/**
 * Splits the string by the delimiter, ignoring escaped delimiters
 * and without tokenizing.
 * Works for plain strings that don't include string representation of
 * complex entities, e.g $replace modifier values.
 *
 * @param string - string to split
 * @param delimiter - delimiter
 * @param escapeCharacter - escape character
 * @param preserveEmptyTokens - if true, preserve empty parts
 * @param shouldUnescape - if true, unescape characters
 * @return array of string parts
 */
function splitByDelimiterWithEscapeCharacter(string, delimiter, escapeCharacter, preserveEmptyTokens, shouldUnescape) {
    if (shouldUnescape === void 0) { shouldUnescape = true; }
    if (!string) {
        return [];
    }
    if (string.startsWith(delimiter)) {
        // eslint-disable-next-line no-param-reassign
        string = string.substring(1);
    }
    var words = [];
    if (!string.includes(escapeCharacter)) {
        words = string.split(delimiter);
        if (!preserveEmptyTokens) {
            words = words.filter(function (word) { return !!word; });
        }
        return words;
    }
    var chars = [];
    var makeWord = function () {
        var word = chars.join('');
        words.push(word);
        chars = [];
    };
    for (var i = 0; i < string.length; i += 1) {
        var char = string.charAt(i);
        var isLastChar = i === (string.length - 1);
        if (char === delimiter) {
            var isEscapedChar = i > 0 && string[i - 1] === escapeCharacter;
            if (isEscapedChar) {
                if (shouldUnescape) {
                    chars.splice(chars.length - 1, 1);
                }
                chars.push(char);
            }
            else {
                makeWord();
            }
            if (isLastChar) {
                makeWord();
            }
        }
        else if (isLastChar) {
            chars.push(char);
            makeWord();
        }
        else {
            chars.push(char);
        }
    }
    if (!preserveEmptyTokens) {
        words = words.filter(function (word) { return !!word; });
    }
    return words;
}
/**
 * djb2 hash algorithm
 *
 * NOTE: This version uses some bit operands to exclude overflow MAX_SAFE_INTEGER
 * (and moreover, exclude overflow 2^32).
 *
 * @see {@link https://gist.github.com/eplawless/52813b1d8ad9af510d85?permalink_comment_id=3367765#gistcomment-3367765}
 *
 * @param str string to get hash
 * @return {number} hash
 */
function fastHash(str) {
    if (str.length === 0) {
        return 0;
    }
    var hash = 5381;
    for (var i = 0; i < str.length; i += 1) {
        hash = hash * 33 ^ str.charCodeAt(i);
    }
    return hash >>> 0;
}
/**
 * Replaces all occurences of find with replace in str
 *
 * @param str
 * @param find
 * @param replace
 */
function replaceAll(str, find, replace) {
    if (!str) {
        return str;
    }
    return str.split(find).join(replace);
}
/**
 * Checks if arrays are equal
 *
 * @param left array
 * @param right array
 * @return {boolean} true on equality
 */
function stringArraysEquals(left, right) {
    if (!left || !right) {
        return !left && !right;
    }
    if (left.length !== right.length) {
        return false;
    }
    for (var i = 0; i < left.length; i += 1) {
        if (left[i] !== right[i]) {
            return false;
        }
    }
    return true;
}
/**
 * Checks if arrays have an intersection
 *
 * @param left array
 * @param right array
 * @return {boolean} true on equality
 */
function stringArraysHaveIntersection(left, right) {
    if (!left || !right) {
        return true;
    }
    for (var i = 0; i < left.length; i += 1) {
        if (right.includes(left[i])) {
            return true;
        }
    }
    return false;
}
/**
 * Checks if string contains spaces
 *
 * @param str String to check
 * @returns `true` if string contains spaces, `false` otherwise
 */
function hasSpaces(str) {
    return str.includes(SPACE);
}
/**
 * Check if the given value is a string
 *
 * @param value Value to check
 * @returns `true` if value is a string, `false` otherwise
 */
function isString(value) {
    return typeof value === 'string';
}
/**
 * Unescapes the specified character in the string
 *
 * @param str String to escape
 * @param char Character to escape
 * @returns The string with the specified character unescaped
 */
function unescapeChar(str, char) {
    return str.replace("\\".concat(char), char);
}
/**
 * Finds the next line break index in the string starting from the specified index.
 * Supports LF, CR, FF and CRLF line breaks.
 *
 * @param str String to search in.
 * @param startIndex  Start index. Default is 0.
 * @returns A tuple with the line break index and the line break length.
 * If the line break is not found, returns the string length and 0.
 */
function findNextLineBreakIndex(str, startIndex) {
    if (startIndex === void 0) { startIndex = 0; }
    var length = str.length;
    var offset = startIndex;
    while (offset < length) {
        var char = str[offset];
        if (char === LF || char === FF) {
            return [offset, 1];
        }
        if (char === CR) {
            return str[offset + 1] === LF ? [offset, 2] : [offset, 1];
        }
        offset += 1;
    }
    return [length, 0];
}

/* eslint-disable max-classes-per-file */
/**
 * Default rule index for source mapping.
 *
 * It is -1, similar to `Array.indexOf()` return value when element is not found.
 */
var RULE_INDEX_NONE = -1;
/**
 * Rule with index
 */
// TODO: Consider remove this because rule already has an index field
var IndexedRule = /** @class */ (function () {
    /**
     * Constructor
     *
     * @param rule
     * @param index
     */
    function IndexedRule(rule, index) {
        this.rule = rule;
        this.index = index;
    }
    return IndexedRule;
}());

// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/regexp
// should be escaped . * + ? ^ $ { } ( ) | [ ] / \
// except of * | ^
var specialCharacters = ['.', '+', '?', '$', '{', '}', '(', ')', '[', ']', '/', '\\'];
var reSpecialCharacters = new RegExp("[".concat(specialCharacters.join('\\'), "]"), 'g');
var reSpecialCharactersFull = /[.*+?^${}()|[\]\\]/g;
var reEscapedSpecialCharactersFull = /\\[.*+?^${}()|[\]\\]/g;
var protocolMarker = String.raw(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["://"], [":\\/\\/"])));
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#using_special_characters_in_strings
var escapeSequence = {
    n: '\n',
    r: '\r',
    t: '\t',
    b: '\b',
    f: '\f',
    v: '\v',
};
/**
 * Class with static helper methods for working with basic filtering rules patterns.
 * https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#basic-rules
 */
var SimpleRegex = /** @class */ (function () {
    function SimpleRegex() {
    }
    /**
     * Extracts the shortcut from the rule's pattern.
     * Shortcut is the longest substring of the pattern that does not contain
     * any special characters.
     *
     * Please note, that the shortcut is always lower-case!
     *
     * @param pattern - network rule's pattern.
     * @returns the shortcut or the empty string if we could not extract any.
     */
    SimpleRegex.extractShortcut = function (pattern) {
        if (pattern.startsWith(this.MASK_REGEX_RULE) && pattern.endsWith(this.MASK_REGEX_RULE)) {
            return this.extractRegexpShortcut(pattern);
        }
        return this.extractBasicShortcut(pattern);
    };
    /**
     * Searches for the longest substring of the pattern that
     * does not contain any special characters: *,^,|.
     *
     * @param pattern - network rule's pattern.
     * @returns the shortcut or the empty string
     */
    SimpleRegex.extractBasicShortcut = function (pattern) {
        var longest = '';
        var parts = pattern.split(this.rePatternSpecialCharacters);
        for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
            var part = parts_1[_i];
            if (part.length > longest.length) {
                longest = part;
            }
        }
        return (longest || '').toLowerCase();
    };
    /**
     * Searches for a shortcut inside of a regexp pattern.
     * Shortcut in this case is a longest string with no REGEX special characters.
     * Also, we discard complicated regexps right away.
     *
     * @param pattern - network rule's pattern (regexp).
     * @returns the shortcut or the empty string
     */
    SimpleRegex.extractRegexpShortcut = function (pattern) {
        var reText = pattern.substring(this.MASK_REGEX_RULE.length, pattern.length - this.MASK_REGEX_RULE.length);
        if (reText.length === 0) {
            // The rule is too short, doing nothing
            return '';
        }
        if (reText.indexOf('?') >= 0) {
            // Do not mess with complex expressions which use lookahead
            // And with those using ? special character
            // https://github.com/AdguardTeam/AdguardBrowserExtension/issues/978
            return '';
        }
        // Remove protocol part to avoid useless shortcuts like "http"
        var protocolIndex = reText.indexOf(protocolMarker);
        if (protocolIndex > -1) {
            reText = reText.substring(protocolIndex + protocolMarker.length);
        }
        var currentLongest = '';
        var token = '';
        for (var i = 0; i < reText.length; i += 1) {
            var char = reText[i];
            if (char === '\\') {
                // Don't break token on escapes
                continue;
            }
            if (SimpleRegex.isValidRegexpShortcutChar(reText, i)) {
                token += char;
                if (i !== reText.length - 1) {
                    continue;
                }
            }
            if (token.length > currentLongest.length) {
                currentLongest = token;
            }
            token = '';
        }
        return currentLongest.toLowerCase();
    };
    /**
     * patternToRegexp is a helper method for creating regular expressions from the simple
     * wildcard-based syntax which is used in basic filters:
     * https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#basic-rules
     *
     * @param pattern - basic rule pattern
     * @returns regular expression
     */
    SimpleRegex.patternToRegexp = function (pattern) {
        if (pattern === this.MASK_START_URL
            || pattern === this.MASK_PIPE
            || pattern === this.MASK_ANY_CHARACTER
            || pattern === '') {
            return this.REGEX_ANY_CHARACTER;
        }
        if (pattern.startsWith(this.MASK_REGEX_RULE) && pattern.endsWith(this.MASK_REGEX_RULE)) {
            // This is a regex rule, just remove the regex markers
            return pattern.substring(this.MASK_REGEX_RULE.length, pattern.length - this.MASK_REGEX_RULE.length);
        }
        // Escape special characters except of * | ^
        var regex = pattern.replace(reSpecialCharacters, '\\$&');
        // Now escape "|" characters but avoid escaping them in the special places
        if (regex.startsWith(this.MASK_START_URL)) {
            regex = regex.substring(0, this.MASK_START_URL.length)
                + replaceAll(regex.substring(this.MASK_START_URL.length, regex.length - this.MASK_PIPE.length), this.MASK_PIPE, "\\".concat(this.MASK_PIPE))
                + regex.substring(regex.length - this.MASK_PIPE.length);
        }
        else {
            regex = regex.substring(0, this.MASK_PIPE.length)
                + replaceAll(regex.substring(this.MASK_PIPE.length, regex.length - this.MASK_PIPE.length), this.MASK_PIPE, "\\".concat(this.MASK_PIPE))
                + regex.substring(regex.length - this.MASK_PIPE.length);
        }
        // Replace special URL masks
        regex = replaceAll(regex, this.MASK_ANY_CHARACTER, this.REGEX_ANY_CHARACTER);
        regex = replaceAll(regex, this.MASK_SEPARATOR, this.REGEX_SEPARATOR);
        // Replace start URL and pipes
        if (regex.startsWith(this.MASK_START_URL)) {
            regex = this.REGEX_START_URL + regex.substring(this.MASK_START_URL.length);
        }
        else if (regex.startsWith(this.MASK_PIPE)) {
            regex = this.REGEX_START_STRING + regex.substring(this.MASK_PIPE.length);
        }
        if (regex.endsWith(this.MASK_PIPE)) {
            regex = regex.substring(0, regex.length - this.MASK_PIPE.length) + this.REGEX_END_STRING;
        }
        return regex;
    };
    /**
     * Creates RegExp object from string in '/reg_exp/gi' format
     *
     * @param str
     */
    SimpleRegex.patternFromString = function (str) {
        var parts = splitByDelimiterWithEscapeCharacter(str, '/', '\\', true);
        var modifiers = (parts[1] || '');
        if (modifiers.indexOf('g') < 0) {
            modifiers += 'g';
        }
        return new RegExp(parts[0], modifiers);
    };
    /**
     * Escapes characters with special meaning inside a regular expression.
     *
     * @param str
     * @param searchPattern - Pattern for detecting special characters. Optional.
     */
    SimpleRegex.escapeRegexSpecials = function (str, searchPattern) {
        if (searchPattern === void 0) { searchPattern = reSpecialCharactersFull; }
        return str.replace(searchPattern, '\\$&');
    };
    /**
     * Unescapes characters with special meaning inside a regular expression.
     *
     * @param str
     * @param searchPattern - Pattern for detecting special characters. Optional.
     */
    SimpleRegex.unescapeRegexSpecials = function (str, searchPattern) {
        if (searchPattern === void 0) { searchPattern = reEscapedSpecialCharactersFull; }
        return str.replace(searchPattern, function (match) { return match.substring(1); });
    };
    /**
     * Check if pattern is Regex
     */
    SimpleRegex.isRegexPattern = function (str) {
        return str.startsWith('/') && str.endsWith('/');
    };
    /**
     * Unescapes special characters in a string
     * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#using_special_characters_in_strings
     */
    SimpleRegex.unescapeSpecials = function (str) {
        var keys = Object.keys(escapeSequence).join('|');
        var regex = new RegExp("\\\\(".concat(keys, ")"), 'g');
        return str.replace(regex, function (match, group) {
            return escapeSequence[group];
        });
    };
    /**
     * Matching the beginning of an address. With this character you don't
     * have to specify a particular protocol and subdomain in address mask.
     * It means, || stands for http://*., https://*., ws://*., wss://*. at once.
     */
    SimpleRegex.MASK_START_URL = '||';
    /**
     * REGEX_START_URL corresponds to MASK_START_URL
     */
    SimpleRegex.REGEX_START_URL = '^(http|https|ws|wss)://([a-z0-9-_.]+\\.)?';
    /**
     * A pointer to the beginning or the end of address. The value depends on the
     * character placement in the mask. For example, a rule swf| corresponds
     * to http://example.com/annoyingflash.swf , but not to http://example.com/swf/index.html.
     * |http://example.org corresponds to http://example.org,
     * but not to http://domain.com?url=http://example.org.
     */
    SimpleRegex.MASK_PIPE = '|';
    /**
     * REGEX_END_STRING corresponds to MASK_PIPE if it is in the end of a pattern.
     */
    SimpleRegex.REGEX_END_STRING = '$';
    /**
     * REGEX_START_STRING corresponds to MASK_PIPE if it is in the beginning of a pattern.
     */
    SimpleRegex.REGEX_START_STRING = '^';
    /**
     * Separator character mark. Separator character is any character,
     * but a letter, a digit, or one of the following: _ - .
     */
    SimpleRegex.MASK_SEPARATOR = '^';
    /**
     * REGEX_SEPARATOR corresponds to MASK_SEPARATOR
     */
    SimpleRegex.REGEX_SEPARATOR = '([^ a-zA-Z0-9.%_-]|$)';
    /**
     * This is a wildcard character. It is used to represent "any set of characters".
     * This can also be an empty string or a string of any length.
     */
    SimpleRegex.MASK_ANY_CHARACTER = '*';
    /**
     * Path separator
     */
    SimpleRegex.MASK_BACKSLASH = '/';
    /**
     * REGEX_ANY_CHARACTER corresponds to MASK_ANY_CHARACTER.
     */
    SimpleRegex.REGEX_ANY_CHARACTER = '.*';
    /**
     * Enclose regex in two backslashes to mark a regex rule:
     * https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#regular-expressions-support
     */
    SimpleRegex.MASK_REGEX_RULE = '/';
    /**
     *  Regex for matching special characters in modifier regex pattern
     */
    SimpleRegex.reModifierPatternSpecialCharacters = /[[\],\\]/g;
    /**
      *  Regex for matching escaped special characters in modifier regex pattern
      */
    SimpleRegex.reModifierPatternEscapedSpecialCharacters = /\\[[\],\\]/g;
    /**
     * If string starts with exclamation mark "!" we consider it as comment
     */
    SimpleRegex.MASK_COMMENT = '!';
    /**
     * Min length of rule shortcut
     * This value has been picked as a result of performance experiments
     */
    SimpleRegex.MIN_SHORTCUT_LENGTH = 3;
    /**
     * Min length of generic rule shortcut
     */
    SimpleRegex.MIN_GENERIC_RULE_LENGTH = 4;
    /** Regex with basic matching pattern special characters */
    SimpleRegex.rePatternSpecialCharacters = new RegExp('[*^|]');
    /**
     * Checks if char is valid for regexp shortcut – is alphanumeric or escaped period or forward slash
     *
     * @param str string
     * @param i index of char
     * @returns  true if char is valid for regexp shortcut
     */
    SimpleRegex.isValidRegexpShortcutChar = function (str, i) {
        var charCode = str.charCodeAt(i);
        if (SimpleRegex.isAlphaNumericChar(charCode)) {
            return true;
        }
        // Escaped period or escaped forward slash are allowed in regexp shortcut
        if (i > 0 && str[i - 1] === '\\') {
            if (charCode === 46 || charCode === 47) {
                return true;
            }
        }
        return false;
    };
    /**
     * Checks if char is alpha-numeric
     * @param charCode - char code
     * @returns true if char is alpha-numeric
     */
    SimpleRegex.isAlphaNumericChar = function (charCode) {
        return (charCode > 47 && charCode < 58) // numeric (0-9)
            || (charCode > 64 && charCode < 91) // upper alpha (A-Z)
            || (charCode > 96 && charCode < 123); // lower alpha (a-z)
    };
    return SimpleRegex;
}());
var templateObject_1$1;

/**
 * Export logger implementation
 */
var logger = console;

/**
 * Pipe separator
 */
var PIPE_SEPARATOR$1 = '|';
/**
 * This is a helper class that is used specifically to work
 * with domains restrictions.
 *
 * There are two options how you can add a domain restriction:
 * * `$domain` modifier: https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#domain-modifier
 * * domains list for the cosmetic rules
 *
 * The only difference between them is that in one case we use `|` as a separator,
 * and in the other case - `,`.
 *
 * Examples:
 * * `||example.org^$domain=example.com|~sub.example.com` -- network rule
 * * `example.com,~sub.example.com##banner` -- cosmetic rule
 */
var DomainModifier = /** @class */ (function () {
    /**
     * Parses the `domains` string and initializes the object.
     *
     * @param domains Domain list string or AGTree DomainList node.
     * @param separator Separator — `,` or `|`.
     *
     * @throws An error if the domains string is empty or invalid
     */
    function DomainModifier(domains, separator) {
        var processed;
        if (isString(domains)) {
            var node = agtree/* DomainListParser.parse */.Wf.parse(domains.trim(), __assign(__assign({}, agtree/* defaultParserOptions */.Xm), { isLocIncluded: false }), 0, separator);
            if (node.children.length === 0) {
                throw new SyntaxError('At least one domain must be specified');
            }
            processed = DomainModifier.processDomainList(node);
        }
        else {
            // domain list node stores the separator
            if (separator !== domains.separator) {
                throw new SyntaxError('Separator mismatch');
            }
            processed = DomainModifier.processDomainList(domains);
        }
        // Unescape separator character in domains
        processed.permittedDomains = processed.permittedDomains.map(function (domain) { return unescapeChar(domain, separator); });
        processed.restrictedDomains = processed.restrictedDomains.map(function (domain) { return unescapeChar(domain, separator); });
        this.restrictedDomains = processed.restrictedDomains.length > 0 ? processed.restrictedDomains : null;
        this.permittedDomains = processed.permittedDomains.length > 0 ? processed.permittedDomains : null;
    }
    /**
     * Processes domain list node, which means extracting permitted and restricted
     * domains from it.
     *
     * @param domainListNode Domain list node to process
     * @returns Processed domain list (permitted and restricted domains) ({@link ProcessedDomainList})
     */
    DomainModifier.processDomainList = function (domainListNode) {
        var result = {
            permittedDomains: [],
            restrictedDomains: [],
        };
        var domains = domainListNode.children;
        for (var _i = 0, domains_1 = domains; _i < domains_1.length; _i++) {
            var _a = domains_1[_i], exception = _a.exception, domain = _a.value;
            var domainLowerCased = domain.toLowerCase();
            if (!SimpleRegex.isRegexPattern(domain) && domain.includes(WILDCARD) && !domain.endsWith(WILDCARD)) {
                throw new SyntaxError("Wildcards are only supported for top-level domains: \"".concat(domain, "\""));
            }
            if (exception) {
                result.restrictedDomains.push(domainLowerCased);
            }
            else {
                result.permittedDomains.push(domainLowerCased);
            }
        }
        return result;
    };
    /**
     * Checks if the filtering rule is allowed on this domain.
     *
     * @param domain Domain to check.
     *
     * @returns True if the filtering rule is allowed on this domain.
     */
    DomainModifier.prototype.matchDomain = function (domain) {
        if (this.hasRestrictedDomains()) {
            if (DomainModifier.isDomainOrSubdomainOfAny(domain, this.restrictedDomains)) {
                // Domain or host is restricted
                // i.e. $domain=~example.org
                return false;
            }
        }
        if (this.hasPermittedDomains()) {
            if (!DomainModifier.isDomainOrSubdomainOfAny(domain, this.permittedDomains)) {
                // Domain is not among permitted
                // i.e. $domain=example.org and we're checking example.com
                return false;
            }
        }
        return true;
    };
    /**
     * Checks if rule has permitted domains
     */
    DomainModifier.prototype.hasPermittedDomains = function () {
        return !!this.permittedDomains && this.permittedDomains.length > 0;
    };
    /**
     * Checks if rule has restricted domains
     */
    DomainModifier.prototype.hasRestrictedDomains = function () {
        return !!this.restrictedDomains && this.restrictedDomains.length > 0;
    };
    /**
     * Gets list of permitted domains.
     */
    DomainModifier.prototype.getPermittedDomains = function () {
        return this.permittedDomains;
    };
    /**
     * Gets list of restricted domains.
     */
    DomainModifier.prototype.getRestrictedDomains = function () {
        return this.restrictedDomains;
    };
    /**
     * isDomainOrSubdomainOfAny checks if `domain` is the same or a subdomain
     * of any of `domains`.
     *
     * @param domain - domain to check
     * @param domains - domains list to check against
     *
     * @returns true if `domain` is the same or a subdomain of any of `domains`
     */
    DomainModifier.isDomainOrSubdomainOfAny = function (domain, domains) {
        for (var i = 0; i < domains.length; i += 1) {
            var d = domains[i];
            if (DomainModifier.isWildcardDomain(d)) {
                if (DomainModifier.matchAsWildcard(d, domain)) {
                    return true;
                }
            }
            if (domain === d || (domain.endsWith(d) && domain.endsWith(".".concat(d)))) {
                return true;
            }
            if (SimpleRegex.isRegexPattern(d)) {
                try {
                    /**
                     * Regular expressions are cached internally by the browser
                     * (for instance, they're stored in the CompilationCache in V8/Chromium),
                     * so calling the constructor here should not be a problem.
                     *
                     * TODO use SimpleRegex.patternFromString(d) after it is refactored to not add 'g' flag
                     */
                    var domainPattern = new RegExp(d.slice(1, -1));
                    if (domainPattern.test(domain)) {
                        return true;
                    }
                }
                catch (_a) {
                    logger.error("Invalid regular expression as domain pattern: \"".concat(d, "\""));
                }
                continue;
            }
        }
        return false;
    };
    /**
     * Checks if domain ends with wildcard
     *
     * @param domain domain string to check
     *
     * @returns true if domain ends with wildcard
     */
    DomainModifier.isWildcardDomain = function (domain) {
        return domain.endsWith('.*');
    };
    /**
     * Checks if domain string does not ends with wildcard and is not regex pattern
     *
     * @param domain domain string to check
     *
     * @returns true if given domain is a wildcard or regexp pattern
     */
    DomainModifier.isWildcardOrRegexDomain = function (domain) {
        return DomainModifier.isWildcardDomain(domain) || SimpleRegex.isRegexPattern(domain);
    };
    /**
     * Checks if wildcard matches domain
     *
     * @param wildcard
     * @param domainNameToCheck
     *
     * @returns true if wildcard matches domain
     */
    DomainModifier.matchAsWildcard = function (wildcard, domainNameToCheck) {
        var wildcardedDomainToCheck = DomainModifier.genTldWildcard(domainNameToCheck);
        if (wildcardedDomainToCheck) {
            return wildcardedDomainToCheck === wildcard
                || (wildcardedDomainToCheck.endsWith(wildcard) && wildcardedDomainToCheck.endsWith(".".concat(wildcard)));
        }
        return false;
    };
    /**
     * Generates from domain tld wildcard e.g. google.com -> google.* ; youtube.co.uk -> youtube.*
     *
     * @param domainName
     *
     * @returns string is empty if tld for provided domain name doesn't exists
     */
    DomainModifier.genTldWildcard = function (domainName) {
        // To match eTld like "com.ru" we use allowPrivateDomains wildcard
        // https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2650
        var tld = (0,es6/* getPublicSuffix */.cH)(domainName, { allowPrivateDomains: true });
        if (tld) {
            // lastIndexOf() is needed not to match the domain, e.g. 'www.chrono24.ch'.
            // https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2312.
            return "".concat(domainName.slice(0, domainName.lastIndexOf(".".concat(tld))), ".*");
        }
        return '';
    };
    return DomainModifier;
}());

/**
 * Replace modifier class
 */
var ReplaceModifier = /** @class */ (function () {
    /**
     * Constructor
     *
     * @param value
     */
    function ReplaceModifier(value) {
        var parsed = ReplaceModifier.parseReplaceOption(value);
        this.replaceOption = parsed.optionText;
        this.replaceApply = parsed.apply;
    }
    /**
     *
     * @param option
     */
    ReplaceModifier.parseReplaceOption = function (option) {
        if (!option) {
            return {
                apply: function (x) { return x; },
                optionText: '',
            };
        }
        var parts = splitByDelimiterWithEscapeCharacter(option, '/', '\\', true);
        var modifiers = (parts[2] || '');
        if (modifiers.indexOf('g') < 0) {
            modifiers += 'g';
        }
        var pattern = new RegExp(parts[0], modifiers);
        // unescape replacement alias
        var replacement = parts[1].replace(/\\\$/g, '$');
        replacement = SimpleRegex.unescapeSpecials(replacement);
        var apply = function (input) { return input.replace(pattern, replacement); };
        return {
            apply: apply,
            optionText: option,
        };
    };
    /**
     * Replace content
     */
    ReplaceModifier.prototype.getValue = function () {
        return this.replaceOption;
    };
    /**
     * Replace apply function
     */
    ReplaceModifier.prototype.getApplyFunc = function () {
        return this.replaceApply;
    };
    return ReplaceModifier;
}());

var CSP_HEADER_NAME = 'Content-Security-Policy';
/**
 * Csp modifier class
 */
var CspModifier = /** @class */ (function () {
    /**
     * Constructor
     *
     * @param value
     * @param isAllowlist
     */
    function CspModifier(value, isAllowlist) {
        this.cspDirective = value;
        this.isAllowlist = isAllowlist;
        this.validateCspDirective();
    }
    /**
     * Csp directive
     */
    CspModifier.prototype.getValue = function () {
        return this.cspDirective;
    };
    /**
     * Validates CSP rule
     */
    CspModifier.prototype.validateCspDirective = function () {
        /**
         * https://github.com/AdguardTeam/AdguardBrowserExtension/issues/685
         * CSP directive may be empty in case of allowlist rule,
         * it means to disable all $csp rules matching the allowlist rule
         */
        if (!this.isAllowlist && !this.cspDirective) {
            throw new Error('Invalid $CSP rule: CSP directive must not be empty');
        }
        if (this.cspDirective) {
            /**
             * https://github.com/AdguardTeam/AdguardBrowserExtension/issues/685#issue-228287090
             * Forbids report-to and report-uri directives
             */
            var cspDirective = this.cspDirective.toLowerCase();
            if (cspDirective.indexOf('report-') >= 0) {
                throw new Error("Forbidden CSP directive: ".concat(cspDirective));
            }
        }
    };
    return CspModifier;
}());

/**
 * Cookie modifier class
 *
 * Learn more about it here:
 * https://github.com/AdguardTeam/AdguardBrowserExtension/issues/961
 */
var CookieModifier = /** @class */ (function () {
    /**
     * Constructor
     *
     * @param value
     */
    function CookieModifier(value) {
        // Save the source text of the option modifier
        this.optionValue = value || '';
        this.regex = null;
        this.cookieName = null;
        this.sameSite = null;
        this.maxAge = null;
        // Parse cookie name/regex
        var parts = this.optionValue.split(/;/);
        if (parts.length < 1) {
            throw new Error("Cannot parse ".concat(this.optionValue));
        }
        var cookieName = parts[0];
        if (cookieName.startsWith('/') && cookieName.endsWith('/')) {
            var pattern = cookieName.substring(1, cookieName.length - 1);
            // Save regex to be used further for matching cookies
            this.regex = new RegExp(pattern);
        }
        else {
            // Match by cookie name
            this.cookieName = cookieName;
        }
        // Parse other cookie options
        if (parts.length > 1) {
            for (var i = 1; i < parts.length; i += 1) {
                var nameValue = parts[i].split('=');
                var optionName = nameValue[0];
                var optionValue = nameValue[1];
                if (optionName === CookieModifier.MAX_AGE) {
                    this.maxAge = parseInt(optionValue, 10);
                }
                else if (optionName === CookieModifier.SAME_SITE) {
                    this.sameSite = optionValue;
                }
                else {
                    throw new Error("Unknown $cookie option: ".concat(optionName));
                }
            }
        }
    }
    /**
     * Modifier value
     */
    CookieModifier.prototype.getValue = function () {
        return this.optionValue;
    };
    /**
     * First cookie name
     */
    CookieModifier.prototype.getCookieName = function () {
        return this.cookieName;
    };
    /**
     * Max age cookie value
     */
    CookieModifier.prototype.getMaxAge = function () {
        return this.maxAge;
    };
    /**
     * Same site cookie value
     */
    CookieModifier.prototype.getSameSite = function () {
        return this.sameSite;
    };
    /**
     * Checks if cookie with the specified name matches this option
     *
     * @param {string} name Cookie name
     * @return {boolean} true if it does
     */
    CookieModifier.prototype.matches = function (name) {
        if (!name) {
            return false;
        }
        if (this.regex) {
            return this.regex.test(name);
        }
        if (this.cookieName) {
            return this.cookieName === name;
        }
        // Empty regex and cookieName means that we must match all cookies
        return true;
    };
    /**
     * Checks if cookie rule has an empty $cookie option
     *
     * @return {boolean} True if $cookie option is empty
     */
    CookieModifier.prototype.isEmpty = function () {
        return !this.regex && !this.cookieName;
    };
    /**
     * Cookie name maxAge
     */
    CookieModifier.MAX_AGE = 'maxAge';
    /**
     * Cookie name sameSite
     */
    CookieModifier.SAME_SITE = 'sameSite';
    /**
     * Checks if the given modifier is an instance of CookieModifier.
     *
     * @param m The modifier to check.
     * @returns True if the modifier is an instance of CookieModifier, false otherwise.
     */
    CookieModifier.isCookieModifier = function (m) {
        return m instanceof CookieModifier;
    };
    return CookieModifier;
}());

var _a$2;
/**
 * Array of all stealth options available, even those which are not supported by browser extension.
 */
var UniversalStealthOption;
(function (UniversalStealthOption) {
    UniversalStealthOption["HideSearchQueries"] = "searchqueries";
    UniversalStealthOption["DoNotTrack"] = "donottrack";
    UniversalStealthOption["ThirdPartyCookies"] = "3p-cookie";
    UniversalStealthOption["FirstPartyCookies"] = "1p-cookie";
    UniversalStealthOption["ThirdPartyCache"] = "3p-cache";
    UniversalStealthOption["ThirdPartyAuth"] = "3p-auth";
    UniversalStealthOption["WebRTC"] = "webrtc";
    UniversalStealthOption["Push"] = "push";
    UniversalStealthOption["Location"] = "location";
    UniversalStealthOption["Flash"] = "flash";
    UniversalStealthOption["Java"] = "java";
    UniversalStealthOption["HideReferrer"] = "referrer";
    UniversalStealthOption["UserAgent"] = "useragent";
    UniversalStealthOption["IP"] = "ip";
    UniversalStealthOption["XClientData"] = "xclientdata";
    UniversalStealthOption["DPI"] = "dpi";
})(UniversalStealthOption || (UniversalStealthOption = {}));
/**
 * List of stealth options, supported by browser extension, which can be disabled by $stealth modifier.
 *
 * Following stealth options are initialized on the engine start
 * and can't be disabled via $stealth modifier:
 * - `Block trackers` and `Remove tracking parameters`, as they are applied by a specific
 *   rule lists, initialized on app start;
 * - `Disabling WebRTC`, as it is not being applied on per-request basis.
 */
var StealthOptionName;
(function (StealthOptionName) {
    StealthOptionName["HideSearchQueries"] = "searchqueries";
    StealthOptionName["DoNotTrack"] = "donottrack";
    StealthOptionName["HideReferrer"] = "referrer";
    StealthOptionName["XClientData"] = "xclientdata";
    StealthOptionName["FirstPartyCookies"] = "1p-cookie";
    StealthOptionName["ThirdPartyCookies"] = "3p-cookie";
})(StealthOptionName || (StealthOptionName = {}));
var StealthModifierOptions = new Set(Object.values(StealthOptionName));
var UniversalStealthOptions = new Set(Object.values(UniversalStealthOption));
var StealthOption = (_a$2 = {
        NotSet: 0
    },
    _a$2[StealthOptionName.HideSearchQueries] = 1,
    _a$2[StealthOptionName.DoNotTrack] = 1 << 1,
    _a$2[StealthOptionName.HideReferrer] = 1 << 2,
    _a$2[StealthOptionName.XClientData] = 1 << 3,
    _a$2[StealthOptionName.FirstPartyCookies] = 1 << 4,
    _a$2[StealthOptionName.ThirdPartyCookies] = 1 << 5,
    _a$2);
/**
 * Stealth modifier class.
 * Rules with $stealth modifier will disable specified stealth options for matched requests.
 *
 * Learn more about it here:
 * https://adguard.com/kb/general/ad-filtering/create-own-filters/#stealth-modifier
 */
var StealthModifier = /** @class */ (function () {
    /**
     * Parses the options string and creates a new stealth modifier instance.
     *
     * @param optionsStr options string
     *
     * @throws SyntaxError on inverted stealth options, which are not supported
     */
    function StealthModifier(optionsStr) {
        this.PIPE_SEPARATOR = '|';
        this.options = StealthOption.NotSet;
        if (optionsStr.trim().length === 0) {
            return;
        }
        // This prevents parsing invalid syntax as rule without supported options
        if (optionsStr.includes(',')) {
            throw new SyntaxError("Invalid separator of stealth options used: \"".concat(optionsStr, "\""));
        }
        var tokens = optionsStr.split(this.PIPE_SEPARATOR);
        for (var i = 0; i < tokens.length; i += 1) {
            var optionName = tokens[i].trim();
            if (optionName === '') {
                continue;
            }
            if (optionName.startsWith('~')) {
                throw new SyntaxError("Inverted $stealth modifier values are not allowed: \"".concat(optionsStr, "\""));
            }
            if (!StealthModifier.isValidStealthOption(optionName)) {
                throw new SyntaxError("Invalid $stealth option in modifier value: \"".concat(optionsStr, "\""));
            }
            // Skip options which are not supported by browser extension
            if (!StealthModifier.isSupportedStealthOption(optionName)) {
                continue;
            }
            var option = StealthOption[optionName];
            if (this.options & option) {
                logger.debug("Duplicate $stealth modifier value \"".concat(optionName, "\" in \"").concat(optionsStr, "\""));
            }
            this.options |= option;
        }
        if (this.options === StealthOption.NotSet) {
            // eslint-disable-next-line max-len
            var msg = "$stealth modifier does not contain any options supported by browser extension: \"".concat(optionsStr, "\"");
            logger.debug(msg);
        }
    }
    /**
     * Checks if this stealth modifier has values.
     *
     * @returns True if this stealth modifier has at least one value
     */
    StealthModifier.prototype.hasValues = function () {
        return this.options !== StealthOption.NotSet;
    };
    /**
     * Checks if this stealth modifier is disabling the given stealth option.
     *
     * @param optionName - Stealth option name
     * @returns True if this stealth modifier is disabling the given stealth option
     */
    StealthModifier.prototype.hasStealthOption = function (optionName) {
        var option = StealthOption[optionName];
        return !!(option && this.options & option);
    };
    /**
     * Checks if the given string is a valid $stealth option, supported by browser extension.
     *
     * @param option - Option name
     * @returns True if the given string is a valid $stealth option
     */
    StealthModifier.isSupportedStealthOption = function (option) { return StealthModifierOptions.has(option); };
    /**
     * Checks if the given string is a valid $stealth option.
     * @param option
     * @returns
     */
    StealthModifier.isValidStealthOption = function (option) { return UniversalStealthOptions.has(option); };
    return StealthModifier;
}());

/**
 * Redirect modifier class
 */
var RedirectModifier = /** @class */ (function () {
    /**
     * Constructor
     *
     * @param value
     * @param ruleText
     * @param isAllowlist
     * @param isRedirectingOnlyBlocked is redirect-rule modifier
     */
    function RedirectModifier(value, isAllowlist, isRedirectingOnlyBlocked) {
        if (isRedirectingOnlyBlocked === void 0) { isRedirectingOnlyBlocked = false; }
        /**
         * Is redirecting only blocked requests
         * See $redirect-rule options
         */
        this.isRedirectingOnlyBlocked = false;
        RedirectModifier.validate(value, isAllowlist);
        this.redirectTitle = value;
        this.isRedirectingOnlyBlocked = isRedirectingOnlyBlocked;
    }
    /**
     * Redirect title
     */
    RedirectModifier.prototype.getValue = function () {
        return this.redirectTitle;
    };
    /**
     * Validates redirect rule
     *
     * @param ruleText
     * @param redirectTitle
     * @param isAllowlist
     */
    RedirectModifier.validate = function (redirectTitle, isAllowlist) {
        if (isAllowlist && !redirectTitle) {
            return;
        }
        if (!redirectTitle) {
            throw new SyntaxError('Invalid $redirect rule, redirect value must not be empty');
        }
        var redirects = (scriptlets_umd_default()).redirects;
        if (!redirects.isRedirectResourceCompatibleWithAdg(redirectTitle)) {
            throw new SyntaxError('$redirect modifier is invalid');
        }
    };
    return RedirectModifier;
}());

/**
 * Splits url into parts
 *
 * @param url
 */
function splitUrl(url) {
    var strippedUrl = url;
    var hash = '';
    var hashIndex = url.indexOf('#');
    if (hashIndex >= 0) {
        hash = url.slice(hashIndex);
        strippedUrl = url.slice(0, hashIndex);
    }
    var query = '';
    var queryIndex = url.indexOf('?');
    if (queryIndex >= 0) {
        query = strippedUrl.slice(queryIndex + 1);
        strippedUrl = strippedUrl.slice(0, queryIndex);
    }
    return {
        path: strippedUrl,
        query: query,
        hash: hash,
    };
}
/**
 * Normalizes url query parameters
 *
 * @param query
 */
function normalizeQuery(query) {
    // Cleanup empty params (p0=0&=2&=3)
    var result = query
        .split('&')
        .filter(function (x) { return x && !x.startsWith('='); })
        .join('&');
    // If we've collapsed the URL to the point where there's an '&' against the '?'
    // then we need to get rid of that.
    while (result.charAt(0) === '&') {
        result = result.slice(1);
    }
    return result;
}
/**
 * Removes query params from url by regexp
 *
 * @param url
 * @param regExp
 * @param invert remove every parameter in url except the ones matched regexp
 */
function cleanUrlParamByRegExp(url, regExp, invert) {
    if (invert === void 0) { invert = false; }
    var searchIndex = url.indexOf('?');
    // If no params, nothing to modify
    if (searchIndex === -1) {
        return url;
    }
    var split = splitUrl(url);
    var modifiedQuery;
    if (invert) {
        modifiedQuery = split.query
            .split('&')
            .filter(function (x) { return x; })
            .filter(function (x) { return x && x.match(regExp); })
            .join('&');
    }
    else {
        modifiedQuery = split.query
            .split('&')
            .filter(function (x) {
            var test = x.includes('=') ? x : "".concat(x, "=");
            return !test.match(regExp);
        })
            .join('&');
    }
    // Do not normalize if regexp is not applied
    if (modifiedQuery === split.query) {
        return url;
    }
    modifiedQuery = normalizeQuery(modifiedQuery);
    var result = split.path;
    if (modifiedQuery) {
        result += "?".concat(modifiedQuery);
    }
    return result + split.hash;
}
/**
 * Extract relative part from hierarchical structured URL
 * @param url
 */
var getRelativeUrl = function (url) {
    var i = url.indexOf('/', url.indexOf('://') + 3);
    return i !== -1 ? url.slice(i) : null;
};

/**
 * Query parameters filtering modifier class
 * Works with '$removeparam' modifier
 */
var RemoveParamModifier = /** @class */ (function () {
    /**
     * Constructor
     *
     * @param value
     */
    function RemoveParamModifier(value) {
        /**
         * Is modifier valid for MV3 or not
         */
        this.mv3Valid = true;
        this.value = value;
        var rawValue = value;
        // TODO: Seems like negation not using in valueRegExp
        if (value.startsWith('~')) {
            rawValue = value.substring(1);
            this.mv3Valid = false;
        }
        if (rawValue.startsWith('/')) {
            this.valueRegExp = SimpleRegex.patternFromString(rawValue);
            this.mv3Valid = false;
        }
        else {
            if (rawValue.includes('|')) {
                throw new Error('Unsupported option in $removeparam: multiple values are not allowed');
            }
            this.valueRegExp = new RegExp("((^|&)(".concat(SimpleRegex.escapeRegexSpecials(rawValue), ")=[^&#]*)"), 'g');
        }
    }
    /**
     * Modifier value
     */
    RemoveParamModifier.prototype.getValue = function () {
        return this.value;
    };
    /**
     * Is modifier valid for MV3 or not
     */
    RemoveParamModifier.prototype.getMV3Validity = function () {
        return this.mv3Valid;
    };
    /**
     * Removes query parameters from url
     *
     * @param url
     */
    RemoveParamModifier.prototype.removeParameters = function (url) {
        var sepIndex = url.indexOf('?');
        if (sepIndex < 0) {
            return url;
        }
        if (!this.value) {
            return url.substring(0, sepIndex);
        }
        if (sepIndex === url.length - 1) {
            return url;
        }
        if (this.value.startsWith('~')) {
            return cleanUrlParamByRegExp(url, this.valueRegExp, true);
        }
        return cleanUrlParamByRegExp(url, this.valueRegExp);
    };
    /**
     * Checks if the given modifier is an instance of RemoveParamModifier.
     *
     * @param m The modifier to check.
     * @returns True if the modifier is an instance of RemoveParamModifier, false otherwise.
     */
    RemoveParamModifier.isRemoveParamModifier = function (m) {
        return m instanceof RemoveParamModifier;
    };
    return RemoveParamModifier;
}());

/**
 * Headers filtering modifier class.
 * Rules with $removeheader modifier are intended to remove headers from HTTP requests and responses.
 */
var RemoveHeaderModifier = /** @class */ (function () {
    /**
     * Constructor
     *
     * @param value
     * @param isAllowlist
     */
    function RemoveHeaderModifier(value, isAllowlist) {
        this.value = value.toLowerCase();
        if (!isAllowlist && !this.value) {
            throw new SyntaxError('Invalid $removeheader rule, removeheader value must not be empty');
        }
        this.isRequestModifier = this.value.startsWith(RemoveHeaderModifier.REQUEST_PREFIX);
        var headerName = this.isRequestModifier
            ? this.value.substring(RemoveHeaderModifier.REQUEST_PREFIX.length)
            : this.value;
        // Values with ":" are not supported in MV3 declarative rules, e.g. "$removeheader=dnt:1"
        this.valid = RemoveHeaderModifier.isAllowedHeader(headerName) && !headerName.includes(':');
        this.applicableHeaderName = this.valid ? headerName : null;
    }
    /**
     * Modifier value
     */
    RemoveHeaderModifier.prototype.getValue = function () {
        return this.value;
    };
    Object.defineProperty(RemoveHeaderModifier.prototype, "isValid", {
        /**
         * Modifier validity
         */
        get: function () {
            return this.valid;
        },
        enumerable: false,
        configurable: true
    });
    /**
     * Returns effective header name to be removed
     *
     * @param isRequestHeaders
     */
    RemoveHeaderModifier.prototype.getApplicableHeaderName = function (isRequestHeaders) {
        if (!this.applicableHeaderName) {
            return null;
        }
        if (isRequestHeaders !== this.isRequestModifier) {
            return null;
        }
        return this.applicableHeaderName;
    };
    /**
     * Some headers are forbidden to remove
     *
     * @param headerName
     */
    RemoveHeaderModifier.isAllowedHeader = function (headerName) {
        return !this.FORBIDDEN_HEADERS.includes(headerName);
    };
    /**
     * List of forbidden headers
     */
    RemoveHeaderModifier.FORBIDDEN_HEADERS = [
        'access-control-allow-origin',
        'access-control-allow-credentials',
        'access-control-allow-headers',
        'access-control-allow-methods',
        'access-control-expose-headers',
        'access-control-max-age',
        'access-control-request-headers',
        'access-control-request-method',
        'origin',
        'timing-allow-origin',
        'allow',
        'cross-origin-embedder-policy',
        'cross-origin-opener-policy',
        'cross-origin-resource-policy',
        'content-security-policy',
        'content-security-policy-report-only',
        'expect-ct',
        'feature-policy',
        'origin-isolation',
        'strict-transport-security',
        'upgrade-insecure-requests',
        'x-content-type-options',
        'x-download-options',
        'x-frame-options',
        'x-permitted-cross-domain-policies',
        'x-powered-by',
        'x-xss-protection',
        'public-key-pins',
        'public-key-pins-report-only',
        'sec-websocket-key',
        'sec-websocket-extensions',
        'sec-websocket-accept',
        'sec-websocket-protocol',
        'sec-websocket-version',
        'p3p',
        'sec-fetch-mode',
        'sec-fetch-dest',
        'sec-fetch-site',
        'sec-fetch-user',
        'referrer-policy',
        'content-type',
        'content-length',
        'accept',
        'accept-encoding',
        'host',
        'connection',
        'transfer-encoding',
        'upgrade',
    ];
    /**
     * Request prefix
     */
    RemoveHeaderModifier.REQUEST_PREFIX = 'request:';
    /**
     * Checks if the given modifier is an instance of RemoveHeaderModifier.
     *
     * @param m The modifier to check.
     * @returns True if the modifier is an instance of RemoveHeaderModifier, false otherwise.
     */
    RemoveHeaderModifier.isRemoveHeaderModifier = function (m) {
        return m instanceof RemoveHeaderModifier;
    };
    return RemoveHeaderModifier;
}());

/**
 * This is a helper class that is used specifically to work with app restrictions.
 *
 * https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#app
 *
 * Examples:
 * ||baddomain.com^$app=org.example.app
 * ||baddomain.com^$app=org.example.app1|org.example.app2
 */
var AppModifier = /** @class */ (function () {
    /**
     * Parses the `apps` string
     *
     * @param apps - apps string
     *
     * @throws an error if the app string is empty or invalid
     */
    function AppModifier(apps) {
        if (!apps) {
            throw new SyntaxError('$app modifier cannot be empty');
        }
        var permittedApps = [];
        var restrictedApps = [];
        var parts = apps.split(SEPARATOR);
        for (var i = 0; i < parts.length; i += 1) {
            var app = parts[i];
            var restricted = false;
            if (app.startsWith('~')) {
                restricted = true;
                app = app.substring(1).trim();
            }
            if (app === '') {
                throw new SyntaxError("Empty app specified in \"".concat(apps, "\""));
            }
            if (restricted) {
                restrictedApps.push(app);
            }
            else {
                permittedApps.push(app);
            }
        }
        this.restrictedApps = restrictedApps.length > 0 ? restrictedApps : null;
        this.permittedApps = permittedApps.length > 0 ? permittedApps : null;
    }
    return AppModifier;
}());

var HTTPMethod;
(function (HTTPMethod) {
    HTTPMethod["GET"] = "GET";
    HTTPMethod["POST"] = "POST";
    HTTPMethod["PUT"] = "PUT";
    HTTPMethod["DELETE"] = "DELETE";
    HTTPMethod["PATCH"] = "PATCH";
    HTTPMethod["HEAD"] = "HEAD";
    HTTPMethod["OPTIONS"] = "OPTIONS";
    HTTPMethod["CONNECT"] = "CONNECT";
    HTTPMethod["TRACE"] = "TRACE";
})(HTTPMethod || (HTTPMethod = {}));
/**
 * Method modifier class.
 * Rules with $method modifier will be applied only to requests with specified methods.
 *
 * Learn more about it here:
 * https://adguard.com/kb/general/ad-filtering/create-own-filters/#method-modifier
 */
var MethodModifier = /** @class */ (function () {
    /**
     * Constructor
     *
     * @param value
     */
    function MethodModifier(methodsStr) {
        if (methodsStr === '') {
            throw new SyntaxError('$method modifier value cannot be empty');
        }
        var permittedMethods = [];
        var restrictedMethods = [];
        var parts = methodsStr.toUpperCase().split(MethodModifier.PIPE_SEPARATOR);
        for (var i = 0; i < parts.length; i += 1) {
            var method = parts[i].trim();
            var restricted = false;
            if (method.startsWith('~')) {
                restricted = true;
                method = method.substring(1);
            }
            if (!MethodModifier.isHTTPMethod(method)) {
                throw new SyntaxError("Invalid $method modifier value: ".concat(method));
            }
            if (restricted) {
                restrictedMethods.push(method);
            }
            else {
                permittedMethods.push(method);
            }
        }
        if (restrictedMethods.length > 0 && permittedMethods.length > 0) {
            throw new SyntaxError("Negated values cannot be mixed with non-negated values: ".concat(methodsStr));
        }
        this.restrictedValues = restrictedMethods.length > 0 ? restrictedMethods : null;
        this.permittedValues = permittedMethods.length > 0 ? permittedMethods : null;
    }
    /**
     * Request methods separator
     */
    MethodModifier.PIPE_SEPARATOR = '|';
    MethodModifier.isHTTPMethod = function (value) { return value in HTTPMethod; };
    return MethodModifier;
}());

/**
 * Header modifier class.
 * The $header modifier allows matching the HTTP response
 * by a specific header with (optionally) a specific value.
 *
 * Learn more about it here:
 * https://adguard.com/kb/general/ad-filtering/create-own-filters/#header-modifier
 */
var HeaderModifier = /** @class */ (function () {
    /**
     * Constructor
     * @param headerStr Header modifier value.
     */
    function HeaderModifier(headerStr) {
        /**
         * Colon separator.
         */
        this.COLON_SEPARATOR = ':';
        /**
         * Forward slash regexp marker.
         */
        this.FORWARD_SLASH = '/';
        if (headerStr === '') {
            throw new SyntaxError('$header modifier value cannot be empty');
        }
        var separatorIndex = headerStr.indexOf(this.COLON_SEPARATOR);
        if (separatorIndex === -1) {
            this.header = headerStr;
            this.value = null;
            return;
        }
        this.header = headerStr.slice(0, separatorIndex);
        var rawValue = headerStr.slice(separatorIndex + 1);
        if (rawValue === '') {
            throw new SyntaxError("Invalid $header modifier value: \"".concat(headerStr, "\""));
        }
        if (rawValue.startsWith(this.FORWARD_SLASH) && rawValue.endsWith(this.FORWARD_SLASH)) {
            this.value = new RegExp(rawValue.slice(1, -1));
        }
        else {
            this.value = rawValue;
        }
    }
    /**
     * Returns header modifier value
     * @returns header modifier value
     */
    HeaderModifier.prototype.getHeaderModifierValue = function () {
        return {
            header: this.header,
            value: this.value,
        };
    };
    return HeaderModifier;
}());

/**
 * To modifier class.
 * Rules with $to modifier are limited to requests made to the specified domains and their subdomains.
 *
 * Learn more about it here:
 * https://adguard.com/kb/general/ad-filtering/create-own-filters/#to-modifier
 */
var ToModifier = /** @class */ (function () {
    /**
     * Constructor
     */
    function ToModifier(domainsStr) {
        if (!domainsStr) {
            throw new SyntaxError('$to modifier value cannot be empty');
        }
        var permittedDomains = [];
        var restrictedDomains = [];
        var parts = domainsStr.toLowerCase().split(ToModifier.PIPE_SEPARATOR);
        for (var i = 0; i < parts.length; i += 1) {
            var domain = parts[i].trim();
            var restricted = false;
            if (domain.startsWith('~')) {
                restricted = true;
                domain = domain.substring(1);
            }
            if (domain === '') {
                throw new SyntaxError("Empty domain specified in \"".concat(domainsStr, "\""));
            }
            if (restricted) {
                restrictedDomains.push(domain);
            }
            else {
                permittedDomains.push(domain);
            }
        }
        this.restrictedValues = restrictedDomains.length > 0 ? restrictedDomains : null;
        this.permittedValues = permittedDomains.length > 0 ? permittedDomains : null;
    }
    /**
     * Domains separator
     */
    ToModifier.PIPE_SEPARATOR = '|';
    return ToModifier;
}());

var PERMISSIONS_POLICY_HEADER_NAME = 'Permissions-Policy';
var COMMA_SEPARATOR = ',';
var PIPE_SEPARATOR = '|';
/**
 * Permissions modifier class.
 * Allows setting permission policies, effectively blocking specific page functionality.
 *
 * Learn more about it here:
 * https://adguard.com/kb/general/ad-filtering/create-own-filters/#permissions-modifier
 */
var PermissionsModifier = /** @class */ (function () {
    /**
     * Constructor
     * @param permissionPolicyStr
     * @param isAllowlist
     */
    function PermissionsModifier(permissionPolicyStr, isAllowlist) {
        this.permissionPolicyDirective = permissionPolicyStr
            .replace(PermissionsModifier.RE_SEPARATOR_REPLACE, COMMA_SEPARATOR);
        PermissionsModifier.validatePermissionPolicyDirective(this.permissionPolicyDirective, isAllowlist);
    }
    /**
     * Returns permission policy allowlist string
     * @returns permission policy allowlist string
     */
    PermissionsModifier.prototype.getValue = function () {
        return this.permissionPolicyDirective;
    };
    /**
     * Validates permission policy directive
     * @throws SyntaxError on invalid permission policy directive
     */
    PermissionsModifier.validatePermissionPolicyDirective = function (directive, isAllowlist) {
        /**
         * $permissions modifier value may be empty only in case of allowlist rule,
         * it means to disable all $permissions rules matching the rule pattern.
        */
        if (!isAllowlist && !directive) {
            throw new SyntaxError('Invalid $permissions rule: permissions directive must not be empty');
        }
    };
    /**
     * Regular expression to apply correct separators.
     * It replaces escaped commas and pipe separators with commas.
     */
    PermissionsModifier.RE_SEPARATOR_REPLACE = new RegExp("(\\\\".concat(COMMA_SEPARATOR, "|\\").concat(PIPE_SEPARATOR, ")"), 'g');
    return PermissionsModifier;
}());

/**
 * Compatibility types are used to configure engine for better support of different libraries
 * For example:
 *  extension doesn't support $app modifier. So if we set in configuration CompatibilityTypes.Extension,
 *  engine would ignore rules with $app modifier
 */
var CompatibilityTypes;
(function (CompatibilityTypes) {
    CompatibilityTypes[CompatibilityTypes["Extension"] = 1] = "Extension";
    CompatibilityTypes[CompatibilityTypes["CoreLibs"] = 2] = "CoreLibs";
    CompatibilityTypes[CompatibilityTypes["Dns"] = 4] = "Dns";
})(CompatibilityTypes || (CompatibilityTypes = {}));
/**
 * Application configuration class
 */
var Configuration = /** @class */ (function () {
    function Configuration(inputConfig) {
        this.defaultConfig = {
            engine: null,
            version: null,
            verbose: false,
            compatibility: null,
        };
        /**
         * {'extension'|'corelibs'} engine application type
         */
        this.engine = null;
        /**
         * {string} version
         */
        this.version = null;
        /**
         * {boolean} verbose flag
         */
        this.verbose = false;
        /**
         * compatibility flag
         */
        this.compatibility = CompatibilityTypes.Extension;
        var config = __assign(__assign({}, this.defaultConfig), inputConfig);
        this.engine = config.engine;
        this.version = config.version;
        this.verbose = config.verbose;
        this.compatibility = config.compatibility;
    }
    return Configuration;
}());
// eslint-disable-next-line import/no-mutable-exports
var config = new Configuration();
/**
 * Checks config is compatible with input level
 * @param compatibilityLevel
 * @private
 */
function isCompatibleWith(compatibilityLevel) {
    if (config.compatibility === null) {
        return false;
    }
    return (config.compatibility & compatibilityLevel) === compatibilityLevel;
}

var NETWORK_RULE_OPTIONS = {
    THIRD_PARTY: 'third-party',
    FIRST_PARTY: 'first-party',
    MATCH_CASE: 'match-case',
    IMPORTANT: 'important',
    DOMAIN: 'domain',
    DENYALLOW: 'denyallow',
    ELEMHIDE: 'elemhide',
    GENERICHIDE: 'generichide',
    SPECIFICHIDE: 'specifichide',
    GENERICBLOCK: 'genericblock',
    JSINJECT: 'jsinject',
    URLBLOCK: 'urlblock',
    CONTENT: 'content',
    DOCUMENT: 'document',
    DOC: 'doc',
    STEALTH: 'stealth',
    POPUP: 'popup',
    EMPTY: 'empty',
    MP4: 'mp4',
    SCRIPT: 'script',
    STYLESHEET: 'stylesheet',
    SUBDOCUMENT: 'subdocument',
    OBJECT: 'object',
    IMAGE: 'image',
    XMLHTTPREQUEST: 'xmlhttprequest',
    MEDIA: 'media',
    FONT: 'font',
    WEBSOCKET: 'websocket',
    OTHER: 'other',
    PING: 'ping',
    BADFILTER: 'badfilter',
    CSP: 'csp',
    REPLACE: 'replace',
    COOKIE: 'cookie',
    REDIRECT: 'redirect',
    REDIRECTRULE: 'redirect-rule',
    REMOVEPARAM: 'removeparam',
    REMOVEHEADER: 'removeheader',
    JSONPRUNE: 'jsonprune',
    HLS: 'hls',
    REFERRERPOLICY: 'referrerpolicy',
    APP: 'app',
    NETWORK: 'network',
    EXTENSION: 'extension',
    NOOP: '_',
    CLIENT: 'client',
    DNSREWRITE: 'dnsrewrite',
    DNSTYPE: 'dnstype',
    CTAG: 'ctag',
    HEADER: 'header',
    METHOD: 'method',
    TO: 'to',
    PERMISSIONS: 'permissions',
    ALL: 'all',
};
var OPTIONS_DELIMITER = '$';
var MASK_ALLOWLIST = '@@';
var NOT_MARK = '~';

/**
 * RequestType is the request types enumeration.
 * Important: the enumeration is marked as const to avoid side effects when
 * importing it into an extension.
 */
var RequestType = {
    /** No value is set. Syntax sugar to simplify code. */
    NotSet: 0,
    /** main frame */
    Document: 1,
    /** (iframe) $subdocument */
    SubDocument: 2,
    /** (javascript, etc) $script */
    Script: 4,
    /** (css) $stylesheet */
    Stylesheet: 8,
    /** (flash, etc) $object */
    Object: 16,
    /** (any image) $image */
    Image: 32,
    /** (ajax/fetch) $xmlhttprequest */
    XmlHttpRequest: 64,
    /** (video/music) $media */
    Media: 128,
    /** (any custom font) $font */
    Font: 256,
    /** (a websocket connection) $websocket */
    WebSocket: 512,
    /** (navigator.sendBeacon()) $ping */
    Ping: 1024,
    /** csp_report */
    CspReport: 2048,
    /** any other request type */
    Other: 4096, // 1 << 12
};

/**
 * This is the base class representing double values modifiers
 */
var BaseValuesModifier = /** @class */ (function () {
    /**
     * Parses the values string
     *
     * @param values - values string
     *
     * @throws an error if the string is empty or invalid
     */
    function BaseValuesModifier(values) {
        if (!values) {
            throw new SyntaxError('Modifier cannot be empty');
        }
        this.value = values;
        var permittedValues = [];
        var restrictedValues = [];
        var parts = values.split(SEPARATOR);
        for (var i = 0; i < parts.length; i += 1) {
            var app = parts[i];
            var restricted = false;
            if (app.startsWith('~')) {
                restricted = true;
                app = app.substring(1).trim();
            }
            if (app === '') {
                throw new SyntaxError("Empty values specified in \"".concat(values, "\""));
            }
            if (restricted) {
                restrictedValues.push(app);
            }
            else {
                permittedValues.push(app);
            }
        }
        this.restricted = restrictedValues.length > 0 ? restrictedValues : null;
        this.permitted = permittedValues.length > 0 ? permittedValues : null;
    }
    BaseValuesModifier.prototype.getPermitted = function () {
        return this.permitted;
    };
    BaseValuesModifier.prototype.getRestricted = function () {
        return this.restricted;
    };
    BaseValuesModifier.prototype.getValue = function () {
        return this.value;
    };
    BaseValuesModifier.prototype.match = function (value) {
        if (!this.restricted && !this.permitted) {
            return true;
        }
        if (this.restricted && this.restricted.includes(value)) {
            return false;
        }
        if (this.permitted) {
            return this.permitted.includes(value);
        }
        return true;
    };
    return BaseValuesModifier;
}());

/**
 * Netmasks class
 */
var NetmasksCollection = /** @class */ (function () {
    function NetmasksCollection() {
        this.ipv4Masks = [];
        this.ipv6Masks = [];
    }
    /**
     * Returns true if any of the containing masks contains provided value
     *
     * @param value
     */
    NetmasksCollection.prototype.contains = function (value) {
        if (is_ip_default().v4(value)) {
            return this.ipv4Masks.some(function (x) { return (0,cidr_tools/* contains */.r3)(x, value); });
        }
        return this.ipv6Masks.some(function (x) { return (0,cidr_tools/* contains */.r3)(x, value); });
    };
    return NetmasksCollection;
}());
/**
 * The client modifier allows specifying clients this rule will be working for.
 * It accepts client names (not ClientIDs), IP addresses, or CIDR ranges.
 */
var ClientModifier = /** @class */ (function (_super) {
    __extends(ClientModifier, _super);
    /**
     * Constructor
     *
     * @param value
     */
    function ClientModifier(value) {
        var _this = _super.call(this, value) || this;
        var permitted = _this.getPermitted();
        if (permitted) {
            _this.permitted = ClientModifier.stripValues(permitted);
            _this.permittedNetmasks = ClientModifier.parseNetmasks(_this.permitted);
        }
        var restricted = _this.getRestricted();
        if (restricted) {
            _this.restricted = ClientModifier.stripValues(restricted);
            _this.restrictedNetmasks = ClientModifier.parseNetmasks(_this.restricted);
        }
        return _this;
    }
    /**
     * Unquotes and unescapes string
     *
     * @param values
     */
    ClientModifier.stripValues = function (values) {
        return values.map(function (v) {
            if ((v.startsWith('"') && v.endsWith('"'))
                || (v.startsWith('\'') && v.endsWith('\''))) {
                // eslint-disable-next-line no-param-reassign
                v = v.substr(1, v.length - 2);
            }
            return v.replace(/\\/ig, '');
        });
    };
    /**
     * Checks if this modifier matches provided params
     *
     * @param clientName
     * @param clientIP
     */
    ClientModifier.prototype.matchAny = function (clientName, clientIP) {
        if (this.restricted) {
            if (clientName && this.restricted.includes(clientName)) {
                return false;
            }
            if (clientIP && this.restricted.includes(clientIP)) {
                return false;
            }
            return true;
        }
        if (this.restrictedNetmasks) {
            if (clientIP && this.restrictedNetmasks.contains(clientIP)) {
                return false;
            }
            return true;
        }
        if (this.permitted) {
            if (clientName && this.permitted.includes(clientName)) {
                return true;
            }
            if (clientIP && this.permitted.includes(clientIP)) {
                return true;
            }
        }
        if (this.permittedNetmasks) {
            if (clientIP && this.permittedNetmasks.contains(clientIP)) {
                return true;
            }
        }
        return false;
    };
    /**
     * Parses netmasks from client's strings
     *
     * @param values
     */
    ClientModifier.parseNetmasks = function (values) {
        var result = new NetmasksCollection();
        values.forEach(function (x) {
            var cidrVersion = is_cidr_default()(x);
            if (cidrVersion === 4) {
                result.ipv4Masks.push(x);
            }
            else if (cidrVersion === 6) {
                result.ipv6Masks.push(x);
            }
        });
        return result;
    };
    return ClientModifier;
}(BaseValuesModifier));

/**
 * The dnsrewrite response modifier allows replacing the content of the response
 * to the DNS request for the matching hosts.
 *
 * TODO: This modifier is not yet implemented
 * https://github.com/AdguardTeam/AdGuardHome/wiki/Hosts-Blocklists#dnsrewrite
 */
var DnsRewriteModifier = /** @class */ (function () {
    /**
     * Constructor
     *
     * @param value
     */
    function DnsRewriteModifier(value) {
        this.value = value;
    }
    /**
     * Modifier value
     */
    DnsRewriteModifier.prototype.getValue = function () {
        return this.value;
    };
    return DnsRewriteModifier;
}());

/**
 * The dnstype modifier allows specifying DNS request type on which this rule will be triggered.
 */
var DnsTypeModifier = /** @class */ (function (_super) {
    __extends(DnsTypeModifier, _super);
    /**
     * Constructor
     *
     * @param value
     */
    function DnsTypeModifier(value) {
        var _this = _super.call(this, value) || this;
        if (_this.permitted) {
            _this.restricted = null;
        }
        return _this;
    }
    return DnsTypeModifier;
}(BaseValuesModifier));

/**
 * The ctag modifier allows to block domains only for specific types of DNS client tags.
 */
var CtagModifier = /** @class */ (function (_super) {
    __extends(CtagModifier, _super);
    /**
     * Constructor
     *
     * @param value
     */
    function CtagModifier(value) {
        var _this = _super.call(this, value) || this;
        _this.validate();
        return _this;
    }
    /**
     * Validates tag values
     */
    CtagModifier.prototype.validate = function () {
        if (!this.getValue()) {
            throw new Error('Invalid rule: Ctag modifier must not be empty');
        }
        var tags = this.permitted ? this.permitted : this.restricted;
        if (tags && tags.some(function (x) { return !CtagModifier.ALLOWED_TAGS.includes(x); })) {
            throw new Error('Invalid rule: Invalid ctag modifier');
        }
    };
    /**
     * The list of allowed tags
     */
    CtagModifier.ALLOWED_TAGS = [
        // By device type:
        'device_audio',
        'device_camera',
        'device_gameconsole',
        'device_laptop',
        'device_nas',
        'device_pc',
        'device_phone',
        'device_printer',
        'device_securityalarm',
        'device_tablet',
        'device_tv',
        'device_other',
        // By operating system:
        'os_android',
        'os_ios',
        'os_linux',
        'os_macos',
        'os_windows',
        'os_other',
        // By user group:
        'user_admin',
        'user_regular',
        'user_child',
    ];
    return CtagModifier;
}(BaseValuesModifier));

/**
 * Rule pattern class
 *
 * This class parses rule pattern text to simple fields.
 */
var Pattern = /** @class */ (function () {
    /**
     * Constructor
     * @param pattern
     * @param matchcase
     */
    function Pattern(pattern, matchcase) {
        if (matchcase === void 0) { matchcase = false; }
        this.pattern = pattern;
        this.shortcut = SimpleRegex.extractShortcut(this.pattern);
        this.matchcase = matchcase;
    }
    /**
     * Checks if this rule pattern matches the specified request.
     *
     * @param request - request to check
     * @param shortcutMatched if true, it means that the request already matches
     * this pattern's shortcut and we don't need to match it again.
     * @returns true if pattern matches
     */
    Pattern.prototype.matchPattern = function (request, shortcutMatched) {
        this.prepare();
        if (this.patternShortcut) {
            return shortcutMatched || this.matchShortcut(request.urlLowercase);
        }
        if (this.hostname) {
            // If we have a `||example.org^` rule, it's easier to match
            // against the request's hostname only without matching
            // a regular expression.
            return request.hostname === this.hostname
                || ( // First light check without new string memory allocation
                request.hostname.endsWith(this.hostname)
                    // Strict check
                    && request.hostname.endsWith(".".concat(this.hostname)));
        }
        // If the regular expression is invalid, just return false right away.
        if (this.regexInvalid || !this.regex) {
            return false;
        }
        // This is needed for DNS filtering only, not used in browser blocking.
        if (this.shouldMatchHostname(request)) {
            return this.regex.test(request.hostname);
        }
        return this.regex.test(request.url);
    };
    /**
     * Checks if this rule pattern matches the specified relative path string.
     * This method is used in cosmetic rules to implement the $path modifier matching logic.
     *
     * @param path - path to check
     * @returns true if pattern matches
     */
    Pattern.prototype.matchPathPattern = function (path) {
        this.prepare();
        if (this.hostname) {
            return false;
        }
        var pathIsEmptyString = this.pattern === '';
        // No-value $path should match root URL
        if (pathIsEmptyString && path === '/') {
            return true;
        }
        if (!pathIsEmptyString && this.patternShortcut) {
            return this.matchShortcut(path);
        }
        // If the regular expression is invalid, just return false right away.
        if (this.regexInvalid || !this.regex) {
            return false;
        }
        return this.regex.test(path);
    };
    /**
     * matchShortcut simply checks if shortcut is a substring of the URL.
     * @param request - request to check.
     */
    Pattern.prototype.matchShortcut = function (str) {
        return str.indexOf(this.shortcut) >= 0;
    };
    /**
     * Prepares this pattern
     */
    Pattern.prototype.prepare = function () {
        if (this.prepared) {
            return;
        }
        this.prepared = true;
        // If shortcut and pattern are the same, we don't need to actually compile
        // a regex and can simply use matchShortcut instead,
        // except for the $match-case modifier
        if (this.pattern === this.shortcut && !this.matchcase) {
            this.patternShortcut = true;
            return;
        }
        // Rules like `/example/*` are rather often in the real-life filters,
        // we might want to process them.
        if (this.pattern.startsWith(this.shortcut)
            && this.pattern.length === this.shortcut.length + 1
            && this.pattern.endsWith('*')) {
            this.patternShortcut = true;
            return;
        }
        if (this.pattern.startsWith(SimpleRegex.MASK_START_URL)
            && this.pattern.endsWith(SimpleRegex.MASK_SEPARATOR)
            && this.pattern.indexOf('*') < 0
            && this.pattern.indexOf('/') < 0) {
            this.hostname = this.pattern.slice(2, this.pattern.length - 1);
            return;
        }
        this.compileRegex();
    };
    /**
     * Compiles this pattern regex
     */
    Pattern.prototype.compileRegex = function () {
        var regexText = SimpleRegex.patternToRegexp(this.pattern);
        try {
            var flags = 'i';
            if (this.matchcase) {
                flags = '';
            }
            this.regex = new RegExp(regexText, flags);
        }
        catch (e) {
            this.regexInvalid = true;
        }
    };
    /**
     * Checks if we should match hostnames and not the URL
     * this is important for the cases when we use urlfilter for DNS-level blocking
     * Note, that even though we may work on a DNS-level, we should still sometimes match full URL instead
     *
     * @param request
     */
    Pattern.prototype.shouldMatchHostname = function (request) {
        if (!request.isHostnameRequest) {
            return false;
        }
        return !this.isPatternDomainSpecific();
    };
    /**
     * In case pattern starts with the following it targets some specific domain
     */
    Pattern.prototype.isPatternDomainSpecific = function () {
        if (this.patternDomainSpecific === undefined) {
            this.patternDomainSpecific = this.pattern.startsWith(SimpleRegex.MASK_START_URL)
                || this.pattern.startsWith('http://')
                || this.pattern.startsWith('https:/')
                || this.pattern.startsWith('://');
        }
        return this.patternDomainSpecific;
    };
    return Pattern;
}());

/**
 * Counts the number of bits in the number and returns it
 *
 * @param a number to count bits
 *
 * @returns The number of bits in the number.
 */
function getBitCount(a) {
    var count = 0;
    var n = a;
    while (n > 0) {
        count += n & 1;
        n >>= 1;
    }
    return count;
}
/**
 * Count the number of bits enabled in a number based on a bit mask
 *
 * @param base Base number to check
 * @param mask Mask to check
 *
 * @returns The number of bits enabled in the base number based on the mask
 *
 * @example
 * countEnabledBits(0b100, 0b110); // 1
 * countEnabledBits(0b111, 0b000); // 0
 */
function countEnabledBits(base, mask) {
    // Get the common bits between the base and the mask
    var common = base & mask;
    // Count the number of bits enabled in the common bits
    return getBitCount(common);
}

// eslint-disable-next-line max-classes-per-file
/**
 * NetworkRuleOption is the enumeration of various rule options.
 * In order to save memory, we store some options as a flag.
 * https://adguard.com/kb/general/ad-filtering/create-own-filters/#basic-rule-modifiers
 */
var NetworkRuleOption;
(function (NetworkRuleOption) {
    /** No value is set. Syntax sugar to simplify code. */
    NetworkRuleOption[NetworkRuleOption["NotSet"] = 0] = "NotSet";
    /** $third-party modifier */
    NetworkRuleOption[NetworkRuleOption["ThirdParty"] = 1] = "ThirdParty";
    /** $match-case modifier */
    NetworkRuleOption[NetworkRuleOption["MatchCase"] = 2] = "MatchCase";
    /** $important modifier */
    NetworkRuleOption[NetworkRuleOption["Important"] = 4] = "Important";
    // Allowlist rules modifiers
    // Each of them can disable part of the functionality
    /** $elemhide modifier */
    NetworkRuleOption[NetworkRuleOption["Elemhide"] = 8] = "Elemhide";
    /** $generichide modifier */
    NetworkRuleOption[NetworkRuleOption["Generichide"] = 16] = "Generichide";
    /** $specifichide modifier */
    NetworkRuleOption[NetworkRuleOption["Specifichide"] = 32] = "Specifichide";
    /** $genericblock modifier */
    NetworkRuleOption[NetworkRuleOption["Genericblock"] = 64] = "Genericblock";
    /** $jsinject modifier */
    NetworkRuleOption[NetworkRuleOption["Jsinject"] = 128] = "Jsinject";
    /** $urlblock modifier */
    NetworkRuleOption[NetworkRuleOption["Urlblock"] = 256] = "Urlblock";
    /** $content modifier */
    NetworkRuleOption[NetworkRuleOption["Content"] = 512] = "Content";
    /** $extension modifier */
    NetworkRuleOption[NetworkRuleOption["Extension"] = 1024] = "Extension";
    /** $stealth modifier */
    NetworkRuleOption[NetworkRuleOption["Stealth"] = 2048] = "Stealth";
    // Other modifiers
    /** $popup modifier */
    NetworkRuleOption[NetworkRuleOption["Popup"] = 4096] = "Popup";
    /** $csp modifier */
    NetworkRuleOption[NetworkRuleOption["Csp"] = 8192] = "Csp";
    /** $replace modifier */
    NetworkRuleOption[NetworkRuleOption["Replace"] = 16384] = "Replace";
    /** $cookie modifier */
    NetworkRuleOption[NetworkRuleOption["Cookie"] = 32768] = "Cookie";
    /** $redirect modifier */
    NetworkRuleOption[NetworkRuleOption["Redirect"] = 65536] = "Redirect";
    /** $badfilter modifier */
    NetworkRuleOption[NetworkRuleOption["Badfilter"] = 131072] = "Badfilter";
    /** $removeparam modifier */
    NetworkRuleOption[NetworkRuleOption["RemoveParam"] = 262144] = "RemoveParam";
    /** $removeheader modifier */
    NetworkRuleOption[NetworkRuleOption["RemoveHeader"] = 524288] = "RemoveHeader";
    /** $jsonprune modifier */
    NetworkRuleOption[NetworkRuleOption["JsonPrune"] = 1048576] = "JsonPrune";
    /** $hls modifier */
    NetworkRuleOption[NetworkRuleOption["Hls"] = 2097152] = "Hls";
    // Compatibility dependent
    /** $network modifier */
    NetworkRuleOption[NetworkRuleOption["Network"] = 4194304] = "Network";
    /** dns modifiers */
    NetworkRuleOption[NetworkRuleOption["Client"] = 8388608] = "Client";
    NetworkRuleOption[NetworkRuleOption["DnsRewrite"] = 16777216] = "DnsRewrite";
    NetworkRuleOption[NetworkRuleOption["DnsType"] = 33554432] = "DnsType";
    NetworkRuleOption[NetworkRuleOption["Ctag"] = 67108864] = "Ctag";
    /* $method modifier */
    NetworkRuleOption[NetworkRuleOption["Method"] = 134217728] = "Method";
    /* $to modifier */
    NetworkRuleOption[NetworkRuleOption["To"] = 268435456] = "To";
    /* $permissions modifier */
    NetworkRuleOption[NetworkRuleOption["Permissions"] = 536870912] = "Permissions";
    /* $header modifier */
    NetworkRuleOption[NetworkRuleOption["Header"] = 1073741824] = "Header";
})(NetworkRuleOption || (NetworkRuleOption = {}));
/**
 * NetworkRuleOptions is the enumeration of various rule options groups
 * needed for validation.
 */
var NetworkRuleGroupOptions;
(function (NetworkRuleGroupOptions) {
    /** Allowlist-only modifiers */
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["AllowlistOnly"] = 4088] = "AllowlistOnly";
    /** Options supported by host-level network rules * */
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["OptionHostLevelRules"] = 125960196] = "OptionHostLevelRules";
    /**
     * Cosmetic option modifiers
     */
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["CosmeticOption"] = 696] = "CosmeticOption";
    /**
     * Removeparam compatible modifiers
     *
     * $removeparam rules are compatible only with content type modifiers ($subdocument, $script, $stylesheet, etc)
     * except $document (using by default) and this list of modifiers:
     */
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["RemoveParamCompatibleOptions"] = 393223] = "RemoveParamCompatibleOptions";
    /**
     * Removeheader compatible modifiers
     *
     * $removeheader rules are compatible only with content type modifiers ($subdocument, $script, $stylesheet, etc)
     * except $document (using by default) and this list of modifiers:
     */
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["RemoveHeaderCompatibleOptions"] = 1074397191] = "RemoveHeaderCompatibleOptions";
    /**
     * Permissions compatible modifiers
     *
     * $permissions is compatible with the limited list of modifiers: $domain, $important, and $subdocument
     */
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["PermissionsCompatibleOptions"] = 537001988] = "PermissionsCompatibleOptions";
    /**
     * Header compatible modifiers
     *
     * $header is compatible with the limited list of modifiers: $csp and $removeheader (on response headers).
     */
    NetworkRuleGroupOptions[NetworkRuleGroupOptions["HeaderCompatibleOptions"] = 1074405380] = "HeaderCompatibleOptions";
})(NetworkRuleGroupOptions || (NetworkRuleGroupOptions = {}));
/**
 * Basic network filtering rule.
 * https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#basic-rules
 */
var NetworkRule = /** @class */ (function () {
    /**
     * Creates an instance of the {@link NetworkRule}.
     * It parses this rule and extracts the rule pattern (see {@link SimpleRegex}),
     * and rule modifiers.
     *
     * @param inputRule Original rule text.
     * @param filterListId ID of the filter list this rule belongs to.
     * @param ruleIndex line start index in the source filter list; it will be used to find the original rule text
     * in the filtering log when a rule is applied. Default value is {@link RULE_INDEX_NONE} which means that
     * the rule does not have source index.
     *
     * @throws error if it fails to parse the rule.
     */
    function NetworkRule(node, filterListId, ruleIndex) {
        if (ruleIndex === void 0) { ruleIndex = RULE_INDEX_NONE; }
        var _a, _b;
        /**
         * Domains in denyallow modifier providing exceptions for permitted domains
         * https://github.com/AdguardTeam/CoreLibs/issues/1304
         */
        this.denyAllowDomains = null;
        /**
         * Flag with all enabled rule options.
         */
        this.enabledOptions = NetworkRuleOption.NotSet;
        /**
         * Flag with all disabled rule options.
         */
        this.disabledOptions = NetworkRuleOption.NotSet;
        /**
         * Flag with all permitted request types.
         */
        this.permittedRequestTypes = RequestType.NotSet;
        /**
         * Flag with all restricted request types.
         */
        this.restrictedRequestTypes = RequestType.NotSet;
        /**
         * Rule Advanced modifier
         */
        this.advancedModifier = null;
        /**
         * Rule Domain modifier
         */
        this.domainModifier = null;
        /**
         * Rule App modifier
         */
        this.appModifier = null;
        /**
         * Rule Method modifier
         */
        this.methodModifier = null;
        /**
         * Rule header modifier
         */
        this.headerModifier = null;
        /**
         * Rule To modifier
         */
        this.toModifier = null;
        /**
         * Rule Stealth modifier
         */
        this.stealthModifier = null;
        /**
         * Options used by the rule, regardless of whether they are enabled or disabled.
         */
        this.usedOptionNames = new Set();
        /**
         * Rule priority, which is needed when the engine has to choose between
         * several rules matching the query. This value is calculated based on
         * the rule modifiers enabled or disabled and rounded up
         * to the smallest integer greater than or equal to the calculated weight
         * in the {@link calculatePriorityWeight}.
         *
         * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#priority-category-1
         */
        this.priorityWeight = 1;
        this.ruleIndex = ruleIndex;
        // TODO: Remove this completely
        this.ruleText = agtree/* RuleParser.generate */.sR.generate(node);
        this.filterListId = filterListId;
        this.allowlist = node.exception;
        var pattern = node.pattern.value;
        if (pattern && hasSpaces(pattern)) {
            throw new SyntaxError('Rule has spaces, seems to be an host rule');
        }
        if ((_b = (_a = node.modifiers) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.length) {
            this.loadOptions(node.modifiers);
        }
        if (NetworkRule.isTooGeneral(node)) {
            throw new SyntaxError("Rule is too general: ".concat(agtree/* RuleParser.generate */.sR.generate(node)));
        }
        this.calculatePriorityWeight();
        this.pattern = new Pattern(pattern, this.isOptionEnabled(NetworkRuleOption.MatchCase));
    }
    // TODO: Remove .getText() completely
    NetworkRule.prototype.getText = function () {
        return this.ruleText;
    };
    NetworkRule.prototype.getIndex = function () {
        return this.ruleIndex;
    };
    /**
     * Returns the identifier of the filter from which the rule was received.
     *
     * @returns Identifier of the filter from which the rule was received.
     */
    NetworkRule.prototype.getFilterListId = function () {
        return this.filterListId;
    };
    /**
     * Returns all options that are used in the rule, regardless of whether they are
     * enabled or disabled.
     *
     * @return Set of option names
     */
    NetworkRule.prototype.getUsedOptionNames = function () {
        return this.usedOptionNames;
    };
    /**
     * Each rule has its own priority, which is necessary when several rules
     * match the request and the filtering system needs to select one of them.
     * Priority is measured as a positive integer.
     * In the case of a conflict between two rules with the same priority value,
     * it is not specified which one of them will be chosen.
     *
     * @returns Rule priority.
     */
    NetworkRule.prototype.getPriorityWeight = function () {
        return this.priorityWeight;
    };
    /**
     * Returns rule pattern,
     * which currently is used only in the rule validator module
     */
    NetworkRule.prototype.getPattern = function () {
        return this.pattern.pattern;
    };
    /**
     * Returns `true` if the rule is "allowlist", e.g. if it disables other
     * rules when the pattern matches the request.
     */
    NetworkRule.prototype.isAllowlist = function () {
        return this.allowlist;
    };
    /**
     * Checks if the rule is a document-level allowlist rule with $urlblock or
     * $genericblock or $content.
     * This means that the rule is supposed to disable or modify blocking
     * of the page subrequests.
     * For instance, `@@||example.org^$urlblock` unblocks all sub-requests.
     */
    NetworkRule.prototype.isDocumentLevelAllowlistRule = function () {
        if (!this.isAllowlist()) {
            return false;
        }
        return this.isOptionEnabled(NetworkRuleOption.Urlblock)
            || this.isOptionEnabled(NetworkRuleOption.Genericblock)
            || this.isOptionEnabled(NetworkRuleOption.Content);
    };
    /**
     * Checks if the rule completely disables filtering.
     */
    NetworkRule.prototype.isFilteringDisabled = function () {
        if (!this.isAllowlist()) {
            return false;
        }
        return this.isOptionEnabled(NetworkRuleOption.Elemhide)
            && this.isOptionEnabled(NetworkRuleOption.Content)
            && this.isOptionEnabled(NetworkRuleOption.Urlblock)
            && this.isOptionEnabled(NetworkRuleOption.Jsinject);
    };
    /**
     * The longest part of pattern without any special characters.
     * It is used to improve the matching performance.
     */
    NetworkRule.prototype.getShortcut = function () {
        return this.pattern.shortcut;
    };
    /**
     * Gets list of permitted domains.
     * See https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#domain-modifier
     */
    NetworkRule.prototype.getPermittedDomains = function () {
        if (this.domainModifier) {
            return this.domainModifier.getPermittedDomains();
        }
        return null;
    };
    /**
     * Gets list of restricted domains.
     * See https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#domain-modifier
     */
    NetworkRule.prototype.getRestrictedDomains = function () {
        if (this.domainModifier) {
            return this.domainModifier.getRestrictedDomains();
        }
        return null;
    };
    /**
     * Gets list of denyAllow domains.
     * See https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#denyallow-modifier
     */
    NetworkRule.prototype.getDenyAllowDomains = function () {
        return this.denyAllowDomains;
    };
    /**
     * Get list of permitted $to domains.
     * See https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#to-modifier
     */
    NetworkRule.prototype.getPermittedToDomains = function () {
        if (this.toModifier) {
            return this.toModifier.permittedValues;
        }
        return null;
    };
    /**
     * Get list of restricted $to domains.
     * See https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#to-modifier
     */
    NetworkRule.prototype.getRestrictedToDomains = function () {
        if (this.toModifier) {
            return this.toModifier.restrictedValues;
        }
        return null;
    };
    /**
     * Gets list of permitted domains.
     * See https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#app
     */
    NetworkRule.prototype.getPermittedApps = function () {
        if (this.appModifier) {
            return this.appModifier.permittedApps;
        }
        return null;
    };
    /**
     * Gets list of restricted domains.
     * See https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#app
     */
    NetworkRule.prototype.getRestrictedApps = function () {
        if (this.appModifier) {
            return this.appModifier.restrictedApps;
        }
        return null;
    };
    /**
     * Gets list of permitted methods.
     * See https://kb.adguard.com/general/how-to-create-your-own-ad-filters#method-modifier
     */
    NetworkRule.prototype.getRestrictedMethods = function () {
        if (this.methodModifier) {
            return this.methodModifier.restrictedValues;
        }
        return null;
    };
    /**
     * Gets list of restricted methods.
     * See https://kb.adguard.com/general/how-to-create-your-own-ad-filters#method-modifier
     */
    NetworkRule.prototype.getPermittedMethods = function () {
        if (this.methodModifier) {
            return this.methodModifier.permittedValues;
        }
        return null;
    };
    /**
     * Flag with all permitted request types.
     * The value {@link RequestType.NotSet} here means "all request types are allowed".
     */
    NetworkRule.prototype.getPermittedRequestTypes = function () {
        return this.permittedRequestTypes;
    };
    /**
     * Flag with all restricted request types.
     * The value {@link RequestType.NotSet} here means "no type of request is restricted".
     */
    NetworkRule.prototype.getRestrictedRequestTypes = function () {
        return this.restrictedRequestTypes;
    };
    /**
     * Advanced modifier
     */
    NetworkRule.prototype.getAdvancedModifier = function () {
        return this.advancedModifier;
    };
    /**
     * Stealth modifier
     */
    NetworkRule.prototype.getStealthModifier = function () {
        return this.stealthModifier;
    };
    /**
     * Advanced modifier value
     */
    NetworkRule.prototype.getAdvancedModifierValue = function () {
        return this.advancedModifier && this.advancedModifier.getValue();
    };
    /**
     * Retrieves the header modifier value.
     */
    NetworkRule.prototype.getHeaderModifierValue = function () {
        if (!this.headerModifier) {
            return null;
        }
        return this.headerModifier.getHeaderModifierValue();
    };
    /**
     * isRegexRule returns true if rule's pattern is a regular expression.
     * https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#regexp-support
     */
    NetworkRule.prototype.isRegexRule = function () {
        return (this.getPattern().startsWith(SimpleRegex.MASK_REGEX_RULE)
            && this.getPattern().endsWith(SimpleRegex.MASK_REGEX_RULE));
    };
    /**
     * Checks if this filtering rule matches the specified request.
     * @param request - request to check.
     * @param useShortcut - the flag to use this rule shortcut
     *
     * In case we use Trie in lookup table, we don't need to use shortcut cause we already check if request's url
     * includes full rule shortcut.
     */
    NetworkRule.prototype.match = function (request, useShortcut) {
        if (useShortcut === void 0) { useShortcut = true; }
        // Regex rules should not be tested by shortcut
        if (useShortcut && !this.matchShortcut(request)) {
            return false;
        }
        if (this.isOptionEnabled(NetworkRuleOption.Method) && !this.matchMethod(request.method)) {
            return false;
        }
        if (this.isOptionEnabled(NetworkRuleOption.ThirdParty) && !request.thirdParty) {
            return false;
        }
        if (this.isOptionDisabled(NetworkRuleOption.ThirdParty) && request.thirdParty) {
            return false;
        }
        if (!this.matchRequestType(request.requestType)) {
            return false;
        }
        if (!this.matchDomainModifier(request)) {
            return false;
        }
        if (this.isOptionEnabled(NetworkRuleOption.RemoveParam)
            || this.isOptionEnabled(NetworkRuleOption.Permissions)) {
            if (!this.matchRequestTypeExplicit(request.requestType)) {
                return false;
            }
        }
        if (!this.matchDenyAllowDomains(request.hostname)) {
            return false;
        }
        if (this.isOptionEnabled(NetworkRuleOption.To) && !this.matchToModifier(request.hostname)) {
            return false;
        }
        if (!this.matchDnsType(request.dnsType)) {
            return false;
        }
        if (!this.matchClientTags(request.clientTags)) {
            return false;
        }
        if (!this.matchClient(request.clientName, request.clientIP)) {
            return false;
        }
        return this.pattern.matchPattern(request, true);
    };
    /**
     * matchShortcut simply checks if shortcut is a substring of the URL.
     * @param request - request to check.
     */
    NetworkRule.prototype.matchShortcut = function (request) {
        return request.urlLowercase.indexOf(this.getShortcut()) >= 0;
    };
    /**
     * Check if request matches domain modifier by request referrer (general case) or by request target
     *
     * In some cases the $domain modifier can match not only the referrer domain, but also the target domain.
     * This happens when the following is true (1 AND ((2 AND 3) OR 4):
     *
     * 1) The request has $document request type (not subdocument)
     * 2) The rule's pattern doesn't match any particular domain(s)
     * 3) The rule's pattern doesn't contain regular expressions
     * 4) The $domain modifier contains only excluded domains (e.g., $domain=~example.org|~example.com)
     *
     * When all these conditions are met, the domain modifier will match both the referrer domain and the target domain.
     * https://github.com/AdguardTeam/tsurlfilter/issues/45
     * @param request
     */
    NetworkRule.prototype.matchDomainModifier = function (request) {
        if (!this.domainModifier) {
            return true;
        }
        var domainModifier = this.domainModifier;
        var isDocumentType = request.requestType === RequestType.Document;
        var hasOnlyExcludedDomains = !domainModifier.hasPermittedDomains()
            && domainModifier.hasRestrictedDomains();
        var patternIsRegex = this.isRegexRule();
        var patternIsDomainSpecific = this.pattern.isPatternDomainSpecific();
        var matchesTargetByPatternCondition = !patternIsRegex && !patternIsDomainSpecific;
        if (isDocumentType && (hasOnlyExcludedDomains || matchesTargetByPatternCondition)) {
            // check if matches source hostname if exists or if matches target hostname
            return (request.sourceHostname && domainModifier.matchDomain(request.sourceHostname))
                || domainModifier.matchDomain(request.hostname);
        }
        return domainModifier.matchDomain(request.sourceHostname || '');
    };
    /**
     * checks if the filtering rule is allowed on this domain.
     * @param domain
     */
    NetworkRule.prototype.matchDenyAllowDomains = function (domain) {
        if (!this.denyAllowDomains) {
            return true;
        }
        if (this.denyAllowDomains.length > 0) {
            if (DomainModifier.isDomainOrSubdomainOfAny(domain, this.denyAllowDomains)) {
                return false;
            }
        }
        return true;
    };
    /**
     * Checks if the request domain matches the specified conditions.
     *
     * @param domain The request's domain.
     * @return true if the request domain matches the permitted domains and does not match the restricted domains.
     */
    NetworkRule.prototype.matchToModifier = function (domain) {
        if (!this.toModifier) {
            return true;
        }
        /**
         * The request's domain must be either explicitly permitted or not be included
         * in the list of restricted domains for the rule to apply.
         */
        var permittedDomains = this.getPermittedToDomains();
        var restrictedDomains = this.getRestrictedToDomains();
        var matches = false;
        if (permittedDomains) {
            matches = DomainModifier.isDomainOrSubdomainOfAny(domain, permittedDomains);
        }
        if (restrictedDomains) {
            matches = !DomainModifier.isDomainOrSubdomainOfAny(domain, restrictedDomains);
        }
        return matches;
    };
    /**
     * Return TRUE if this rule matches with the tags associated with a client
     *
     * @param clientTags
     */
    NetworkRule.prototype.matchClientTags = function (clientTags) {
        var advancedModifier = this.getAdvancedModifier();
        if (!advancedModifier || !(advancedModifier instanceof CtagModifier)) {
            return true;
        }
        if (!clientTags) {
            return false;
        }
        var cTagsModifier = advancedModifier;
        return clientTags.every(function (x) { return cTagsModifier.match(x); });
    };
    /**
     * returns TRUE if the rule matches with the specified client
     *
     * @param clientName
     * @param clientIP
     */
    NetworkRule.prototype.matchClient = function (clientName, clientIP) {
        var advancedModifier = this.getAdvancedModifier();
        if (!advancedModifier || !(advancedModifier instanceof ClientModifier)) {
            return true;
        }
        if (!clientName && !clientIP) {
            return false;
        }
        var modifier = advancedModifier;
        return modifier.matchAny(clientName, clientIP);
    };
    /**
     * Return TRUE if this rule matches with the request dnstype
     *
     * @param dnstype
     */
    NetworkRule.prototype.matchDnsType = function (dnstype) {
        var advancedModifier = this.getAdvancedModifier();
        if (!advancedModifier || !(advancedModifier instanceof DnsTypeModifier)) {
            return true;
        }
        if (!dnstype) {
            return false;
        }
        var modifier = advancedModifier;
        return modifier.match(dnstype);
    };
    /**
     * Checks if rule has permitted apps
     */
    NetworkRule.prototype.hasPermittedApps = function () {
        if (!this.appModifier) {
            return false;
        }
        return this.appModifier.permittedApps !== null && this.appModifier.permittedApps.length > 0;
    };
    /**
     * matchRequestType checks if the request's type matches the rule properties
     * @param requestType - request type to check.
     */
    NetworkRule.prototype.matchRequestType = function (requestType) {
        if (this.permittedRequestTypes !== RequestType.NotSet) {
            if ((this.permittedRequestTypes & requestType) !== requestType) {
                return false;
            }
        }
        if (this.restrictedRequestTypes !== RequestType.NotSet) {
            if ((this.restrictedRequestTypes & requestType) === requestType) {
                return false;
            }
        }
        return true;
    };
    /**
     * In case of $removeparam, $permissions modifier,
     * we only allow it to target other content types if the rule has an explicit content-type modifier.
     */
    NetworkRule.prototype.matchRequestTypeExplicit = function (requestType) {
        if (this.permittedRequestTypes === RequestType.NotSet
            && this.restrictedRequestTypes === RequestType.NotSet
            && requestType !== RequestType.Document
            && requestType !== RequestType.SubDocument) {
            return false;
        }
        return this.matchRequestType(requestType);
    };
    /**
     * Checks if request's method matches with the rule
     *
     * @param method request's method
     * @returns true, if rule must be applied to the request
     */
    NetworkRule.prototype.matchMethod = function (method) {
        if (!method || !MethodModifier.isHTTPMethod(method)) {
            return false;
        }
        /**
         * Request's method must be either explicitly
         * permitted or not be included in list of restricted methods
         * for the rule to apply
         */
        var permittedMethods = this.getPermittedMethods();
        if (permittedMethods === null || permittedMethods === void 0 ? void 0 : permittedMethods.includes(method)) {
            return true;
        }
        var restrictedMethods = this.getRestrictedMethods();
        return !!restrictedMethods && !restrictedMethods.includes(method);
    };
    /**
     * Checks if request's response headers matches with
     * the rule's $header modifier value
     *
     * @param responseHeadersItems request's response headers
     * @returns true, if rule must be applied to the request
     */
    NetworkRule.prototype.matchResponseHeaders = function (responseHeadersItems) {
        if (!responseHeadersItems || responseHeadersItems.length === 0) {
            return false;
        }
        var ruleData = this.getHeaderModifierValue();
        if (!ruleData) {
            return false;
        }
        var ruleHeaderName = ruleData.header, ruleHeaderValue = ruleData.value;
        return responseHeadersItems.some(function (responseHeadersItem) {
            var responseHeaderName = responseHeadersItem.name, responseHeaderValue = responseHeadersItem.value;
            // Header name matching is case-insensitive
            if (ruleHeaderName.toLowerCase() !== responseHeaderName.toLowerCase()) {
                return false;
            }
            if (ruleHeaderValue === null) {
                return true;
            }
            // Unlike header name, header value matching is case-sensitive
            if (typeof ruleHeaderValue === 'string') {
                return ruleHeaderValue === responseHeaderValue;
            }
            if (responseHeaderValue && ruleHeaderValue instanceof RegExp) {
                return ruleHeaderValue.test(responseHeaderValue);
            }
            return false;
        });
    };
    /**
     * Checks if a network rule is too general.
     */
    NetworkRule.isTooGeneral = function (node) {
        var _a, _b;
        return !((_b = (_a = node.modifiers) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.length) && node.pattern.value.length < 4;
    };
    /**
     * Parses the options string and saves them.
     * More on the rule modifiers:
     * https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#basic-rules-modifiers
     *
     * @param options - Modifier list node.
     *
     * @throws an error if there is an unsupported modifier
     */
    NetworkRule.prototype.loadOptions = function (options) {
        for (var _i = 0, _a = options.children; _i < _a.length; _i++) {
            var option = _a[_i];
            var value = EMPTY_STRING;
            if (option.value && option.value.value) {
                value = option.value.value;
            }
            this.loadOption(option.name.value, value, option.exception);
            this.usedOptionNames.add(option.name.value);
        }
        this.validateOptions();
    };
    /**
     * Returns true if rule contains (enabled or disabled) specified option.
     * Please note, that options have three state: enabled, disabled, undefined.
     *
     * @param option - rule option to check.
     */
    NetworkRule.prototype.hasOption = function (option) {
        return this.isOptionEnabled(option) || this.isOptionDisabled(option);
    };
    /**
     * Returns true if rule has at least one cosmetic option enabled.
     */
    NetworkRule.prototype.hasCosmeticOption = function () {
        return (this.enabledOptions & NetworkRuleGroupOptions.CosmeticOption) !== 0;
    };
    /**
     * Returns true if the specified option is enabled.
     * Please note, that options have three state: enabled, disabled, undefined.
     *
     * @param option - rule option to check.
     */
    NetworkRule.prototype.isOptionEnabled = function (option) {
        return (this.enabledOptions & option) === option;
    };
    /**
     * Returns true if one and only option is enabled
     *
     * @param option
     */
    NetworkRule.prototype.isSingleOptionEnabled = function (option) {
        return this.enabledOptions === option;
    };
    /**
     * Returns true if the specified option is disabled.
     * Please note, that options have three state: enabled, disabled, undefined.
     *
     * @param option - rule option to check.
     */
    NetworkRule.prototype.isOptionDisabled = function (option) {
        return (this.disabledOptions & option) === option;
    };
    /**
     * Checks if the rule has higher priority that the specified rule
     * allowlist + $important > $important > redirect > allowlist > basic rules
     */
    NetworkRule.prototype.isHigherPriority = function (r) {
        return this.priorityWeight > r.priorityWeight;
    };
    /**
     * Returns true if the rule is considered "generic"
     * "generic" means that the rule is not restricted to a limited set of domains
     * Please note that it might be forbidden on some domains, though.
     *
     * @return {boolean}
     */
    NetworkRule.prototype.isGeneric = function () {
        var _a;
        return !((_a = this.domainModifier) === null || _a === void 0 ? void 0 : _a.hasPermittedDomains());
    };
    /**
     * Returns true if this rule negates the specified rule
     * Only makes sense when this rule has a `badfilter` modifier
     */
    NetworkRule.prototype.negatesBadfilter = function (specifiedRule) {
        if (!this.isOptionEnabled(NetworkRuleOption.Badfilter)) {
            return false;
        }
        if (this.allowlist !== specifiedRule.allowlist) {
            return false;
        }
        if (this.pattern.pattern !== specifiedRule.pattern.pattern) {
            return false;
        }
        if (this.permittedRequestTypes !== specifiedRule.permittedRequestTypes) {
            return false;
        }
        if (this.restrictedRequestTypes !== specifiedRule.restrictedRequestTypes) {
            return false;
        }
        if ((this.enabledOptions ^ NetworkRuleOption.Badfilter) !== specifiedRule.enabledOptions) {
            return false;
        }
        if (this.disabledOptions !== specifiedRule.disabledOptions) {
            return false;
        }
        if (!stringArraysEquals(this.getRestrictedDomains(), specifiedRule.getRestrictedDomains())) {
            return false;
        }
        if (!stringArraysHaveIntersection(this.getPermittedDomains(), specifiedRule.getPermittedDomains())) {
            return false;
        }
        return true;
    };
    /**
     * Checks if this rule can be used for hosts-level blocking
     */
    NetworkRule.prototype.isHostLevelNetworkRule = function () {
        var _a, _b;
        if (((_a = this.domainModifier) === null || _a === void 0 ? void 0 : _a.hasPermittedDomains()) || ((_b = this.domainModifier) === null || _b === void 0 ? void 0 : _b.hasRestrictedDomains())) {
            return false;
        }
        if (this.permittedRequestTypes !== 0 && this.restrictedRequestTypes !== 0) {
            return false;
        }
        if (this.disabledOptions !== NetworkRuleOption.NotSet) {
            return false;
        }
        if (this.enabledOptions !== NetworkRuleOption.NotSet) {
            return ((this.enabledOptions
                & NetworkRuleGroupOptions.OptionHostLevelRules)
                | (this.enabledOptions
                    ^ NetworkRuleGroupOptions.OptionHostLevelRules)) === NetworkRuleGroupOptions.OptionHostLevelRules;
        }
        return true;
    };
    /**
     * Enables or disables the specified option.
     *
     * @param option - option to enable or disable.
     * @param enabled - true to enable, false to disable.
     * @param skipRestrictions - skip options allowlist/blacklist restrictions
     *
     * @throws an error if the option we're trying to enable cannot be.
     * For instance, you cannot enable $elemhide for blacklist rules.
     */
    NetworkRule.prototype.setOptionEnabled = function (option, enabled, skipRestrictions) {
        if (skipRestrictions === void 0) { skipRestrictions = false; }
        if (!skipRestrictions) {
            if (!this.allowlist && (option & NetworkRuleGroupOptions.AllowlistOnly) === option) {
                throw new SyntaxError("Modifier ".concat(NetworkRuleOption[option], " cannot be used in blacklist rule"));
            }
        }
        if (enabled) {
            this.enabledOptions |= option;
        }
        else {
            this.disabledOptions |= option;
        }
    };
    /**
     * Permits or forbids the specified request type.
     * "Permits" means that the rule will match **only** the types that are permitted.
     * "Restricts" means that the rule will match **all but restricted**.
     *
     * @param requestType - request type.
     * @param permitted - true if it's permitted (whic)
     */
    NetworkRule.prototype.setRequestType = function (requestType, permitted) {
        if (permitted) {
            this.permittedRequestTypes |= requestType;
        }
        else {
            this.restrictedRequestTypes |= requestType;
        }
    };
    /**
     * Sets and validates exceptionally allowed domains presented in $denyallow modifier
     *
     * @param optionValue
     */
    NetworkRule.prototype.setDenyAllowDomains = function (optionValue) {
        var domainModifier = new DomainModifier(optionValue, PIPE_SEPARATOR$1);
        if (domainModifier.restrictedDomains && domainModifier.restrictedDomains.length > 0) {
            throw new SyntaxError('Invalid modifier: $denyallow domains cannot be negated');
        }
        if (domainModifier.permittedDomains) {
            if (domainModifier.permittedDomains.some(DomainModifier.isWildcardOrRegexDomain)) {
                throw new SyntaxError('Invalid modifier: $denyallow does not support wildcards and regex domains');
            }
        }
        this.denyAllowDomains = domainModifier.permittedDomains;
    };
    /**
     * Loads the specified modifier:
     * https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#basic-rules-modifiers
     *
     * @param optionName - modifier name.
     * @param optionValue - modifier value.
     * @param exception - true if the modifier is negated.
     *
     * @throws an error if there is an unsupported modifier
     */
    NetworkRule.prototype.loadOption = function (optionName, optionValue, exception) {
        var _this = this;
        if (exception === void 0) { exception = false; }
        var OPTIONS = NetworkRule.OPTIONS, NEGATABLE_OPTIONS = NetworkRule.NEGATABLE_OPTIONS;
        if (optionName.startsWith(OPTIONS.NOOP)) {
            /**
             * A noop modifier does nothing and can be used to increase some rules readability.
             * It consists of the sequence of underscore characters (_) of any length
             * and can appear in a rule as many times as it's needed.
             */
            if (!optionName.split(OPTIONS.NOOP).some(function (s) { return !!s; })) {
                return;
            }
        }
        // TODO: Speed up this by creating a map from names to bit mask positions
        if (exception && !NEGATABLE_OPTIONS.has(optionName)) {
            throw new SyntaxError("Invalid modifier: '".concat(optionName, "' cannot be negated"));
        }
        switch (optionName) {
            // General options
            // $first-party, $~first-party
            case OPTIONS.FIRST_PARTY:
                this.setOptionEnabled(NetworkRuleOption.ThirdParty, exception);
                break;
            // $third-party, $~third-party
            case OPTIONS.THIRD_PARTY:
                this.setOptionEnabled(NetworkRuleOption.ThirdParty, !exception);
                break;
            // $match-case, $~match-case
            case OPTIONS.MATCH_CASE:
                this.setOptionEnabled(NetworkRuleOption.MatchCase, !exception);
                break;
            // $important
            case OPTIONS.IMPORTANT:
                this.setOptionEnabled(NetworkRuleOption.Important, true);
                break;
            // $domain
            case OPTIONS.DOMAIN:
                this.domainModifier = new DomainModifier(optionValue, PIPE_SEPARATOR$1);
                break;
            // $denyallow
            case OPTIONS.DENYALLOW:
                this.setDenyAllowDomains(optionValue);
                break;
            // $method modifier
            case OPTIONS.METHOD: {
                this.setOptionEnabled(NetworkRuleOption.Method, true);
                this.methodModifier = new MethodModifier(optionValue);
                break;
            }
            // $header modifier
            case OPTIONS.HEADER:
                this.setOptionEnabled(NetworkRuleOption.Header, true);
                this.headerModifier = new HeaderModifier(optionValue);
                break;
            // $to modifier
            case OPTIONS.TO: {
                this.setOptionEnabled(NetworkRuleOption.To, true);
                this.toModifier = new ToModifier(optionValue);
                break;
            }
            // Document-level allowlist rules
            // $elemhide
            case OPTIONS.ELEMHIDE:
                this.setOptionEnabled(NetworkRuleOption.Elemhide, true);
                this.setRequestType(RequestType.Document, true);
                this.setRequestType(RequestType.SubDocument, true);
                break;
            // $generichide
            case OPTIONS.GENERICHIDE:
                this.setOptionEnabled(NetworkRuleOption.Generichide, true);
                this.setRequestType(RequestType.Document, true);
                this.setRequestType(RequestType.SubDocument, true);
                break;
            // $specifichide
            case OPTIONS.SPECIFICHIDE:
                this.setOptionEnabled(NetworkRuleOption.Specifichide, true);
                this.setRequestType(RequestType.Document, true);
                this.setRequestType(RequestType.SubDocument, true);
                break;
            // $genericblock
            case OPTIONS.GENERICBLOCK:
                this.setOptionEnabled(NetworkRuleOption.Genericblock, true);
                this.setRequestType(RequestType.Document, true);
                this.setRequestType(RequestType.SubDocument, true);
                break;
            // $jsinject
            case OPTIONS.JSINJECT:
                this.setOptionEnabled(NetworkRuleOption.Jsinject, true);
                this.setRequestType(RequestType.Document, true);
                this.setRequestType(RequestType.SubDocument, true);
                break;
            // $urlblock
            case OPTIONS.URLBLOCK:
                this.setOptionEnabled(NetworkRuleOption.Urlblock, true);
                this.setRequestType(RequestType.Document, true);
                this.setRequestType(RequestType.SubDocument, true);
                break;
            // $content
            case OPTIONS.CONTENT:
                this.setOptionEnabled(NetworkRuleOption.Content, true);
                this.setRequestType(RequestType.Document, true);
                this.setRequestType(RequestType.SubDocument, true);
                break;
            // $document, $doc / $~document, $~doc
            case OPTIONS.DOCUMENT:
            case OPTIONS.DOC:
                if (exception) {
                    this.setRequestType(RequestType.Document, false);
                    break;
                }
                this.setRequestType(RequestType.Document, true);
                // In the case of allowlist rules $document implicitly includes
                // all these modifiers: `$content`, `$elemhide`, `$jsinject`,
                // `$urlblock`.
                if (this.isAllowlist()) {
                    this.setOptionEnabled(NetworkRuleOption.Elemhide, true, true);
                    this.setOptionEnabled(NetworkRuleOption.Jsinject, true, true);
                    this.setOptionEnabled(NetworkRuleOption.Urlblock, true, true);
                    this.setOptionEnabled(NetworkRuleOption.Content, true, true);
                }
                break;
            // $stealth
            case OPTIONS.STEALTH:
                this.setOptionEnabled(NetworkRuleOption.Stealth, true);
                this.stealthModifier = new StealthModifier(optionValue);
                break;
            // $popup
            case OPTIONS.POPUP:
                this.setOptionEnabled(NetworkRuleOption.Popup, true);
                break;
            // Content type options
            // $script, $~script
            case OPTIONS.SCRIPT:
                this.setRequestType(RequestType.Script, !exception);
                break;
            // $stylesheet, $~stylesheet
            case OPTIONS.STYLESHEET:
                this.setRequestType(RequestType.Stylesheet, !exception);
                break;
            // $subdocument, $~subdocument
            case OPTIONS.SUBDOCUMENT:
                this.setRequestType(RequestType.SubDocument, !exception);
                break;
            // $object, $~object
            case OPTIONS.OBJECT:
                this.setRequestType(RequestType.Object, !exception);
                break;
            // $image, $~image
            case OPTIONS.IMAGE:
                this.setRequestType(RequestType.Image, !exception);
                break;
            // $xmlhttprequest, $~xmlhttprequest
            case OPTIONS.XMLHTTPREQUEST:
                this.setRequestType(RequestType.XmlHttpRequest, !exception);
                break;
            // $media, $~media
            case OPTIONS.MEDIA:
                this.setRequestType(RequestType.Media, !exception);
                break;
            // $font, $~font
            case OPTIONS.FONT:
                this.setRequestType(RequestType.Font, !exception);
                break;
            // $websocket, $~websocket
            case OPTIONS.WEBSOCKET:
                this.setRequestType(RequestType.WebSocket, !exception);
                break;
            // $other, $~other
            case OPTIONS.OTHER:
                this.setRequestType(RequestType.Other, !exception);
                break;
            // $ping, $~ping
            case OPTIONS.PING:
                this.setRequestType(RequestType.Ping, !exception);
                break;
            // Special modifiers
            // $badfilter
            case OPTIONS.BADFILTER:
                this.setOptionEnabled(NetworkRuleOption.Badfilter, true);
                break;
            // $csp
            case OPTIONS.CSP:
                this.setOptionEnabled(NetworkRuleOption.Csp, true);
                this.advancedModifier = new CspModifier(optionValue, this.isAllowlist());
                break;
            // $replace
            case OPTIONS.REPLACE:
                this.setOptionEnabled(NetworkRuleOption.Replace, true);
                this.advancedModifier = new ReplaceModifier(optionValue);
                break;
            // $cookie
            case OPTIONS.COOKIE:
                this.setOptionEnabled(NetworkRuleOption.Cookie, true);
                this.advancedModifier = new CookieModifier(optionValue);
                break;
            // $redirect
            case OPTIONS.REDIRECT:
                this.setOptionEnabled(NetworkRuleOption.Redirect, true);
                this.advancedModifier = new RedirectModifier(optionValue, this.isAllowlist());
                break;
            // $redirect-rule
            case OPTIONS.REDIRECTRULE:
                this.setOptionEnabled(NetworkRuleOption.Redirect, true);
                this.advancedModifier = new RedirectModifier(optionValue, this.isAllowlist(), true);
                break;
            // $removeparam
            case OPTIONS.REMOVEPARAM:
                this.setOptionEnabled(NetworkRuleOption.RemoveParam, true);
                this.advancedModifier = new RemoveParamModifier(optionValue);
                break;
            // $removeheader
            case OPTIONS.REMOVEHEADER:
                this.setOptionEnabled(NetworkRuleOption.RemoveHeader, true);
                this.advancedModifier = new RemoveHeaderModifier(optionValue, this.isAllowlist());
                break;
            // $permissions
            case OPTIONS.PERMISSIONS:
                this.setOptionEnabled(NetworkRuleOption.Permissions, true);
                this.advancedModifier = new PermissionsModifier(optionValue, this.isAllowlist());
                break;
            // $jsonprune
            // simple validation of jsonprune rules for compiler
            // https://github.com/AdguardTeam/FiltersCompiler/issues/168
            case OPTIONS.JSONPRUNE:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension does not support $jsonprune modifier yet');
                }
                this.setOptionEnabled(NetworkRuleOption.JsonPrune, true);
                // TODO: should be properly implemented later
                // https://github.com/AdguardTeam/tsurlfilter/issues/71
                break;
            // $hls
            // simple validation of hls rules for compiler
            // https://github.com/AdguardTeam/FiltersCompiler/issues/169
            case OPTIONS.HLS:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension does not support $hls modifier yet');
                }
                this.setOptionEnabled(NetworkRuleOption.Hls, true);
                // TODO: should be properly implemented later
                // https://github.com/AdguardTeam/tsurlfilter/issues/72
                break;
            // $referrerpolicy
            // simple validation of referrerpolicy rules for compiler
            // https://github.com/AdguardTeam/FiltersCompiler/issues/191
            case OPTIONS.REFERRERPOLICY:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension does not support $referrerpolicy modifier');
                }
                // do nothing as $referrerpolicy is supported by CoreLibs-based apps only.
                // it is needed for proper rule conversion performed by FiltersCompiler
                // so rules with $referrerpolicy modifier is not marked as invalid
                break;
            // Dns modifiers
            // $client
            case OPTIONS.CLIENT:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $client modifier');
                }
                this.setOptionEnabled(NetworkRuleOption.Client, true);
                this.advancedModifier = new ClientModifier(optionValue);
                break;
            // $dnsrewrite
            case OPTIONS.DNSREWRITE:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $dnsrewrite modifier');
                }
                this.setOptionEnabled(NetworkRuleOption.DnsRewrite, true);
                this.advancedModifier = new DnsRewriteModifier(optionValue);
                break;
            // $dnstype
            case OPTIONS.DNSTYPE:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $dnstype modifier');
                }
                this.setOptionEnabled(NetworkRuleOption.DnsType, true);
                this.advancedModifier = new DnsTypeModifier(optionValue);
                break;
            // $ctag
            case OPTIONS.CTAG:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $ctag modifier');
                }
                this.setOptionEnabled(NetworkRuleOption.Ctag, true);
                this.advancedModifier = new CtagModifier(optionValue);
                break;
            // $app
            case OPTIONS.APP:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $app modifier');
                }
                this.appModifier = new AppModifier(optionValue);
                break;
            // $network
            case OPTIONS.NETWORK:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $network modifier');
                }
                this.setOptionEnabled(NetworkRuleOption.Network, true);
                break;
            // $extension, $~extension
            case OPTIONS.EXTENSION:
                if (isCompatibleWith(CompatibilityTypes.Extension)) {
                    throw new SyntaxError('Extension doesn\'t support $extension modifier');
                }
                this.setOptionEnabled(NetworkRuleOption.Extension, !exception);
                break;
            // $all
            case OPTIONS.ALL:
                if (this.isAllowlist()) {
                    throw new SyntaxError('Rule with $all modifier can not be allowlist rule');
                }
                // Set all request types
                Object.values(RequestType).forEach(function (type) {
                    _this.setRequestType(type, true);
                });
                this.setOptionEnabled(NetworkRuleOption.Popup, true);
                break;
            // $empty and $mp4
            // Deprecated in favor of $redirect
            case OPTIONS.EMPTY:
            case OPTIONS.MP4:
                // Do nothing.
                break;
            default: {
                // clear empty values
                var modifierView = [optionName, optionValue]
                    .filter(function (i) { return i; })
                    .join('=');
                throw new SyntaxError("Unknown modifier: ".concat(modifierView));
            }
        }
    };
    /**
     * To calculate priority, we've categorized modifiers into different groups.
     * These groups are ranked based on their priority, from lowest to highest.
     * A modifier that significantly narrows the scope of a rule adds more
     * weight to its total priority. Conversely, if a rule applies to a broader
     * range of requests, its priority decreases.
     *
     * It's worth noting that there are cases where a single-parameter modifier
     * has a higher priority than multi-parameter ones. For instance, in
     * the case of `$domain=example.com|example.org`, a rule that includes two
     * domains has a slightly broader effective area than a rule with one
     * specified domain, therefore its priority is lower.
     *
     * The base priority weight of any rule is 1. If the calculated priority
     * is a floating-point number, it will be **rounded up** to the smallest
     * integer greater than or equal to the calculated weight.
     *
     * @see {@link NetworkRule.PermittedRequestTypeWeight}
     * @see {@link NetworkRule.PermittedDomainWeight}
     * @see {@link NetworkRule.SpecificExceptionsWeight}
     * @see {@link NetworkRule.AllowlistRuleWeight}
     * @see {@link NetworkRule.RedirectRuleWeight}
     * @see {@link NetworkRule.ImportantRuleWeight}
     *
     * @see {@link https://adguard.com/kb/general/ad-filtering/create-own-filters/#priority-counting}
     */
    NetworkRule.prototype.calculatePriorityWeight = function () {
        var _a, _b;
        // Base modifiers, category 1.
        this.priorityWeight += countEnabledBits(this.enabledOptions, NetworkRule.CATEGORY_1_OPTIONS_MASK);
        this.priorityWeight += countEnabledBits(this.disabledOptions, NetworkRule.CATEGORY_1_OPTIONS_MASK);
        /**
         * When dealing with a negated domain, app, method, or content-type,
         * we add a point for the existence of the modifier itself, regardless
         * of the quantity of negated domains or content-types. This is because
         * the rule's scope is already infinitely broad. Put simply,
         * by prohibiting multiple domains, content-types, methods or apps,
         * the scope of the rule becomes only minimally smaller.
         */
        if (this.denyAllowDomains && this.denyAllowDomains.length > 0) {
            this.priorityWeight += 1;
        }
        var domainModifier = this.domainModifier;
        if (domainModifier === null || domainModifier === void 0 ? void 0 : domainModifier.hasRestrictedDomains()) {
            this.priorityWeight += 1;
        }
        if (((_a = this.methodModifier) === null || _a === void 0 ? void 0 : _a.restrictedValues) && this.methodModifier.restrictedValues.length > 0) {
            this.priorityWeight += 1;
        }
        if (this.restrictedRequestTypes !== RequestType.NotSet) {
            this.priorityWeight += 1;
        }
        // $to modifier is basically a replacement for a regular expression
        // See https://github.com/AdguardTeam/KnowledgeBase/pull/196#discussion_r1221401215
        if (this.toModifier) {
            this.priorityWeight += 1;
        }
        /**
         * Category 2: permitted request types, methods, headers, $popup.
         * Specified content-types add `50 + 50 / number_of_content_types`,
         * for example: `||example.com^$image,script` will add
         * `50 + 50 / 2 = 50 + 25 = 75` to the total weight of the rule.
         * The `$popup` also belongs to this category, because it implicitly
         * adds the modifier `$document`.
         * Similarly, specific exceptions add `$document,subdocument`.
         *
         * Learn more about it here:
         * https://adguard.com/kb/general/ad-filtering/create-own-filters/#priority-category-2
         */
        if (this.permittedRequestTypes !== RequestType.NotSet) {
            var numberOfPermittedRequestTypes = getBitCount(this.permittedRequestTypes);
            // More permitted request types mean less priority weight.
            var relativeWeight = NetworkRule.CategoryTwoWeight / numberOfPermittedRequestTypes;
            this.priorityWeight += NetworkRule.CategoryTwoWeight + relativeWeight;
        }
        if (((_b = this.methodModifier) === null || _b === void 0 ? void 0 : _b.permittedValues) && this.methodModifier.permittedValues.length > 0) {
            // More permitted request methods mean less priority weight.
            var relativeWeight = NetworkRule.CategoryTwoWeight / this.methodModifier.permittedValues.length;
            this.priorityWeight += NetworkRule.CategoryTwoWeight + relativeWeight;
        }
        if (this.headerModifier) {
            // $header modifier in the rule adds 50
            this.priorityWeight += NetworkRule.CategoryTwoWeight;
        }
        /**
         * Category 3: permitted domains.
         * Specified domains through `$domain` and specified applications
         * through `$app` add `100 + 100 / number_domains (or number_applications)`,
         * for example:
         * `||example.com^$domain=example.com|example.org|example.net`
         * will add `100 + 100 / 3 = 134.3 = 134` or
         * `||example.com^$app=org.example.app1|org.example.app2`
         * will add `100 + 100 / 2 = 151`.
         */
        if (domainModifier === null || domainModifier === void 0 ? void 0 : domainModifier.hasPermittedDomains()) {
            // More permitted domains mean less priority weight.
            var relativeWeight = NetworkRule.CategoryThreeWeight / domainModifier.getPermittedDomains().length;
            this.priorityWeight += NetworkRule.CategoryThreeWeight + relativeWeight;
        }
        // Category 4: redirect rules.
        if (this.isOptionEnabled(NetworkRuleOption.Redirect)) {
            this.priorityWeight += NetworkRule.CategoryFourWeight;
        }
        // Category 5: specific exceptions.
        this.priorityWeight += NetworkRule.CategoryFiveWeight * countEnabledBits(this.enabledOptions, NetworkRule.SPECIFIC_EXCLUSIONS_MASK);
        // Category 6: allowlist rules.
        if (this.isAllowlist()) {
            this.priorityWeight += NetworkRule.CategorySixWeight;
        }
        // Category 7: important rules.
        if (this.isOptionEnabled(NetworkRuleOption.Important)) {
            this.priorityWeight += NetworkRule.CategorySevenWeight;
        }
        // Round up to avoid overlap between different categories of rules.
        this.priorityWeight = Math.ceil(this.priorityWeight);
    };
    /**
     * Validates rule options
     */
    NetworkRule.prototype.validateOptions = function () {
        if (this.advancedModifier instanceof RemoveParamModifier) {
            this.validateRemoveParamRule();
        }
        else if (this.advancedModifier instanceof RemoveHeaderModifier) {
            this.validateRemoveHeaderRule();
        }
        else if (this.advancedModifier instanceof PermissionsModifier) {
            this.validatePermissionsRule();
        }
        else if (this.headerModifier instanceof HeaderModifier) {
            this.validateHeaderRule();
        }
        else if (this.toModifier !== null) {
            this.validateToRule();
        }
        else if (this.denyAllowDomains !== null) {
            this.validateDenyallowRule();
        }
    };
    /**
     * $header rules are not compatible with any other
     * modifiers except for $important, $csp, $removeheader, $badfilter.
     * The rules with any other modifiers are considered invalid and will be discarded.
     */
    NetworkRule.prototype.validateHeaderRule = function () {
        if ((this.enabledOptions | NetworkRuleGroupOptions.HeaderCompatibleOptions)
            !== NetworkRuleGroupOptions.HeaderCompatibleOptions) {
            throw new SyntaxError('$header rules are not compatible with some other modifiers');
        }
        if (this.advancedModifier && this.isOptionEnabled(NetworkRuleOption.RemoveHeader)) {
            var removeHeaderValue = this.getAdvancedModifierValue();
            if (!removeHeaderValue || removeHeaderValue.includes('request:')) {
                var message = '$header rules are only compatible with response headers removal of $removeheader.';
                throw new SyntaxError(message);
            }
        }
    };
    /**
     * $permissions rules are not compatible with any other
     * modifiers except $domain, $important, and $subdocument.
     * The rules with any other modifiers are considered invalid and will be discarded.
     */
    NetworkRule.prototype.validatePermissionsRule = function () {
        if ((this.enabledOptions | NetworkRuleGroupOptions.PermissionsCompatibleOptions)
            !== NetworkRuleGroupOptions.PermissionsCompatibleOptions) {
            throw new SyntaxError('$permissions rules are not compatible with some other modifiers');
        }
    };
    /**
     * $removeparam rules are not compatible with any other modifiers except $domain,
     * $third-party, $app, $important, $match-case and permitted content type modifiers ($script, $stylesheet, etc).
     * The rules with any other modifiers are considered invalid and will be discarded.
     */
    NetworkRule.prototype.validateRemoveParamRule = function () {
        if ((this.enabledOptions | NetworkRuleGroupOptions.RemoveParamCompatibleOptions)
            !== NetworkRuleGroupOptions.RemoveParamCompatibleOptions) {
            throw new SyntaxError('$removeparam rules are not compatible with some other modifiers');
        }
    };
    /**
     * $removeheader rules are not compatible with any other modifiers except $domain,
     * $third-party, $app, $important, $match-case and permitted content type modifiers ($script, $stylesheet, etc).
     * The rules with any other modifiers are considered invalid and will be discarded.
     */
    NetworkRule.prototype.validateRemoveHeaderRule = function () {
        if ((this.enabledOptions | NetworkRuleGroupOptions.RemoveHeaderCompatibleOptions)
            !== NetworkRuleGroupOptions.RemoveHeaderCompatibleOptions) {
            throw new SyntaxError('$removeheader rules are not compatible with some other modifiers');
        }
        if (this.headerModifier && this.isOptionEnabled(NetworkRuleOption.Header)) {
            var removeHeaderValue = this.getAdvancedModifierValue();
            if (!removeHeaderValue || removeHeaderValue.includes('request:')) {
                var message = 'Request headers removal of $removeheaders is not compatible with $header rules.';
                throw new SyntaxError(message);
            }
        }
    };
    /**
     * $to rules are not compatible $denyallow - these rules considered invalid
     * and will be discarded.
     */
    NetworkRule.prototype.validateToRule = function () {
        if (this.denyAllowDomains) {
            throw new SyntaxError('modifier $to is not compatible with $denyallow modifier');
        }
    };
    /**
     * $denyallow rules are not compatible $to - these rules considered invalid
     * and will be discarded.
     */
    NetworkRule.prototype.validateDenyallowRule = function () {
        if (this.toModifier) {
            throw new SyntaxError('modifier $to is not compatible with $denyallow modifier');
        }
    };
    /**
     * Rules with base modifiers, from category 1, each of them adds 1
     * to the weight of the rule.
     *
     * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#priority-category-1
     */
    NetworkRule.CATEGORY_1_OPTIONS_MASK = NetworkRuleOption.ThirdParty
        | NetworkRuleOption.MatchCase
        | NetworkRuleOption.DnsRewrite;
    /**
     * The priority weight used in {@link calculatePriorityWeight} for rules
     * with permitted request types and methods.
     * The value 50 is chosen in order to cover (with a margin) all possible
     * combinations and variations of rules from categories with a lower
     * priority (each of them adds 1 to the rule priority).
     *
     * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#priority-category-2
     */
    NetworkRule.CategoryTwoWeight = 50;
    /**
     * The priority weight used in {@link calculatePriorityWeight} for rules
     * with allowed domains.
     * The value 100 is chosen to cover all possible combinations and variations
     * of rules from categories with a lower priority, for example a rule with
     * one allowed query type will get priority 100 (50 + 50/1), but for allowed
     * domains with any number of domains we will get at least 101 (for 100
     * domains: 100 + 100/100; for 200 100 + 100/200; or even for 10000:
     * 100 + 100/10000) because the resulting weight is rounded up.
     *
     * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#priority-category-3
     */
    NetworkRule.CategoryThreeWeight = 100;
    /**
     * The priority weight used in {@link calculatePriorityWeight}
     * for $redirect rules.
     *
     * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#priority-category-6
     */
    NetworkRule.CategoryFourWeight = Math.pow(10, 3);
    /**
     * The priority weight used in {@link calculatePriorityWeight} for rules
     * with specific exceptions.
     *
     * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#priority-category-4
     */
    NetworkRule.CategoryFiveWeight = Math.pow(10, 4);
    /**
     * Rules with specific exclusions, from category 4, each of them adds
     * {@link SpecificExceptionsWeight} to the weight of the rule.
     *
     * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#priority-category-4
     */
    NetworkRule.SPECIFIC_EXCLUSIONS_MASK = NetworkRuleOption.Elemhide
        | NetworkRuleOption.Generichide
        | NetworkRuleOption.Specifichide
        | NetworkRuleOption.Content
        | NetworkRuleOption.Urlblock
        | NetworkRuleOption.Genericblock
        | NetworkRuleOption.Jsinject
        | NetworkRuleOption.Extension;
    /**
     * The priority weight used in {@link calculatePriorityWeight} for rules
     * with allowlist mark '@@'.
     *
     * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#priority-category-5
     */
    NetworkRule.CategorySixWeight = Math.pow(10, 5);
    /**
     * The priority weight used in {@link calculatePriorityWeight}
     * for $important rules.
     *
     * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#priority-category-7
     */
    NetworkRule.CategorySevenWeight = Math.pow(10, 6);
    /**
     * Separates the rule pattern from the list of modifiers.
     *
     * ```
     * rule = ["@@"] pattern [ "$" modifiers ]
     * modifiers = [modifier0, modifier1[, ...[, modifierN]]]
     * ```
     */
    NetworkRule.OPTIONS_DELIMITER = OPTIONS_DELIMITER;
    /**
     * A marker that is used in rules of exception.
     * To turn off filtering for a request, start your rule with this marker.
     */
    NetworkRule.MASK_ALLOWLIST = MASK_ALLOWLIST;
    /**
     * Mark that negates options
     */
    NetworkRule.NOT_MARK = NOT_MARK;
    /**
     * Rule options
     */
    NetworkRule.OPTIONS = NETWORK_RULE_OPTIONS;
    /**
     * Rule options that can be negated
     */
    NetworkRule.NEGATABLE_OPTIONS = new Set([
        // General options
        NetworkRule.OPTIONS.FIRST_PARTY,
        NetworkRule.OPTIONS.THIRD_PARTY,
        NetworkRule.OPTIONS.MATCH_CASE,
        NetworkRule.OPTIONS.DOCUMENT,
        NetworkRule.OPTIONS.DOC,
        // Content type options
        NetworkRule.OPTIONS.SCRIPT,
        NetworkRule.OPTIONS.STYLESHEET,
        NetworkRule.OPTIONS.SUBDOCUMENT,
        NetworkRule.OPTIONS.OBJECT,
        NetworkRule.OPTIONS.IMAGE,
        NetworkRule.OPTIONS.XMLHTTPREQUEST,
        NetworkRule.OPTIONS.MEDIA,
        NetworkRule.OPTIONS.FONT,
        NetworkRule.OPTIONS.WEBSOCKET,
        NetworkRule.OPTIONS.OTHER,
        NetworkRule.OPTIONS.PING,
        // Dns modifiers
        NetworkRule.OPTIONS.EXTENSION,
    ]);
    /**
     * Advanced option modifier names.
     */
    NetworkRule.ADVANCED_OPTIONS = new Set([
        NetworkRule.OPTIONS.CSP,
        NetworkRule.OPTIONS.REPLACE,
        NetworkRule.OPTIONS.COOKIE,
        NetworkRule.OPTIONS.REDIRECT,
        NetworkRule.OPTIONS.REDIRECTRULE,
        NetworkRule.OPTIONS.REMOVEPARAM,
        NetworkRule.OPTIONS.REMOVEHEADER,
        NetworkRule.OPTIONS.PERMISSIONS,
        NetworkRule.OPTIONS.CLIENT,
        NetworkRule.OPTIONS.DNSREWRITE,
        NetworkRule.OPTIONS.DNSTYPE,
        NetworkRule.OPTIONS.CTAG,
    ]);
    return NetworkRule;
}());

/**
 * @file Known CSS / Extended CSS elements
 */
/**
 * Supported Extended CSS pseudo-classes.
 *
 * These pseudo-classes are not supported by browsers natively, so we need Extended CSS library to support them.
 *
 * Please keep this list sorted alphabetically.
 */
var SUPPORTED_EXT_CSS_PSEUDO_CLASSES = new Set([
    /**
     * Pseudo-classes :is(), and :not() may use native implementation
     * so they are not listed here
     * https://github.com/AdguardTeam/ExtendedCss#extended-css-is
     * https://github.com/AdguardTeam/ExtendedCss#extended-css-not
     */
    /**
     * :has() should also be conditionally considered as extended and should not be in this list
     * https://github.com/AdguardTeam/ExtendedCss#extended-css-has
     * but there is a bug with content blocker in safari
     * https://bugs.webkit.org/show_bug.cgi?id=248868
     *
     * TODO: remove 'has' later
     */
    '-abp-contains',
    '-abp-has',
    'contains',
    'has',
    'has-text',
    'if',
    'if-not',
    'matches-attr',
    'matches-css',
    'matches-css-after',
    'matches-css-before',
    'matches-property',
    'nth-ancestor',
    'remove',
    'upward',
    'xpath',
]);
/**
 * Supported native CSS pseudo-classes.
 *
 * These pseudo-classes are supported by browsers natively, so we don't need Extended CSS library to support them.
 *
 * The problem with pseudo-classes is that any unknown pseudo-class makes browser ignore the whole CSS rule,
 * which contains a lot more selectors. So, if CSS selector contains a pseudo-class, we should try to validate it.
 * One more problem with pseudo-classes is that they are actively used in uBlock, hence it may mess AG styles.
 *
 * Please keep this list sorted alphabetically.
 */
var SUPPORTED_CSS_PSEUDO_CLASSES = new Set([
    'active',
    'checked',
    'disabled',
    'empty',
    'enabled',
    'first-child',
    'first-of-type',
    'focus',
    'has',
    'hover',
    'in-range',
    'invalid',
    'is',
    'lang',
    'last-child',
    'last-of-type',
    'link',
    'not',
    'nth-child',
    'nth-last-child',
    'nth-last-of-type',
    'nth-of-type',
    'only-child',
    'only-of-type',
    'optional',
    'out-of-range',
    'read-only',
    'read-write',
    'required',
    'root',
    'target',
    'valid',
    'visited',
    'where', // https://developer.mozilla.org/en-US/docs/Web/CSS/:where
]);
/**
 * Every Extended CSS pseudo-class should start with this prefix.
 *
 * @see {@link https://github.com/AdguardTeam/ExtendedCss#-backward-compatible-syntax}
 */
var EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX = '-ext-';
/**
 * Supported legacy Extended CSS attribute selectors.
 *
 * Attribute selector way is deprecated and will be removed completely in the future,
 * we replaced it with Extended CSS pseudo-classes. For example, instead of
 * `[-ext-has="a[href]"]` you should use `:has(a[href])`.
 *
 * Please keep this list sorted alphabetically.
 */
var SUPPORTED_EXT_CSS_ATTRIBUTE_SELECTORS = new Set([
    "".concat(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX, "has"),
    "".concat(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX, "contains"),
    "".concat(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX, "has-text"),
    "".concat(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX, "matches-css"),
    "".concat(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX, "matches-css-before"),
    "".concat(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX, "matches-css-after"),
]);
/**
 * Known CSS functions that aren't allowed in CSS injection rules, because they
 * able to load external resources. Please, keep this list sorted.
 */
var FORBIDDEN_CSS_FUNCTIONS = new Set([
    // https://developer.mozilla.org/en-US/docs/Web/CSS/cross-fade
    '-webkit-cross-fade',
    'cross-fade',
    // https://developer.mozilla.org/en-US/docs/Web/CSS/image
    'image',
    // https://developer.mozilla.org/en-US/docs/Web/CSS/image-set
    '-webkit-image-set',
    'image-set',
    // https://developer.mozilla.org/en-US/docs/Web/CSS/url
    'url',
]);

/**
 * @file Selector list validator.
 */
/**
 * Does a basic validation of a selector list.
 * Checks for unsupported pseudo-classes and attribute selectors,
 * and determines if the selector is an Extended CSS selector.
 *
 * @param selectorList Selector list to validate.
 * @returns Validation result, see {@link CssValidationResult}.
 * @note This is a basic validation for the most necessary things, it does not guarantee that the CSS is completely
 * valid.
 */
var validateSelectorList = function (selectorList) {
    var result = {
        isValid: true,
        isExtendedCss: false,
    };
    try {
        var prevIsDoubleColon_1 = false;
        var prevToken_1;
        var prevNonWhitespaceToken_1;
        (0,csstokenizer/* tokenizeExtended */.lL)(selectorList, function (token, start, end) {
            if ((token === csstokenizer/* TokenType.Function */.iv.Function || token === csstokenizer/* TokenType.Ident */.iv.Ident)
                && prevToken_1 === csstokenizer/* TokenType.Colon */.iv.Colon
                && !prevIsDoubleColon_1) {
                // whitespace is NOT allowed between the ':' and the pseudo-class name, like ': active('
                var name_1 = selectorList.slice(start, 
                // function tokens look like 'func(', so we need to remove the last character
                token === csstokenizer/* TokenType.Function */.iv.Function ? end - 1 : end);
                // function name may contain escaped characters, like '\75' instead of 'u', so we need to decode it
                var decodedName = (0,csstokenizer/* decodeIdent */.pV)(name_1);
                if (SUPPORTED_EXT_CSS_PSEUDO_CLASSES.has(decodedName)) {
                    result.isExtendedCss = true;
                }
                else if (!SUPPORTED_CSS_PSEUDO_CLASSES.has(decodedName)) {
                    throw new Error("Unsupported pseudo-class: ':".concat(decodedName, "'"));
                }
            }
            else if (token === csstokenizer/* TokenType.Ident */.iv.Ident && prevNonWhitespaceToken_1 === csstokenizer/* TokenType.OpenSquareBracket */.iv.OpenSquareBracket) {
                // whitespace is allowed between the '[' and the attribute name, like '[ attr]'
                var attributeName = selectorList.slice(start, end);
                if (attributeName.startsWith(EXT_CSS_ATTRIBUTE_SELECTOR_PREFIX)) {
                    result.isExtendedCss = true;
                    if (!SUPPORTED_EXT_CSS_ATTRIBUTE_SELECTORS.has(attributeName)) {
                        throw new Error("Unsupported Extended CSS attribute selector: '".concat(attributeName, "'"));
                    }
                }
            }
            else if (token === csstokenizer/* TokenType.OpenCurlyBracket */.iv.OpenCurlyBracket || token === csstokenizer/* TokenType.CloseCurlyBracket */.iv.CloseCurlyBracket) {
                throw new Error('Curly brackets are not allowed in selector lists');
            }
            else if (token === csstokenizer/* TokenType.Comment */.iv.Comment) {
                throw new Error('Comments are not allowed in selector lists');
            }
            // memorize tokens, we need them later
            if (token === csstokenizer/* TokenType.Colon */.iv.Colon) {
                prevIsDoubleColon_1 = prevToken_1 === csstokenizer/* TokenType.Colon */.iv.Colon;
            }
            prevToken_1 = token;
            if (token !== csstokenizer/* TokenType.Whitespace */.iv.Whitespace) {
                prevNonWhitespaceToken_1 = token;
            }
        });
    }
    catch (error) {
        result.isValid = false;
        result.errorMessage = getErrorMessage(error);
    }
    return result;
};

/**
 * @file Declaration list validator.
 */
var REMOVE_PROPERTY = 'remove';
var REMOVE_LENGTH = REMOVE_PROPERTY.length;
/**
 * Check if function name is forbidden. If so, throws an error.
 *
 * @param functionName Function name to check.
 * @throws Error if function name is forbidden.
 */
var checkFunctionName = function (functionName) {
    // function name may contain escaped characters, like '\75' instead of 'u', so we need to decode it
    var decodedFunctionName = (0,csstokenizer/* decodeIdent */.pV)(functionName);
    if (FORBIDDEN_CSS_FUNCTIONS.has(decodedFunctionName)) {
        throw new Error("Using '".concat(decodedFunctionName, "()' is not allowed"));
    }
};
/**
 * Does a basic validation of a declaration list.
 * Checks for unsafe resource loading and determines if the declaration list is an Extended CSS declaration list.
 *
 * @param declarationList Declaration list to validate.
 * @returns Validation result, see {@link CssValidationResult}.
 * @note This is a basic validation for the most necessary things, it does not guarantee that the CSS is completely
 * valid.
 */
var validateDeclarationList = function (declarationList) {
    var result = {
        isValid: true,
        isExtendedCss: false,
    };
    try {
        (0,csstokenizer/* tokenizeExtended */.lL)(declarationList, function (token, start, end) {
            switch (token) {
                // Special case: according to CSS specs, sometimes url() is handled as a separate token type
                case csstokenizer/* TokenType.Url */.iv.Url:
                case csstokenizer/* TokenType.BadUrl */.iv.BadUrl:
                    throw new Error("Using 'url()' is not allowed");
                case csstokenizer/* TokenType.Function */.iv.Function:
                    // we need -1 to exclude closing bracket, because function tokens look like 'func('
                    checkFunctionName(declarationList.slice(start, end - 1));
                    break;
                case csstokenizer/* TokenType.Ident */.iv.Ident:
                    // do a fast check before getting the substring
                    if (end - start === REMOVE_LENGTH) {
                        // TODO: Improve this check, and check the whole `remove: true` sequence.
                        // Please note that the `remove : true` case also valid.
                        if ((0,csstokenizer/* decodeIdent */.pV)(declarationList.slice(start, end)) === REMOVE_PROPERTY) {
                            result.isExtendedCss = true;
                        }
                    }
                    break;
                case csstokenizer/* TokenType.Comment */.iv.Comment:
                    throw new Error('Comments are not allowed in declaration lists');
                default:
                    break;
            }
        });
    }
    catch (error) {
        result.isValid = false;
        result.errorMessage = getErrorMessage(error);
    }
    return result;
};

/* eslint-disable max-classes-per-file */
var ScriptletParams = /** @class */ (function () {
    function ScriptletParams(name, args) {
        this.props = null;
        if (typeof name !== 'undefined') {
            this.props = {
                name: name,
                args: args || [],
            };
        }
    }
    Object.defineProperty(ScriptletParams.prototype, "name", {
        get: function () {
            var _a;
            return (_a = this.props) === null || _a === void 0 ? void 0 : _a.name;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScriptletParams.prototype, "args", {
        get: function () {
            var _a, _b;
            return (_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.args) !== null && _b !== void 0 ? _b : [];
        },
        enumerable: false,
        configurable: true
    });
    ScriptletParams.prototype.toString = function () {
        var result = [];
        result.push(agtree/* ADG_SCRIPTLET_MASK */.wh);
        result.push('(');
        if (this.name) {
            result.push(agtree/* QuoteUtils.setStringQuoteType */.tC.setStringQuoteType(this.name, agtree/* QuoteType.Single */.Q_.Single));
        }
        if (this.args.length) {
            result.push(', ');
            result.push(this.args.map(function (arg) { return agtree/* QuoteUtils.setStringQuoteType */.tC.setStringQuoteType(arg, agtree/* QuoteType.Single */.Q_.Single); }).join(', '));
        }
        result.push(')');
        return result.join(EMPTY_STRING);
    };
    return ScriptletParams;
}());
/**
 * Implements a basic cosmetic rule.
 *
 * Cosmetic rules syntax are almost similar and looks like this:
 * ```
 * rule = [domains] "marker" content
 * domains = [domain0, domain1[, ...[, domainN]]]
 * ```
 *
 * The rule type is defined by the `marker` value, you can find the list of them
 * in the {@see CosmeticRuleMarker} enumeration.
 *
 * What matters, though, is what's in the `content` part of it.
 *
 * Examples:
 * * `example.org##.banner` -- element hiding rule
 * * `example.org#$#.banner { display: block; }` -- CSS rule
 * * `example.org#%#window.x=1;` -- JS rule
 * * `example.org#%#//scriptlet('scriptlet-name')` -- Scriptlet rule
 * * `example.org$$div[id="test"]` -- HTML filtering rule
 */
var CosmeticRule = /** @class */ (function () {
    /**
     * Creates an instance of the {@link CosmeticRule}.
     * It parses the rule and extracts the permitted/restricted domains,
     * and also the cosmetic rule's content.
     *
     * Depending on the rule type, the content might be transformed in
     * one of the helper classes, or kept as string when it's appropriate.
     *
     * @param inputRule Original rule text.
     * @param filterListId ID of the filter list this rule belongs to.
     * @param ruleIndex line start index in the source filter list; it will be used to find the original rule text
     * in the filtering log when a rule is applied. Default value is {@link RULE_INDEX_NONE} which means that
     * the rule does not have source index.
     *
     * @throws error if it fails to parse the rule.
     */
    function CosmeticRule(node, filterListId, ruleIndex) {
        if (ruleIndex === void 0) { ruleIndex = RULE_INDEX_NONE; }
        var _a, _b, _c;
        this.allowlist = false;
        this.extendedCss = false;
        /**
         * $domain modifier pattern. It is only set if $domain modifier is specified for this rule.
         */
        this.domainModifier = null;
        /**
         * Js script to execute
         */
        this.script = undefined;
        /**
         * Object with script code ready to execute and debug, domain values
         * @private
         */
        this.scriptData = null;
        /**
         * Object with scriptlet function and params
         * @private
         */
        this.scriptletData = null;
        /**
         * If the rule contains scriptlet content
         */
        this.isScriptlet = false;
        this.ruleIndex = ruleIndex;
        this.filterListId = filterListId;
        this.allowlist = agtree/* CosmeticRuleSeparatorUtils.isException */.T9.isException(node.separator.value);
        this.type = node.type;
        this.isScriptlet = node.type === agtree/* CosmeticRuleType.ScriptletInjectionRule */.Az.ScriptletInjectionRule;
        this.content = agtree/* CosmeticRuleParser.generateBody */.c3.generateBody(node);
        // Store the scriptlet parameters. They will be used later, when we initialize the scriptlet,
        // but at this point we need to store them in order to avoid double parsing
        if (node.type === agtree/* CosmeticRuleType.ScriptletInjectionRule */.Az.ScriptletInjectionRule) {
            // Transform complex node into a simple array of strings
            var params = (_b = (_a = node.body.children[0]) === null || _a === void 0 ? void 0 : _a.children.map(function (param) { return (param === null ? EMPTY_STRING : agtree/* QuoteUtils.removeQuotesAndUnescape */.tC.removeQuotesAndUnescape(param.value)); })) !== null && _b !== void 0 ? _b : [];
            this.scriptletParams = new ScriptletParams((_c = params[0]) !== null && _c !== void 0 ? _c : '', params.slice(1));
        }
        else {
            this.scriptletParams = new ScriptletParams();
        }
        var validationResult = CosmeticRule.validate(node);
        // We should throw an error if the validation failed for any reason
        if (!validationResult.isValid) {
            throw new SyntaxError(validationResult.errorMessage);
        }
        // Check if the rule is ExtendedCss
        var isExtendedCssSeparator = agtree/* CosmeticRuleSeparatorUtils.isExtendedCssMarker */.T9.isExtendedCssMarker(node.separator.value);
        this.extendedCss = isExtendedCssSeparator || validationResult.isExtendedCss;
        // Process cosmetic rule modifiers
        var processedModifiers = CosmeticRule.processModifiers(node);
        if (processedModifiers) {
            if (processedModifiers.domainModifier) {
                this.domainModifier = processedModifiers.domainModifier;
            }
            if (processedModifiers.pathModifier) {
                this.pathModifier = processedModifiers.pathModifier;
            }
            if (processedModifiers.urlModifier) {
                this.urlModifier = processedModifiers.urlModifier;
            }
        }
        // Process domain list, if at least one domain is specified
        var domainListNode = node.domains;
        if (CosmeticRule.isAnyDomainSpecified(domainListNode)) {
            this.domainModifier = new DomainModifier(domainListNode, agtree/* COMMA_DOMAIN_LIST_SEPARATOR */.Hm);
        }
    }
    CosmeticRule.prototype.getIndex = function () {
        return this.ruleIndex;
    };
    CosmeticRule.prototype.getFilterListId = function () {
        return this.filterListId;
    };
    /**
     * Returns the rule content.
     */
    CosmeticRule.prototype.getContent = function () {
        return this.content;
    };
    /**
     * Cosmetic rule type (always present)
     */
    CosmeticRule.prototype.getType = function () {
        return this.type;
    };
    /**
     * Allowlist means that this rule is meant to disable other rules.
     * For instance, https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#elemhide-exceptions
     */
    CosmeticRule.prototype.isAllowlist = function () {
        return this.allowlist;
    };
    /**
     * Returns script ready to execute or null
     * Rebuilds scriptlet script if debug or domain params change
     * @param options script options
     * @returns script code or null
     */
    CosmeticRule.prototype.getScript = function (options) {
        var _a, _b;
        if (options === void 0) { options = {}; }
        var _c = options.debug, debug = _c === void 0 ? false : _c, frameUrl = options.frameUrl;
        var scriptData = this.scriptData;
        if (scriptData && !this.isScriptlet) {
            return scriptData.code;
        }
        if (scriptData && scriptData.debug === debug) {
            if (frameUrl) {
                if (frameUrl === scriptData.frameUrl) {
                    return scriptData.code;
                }
            }
            else {
                return scriptData.code;
            }
        }
        this.initScript(options);
        return (_b = (_a = this.scriptData) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : null;
    };
    /**
     * Gets list of permitted domains.
     */
    CosmeticRule.prototype.getPermittedDomains = function () {
        if (this.domainModifier) {
            return this.domainModifier.getPermittedDomains();
        }
        return null;
    };
    /**
     * Gets list of restricted domains.
     */
    CosmeticRule.prototype.getRestrictedDomains = function () {
        if (this.domainModifier) {
            return this.domainModifier.getRestrictedDomains();
        }
        return null;
    };
    /**
     * Returns true if the rule is considered "generic"
     * "generic" means that the rule is not restricted to a limited set of domains
     * Please note that it might be forbidden on some domains, though.
     *
     * @return {boolean}
     */
    CosmeticRule.prototype.isGeneric = function () {
        var _a;
        return !((_a = this.domainModifier) === null || _a === void 0 ? void 0 : _a.hasPermittedDomains());
    };
    CosmeticRule.prototype.isExtendedCss = function () {
        return this.extendedCss;
    };
    /**
     * Processes cosmetic rule modifiers, e.g. `$path`.
     *
     * @param ruleNode Cosmetic rule node to process
     * @returns Processed modifiers ({@link ProcessedModifiers}) or `null` if there are no modifiers
     * @see {@link https://adguard.com/kb/general/ad-filtering/create-own-filters/#modifiers-for-non-basic-type-of-rules}
     */
    CosmeticRule.processModifiers = function (ruleNode) {
        var _a;
        // Do nothing if there are no modifiers in the rule node
        if (!ruleNode.modifiers) {
            return null;
        }
        var result = {};
        // We don't allow duplicate modifiers, so we collect them in a set
        var usedModifiers = new Set();
        // Destructure the modifiers array just for convenience
        var modifierNodes = ruleNode.modifiers.children;
        // AGTree parser tolerates this case: [$]example.com##.foo
        // However, we should throw an error here if the modifier list is empty
        // (if the modifier list isn't specified at all, then ruleNode.modifiers
        // will be undefined, so we won't get here)
        if (modifierNodes.length < 1) {
            throw new SyntaxError('Modifiers list cannot be be empty');
        }
        for (var _i = 0, modifierNodes_1 = modifierNodes; _i < modifierNodes_1.length; _i++) {
            var modifierNode = modifierNodes_1[_i];
            var modifierName = modifierNode.name.value;
            // Check if the modifier is already used
            if (usedModifiers.has(modifierName)) {
                throw new Error("Duplicated modifier: '".concat(modifierName, "'"));
            }
            // Mark the modifier as used by adding it to the set
            usedModifiers.add(modifierName);
            var modifierValue = ((_a = modifierNode.value) === null || _a === void 0 ? void 0 : _a.value) || EMPTY_STRING;
            // Every modifier should have a value at the moment, so for simplicity we throw an error here if the
            // modifier value is not present.
            // TODO: Improve this when we decide to add modifiers without values
            if (modifierValue.length < 1 && modifierName !== "path" /* CosmeticRuleModifier.Path */) {
                throw new SyntaxError("'$".concat(modifierName, "' modifier should have a value"));
            }
            // Process the modifier based on its name
            switch (modifierName) {
                case "domain" /* CosmeticRuleModifier.Domain */:
                    if (ruleNode.domains.children.length > 0) {
                        throw new SyntaxError("'$".concat(modifierName, "' modifier is not allowed in a domain-specific rule"));
                    }
                    result.domainModifier = new DomainModifier(modifierValue, agtree/* PIPE_MODIFIER_SEPARATOR */.mC);
                    break;
                case "path" /* CosmeticRuleModifier.Path */:
                    result.pathModifier = new Pattern(SimpleRegex.isRegexPattern(modifierValue)
                        // eslint-disable-next-line max-len
                        ? SimpleRegex.unescapeRegexSpecials(modifierValue, SimpleRegex.reModifierPatternEscapedSpecialCharacters)
                        : modifierValue);
                    break;
                case "url" /* CosmeticRuleModifier.Url */:
                    if (ruleNode.domains.children.length > 0) {
                        throw new SyntaxError("'$".concat(modifierName, "' modifier is not allowed in a domain-specific rule"));
                    }
                    result.urlModifier = new Pattern(SimpleRegex.isRegexPattern(modifierValue)
                        // eslint-disable-next-line max-len
                        ? SimpleRegex.unescapeRegexSpecials(modifierValue, SimpleRegex.reModifierPatternEscapedSpecialCharacters)
                        : modifierValue);
                    break;
                // Don't allow unknown modifiers
                default:
                    throw new SyntaxError("'$".concat(modifierName, "' modifier is not supported"));
            }
        }
        // $url modifier can't be used with other modifiers
        // TODO: Extend / change this check if we decide to add more such modifiers
        if (result.urlModifier && usedModifiers.size > 1) {
            throw new SyntaxError("'$".concat("url" /* CosmeticRuleModifier.Url */, "' modifier cannot be used with other modifiers"));
        }
        return result;
    };
    /**
     * Validates cosmetic rule node.
     *
     * @param ruleNode Cosmetic rule node to validate
     * @returns Validation result ({@link ValidationResult})
     */
    CosmeticRule.validate = function (ruleNode) {
        var _a, _b, _c, _d;
        var result = {
            isValid: true,
            isExtendedCss: false,
        };
        var scriptletName;
        var selectorListValidationResult;
        var ruleType = ruleNode.type;
        try {
            // Common validation: every cosmetic rule has a domain list
            if ((_a = ruleNode.domains) === null || _a === void 0 ? void 0 : _a.children.length) {
                // Iterate over the domain list and check every domain
                for (var _i = 0, _e = ruleNode.domains.children; _i < _e.length; _i++) {
                    var domain = _e[_i].value;
                    if (!agtree/* DomainUtils.isValidDomainOrHostname */.QM.isValidDomainOrHostname(domain)) {
                        throw new Error("'".concat(domain, "' is not a valid domain name"));
                    }
                }
            }
            // Type-specific validation
            switch (ruleType) {
                case agtree/* CosmeticRuleType.ElementHidingRule */.Az.ElementHidingRule:
                    selectorListValidationResult = validateSelectorList(ruleNode.body.selectorList.value);
                    if (!selectorListValidationResult.isValid) {
                        throw new Error(selectorListValidationResult.errorMessage);
                    }
                    // Detect ExtendedCss and unsupported pseudo-classes
                    result.isExtendedCss = selectorListValidationResult.isExtendedCss;
                    break;
                case agtree/* CosmeticRuleType.CssInjectionRule */.Az.CssInjectionRule:
                    selectorListValidationResult = validateSelectorList(ruleNode.body.selectorList.value);
                    if (!selectorListValidationResult.isValid) {
                        throw new Error(selectorListValidationResult.errorMessage);
                    }
                    // Detect ExtendedCss and unsupported pseudo-classes
                    result.isExtendedCss = selectorListValidationResult.isExtendedCss;
                    // AGTree won't allow the following rule:
                    // `#$#selector { remove: true; padding: 0; }`
                    // because it mixes removal and non-removal declarations.
                    if (ruleNode.body.declarationList) {
                        // eslint-disable-next-line max-len
                        var declarationListValidationResult = validateDeclarationList(ruleNode.body.declarationList.value);
                        if (!declarationListValidationResult.isValid) {
                            throw new Error(declarationListValidationResult.errorMessage);
                        }
                        // If the selector list is not ExtendedCss, then we should set this flag based on the
                        // declaration list validation result
                        if (!result.isExtendedCss) {
                            result.isExtendedCss = declarationListValidationResult.isExtendedCss;
                        }
                    }
                    break;
                case agtree/* CosmeticRuleType.ScriptletInjectionRule */.Az.ScriptletInjectionRule:
                    // Scriptlet name is the first child of the parameter list
                    // eslint-disable-next-line max-len
                    scriptletName = agtree/* QuoteUtils.removeQuotes */.tC.removeQuotes((_d = (_c = (_b = ruleNode.body.children[0]) === null || _b === void 0 ? void 0 : _b.children[0]) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : EMPTY_STRING);
                    // Special case: scriptlet name is empty, e.g. '#%#//scriptlet()'
                    if (scriptletName.length === 0) {
                        break;
                    }
                    // Check if the scriptlet name is valid
                    if (!scriptlets_umd_default().isValidScriptletName(scriptletName)) {
                        throw new Error("'".concat(scriptletName, "' is not a known scriptlet name"));
                    }
                    break;
                case agtree/* CosmeticRuleType.HtmlFilteringRule */.Az.HtmlFilteringRule:
                    // TODO: Validate HTML filtering rules
                    break;
                case agtree/* CosmeticRuleType.JsInjectionRule */.Az.JsInjectionRule:
                    // TODO: Validate JS injection rules
                    break;
                default:
                    break;
            }
        }
        catch (error) {
            result.isValid = false;
            result.errorMessage = getErrorMessage(error);
        }
        return result;
    };
    /**
     * Checks if the domain list contains any domains, but returns `false` if only
     * the wildcard domain is specified.
     *
     * @param domainListNode Domain list node to check
     * @returns `true` if the domain list contains any domains, `false` otherwise
     */
    CosmeticRule.isAnyDomainSpecified = function (domainListNode) {
        if (domainListNode.children.length > 0) {
            // Skip wildcard domain list (*)
            return !(domainListNode.children.length === 1 && domainListNode.children[0].value === WILDCARD);
        }
        return false;
    };
    /**
     * Match returns true if this rule can be used on the specified request.
     *
     * @param request - request to check
     */
    CosmeticRule.prototype.match = function (request) {
        if (!this.domainModifier
            && !this.pathModifier
            && !this.urlModifier) {
            return true;
        }
        if (this.urlModifier) {
            return this.urlModifier.matchPattern(request, false);
        }
        if (this.domainModifier) {
            if (!this.domainModifier.matchDomain(request.hostname)) {
                return false;
            }
        }
        if (this.pathModifier) {
            var path = getRelativeUrl(request.urlLowercase);
            if (path) {
                return this.pathModifier.matchPathPattern(path);
            }
            return false;
        }
        return true;
    };
    /**
     * Returns the scriptlet's data consisting of the scriptlet function and its arguments.
     * This method is supposed to be used in the manifest V3 extension.
     */
    CosmeticRule.prototype.getScriptletData = function () {
        if (this.scriptletData) {
            return this.scriptletData;
        }
        this.initScript();
        return this.scriptletData;
    };
    /**
     * Updates this.scriptData and this.scriptletData when it is necessary in a lazy way.
     *
     * @param options
     */
    CosmeticRule.prototype.initScript = function (options) {
        var _a, _b;
        if (options === void 0) { options = {}; }
        var _c = options.debug, debug = _c === void 0 ? false : _c, frameUrl = options.frameUrl;
        var ruleContent = this.getContent();
        if (!this.isScriptlet) {
            this.scriptData = {
                code: ruleContent,
            };
            return;
        }
        // A scriptlet without a name can only be an allowlist scriptlet
        // https://github.com/AdguardTeam/Scriptlets/issues/377
        // or it is considered invalid if the scriptlet was invalid.
        // This does not require finding scriptData and scriptletData.
        if (!((_a = this.scriptletParams) === null || _a === void 0 ? void 0 : _a.name)) {
            return;
        }
        var params = {
            args: this.scriptletParams.args,
            engine: config.engine || EMPTY_STRING,
            name: this.scriptletParams.name,
            verbose: debug,
            domainName: frameUrl,
            version: config.version || EMPTY_STRING,
        };
        this.scriptData = {
            code: (_b = scriptlets_umd_default().invoke(params)) !== null && _b !== void 0 ? _b : null,
            debug: debug,
            frameUrl: frameUrl,
        };
        this.scriptletData = {
            func: scriptlets_umd_default().getScriptletFunction(params.name),
            params: params,
        };
    };
    return CosmeticRule;
}());

/**
 * Implements a host rule.
 *
 * HostRule is a structure for simple host-level rules (i.e. /etc/hosts syntax).
 * http://man7.org/linux/man-pages/man5/hosts.5.html
 * It also supports "just domain" syntax. In this case, the IP will be set to 0.0.0.0.
 *
 * Rules syntax looks like this:
 * ```
 * IP_address canonical_hostname [aliases...]
 * ```
 *
 * Examples:
 * * `192.168.1.13 bar.mydomain.org bar` -- ipv4
 * * `ff02::1 ip6-allnodes` -- ipv6
 * * `::1 localhost ip6-localhost ip6-loopback` -- ipv6 aliases
 * * `example.org` -- "just domain" syntax
 */
var HostRule = /** @class */ (function () {
    /**
     * Constructor
     *
     * Parses the rule and creates a new HostRule instance
     *
     * @param inputRule - original rule text.
     * @param filterListId - ID of the filter list this rule belongs to.
     *
     * @throws error if it fails to parse the rule.
     */
    function HostRule(node, filterListId, ruleIndex) {
        if (ruleIndex === void 0) { ruleIndex = RULE_INDEX_NONE; }
        this.hostnames = [];
        this.ip = '';
        this.invalid = false;
        this.ruleIndex = ruleIndex;
        this.filterListId = filterListId;
        this.ip = node.ip.value;
        if (node.hostnames.children.length === 0) {
            this.invalid = true;
            return;
        }
        this.hostnames = node.hostnames.children.map(function (hostname) { return hostname.value; });
    }
    /**
     * Match returns true if this rule can be used on the specified hostname.
     *
     * @param hostname - hostname to check
     */
    HostRule.prototype.match = function (hostname) {
        return this.hostnames.includes(hostname);
    };
    /**
     * Returns list id
     */
    HostRule.prototype.getFilterListId = function () {
        return this.filterListId;
    };
    /**
     * Returns rule index
     */
    HostRule.prototype.getIndex = function () {
        return this.ruleIndex;
    };
    /**
     * Returns ip address
     */
    HostRule.prototype.getIp = function () {
        return this.ip;
    };
    /**
     * Returns hostnames
     */
    HostRule.prototype.getHostnames = function () {
        return this.hostnames;
    };
    /**
     * Is invalid rule
     */
    HostRule.prototype.isInvalid = function () {
        return this.invalid;
    };
    return HostRule;
}());

/**
 * Helper function to create an allowlist rule node for a given domain.
 *
 * @param domain Domain to create an allowlist rule for.
 * @returns Allowlist rule node or null.
 */
var createAllowlistRuleNode = function (domain) {
    var domainToUse = domain.startsWith('www.') ? domain.substring(4) : domain;
    if (!domainToUse) {
        return null;
    }
    var pattern;
    // Special case: Wildcard TLD + N domain
    if (domainToUse.startsWith('*.')) {
        pattern = "".concat(SimpleRegex.MASK_START_URL).concat(domainToUse.slice(2));
    }
    else {
        // In other cases we use regexp to match domain and it`s 'www' subdomain strictly.
        var regexp = '';
        // transform allowlist domain special characters
        for (var i = 0; i < domainToUse.length; i += 1) {
            var char = domainToUse[i];
            // transform wildcard to regexp equivalent
            if (char === '*') {
                regexp += '.*';
                // escape domain separator
            }
            else if (char === '.') {
                regexp += String.raw(templateObject_1 || (templateObject_1 = __makeTemplateObject(["."], ["\\."])));
            }
            else {
                regexp += char;
            }
        }
        pattern = String.raw(templateObject_2 || (templateObject_2 = __makeTemplateObject(["///(www.)?", "/"], ["///(www\\.)?", "/"])), regexp);
    }
    var node = {
        category: agtree/* RuleCategory.Network */.WV.Network,
        type: agtree/* NetworkRuleType.NetworkRule */.bS.NetworkRule,
        syntax: agtree/* AdblockSyntax.Common */.qJ.Common,
        exception: true,
        pattern: {
            type: 'Value',
            value: pattern,
        },
        modifiers: {
            type: 'ModifierList',
            children: [
                {
                    type: 'Modifier',
                    name: {
                        type: 'Value',
                        value: 'document',
                    },
                },
                {
                    type: 'Modifier',
                    name: {
                        type: 'Value',
                        value: 'important',
                    },
                },
            ],
        },
    };
    return node;
};
var templateObject_1, templateObject_2;

/**
 * Rule builder class
 */
var RuleFactory = /** @class */ (function () {
    function RuleFactory() {
    }
    /**
     * Creates rule of suitable class from text string
     * It returns null if the line is empty or if it is a comment
     *
     * TODO: Pack `ignore*` parameters and `silent` into one object with flags.
     *
     * @param inputRule rule string
     * @param filterListId list id
     * @param ruleIndex line start index in the source filter list; it will be used to find the original rule text
     * in the filtering log when a rule is applied. Default value is {@link RULE_INDEX_NONE} which means that
     * the rule does not have source index
     * @param ignoreNetwork do not create network rules
     * @param ignoreCosmetic do not create cosmetic rules
     * @param ignoreHost do not create host rules
     * @param silent Log the error for `true`, otherwise throw an exception on
     * a rule creation
     *
     * @throws Error when `silent` flag is passed as false on rule creation error.
     *
     * @return IRule object or null
     */
    RuleFactory.createRule = function (node, filterListId, ruleIndex, ignoreNetwork, ignoreCosmetic, ignoreHost, silent) {
        if (ruleIndex === void 0) { ruleIndex = RULE_INDEX_NONE; }
        if (ignoreNetwork === void 0) { ignoreNetwork = false; }
        if (ignoreCosmetic === void 0) { ignoreCosmetic = false; }
        if (ignoreHost === void 0) { ignoreHost = true; }
        if (silent === void 0) { silent = true; }
        try {
            switch (node.category) {
                case agtree/* RuleCategory.Invalid */.WV.Invalid:
                case agtree/* RuleCategory.Empty */.WV.Empty:
                case agtree/* RuleCategory.Comment */.WV.Comment:
                    return null;
                case agtree/* RuleCategory.Cosmetic */.WV.Cosmetic:
                    if (ignoreCosmetic) {
                        return null;
                    }
                    return new CosmeticRule(node, filterListId, ruleIndex);
                case agtree/* RuleCategory.Network */.WV.Network:
                    if (node.type === agtree/* NetworkRuleType.HostRule */.bS.HostRule) {
                        if (ignoreHost) {
                            return null;
                        }
                        return new HostRule(node, filterListId, ruleIndex);
                    }
                    if (ignoreNetwork) {
                        return null;
                    }
                    return new NetworkRule(node, filterListId, ruleIndex);
                default:
                    // should not happen in normal operation
                    return null;
            }
        }
        catch (e) {
            var ruleText = agtree/* RuleParser.generate */.sR.generate(node);
            var msg = "\"".concat(getErrorMessage(e), "\" in the rule: \"").concat(ruleText, "\"");
            if (silent) {
                logger.info("Error: ".concat(msg));
            }
            else {
                throw new Error(msg);
            }
        }
        return null;
    };
    /**
     * Creates allowlist rule for domain.
     *
     * @param domain Domain name.
     * @returns Allowlist rule or null.
     */
    RuleFactory.createAllowlistRule = function (domain, filterListId, ruleIndex) {
        if (ruleIndex === void 0) { ruleIndex = RULE_INDEX_NONE; }
        var node = createAllowlistRuleNode(domain);
        if (!node) {
            return null;
        }
        return new NetworkRule(node, filterListId, ruleIndex);
    };
    return RuleFactory;
}());

/**
 * Network rule with index and hash.
 */
var IndexedNetworkRuleWithHash = /** @class */ (function (_super) {
    __extends(IndexedNetworkRuleWithHash, _super);
    /**
     * Constructor.
     *
     * @param rule Item of {@link NetworkRule}.
     * @param index Rule's index.
     * @param hash Hash of the rule.
     */
    function IndexedNetworkRuleWithHash(rule, index, hash) {
        var _this = _super.call(this, rule, index) || this;
        _this.hash = hash;
        _this.rule = rule;
        return _this;
    }
    /**
     * Creates hash for pattern part of the network rule and return it. Needed
     * to quickly compare two different rules with the same pattern part for
     * future checking of $badfilter application from one of them to another.
     *
     * @param networkRule Item of {@link NetworkRule}.
     *
     * @returns Hash for patter part of the network rule.
     */
    IndexedNetworkRuleWithHash.createRuleHash = function (networkRule) {
        // TODO: Improve this part: maybe use trie-lookup-table and .getShortcut()?
        // or use agtree to collect pattern + all enabled network options without values
        var significantPart = networkRule.getPattern();
        var hash = fastHash(significantPart);
        return hash;
    };
    /**
     * Create {@link IndexedNetworkRuleWithHash} from rule. If an error
     * was detected during the conversion - return it.
     *
     * @param filterId Filter id.
     * @param lineIndex Rule's line index in that filter.
     * @param ruleConvertedToAGSyntax Rule which was converted to AG syntax.
     *
     * @throws Error when conversion failed.
     *
     * @returns Item of {@link IndexedNetworkRuleWithHash} or Error.
     */
    IndexedNetworkRuleWithHash.createIndexedNetworkRuleWithHash = function (filterId, lineIndex, ruleConvertedToAGSyntax) {
        // Create indexed network rule from AG rule. These rules will be used in
        // declarative rules, that's why we ignore cosmetic and host rules.
        var networkRule;
        try {
            // Note: for correct throwing error it is important to use setConfiguration(),
            // because it will set compatibility type and future parsing options
            // for network rules will take it into account.
            networkRule = RuleFactory.createRule(ruleConvertedToAGSyntax, filterId, lineIndex, false, // convert only network rules
            true, // ignore cosmetic rules
            true, // ignore host rules
            false);
        }
        catch (e) {
            // eslint-disable-next-line max-len
            throw new Error("Cannot create IRule from filter \"".concat(filterId, "\" and byte offset \"").concat(lineIndex, "\": ").concat(getErrorMessage(e)));
        }
        /**
         * The converted rule will be null when there was a comment or
         * an ignored cosmetic/host rule.
         */
        if (networkRule === null) {
            return null;
        }
        if (!(networkRule instanceof NetworkRule)) {
            // eslint-disable-next-line max-len
            throw new Error("Rule from filter \"".concat(filterId, "\" and line \"").concat(lineIndex, "\" is not network rule: ").concat(networkRule));
        }
        var hash = IndexedNetworkRuleWithHash.createRuleHash(networkRule);
        // If rule is not empty - pack to IndexedNetworkRuleWithHash and add it
        // to the result array.
        var indexedNetworkRuleWithHash = new IndexedNetworkRuleWithHash(networkRule, lineIndex, hash);
        if (!indexedNetworkRuleWithHash) {
            // eslint-disable-next-line max-len
            throw new Error("Cannot create indexed network rule with hash from filter \"".concat(filterId, "\" and line \"").concat(lineIndex, "\""));
        }
        return indexedNetworkRuleWithHash;
    };
    /**
     * Creates {@link IndexedNetworkRuleWithHash} from rule node.
     *
     * @param filterId Filter's id from which rule was extracted.
     * @param lineIndex Line index of rule in that filter.
     * @param node Rule node.
     *
     * @throws Error when rule cannot be converted to AG syntax or when indexed
     * rule cannot be created from the rule which is already converted to AG
     * syntax.
     *
     * @returns Item of {@link IndexedNetworkRuleWithHash}.
     */
    IndexedNetworkRuleWithHash.createFromNode = function (filterId, lineIndex, node) {
        // Converts a raw string rule to AG syntax (apply aliases, etc.)
        var rulesConvertedToAGSyntax;
        try {
            var conversionResult = agtree/* RuleConverter.convertToAdg */.cR.convertToAdg(node);
            if (conversionResult.isConverted) {
                rulesConvertedToAGSyntax = conversionResult.result;
            }
            else {
                rulesConvertedToAGSyntax = [node];
            }
        }
        catch (e) {
            // eslint-disable-next-line max-len
            throw new Error("Unknown error during conversion rule to AG syntax: ".concat(getErrorMessage(e)));
        }
        var rules = [];
        var convertedAGRules = rulesConvertedToAGSyntax;
        // Now convert to IRule and then IndexedRule.
        for (var rulesIndex = 0; rulesIndex < convertedAGRules.length; rulesIndex += 1) {
            var ruleConvertedToAGSyntax = convertedAGRules[rulesIndex];
            try {
                var networkIndexedRuleWithHash = IndexedNetworkRuleWithHash.createIndexedNetworkRuleWithHash(filterId, lineIndex, ruleConvertedToAGSyntax);
                if (networkIndexedRuleWithHash) {
                    rules.push(networkIndexedRuleWithHash);
                }
            }
            catch (e) {
                // eslint-disable-next-line max-len
                throw new Error("Error during creating indexed rule with hash: ".concat(getErrorMessage(e)));
            }
        }
        return rules;
    };
    return IndexedNetworkRuleWithHash;
}(IndexedRule));

/* eslint-disable jsdoc/require-description-complete-sentence */
/**
 * @file Describes types from declarativeNetRequest,
 * since @types/chrome does not contain actual information.
 *
 * Updated 07/09/2022.
 */
var _a$1, _b;
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-DomainType
 */
var DomainType;
(function (DomainType) {
    DomainType["FirstParty"] = "firstParty";
    DomainType["ThirdParty"] = "thirdParty";
})(DomainType || (DomainType = {}));
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-ResourceType
 */
var ResourceType;
(function (ResourceType) {
    ResourceType["MainFrame"] = "main_frame";
    ResourceType["SubFrame"] = "sub_frame";
    ResourceType["Stylesheet"] = "stylesheet";
    ResourceType["Script"] = "script";
    ResourceType["Image"] = "image";
    ResourceType["Font"] = "font";
    ResourceType["Object"] = "object";
    ResourceType["XmlHttpRequest"] = "xmlhttprequest";
    ResourceType["Ping"] = "ping";
    ResourceType["Media"] = "media";
    ResourceType["WebSocket"] = "websocket";
    ResourceType["Other"] = "other";
    // Temporary not using
    // TODO: Add csp_report handler similar to AG-24613 but in declarative way.
    // CspReport = 'csp_report',
    // WebTransport = 'webtransport',
    // WebBundle = 'webbundle',
})(ResourceType || (ResourceType = {}));
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-QueryKeyValue
 */
var QueryKeyValueValidator = lib.z.strictObject({
    key: lib.z.string(),
    replaceOnly: lib.z.boolean().optional(),
    value: lib.z.string(),
});
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-QueryTransform
 */
var QueryTransformValidator = lib.z.strictObject({
    addOrReplaceParams: QueryKeyValueValidator.array().optional(),
    removeParams: lib.z.string().array().optional(),
});
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-URLTransform
 */
var URLTransformValidator = lib.z.strictObject({
    fragment: lib.z.string().optional(),
    host: lib.z.string().optional(),
    password: lib.z.string().optional(),
    path: lib.z.string().optional(),
    port: lib.z.string().optional(),
    query: lib.z.string().optional(),
    queryTransform: QueryTransformValidator.optional(),
    scheme: lib.z.string().optional(),
    username: lib.z.string().optional(),
});
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-Redirect
 */
var RedirectValidator = lib.z.strictObject({
    extensionPath: lib.z.string().optional(),
    regexSubstitution: lib.z.string().optional(),
    transform: URLTransformValidator.optional(),
    url: lib.z.string().optional(),
});
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-HeaderOperation
 */
var HeaderOperation;
(function (HeaderOperation) {
    HeaderOperation["Append"] = "append";
    HeaderOperation["Set"] = "set";
    HeaderOperation["Remove"] = "remove";
})(HeaderOperation || (HeaderOperation = {}));
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-ModifyHeaderInfo
 */
var ModifyHeaderInfoValidator = lib.z.strictObject({
    header: lib.z.string(),
    operation: lib.z.nativeEnum(HeaderOperation),
    value: lib.z.string().optional(),
});
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-RuleActionType
 */
var RuleActionType;
(function (RuleActionType) {
    RuleActionType["BLOCK"] = "block";
    RuleActionType["REDIRECT"] = "redirect";
    RuleActionType["ALLOW"] = "allow";
    RuleActionType["UPGRADE_SCHEME"] = "upgradeScheme";
    RuleActionType["MODIFY_HEADERS"] = "modifyHeaders";
    /**
     * For allowAllRequests rules {@link RuleCondition.resourceTypes} may only
     * include the 'sub_frame' and 'main_frame' resource types.
     */
    RuleActionType["ALLOW_ALL_REQUESTS"] = "allowAllRequests";
})(RuleActionType || (RuleActionType = {}));
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-RuleAction
 */
var RuleActionValidator = lib.z.strictObject({
    redirect: RedirectValidator.optional(),
    requestHeaders: ModifyHeaderInfoValidator.array().optional(),
    responseHeaders: ModifyHeaderInfoValidator.array().optional(),
    type: lib.z.nativeEnum(RuleActionType),
});
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-RequestMethod
 */
var RequestMethod;
(function (RequestMethod) {
    RequestMethod["Connect"] = "connect";
    RequestMethod["Delete"] = "delete";
    RequestMethod["Get"] = "get";
    RequestMethod["Head"] = "head";
    RequestMethod["Options"] = "options";
    RequestMethod["Patch"] = "patch";
    RequestMethod["Post"] = "post";
    RequestMethod["Put"] = "put";
})(RequestMethod || (RequestMethod = {}));
/**
 * Map {@link HTTPMethod} to declarative {@link RequestMethod}.
 */
var DECLARATIVE_REQUEST_METHOD_MAP = (_a$1 = {},
    _a$1[HTTPMethod.GET] = RequestMethod.Get,
    _a$1[HTTPMethod.POST] = RequestMethod.Post,
    _a$1[HTTPMethod.PUT] = RequestMethod.Put,
    _a$1[HTTPMethod.DELETE] = RequestMethod.Delete,
    _a$1[HTTPMethod.PATCH] = RequestMethod.Patch,
    _a$1[HTTPMethod.HEAD] = RequestMethod.Head,
    _a$1[HTTPMethod.OPTIONS] = RequestMethod.Options,
    _a$1[HTTPMethod.CONNECT] = RequestMethod.Connect,
    _a$1);
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-RuleCondition
 */
var RuleConditionValidator = lib.z.strictObject({
    domainType: lib.z.nativeEnum(DomainType).optional(),
    excludedInitiatorDomains: lib.z.string().array().optional(),
    excludedRequestDomains: lib.z.string().array().optional(),
    excludedRequestMethods: lib.z.nativeEnum(RequestMethod).array().optional(),
    excludedResourceTypes: lib.z.nativeEnum(ResourceType).array().optional(),
    excludedTabIds: lib.z.number().array().optional(),
    initiatorDomains: lib.z.string().array().optional(),
    isUrlFilterCaseSensitive: lib.z.boolean().optional(),
    regexFilter: lib.z.string().optional(),
    requestDomains: lib.z.string().array().optional(),
    requestMethods: lib.z.nativeEnum(RequestMethod).array().optional(),
    /**
     * If none of the `excludedResourceTypes` and `resourceTypes` are specified,
     * all resource types except "main_frame" will be matched.
     */
    resourceTypes: lib.z.nativeEnum(ResourceType).array().optional(),
    tabIds: lib.z.number().array().optional(),
    urlFilter: lib.z.string().optional(),
});
/**
 * https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-Rule
 */
var DeclarativeRuleValidator = lib.z.strictObject({
    action: RuleActionValidator,
    condition: RuleConditionValidator,
    id: lib.z.number(),
    priority: lib.z.number().optional(),
});
/**
 * Map request types to declarative types.
 */
var DECLARATIVE_RESOURCE_TYPES_MAP = (_b = {},
    _b[ResourceType.MainFrame] = RequestType.Document,
    _b[ResourceType.SubFrame] = RequestType.SubDocument,
    _b[ResourceType.Stylesheet] = RequestType.Stylesheet,
    _b[ResourceType.Script] = RequestType.Script,
    _b[ResourceType.Image] = RequestType.Image,
    _b[ResourceType.Font] = RequestType.Font,
    _b[ResourceType.Object] = RequestType.Object,
    _b[ResourceType.XmlHttpRequest] = RequestType.XmlHttpRequest,
    _b[ResourceType.Ping] = RequestType.Ping,
    // TODO: what should match this resource type?
    // [ResourceType.CSP_REPORT]: RequestType.Document,
    _b[ResourceType.Media] = RequestType.Media,
    _b[ResourceType.WebSocket] = RequestType.WebSocket,
    _b[ResourceType.Other] = RequestType.Other,
    _b);

/**
 * Describes an error when rule set source is not available.
 */
var UnavailableRuleSetSourceError = /** @class */ (function (_super) {
    __extends(UnavailableRuleSetSourceError, _super);
    /**
     * Describes an error when rule set source is not available.
     *
     * @param message Message of error.
     * @param ruleSetId Rule set id, the source of which is not available.
     * @param cause Basic error, describes why the source is unavailable.
     */
    function UnavailableRuleSetSourceError(message, ruleSetId, cause) {
        var _this = _super.call(this, message, { cause: cause }) || this;
        _this.name = 'UnavailableRuleSetSourceError';
        _this.ruleSetId = ruleSetId;
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, UnavailableRuleSetSourceError.prototype);
        return _this;
    }
    return UnavailableRuleSetSourceError;
}(Error));

/**
 * Contains a list of records with source rule ID, converted rule ID
 * and filter ID.
 * Can return the source filter and rule for the provided conversion rule ID.
 */
var SourceMap = /** @class */ (function () {
    /**
     * Creates new SourceMap from provided list of sources.
     *
     * @param sources List of sources.
     */
    function SourceMap(sources) {
        var _this = this;
        this.sources = [];
        /**
         * Needs for fast search for source rule.
         */
        this.ruleIdMap = new Map();
        /**
         * Needs for fast search for source rule.
         */
        this.declarativeIdMap = new Map();
        this.sources = sources;
        // For fast search
        this.sources.forEach(function (item) {
            var sourceRuleIndex = item.sourceRuleIndex, filterId = item.filterId, declarativeRuleId = item.declarativeRuleId;
            // Fill source rules map.
            var existingSourcePairs = _this.ruleIdMap.get(declarativeRuleId);
            var value = {
                sourceRuleIndex: sourceRuleIndex,
                filterId: filterId,
            };
            var newSourceValue = existingSourcePairs
                ? existingSourcePairs.concat(value)
                : [value];
            _this.ruleIdMap.set(declarativeRuleId, newSourceValue);
            // Fill
            var key = SourceMap.getKeyFromSource(value);
            var existingDeclarativeIdsPairs = _this.declarativeIdMap.get(key);
            var newDeclarativeIdsValue = existingDeclarativeIdsPairs
                ? existingDeclarativeIdsPairs.concat(declarativeRuleId)
                : [declarativeRuleId];
            _this.declarativeIdMap.set(key, newDeclarativeIdsValue);
        });
    }
    /**
     * Creates unique key for provided pair of source rule and filter id.
     *
     * @param source Pair of source rule and filter id.
     *
     * @returns Unique key for dictionary.
     */
    SourceMap.getKeyFromSource = function (source) {
        return "".concat(source.filterId, "_").concat(source.sourceRuleIndex);
    };
    /**
     * Returns source filter id and source text rule id
     * for provided declarative rule id.
     *
     * @param ruleId Converted rule id.
     *
     * @returns List of pairs: source filter id and source rule id.
     */
    SourceMap.prototype.getByDeclarativeRuleId = function (ruleId) {
        return this.ruleIdMap.get(ruleId) || [];
    };
    /**
     * Returns ids of converted declarative rules for provided pairs of source
     * filter id and source text rule.
     *
     * @param source Pair of source rule and filter id.
     *
     * @returns List of ids of converted declarative rules.
     */
    SourceMap.prototype.getBySourceRuleIndex = function (source) {
        var key = SourceMap.getKeyFromSource(source);
        return this.declarativeIdMap.get(key) || [];
    };
    /**
     * Deserializes array of sources from string.
     *
     * @param sourceString The original map that was serialized into a string.
     *
     * @returns List of sources.
     */
    SourceMap.deserializeSources = function (sourceString) {
        // TODO: Add validation
        var arr = JSON.parse(sourceString);
        return arr.map(function (item) { return ({
            declarativeRuleId: item[0],
            sourceRuleIndex: item[1],
            filterId: item[2],
        }); });
    };
    /**
     * Serializes source map to JSON string.
     *
     * @todo (TODO:) Can use protocol VLQ.
     *
     * @returns JSON string.
     */
    SourceMap.prototype.serialize = function () {
        // Remove fields names to reduce size of serialized string
        var plainArray = this.sources.map(function (_a) {
            var declarativeRuleId = _a.declarativeRuleId, sourceRuleIndex = _a.sourceRuleIndex, filterId = _a.filterId;
            return ([declarativeRuleId, sourceRuleIndex, filterId]);
        });
        return JSON.stringify(plainArray);
    };
    return SourceMap;
}());

var serializedRuleSetLazyDataValidator = lib.z.strictObject({
    sourceMapRaw: lib.z.string(),
    filterIds: lib.z.number().array(),
});
var serializedRuleSetDataValidator = lib.z.strictObject({
    regexpRulesCount: lib.z.number(),
    rulesCount: lib.z.number(),
    ruleSetHashMapRaw: lib.z.string(),
    badFilterRulesRaw: lib.z.string().array(),
});
/**
 * Keeps converted declarative rules, counters of rules and source map for them.
 */
var RuleSet = /** @class */ (function () {
    /**
     * Constructor of RuleSet.
     *
     * @param id Id of rule set.
     * @param rulesCount Number of rules.
     * @param regexpRulesCount Number of regexp rules.
     * @param ruleSetContentProvider Rule set content provider.
     * @param badFilterRules List of rules with $badfilter modifier.
     * @param rulesHashMap Dictionary with hashes for all source rules.
     */
    function RuleSet(id, rulesCount, regexpRulesCount, ruleSetContentProvider, badFilterRules, rulesHashMap) {
        /**
         * Array of converted declarative rules.
         */
        this.declarativeRules = [];
        /**
         * Number of converted declarative rules.
         * This is needed for the lazy version of the rule set,
         * when content not loaded.
         */
        this.rulesCount = 0;
        /**
         * Converted declarative regexp rules.
         */
        this.regexpRulesCount = 0;
        /**
         * Keeps array of source filter lists
         * TODO: ? May it leads to memory leaks,
         * because one FilterList with its content
         * can be in the several RuleSet's at the same time ?
         */
        this.filterList = new Map();
        /**
         * Whether the content is loaded or not.
         */
        this.initialized = false;
        this.id = id;
        this.rulesCount = rulesCount;
        this.regexpRulesCount = regexpRulesCount;
        this.ruleSetContentProvider = ruleSetContentProvider;
        this.badFilterRules = badFilterRules;
        this.rulesHashMap = rulesHashMap;
    }
    /** @inheritdoc */
    RuleSet.prototype.getRulesCount = function () {
        return this.rulesCount || this.declarativeRules.length;
    };
    /** @inheritdoc */
    RuleSet.prototype.getRegexpRulesCount = function () {
        return this.regexpRulesCount;
    };
    /** @inheritdoc */
    RuleSet.prototype.getId = function () {
        return this.id;
    };
    /**
     * Returns a list of pairs of source text rules and their filter identifiers
     * for a given declarative rule identifier.
     *
     * @param declarativeRuleId {@link DeclarativeRule|declarative rule} Id.
     *
     * @throws An error when filter is not found or filter content is unavailable.
     *
     * @returns Promise with list of source rules.
     */
    RuleSet.prototype.findSourceRules = function (declarativeRuleId) {
        var _this = this;
        if (!this.sourceMap) {
            return Promise.resolve([]);
        }
        var sourcePairs = this.sourceMap.getByDeclarativeRuleId(declarativeRuleId);
        var sourceRules = sourcePairs.map(function (_a) {
            var filterId = _a.filterId, sourceRuleIndex = _a.sourceRuleIndex;
            return __awaiter(_this, void 0, void 0, function () {
                var filter, sourceRule;
                return __generator(this, function (_b) {
                    switch (_b.label) {
                        case 0:
                            filter = this.filterList.get(filterId);
                            if (!filter) {
                                throw new Error("Not found filter list with id: ".concat(filterId));
                            }
                            return [4 /*yield*/, filter.getRuleByIndex(sourceRuleIndex)];
                        case 1:
                            sourceRule = _b.sent();
                            return [2 /*return*/, {
                                    sourceRule: sourceRule,
                                    filterId: filterId,
                                }];
                    }
                });
            });
        });
        return Promise.all(sourceRules);
    };
    /**
     * Run inner lazy deserialization from rule set content provider to load
     * data which is not needed on the creation of rule set:
     * the source map, filter list and declarative rules list.
     */
    RuleSet.prototype.loadContent = function () {
        return __awaiter(this, void 0, void 0, function () {
            var initialize;
            var _this = this;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        if (this.initialized) {
                            return [2 /*return*/];
                        }
                        if (!this.initializerPromise) return [3 /*break*/, 2];
                        return [4 /*yield*/, this.initializerPromise];
                    case 1:
                        _a.sent();
                        return [2 /*return*/];
                    case 2:
                        initialize = function () { return __awaiter(_this, void 0, void 0, function () {
                            var _a, loadSourceMap, loadFilterList, loadDeclarativeRules, _b, _c, filtersList;
                            var _this = this;
                            return __generator(this, function (_d) {
                                switch (_d.label) {
                                    case 0:
                                        _a = this.ruleSetContentProvider, loadSourceMap = _a.loadSourceMap, loadFilterList = _a.loadFilterList, loadDeclarativeRules = _a.loadDeclarativeRules;
                                        _b = this;
                                        return [4 /*yield*/, loadSourceMap()];
                                    case 1:
                                        _b.sourceMap = _d.sent();
                                        _c = this;
                                        return [4 /*yield*/, loadDeclarativeRules()];
                                    case 2:
                                        _c.declarativeRules = _d.sent();
                                        return [4 /*yield*/, loadFilterList()];
                                    case 3:
                                        filtersList = _d.sent();
                                        filtersList.forEach(function (filter) {
                                            _this.filterList.set(filter.getId(), filter);
                                        });
                                        this.initialized = true;
                                        return [2 /*return*/];
                                }
                            });
                        }); };
                        this.initializerPromise = initialize().then(function () {
                            _this.initializerPromise = undefined;
                        });
                        return [4 /*yield*/, this.initializerPromise];
                    case 3:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    /** @inheritdoc */
    RuleSet.prototype.getRulesById = function (declarativeRuleId) {
        return __awaiter(this, void 0, void 0, function () {
            var originalRules, e_1, id, msg;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        _a.trys.push([0, 3, , 4]);
                        return [4 /*yield*/, this.loadContent()];
                    case 1:
                        _a.sent();
                        return [4 /*yield*/, this.findSourceRules(declarativeRuleId)];
                    case 2:
                        originalRules = _a.sent();
                        return [2 /*return*/, originalRules];
                    case 3:
                        e_1 = _a.sent();
                        id = this.getId();
                        msg = "Cannot extract source rule for given declarativeRuleId ".concat(declarativeRuleId, " in rule set '").concat(id, "'");
                        throw new UnavailableRuleSetSourceError(msg, id, e_1);
                    case 4: return [2 /*return*/];
                }
            });
        });
    };
    /** @inheritdoc */
    RuleSet.prototype.getBadFilterRules = function () {
        return this.badFilterRules;
    };
    /** @inheritdoc */
    RuleSet.prototype.getRulesHashMap = function () {
        return this.rulesHashMap;
    };
    /** @inheritdoc */
    RuleSet.prototype.getDeclarativeRulesIdsBySourceRuleIndex = function (source) {
        return __awaiter(this, void 0, void 0, function () {
            var filterId, sourceRuleIndex;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, this.loadContent()];
                    case 1:
                        _a.sent();
                        if (!this.sourceMap) {
                            filterId = source.filterId, sourceRuleIndex = source.sourceRuleIndex;
                            // eslint-disable-next-line max-len
                            throw new Error("Cannot find declarative rules for filter id - ".concat(filterId, ", rule index - ").concat(sourceRuleIndex, " because source map is undefined in ruleset: ").concat(this.getId()));
                        }
                        return [2 /*return*/, this.sourceMap.getBySourceRuleIndex(source)];
                }
            });
        });
    };
    /** @inheritdoc */
    RuleSet.prototype.getDeclarativeRules = function () {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, this.loadContent()];
                    case 1:
                        _a.sent();
                        return [2 /*return*/, this.declarativeRules];
                }
            });
        });
    };
    /**
     * For provided source rule and filter id return network rule.
     * This method is needed for checking the applicability of $badfilter after
     * a fast-check of rules by comparing only hashes. Afterward, we should
     * build the 'full' Network rule from provided source, not just the hash,
     * to determine the applicability of $badfilter.
     *
     * @param source Source rule and filter id.
     *
     * @returns List of {@link NetworkRule | network rules}.
     */
    RuleSet.getNetworkRuleBySourceRule = function (source) {
        var sourceRule = source.sourceRule, filterId = source.filterId;
        var networkIndexedRulesWithHash = [];
        try {
            networkIndexedRulesWithHash = IndexedNetworkRuleWithHash.createFromNode(filterId, 
            // We don't need line index because this indexedNetworkRulesWithHash
            // will be used only for matching $badfilter rules.
            0, agtree/* RuleParser.parse */.sR.parse(sourceRule));
        }
        catch (e) {
            return [];
        }
        var networkRules = networkIndexedRulesWithHash.map(function (_a) {
            var rule = _a.rule;
            return rule;
        });
        return networkRules;
    };
    /**
     * Deserializes rule set to primitives values with lazy load.
     *
     * @param id Id of rule set.
     * @param rawData An item of {@link SerializedRuleSetData} for instant
     * creating ruleset. It contains counters for regular declarative and regexp
     * declarative rules, a map of hashes for all rules, and a list of rules
     * with the `$badfilter` modifier.
     * @param loadLazyData An item of {@link SerializedRuleSetLazyData} for lazy
     * loading ruleset data to find and display source rules when declarative
     * filtering log is enabled. It includes a map of sources for all rules,
     * a list of declarative rules, and a list of source filter IDs.
     * @param loadDeclarativeRules Loader for ruleset's declarative rules from
     * raw file as a string.
     * @param filterList List of {@link IFilter}.
     *
     * @returns Deserialized rule set.
     *
     * @throws Error {@link UnavailableRuleSetSourceError} if rule set source
     * is not available.
     */
    RuleSet.deserialize = function (id, rawData, loadLazyData, loadDeclarativeRules, filterList) {
        return __awaiter(this, void 0, void 0, function () {
            var data, objectFromString, msg, deserializedLazyData, getLazyData, deserialized;
            var _this = this;
            return __generator(this, function (_a) {
                try {
                    objectFromString = JSON.parse(rawData);
                    data = serializedRuleSetDataValidator.parse(objectFromString);
                }
                catch (e) {
                    msg = "Cannot parse serialized ruleset's data with id \"".concat(id, "\" because of not available source");
                    throw new UnavailableRuleSetSourceError(msg, id, e);
                }
                getLazyData = function () { return __awaiter(_this, void 0, void 0, function () {
                    var lazyData, objectFromString, e_2, msg;
                    return __generator(this, function (_a) {
                        switch (_a.label) {
                            case 0:
                                if (deserializedLazyData !== undefined) {
                                    return [2 /*return*/, deserializedLazyData];
                                }
                                _a.label = 1;
                            case 1:
                                _a.trys.push([1, 3, , 4]);
                                return [4 /*yield*/, loadLazyData()];
                            case 2:
                                lazyData = _a.sent();
                                objectFromString = JSON.parse(lazyData);
                                deserializedLazyData = serializedRuleSetLazyDataValidator.parse(objectFromString);
                                return [2 /*return*/, deserializedLazyData];
                            case 3:
                                e_2 = _a.sent();
                                msg = "Cannot parse or load data for lazy metadata for rule set with id \"".concat(id, "\": ").concat(getErrorMessage(e_2));
                                throw new UnavailableRuleSetSourceError(msg, id, e_2);
                            case 4: return [2 /*return*/];
                        }
                    });
                }); };
                deserialized = {
                    id: id,
                    data: data,
                    ruleSetContentProvider: {
                        loadSourceMap: function () { return __awaiter(_this, void 0, void 0, function () {
                            var sourceMapRaw, sources;
                            return __generator(this, function (_a) {
                                switch (_a.label) {
                                    case 0: return [4 /*yield*/, getLazyData()];
                                    case 1:
                                        sourceMapRaw = (_a.sent()).sourceMapRaw;
                                        sources = SourceMap.deserializeSources(sourceMapRaw);
                                        return [2 /*return*/, new SourceMap(sources)];
                                }
                            });
                        }); },
                        loadFilterList: function () { return __awaiter(_this, void 0, void 0, function () {
                            var filterIds;
                            return __generator(this, function (_a) {
                                switch (_a.label) {
                                    case 0: return [4 /*yield*/, getLazyData()];
                                    case 1:
                                        filterIds = (_a.sent()).filterIds;
                                        return [2 /*return*/, filterList.filter(function (filter) { return filterIds.includes(filter.getId()); })];
                                }
                            });
                        }); },
                        loadDeclarativeRules: function () { return __awaiter(_this, void 0, void 0, function () {
                            var rawFileContent, objectFromString, declarativeRules;
                            return __generator(this, function (_a) {
                                switch (_a.label) {
                                    case 0: return [4 /*yield*/, loadDeclarativeRules()];
                                    case 1:
                                        rawFileContent = _a.sent();
                                        objectFromString = JSON.parse(rawFileContent);
                                        declarativeRules = DeclarativeRuleValidator
                                            .array()
                                            .parse(objectFromString);
                                        return [2 /*return*/, declarativeRules];
                                }
                            });
                        }); },
                    },
                };
                return [2 /*return*/, deserialized];
            });
        });
    };
    /** @inheritdoc */
    RuleSet.prototype.serialize = function () {
        var _a;
        return __awaiter(this, void 0, void 0, function () {
            var e_3, id, msg, data, lazyData, serialized;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        _b.trys.push([0, 2, , 3]);
                        return [4 /*yield*/, this.loadContent()];
                    case 1:
                        _b.sent();
                        return [3 /*break*/, 3];
                    case 2:
                        e_3 = _b.sent();
                        id = this.getId();
                        msg = "Cannot serialize rule set '".concat(id, "' because of not available source");
                        throw new UnavailableRuleSetSourceError(msg, id, e_3);
                    case 3:
                        data = {
                            regexpRulesCount: this.regexpRulesCount,
                            rulesCount: this.rulesCount,
                            ruleSetHashMapRaw: this.rulesHashMap.serialize(),
                            // TODO: Remove .getText() completely
                            badFilterRulesRaw: this.badFilterRules.map(function (r) { return r.rule.getText(); }) || [],
                        };
                        lazyData = {
                            sourceMapRaw: ((_a = this.sourceMap) === null || _a === void 0 ? void 0 : _a.serialize()) || '',
                            filterIds: Array.from(this.filterList.keys()),
                        };
                        serialized = {
                            id: this.id,
                            data: JSON.stringify(data),
                            lazyData: JSON.stringify(lazyData),
                        };
                        return [2 /*return*/, serialized];
                }
            });
        });
    };
    return RuleSet;
}());

/**
 * Describes abstract error when declarative rule is invalid.
 */
var InvalidDeclarativeRuleError = /** @class */ (function (_super) {
    __extends(InvalidDeclarativeRuleError, _super);
    /**
     * Describes abstract error when declarative rule is invalid.
     *
     * @param message Message of error.
     * @param networkRule {@link NetworkRule}.
     * @param declarativeRule {@link DeclarativeRule}.
     */
    function InvalidDeclarativeRuleError(message, networkRule, declarativeRule) {
        var _this = _super.call(this, message) || this;
        _this.name = 'InvalidDeclarativeRuleError';
        _this.networkRule = networkRule;
        _this.declarativeRule = declarativeRule;
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, InvalidDeclarativeRuleError.prototype);
        return _this;
    }
    return InvalidDeclarativeRuleError;
}(Error));

/**
 * Describes error when converted rule contains empty list of resources types.
 */
var EmptyResourcesError = /** @class */ (function (_super) {
    __extends(EmptyResourcesError, _super);
    /**
     * Describes error when converted rule contains empty list of resources types.
     *
     * @param message Message of error.
     * @param networkRule {@link NetworkRule}.
     * @param declarativeRule {@link DeclarativeRule}.
     */
    function EmptyResourcesError(message, networkRule, declarativeRule) {
        var _this = _super.call(this, message, networkRule, declarativeRule) || this;
        _this.name = 'EmptyResourcesError';
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, EmptyResourcesError.prototype);
        return _this;
    }
    return EmptyResourcesError;
}(InvalidDeclarativeRuleError));

/**
 * Describes an error when a source network rule contains some of
 * the unsupported modifiers.
 *
 * @see {@link DeclarativeRuleConverter.checkNetworkRuleConvertible} for more details.
 */
var UnsupportedModifierError = /** @class */ (function (_super) {
    __extends(UnsupportedModifierError, _super);
    /**
     * Describes an error when a source network rule contains some of
     * the unsupported modifiers.
     *
     * @param message Message of error.
     * @param networkRule {@link NetworkRule}.
     */
    function UnsupportedModifierError(message, networkRule) {
        var _this = _super.call(this, message) || this;
        _this.name = 'UnsupportedModifierError';
        _this.networkRule = networkRule;
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, UnsupportedModifierError.prototype);
        return _this;
    }
    return UnsupportedModifierError;
}(Error));

/**
 * Describes an error when the converted rule contains an unsupported RE2
 * regexp syntax error.
 *
 * @see https://github.com/google/re2/wiki/Syntax
 */
var UnsupportedRegexpError = /** @class */ (function (_super) {
    __extends(UnsupportedRegexpError, _super);
    /**
     * Describes an error when the converted rule contains an unsupported RE2
     * regexp syntax error.
     *
     * @param message Message of error.
     * @param networkRule {@link NetworkRule}.
     * @param declarativeRule {@link DeclarativeRule}.
     * @param reason Describes a reason of the error.
     */
    function UnsupportedRegexpError(message, networkRule, declarativeRule, reason) {
        var _this = _super.call(this, message, networkRule, declarativeRule) || this;
        _this.name = 'UnsupportedRegexpError';
        _this.reason = reason;
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, UnsupportedRegexpError.prototype);
        return _this;
    }
    return UnsupportedRegexpError;
}(InvalidDeclarativeRuleError));

/**
 * Describes error when maximum number of rules is equal or less than 0.
 */
var EmptyOrNegativeNumberOfRulesError = /** @class */ (function (_super) {
    __extends(EmptyOrNegativeNumberOfRulesError, _super);
    /**
     * Describes error when maximum number of rules is equal or less than 0.
     *
     * @param message Message of error.
     */
    function EmptyOrNegativeNumberOfRulesError(message) {
        var _this = _super.call(this, message) || this;
        _this.name = 'EmptyOrNegativeNumberOfRulesError';
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, EmptyOrNegativeNumberOfRulesError.prototype);
        return _this;
    }
    return EmptyOrNegativeNumberOfRulesError;
}(Error));

/**
 * Describes error when maximum number of rules is less than 0.
 */
var NegativeNumberOfRegexpRulesError = /** @class */ (function (_super) {
    __extends(NegativeNumberOfRegexpRulesError, _super);
    /**
     * Describes error when maximum number of rules is less than 0.
     *
     * @param message Message of error.
     */
    function NegativeNumberOfRegexpRulesError(message) {
        var _this = _super.call(this, message) || this;
        _this.name = 'NegativeNumberOfRegexpRulesError';
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, NegativeNumberOfRegexpRulesError.prototype);
        return _this;
    }
    return NegativeNumberOfRegexpRulesError;
}(Error));

/**
 * Describes error when the resources path does not start with a slash
 * or it ends with a slash.
 */
var ResourcesPathError = /** @class */ (function (_super) {
    __extends(ResourcesPathError, _super);
    /**
     * Describes error when the resources path does not start with a slash
     * or it ends with a slash.
     *
     * @param message Message of error.
     */
    function ResourcesPathError(message) {
        var _this = _super.call(this, message) || this;
        _this.name = 'ResourcesPathError';
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, ResourcesPathError.prototype);
        return _this;
    }
    return ResourcesPathError;
}(Error));

/**
 * Class for validating network rules.
 */
var NetworkRuleDeclarativeValidator = /** @class */ (function () {
    function NetworkRuleDeclarativeValidator() {
    }
    /**
     * Checks if the $redirect values in the provided network rule
     * are supported for conversion to MV3.
     *
     * @param r Network rule.
     * @param name Modifier's name.
     *
     * @returns Error {@link UnsupportedModifierError} or null if rule is supported.
     */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    NetworkRuleDeclarativeValidator.checkRemoveParamModifierFn = function (r, name) {
        var removeParam = r.getAdvancedModifier();
        if (!removeParam) {
            return null;
        }
        if (!RemoveParamModifier.isRemoveParamModifier(removeParam)) {
            return null;
        }
        if (!removeParam.getMV3Validity()) {
            return new UnsupportedModifierError('Network rule with $removeparam modifier with negation or regexp is not supported', r);
        }
        return null;
    };
    /**
     * Checks if the provided rule is an allowlist rule.
     *
     * @param r Network rule.
     * @param name Modifier's name.
     *
     * @returns Error {@link UnsupportedModifierError} or null if rule is supported.
     */
    NetworkRuleDeclarativeValidator.checkAllowRulesFn = function (r, name) {
        if (r.isAllowlist()) {
            return new UnsupportedModifierError("Network allowlist rule with ".concat(name, " modifier is not supported"), r);
        }
        return null;
    };
    /**
     * Checks if the specified modifier is the only one the rule has, then throws error.
     *
     * @param r Network rule.
     * @param name Modifier's name.
     *
     * @returns Error {@link UnsupportedModifierError} or null if rule is supported.
     */
    NetworkRuleDeclarativeValidator.checkNotOnlyOneModifier = function (r, name) {
        var nameToCheck = name;
        // Remove leading dollar sign, if any
        if (nameToCheck.startsWith(OPTIONS_DELIMITER)) {
            nameToCheck = nameToCheck.slice(OPTIONS_DELIMITER.length);
        }
        // Get all used modifier names from the network rule
        var optionNames = r.getUsedOptionNames();
        if (optionNames.size === 1 && optionNames.has(nameToCheck)) {
            return new UnsupportedModifierError("Network rule with only one enabled modifier ".concat(name, " is not supported"), r);
        }
        return null;
    };
    /**
     * Checks if the $removeparam values in the provided network rule
     * are supported for conversion to MV3.
     *
     * @param r Network rule.
     * @param name Modifier's name.
     *
     * @returns Error {@link UnsupportedModifierError} or null if rule is supported.
     */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    NetworkRuleDeclarativeValidator.checkRemoveHeaderModifierFn = function (r, name) {
        var removeHeader = r.getAdvancedModifier();
        if (!removeHeader) {
            return null;
        }
        if (!RemoveHeaderModifier.isRemoveHeaderModifier(removeHeader)) {
            return null;
        }
        if (!removeHeader.isValid) {
            return new UnsupportedModifierError(
            // eslint-disable-next-line max-len
            'Network rule with $removeheader modifier contains some of the unsupported headers', r);
        }
        return null;
    };
    /**
     * Checks if the $method values in the provided network rule
     * are supported for conversion to MV3.
     *
     * @param r Network rule.
     * @param name Modifier's name.
     *
     * @returns Error {@link UnsupportedModifierError} or null if rule is supported.
     */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    NetworkRuleDeclarativeValidator.checkMethodModifierFn = function (r, name) {
        var permittedMethods = r.getPermittedMethods();
        var restrictedMethods = r.getRestrictedMethods();
        if ((permittedMethods === null || permittedMethods === void 0 ? void 0 : permittedMethods.some(function (method) { return method === HTTPMethod.TRACE; }))
            || (restrictedMethods === null || restrictedMethods === void 0 ? void 0 : restrictedMethods.some(function (method) { return method === HTTPMethod.TRACE; }))) {
            return new UnsupportedModifierError('Network rule with $method modifier containing \'trace\' method is not supported', r);
        }
        return null;
    };
    /**
     * Checks if a network rule can be converted to a declarative format or not.
     * We skip the following modifiers:
     *
     * All specific exceptions:
     * $genericblock;
     * $jsinject;
     * $urlblock;
     * $content;
     * $extension;
     * $stealth;
     *
     * Following specific exceptions are not require conversion, but they
     * are used in the {@link MatchingResult.getCosmeticOption}:
     * $elemhide
     * $generichide;
     * $specifichide;
     *
     * Other:
     * $header;
     * $popup;
     * $csp;
     * $replace;
     * $cookie - if modifier is not empty and contains any parameters;
     * $redirect - if the rule is a allowlist;
     * $removeparam - if it contains a negation, or regexp,
     * or the rule is a allowlist;
     * $removeheader - if it contains a title from a prohibited list
     * (see {@link RemoveHeaderModifier.FORBIDDEN_HEADERS});
     * $jsonprune;
     * $method - if the modifier contains 'trace' method,
     * $hls;
     * $permissions.
     *
     * @param rule - Network rule.
     *
     * @throws Error with type {@link UnsupportedModifierError} if the rule is not
     * convertible.
     *
     * @returns Boolean flag - `false` if the rule does not require conversion
     * and `true` if the rule is convertible.
     */
    NetworkRuleDeclarativeValidator.shouldConvertNetworkRule = function (rule) {
        // Filter NetworkRuleOption.NotSet because this is syntax sugar and
        // not a real valuable option.
        var options = Object.keys(NetworkRuleOption).filter(function (key) { return key !== 'NotSet'; });
        // Because we don't have public getter of rule's options, we need
        // to iterate over all existing network options and check each of them.
        for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
            var option = options_1[_i];
            var networkOption = NetworkRuleOption[option];
            if (!rule.isOptionEnabled(networkOption)) {
                continue;
            }
            var validator = this.optionsValidators[option];
            if (!validator) {
                throw new Error("Validator for option \"".concat(option, "\" is not found"));
            }
            var name_1 = validator.name, customChecks = validator.customChecks, skipConversion = validator.skipConversion, notSupported = validator.notSupported;
            if (notSupported) {
                throw new UnsupportedModifierError("Unsupported option \"".concat(name_1, "\""), rule);
            }
            if (skipConversion) {
                if (rule.isSingleOptionEnabled(networkOption)) {
                    return false;
                }
                continue;
            }
            if (customChecks) {
                for (var j = 0; j < customChecks.length; j += 1) {
                    var err = customChecks[j](rule, name_1);
                    if (err !== null) {
                        throw err;
                    }
                }
            }
        }
        return true;
    };
    /**
     * Checks if the $cookie values in the provided network rule
     * are supported for conversion to MV3.
     *
     * @param r Network rule.
     * @param name Modifier's name.
     *
     * @returns Error {@link UnsupportedModifierError} or null if rule is supported.
     */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    NetworkRuleDeclarativeValidator.checkCookieModifierFn = function (r, name) {
        var cookieModifier = r.getAdvancedModifier();
        if (!cookieModifier) {
            return null;
        }
        if (!CookieModifier.isCookieModifier(cookieModifier)) {
            return null;
        }
        if (!cookieModifier.isEmpty()) {
            // eslint-disable-next-line max-len
            var msg = 'The use of additional parameters in $cookie (apart from $cookie itself) is not supported';
            return new UnsupportedModifierError(msg, r);
        }
        return null;
    };
    /**
     * Checks if rule is a "document"-allowlist and contains all these
     * `$elemhide,content,urlblock,jsinject` modifiers at the same time.
     * If it is - we allow partially convert this rule, because `$content`
     * is not supported in the MV3 at all and `$jsinject` and `$urlblock`
     * are not implemented yet, but we can support at least allowlist-rule
     * with `$elemhide` modifier (not in the DNR, but with tsurlfilter engine).
     *
     * TODO: Change the description when `$jsinject` and `$urlblock`
     * are implemented.
     *
     * @param r Network rule.
     * @param name Modifier's name.
     *
     * @returns Error {@link UnsupportedModifierError} or null if rule is supported.
     */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    NetworkRuleDeclarativeValidator.checkDocumentAllowlistFn = function (r, name) {
        if (r.isFilteringDisabled()) {
            return null;
        }
        return new UnsupportedModifierError("Network rule with \"".concat(name, "\" modifier is not supported"), r);
    };
    /**
     * The $redirect-rule support will be possible to implement after browsers add this feature:
     * https://github.com/w3c/webextensions/issues/493.
     *
     * @param r Network rule.
     * @param name Modifier's name.
     *
     * @returns Error {@link UnsupportedModifierError} or null if rule is supported.
     */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    NetworkRuleDeclarativeValidator.checkRedirectModifierFn = function (r, name) {
        var isRedirectRule = r.isOptionEnabled(NetworkRuleOption.Redirect)
            && r.getAdvancedModifier().isRedirectingOnlyBlocked;
        if (!isRedirectRule) {
            return null;
        }
        return new UnsupportedModifierError('Network rule with $redirect-rule modifier is not supported', r);
    };
    NetworkRuleDeclarativeValidator.optionsValidators = {
        // Supported
        ThirdParty: { name: '$third-party' },
        MatchCase: { name: '$match-case' },
        Important: { name: '$important' },
        To: { name: '$to' },
        Badfilter: { name: '$badfilter' },
        Permissions: { name: '$permissions' },
        // Supported without conversion.
        Elemhide: { name: '$elemhide', skipConversion: true },
        Generichide: { name: '$generichide', skipConversion: true },
        Specifichide: { name: '$specifichide', skipConversion: true },
        // Partially supported.
        Jsinject: { name: '$jsinject', customChecks: [NetworkRuleDeclarativeValidator.checkDocumentAllowlistFn] },
        Urlblock: { name: '$urlblock', customChecks: [NetworkRuleDeclarativeValidator.checkDocumentAllowlistFn] },
        Content: { name: '$content', customChecks: [NetworkRuleDeclarativeValidator.checkDocumentAllowlistFn] },
        // $popup is not supported in MV3, but rule with $all modifier includes $popup, so we should to skip it.
        Popup: { name: '$popup', customChecks: [NetworkRuleDeclarativeValidator.checkNotOnlyOneModifier] },
        Csp: { name: '$csp', customChecks: [NetworkRuleDeclarativeValidator.checkAllowRulesFn] },
        Redirect: {
            // $redirect and $redirect-rule modifiers are falling under this option
            name: '$redirect',
            customChecks: [
                NetworkRuleDeclarativeValidator.checkAllowRulesFn,
                NetworkRuleDeclarativeValidator.checkRedirectModifierFn,
            ],
        },
        RemoveParam: {
            name: '$removeparam',
            customChecks: [
                NetworkRuleDeclarativeValidator.checkAllowRulesFn,
                NetworkRuleDeclarativeValidator.checkRemoveParamModifierFn,
            ],
        },
        RemoveHeader: {
            name: '$removeheader',
            customChecks: [
                NetworkRuleDeclarativeValidator.checkAllowRulesFn,
                NetworkRuleDeclarativeValidator.checkRemoveHeaderModifierFn,
            ],
        },
        Cookie: {
            name: '$cookie',
            customChecks: [
                NetworkRuleDeclarativeValidator.checkAllowRulesFn,
                NetworkRuleDeclarativeValidator.checkCookieModifierFn,
            ],
        },
        Method: { name: '$method', customChecks: [NetworkRuleDeclarativeValidator.checkMethodModifierFn] },
        // Not supported.
        Header: { name: '$header', notSupported: true },
        // Not supported yet.
        Genericblock: { name: '$genericblock', notSupported: true },
        Stealth: { name: '$stealth', notSupported: true },
        // Will not be supported.
        Replace: { name: '$replace', notSupported: true },
        JsonPrune: { name: '$jsonprune', notSupported: true },
        Hls: { name: '$hls', notSupported: true },
        // DNS modifiers.
        Client: { name: '$client', notSupported: true },
        DnsRewrite: { name: '$dnsrewrite', notSupported: true },
        DnsType: { name: '$dnstype', notSupported: true },
        Ctag: { name: '$ctag', notSupported: true },
        // Desktop modifiers only.
        Network: { name: '$network', notSupported: true },
        Extension: { name: '$extension', notSupported: true },
    };
    return NetworkRuleDeclarativeValidator;
}());

/**
 * Describes error when converted rule contains an empty list of domains, but original contains.
 */
var EmptyDomainsError = /** @class */ (function (_super) {
    __extends(EmptyDomainsError, _super);
    /**
     * Describes error when converted rule contains an empty list of domains, but original contains.
     *
     * @param message Message of error.
     * @param networkRule {@link NetworkRule}.
     * @param declarativeRule {@link DeclarativeRule}.
     */
    function EmptyDomainsError(message, networkRule, declarativeRule) {
        var _this = _super.call(this, message, networkRule, declarativeRule) || this;
        _this.name = 'EmptyDomainsError';
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, EmptyDomainsError.prototype);
        return _this;
    }
    return EmptyDomainsError;
}(InvalidDeclarativeRuleError));

/**
 * Check if the regex is supported in a browser extension using the built-in chrome.declarativeNetRequest API.
 *
 * @param regexFilter Regex to check.
 * @returns Promise that resolves to true if the regex is supported, and rejects with an error otherwise.
 */
var regexValidatorExtension = function (regexFilter) { return __awaiter(void 0, void 0, void 0, function () {
    return __generator(this, function (_a) {
        return [2 /*return*/, new Promise(function (resolve, reject) {
                if (typeof chrome !== 'undefined' && chrome.declarativeNetRequest) {
                    var regexOptions = { regex: regexFilter };
                    chrome.declarativeNetRequest.isRegexSupported(regexOptions, function (result) {
                        if (chrome.runtime.lastError) {
                            reject(chrome.runtime.lastError);
                        }
                        else if (result.isSupported) {
                            resolve(true);
                        }
                        else {
                            reject(new Error(result.reason));
                        }
                    });
                }
                else {
                    reject(new Error('chrome.declarativeNetRequest is not available'));
                }
            })];
    });
}); };

/**
 * Class to manage regex validation using a customizable validator function.
 * By default, it uses the Chrome validator, but a custom validator can be set.
 */
var Re2Validator = /** @class */ (function () {
    function Re2Validator() {
        /**
         * The default validator function.
         * By default, it uses the builtin browser validator.
         */
        this.validator = regexValidatorExtension;
    }
    /**
     * Set a custom validator function.
     *
     * @param validator - The custom validator function to use.
     */
    Re2Validator.prototype.setValidator = function (validator) {
        this.validator = validator;
    };
    /**
     * Check if the regex is supported using the current validator function.
     *
     * @param regexFilter - The regex pattern to validate.
     * @returns A promise that resolves to true if the regex is supported, false otherwise.
     */
    Re2Validator.prototype.isRegexSupported = function (regexFilter) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/, this.validator(regexFilter)];
            });
        });
    };
    return Re2Validator;
}());
/**
 * Singleton instance of the Re2Validator class.
 * Provides a single point of access to manage regex validation.
 */
var re2Validator = new Re2Validator();

/* eslint-disable jsdoc/require-description-complete-sentence */
/**
 * Contains the generic logic for converting a {@link NetworkRule}
 * into a {@link DeclarativeRule}.
 *
 * Descendant classes must override the {@link convert} method,
 * where some logic must be defined for each rule type.
 *
 * Also descendant classes can use {@link convertRules}, {@link convertRule} and
 * {@link groupConvertedRules} methods, which contains the general logic of
 * transformation and grouping of rules.
 */
var DeclarativeRuleConverter = /** @class */ (function () {
    /**
     * Creates an instance of DeclarativeRuleConverter.
     *
     * @param webAccessibleResourcesPath Path to web accessible resources.
     */
    function DeclarativeRuleConverter(webAccessibleResourcesPath) {
        this.webAccessibleResourcesPath = webAccessibleResourcesPath;
    }
    /**
     * Gets resource type matching request type.
     *
     * @param requestTypes Request type.
     *
     * @returns List of resource types.
     */
    DeclarativeRuleConverter.getResourceTypes = function (requestTypes) {
        return Object.entries(DECLARATIVE_RESOURCE_TYPES_MAP)
            // Skips the first element
            .filter(function (_a) {
            var requestType = _a[1];
            return (requestTypes & requestType) === requestType;
        })
            .map(function (_a) {
            var resourceTypeKey = _a[0];
            return resourceTypeKey;
        });
    };
    /**
     * Converts list of tsurlfilter {@link HTTPMethod|methods} to declarative
     * supported http {@link RequestMethod|methods} via excluding 'trace' method.
     *
     * @param methods List of {@link HTTPMethod|methods}.
     *
     * @returns List of {@link RequestMethod|methods}.
     */
    DeclarativeRuleConverter.mapHttpMethodToDeclarativeHttpMethod = function (methods) {
        return methods
            // Filters unsupported `trace` method
            .filter(function (m) { return m !== HTTPMethod.TRACE; })
            // Map tsurlfilter http method to supported declarative http method
            .map(function (m) { return DECLARATIVE_REQUEST_METHOD_MAP[m]; });
    };
    /**
     * Checks if the string contains only ASCII characters.
     *
     * @param str String to test.
     *
     * @returns True if string contains only ASCII characters.
     */
    DeclarativeRuleConverter.isASCII = function (str) {
        // eslint-disable-next-line no-control-regex
        return /^[\x00-\x7F]+$/.test(str);
    };
    /**
     * Converts to ASCII characters only if `str` contains non-ASCII characters.
     *
     * @param str String to convert.
     *
     * @returns A transformed string containing only ASCII characters or
     * the original string.
     *
     * @throws Error if conversion into ASCII fails.
     */
    DeclarativeRuleConverter.prepareASCII = function (str) {
        var res = str;
        try {
            if (!DeclarativeRuleConverter.isASCII(res)) {
                // for cyrillic domains we need to convert them by isASCII()
                res = punycode_es6/* default.toASCII */.ZP.toASCII(res);
            }
            // after toASCII() some characters can be still non-ASCII
            // e.g. `abc“@` with non-ASCII `“`
            if (!DeclarativeRuleConverter.isASCII(res)) {
                res = punycode_es6/* default.encode */.ZP.encode(res);
            }
        }
        catch (e) {
            throw new Error("Error converting to ASCII: \"".concat(str, "\" due to ").concat(getErrorMessage(e)));
        }
        return res;
    };
    /**
     * Removes slashes from the beginning and end of the string.
     * We do that because regexFilter does not support them.
     *
     * @param str String to remove slashes.
     * @returns String without slashes.
     */
    DeclarativeRuleConverter.removeSlashes = function (str) {
        if (str.startsWith('/') && str.endsWith('/')) {
            return str.substring(1, str.length - 1);
        }
        return str;
    };
    /**
     * Converts a list of strings into strings containing only ASCII characters.
     *
     * @param strings List of strings.
     *
     * @returns List of string containing only ASCII characters.
     */
    DeclarativeRuleConverter.toASCII = function (strings) {
        return strings.map(function (s) {
            return DeclarativeRuleConverter.prepareASCII(s);
        });
    };
    /**
     * Checks if network rule can be converted to {@link RuleActionType.ALLOW_ALL_REQUESTS}.
     *
     * @param rule Network rule.
     *
     * @returns Is rule compatible with {@link RuleActionType.ALLOW_ALL_REQUESTS}.
     */
    DeclarativeRuleConverter.isCompatibleWithAllowAllRequests = function (rule) {
        var types = DeclarativeRuleConverter.getResourceTypes(rule.getPermittedRequestTypes());
        var allowedRequestTypes = [ResourceType.MainFrame, ResourceType.SubFrame];
        // If found resource type which is incompatible with allowAllRequest field
        if (types.some(function (type) { return !allowedRequestTypes.includes(type); })) {
            return false;
        }
        return true;
    };
    /**
     * Rule priority.
     *
     * @see {@link NetworkRule.getPriorityWeight}
     * @see {@link NetworkRule.priorityWeight}
     * @see {@link NetworkRule.calculatePriorityWeight}
     * @see {@link https://adguard.com/kb/en/general/ad-filtering/create-own-filters/#rule-priorities}
     *
     * @param rule Network rule.
     *
     * @returns Priority of the rule or null.
     */
    DeclarativeRuleConverter.getPriority = function (rule) {
        return rule.getPriorityWeight();
    };
    /**
     * Rule redirect action.
     *
     * @param rule Network rule.
     *
     * @throws Error {@link ResourcesPathError} when a network rule has
     * a $redirect modifier and no path to web-accessible resources
     * is specified.
     *
     * @returns Redirect, which describes where and how the request
     * should be redirected.
     */
    DeclarativeRuleConverter.prototype.getRedirectAction = function (rule) {
        if (rule.isOptionEnabled(NetworkRuleOption.Redirect)) {
            var resourcesPath = this.webAccessibleResourcesPath;
            if (!resourcesPath) {
                throw new ResourcesPathError('Empty web accessible resources path');
            }
            var advancedModifier = rule.getAdvancedModifier();
            var redirectTo = advancedModifier;
            var filename = scriptlets_umd.redirects.getRedirectFilename(redirectTo.getValue());
            return { extensionPath: "".concat(resourcesPath, "/").concat(filename) };
        }
        if (rule.isOptionEnabled(NetworkRuleOption.RemoveParam)) {
            var advancedModifier = rule.getAdvancedModifier();
            var removeParamModifier = advancedModifier;
            var value = removeParamModifier.getValue();
            if (value === '') {
                return { transform: { query: '' } };
            }
            return {
                transform: {
                    queryTransform: {
                        removeParams: DeclarativeRuleConverter.toASCII([value]),
                    },
                },
            };
        }
        return {};
    };
    /**
     * Returns rule modify headers action.
     *
     * @param rule Network rule.
     *
     * @returns Modify headers action, which describes which headers should
     * be changed: added, set or deleted.
     */
    DeclarativeRuleConverter.getModifyHeadersAction = function (rule) {
        if (!rule.isOptionEnabled(NetworkRuleOption.RemoveHeader)) {
            return null;
        }
        var removeHeaderModifier = rule.getAdvancedModifier();
        var removeRequestHeader = removeHeaderModifier.getApplicableHeaderName(true);
        if (removeRequestHeader) {
            return {
                requestHeaders: [{
                        header: removeRequestHeader,
                        operation: HeaderOperation.Remove,
                    }],
            };
        }
        var removeResponseHeader = removeHeaderModifier.getApplicableHeaderName(false);
        if (removeResponseHeader) {
            return {
                responseHeaders: [{
                        header: removeResponseHeader,
                        operation: HeaderOperation.Remove,
                    }],
            };
        }
        return null;
    };
    /**
     * Returns rule modify headers action with removing Cookie headers from response and request.
     *
     * @param rule Network rule.
     *
     * @returns Add headers action, which describes which headers should be added.
     */
    DeclarativeRuleConverter.getRemovingCookieHeadersAction = function (rule) {
        if (!rule.isOptionEnabled(NetworkRuleOption.Cookie)) {
            return null;
        }
        return {
            responseHeaders: [{
                    operation: HeaderOperation.Remove,
                    header: 'Set-Cookie',
                }],
            requestHeaders: [{
                    operation: HeaderOperation.Remove,
                    header: 'Cookie',
                }],
        };
    };
    /**
     * Returns rule modify headers action with adding CSP headers to response.
     *
     * @param rule Network rule.
     *
     * @returns Add headers action, which describes what headers should be added.
     */
    DeclarativeRuleConverter.getAddingCspHeadersAction = function (rule) {
        if (!rule.isOptionEnabled(NetworkRuleOption.Csp)) {
            return null;
        }
        var cspHeaderValue = rule.getAdvancedModifierValue();
        if (cspHeaderValue) {
            return {
                operation: HeaderOperation.Append,
                header: CSP_HEADER_NAME,
                value: cspHeaderValue,
            };
        }
        return null;
    };
    /**
     * Returns rule modify headers action with adding Permissions headers to response.
     *
     * @param rule Network rule.
     *
     * @returns Add headers action, which describes what headers should be added.
     */
    DeclarativeRuleConverter.getAddingPermissionsHeadersAction = function (rule) {
        if (!rule.isOptionEnabled(NetworkRuleOption.Permissions)) {
            return null;
        }
        var permissionsHeaderValue = rule.getAdvancedModifierValue();
        if (permissionsHeaderValue) {
            return {
                operation: HeaderOperation.Append,
                header: PERMISSIONS_POLICY_HEADER_NAME,
                value: permissionsHeaderValue,
            };
        }
        return null;
    };
    /**
     * Rule action.
     *
     * @param rule Network rule.
     *
     * @throws Error {@link ResourcesPathError} when specified an empty
     * path to the web accessible resources.
     *
     * @returns The action of a rule that describes what should be done
     * with the request.
     */
    DeclarativeRuleConverter.prototype.getAction = function (rule) {
        if (rule.isAllowlist()) {
            if (rule.isFilteringDisabled() && DeclarativeRuleConverter.isCompatibleWithAllowAllRequests(rule)) {
                return { type: RuleActionType.ALLOW_ALL_REQUESTS };
            }
            return { type: RuleActionType.ALLOW };
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Redirect)
            || rule.isOptionEnabled(NetworkRuleOption.RemoveParam)) {
            return {
                type: RuleActionType.REDIRECT,
                redirect: this.getRedirectAction(rule),
            };
        }
        if (rule.isOptionEnabled(NetworkRuleOption.RemoveHeader)) {
            var modifyHeadersAction = DeclarativeRuleConverter.getModifyHeadersAction(rule);
            if (modifyHeadersAction === null || modifyHeadersAction === void 0 ? void 0 : modifyHeadersAction.requestHeaders) {
                return {
                    type: RuleActionType.MODIFY_HEADERS,
                    requestHeaders: modifyHeadersAction.requestHeaders,
                };
            }
            if (modifyHeadersAction === null || modifyHeadersAction === void 0 ? void 0 : modifyHeadersAction.responseHeaders) {
                return {
                    type: RuleActionType.MODIFY_HEADERS,
                    responseHeaders: modifyHeadersAction.responseHeaders,
                };
            }
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Csp)) {
            var headersAction = DeclarativeRuleConverter.getAddingCspHeadersAction(rule);
            if (headersAction) {
                return {
                    type: RuleActionType.MODIFY_HEADERS,
                    responseHeaders: [headersAction],
                };
            }
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Permissions)) {
            var headersAction = DeclarativeRuleConverter.getAddingPermissionsHeadersAction(rule);
            if (headersAction) {
                return {
                    type: RuleActionType.MODIFY_HEADERS,
                    responseHeaders: [headersAction],
                };
            }
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Cookie)) {
            var removeCookieHeaders = DeclarativeRuleConverter.getRemovingCookieHeadersAction(rule);
            if (removeCookieHeaders) {
                var responseHeaders = removeCookieHeaders.responseHeaders, requestHeaders = removeCookieHeaders.requestHeaders;
                return {
                    type: RuleActionType.MODIFY_HEADERS,
                    responseHeaders: responseHeaders,
                    requestHeaders: requestHeaders,
                };
            }
        }
        return { type: RuleActionType.BLOCK };
    };
    /**
     * Rule condition.
     *
     * @param rule Network rule.
     *
     * @returns A rule condition that describes to which request the declarative
     * rule should be applied.
     */
    DeclarativeRuleConverter.getCondition = function (rule) {
        var _a;
        var condition = {};
        var pattern = rule.getPattern();
        if (pattern) {
            // set regexFilter
            if (rule.isRegexRule()) {
                var regexFilter = DeclarativeRuleConverter.removeSlashes(pattern);
                condition.regexFilter = DeclarativeRuleConverter.prepareASCII(regexFilter);
            }
            else {
                // A pattern beginning with ||* is not allowed. Use * instead.
                var patternWithoutVerticals = pattern.startsWith('||*')
                    ? pattern.substring(2)
                    : pattern;
                condition.urlFilter = DeclarativeRuleConverter.prepareASCII(patternWithoutVerticals);
            }
        }
        // set domainType
        if (rule.isOptionEnabled(NetworkRuleOption.ThirdParty)) {
            condition.domainType = DomainType.ThirdParty;
        }
        else if (rule.isOptionDisabled(NetworkRuleOption.ThirdParty)) {
            condition.domainType = DomainType.FirstParty;
        }
        // set initiatorDomains
        var permittedDomains = (_a = rule.getPermittedDomains()) === null || _a === void 0 ? void 0 : _a.filter(function (d) {
            // Wildcard and regex domains are not supported by declarative converter
            return !d.includes(SimpleRegex.MASK_ANY_CHARACTER) && !SimpleRegex.isRegexPattern(d);
        });
        if (permittedDomains && permittedDomains.length > 0) {
            condition.initiatorDomains = this.toASCII(permittedDomains);
        }
        // set excludedInitiatorDomains
        var excludedDomains = rule.getRestrictedDomains();
        if (excludedDomains && excludedDomains.length > 0) {
            condition.excludedInitiatorDomains = this.toASCII(excludedDomains);
        }
        var permittedToDomains = rule.getPermittedToDomains();
        if (permittedToDomains && permittedToDomains.length > 0) {
            condition.requestDomains = this.toASCII(permittedToDomains);
        }
        // Can be specified $to or $denyallow, but not together.
        var denyAllowDomains = rule.getDenyAllowDomains();
        var restrictedToDomains = rule.getRestrictedToDomains();
        if (denyAllowDomains && denyAllowDomains.length !== 0) {
            condition.excludedRequestDomains = this.toASCII(denyAllowDomains);
        }
        else if (restrictedToDomains && restrictedToDomains.length !== 0) {
            condition.excludedRequestDomains = this.toASCII(restrictedToDomains);
        }
        // set excludedResourceTypes
        var restrictedRequestTypes = rule.getRestrictedRequestTypes();
        var hasExcludedResourceTypes = restrictedRequestTypes !== 0;
        if (hasExcludedResourceTypes) {
            condition.excludedResourceTypes = this.getResourceTypes(restrictedRequestTypes);
            /**
             * By default, we do not block the requests that
             * are loaded in the browser tab ("main_frame").
             */
            if (!condition.excludedResourceTypes.includes(ResourceType.MainFrame)) {
                condition.excludedResourceTypes.push(ResourceType.MainFrame);
            }
        }
        // set resourceTypes
        var permittedRequestTypes = rule.getPermittedRequestTypes();
        if (!hasExcludedResourceTypes && permittedRequestTypes !== 0) {
            condition.resourceTypes = this.getResourceTypes(permittedRequestTypes);
        }
        var permittedMethods = rule.getPermittedMethods();
        if (permittedMethods && permittedMethods.length !== 0) {
            condition.requestMethods = this.mapHttpMethodToDeclarativeHttpMethod(permittedMethods);
        }
        var restrictedMethods = rule.getRestrictedMethods();
        if (restrictedMethods && restrictedMethods.length !== 0) {
            condition.excludedRequestMethods = this.mapHttpMethodToDeclarativeHttpMethod(restrictedMethods);
        }
        // By default, this option is false, so there is no need to specify it everywhere.
        // We do it only if it is true.
        if (rule.isOptionEnabled(NetworkRuleOption.MatchCase)) {
            condition.isUrlFilterCaseSensitive = rule.isOptionEnabled(NetworkRuleOption.MatchCase);
        }
        /**
         * Adds the main_frame resource type to the resourceTypes if the popup modifier is enabled.
         * Popup rules apply only to document requests, so adding main_frame ensures the rules are correctly applied.
         */
        if (rule.isOptionEnabled(NetworkRuleOption.Popup)) {
            condition.resourceTypes = condition.resourceTypes || [];
            if (!condition.resourceTypes.includes(ResourceType.MainFrame)) {
                condition.resourceTypes.push(ResourceType.MainFrame);
            }
        }
        var emptyResourceTypes = !condition.resourceTypes && !condition.excludedResourceTypes;
        if (emptyResourceTypes) {
            /**
             * Here we need to set 'main_frame' to apply to document requests
             * as well (because by default it applies to all requests except
             * document).
             * And if we specify 'main_frame', then we also need to specify all
             * other types, so that it works not only for document requests, but
             * also for all other types of requests.
             */
            var shouldMatchAllResourcesTypes = rule.isOptionEnabled(NetworkRuleOption.RemoveHeader)
                || rule.isOptionEnabled(NetworkRuleOption.Csp)
                || rule.isOptionEnabled(NetworkRuleOption.Cookie)
                || rule.isOptionEnabled(NetworkRuleOption.To)
                || rule.isOptionEnabled(NetworkRuleOption.Method);
            /**
             * $permissions and $removeparam modifiers must be applied only
             * to `document` content-type ('main_frame' and 'sub_frame')
             * if they don't have resource types.
             */
            var shouldMatchOnlyDocument = rule.isOptionEnabled(NetworkRuleOption.RemoveParam)
                || rule.isOptionEnabled(NetworkRuleOption.Permissions);
            if (shouldMatchAllResourcesTypes) {
                condition.resourceTypes = [
                    ResourceType.MainFrame,
                    ResourceType.SubFrame,
                    ResourceType.Stylesheet,
                    ResourceType.Script,
                    ResourceType.Image,
                    ResourceType.Font,
                    ResourceType.Object,
                    ResourceType.XmlHttpRequest,
                    ResourceType.Ping,
                    ResourceType.Media,
                    ResourceType.WebSocket,
                    ResourceType.Other,
                ];
            }
            else if (shouldMatchOnlyDocument) {
                condition.resourceTypes = [ResourceType.MainFrame, ResourceType.SubFrame];
            }
        }
        return condition;
    };
    /**
     * Converts the network rule into an array of declarative rules.
     *
     * Method to use only in class heirs.
     *
     * @protected
     *
     * @param rule Network rule.
     * @param id Rule identifier.
     *
     * @throws An {@link UnsupportedModifierError} if the network rule
     * contains an unsupported modifier
     * OR an {@link EmptyResourcesError} if there is empty resources in the rule
     * OR an {@link UnsupportedRegexpError} if regexp is not supported in
     * the RE2 syntax.
     * OR a {@link ResourcesPathError} when specified an empty
     * path to the web accessible resources.
     *
     * @returns A list of declarative rules.
     */
    DeclarativeRuleConverter.prototype.convertRule = function (rule, id) {
        return __awaiter(this, void 0, void 0, function () {
            var shouldConvert, declarativeRule, priority, conversionErr;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        shouldConvert = NetworkRuleDeclarativeValidator.shouldConvertNetworkRule(rule);
                        // The rule does not require conversion.
                        if (!shouldConvert) {
                            return [2 /*return*/, []];
                        }
                        declarativeRule = {
                            id: id,
                            action: this.getAction(rule),
                            condition: DeclarativeRuleConverter.getCondition(rule),
                        };
                        priority = DeclarativeRuleConverter.getPriority(rule);
                        if (priority) {
                            declarativeRule.priority = priority;
                        }
                        return [4 /*yield*/, DeclarativeRuleConverter.checkDeclarativeRuleApplicable(rule, declarativeRule)];
                    case 1:
                        conversionErr = _a.sent();
                        if (conversionErr) {
                            throw conversionErr;
                        }
                        return [2 /*return*/, [declarativeRule]];
                }
            });
        });
    };
    /**
     * Verifies whether the converted declarative rule passes the regular expression (regexp) validation.
     *
     * Additionally, it checks whether the rule contains resource types.
     *
     * Note: some complex regexps are not allowed,
     * e.g. back references, possessive quantifiers, negative lookaheads.
     *
     * @see {@link https://github.com/google/re2/wiki/Syntax}.
     *
     * @param networkRule The original network rule.
     * @param declarativeRule The converted declarative rule.
     *
     * @returns Different errors:
     * - {@link EmptyResourcesError} if the rule has empty resources,
     * - {@link UnsupportedRegexpError} if the regexp is not supported
     * by RE2 syntax (@see {@link https://github.com/google/re2/wiki/Syntax}),
     * - {@link EmptyDomainsError} if the declarative rule has empty domains
     * while the original rule has non-empty domains,
     * - {@link NonAsciiUrlFilterError} if condition `urlFilter` contains non-ASCII characters,
     * or null if no errors are found.
     */
    DeclarativeRuleConverter.checkDeclarativeRuleApplicable = function (networkRule, declarativeRule) {
        return __awaiter(this, void 0, void 0, function () {
            var _a, regexFilter, resourceTypes, permittedDomains, initiatorDomains, ruleText, msg, e_1, ruleText, msg;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        _a = declarativeRule.condition, regexFilter = _a.regexFilter, resourceTypes = _a.resourceTypes;
                        if ((resourceTypes === null || resourceTypes === void 0 ? void 0 : resourceTypes.length) === 0) {
                            return [2 /*return*/, new EmptyResourcesError('Conversion resourceTypes is empty', networkRule, declarativeRule)];
                        }
                        permittedDomains = networkRule.getPermittedDomains();
                        if (permittedDomains && permittedDomains.length > 0) {
                            initiatorDomains = declarativeRule.condition.initiatorDomains;
                            if (!initiatorDomains || initiatorDomains.length === 0) {
                                ruleText = networkRule.getText();
                                msg = "Conversion initiatorDomains is empty, but original rule's domains not: \"".concat(ruleText, "\"");
                                return [2 /*return*/, new EmptyDomainsError(msg, networkRule, declarativeRule)];
                            }
                        }
                        if (!regexFilter) return [3 /*break*/, 4];
                        _b.label = 1;
                    case 1:
                        _b.trys.push([1, 3, , 4]);
                        return [4 /*yield*/, re2Validator.isRegexSupported(regexFilter)];
                    case 2:
                        _b.sent();
                        return [3 /*break*/, 4];
                    case 3:
                        e_1 = _b.sent();
                        ruleText = networkRule.getText();
                        msg = "Regex is unsupported: \"".concat(ruleText, "\"");
                        return [2 /*return*/, new UnsupportedRegexpError(msg, networkRule, declarativeRule, getErrorMessage(e_1))];
                    case 4: return [2 /*return*/, null];
                }
            });
        });
    };
    /**
     * Checks the captured conversion error, if it is one of the expected
     * conversion errors - returns it, otherwise adds information about
     * the original rule, packages it into a new error and returns it.
     *
     * @param rule An error was caught while converting this rule.
     * @param index Index of {@link IndexedNetworkRuleWithHash}.
     * @param id Identifier of the desired declarative rule.
     * @param e Captured error.
     *
     * @returns Initial error or new packaged error.
     */
    DeclarativeRuleConverter.catchErrorDuringConversion = function (rule, index, id, e) {
        if (e instanceof EmptyResourcesError
            || e instanceof UnsupportedModifierError
            || e instanceof UnsupportedRegexpError
            || e instanceof EmptyDomainsError) {
            return e;
        }
        var msg = "Non-categorized error during a conversion rule (index - ".concat(index, ", id - ").concat(id, ")");
        return e instanceof Error
            ? new Error(msg, { cause: e })
            : new Error(msg);
    };
    /**
     * Converts the provided set of indexed rules into declarative rules,
     * collecting source rule identifiers for declarative rules
     * and catching conversion errors.
     *
     * @param filterId An identifier for the filter.
     * @param rules Indexed rules.
     * @param offsetId Offset for the IDs of the converted rules. Used in cases
     * of converting several filters into one ruleset to exclude the possibility
     * of duplicate IDs.
     *
     * @returns Transformed declarative rules with their sources
     * and caught conversion errors.
     */
    DeclarativeRuleConverter.prototype.convertRules = function (filterId, rules, offsetId) {
        return __awaiter(this, void 0, void 0, function () {
            var res;
            var _this = this;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        res = {
                            declarativeRules: [],
                            errors: [],
                            sourceMapValues: [],
                        };
                        return [4 /*yield*/, Promise.all(rules.map(function (_a) {
                                var rule = _a.rule, index = _a.index;
                                return __awaiter(_this, void 0, void 0, function () {
                                    var id, converted, e_2, err;
                                    return __generator(this, function (_b) {
                                        switch (_b.label) {
                                            case 0:
                                                id = offsetId + index;
                                                converted = [];
                                                _b.label = 1;
                                            case 1:
                                                _b.trys.push([1, 3, , 4]);
                                                return [4 /*yield*/, this.convertRule(rule, id)];
                                            case 2:
                                                converted = _b.sent();
                                                return [3 /*break*/, 4];
                                            case 3:
                                                e_2 = _b.sent();
                                                err = DeclarativeRuleConverter.catchErrorDuringConversion(rule, index, id, e_2);
                                                res.errors.push(err);
                                                return [2 /*return*/];
                                            case 4:
                                                // For each converted declarative rule save it's source.
                                                converted.forEach(function (dRule) {
                                                    res.sourceMapValues.push({
                                                        declarativeRuleId: dRule.id,
                                                        sourceRuleIndex: index,
                                                        filterId: filterId,
                                                    });
                                                    res.declarativeRules.push(dRule);
                                                });
                                                return [2 /*return*/];
                                        }
                                    });
                                });
                            }))];
                    case 1:
                        _a.sent();
                        return [2 /*return*/, res];
                }
            });
        });
    };
    /**
     * This function groups similar rules among those already converted into
     * declarative rules. If a similar rule is found, it combines the two
     * declarative rules into one.
     *
     * @param converted An instance of {@link ConvertedRules} that includes
     * converted declarative rules, recorded errors, and a hash mapping
     * declarative rule IDs to corresponding source test rule IDs.
     * @param createRuleTemplate A function that stores the template of
     * a declarative rule. This template is used to compare different
     * declarative rules.
     * @param combineRulePair A function that attempts to find a similar
     * declarative rule by comparing rule templates. If a match is found,
     * it merges the two declarative rules into one and returns combined rule.
     *
     * @returns Object with grouped similar declarative rules.
     */
    // eslint-disable-next-line class-methods-use-this
    DeclarativeRuleConverter.prototype.groupConvertedRules = function (converted, createRuleTemplate, combineRulePair) {
        var rulesTemplates = new Map();
        var saveRuleTemplate = function (rule) {
            var template = createRuleTemplate(rule);
            rulesTemplates.set(template, rule);
        };
        var result = {
            declarativeRules: [],
            sourceMapValues: [],
            errors: converted.errors,
        };
        var sourceMapValues = converted.sourceMapValues, declarativeRules = converted.declarativeRules;
        declarativeRules.forEach(function (dRule) {
            // Trying to find a declarative rule for siblings.
            var template = createRuleTemplate(dRule);
            var siblingDeclarativeRule = rulesTemplates.get(template);
            // Finds the source rule identifier.
            var source = sourceMapValues.find(function (s) { return s.declarativeRuleId === dRule.id; });
            if (source === undefined) {
                result.errors.push(new Error("Cannot find source for converted rule \"".concat(dRule, "\"")));
                return;
            }
            // If a similar rule is found, the function combines the two
            // declarative rules into one and returns the resulting combined rule.
            if (siblingDeclarativeRule) {
                var combinedRule = combineRulePair(siblingDeclarativeRule, dRule);
                // Updates template.
                saveRuleTemplate(combinedRule);
                // Updates the declarative rule identified for the merged rule.
                result.sourceMapValues.push(__assign(__assign({}, source), { declarativeRuleId: combinedRule.id }));
            }
            else {
                // If not found - saves the template part of the declarative
                // rule to compare it with next values.
                saveRuleTemplate(dRule);
                // Keeps the source unchanged because the current rule
                // has not been merged.
                result.sourceMapValues.push(source);
            }
        });
        result.declarativeRules = Array.from(rulesTemplates.values());
        return result;
    };
    return DeclarativeRuleConverter;
}());

/**
 * Describes how to convert all rules that are not grouped
 * for separate conversion.
 *
 * @see {@link RulesGroup}
 */
var RegularRulesConverter = /** @class */ (function (_super) {
    __extends(RegularRulesConverter, _super);
    function RegularRulesConverter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * Converts ungrouped, basic indexed rules into declarative rules.
     *
     * @param filterId Filter id.
     * @param rules List of indexed network rules with hash.
     * @param offsetId Offset for the IDs of the converted rules.
     *
     * @returns Converted rules.
     */
    RegularRulesConverter.prototype.convert = function (filterId, rules, offsetId) {
        return this.convertRules(filterId, rules, offsetId);
    };
    return RegularRulesConverter;
}(DeclarativeRuleConverter));

/**
 * Describes how to convert $removeparam rules.
 */
var RemoveParamRulesConverter = /** @class */ (function (_super) {
    __extends(RemoveParamRulesConverter, _super);
    function RemoveParamRulesConverter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * Converts indexed rules grouped by $removeparam into declarative rules:
     * for each rule looks for similar rules and groups them into a new rule.
     *
     * @param filterId Filter id.
     * @param rules List of indexed network rules with hash.
     * @param offsetId Offset for the IDs of the converted rules.
     *
     * @returns Converted rules.
     */
    RemoveParamRulesConverter.prototype.convert = function (filterId, rules, offsetId) {
        return __awaiter(this, void 0, void 0, function () {
            var createRuleTemplate, combineRulePair, converted, result;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        createRuleTemplate = function (rule) {
                            var _a, _b, _c, _d;
                            // Deep copy without relation to source rule
                            // Note: Partial type is used because we need to delete some fields,
                            // but we cannot mark them as optional in the parent type.
                            var template = JSON.parse(JSON.stringify(rule));
                            delete template.id;
                            (_d = (_c = (_b = (_a = template.action) === null || _a === void 0 ? void 0 : _a.redirect) === null || _b === void 0 ? void 0 : _b.transform) === null || _c === void 0 ? void 0 : _c.queryTransform) === null || _d === void 0 ? true : delete _d.removeParams;
                            return JSON.stringify(template);
                        };
                        combineRulePair = function (sourceRule, ruleToMerge) {
                            var _a, _b, _c, _d, _e, _f, _g;
                            var resultRule = JSON.parse(JSON.stringify(sourceRule));
                            var params = ((_c = (_b = (_a = ruleToMerge.action.redirect) === null || _a === void 0 ? void 0 : _a.transform) === null || _b === void 0 ? void 0 : _b.queryTransform) === null || _c === void 0 ? void 0 : _c.removeParams) || [];
                            (_g = (_f = (_e = (_d = resultRule.action.redirect) === null || _d === void 0 ? void 0 : _d.transform) === null || _e === void 0 ? void 0 : _e.queryTransform) === null || _f === void 0 ? void 0 : _f.removeParams) === null || _g === void 0 ? void 0 : _g.push.apply(_g, params);
                            return resultRule;
                        };
                        return [4 /*yield*/, this.convertRules(filterId, rules, offsetId)];
                    case 1:
                        converted = _a.sent();
                        result = this.groupConvertedRules(converted, createRuleTemplate, combineRulePair);
                        return [2 /*return*/, result];
                }
            });
        });
    };
    return RemoveParamRulesConverter;
}(DeclarativeRuleConverter));

/**
 * Describes how to convert $removeheader rules.
 *
 * TODO: Add checks for rules containing the $removeheader and
 * incompatible modifiers: '$domain', '$third-party', '$important', '$app',
 * '$match-case', '$script', '$stylesheet, etc.
 *
 */
var RemoveHeaderRulesConverter = /** @class */ (function (_super) {
    __extends(RemoveHeaderRulesConverter, _super);
    function RemoveHeaderRulesConverter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * Converts indexed rules grouped by $removeheader into declarative rules:
     * for each rule looks for similar rules and groups them into a new rule.
     *
     * @param filterId Filter id.
     * @param rules List of indexed network rules with hash.
     * @param offsetId Offset for the IDs of the converted rules.
     *
     * @returns Converted rules.
     */
    RemoveHeaderRulesConverter.prototype.convert = function (filterId, rules, offsetId) {
        return __awaiter(this, void 0, void 0, function () {
            var createRuleTemplate, combineRulePair, converted, result;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        createRuleTemplate = function (rule) {
                            // Deep copy without relation to source rule
                            var template = JSON.parse(JSON.stringify(rule));
                            delete template.id;
                            delete template.action.requestHeaders;
                            delete template.action.responseHeaders;
                            return JSON.stringify(template);
                        };
                        combineRulePair = function (sourceRule, ruleToMerge) {
                            var _a, _b;
                            var resultRule = JSON.parse(JSON.stringify(sourceRule));
                            var _c = ruleToMerge.action, responseHeaders = _c.responseHeaders, requestHeaders = _c.requestHeaders;
                            if (responseHeaders) {
                                if (resultRule.action.responseHeaders) {
                                    (_a = resultRule.action.responseHeaders).push.apply(_a, responseHeaders);
                                }
                                else {
                                    resultRule.action.responseHeaders = responseHeaders;
                                }
                            }
                            if (requestHeaders) {
                                if (resultRule.action.requestHeaders) {
                                    (_b = resultRule.action.requestHeaders).push.apply(_b, requestHeaders);
                                }
                                else {
                                    resultRule.action.requestHeaders = requestHeaders;
                                }
                            }
                            return resultRule;
                        };
                        return [4 /*yield*/, this.convertRules(filterId, rules, offsetId)];
                    case 1:
                        converted = _a.sent();
                        result = this.groupConvertedRules(converted, createRuleTemplate, combineRulePair);
                        return [2 /*return*/, result];
                }
            });
        });
    };
    return RemoveHeaderRulesConverter;
}(DeclarativeRuleConverter));

/**
 * Describes how to convert $csp rules.
 */
var CspRulesConverter = /** @class */ (function (_super) {
    __extends(CspRulesConverter, _super);
    function CspRulesConverter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * Converts indexed rules grouped by $csp into declarative rules:
     * for each rule looks for similar rules and groups them into a new rule.
     *
     * @param filterId Filter id.
     * @param rules List of indexed rules.
     * @param offsetId Offset for the IDs of the converted rules.
     *
     * @returns Converted rules.
     */
    CspRulesConverter.prototype.convert = function (filterId, rules, offsetId) {
        return __awaiter(this, void 0, void 0, function () {
            var createRuleTemplate, combineRulePair, converted, result;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        createRuleTemplate = function (rule) {
                            // Deep copy without relation to source rule
                            var template = JSON.parse(JSON.stringify(rule));
                            delete template.id;
                            // Converted $csp rules contain only one response headers action.
                            delete template.action.responseHeaders[0].value;
                            return JSON.stringify(template);
                        };
                        combineRulePair = function (sourceRule, ruleToMerge) {
                            var resultRule = JSON.parse(JSON.stringify(sourceRule));
                            // If the headers are empty in the rule to merge, do not take any action.
                            if (!ruleToMerge.action.responseHeaders || ruleToMerge.action.responseHeaders.length === 0) {
                                return resultRule;
                            }
                            // Try to find CSP header in the rule to merge - if not found, do not take any action.
                            var cspHeaderToMerge = ruleToMerge.action.responseHeaders
                                .find(function (h) { return h.header === CSP_HEADER_NAME; });
                            if (!cspHeaderToMerge) {
                                return resultRule;
                            }
                            // Combine the CSP header from the rule to merge with a copy of the source rule.
                            if (resultRule.action.responseHeaders && resultRule.action.responseHeaders.length > 0) {
                                var idx = resultRule.action.responseHeaders
                                    .findIndex(function (h) { return h.header === CSP_HEADER_NAME; });
                                if (idx === -1) {
                                    return resultRule;
                                }
                                var cspHeaderValue = resultRule.action.responseHeaders[idx].value;
                                if (cspHeaderValue) {
                                    resultRule.action.responseHeaders[idx].value = "".concat(cspHeaderValue, "; ").concat(cspHeaderToMerge.value);
                                }
                                else {
                                    resultRule.action.responseHeaders[idx].value = cspHeaderToMerge.value;
                                }
                            }
                            else {
                                resultRule.action.responseHeaders = [cspHeaderToMerge];
                            }
                            return resultRule;
                        };
                        return [4 /*yield*/, this.convertRules(filterId, rules, offsetId)];
                    case 1:
                        converted = _a.sent();
                        result = this.groupConvertedRules(converted, createRuleTemplate, combineRulePair);
                        return [2 /*return*/, result];
                }
            });
        });
    };
    return CspRulesConverter;
}(DeclarativeRuleConverter));

/**
 * Describes an error when the maximum number of rules is reached and
 * some rules are skipped from scanning.
 */
var MaxScannedRulesError = /** @class */ (function (_super) {
    __extends(MaxScannedRulesError, _super);
    /**
     * Describes an error when the maximum number of rules is reached and some
     * rules are skipped from scanning.
     *
     * @param message Message of error.
     * @param lineIndex Line index of the filter from which the rules
     * are skipped.
     */
    function MaxScannedRulesError(message, lineIndex) {
        var _this = _super.call(this, message) || this;
        _this.name = 'MaxScannedRulesError';
        _this.lineIndex = lineIndex;
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, MaxScannedRulesError.prototype);
        return _this;
    }
    return MaxScannedRulesError;
}(Error));

/**
 * Describes an error when the maximum number of regexp rules is reached.
 */
var TooManyRegexpRulesError = /** @class */ (function (_super) {
    __extends(TooManyRegexpRulesError, _super);
    /**
     * Describes an error when the maximum number of regexp rules is reached.
     *
     * @param message Message of error.
     * @param excludedRulesIds List of excluded source (important!)
     * {@link Source} rules ids.
     * @param numberOfMaximumRules Number of maximum rules.
     * @param numberOfExcludedDeclarativeRules Number of excluded declarative
     * rules.
     */
    function TooManyRegexpRulesError(message, excludedRulesIds, numberOfMaximumRules, numberOfExcludedDeclarativeRules) {
        var _this = _super.call(this, message) || this;
        _this.name = 'TooManyRegexpRulesError';
        _this.excludedRulesIds = excludedRulesIds;
        _this.numberOfMaximumRules = numberOfMaximumRules;
        _this.numberOfExcludedDeclarativeRules = numberOfExcludedDeclarativeRules;
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, TooManyRegexpRulesError.prototype);
        return _this;
    }
    return TooManyRegexpRulesError;
}(Error));

/**
 * Describes an error when the maximum number of rules is reached.
 */
var TooManyRulesError = /** @class */ (function (_super) {
    __extends(TooManyRulesError, _super);
    /**
     * Describes an error when the maximum number of rules is reached.
     *
     * @param message Message of error.
     * @param excludedRulesIds List of excluded source (important!)
     * {@link Source} rules ids.
     * @param numberOfMaximumRules Number of maximum rules.
     * @param numberOfExcludedDeclarativeRules Number of excluded declarative
     * rules.
     */
    function TooManyRulesError(message, excludedRulesIds, numberOfMaximumRules, numberOfExcludedDeclarativeRules) {
        var _this = _super.call(this, message) || this;
        _this.name = 'TooManyRulesError';
        _this.excludedRulesIds = excludedRulesIds;
        _this.numberOfMaximumRules = numberOfMaximumRules;
        _this.numberOfExcludedDeclarativeRules = numberOfExcludedDeclarativeRules;
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, TooManyRulesError.prototype);
        return _this;
    }
    return TooManyRulesError;
}(Error));

/**
 * Just a dummy for $badfilter-rules, because they don't need to be converted.
 */
var BadFilterRulesConverter = /** @class */ (function (_super) {
    __extends(BadFilterRulesConverter, _super);
    function BadFilterRulesConverter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * Skips converting bad rules.
     *
     * @param filterId Filter id.
     * @param rules List of indexed rules.
     * @param offsetId Offset for the IDs of the converted rules.
     *
     * @returns Empty converted rules.
     */
    // eslint-disable-next-line class-methods-use-this
    BadFilterRulesConverter.prototype.convert = function (
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    filterId, 
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    rules, 
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    offsetId) {
        return Promise.resolve({
            sourceMapValues: [],
            declarativeRules: [],
            errors: [],
        });
    };
    return BadFilterRulesConverter;
}(DeclarativeRuleConverter));

var RulesGroup;
(function (RulesGroup) {
    RulesGroup[RulesGroup["Regular"] = 0] = "Regular";
    RulesGroup[RulesGroup["RemoveParam"] = 1] = "RemoveParam";
    RulesGroup[RulesGroup["RemoveHeader"] = 2] = "RemoveHeader";
    RulesGroup[RulesGroup["Csp"] = 3] = "Csp";
    RulesGroup[RulesGroup["BadFilter"] = 4] = "BadFilter";
})(RulesGroup || (RulesGroup = {}));
/**
 * Contains logic on how to divide the rules into certain groups.
 *
 * @see {@link RulesGroup}
 */
var DeclarativeRulesGrouper = /** @class */ (function () {
    function DeclarativeRulesGrouper() {
    }
    /**
     * Returns group of the indexed rule.
     *
     * @param indexedNetworkRuleWithHash Indexed network rule with hash.
     *
     * @returns Group of the indexed rule.
     */
    DeclarativeRulesGrouper.getRuleGroup = function (indexedNetworkRuleWithHash) {
        var rule = indexedNetworkRuleWithHash.rule;
        if (rule.isOptionEnabled(NetworkRuleOption.RemoveParam)) {
            return RulesGroup.RemoveParam;
        }
        if (rule.isOptionEnabled(NetworkRuleOption.RemoveHeader)) {
            return RulesGroup.RemoveHeader;
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Csp)) {
            return RulesGroup.Csp;
        }
        if (rule.isOptionEnabled(NetworkRuleOption.Badfilter)) {
            return RulesGroup.BadFilter;
        }
        return RulesGroup.Regular;
    };
    /**
     * Splits the list of indexed rules into an index with groups.
     *
     * @param rules List of indexed rules.
     *
     * @returns Index with grouped, indexed rules.
     */
    DeclarativeRulesGrouper.splitRulesByGroups = function (rules) {
        var _a;
        var rulesToProcess = (_a = {},
            _a[RulesGroup.RemoveParam] = [],
            _a[RulesGroup.RemoveHeader] = [],
            _a[RulesGroup.BadFilter] = [],
            _a[RulesGroup.Regular] = [],
            _a[RulesGroup.Csp] = [],
            _a);
        // Categorizing rule groups
        rules.forEach(function (indexedNetworkRuleWithHash) {
            var group = DeclarativeRulesGrouper.getRuleGroup(indexedNetworkRuleWithHash);
            rulesToProcess[group].push(indexedNetworkRuleWithHash);
        });
        return rulesToProcess;
    };
    return DeclarativeRulesGrouper;
}());

/* eslint-disable jsdoc/require-description-complete-sentence  */
/**
 * @file Describes the conversion process from {@link IndexedNetworkRuleWithHash}
 * to declarative rules {@link DeclarativeRule} via applying $badfilter-rules
 * {@link DeclarativeRulesConverter#applyBadFilter} and checks for specified
 * limitations {@link DeclarativeRulesConverter#checkLimitations}.
 *
 *                                                                           Conversion
 *
 *
 *
 *
 *       Two entry points        │                FilterConverter             │             RulesConverter
 *                               │                                            │
 *                               │       Perform the conversion at the        │      Perform the conversion at the
 *                               │       filter level.                        │      rules level.
 *                               │                                            │
 *  Converting static rules      │       Validate passed number of rules      │
 *  during extension assembly.   │       and path to web accessible resources.│
 * ┌─────────────────────────┐   │      ┌────────────────────────────────┐    │
 * │                         ├─┬─┼─────►│                                │    │
 * │  convertStaticRuleSet() │ │ │      │      checkConverterOptions()   │    │
 * │                         │ │ │  ┌───┤                                │    │
 * └─────────────────────────┘ │ │  │   └────────────────────────────────┘    │
 *                             │ │  │                                         │
 *  On-the-fly conversion      │ │  │    Filter only network rules and create │
 *  for dynamic rules.         │ │  │    indexed rule with hash.              │
 * ┌─────────────────────────┐ │ │  │    In this method, when converting      │
 * │                         │ │ │  │    dynamic rules, the rules canceled by │
 * │ convertDynamicRuleSets()├─┘ │  │    $badfilter rules from static filters │
 * │                         │   │  │    are filtered out - such rules are    │
 * └─────────────────────────┘   │  │    discarded during filter scanning.    │
 *                               │  │   ┌────────────────────────────────┐    │
 *                               │  └──►│                                │    │
 *                               │      │ NetworkRulesScanner.scanRules()│    │
 *                               │  ┌───┤                                │    │
 *                               │  │   └────────────────────────────────┘    │  Filter rules affected by $badfilter
 *                               │  │                                         │  within one filter, then group the rules
 *                               │  │                                         │  based on modifiers, requiring specific
 *                               │  │    Convert our network rule to DNR.     │  conversion processes such as
 *                               │  │   ┌────────────────────────────────┐    │  post-processing for similar rules.
 *                               │  └──►│                                │    │   ┌────────────────────────────────┐
 *                               │      │           convert()            ├────┼───┤                                │
 *                               │      │                                │    │   │        applyBadFilter()        │
 *                               │      └────────────────────────────────┘    │ ┌─┤                                │
 *                               │                                            │ │ └────────────────────────────────┘
 *                               │                                            │ │
 *                               │                                            │ │ Each group of rules within a single
 *                               │                                            │ │ filter has its converter that performs
 *                               │                                            │ │ the conversion, then combines the
 *                               │                                            │ │ results and returns them.
 *                               │                                            │ │
 *                               │                                            │ │ For details, please go to the
 *                               │                                            │ │ abstract-rule-converter.ts schema.
 *                               │                                            │ │ ┌────────────────────────────────┐
 *                               │                                            │ └►│                                │
 *                               │                                            │   │          convertRules()        │
 *                               │                                            │ ┌─┤                                │
 *                               │                                            │ │ └────────────────────────────────┘
 *                               │                                            │ │
 *                               │                                            │ │ The declarative rules are checked to
 *                               │                                            │ │ ensure they meet the specified
 *                               │                                            │ │ constraints, and if necessary,
 *                               │                                            │ │ some rules are removed.
 *                               │                                            │ │ ┌────────────────────────────────┐
 *                               │                                            │ └►│                                │
 *                               │                                            │   │         checkLimitations()     │
 *                               │   ┌────────────────────────────────────────┼───┤                                │
 *                               │   │                                        │   └────────────────────────────────┘
 *                               │   │   Wrap conversion result into RuleSet. │
 *                               │   │  ┌────────────────────────────────┐    │
 *                               │   └─►│                                │    │
 *                               │      │    collectConvertedResult()    │    │
 *                               │  ┌───┤                                │    │
 *                               │  │   └────────────────────────────────┘    │
 *                               │  │                                         │
 *                               │  │    This method is only called during the│
 *                               │  │    conversion of dynamic rules.         │
 *                               │  │    Applies rules with $badfilter        │
 *                               │  │    modifier from dynamic rulesets to    │
 *                               │  │    all rules from static rulesets and   │
 *                               │  │    returns list of ids of declarative   │
 *                               │  │    rules to disable them.               │
 *                               │  │   ┌──────────────────────────────────┐  │
 *                               │  └──►│                                  │  │
 *                               │      │ collectDeclarativeRulesToCancel()│  │
 *                               │      │                                  │  │
 *                               │      └──────────────────────────────────┘  │
 *                               │                                            │
 */
/* eslint-enable jsdoc/require-description-complete-sentence */
var _a;
/**
 * Describes how to convert {@link IndexedNetworkRuleWithHash|indexed network rules}
 * into list of {@link DeclarativeRule|declarative rules}.
 */
var DeclarativeRulesConverter = /** @class */ (function () {
    function DeclarativeRulesConverter() {
    }
    /**
     * Converts list of filters ids with indexed rules to declarative rules:
     * applies $badfilter rules, then for each group of rules (inside one
     * filter) runs specified converter.
     *
     * TODO: The $removeparam, $removeheader, $csp converters can also combine
     * rules across multiple filters.
     *
     * @see {@link DeclarativeRulesConverter.converters}.
     *
     * @param filtersWithRules List of filters ids with indexed rules.
     * @param options Options for conversion.
     *
     * @returns A list of declarative rules, a regexp rule counter,
     * and a list of sourcemap values that contain the relationship between the
     * transformed declarative rule and the source rule.
     */
    DeclarativeRulesConverter.convert = function (filtersWithRules, options) {
        return __awaiter(this, void 0, void 0, function () {
            var filters, converted, _i, filters_1, _a, filterId, groupedRules, highestUsedId, _b, sourceMapValues, declarativeRules, errors;
            return __generator(this, function (_c) {
                switch (_c.label) {
                    case 0:
                        filters = this.applyBadFilter(filtersWithRules);
                        converted = {
                            sourceMapValues: [],
                            declarativeRules: [],
                            errors: [],
                        };
                        _i = 0, filters_1 = filters;
                        _c.label = 1;
                    case 1:
                        if (!(_i < filters_1.length)) return [3 /*break*/, 4];
                        _a = filters_1[_i], filterId = _a[0], groupedRules = _a[1];
                        highestUsedId = converted.declarativeRules.reduce(function (currentMax, rule) {
                            return Math.max(currentMax, rule.id);
                        }, DeclarativeRulesConverter.START_DECLARATIVE_RULE_ID);
                        return [4 /*yield*/, this.convertRules(filterId, groupedRules, highestUsedId, options)];
                    case 2:
                        _b = _c.sent(), sourceMapValues = _b.sourceMapValues, declarativeRules = _b.declarativeRules, errors = _b.errors;
                        converted.sourceMapValues = converted.sourceMapValues.concat(sourceMapValues);
                        converted.declarativeRules = converted.declarativeRules.concat(declarativeRules);
                        converted.errors = converted.errors.concat(errors);
                        _c.label = 3;
                    case 3:
                        _i++;
                        return [3 /*break*/, 1];
                    case 4:
                        converted = this.checkLimitations(converted, options === null || options === void 0 ? void 0 : options.maxNumberOfRules, options === null || options === void 0 ? void 0 : options.maxNumberOfRegexpRules);
                        if (!this.checkRulesHaveUniqueIds(converted.declarativeRules)) {
                            throw new Error('Declarative rules have non-unique identifiers.');
                        }
                        return [2 /*return*/, converted];
                }
            });
        });
    };
    /**
     * Converts filter's indexed rules into declarative rules.
     *
     * @param filterId Filed id.
     * @param groupsRules Grouped rules.
     * @param lastUsedId To avoid intersections between the identifiers of
     * the converted rules, we start converting new group rules with an offset.
     * @param options Options for conversion.
     *
     * @returns A list of declarative rules, a regexp rule counter,
     * and a list of sourcemap values that contain the relationship between the
     * transformed declarative rule and the source rule.
     */
    DeclarativeRulesConverter.convertRules = function (filterId, groupsRules, lastUsedId, options) {
        return __awaiter(this, void 0, void 0, function () {
            var converted, groups;
            var _this = this;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        converted = {
                            sourceMapValues: [],
                            declarativeRules: [],
                            errors: [],
                        };
                        groups = Object.keys(groupsRules).map(Number);
                        return [4 /*yield*/, Promise.all(groups.map(function (key) { return __awaiter(_this, void 0, void 0, function () {
                                var converter, _a, sourceMapValues, declarativeRules, errors;
                                return __generator(this, function (_b) {
                                    switch (_b.label) {
                                        case 0:
                                            converter = new DeclarativeRulesConverter.converters[key](options === null || options === void 0 ? void 0 : options.resourcesPath);
                                            return [4 /*yield*/, converter.convert(filterId, groupsRules[key], lastUsedId)];
                                        case 1:
                                            _a = _b.sent(), sourceMapValues = _a.sourceMapValues, declarativeRules = _a.declarativeRules, errors = _a.errors;
                                            converted.sourceMapValues = converted.sourceMapValues.concat(sourceMapValues);
                                            converted.declarativeRules = converted.declarativeRules.concat(declarativeRules);
                                            converted.errors = converted.errors.concat(errors);
                                            return [2 /*return*/];
                                    }
                                });
                            }); }))];
                    case 1:
                        _a.sent();
                        return [2 /*return*/, converted];
                }
            });
        });
    };
    /**
     * Checks that declarative rules have unique identifiers.
     *
     * @param rules List of declarative rules.
     *
     * @returns True if all rules have unique identifiers, otherwise false.
     */
    DeclarativeRulesConverter.checkRulesHaveUniqueIds = function (rules) {
        var ids = rules.map(function (_a) {
            var id = _a.id;
            return id;
        });
        var uniqueIds = new Set(ids);
        return uniqueIds.size === rules.length;
    };
    /**
     * Check that declarative rules matches the specified constraints and
     * cuts rules if needed as from list also from source map.
     *
     * @param converted Converted rules, errors, sourcemap and counters.
     * @param maxNumberOfRules Maximum number of converted rules.
     * @param maxNumberOfRegexpRules Maximum number of converted regexp rules.
     *
     * @returns Transformed converted rules with modified (if abbreviated)
     * counters, declarative rules list, source map and errors.
     */
    DeclarativeRulesConverter.checkLimitations = function (converted, maxNumberOfRules, maxNumberOfRegexpRules) {
        var limitations = [];
        // We apply restrictions only to transformed rules, so we need to filter
        // rule conversion errors if we remove the transformed rule associated
        // with those errors
        var declarativeRules = converted.declarativeRules, sourceMapValues = converted.sourceMapValues, errors = converted.errors;
        var convertedRulesErrors = [];
        var otherErrors = [];
        for (var i = 0; i < errors.length; i += 1) {
            var e = errors[i];
            // Checks only errors of converted declarative rules
            if (e instanceof InvalidDeclarativeRuleError) {
                convertedRulesErrors.push(e);
            }
            else {
                otherErrors.push(e);
            }
        }
        // TODO: Lazy creation of index
        // Create index of errors for fast search and filtering
        var convertedRulesErrorsIndex = new Map();
        convertedRulesErrors.forEach(function (e) {
            // Checks only errors of converted declarative rules
            var errorsList = convertedRulesErrorsIndex.get(e.declarativeRule.id);
            var newValue = errorsList
                ? errorsList.concat(e)
                : [e];
            convertedRulesErrorsIndex.set(e.declarativeRule.id, newValue);
        });
        // TODO: Lazy creation of index
        // Create index of sources for fast search and filtering
        var sourcesIndex = new Map();
        sourceMapValues.forEach(function (source) {
            var sources = sourcesIndex.get(source.declarativeRuleId);
            var newValue = sources
                ? sources.concat(source)
                : [source];
            sourcesIndex.set(source.declarativeRuleId, newValue);
        });
        // Checks and, if necessary, trims the maximum number of rules
        if (maxNumberOfRules && declarativeRules.length > maxNumberOfRules) {
            var filteredRules = [];
            var excludedRulesIds = [];
            for (var i = 0; i < declarativeRules.length; i += 1) {
                var rule = declarativeRules[i];
                if (i < maxNumberOfRules) {
                    filteredRules.push(rule);
                    continue;
                }
                // Removing an source for a truncated rule
                var sources = sourcesIndex.get(rule.id) || [];
                var sourcesRulesIds = sources.map(function (_a) {
                    var sourceRuleIndex = _a.sourceRuleIndex;
                    return sourceRuleIndex;
                });
                sourcesIndex.set(rule.id, []);
                // Removing an error for a truncated rule
                convertedRulesErrorsIndex.set(rule.id, []);
                // Note: be sure, that sourceRulesIds are not too much to overflow stack.
                excludedRulesIds.push.apply(excludedRulesIds, sourcesRulesIds);
            }
            var msg = 'After conversion, too many declarative rules remain: '
                + "".concat(declarativeRules.length, " exceeds ")
                + "the limit provided - ".concat(maxNumberOfRules);
            var err = new TooManyRulesError(msg, excludedRulesIds, maxNumberOfRules, declarativeRules.length - maxNumberOfRules);
            limitations.push(err);
            declarativeRules = filteredRules;
        }
        // Checks and, if necessary, trims the maximum number of regexp rules
        if (maxNumberOfRegexpRules) {
            var filteredRules = [];
            var excludedRulesIds = [];
            var regexpRulesCounter = 0;
            for (var i = 0; i < declarativeRules.length; i += 1) {
                var rule = declarativeRules[i];
                var isRegexp = rule.condition.regexFilter !== undefined;
                if (isRegexp) {
                    regexpRulesCounter += 1;
                    if (regexpRulesCounter > maxNumberOfRegexpRules) {
                        // Removing an source for a truncated rule
                        var sources = sourcesIndex.get(rule.id) || [];
                        var sourcesRulesIds = sources.map(function (_a) {
                            var sourceRuleIndex = _a.sourceRuleIndex;
                            return sourceRuleIndex;
                        });
                        sourcesIndex.set(rule.id, []);
                        // Removing an error for a truncated rule
                        convertedRulesErrorsIndex.set(rule.id, []);
                        // Note: be sure, that sourceRulesIds are not too much to overflow stack.
                        excludedRulesIds.push.apply(excludedRulesIds, sourcesRulesIds);
                        continue;
                    }
                }
                filteredRules.push(rule);
            }
            if (regexpRulesCounter > maxNumberOfRegexpRules) {
                var msg = 'After conversion, too many regexp rules remain: '
                    + "".concat(regexpRulesCounter, " exceeds ")
                    + "the limit provided - ".concat(maxNumberOfRegexpRules);
                var err = new TooManyRegexpRulesError(msg, excludedRulesIds, maxNumberOfRegexpRules, regexpRulesCounter - maxNumberOfRegexpRules);
                limitations.push(err);
            }
            declarativeRules = filteredRules;
        }
        // Make array from index
        sourceMapValues = Array.from(sourcesIndex.values())
            .filter(function (arr) { return arr.length > 0; })
            .flat();
        // Make array from index
        errors = Array.from(convertedRulesErrorsIndex.values())
            .filter(function (arr) { return arr.length > 0; })
            .flat();
        return {
            sourceMapValues: sourceMapValues,
            declarativeRules: declarativeRules,
            errors: errors.concat(otherErrors),
            limitations: limitations,
        };
    };
    /**
     * Filters rules that have been affected by $badfilter rules and
     * groups them by modifiers.
     *
     * @param filtersWithRules List with filters ids and indexed rules.
     *
     * @returns List with filters ids and grouped indexed rules.
     */
    DeclarativeRulesConverter.applyBadFilter = function (filtersWithRules) {
        var allBadFilterRules = [];
        // Group rules
        var filterIdsWithGroupedRules = filtersWithRules
            .map(function (_a) {
            var id = _a.id, rules = _a.rules;
            var rulesToProcess = DeclarativeRulesGrouper.splitRulesByGroups(rules);
            allBadFilterRules = allBadFilterRules.concat(rulesToProcess[RulesGroup.BadFilter]);
            var tuple = [id, rulesToProcess];
            return tuple;
        });
        // Define filter function
        var filterByBadFilterFn = function (ruleToTest) {
            var networkRuleToTest = ruleToTest.rule;
            for (var _i = 0, allBadFilterRules_1 = allBadFilterRules; _i < allBadFilterRules_1.length; _i++) {
                var rule = allBadFilterRules_1[_i].rule;
                if (rule.negatesBadfilter(networkRuleToTest)) {
                    return false;
                }
            }
            return true;
        };
        // For each group of filters' rules apply filter function
        return filterIdsWithGroupedRules.map(function (_a) {
            var filterId = _a[0], groupedRules = _a[1];
            var filtered = groupedRules;
            // Map because RulesGroup values are numbers
            var groups = Object.keys(filtered).map(Number);
            groups.forEach(function (key) {
                filtered[key] = filtered[key].filter(filterByBadFilterFn);
            });
            // Clean up bad filters rules
            filtered[RulesGroup.BadFilter] = [];
            return [filterId, filtered];
        });
    };
    /**
     * The declarative identifier of a rule must be a natural number.
     */
    DeclarativeRulesConverter.START_DECLARATIVE_RULE_ID = 1;
    /**
     * Describes for which group of rules which converter should be used.
     */
    DeclarativeRulesConverter.converters = (_a = {},
        _a[RulesGroup.Regular] = RegularRulesConverter,
        _a[RulesGroup.Csp] = CspRulesConverter,
        _a[RulesGroup.RemoveParam] = RemoveParamRulesConverter,
        _a[RulesGroup.RemoveHeader] = RemoveHeaderRulesConverter,
        _a[RulesGroup.BadFilter] = BadFilterRulesConverter,
        _a);
    return DeclarativeRulesConverter;
}());

/**
 * Contains a dictionary where the key is the hash of the rule and the value is
 * a list of sources for the rule. Storing this dictionary is necessary for fast
 * rule matching, which can be negated by $badfilter.
 */
var RulesHashMap = /** @class */ (function () {
    /**
     * Creates new {@link RulesHashMap}.
     *
     * @param listOfRulesWithHash List of rules hashes and rules sources:
     * filter id with rule index.
     */
    function RulesHashMap(listOfRulesWithHash) {
        var _this = this;
        this.map = new Map();
        listOfRulesWithHash.forEach(function (_a) {
            var hash = _a.hash, source = _a.source;
            var existingValue = _this.map.get(hash);
            if (existingValue) {
                existingValue.push(source);
            }
            else {
                _this.map.set(hash, [source]);
            }
        });
    }
    /** @inheritdoc */
    RulesHashMap.prototype.findRules = function (hash) {
        return this.map.get(hash) || [];
    };
    /**
     * Deserializes dictionary from raw string.
     *
     * @param rawString The original dictionary that was serialized into a string.
     *
     * @returns Deserialized dictionary.
     */
    RulesHashMap.deserializeSources = function (rawString) {
        var plainArray = JSON.parse(rawString);
        var allPairs = plainArray
            .map(function (_a) {
            var hash = _a[0], sources = _a[1];
            return sources.map(function (_a) {
                var filterId = _a[0], sourceRuleIndex = _a[1];
                return {
                    hash: hash,
                    source: {
                        filterId: filterId,
                        sourceRuleIndex: sourceRuleIndex,
                    },
                };
            });
        })
            .flat();
        return allPairs;
    };
    /** @inheritdoc */
    RulesHashMap.prototype.serialize = function () {
        var arr = Array.from(this.map);
        var serializedValues = arr
            .map(function (_a) {
            var hash = _a[0], source = _a[1];
            var sources = source.map(function (s) {
                return [s.filterId, s.sourceRuleIndex];
            });
            return [hash, sources];
        });
        return JSON.stringify(serializedValues);
    };
    return RulesHashMap;
}());

/**
 * BufferReader is a class responsible for reading content from serialized rules.
 */
var BufferReader = /** @class */ (function () {
    /**
     * Constructor of a BufferReader.
     *
     * @param buffer - Uint8Array that contains a UTF-8 encoded string.
     */
    function BufferReader(buffer) {
        /**
         * Current position of the reader.
         */
        this.currentIndex = 0;
        this.buffer = buffer;
        this.currentIndex = this.buffer.currentOffset;
    }
    /**
     * Reads the next line in the buffer
     *
     * @return text or null on end
     */
    BufferReader.prototype.readNext = function () {
        // If the next byte is 0, it means that there's nothing to read.
        if (this.buffer.peekUint8() === 0) {
            return null;
        }
        var ruleNode;
        agtree/* RuleParser.deserialize */.sR.deserialize(this.buffer, ruleNode = {});
        this.currentIndex = this.buffer.currentOffset;
        if (ruleNode.category) {
            return ruleNode;
        }
        return null;
    };
    /**
     * Returns the current position of this reader or -1 if there's nothing to
     * read.
     *
     * @returns - The current position or -1 if there's nothing to read.
     */
    BufferReader.prototype.getCurrentPos = function () {
        return this.currentIndex;
    };
    /** @inheritdoc */
    BufferReader.prototype.getDataLength = function () {
        return this.buffer.capacity;
    };
    return BufferReader;
}());

/**
 * Source map.
 *
 * @note Since serialized rule nodes are not store original rule text, we need this source map between the
 * serialized filter list and the raw filter list.
 */
lib.z.record(
/**
 * Rule start index in the converted list's byte buffer.
 */
lib.z.string(), 
/**
 * Rule start index in the raw converted list.
 */
lib.z.number());

/**
 * Helper function to get the rule source text from the source string by its line start index.
 *
 * @param lineStartIndex Rule start index.
 * @param source Raw filter list source.
 * @returns Rule string or null if the rule couldn't be found.
 */
var getRuleSourceText = function (lineStartIndex, source) {
    // note: checking for LF is enough, because we transform source before storing it, and it's always LF
    var lineEndIndex = findNextLineBreakIndex(source, lineStartIndex)[0];
    // If the line end index is not found, we assume that the rule is the last line in the source.
    if (lineEndIndex === -1) {
        lineEndIndex = source.length;
    }
    // If the rule start index is equal to or greater than the rule end index, we return null,
    // and the rule is considered not found.
    if (lineStartIndex >= lineEndIndex) {
        return null;
    }
    var ruleSourceText = source.slice(lineStartIndex, lineEndIndex);
    // WARNING!
    // Potential memory leak mitigation for substring operation due to V8 optimizations:
    // When extracting a substring with rule.slice(), there's a concern in some JS environments
    // that the resulting substring might retain a hidden reference to the entire original 'rule' string.
    // This could prevent the garbage collector (GC) from freeing the memory allocated for filter rules.
    // This hidden reference occurs because the substring might not create a new string but rather
    // a view into the original, keeping it in memory longer than necessary.
    // And we receive a memory leak here because we store parsed tags from first N lines of the filter rules
    // which have references to the original large string with filter rules.
    // To ensure that the original large string can be garbage collected, and only the necessary
    // substring is retained, we explicitly force a copy of the substring via split and join,
    // thereby breaking the direct reference to the original string and allowing the GC to free the memory
    // for filter rules when they are no longer in use.
    return ruleSourceText.split('').join('');
};
/**
 * Helper function to get the rule source index (line start index in the source) from the source map by the rule index.
 *
 * @param ruleIdx Rule index.
 * @param sourceMap Source map.
 * @returns Rule source index or RULE_INDEX_NONE (-1).
 * @note Similar to `Array.prototype.indexOf`, we return -1 if the rule index is not found.
 */
var getRuleSourceIndex = function (ruleIdx, sourceMap) {
    var _a;
    return (_a = sourceMap[ruleIdx]) !== null && _a !== void 0 ? _a : RULE_INDEX_NONE;
};

/**
 * FilterScanner returns indexed, only network rules from IFilter's content.
 */
var FilterScanner = /** @class */ (function () {
    /**
     * Constructor of FilterScanner.
     *
     * @param filter From which filter the rules should be scanned.
     * @param filterId Id of filter.
     */
    function FilterScanner(filter, filterId) {
        this.filter = filter;
        this.filterId = filterId;
    }
    /**
     * Creates new filter scanner.
     *
     * @param filter From which filter the rules should be scanned.
     *
     * @returns New FilterScanner.
     */
    FilterScanner.createNew = function (filter) {
        return __awaiter(this, void 0, void 0, function () {
            var content;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, filter.getContent()];
                    case 1:
                        content = _a.sent();
                        return [2 /*return*/, new FilterScanner(content, filter.getId())];
                }
            });
        });
    };
    /**
     * Gets the entire contents of the filter, extracts only the network rules
     * (ignore cosmetic and host rules) and tries to convert each line into an
     * indexed rule with hash.
     *
     * @param filterFn If this function is specified, it will be applied to each
     * rule after it has been parsed and transformed. This function is needed
     * for example to apply $badfilter: to exclude negated rules from the array
     * of rules that will be returned.
     * @param maxNumberOfScannedNetworkRules Maximum number of network rules to
     * scan, all other rules will be ignored and an error {@link MaxScannedRulesError}
     * will be added to the list of result errors.
     *
     * @returns List of indexed rules with hash. If filterFn was specified then
     * out values will be filtered with this function.
     */
    FilterScanner.prototype.getIndexedRules = function (filterFn, maxNumberOfScannedNetworkRules) {
        var _a;
        var filterList = this.filter.filterList;
        var result = {
            errors: [],
            rules: [],
        };
        var buffer = new agtree/* InputByteBuffer */.tL(filterList);
        var reader = new BufferReader(buffer);
        var ruleBufferIndex = reader.getCurrentPos();
        var ruleNode = reader.readNext();
        var curNumberOfScannedNetworkRules = 0;
        while (ruleNode) {
            var indexedNetworkRulesWithHash = [];
            try {
                indexedNetworkRulesWithHash = IndexedNetworkRuleWithHash.createFromNode(this.filterId, ruleBufferIndex, ruleNode);
            }
            catch (e) {
                if (e instanceof Error) {
                    result.errors.push(e);
                }
                else {
                    var lineIndex = getRuleSourceIndex(ruleBufferIndex, this.filter.sourceMap);
                    var rawRule = getRuleSourceText(lineIndex, this.filter.rawFilterList);
                    var originalRawRule = this.filter.conversionMap[lineIndex];
                    // eslint-disable-next-line max-len
                    var errorMessage = "Unknown error during creating indexed rule with hash from raw string: filter id - ".concat(this.filterId, ", line index - ").concat(lineIndex, ", line - ").concat(rawRule);
                    if (originalRawRule) {
                        errorMessage += ", original line - ".concat(originalRawRule);
                    }
                    var err = new Error(errorMessage);
                    result.errors.push(err);
                }
                continue;
            }
            finally {
                ruleBufferIndex = reader.getCurrentPos();
                ruleNode = reader.readNext();
            }
            var filteredRules = filterFn
                ? indexedNetworkRulesWithHash.filter(filterFn)
                : indexedNetworkRulesWithHash;
            (_a = result.rules).push.apply(_a, filteredRules);
            curNumberOfScannedNetworkRules += filteredRules.length;
            if (maxNumberOfScannedNetworkRules !== undefined
                && curNumberOfScannedNetworkRules >= maxNumberOfScannedNetworkRules) {
                var lastScannedRule = indexedNetworkRulesWithHash[indexedNetworkRulesWithHash.length - 1];
                var lineIndex = getRuleSourceIndex(lastScannedRule.index, this.filter.sourceMap);
                // This error needed for future improvements, for example
                // to show in the UI which rules were skipped.
                var err = new MaxScannedRulesError("Maximum number of scanned network rules reached at line index ".concat(lineIndex, "."), lineIndex);
                result.errors.push(err);
                break;
            }
        }
        return result;
    };
    return FilterScanner;
}());

/**
 * Scanner for network rules from list of filters.
 */
var NetworkRulesScanner = /** @class */ (function () {
    function NetworkRulesScanner() {
    }
    /**
     * Asynchronous scans the list of filters for network rules.
     *
     * @param filterList List of {@link IFilter}.
     * @param filterFn If this function is specified, it will be applied to each
     * rule after it has been parsed and transformed. This function is needed
     * for example to apply $badfilter: to exclude negated rules from the array
     * of rules that will be returned.
     * @param maxNumberOfScannedNetworkRules Maximum number of network rules to
     * scan, all other rules will be ignored. It will be applied to each filter
     * separately, not for cumulative scope of rules from all filters, because
     * it looks simpler and more predictable solution to prevent too long scan.
     *
     * @returns List of filters includes the scanned filters and any errors that
     * may occur during the scan.
     */
    NetworkRulesScanner.scanRules = function (filterList, filterFn, maxNumberOfScannedNetworkRules) {
        return __awaiter(this, void 0, void 0, function () {
            var res, promises, tasks;
            var _this = this;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        res = {
                            errors: [],
                            filters: [],
                        };
                        promises = filterList.map(function (filter) { return __awaiter(_this, void 0, void 0, function () {
                            var scanner, _a, errors, rules, badFilterRules;
                            return __generator(this, function (_b) {
                                switch (_b.label) {
                                    case 0: return [4 /*yield*/, FilterScanner.createNew(filter)];
                                    case 1:
                                        scanner = _b.sent();
                                        _a = scanner.getIndexedRules(filterFn, maxNumberOfScannedNetworkRules), errors = _a.errors, rules = _a.rules;
                                        res.errors = res.errors.concat(errors);
                                        badFilterRules = rules.filter(function (_a) {
                                            var rule = _a.rule;
                                            return rule.isOptionEnabled(NetworkRuleOption.Badfilter);
                                        });
                                        return [2 /*return*/, {
                                                id: filter.getId(),
                                                rules: rules,
                                                badFilterRules: badFilterRules,
                                            }];
                                }
                            });
                        }); });
                        return [4 /*yield*/, Promise.allSettled(promises)];
                    case 1:
                        tasks = _a.sent();
                        tasks.forEach(function (task, index) {
                            if (task.status === 'rejected') {
                                var filterId = filterList[index].getId();
                                res.errors.push(new Error("Cannot scan rules from filter ".concat(filterId, ": ").concat(task.reason)));
                                return;
                            }
                            res.filters.push(task.value);
                        });
                        return [2 /*return*/, res];
                }
            });
        });
    };
    return NetworkRulesScanner;
}());

/* eslint-disable jsdoc/require-description-complete-sentence  */
/**
 * Converts a list of IFilters to a single rule set or to a list of rule sets.
 */
var DeclarativeFilterConverter = /** @class */ (function () {
    function DeclarativeFilterConverter() {
    }
    /**
     * Checks that provided converter options are correct.
     *
     * @param options Contains path to web accessible resources,
     * maximum number of converter rules and regexp rules. @see
     * {@link DeclarativeConverterOptions} for details.
     *
     * @throws An {@link ResourcesPathError} if the resources path does not
     * start with a slash or it ends with a slash
     * OR an {@link EmptyOrNegativeNumberOfRulesError} if maximum number of
     * rules is equal or less than 0.
     * OR an {@link NegativeNumberOfRegexpRulesError} if maximum number of
     * regexp rules is less than 0.
     */
    DeclarativeFilterConverter.checkConverterOptions = function (options) {
        var resourcesPath = options.resourcesPath, maxNumberOfRules = options.maxNumberOfRules, maxNumberOfRegexpRules = options.maxNumberOfRegexpRules;
        if (resourcesPath !== undefined) {
            var firstChar = 0;
            var lastChar = resourcesPath.length > 0
                ? resourcesPath.length - 1
                : 0;
            if (resourcesPath[firstChar] !== '/') {
                var msg = 'Path to web accessible resources should '
                    + "be started with leading slash: ".concat(resourcesPath);
                throw new ResourcesPathError(msg);
            }
            if (resourcesPath[lastChar] === '/') {
                var msg = 'Path to web accessible resources should '
                    + "not be ended with slash: ".concat(resourcesPath);
                throw new ResourcesPathError(msg);
            }
        }
        if (maxNumberOfRules !== undefined && maxNumberOfRules <= 0) {
            var msg = 'Maximum number of rules cannot be equal or less than 0';
            throw new EmptyOrNegativeNumberOfRulesError(msg);
        }
        if (maxNumberOfRegexpRules && maxNumberOfRegexpRules < 0) {
            var msg = 'Maximum number of regexp rules cannot be less than 0';
            throw new NegativeNumberOfRegexpRulesError(msg);
        }
    };
    /** @inheritdoc */
    // eslint-disable-next-line class-methods-use-this
    DeclarativeFilterConverter.prototype.convertStaticRuleSet = function (filter, options) {
        return __awaiter(this, void 0, void 0, function () {
            var _a, errors, filters, scannedStaticFilter, id, badFilterRules, convertedRules, conversionResult;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        if (options) {
                            DeclarativeFilterConverter.checkConverterOptions(options);
                        }
                        return [4 /*yield*/, NetworkRulesScanner.scanRules([filter])];
                    case 1:
                        _a = _b.sent(), errors = _a.errors, filters = _a.filters;
                        scannedStaticFilter = filters[0];
                        id = scannedStaticFilter.id, badFilterRules = scannedStaticFilter.badFilterRules;
                        return [4 /*yield*/, DeclarativeRulesConverter.convert(filters, options)];
                    case 2:
                        convertedRules = _b.sent();
                        conversionResult = DeclarativeFilterConverter.collectConvertedResult("ruleset_".concat(id), [filter], filters, convertedRules, badFilterRules);
                        return [2 /*return*/, {
                                ruleSet: conversionResult.ruleSet,
                                errors: errors.concat(conversionResult.errors),
                                limitations: conversionResult.limitations,
                            }];
                }
            });
        });
    };
    /** @inheritdoc */
    // eslint-disable-next-line class-methods-use-this
    DeclarativeFilterConverter.prototype.convertDynamicRuleSets = function (filterList, staticRuleSets, options) {
        return __awaiter(this, void 0, void 0, function () {
            var allStaticBadFilterRules, skipNegatedRulesFn, scanned, convertedRules, dynamicBadFilterRules, conversionResult, _a, declarativeRulesToCancel, errors;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        if (options) {
                            DeclarativeFilterConverter.checkConverterOptions(options);
                        }
                        allStaticBadFilterRules = DeclarativeFilterConverter.createBadFilterRulesHashMap(staticRuleSets);
                        skipNegatedRulesFn = function (r) {
                            var fastMatchedBadFilterRules = allStaticBadFilterRules.get(r.hash);
                            if (!fastMatchedBadFilterRules) {
                                return true;
                            }
                            for (var i = 0; i < fastMatchedBadFilterRules.length; i += 1) {
                                var rule = fastMatchedBadFilterRules[i];
                                var badFilterRule = rule.rule;
                                var ruleToCheck = r.rule;
                                if (badFilterRule.negatesBadfilter(ruleToCheck)) {
                                    return false;
                                }
                            }
                            return true;
                        };
                        return [4 /*yield*/, NetworkRulesScanner.scanRules(filterList, skipNegatedRulesFn, 
                            // We increase the limit by 10% to scan more rules in case of some
                            // network rules will be combined into one declarative rule. It is
                            // safe, because we have double check for maxNumberOfRules on the
                            // converted DNR rules.
                            (options === null || options === void 0 ? void 0 : options.maxNumberOfRules)
                                ? Math.ceil(options.maxNumberOfRules * DeclarativeFilterConverter.SCANNED_NETWORK_RULES_MULTIPLICATOR)
                                : undefined)];
                    case 1:
                        scanned = _b.sent();
                        return [4 /*yield*/, DeclarativeRulesConverter.convert(scanned.filters, options)];
                    case 2:
                        convertedRules = _b.sent();
                        dynamicBadFilterRules = scanned.filters
                            .map(function (_a) {
                            var badFilterRules = _a.badFilterRules;
                            return badFilterRules;
                        })
                            .flat();
                        conversionResult = DeclarativeFilterConverter.collectConvertedResult(DeclarativeFilterConverter.COMBINED_RULESET_ID, filterList, scanned.filters, convertedRules, dynamicBadFilterRules);
                        return [4 /*yield*/, DeclarativeFilterConverter.collectDeclarativeRulesToCancel(staticRuleSets, dynamicBadFilterRules)];
                    case 3:
                        _a = _b.sent(), declarativeRulesToCancel = _a.declarativeRulesToCancel, errors = _a.errors;
                        conversionResult.errors = conversionResult.errors
                            .concat(scanned.errors)
                            .concat(errors);
                        conversionResult.declarativeRulesToCancel = declarativeRulesToCancel;
                        return [2 /*return*/, conversionResult];
                }
            });
        });
    };
    /**
     * Collects {@link ConversionResult} from provided list of raw filters,
     * scanned filters, converted rules and bad filter rules.
     * Creates new {@link RuleSet} and wrap all data for {@link RuleSetContentProvider}.
     *
     * @param ruleSetId Rule set id.
     * @param filterList List of raw filters.
     * @param scannedFilters Already scanned filters.
     * @param convertedRules Converted rules.
     * @param badFilterRules List of rules with $badfilter modifier.
     *
     * @returns Item of {@link ConversionResult}.
     */
    DeclarativeFilterConverter.collectConvertedResult = function (ruleSetId, filterList, scannedFilters, convertedRules, badFilterRules) {
        var _this = this;
        var sourceMapValues = convertedRules.sourceMapValues, declarativeRules = convertedRules.declarativeRules, errors = convertedRules.errors, _a = convertedRules.limitations, limitations = _a === void 0 ? [] : _a;
        var ruleSetContent = {
            loadSourceMap: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
                return [2 /*return*/, new SourceMap(sourceMapValues)];
            }); }); },
            loadFilterList: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
                return [2 /*return*/, filterList];
            }); }); },
            loadDeclarativeRules: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
                return [2 /*return*/, declarativeRules];
            }); }); },
        };
        var listOfRulesWithHash = scannedFilters
            .map(function (_a) {
            var id = _a.id, rules = _a.rules;
            return rules.map(function (r) { return ({
                hash: r.hash,
                source: {
                    sourceRuleIndex: r.index,
                    filterId: id,
                },
            }); });
        })
            .flat();
        var rulesHashMap = new RulesHashMap(listOfRulesWithHash);
        var ruleSet = new RuleSet(ruleSetId, declarativeRules.length, declarativeRules.filter(function (d) { return d.condition.regexFilter; }).length, ruleSetContent, badFilterRules, rulesHashMap);
        return {
            ruleSet: ruleSet,
            errors: errors,
            limitations: limitations,
        };
    };
    /**
     * Creates dictionary where key is hash of indexed rule and value is array
     * of rules with this hash.
     *
     * @param ruleSets A list of IRuleSets for each of which a list of
     * $badfilter rules.
     *
     * @returns Dictionary with all $badfilter rules which are extracted from
     * rulesets.
     */
    DeclarativeFilterConverter.createBadFilterRulesHashMap = function (ruleSets) {
        var allStaticBadFilterRules = new Map();
        ruleSets.forEach(function (ruleSet) {
            ruleSet.getBadFilterRules().forEach(function (r) {
                var existingValue = allStaticBadFilterRules.get(r.hash);
                if (existingValue) {
                    existingValue.push(r);
                }
                else {
                    allStaticBadFilterRules.set(r.hash, [r]);
                }
            });
        });
        return allStaticBadFilterRules;
    };
    /**
     * Checks if some rules (fastMatchedRulesByHash) from the staticRuleSet,
     * which have been fast matched by hash, can be negated with the provided
     * badFilterRule via the `$badfilter` option.
     *
     * @param badFilterRule Network rule with hash {@link IndexedNetworkRuleWithHash}
     * and `$badfilter` option.
     * @param staticRuleSet Static rule set which contains fast matched rules.
     * @param fastMatchedRulesByHash Rules that have been fast matched by hash
     * for potential negation.
     *
     * @returns List of declarative rule IDs that have been canceled by
     * the provided badFilterRule.
     */
    DeclarativeFilterConverter.checkFastMatchedRulesCanBeCancelled = function (badFilterRule, staticRuleSet, fastMatchedRulesByHash) {
        return __awaiter(this, void 0, void 0, function () {
            var fastMatchedDeclarativeRulesIds, promises, ids, e_1, disableRuleIds, k, id, matchedSourceRules, e_2, indexedNetworkRulesWithHash, arrayWithRules, e_3, someRulesMatched;
            var _this = this;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        fastMatchedDeclarativeRulesIds = [];
                        _a.label = 1;
                    case 1:
                        _a.trys.push([1, 3, , 4]);
                        promises = fastMatchedRulesByHash.map(function (source) { return __awaiter(_this, void 0, void 0, function () {
                            return __generator(this, function (_a) {
                                return [2 /*return*/, staticRuleSet.getDeclarativeRulesIdsBySourceRuleIndex(source)];
                            });
                        }); });
                        return [4 /*yield*/, Promise.all(promises)];
                    case 2:
                        ids = _a.sent();
                        fastMatchedDeclarativeRulesIds.push.apply(fastMatchedDeclarativeRulesIds, ids.flat());
                        return [3 /*break*/, 4];
                    case 3:
                        e_1 = _a.sent();
                        // eslint-disable-next-line max-len
                        throw new Error("Not found declarative rule id for some source from list: ".concat(JSON.stringify(fastMatchedDeclarativeRulesIds), ": ").concat(getErrorMessage(e_1)));
                    case 4:
                        disableRuleIds = [];
                        k = 0;
                        _a.label = 5;
                    case 5:
                        if (!(k < fastMatchedDeclarativeRulesIds.length)) return [3 /*break*/, 15];
                        id = fastMatchedDeclarativeRulesIds[k];
                        matchedSourceRules = [];
                        _a.label = 6;
                    case 6:
                        _a.trys.push([6, 8, , 9]);
                        return [4 /*yield*/, staticRuleSet.getRulesById(id)];
                    case 7:
                        // eslint-disable-next-line no-await-in-loop
                        matchedSourceRules = _a.sent();
                        return [3 /*break*/, 9];
                    case 8:
                        e_2 = _a.sent();
                        throw new Error("Not found sources for declarative rule with id \"".concat(id, "\": ").concat(getErrorMessage(e_2)));
                    case 9:
                        indexedNetworkRulesWithHash = [];
                        _a.label = 10;
                    case 10:
                        _a.trys.push([10, 12, , 13]);
                        return [4 /*yield*/, Promise.all(matchedSourceRules.map(function (source) {
                                return RuleSet.getNetworkRuleBySourceRule(source);
                            }))];
                    case 11:
                        arrayWithRules = _a.sent();
                        indexedNetworkRulesWithHash = arrayWithRules.flat();
                        return [3 /*break*/, 13];
                    case 12:
                        e_3 = _a.sent();
                        // eslint-disable-next-line max-len
                        throw new Error("Not found network rules from matched sources \"".concat(JSON.stringify(matchedSourceRules), "\": ").concat(getErrorMessage(e_3)));
                    case 13:
                        someRulesMatched = indexedNetworkRulesWithHash
                            .flat()
                            .some(function (rule) { return badFilterRule.rule.negatesBadfilter(rule); });
                        if (someRulesMatched) {
                            disableRuleIds.push(id);
                        }
                        _a.label = 14;
                    case 14:
                        k += 1;
                        return [3 /*break*/, 5];
                    case 15: return [2 /*return*/, disableRuleIds];
                }
            });
        });
    };
    /**
     * Applies rules with $badfilter modifier from dynamic rulesets to all rules
     * from static rulesets and returns list of ids of declarative rules to
     * disable them.
     *
     * @param staticRuleSets List of converted static rulesets.
     * @param dynamicBadFilterRules List of rules with $badfilter.
     *
     * @returns List of ids of declarative rules to disable them.
     */
    DeclarativeFilterConverter.collectDeclarativeRulesToCancel = function (staticRuleSets, dynamicBadFilterRules) {
        return __awaiter(this, void 0, void 0, function () {
            var declarativeRulesToCancel, errors, i, staticRuleSet, disableRuleIds, j, badFilterRule, hashMap, fastMatchedRulesByHash, ids, e_4;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        declarativeRulesToCancel = [];
                        errors = [];
                        i = 0;
                        _a.label = 1;
                    case 1:
                        if (!(i < staticRuleSets.length)) return [3 /*break*/, 9];
                        staticRuleSet = staticRuleSets[i];
                        disableRuleIds = [];
                        j = 0;
                        _a.label = 2;
                    case 2:
                        if (!(j < dynamicBadFilterRules.length)) return [3 /*break*/, 7];
                        badFilterRule = dynamicBadFilterRules[j];
                        hashMap = staticRuleSet.getRulesHashMap();
                        fastMatchedRulesByHash = hashMap.findRules(badFilterRule.hash);
                        if (fastMatchedRulesByHash.length === 0) {
                            return [3 /*break*/, 6];
                        }
                        _a.label = 3;
                    case 3:
                        _a.trys.push([3, 5, , 6]);
                        return [4 /*yield*/, DeclarativeFilterConverter.checkFastMatchedRulesCanBeCancelled(badFilterRule, staticRuleSet, fastMatchedRulesByHash)];
                    case 4:
                        ids = _a.sent();
                        disableRuleIds.push.apply(disableRuleIds, ids);
                        return [3 /*break*/, 6];
                    case 5:
                        e_4 = _a.sent();
                        errors.push(new Error("Cannot apply badfilter: ".concat(getErrorMessage(e_4))));
                        return [3 /*break*/, 6];
                    case 6:
                        j += 1;
                        return [3 /*break*/, 2];
                    case 7:
                        if (disableRuleIds.length > 0) {
                            declarativeRulesToCancel.push({
                                rulesetId: staticRuleSet.getId(),
                                disableRuleIds: disableRuleIds,
                            });
                        }
                        _a.label = 8;
                    case 8:
                        i += 1;
                        return [3 /*break*/, 1];
                    case 9: return [2 /*return*/, {
                            errors: errors,
                            declarativeRulesToCancel: declarativeRulesToCancel,
                        }];
                }
            });
        });
    };
    /**
     * Same as chrome.declarativeNetRequest.DYNAMIC_RULESET_ID.
     */
    DeclarativeFilterConverter.COMBINED_RULESET_ID = '_dynamic';
    /**
     * Number of scanned rules can be limited via converter options. In this
     * case we increase the limit by 10% to scan more rules in case of some
     * network rules will be combined into one declarative rule. It is safe,
     * because we have double check for maxNumberOfRules on the converted DNR
     * rules.
     */
    DeclarativeFilterConverter.SCANNED_NETWORK_RULES_MULTIPLICATOR = 1.1;
    return DeclarativeFilterConverter;
}());

/**
 * Describes an error when filter source is not available.
 */
var UnavailableFilterSourceError = /** @class */ (function (_super) {
    __extends(UnavailableFilterSourceError, _super);
    /**
     * Describes an error when filter source is not available.
     *
     * @param message Message of error.
     * @param filterId Filter id, the source of which is not available.
     * @param cause Basic error, describes why the source is unavailable.
     */
    function UnavailableFilterSourceError(message, filterId, cause) {
        var _this = _super.call(this, message, { cause: cause }) || this;
        _this.name = 'UnavailableFilterSourceError';
        _this.filterId = filterId;
        // For proper work of the "instanceof" operator
        Object.setPrototypeOf(_this, UnavailableFilterSourceError.prototype);
        return _this;
    }
    return UnavailableFilterSourceError;
}(Error));

/**
 * Saves the original rules and can return all original rules or just one,
 * with lazy content loading.
 */
var Filter = /** @class */ (function () {
    /**
     * Creates new FilterList.
     *
     * @param id Number id of filter.
     * @param source Provider of filter content.
     * @param trusted Filter trusted flag.
     */
    function Filter(id, source, trusted) {
        // Content of filter, lazy load
        this.content = null;
        this.id = id;
        this.source = source;
        this.trusted = trusted;
    }
    /**
     * Filter id.
     *
     * @returns Filter id.
     */
    Filter.prototype.getId = function () {
        return this.id;
    };
    /**
     * Returns the original filter rules with lazy loading.
     *
     * @throws UnavailableFilterSourceError if content is not available.
     *
     * @returns List of original filter rules.
     */
    Filter.prototype.getContent = function () {
        return __awaiter(this, void 0, void 0, function () {
            var _a, e_1;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        if (this.content) {
                            return [2 /*return*/, this.content];
                        }
                        _b.label = 1;
                    case 1:
                        _b.trys.push([1, 3, , 4]);
                        _a = this;
                        return [4 /*yield*/, this.source.getContent()];
                    case 2:
                        _a.content = _b.sent();
                        if (!this.content || this.content.rawFilterList.length === 0 || this.content.filterList.length === 0) {
                            throw new Error('Loaded empty content');
                        }
                        return [2 /*return*/, this.content];
                    case 3:
                        e_1 = _b.sent();
                        throw new UnavailableFilterSourceError('Filter content is unavailable', this.id, e_1);
                    case 4: return [2 /*return*/];
                }
            });
        });
    };
    /**
     * Returns original filtering rule by provided id with lazy load.
     *
     * @param index Rule index.
     *
     * @throws Error {@link UnavailableFilterSourceError} if content is
     * not available.
     *
     * @returns Original filtering rule by provided identifier.
     */
    Filter.prototype.getRuleByIndex = function (index) {
        var _a;
        return __awaiter(this, void 0, void 0, function () {
            var content, lineIndex, sourceRule;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0: return [4 /*yield*/, this.getContent()];
                    case 1:
                        content = _b.sent();
                        lineIndex = getRuleSourceIndex(index, content.sourceMap);
                        sourceRule = (_a = getRuleSourceText(lineIndex, content.rawFilterList)) !== null && _a !== void 0 ? _a : EMPTY_STRING;
                        return [2 /*return*/, sourceRule];
                }
            });
        });
    };
    /**
     * Returns if the filter is trusted or not.
     *
     * @returns True if the filter is trusted, false otherwise.
     */
    Filter.prototype.isTrusted = function () {
        return this.trusted;
    };
    return Filter;
}());

/**
 * @file This file describes the file names for the parts of the rule set that
 * will be saved to/loaded from disk.
 *
 * We split all ruleset data into two parts: one is needed for instant creating
 * ruleset, while the other is needed only when declarative filtering log
 * is enabled - to find and display source rules from raw filters.
 */
/**
 * This metadata needed for instant creating ruleset.
 */
var METADATA_FILENAME = 'metadata.json';
/**
 * This metadata needed for lazy load some data to ruleset
 * to find and show source rules when declarative filtering log is enabled.
 */
var LAZY_METADATA_FILENAME = 'lazy_metadata.json';



;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/filteringLogStatus.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

/**
 * @typedef {object} StatusMode
 * @property {string} REGULAR
 * @property {string} MODIFIED
 * @property {string} BLOCKED
 * @property {string} ALLOWED
 */ const StatusMode = {
    REGULAR: 'regular',
    MODIFIED: 'modified',
    BLOCKED: 'blocked',
    ALLOWED: 'allowed',
    ALLOWED_STEALTH: 'allowed-stealth'
};
const getDeclarativeStatusMode = (declarativeRuleInfo)=>{
    const { sourceRules, declarativeRuleJson } = declarativeRuleInfo;
    const rule = JSON.parse(declarativeRuleJson);
    // Small hack to show rules with $redirect as blocked for keep legacy logic.
    if (rule.action.type === RuleActionType.REDIRECT && sourceRules.some(({ sourceRule })=>sourceRule.includes('$redirect=') || sourceRule.includes(',redirect='))) {
        return StatusMode.BLOCKED;
    }
    switch(rule.action.type){
        case RuleActionType.BLOCK:
            {
                return StatusMode.BLOCKED;
            }
        case RuleActionType.MODIFY_HEADERS:
        case RuleActionType.REDIRECT:
            {
                return StatusMode.MODIFIED;
            }
        case RuleActionType.ALLOW_ALL_REQUESTS:
        case RuleActionType.UPGRADE_SCHEME:
        case RuleActionType.ALLOW:
            {
                return StatusMode.ALLOWED;
            }
        default:
            {
                return StatusMode.REGULAR;
            }
    }
};
/**
 * Returns filtering log status
 *
 * @param {object} event - filtering log event
 * @returns {string}
 */ const getStatusMode = (event)=>{
    const { cspReportBlocked, replaceRules, stealthAllowlistRules, requestRule, removeParam, removeHeader, isModifyingCookieRule, declarativeRuleInfo } = event;
    if (declarativeRuleInfo !== undefined) {
        return getDeclarativeStatusMode(declarativeRuleInfo);
    }
    let mode = StatusMode.REGULAR;
    if (cspReportBlocked) {
        mode = StatusMode.BLOCKED;
        return mode;
    }
    if (replaceRules) {
        mode = StatusMode.MODIFIED;
    }
    if (stealthAllowlistRules) {
        mode = StatusMode.ALLOWED_STEALTH;
    }
    if (requestRule && !replaceRules) {
        /**
         * All of these fields are fields that are "synthetically" added to the
         * `FilteringLogEvent` of the tswebextension on the side of the extension
         * {@link FilteringLogApi.createCosmeticRuleEventData}.
         */ const { allowlistRule, cssRule, scriptRule, cookieRule, cspRule, permissionsRule } = requestRule;
        if (allowlistRule) {
            // $stealth allowlist rules are not being marked as allowed
            // to prevent log cluttering and conform with desktop applications
            mode = StatusMode.ALLOWED;
        } else if (cssRule || scriptRule || removeParam || removeHeader) {
            mode = StatusMode.MODIFIED;
        } else if (cookieRule) {
            if (isModifyingCookieRule) {
                mode = StatusMode.MODIFIED;
            } else {
                mode = StatusMode.BLOCKED;
            }
        } else if (cspRule || permissionsRule) {
            mode = StatusMode.MODIFIED;
        } else {
            mode = StatusMode.BLOCKED;
        }
    }
    return mode;
};

// EXTERNAL MODULE: ./Extension/src/common/logger.ts
var common_logger = __webpack_require__(41512);
// EXTERNAL MODULE: ./Extension/src/pages/filtering-log/stores/helpers.ts
var helpers = __webpack_require__(14921);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/stores/LogStore.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ /* eslint-disable no-param-reassign */ function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _ts_decorate(decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
}











;
;
;
const initMiscellaneousFilters = {
    allButtonEnabled: true,
    filters: [
        {
            id: "regular",
            enabled: true,
            title: translator/* translator.getMessage */.O.getMessage('filtering_log_filter_regular'),
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_regular')
        },
        {
            id: "allowlisted",
            enabled: true,
            title: translator/* translator.getMessage */.O.getMessage('filtering_log_filter_allowed'),
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_allowed')
        },
        {
            id: "blocked",
            enabled: true,
            title: translator/* translator.getMessage */.O.getMessage('filtering_log_filter_blocked'),
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_blocked')
        },
        {
            id: "modified",
            enabled: true,
            title: translator/* translator.getMessage */.O.getMessage('filtering_log_filter_modified'),
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_modified')
        },
        {
            id: "user_filter",
            enabled: true,
            title: translator/* translator.getMessage */.O.getMessage('filtering_log_filter_user_rules'),
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_user_rules')
        }
    ]
};
const initRequestSourceFilters = {
    allButtonEnabled: true,
    filters: [
        {
            id: "first_party",
            enabled: true,
            title: '1P',
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_first_party')
        },
        {
            id: "third_party",
            enabled: true,
            title: '3P',
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_third_party')
        }
    ]
};
const initEventTypesFilters = {
    allButtonEnabled: true,
    filters: [
        {
            id: "html",
            enabled: true,
            title: 'HTML',
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_html'),
            types: [
                index_mv3/* ContentType.Document */.zc.Document,
                index_mv3/* ContentType.Subdocument */.zc.Subdocument
            ]
        },
        {
            id: "css",
            enabled: true,
            title: 'CSS',
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_css'),
            types: [
                index_mv3/* ContentType.Stylesheet */.zc.Stylesheet
            ]
        },
        {
            id: "java_script",
            enabled: true,
            title: 'JS',
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_js'),
            types: [
                index_mv3/* ContentType.Script */.zc.Script
            ]
        },
        {
            id: "xmlhttprequest",
            enabled: true,
            title: 'XHR',
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_xhr'),
            types: [
                index_mv3/* ContentType.XmlHttpRequest */.zc.XmlHttpRequest
            ]
        },
        {
            id: "image",
            enabled: true,
            title: 'Img',
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_img'),
            types: [
                index_mv3/* ContentType.Image */.zc.Image
            ]
        },
        {
            id: "media",
            enabled: true,
            title: 'Media',
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_media'),
            types: [
                index_mv3/* ContentType.Object */.zc.Object,
                index_mv3/* ContentType.Media */.zc.Media
            ]
        },
        {
            id: "other",
            enabled: true,
            title: translator/* translator.getMessage */.O.getMessage('filtering_type_other'),
            tooltip: translator/* translator.getMessage */.O.getMessage('filtering_log_tag_tooltip_other'),
            types: [
                index_mv3/* ContentType.Other */.zc.Other,
                index_mv3/* ContentType.Font */.zc.Font,
                index_mv3/* ContentType.Websocket */.zc.Websocket,
                index_mv3/* ContentType.Csp */.zc.Csp,
                index_mv3/* ContentType.PermissionsPolicy */.zc.PermissionsPolicy,
                index_mv3/* ContentType.Cookie */.zc.Cookie,
                index_mv3/* ContentType.Ping */.zc.Ping,
                index_mv3/* ContentType.WebRtc */.zc.WebRtc,
                index_mv3/* ContentType.CspReport */.zc.CspReport
            ]
        }
    ]
};
const matchesFilter = ({ filters }, filterId, check)=>{
    const filter = filters.find((f)=>f.id === filterId);
    if (!filter) {
        return false;
    }
    return filter.enabled && check;
};
class LogStore {
    onTabUpdate(tabInfo) {
        const { tabId } = tabInfo;
        this.tabsMap[tabId] = tabInfo;
    }
    async onTabClose(tabInfo) {
        delete this.tabsMap[tabInfo.tabId];
        if (tabInfo.tabId === this.selectedTabId) {
            const [firstTabInfo] = Object.values(this.tabsMap);
            if (!firstTabInfo) {
                return;
            }
            await this.setSelectedTabId(firstTabInfo.tabId);
        }
    }
    onTabReset(tabInfo) {
        if (this.selectedTabId === tabInfo.tabId) {
            this.filteringEvents = [];
        }
    }
    // @ts-ignore
    onSettingUpdated(name, value) {
        if (!this.settings) {
            return;
        }
        // @ts-ignore
        this.settings.values[name] = value;
    }
    get tabs() {
        // while tab select is open we return prev tabs
        // to stop select from re-rendering during selection
        if (this.selectIsOpen) {
            if (!this.prevTabs) {
                (0,mobx_esm/* runInAction */.z)(()=>{
                    this.prevTabs = this.getTabs();
                });
            }
            return this.prevTabs;
        }
        const tabs = this.getTabs();
        (0,mobx_esm/* runInAction */.z)(()=>{
            this.prevTabs = tabs;
        });
        return tabs;
    }
    get events() {
        const filteredEvents = this.filteringEvents.filter((filteringEvent)=>{
            var _filteringEvent_requestRule, _sourceRules_;
            const show = (0,helpers/* matchesSearch */.U)(filteringEvent, this.eventsSearchValue);
            // Filter by requestType
            const { requestType } = filteringEvent;
            // check if request type is in eventTypesFilters
            const filterForRequestType = this.eventTypesFilters.filters.find((filter)=>{
                // Cookie rules have document request type,
                // but they refer to "other" filtering log events
                if (filteringEvent === null || filteringEvent === void 0 ? void 0 : filteringEvent.isModifyingCookieRule) {
                    return filter.types && filter.types.includes(index_mv3/* ContentType.Cookie */.zc.Cookie);
                }
                if (filteringEvent === null || filteringEvent === void 0 ? void 0 : filteringEvent.cspReportBlocked) {
                    return filter.types && filter.types.includes(index_mv3/* ContentType.CspReport */.zc.CspReport);
                }
                return requestType && filter.types && filter.types.includes(requestType);
            });
            if (!(filterForRequestType === null || filterForRequestType === void 0 ? void 0 : filterForRequestType.enabled)) {
                return false;
            }
            // blocked CSP reports should be filtered as blocked requests in the filtering log. AG-24613
            const filteringEventType = getStatusMode(filteringEvent);
            const isAllowlisted = filteringEventType === StatusMode.ALLOWED || filteringEventType === StatusMode.ALLOWED_STEALTH;
            const isBlocked = filteringEventType === StatusMode.BLOCKED;
            const isModified = filteringEventType === StatusMode.MODIFIED;
            const isRegular = !isAllowlisted && !isBlocked && !isModified;
            const { sourceRules } = (filteringEvent === null || filteringEvent === void 0 ? void 0 : filteringEvent.declarativeRuleInfo) || {};
            const isUserFilter = ((_filteringEvent_requestRule = filteringEvent.requestRule) === null || _filteringEvent_requestRule === void 0 ? void 0 : _filteringEvent_requestRule.filterId) === 0 || !!(sourceRules && sourceRules.length > 0 && ((_sourceRules_ = sourceRules[0]) === null || _sourceRules_ === void 0 ? void 0 : _sourceRules_.filterId) === 0);
            // filter by miscellaneous filters
            const showByMiscellaneous = this.miscellaneousFilters.filters.every((f)=>f.enabled) || matchesFilter(this.miscellaneousFilters, "regular", isRegular) || matchesFilter(this.miscellaneousFilters, "allowlisted", isAllowlisted) || matchesFilter(this.miscellaneousFilters, "blocked", isBlocked) || matchesFilter(this.miscellaneousFilters, "modified", isModified) || matchesFilter(this.miscellaneousFilters, "user_filter", isUserFilter);
            if (!showByMiscellaneous) {
                return false;
            }
            const isFirstParty = !filteringEvent.requestThirdParty;
            const isThirdParty = !!filteringEvent.requestThirdParty;
            // filter by request source filter
            const showByRequestSource = this.requestSourceFilters.filters.every((f)=>f.enabled) || matchesFilter(this.requestSourceFilters, "first_party", isFirstParty) || matchesFilter(this.requestSourceFilters, "third_party", isThirdParty);
            if (!showByRequestSource) {
                return false;
            }
            return show;
        });
        return filteredEvents;
    /* eslint-enable max-len */ }
    get appearanceTheme() {
        if (!this.settings) {
            return null;
        }
        return this.settings.values[this.settings.names.AppearanceTheme];
    }
    constructor(rootStore){
        _define_property(this, "filteringEvents", []);
        _define_property(this, "tabsMap", {});
        _define_property(this, "selectedTabId", null);
        _define_property(this, "eventsSearchValue", '');
        _define_property(this, "preserveLogEnabled", false);
        _define_property(this, "selectedEvent", null);
        _define_property(this, "filtersMetadata", null);
        _define_property(this, "settings", null);
        _define_property(this, "miscellaneousFilters", initMiscellaneousFilters);
        _define_property(this, "requestSourceFilters", initRequestSourceFilters);
        _define_property(this, "eventTypesFilters", initEventTypesFilters);
        _define_property(this, "selectIsOpen", false);
        _define_property(this, "prevTabs", []);
        _define_property(this, "rootStore", void 0);
        _define_property(this, "setMiscellaneousFilters", (payload)=>{
            this.miscellaneousFilters = payload;
        });
        _define_property(this, "setRequestSourceFilters", (payload)=>{
            this.requestSourceFilters = payload;
        });
        _define_property(this, "setEventTypesFilters", (payload)=>{
            this.eventTypesFilters = payload;
        });
        _define_property(this, "resetAllFilters", ()=>{
            // enable all eventTypesFilters
            this.eventTypesFilters = initEventTypesFilters;
            // disable all miscellaneousFilters
            this.miscellaneousFilters = initMiscellaneousFilters;
            // disable all requestSourceFilters
            this.requestSourceFilters = initRequestSourceFilters;
        });
        /**
     * For each event tries to add filterName, originalRuleText and appliedRuleText,
     * extracted from requestRule or replaceRules or stealthAllowlistRules.
     * This is like helper to move rule's texts to upper level, inside event
     * itself to make other code easier to access these rule's texts.
     *
     * @param filteringEvent Filtering event to format.
     *
     * @returns Same filtering event, but with extracted rules texts if found any.
     */ _define_property(this, "formatEvent", (filteringEvent)=>{
            const { requestRule } = filteringEvent;
            const { originalRuleText, appliedRuleText } = requestRule !== null && requestRule !== void 0 ? requestRule : {};
            // For $replace and $stealth rules, which will be grouped in RequestInfo with filter names specified,
            // we only show filter name on a main log screen for a single rule.
            if (requestRule) {
                filteringEvent.filterName = getFilterName(requestRule === null || requestRule === void 0 ? void 0 : requestRule.filterId, this.filtersMetadata);
            }
            const { filterName } = filteringEvent;
            if (originalRuleText) {
                filteringEvent.originalRuleText = originalRuleText;
            }
            if (appliedRuleText) {
                filteringEvent.appliedRuleText = appliedRuleText;
            }
            if (!filterName) {
                filteringEvent.filterName = getRuleFilterName(filteringEvent, this.filtersMetadata);
            }
            return filteringEvent;
        });
        _define_property(this, "getTabs", ()=>{
            const MAX_TITLE_LENGTH = 60;
            return Object.values(this.tabsMap).filter((tab)=>!tab.isExtensionTab).map(({ title, tabId })=>{
                const updatedTitle = lodash_es_truncate(title, {
                    length: MAX_TITLE_LENGTH
                });
                return {
                    title: updatedTitle,
                    tabId
                };
            });
        });
        _define_property(this, "setSelectIsOpenState", (value)=>{
            this.selectIsOpen = value;
        });
        _define_property(this, "getEventsByTabId", async (tabId)=>{
            const filteringInfo = await messenger/* messenger.getFilteringInfoByTabId */.d.getFilteringInfoByTabId(tabId);
            (0,mobx_esm/* runInAction */.z)(()=>{
                this.filteringEvents = (filteringInfo === null || filteringInfo === void 0 ? void 0 : filteringInfo.filteringEvents.map((filteringEvent)=>this.formatEvent(filteringEvent))) || [];
            });
        });
        _define_property(this, "setSelectedTabId", async (tabId)=>{
            this.selectedTabId = typeof tabId === 'string' ? Number.parseInt(tabId, 10) : tabId;
            await this.getEventsByTabId(this.selectedTabId);
            /**
         * Hash of filtering log window should be updated to focus on the active browser tab.
         * Because after manual changing of TabSelector's tab,
         * location.hash of the filtering log window does not change.
         * https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2482
         */ document.location.hash = String(tabId);
        });
        _define_property(this, "synchronizeOpenTabs", async ()=>{
            const tabsInfo = await messenger/* messenger.synchronizeOpenTabs */.d.synchronizeOpenTabs();
            (0,mobx_esm/* runInAction */.z)(()=>{
                tabsInfo.forEach((tabInfo)=>{
                    this.tabsMap[tabInfo.tabId] = tabInfo;
                });
            });
        });
        _define_property(this, "getFilteringLogData", async ()=>{
            const { filtersMetadata, settings, preserveLogEnabled } = await messenger/* messenger.getFilteringLogData */.d.getFilteringLogData();
            (0,mobx_esm/* runInAction */.z)(()=>{
                this.filtersMetadata = filtersMetadata;
                this.settings = settings;
                this.preserveLogEnabled = preserveLogEnabled;
            });
        });
        _define_property(this, "getFilteringLogEvents", async ()=>{
            if (!this.selectedTabId) {
                return;
            }
            await this.getEventsByTabId(this.selectedTabId);
        });
        /**
     * Clears filtering events ignoring preserve log.
     *
     * @returns {Promise<void>}
     */ _define_property(this, "clearFilteringEvents", async ()=>{
            if (this.selectedTabId === null) {
                common_logger/* logger.error */.k.error('[clearFilteringEvents]: selected tab id is not defined');
                return;
            }
            const ignorePreserveLog = true;
            await messenger/* messenger.clearEventsByTabId */.d.clearEventsByTabId(this.selectedTabId, ignorePreserveLog);
            (0,mobx_esm/* runInAction */.z)(()=>{
                this.filteringEvents = [];
            });
        });
        _define_property(this, "setEventsSearchValue", (value)=>{
            this.eventsSearchValue = value;
        });
        _define_property(this, "refreshPage", async ()=>{
            if (this.selectedTabId === null) {
                common_logger/* logger.error */.k.error('[clearFilteringEvents]: selected tab id is not defined');
                return;
            }
            if (this.selectedTabId === constants/* BACKGROUND_TAB_ID */.HB) {
                await messenger/* messenger.clearEventsByTabId */.d.clearEventsByTabId(this.selectedTabId);
                return;
            }
            await messenger/* messenger.refreshPage */.d.refreshPage(this.selectedTabId);
        });
        _define_property(this, "setPreserveLog", async (state)=>{
            await messenger/* messenger.setPreserveLogState */.d.setPreserveLogState(state);
            (0,mobx_esm/* runInAction */.z)(()=>{
                this.preserveLogEnabled = state;
            });
        });
        _define_property(this, "handleSelectEvent", (eventId)=>{
            if (this.selectedEvent && this.rootStore.wizardStore.isModalOpen && eventId === this.selectedEvent.eventId) {
                this.selectedEvent = null;
                this.rootStore.wizardStore.closeModal();
                return;
            }
            this.rootStore.wizardStore.setAddedRuleState(null);
            this.setSelectedEventById(eventId);
            this.rootStore.wizardStore.openModal();
        });
        _define_property(this, "setSelectedEventById", (eventId)=>{
            this.selectedEvent = lodash_es_find(this.filteringEvents, {
                eventId
            }) || null;
        });
        _define_property(this, "removeSelectedEvent", ()=>{
            this.selectedEvent = null;
        });
        this.rootStore = rootStore;
        (0,mobx_esm/* makeObservable */.rC)(this);
    }
}
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "filteringEvents", void 0);
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "tabsMap", void 0);
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "selectedTabId", void 0);
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "eventsSearchValue", void 0);
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "preserveLogEnabled", void 0);
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "selectedEvent", void 0);
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "filtersMetadata", void 0);
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "settings", void 0);
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "miscellaneousFilters", void 0);
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "requestSourceFilters", void 0);
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "eventTypesFilters", void 0);
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "selectIsOpen", void 0);
_ts_decorate([
    mobx_esm/* observable */.LO
], LogStore.prototype, "prevTabs", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "setMiscellaneousFilters", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "setRequestSourceFilters", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "setEventTypesFilters", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "resetAllFilters", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "onTabUpdate", null);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "onTabClose", null);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "onTabReset", null);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "onSettingUpdated", null);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "setSelectIsOpenState", void 0);
_ts_decorate([
    mobx_esm/* computed */.Fl
], LogStore.prototype, "tabs", null);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "getEventsByTabId", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "setSelectedTabId", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "synchronizeOpenTabs", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "getFilteringLogData", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "getFilteringLogEvents", void 0);
_ts_decorate([
    mobx_esm/* computed */.Fl
], LogStore.prototype, "events", null);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "clearFilteringEvents", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "setEventsSearchValue", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "refreshPage", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "setPreserveLog", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "handleSelectEvent", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "setSelectedEventById", void 0);
_ts_decorate([
    mobx_esm/* action */.aD
], LogStore.prototype, "removeSelectedEvent", void 0);
_ts_decorate([
    mobx_esm/* computed */.Fl
], LogStore.prototype, "appearanceTheme", null);


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/constants.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ const RULE_CREATION_OPTION = {
    DOMAIN: 'ruleDomain',
    IMPORTANT: 'ruleImportant',
    THIRD_PARTY: 'ruleThirdParty',
    REMOVE_PARAM: 'ruleRemoveParam'
};
const LINE_COUNT_LIMIT = {
    REQUEST_URL: 3,
    RULE: 8
};
const DEFAULT_MODAL_WIDTH_PX = 460;
const COMMA_DELIMITER = ',';

// EXTERNAL MODULE: ./node_modules/.pnpm/@adguard+tsurlfilter@3.1.0-alpha.7_@adguard+re2-wasm@1.2.0/node_modules/@adguard/tsurlfilter/dist/es/index.js + 2 modules
var es = __webpack_require__(37302);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/ruleCreators.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 






/**
 * Possible cosmetic rule markers.
 */ var CosmeticRuleMarker = /*#__PURE__*/ function(CosmeticRuleMarker) {
    CosmeticRuleMarker["Css"] = "#$#";
    CosmeticRuleMarker["ElementHidingExtCSS"] = "#?#";
    CosmeticRuleMarker["CssExtCSS"] = "#$?#";
    CosmeticRuleMarker["ElementHiding"] = "##";
    CosmeticRuleMarker["Js"] = "#%#";
    CosmeticRuleMarker["Html"] = "$$";
    return CosmeticRuleMarker;
}(CosmeticRuleMarker || {});
/**
 * Splits request url by backslash to block or allow patterns.
 *
 * @param requestUrl Request event url.
 * @param domain Request event domain.
 * @param isAllowlist Flag determining if patterns would be blocking or allowing.
 *
 * @returns Array of patterns.
 */ const splitToPatterns = (requestUrl, domain, isAllowlist)=>{
    const PATTERNS_COUNT = 2;
    const hierarchicUrl = UrlUtils.isHierarchicUrl(requestUrl);
    let prefix;
    if (hierarchicUrl) {
        prefix = es.SimpleRegex.MASK_START_URL; // Covers default protocols: http, ws
    } else {
        prefix = UrlUtils.getProtocol(requestUrl); // Covers non-default protocols: stun, turn
    }
    if (isAllowlist) {
        prefix = es/* NetworkRule.MASK_ALLOWLIST */.nC.MASK_ALLOWLIST + prefix;
    }
    const patterns = [];
    const relative = strings.substringAfter(requestUrl, `${domain}/`);
    const path = strings.substringBefore(relative, '?');
    if (path) {
        const parts = path.split('/');
        let pattern = `${domain}/`;
        for(let i = 0; i < Math.min(parts.length - 1, PATTERNS_COUNT); i += 1){
            pattern += `${parts[i]}/`;
            patterns.push(prefix + pattern);
        }
        const file = parts[parts.length - 1];
        if (file && patterns.length < PATTERNS_COUNT) {
            pattern += file;
            patterns.push(prefix + pattern);
        }
    }
    // add domain pattern to start
    patterns.unshift(prefix + domain + es.SimpleRegex.MASK_SEPARATOR);
    // add 2LD to start, if it differs from the current one
    const secondLevelDomain = domain.split('.').slice(-2).join('.');
    if (secondLevelDomain !== domain) {
        patterns.unshift(prefix + secondLevelDomain + es.SimpleRegex.MASK_SEPARATOR);
    }
    // push full url pattern
    const url = UrlUtils.getUrlWithoutScheme(requestUrl);
    if (`${domain}/` !== url) {
        if (patterns.indexOf(prefix + url) < 0) {
            patterns.push(prefix + url);
        }
    }
    return patterns.reverse();
};
/**
 * Creates rule blocking document level rules
 * e.g. for rule "@@||example.org^$urlblock" ->
 *      blocking rule would be " @@||example.org^$urlblock,badfilter"
 *
 * @param rule
 * @returns {string}
 */ const createDocumentLevelBlockRule = (rule)=>{
    const { appliedRuleText } = rule;
    if (appliedRuleText && appliedRuleText.indexOf(es/* NetworkRule.OPTIONS_DELIMITER */.nC.OPTIONS_DELIMITER) > -1) {
        return `${appliedRuleText},${es/* NetworkRule.OPTIONS.BADFILTER */.nC.OPTIONS.BADFILTER}`;
    }
    return appliedRuleText + es/* NetworkRule.OPTIONS_DELIMITER */.nC.OPTIONS_DELIMITER + es/* NetworkRule.OPTIONS.BADFILTER */.nC.OPTIONS.BADFILTER;
};
/**
 * Generates exception rule with required mask.
 *
 * @param appliedRuleText Rule text.
 * @param mask Mask to be inserted.
 *
 * @returns Exception rule.
 */ const generateExceptionRule = (appliedRuleText, mask)=>{
    const insert = (str, index, value)=>{
        return str.slice(0, index) + value + str.slice(index);
    };
    const maskIndex = appliedRuleText.indexOf(mask);
    const maskLength = mask.length;
    const rulePart = appliedRuleText.slice(maskIndex + maskLength);
    // insert exception mark after first char
    const exceptionMask = insert(mask, 1, '@');
    return exceptionMask + rulePart;
};
/**
 * Creates exception rules for css rule.
 *
 * @param rule Css rule.
 * @param event Filtering log event.
 * @returns Exception rule for css rule.
 */ const createExceptionCssRule = (rule, event)=>{
    if (!rule || !rule.appliedRuleText) {
        common_logger/* logger.error */.k.error(`Cannot create css exception rule for an event with id: ${event.eventId} because rule is not defined or appliedRuleText is not defined.`);
        return '';
    }
    const { appliedRuleText } = rule;
    const domainPart = event.frameDomain;
    if (appliedRuleText.indexOf("#$#") > -1) {
        return domainPart + generateExceptionRule(appliedRuleText, "#$#");
    }
    if (appliedRuleText.indexOf("#?#") > -1) {
        return domainPart + generateExceptionRule(appliedRuleText, "#?#");
    }
    if (appliedRuleText.indexOf("#$?#") > -1) {
        return domainPart + generateExceptionRule(appliedRuleText, "#$?#");
    }
    if (appliedRuleText.indexOf("##") > -1) {
        return domainPart + generateExceptionRule(appliedRuleText, "##");
    }
    if (appliedRuleText.indexOf("$$") > -1) {
        return domainPart + generateExceptionRule(appliedRuleText, "$$");
    }
    common_logger/* logger.error */.k.error('Cannot createExceptionCssRule for the rule:', rule);
    return '';
};
/**
 * Creates exception rule for blocking script rule
 *
 * @param rule
 * @param event
 * @returns {string}
 */ const createExceptionScriptRule = (rule, event)=>{
    if (!rule || !rule.appliedRuleText) {
        common_logger/* logger.error */.k.error(`Cannot create exception blocking script rule for an event with id: ${event.eventId} because rule is not defined or appliedRuleText is not defined.`);
        return '';
    }
    const { appliedRuleText } = rule;
    const domainPart = event.frameDomain;
    if (appliedRuleText.indexOf("#%#") > -1) {
        return domainPart + generateExceptionRule(appliedRuleText, "#%#");
    }
    const MASK_SCRIPT_RULE_UBO = "##";
    if (appliedRuleText.indexOf(MASK_SCRIPT_RULE_UBO) > -1) {
        return domainPart + generateExceptionRule(appliedRuleText, MASK_SCRIPT_RULE_UBO);
    }
    return '';
};
const getBlockDomainRule = (domain, ruleOption)=>{
    const { MASK_START_URL, MASK_SEPARATOR } = es.SimpleRegex;
    return `${MASK_START_URL}${domain}${MASK_SEPARATOR}${es/* NetworkRule.OPTIONS_DELIMITER */.nC.OPTIONS_DELIMITER}${ruleOption}`;
};
const getUnblockDomainRule = (rawDomain, ruleOption)=>{
    const domain = rawDomain || '';
    return es/* NetworkRule.MASK_ALLOWLIST */.nC.MASK_ALLOWLIST + getBlockDomainRule(domain, ruleOption);
};
/**
 * Creates exception rules for cookie event.
 *
 * @param event Filtering log event.
 * @returns Array of patterns.
 */ const createExceptionCookieRules = (event)=>{
    const { frameDomain, cookieName, requestRule } = event;
    const patterns = [];
    const domain = UrlUtils.getCookieDomain(frameDomain);
    if (cookieName) {
        patterns.push(getUnblockDomainRule(domain, `${es/* NetworkRule.OPTIONS.COOKIE */.nC.OPTIONS.COOKIE}=${cookieName}`));
    }
    if (requestRule && requestRule.modifierValue && requestRule.modifierValue !== cookieName) {
        patterns.push(getUnblockDomainRule(domain, `${es/* NetworkRule.OPTIONS.COOKIE */.nC.OPTIONS.COOKIE}=${requestRule.modifierValue}`));
    }
    patterns.push(getUnblockDomainRule(domain, es/* NetworkRule.OPTIONS.COOKIE */.nC.OPTIONS.COOKIE));
    return patterns;
};
// TODO: these could be refactored into one createExceptionAdvancedModifierRules
const createExceptionRemoveParamRules = (event)=>{
    const { frameDomain, requestRule } = event;
    const patterns = [];
    if (requestRule && requestRule.modifierValue) {
        patterns.push(getUnblockDomainRule(frameDomain, `${es/* NetworkRule.OPTIONS.REMOVEPARAM */.nC.OPTIONS.REMOVEPARAM}=${requestRule.modifierValue}`));
    }
    patterns.push(getUnblockDomainRule(frameDomain, es/* NetworkRule.OPTIONS.REMOVEPARAM */.nC.OPTIONS.REMOVEPARAM));
    return patterns;
};
const createExceptionRemoveHeaderRules = (event)=>{
    const { frameDomain, requestRule } = event;
    const patterns = [];
    if (requestRule && requestRule.modifierValue) {
        patterns.push(getUnblockDomainRule(frameDomain, `${es/* NetworkRule.OPTIONS.REMOVEHEADER */.nC.OPTIONS.REMOVEHEADER}=${requestRule.modifierValue}`));
    }
    patterns.push(getUnblockDomainRule(frameDomain, es/* NetworkRule.OPTIONS.REMOVEHEADER */.nC.OPTIONS.REMOVEHEADER));
    return patterns;
};
const createExceptionCspRules = (event)=>{
    const { frameDomain, requestRule } = event;
    const patterns = [];
    if (requestRule && requestRule.modifierValue) {
        patterns.push(getUnblockDomainRule(frameDomain, `${es/* NetworkRule.OPTIONS.CSP */.nC.OPTIONS.CSP}=${requestRule.modifierValue}`));
    }
    patterns.push(getUnblockDomainRule(frameDomain, es/* NetworkRule.OPTIONS.CSP */.nC.OPTIONS.CSP));
    return patterns;
};
/**
 * Creates blocking rule for cookie event
 *
 * @param event
 * @returns {string}
 */ const createBlockingCookieRule = (event)=>{
    const { frameDomain, cookieName } = event;
    const patterns = [];
    const domain = UrlUtils.getCookieDomain(frameDomain);
    const blockingRule = getBlockDomainRule(domain, es/* NetworkRule.OPTIONS.COOKIE */.nC.OPTIONS.COOKIE);
    if (cookieName) {
        patterns.push(getBlockDomainRule(domain, `${es/* NetworkRule.OPTIONS.COOKIE */.nC.OPTIONS.COOKIE}=${cookieName}`));
    }
    patterns.push(blockingRule);
    return patterns;
};
const createRuleFromParams = ({ urlPattern, urlDomain, thirdParty, important, removeParam })=>{
    let appliedRuleText = urlPattern || '';
    const options = [];
    // add domain option
    if (urlDomain) {
        options.push(`${es/* NETWORK_RULE_OPTIONS.DOMAIN */.Ig.DOMAIN}=${urlDomain}`);
    }
    // add important option
    if (important) {
        options.push(es/* NETWORK_RULE_OPTIONS.IMPORTANT */.Ig.IMPORTANT);
    }
    // add third party option
    if (thirdParty) {
        options.push(es/* NETWORK_RULE_OPTIONS.THIRD_PARTY */.Ig.THIRD_PARTY);
    }
    // add removeparam option
    if (removeParam) {
        options.push(es/* NETWORK_RULE_OPTIONS.REMOVEPARAM */.Ig.REMOVEPARAM);
    }
    if (options.length > 0) {
        // Pick correct symbol to append options with
        const hasOptions = appliedRuleText.includes(es/* OPTIONS_DELIMITER */.lN);
        const prefix = hasOptions ? COMMA_DELIMITER : es/* OPTIONS_DELIMITER */.lN;
        appliedRuleText += prefix + options.join(COMMA_DELIMITER);
    }
    return appliedRuleText;
};
const createCssRuleFromParams = (urlPattern, permitDomain)=>{
    let appliedRuleText = urlPattern;
    if (!permitDomain) {
        appliedRuleText = appliedRuleText.slice(appliedRuleText.indexOf('#'));
    }
    return appliedRuleText;
};
const createCookieRuleFromParams = ({ rulePattern, thirdParty, important })=>{
    let appliedRuleText = rulePattern;
    const options = [];
    // add important option
    if (important) {
        options.push(es/* NETWORK_RULE_OPTIONS.IMPORTANT */.Ig.IMPORTANT);
    }
    // add third party option
    if (thirdParty) {
        options.push(es/* NETWORK_RULE_OPTIONS.THIRD_PARTY */.Ig.THIRD_PARTY);
    }
    if (options.length > 0) {
        appliedRuleText += COMMA_DELIMITER + options.join(COMMA_DELIMITER);
    }
    return appliedRuleText;
};
const getRuleText = (selectedEvent, rulePattern, ruleOptions)=>{
    var _selectedEvent_requestRule;
    if (!selectedEvent) {
        return '';
    }
    const { ruleDomain, ruleImportant, ruleThirdParty, ruleRemoveParam } = ruleOptions;
    const permitDomain = !(ruleDomain === null || ruleDomain === void 0 ? void 0 : ruleDomain.checked);
    const important = !!(ruleImportant === null || ruleImportant === void 0 ? void 0 : ruleImportant.checked);
    const thirdParty = !!(ruleThirdParty === null || ruleThirdParty === void 0 ? void 0 : ruleThirdParty.checked);
    const removeParam = !!(ruleRemoveParam === null || ruleRemoveParam === void 0 ? void 0 : ruleRemoveParam.checked);
    const domain = permitDomain ? selectedEvent.frameDomain : null;
    let appliedRuleText;
    if (selectedEvent.element) {
        appliedRuleText = createCssRuleFromParams(rulePattern, permitDomain);
    } else if (selectedEvent.cookieName) {
        appliedRuleText = createCookieRuleFromParams({
            rulePattern,
            thirdParty,
            important
        });
    } else if (selectedEvent.script || (selectedEvent === null || selectedEvent === void 0 ? void 0 : (_selectedEvent_requestRule = selectedEvent.requestRule) === null || _selectedEvent_requestRule === void 0 ? void 0 : _selectedEvent_requestRule.documentLevelRule)) {
        appliedRuleText = createRuleFromParams({
            urlPattern: rulePattern
        });
    } else {
        appliedRuleText = createRuleFromParams({
            urlPattern: rulePattern,
            urlDomain: domain,
            thirdParty,
            important,
            removeParam
        });
    }
    return appliedRuleText;
};

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/constants.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ var WizardRequestState = /*#__PURE__*/ function(WizardRequestState) {
    WizardRequestState["View"] = "view.request";
    WizardRequestState["Block"] = "block.request";
    WizardRequestState["Unblock"] = "unblock.request";
    WizardRequestState["Preview"] = "preview.request";
    return WizardRequestState;
}({});
var AddedRuleState = /*#__PURE__*/ function(AddedRuleState) {
    AddedRuleState["Block"] = "block";
    AddedRuleState["Unblock"] = "unblock";
    return AddedRuleState;
}({});

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/stores/WizardStore.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ function WizardStore_define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function WizardStore_ts_decorate(decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
}







const defaultRuleOptions = {
    [RULE_CREATION_OPTION.DOMAIN]: {
        checked: false
    },
    [RULE_CREATION_OPTION.THIRD_PARTY]: {
        checked: false
    },
    [RULE_CREATION_OPTION.IMPORTANT]: {
        checked: false
    },
    [RULE_CREATION_OPTION.REMOVE_PARAM]: null
};
class WizardStore {
    get requestModalStateEnum() {
        /* should have only one true value */ return {
            isBlock: this.requestModalState === WizardRequestState.Block,
            isUnblock: this.requestModalState === WizardRequestState.Unblock,
            isView: this.requestModalState === WizardRequestState.View
        };
    }
    setActionSubmitted(value) {
        this.isActionSubmitted = value;
    }
    updateRuleOptions() {
        const { selectedEvent } = this.rootStore.logStore;
        if (!selectedEvent) {
            return;
        }
        const { requestRule } = selectedEvent;
        const isImportant = !!(requestRule && (requestRule.allowlistRule || requestRule.isImportant) && !requestRule.documentLevelRule);
        this.ruleOptions = {
            [RULE_CREATION_OPTION.DOMAIN]: {
                checked: false
            },
            [RULE_CREATION_OPTION.THIRD_PARTY]: {
                checked: false
            },
            [RULE_CREATION_OPTION.IMPORTANT]: {
                checked: isImportant
            },
            [RULE_CREATION_OPTION.REMOVE_PARAM]: {
                checked: false
            }
        };
    }
    openModal() {
        this.isModalOpen = true;
        this.requestModalState = WizardRequestState.View;
        this.updateRuleOptions();
    }
    setBlockState() {
        this.requestModalState = WizardRequestState.Block;
    }
    setUnblockState() {
        this.requestModalState = WizardRequestState.Unblock;
    }
    setAddedRuleState(nextAddedRuleState) {
        this.addedRuleState = nextAddedRuleState;
        this.requestModalState = WizardRequestState.View;
    }
    setPreviewState() {
        this.requestModalState = WizardRequestState.Preview;
    }
    setViewState() {
        this.requestModalState = WizardRequestState.View;
    }
    setRulePattern(rulePattern) {
        // on every rule pattern change we reset rule text inserted manually
        this.ruleText = null;
        this.rulePattern = rulePattern;
    }
    setRuleText(ruleText) {
        this.ruleText = ruleText;
    }
    get rule() {
        const { logStore } = this.rootStore;
        // If the rule was edited by the user, it will be returned as is
        return this.ruleText === null ? getRuleText(logStore.selectedEvent, this.rulePattern, this.ruleOptions) : this.ruleText;
    }
    get rulePatterns() {
        const { selectedEvent } = this.rootStore.logStore;
        if (!selectedEvent) {
            return [];
        }
        if (this.requestModalState === WizardRequestState.Unblock) {
            let patterns = [];
            if (selectedEvent.requestUrl && selectedEvent.requestDomain) {
                patterns = splitToPatterns(selectedEvent.requestUrl, selectedEvent.requestDomain, true);
            }
            if (selectedEvent.element) {
                patterns = [
                    createExceptionCssRule(selectedEvent.requestRule, selectedEvent)
                ];
            }
            if (selectedEvent.cookieName) {
                patterns = createExceptionCookieRules(selectedEvent);
            }
            if (selectedEvent.script) {
                patterns = [
                    createExceptionScriptRule(selectedEvent.requestRule, selectedEvent)
                ];
            }
            if (selectedEvent.removeParam) {
                patterns = createExceptionRemoveParamRules(selectedEvent);
            }
            if (selectedEvent.removeHeader) {
                patterns = createExceptionRemoveHeaderRules(selectedEvent);
            }
            if (selectedEvent.requestType === index_mv3/* ContentType.Csp */.zc.Csp) {
                patterns = createExceptionCspRules(selectedEvent);
            }
            if (patterns[0]) {
                this.setRulePattern(patterns[0]);
            }
            return patterns;
        }
        let patterns = [];
        if (selectedEvent.requestUrl && selectedEvent.requestDomain) {
            patterns = splitToPatterns(selectedEvent.requestUrl, selectedEvent.requestDomain, false);
        } else if (selectedEvent.cookieName) {
            patterns = createBlockingCookieRule(selectedEvent);
        }
        if (selectedEvent.requestRule && selectedEvent.requestRule.documentLevelRule) {
            patterns = [
                createDocumentLevelBlockRule(selectedEvent.requestRule)
            ];
        }
        if (patterns[0]) {
            this.setRulePattern(patterns[0]);
        }
        return patterns;
    }
    setRuleOptionState(optionId, checked) {
        // on every rule pattern change we reset rule text inserted manually
        this.ruleText = null;
        // @ts-ignore
        this.ruleOptions[optionId].checked = checked;
    }
    constructor(rootStore){
        WizardStore_define_property(this, "rootStore", void 0);
        WizardStore_define_property(this, "isModalOpen", false);
        WizardStore_define_property(this, "requestModalState", WizardRequestState.View);
        WizardStore_define_property(this, "ruleText", null);
        WizardStore_define_property(this, "rulePattern", '');
        WizardStore_define_property(this, "ruleOptions", defaultRuleOptions);
        WizardStore_define_property(this, "addedRuleState", null);
        /**
     * Whether the rule for the specified request is now applied or deleted
     */ WizardStore_define_property(this, "isActionSubmitted", false);
        WizardStore_define_property(this, "closeModal", ()=>{
            this.isActionSubmitted = false;
            this.isModalOpen = false;
            this.addedRuleState = null;
            this.requestModalState = WizardRequestState.View;
            this.rootStore.logStore.removeSelectedEvent();
        });
        WizardStore_define_property(this, "removeFromAllowlistHandler", async ()=>{
            this.setActionSubmitted(true);
            const { selectedTabId } = this.rootStore.logStore;
            if (!selectedTabId) {
                common_logger/* logger.error */.k.error('[removeFromAllowlistHandler]: selected tab id is not defined');
                return;
            }
            await messenger/* messenger.removeAllowlistDomain */.d.removeAllowlistDomain(selectedTabId, false);
            this.closeModal();
        });
        WizardStore_define_property(this, "removeFromUserFilterHandler", async (filteringEvent)=>{
            this.setActionSubmitted(true);
            const { requestRule } = filteringEvent;
            if (!requestRule) {
                return;
            }
            var _requestRule_originalRuleText;
            const ruleText = (_requestRule_originalRuleText = requestRule.originalRuleText) !== null && _requestRule_originalRuleText !== void 0 ? _requestRule_originalRuleText : requestRule.appliedRuleText;
            if (!ruleText) {
                common_logger/* logger.error */.k.error('[removeFromUserFilterHandler]: rule text is not defined');
                return;
            }
            await messenger/* messenger.removeUserRule */.d.removeUserRule(ruleText);
            this.closeModal();
        });
        WizardStore_define_property(this, "removeAddedRuleFromUserFilter", async ()=>{
            this.setActionSubmitted(true);
            if (!this.rule) {
                return;
            }
            await messenger/* messenger.removeUserRule */.d.removeUserRule(this.rule);
            this.closeModal();
        });
        this.rootStore = rootStore;
        (0,mobx_esm/* makeObservable */.rC)(this);
    }
}
WizardStore_ts_decorate([
    mobx_esm/* observable */.LO
], WizardStore.prototype, "isModalOpen", void 0);
WizardStore_ts_decorate([
    mobx_esm/* observable */.LO
], WizardStore.prototype, "requestModalState", void 0);
WizardStore_ts_decorate([
    mobx_esm/* observable */.LO
], WizardStore.prototype, "ruleText", void 0);
WizardStore_ts_decorate([
    mobx_esm/* observable */.LO
], WizardStore.prototype, "rulePattern", void 0);
WizardStore_ts_decorate([
    mobx_esm/* observable */.LO
], WizardStore.prototype, "ruleOptions", void 0);
WizardStore_ts_decorate([
    mobx_esm/* observable */.LO
], WizardStore.prototype, "addedRuleState", void 0);
WizardStore_ts_decorate([
    mobx_esm/* observable */.LO
], WizardStore.prototype, "isActionSubmitted", void 0);
WizardStore_ts_decorate([
    mobx_esm/* computed */.Fl
], WizardStore.prototype, "requestModalStateEnum", null);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "setActionSubmitted", null);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "updateRuleOptions", null);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "openModal", null);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "closeModal", void 0);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "setBlockState", null);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "setUnblockState", null);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "setAddedRuleState", null);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "setPreviewState", null);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "removeFromAllowlistHandler", void 0);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "removeFromUserFilterHandler", void 0);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "removeAddedRuleFromUserFilter", void 0);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "setViewState", null);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "setRulePattern", null);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "setRuleText", null);
WizardStore_ts_decorate([
    mobx_esm/* computed */.Fl
], WizardStore.prototype, "rule", null);
WizardStore_ts_decorate([
    mobx_esm/* computed */.Fl
], WizardStore.prototype, "rulePatterns", null);
WizardStore_ts_decorate([
    mobx_esm/* action */.aD
], WizardStore.prototype, "setRuleOptionState", null);


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/stores/RootStore.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ function RootStore_define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}




// Do not allow property change outside of store actions
(0,mobx_esm/* configure */.jQ)({
    enforceActions: 'observed'
});
class RootStore {
    constructor(){
        RootStore_define_property(this, "logStore", void 0);
        RootStore_define_property(this, "wizardStore", void 0);
        this.logStore = new LogStore(this);
        this.wizardStore = new WizardStore(this);
    }
}
const rootStore = (0,react.createContext)(new RootStore());

// EXTERNAL MODULE: ./Extension/src/pages/common/components/ui/Icon.tsx
var Icon = __webpack_require__(85464);
// EXTERNAL MODULE: ./Extension/src/pages/common/components/ui/Popover/index.ts
var Popover = __webpack_require__(70006);
// EXTERNAL MODULE: ./Extension/src/common/user-agent.ts
var user_agent = __webpack_require__(12855);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
var injectStylesIntoStyleTag = __webpack_require__(2829);
var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/styleDomAPI.js
var styleDomAPI = __webpack_require__(65281);
var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/insertBySelector.js
var insertBySelector = __webpack_require__(29927);
var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js
var setAttributesWithoutAttributes = __webpack_require__(68323);
var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/insertStyleElement.js
var insertStyleElement = __webpack_require__(53062);
var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/styleTagTransform.js
var styleTagTransform = __webpack_require__(84051);
var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform);
// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/Search/search.pcss
var search = __webpack_require__(41019);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Search/search.pcss

      
      
      
      
      
      
      
      
      

var options = {};

options.styleTagTransform = (styleTagTransform_default());
options.setAttributes = (setAttributesWithoutAttributes_default());

      options.insert = insertBySelector_default().bind(null, "head");
    
options.domAPI = (styleDomAPI_default());
options.insertStyleElement = (insertStyleElement_default());

var update = injectStylesIntoStyleTag_default()(search/* default */.Z, options);




       /* harmony default export */ const Search_search = (search/* default */.Z && search/* default.locals */.Z.locals ? search/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Search/Search.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 





const Search = /*#__PURE__*/ (0,react.forwardRef)(({ changeHandler, handleClear, onFocus, value, placeholder, select, onOpenSelect }, passedRef)=>{
    const localSearchInputRef = (0,react.useRef)(null);
    (0,react.useEffect)(()=>{
        const modifierKeyProperty = user_agent/* UserAgent.isMacOs */.Z.isMacOs ? 'metaKey' : 'ctrlKey';
        const handleSearchHotkey = (e)=>{
            const { code } = e;
            if (e[modifierKeyProperty] && code === 'KeyF') {
                e.preventDefault();
                localSearchInputRef.current.focus();
                localSearchInputRef.current.select();
            }
        };
        window.addEventListener('keydown', handleSearchHotkey);
        return function onUnmount() {
            window.removeEventListener('keydown', handleSearchHotkey);
        };
    }, [
        localSearchInputRef
    ]);
    const onSubmit = (e)=>{
        e.preventDefault();
    };
    const onChange = (e)=>{
        changeHandler(e);
    };
    const onClear = ()=>{
        localSearchInputRef.current.focus();
        if (handleClear) {
            handleClear();
        }
    };
    const Control = ()=>{
        if (value && !select) {
            return /*#__PURE__*/ react.createElement("button", {
                type: "button",
                className: "button search__clear",
                "aria-label": reactTranslator/* reactTranslator.getMessage */._.getMessage('close_button_title'),
                onClick: onClear
            }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
                id: "#cross",
                classname: "icon--24 icon--gray-default"
            }));
        }
        // Render with tab selector search in drop-down menu
        if (select) {
            return /*#__PURE__*/ react.createElement("button", {
                type: "button",
                className: "search__btn"
            }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
                id: "#arrow-down",
                classname: classnames_default()('icon--24 icon--gray-default search__ico', onOpenSelect ? 'search__arrow-up' : 'search__arrow-down')
            }));
        }
        return /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
            id: "#magnifying",
            classname: "icon--24 icon--gray-default search__ico"
        });
    };
    return /*#__PURE__*/ react.createElement("form", {
        className: "search",
        onSubmit: onSubmit
    }, /*#__PURE__*/ react.createElement(Control, null), /*#__PURE__*/ react.createElement("input", {
        type: "text",
        id: "log-search",
        name: "log-search",
        className: "search__input",
        placeholder: placeholder,
        ref: passedRef || localSearchInputRef,
        onChange: onChange,
        onFocus: onFocus,
        value: value,
        autoComplete: "off"
    }));
});


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Search/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/EventsSearch/EventsSearch.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 




const EventsSearch = (0,mobxreact_esm/* observer */.Pi)(()=>{
    const { logStore } = (0,react.useContext)(rootStore);
    const changeHandler = (e)=>{
        logStore.setEventsSearchValue(e.currentTarget.value);
    };
    const handleClear = ()=>{
        logStore.setEventsSearchValue('');
    };
    return /*#__PURE__*/ react.createElement(Search, {
        changeHandler: changeHandler,
        handleClear: handleClear,
        value: logStore.eventsSearchValue,
        placeholder: reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_log_search_string')
    });
});


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/EventsSearch/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

// EXTERNAL MODULE: ./Extension/src/pages/common/hooks/useOutsideClick.js
var useOutsideClick = __webpack_require__(78424);
// EXTERNAL MODULE: ./Extension/src/pages/common/hooks/useOutsideFocus.js
var useOutsideFocus = __webpack_require__(39239);
;// CONCATENATED MODULE: ./Extension/src/pages/common/hooks/useKeyDown.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const useKeyDown = (ref, key, callback)=>{
    const handleKeyDown = (0,react.useCallback)((e)=>{
        if (ref.current && e.key === key) {
            callback();
        }
    }, [
        ref,
        key,
        callback
    ]);
    (0,react.useEffect)(()=>{
        document.addEventListener('keydown', handleKeyDown);
        return ()=>{
            document.removeEventListener('keydown', handleKeyDown);
        };
    }, [
        handleKeyDown
    ]);
};

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/Filters/TabSelector/tab-selector.pcss
var tab_selector = __webpack_require__(35356);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/TabSelector/tab-selector.pcss

      
      
      
      
      
      
      
      
      

var tab_selector_options = {};

tab_selector_options.styleTagTransform = (styleTagTransform_default());
tab_selector_options.setAttributes = (setAttributesWithoutAttributes_default());

      tab_selector_options.insert = insertBySelector_default().bind(null, "head");
    
tab_selector_options.domAPI = (styleDomAPI_default());
tab_selector_options.insertStyleElement = (insertStyleElement_default());

var tab_selector_update = injectStylesIntoStyleTag_default()(tab_selector/* default */.Z, tab_selector_options);




       /* harmony default export */ const TabSelector_tab_selector = (tab_selector/* default */.Z && tab_selector/* default.locals */.Z.locals ? tab_selector/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/TabSelector/TabSelector.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ /*
eslint-disable jsx-a11y/click-events-have-key-events,
jsx-a11y/no-noninteractive-element-interactions
*/ 











const TabSelector = (0,mobxreact_esm/* observer */.Pi)(()=>{
    const { logStore, wizardStore } = (0,react.useContext)(rootStore);
    const refSelector = (0,react.useRef)(null);
    const refResult = (0,react.useRef)(null);
    const searchInputRef = (0,react.useRef)(null);
    const { tabs, selectedTabId, selectIsOpen } = logStore;
    const [prevTabTitle, setPrevTabTitle] = (0,react.useState)('');
    const [searchValue, setSearchValue] = (0,react.useState)('');
    const [resultItems, setResultItems] = (0,react.useState)([]);
    const [currentStep, setCurrentStep] = (0,react.useState)(0);
    const SELECTED_CLASS_NAME = 'selected';
    (0,react.useEffect)(()=>{
        var _refResult_current;
        if ((_refResult_current = refResult.current) === null || _refResult_current === void 0 ? void 0 : _refResult_current.childNodes) {
            setResultItems(Array.from(refResult.current.childNodes));
        }
    }, [
        selectIsOpen,
        searchValue
    ]);
    (0,react.useEffect)(()=>{
        if (resultItems) {
            resultItems.forEach((el)=>el.classList.remove(SELECTED_CLASS_NAME));
            const currentEl = resultItems[currentStep];
            currentEl === null || currentEl === void 0 ? void 0 : currentEl.classList.add(SELECTED_CLASS_NAME);
            currentEl === null || currentEl === void 0 ? void 0 : currentEl.scrollIntoView({
                block: 'nearest',
                behavior: 'smooth'
            });
        }
    }, [
        currentStep,
        resultItems
    ]);
    const cancelTabSearch = ()=>{
        if (!tabs.find((tab)=>tab.title === searchValue)) {
            setSearchValue(prevTabTitle);
        }
        if (selectIsOpen) {
            logStore.setSelectIsOpenState(false);
        }
        setCurrentStep(0);
    };
    const quitTabSearch = ()=>{
        cancelTabSearch();
        document.activeElement.blur();
    };
    useKeyDown(refResult, 'Escape', ()=>{
        if (searchValue.length === 0) {
            quitTabSearch();
        } else {
            setSearchValue('');
        }
    });
    useKeyDown(refResult, 'Enter', ()=>{
        // Selected with the arrow buttons
        const targetElem = resultItems === null || resultItems === void 0 ? void 0 : resultItems.find((el)=>el.classList.contains(SELECTED_CLASS_NAME));
        // Selected with the tab button
        const activeElem = resultItems === null || resultItems === void 0 ? void 0 : resultItems.find((el)=>el === document.activeElement);
        if (activeElem || targetElem) {
            (async ()=>{
                await selectionHandlerSearch(Number(activeElem ? activeElem.id : targetElem.id));
            })();
            document.activeElement.blur();
        }
    });
    useKeyDown(refResult, 'ArrowDown', ()=>{
        const lastIndex = resultItems.length - 1;
        const step = lastIndex > currentStep ? currentStep + 1 : 0;
        setCurrentStep(step);
    });
    useKeyDown(refResult, 'ArrowUp', ()=>{
        const lastIndex = resultItems.length - 1;
        const step = currentStep > 0 ? currentStep - 1 : lastIndex;
        setCurrentStep(step);
    });
    (0,useOutsideClick/* useOutsideClick */.O)(refSelector, cancelTabSearch);
    (0,useOutsideFocus/* useOutsideFocus */.W)(refSelector, cancelTabSearch);
    (0,react.useEffect)(()=>{
        const selectedTab = tabs.find((tab)=>tab.tabId === selectedTabId);
        const title = (selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.title) || '';
        setPrevTabTitle(title);
        if (!selectIsOpen) {
            setSearchValue(title);
        }
    }, [
        selectedTabId,
        tabs,
        selectIsOpen
    ]);
    const selectionHandlerSearch = async (id)=>{
        logStore.setSelectIsOpenState(false);
        setCurrentStep(0);
        if (selectedTabId === id) {
            setSearchValue(prevTabTitle);
        }
        await logStore.setSelectedTabId(id);
    };
    const renderSearchResult = ()=>{
        const searchValueString = searchValue.replace(constants/* WASTE_CHARACTERS */.XS, '\\$&');
        const searchQuery = new RegExp(searchValueString, 'ig');
        return tabs.map((tab)=>{
            const { title, tabId } = tab;
            const isActive = tabId === selectedTabId;
            const itemTextClassName = classnames_default()('tab-selector__result-item--text', {
                'tab-selector__result-item--text--active': isActive
            });
            if (title.match(searchQuery)) {
                return /*#__PURE__*/ react.createElement("div", {
                    key: tabId,
                    id: tabId,
                    role: "button",
                    className: "tab-selector__result-item",
                    onClick: ()=>{
                        selectionHandlerSearch(tabId);
                    },
                    tabIndex: 0
                }, /*#__PURE__*/ react.createElement("span", {
                    className: itemTextClassName
                }, title), isActive && /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
                    id: "#tick",
                    classname: "icon icon--24 icon--green-default"
                }));
            }
            return null;
        });
    };
    const searchChangeHandler = (e)=>{
        setCurrentStep(0);
        setSearchValue(e.currentTarget.value);
    };
    const handleClear = ()=>{
        setSearchValue('');
        wizardStore.closeModal();
        logStore.setSelectIsOpenState(true);
    };
    const onTabSelectorFocus = ()=>{
        if (selectIsOpen) {
            quitTabSearch();
        } else {
            searchInputRef.current.focus();
        }
    };
    return /*#__PURE__*/ react.createElement("div", {
        id: "tab-selector",
        className: "tab-selector",
        ref: refSelector
    }, /*#__PURE__*/ react.createElement("div", {
        onFocus: onTabSelectorFocus
    }, /*#__PURE__*/ react.createElement(Search, {
        select: true,
        ref: searchInputRef,
        changeHandler: searchChangeHandler,
        value: searchValue,
        placeholder: translator/* translator.getMessage */.O.getMessage('filtering_log_search_tabs_placeholder'),
        handleClear: handleClear,
        onFocus: handleClear,
        onOpenSelect: selectIsOpen
    })), selectIsOpen && /*#__PURE__*/ react.createElement("div", {
        className: "tab-selector__result",
        ref: refResult
    }, renderSearchResult()));
});


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/TabSelector/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/Actions/actions.pcss
var actions = __webpack_require__(45649);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Actions/actions.pcss

      
      
      
      
      
      
      
      
      

var actions_options = {};

actions_options.styleTagTransform = (styleTagTransform_default());
actions_options.setAttributes = (setAttributesWithoutAttributes_default());

      actions_options.insert = insertBySelector_default().bind(null, "head");
    
actions_options.domAPI = (styleDomAPI_default());
actions_options.insertStyleElement = (insertStyleElement_default());

var actions_update = injectStylesIntoStyleTag_default()(actions/* default */.Z, actions_options);




       /* harmony default export */ const Actions_actions = (actions/* default */.Z && actions/* default.locals */.Z.locals ? actions/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Actions/Actions.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 









const Actions = (0,mobxreact_esm/* observer */.Pi)(()=>{
    const { logStore, wizardStore } = (0,react.useContext)(rootStore);
    const { preserveLogEnabled } = logStore;
    const clearLogHandler = async (e)=>{
        e.preventDefault();
        await logStore.clearFilteringEvents();
    };
    const refreshPage = async (e)=>{
        e.preventDefault();
        await logStore.refreshPage();
        if (!preserveLogEnabled) {
            await wizardStore.closeModal();
        }
    };
    const preserveLogHandler = (e)=>{
        logStore.setPreserveLog(e.target.checked);
    };
    const preserveLogClassName = classnames_default()('record', {
        active: preserveLogEnabled
    });
    const preserveLogTooltipText = preserveLogEnabled ? translator/* translator.getMessage */.O.getMessage('filtering_log_preserve_log_on') : translator/* translator.getMessage */.O.getMessage('filtering_log_preserve_log_off');
    const preserveLogInputId = 'preserveLog';
    return /*#__PURE__*/ react.createElement("div", {
        className: "actions"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "actions__col actions__tab-selector"
    }, /*#__PURE__*/ react.createElement(TabSelector, null)), /*#__PURE__*/ react.createElement("div", {
        className: "actions__col actions__buttons"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "actions__action actions__preserve"
    }, /*#__PURE__*/ react.createElement("input", {
        className: "checkbox-input",
        type: "checkbox",
        name: "preserveLog",
        id: preserveLogInputId,
        onChange: preserveLogHandler,
        checked: preserveLogEnabled,
        "aria-label": preserveLogTooltipText
    }), /*#__PURE__*/ react.createElement("label", {
        htmlFor: preserveLogInputId,
        className: "checkbox-label"
    }, /*#__PURE__*/ react.createElement(Popover/* Popover */.J, {
        text: preserveLogTooltipText
    }, /*#__PURE__*/ react.createElement("div", {
        className: preserveLogClassName
    }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: "#record",
        classname: "icon--24"
    }))))), /*#__PURE__*/ react.createElement("div", {
        className: "actions__action"
    }, /*#__PURE__*/ react.createElement(Popover/* Popover */.J, {
        text: translator/* translator.getMessage */.O.getMessage('filtering_clear_log_events')
    }, /*#__PURE__*/ react.createElement("button", {
        type: "button",
        className: "actions__clear",
        "aria-label": translator/* translator.getMessage */.O.getMessage('filtering_clear_log_events'),
        onClick: clearLogHandler
    }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: "#trash",
        classname: "icon--24 icon--red-default"
    })))), /*#__PURE__*/ react.createElement("div", {
        className: "actions__action"
    }, /*#__PURE__*/ react.createElement("button", {
        className: "actions__refresh",
        type: "button",
        onClick: refreshPage
    }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: "#reload",
        classname: "icon--24 actions__refresh--icon"
    }), /*#__PURE__*/ react.createElement("span", {
        className: "actions__refresh--text"
    }, translator/* translator.getMessage */.O.getMessage('filtering_refresh_tab_short'))))), /*#__PURE__*/ react.createElement("div", {
        className: "actions__col actions__search"
    }, /*#__PURE__*/ react.createElement(EventsSearch, null)));
});


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Actions/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

// EXTERNAL MODULE: ./Extension/src/pages/helpers.ts
var pages_helpers = __webpack_require__(9008);
;// CONCATENATED MODULE: ./Extension/src/pages/common/hooks/useResizeObserver.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

/**
 * Hook for tracking dom element resize.
 *
 * @param ref Reference to tracking dom element.
 * @param callback Tracking flag.
 * @param throttleTimeMs Throttle time in ms, default is 500ms.
 *
 * @returns
 */ const useResizeObserver = (ref, callback, throttleTimeMs = 500)=>{
    (0,react.useEffect)(()=>{
        const target = ref.current;
        if (!target) {
            return;
        }
        const observer = new ResizeObserver((0,throttle/* default */.Z)(callback, throttleTimeMs));
        observer.observe(target);
        return ()=>{
            observer.unobserve(target);
        };
    }, [
        ref,
        callback,
        throttleTimeMs
    ]);
};

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/Tags/Tags.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 




const Tags = ({ tags, setTags, type })=>{
    const { allButtonEnabled, filters } = tags;
    const enableOne = (tagId)=>{
        const updatedTags = filters.map((tag)=>{
            return {
                ...tag,
                enabled: tag.id === tagId
            };
        });
        setTags({
            filters: updatedTags,
            allButtonEnabled: false
        });
    };
    const enableAll = ()=>{
        const updatedTags = filters.map((tag)=>{
            return {
                ...tag,
                enabled: true
            };
        });
        setTags({
            filters: updatedTags,
            allButtonEnabled: true
        });
    };
    const toggleMultiple = (tagId)=>{
        let updatedTags;
        const everyEnabled = filters.every((tag)=>tag.enabled);
        if (everyEnabled) {
            if (allButtonEnabled) {
                // disable all, except selected
                updatedTags = filters.map((tag)=>{
                    if (tag.id !== tagId) {
                        return {
                            ...tag,
                            enabled: false
                        };
                    }
                    return {
                        ...tag
                    };
                });
                setTags({
                    filters: updatedTags,
                    allButtonEnabled: false
                });
            } else {
                // disable only selected
                updatedTags = filters.map((tag)=>{
                    if (tag.id === tagId) {
                        return {
                            ...tag,
                            enabled: false
                        };
                    }
                    return tag;
                });
                setTags({
                    filters: updatedTags,
                    allButtonEnabled
                });
            }
        } else {
            updatedTags = filters.map((tag)=>{
                return {
                    ...tag,
                    enabled: tag.id === tagId ? !tag.enabled : tag.enabled
                };
            });
            const allDisabled = updatedTags.every((tag)=>!tag.enabled);
            if (allDisabled) {
                // set all enabled
                updatedTags = filters.map((tag)=>{
                    return {
                        ...tag,
                        enabled: true
                    };
                });
                setTags({
                    filters: updatedTags,
                    allButtonEnabled: true
                });
            } else {
                setTags({
                    filters: updatedTags,
                    allButtonEnabled
                });
            }
        }
    };
    const handleTagClick = (e)=>{
        if (user_agent/* UserAgent.isMacOs */.Z.isMacOs ? e.metaKey : e.ctrlKey) {
            toggleMultiple(e.target.value);
        } else {
            enableOne(e.target.value);
        }
    };
    const handleAllClick = ()=>{
        enableAll();
    };
    const renderTypes = ()=>{
        return filters.map((tag)=>{
            const { id, title, enabled, tooltip } = tag;
            const button = /*#__PURE__*/ react.createElement("button", {
                className: classnames_default()(`tag tag--${id}`, type && `tag--${type}`, {
                    active: !allButtonEnabled && enabled
                }),
                type: "button",
                onClick: handleTagClick,
                value: id,
                key: id,
                "aria-label": tooltip
            }, title);
            return tooltip ? /*#__PURE__*/ react.createElement(Popover/* Popover */.J, {
                text: tooltip,
                key: id
            }, button) : button;
        });
    };
    return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement("button", {
        className: classnames_default()('tag', type && `tag--${type}`, {
            active: allButtonEnabled
        }),
        type: "button",
        onClick: handleAllClick
    }, reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_type_all')), renderTypes());
};

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/Tags/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/Filters/MiscellaneousFilters/miscellaneous-filters.pcss
var miscellaneous_filters = __webpack_require__(40204);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/MiscellaneousFilters/miscellaneous-filters.pcss

      
      
      
      
      
      
      
      
      

var miscellaneous_filters_options = {};

miscellaneous_filters_options.styleTagTransform = (styleTagTransform_default());
miscellaneous_filters_options.setAttributes = (setAttributesWithoutAttributes_default());

      miscellaneous_filters_options.insert = insertBySelector_default().bind(null, "head");
    
miscellaneous_filters_options.domAPI = (styleDomAPI_default());
miscellaneous_filters_options.insertStyleElement = (insertStyleElement_default());

var miscellaneous_filters_update = injectStylesIntoStyleTag_default()(miscellaneous_filters/* default */.Z, miscellaneous_filters_options);




       /* harmony default export */ const MiscellaneousFilters_miscellaneous_filters = (miscellaneous_filters/* default */.Z && miscellaneous_filters/* default.locals */.Z.locals ? miscellaneous_filters/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/MiscellaneousFilters/MiscellaneousFilters.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 





const MiscellaneousFilters = (0,mobxreact_esm/* observer */.Pi)(()=>{
    const ref = (0,react.useRef)(null);
    const { logStore } = (0,react.useContext)(rootStore);
    const { requestSourceFilters, setRequestSourceFilters, miscellaneousFilters, setMiscellaneousFilters } = logStore;
    return /*#__PURE__*/ react.createElement("div", {
        className: "miscellaneous-filters"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "miscellaneous-filters__filters",
        ref: ref
    }, /*#__PURE__*/ react.createElement("div", {
        className: "miscellaneous-filters__section"
    }, /*#__PURE__*/ react.createElement(Tags, {
        type: constants/* NavigationTag.Party */.zb.Party,
        tags: requestSourceFilters,
        setTags: setRequestSourceFilters
    })), /*#__PURE__*/ react.createElement("div", {
        className: "miscellaneous-filters__section"
    }, /*#__PURE__*/ react.createElement(Tags, {
        type: constants/* NavigationTag.Regular */.zb.Regular,
        tags: miscellaneousFilters,
        setTags: setMiscellaneousFilters
    }))));
});


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/MiscellaneousFilters/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/Filters/EventsTypeFilter/events-type-filter.pcss
var events_type_filter = __webpack_require__(15278);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/EventsTypeFilter/events-type-filter.pcss

      
      
      
      
      
      
      
      
      

var events_type_filter_options = {};

events_type_filter_options.styleTagTransform = (styleTagTransform_default());
events_type_filter_options.setAttributes = (setAttributesWithoutAttributes_default());

      events_type_filter_options.insert = insertBySelector_default().bind(null, "head");
    
events_type_filter_options.domAPI = (styleDomAPI_default());
events_type_filter_options.insertStyleElement = (insertStyleElement_default());

var events_type_filter_update = injectStylesIntoStyleTag_default()(events_type_filter/* default */.Z, events_type_filter_options);




       /* harmony default export */ const EventsTypeFilter_events_type_filter = (events_type_filter/* default */.Z && events_type_filter/* default.locals */.Z.locals ? events_type_filter/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/EventsTypeFilter/EventsTypeFilter.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 





const EventsTypeFilter = (0,mobxreact_esm/* observer */.Pi)(()=>{
    const { logStore } = (0,react.useContext)(rootStore);
    const { eventTypesFilters, setEventTypesFilters } = logStore;
    return /*#__PURE__*/ react.createElement("div", {
        className: "events-types"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "events-types__content"
    }, /*#__PURE__*/ react.createElement(Tags, {
        type: constants/* NavigationTag.Regular */.zb.Regular,
        tags: eventTypesFilters,
        setTags: setEventTypesFilters
    })));
});


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/EventsTypeFilter/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/Filters/filters.pcss
var filters = __webpack_require__(84603);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/filters.pcss

      
      
      
      
      
      
      
      
      

var filters_options = {};

filters_options.styleTagTransform = (styleTagTransform_default());
filters_options.setAttributes = (setAttributesWithoutAttributes_default());

      filters_options.insert = insertBySelector_default().bind(null, "head");
    
filters_options.domAPI = (styleDomAPI_default());
filters_options.insertStyleElement = (insertStyleElement_default());

var filters_update = injectStylesIntoStyleTag_default()(filters/* default */.Z, filters_options);




       /* harmony default export */ const Filters_filters = (filters/* default */.Z && filters/* default.locals */.Z.locals ? filters/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/Filters.tsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 







const RESIZE_OBSERVER_THROTTLE_MS = 500;
const Filters = ()=>{
    const [leftArrow, setLeftArrow] = (0,react.useState)(false);
    const [rightArrow, setRightArrow] = (0,react.useState)(true);
    const ref = (0,react.useRef)(null);
    const calcArrowState = (0,react.useCallback)(([entry])=>{
        const { scrollLeft, scrollWidth, clientWidth } = entry.target;
        /**
         * Call setState within requestAnimationFrame to prevent infinite loop
         */ window.requestAnimationFrame(()=>{
            setLeftArrow(scrollLeft > 0);
            setRightArrow(scrollWidth - clientWidth > scrollLeft);
        });
    }, []);
    useResizeObserver(ref, calcArrowState, RESIZE_OBSERVER_THROTTLE_MS);
    const scrollTags = ()=>{
        if (!ref.current) {
            return;
        }
        const { scrollLeft, scrollWidth, clientWidth } = ref.current;
        setLeftArrow(scrollLeft > 0);
        setRightArrow(scrollWidth - clientWidth > scrollLeft);
    };
    const scrollLeft = ()=>{
        if (!ref.current) {
            return;
        }
        const { width } = ref.current.getBoundingClientRect();
        ref.current.scrollLeft -= width;
    };
    const scrollRight = ()=>{
        if (!ref.current) {
            return;
        }
        const { width } = ref.current.getBoundingClientRect();
        ref.current.scrollLeft += width;
    };
    const handleWheel = (e)=>{
        if (!ref.current) {
            return;
        }
        if ((0,pages_helpers/* isVerticalScroll */.fQ)(e.deltaY, e.deltaX)) {
            if (e.deltaY < 0) {
                ref.current.scrollLeft += 10;
            } else {
                ref.current.scrollLeft -= 10;
            }
        }
    };
    return /*#__PURE__*/ react.createElement("div", {
        className: "filters"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "filters__nav"
    }, /*#__PURE__*/ react.createElement(Actions, null)), /*#__PURE__*/ react.createElement("div", {
        className: "filters__events-tags"
    }, /*#__PURE__*/ react.createElement("div", {
        ref: ref,
        onScroll: scrollTags,
        onWheel: handleWheel,
        className: "filters__events-filters"
    }, leftArrow && /*#__PURE__*/ react.createElement("button", {
        type: "button",
        onClick: scrollLeft,
        className: "filters__arrow filters__arrow--left"
    }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: "#arrow-left",
        classname: "filters__arrow__icon"
    })), /*#__PURE__*/ react.createElement(MiscellaneousFilters, null), /*#__PURE__*/ react.createElement(EventsTypeFilter, null), rightArrow && /*#__PURE__*/ react.createElement("button", {
        type: "button",
        onClick: scrollRight,
        className: "filters__arrow filters__arrow--right"
    }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: "#arrow-left",
        classname: "filters__arrow__icon"
    })))));
};


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Filters/index.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

// EXTERNAL MODULE: ./node_modules/.pnpm/react-modal@3.16.1_react-dom@17.0.2_react@17.0.2/node_modules/react-modal/lib/index.js
var react_modal_lib = __webpack_require__(34936);
var lib_default = /*#__PURE__*/__webpack_require__.n(react_modal_lib);
// EXTERNAL MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/identity.js
var identity = __webpack_require__(91130);
// EXTERNAL MODULE: ./Extension/src/pages/options/constants.ts
var options_constants = __webpack_require__(78715);
// EXTERNAL MODULE: ./node_modules/.pnpm/webextension-polyfill@0.12.0/node_modules/webextension-polyfill/dist/browser-polyfill.js
var browser_polyfill = __webpack_require__(70914);
var browser_polyfill_default = /*#__PURE__*/__webpack_require__.n(browser_polyfill);
;// CONCATENATED MODULE: ./Extension/src/common/api/extension/windows.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
/**
 * Helper class for browser.windows API.
 */ class WindowsApi {
    /**
     * Calls browser.windows.create with fallback to browser.tabs.create.
     * In case of fallback, compatible data will be reused.
     *
     * This covers cases like Firefox for Android, where browser.windows API is not available.
     * https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2536
     *
     * @param createData Browser.windows.create argument.
     * @returns Created window, tab or null, if no calls were made.
     */ static async create(createData) {
        if ((browser_polyfill_default()).windows) {
            return browser_polyfill_default().windows.create(createData);
        }
        const createProperties = createData || {};
        const { url, cookieStoreId } = createProperties;
        if (typeof url === 'string') {
            return browser_polyfill_default().tabs.create({
                url,
                cookieStoreId
            });
        }
        if (Array.isArray(url)) {
            return browser_polyfill_default().tabs.create({
                url: url[0],
                cookieStoreId
            });
        }
        return null;
    }
}

// EXTERNAL MODULE: ./node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/format/index.js + 34 modules
var format = __webpack_require__(57696);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Status/statusStyles.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
/**
 * @typedef {object} StatusColor
 * @property {string} GRAY
 * @property {string} ORANGE
 * @property {string} RED
 * @property {string} GREEN
 */ const StatusColor = {
    GRAY: 'gray',
    ORANGE: 'orange',
    RED: 'red',
    GREEN: 'green'
};
const colorMap = {
    [StatusMode.REGULAR]: StatusColor.GRAY,
    [StatusMode.MODIFIED]: StatusColor.ORANGE,
    [StatusMode.BLOCKED]: StatusColor.RED,
    [StatusMode.ALLOWED]: StatusColor.GREEN
};
const getItemClassName = (color)=>{
    return color ? `status__item status__item--${color}` : 'status__item';
};
const getBadgeClassNames = (color)=>{
    return color ? `status__badge status__badge--${color}` : 'status__badge';
};

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Status/statusTitles.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

/**
 * @typedef {object} StatusTitle
 * @property {string} PROCESSED
 * @property {string} BLOCKED
 * @property {string} MODIFIED
 * @property {string} UNBLOCKED
 */ const StatusTitle = {
    PROCESSED: 'filtering_log_status_processed',
    BLOCKED: 'filtering_log_status_blocked',
    MODIFIED: 'filtering_log_status_modified',
    UNBLOCKED: 'filtering_log_status_allowed'
};
const titleMap = {
    [StatusMode.REGULAR]: StatusTitle.PROCESSED,
    [StatusMode.MODIFIED]: StatusTitle.MODIFIED,
    [StatusMode.BLOCKED]: StatusTitle.BLOCKED,
    [StatusMode.ALLOWED]: StatusTitle.UNBLOCKED,
    [StatusMode.ALLOWED_STEALTH]: StatusTitle.PROCESSED
};
const getStatusTitle = (mode)=>{
    return reactTranslator/* reactTranslator.getMessage */._.getMessage(titleMap[mode]);
};

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/Status/status.pcss
var Status_status = __webpack_require__(26869);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Status/status.pcss

      
      
      
      
      
      
      
      
      

var status_options = {};

status_options.styleTagTransform = (styleTagTransform_default());
status_options.setAttributes = (setAttributesWithoutAttributes_default());

      status_options.insert = insertBySelector_default().bind(null, "head");
    
status_options.domAPI = (styleDomAPI_default());
status_options.insertStyleElement = (insertStyleElement_default());

var status_update = injectStylesIntoStyleTag_default()(Status_status/* default */.Z, status_options);




       /* harmony default export */ const components_Status_status = (Status_status/* default */.Z && Status_status/* default.locals */.Z.locals ? Status_status/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Status/Status.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 









const Status = (props)=>{
    const { statusCode, timestamp, method, requestUrl, requestThirdParty } = props;
    const timeString = (0,format/* default */.Z)(timestamp, 'HH:mm:ss');
    const mode = getStatusMode(props);
    const color = colorMap[mode];
    const itemClassNames = getItemClassName(color);
    const badgeClassNames = getBadgeClassNames(color);
    const isBlocked = mode === StatusMode.BLOCKED;
    const isModified = mode === StatusMode.MODIFIED;
    const areNetworkBadgesVisible = requestUrl && !isModified;
    const statusTooltipText = getStatusTitle(mode);
    return /*#__PURE__*/ react.createElement("div", {
        className: "status-wrapper"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "status"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "status__item status__item_width60"
    }, timeString), areNetworkBadgesVisible && /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement("div", {
        className: itemClassNames
    }, /*#__PURE__*/ react.createElement(Popover/* Popover */.J, {
        text: statusTooltipText
    }, /*#__PURE__*/ react.createElement("div", {
        className: "status__icon--wrapper"
    }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: statusCode ? '#transfer-status' : '#arrow-status',
        classname: "status__icon"
    })))), /*#__PURE__*/ react.createElement("div", {
        className: classnames_default()(itemClassNames, 'status__item_centered')
    }, isBlocked ? /*#__PURE__*/ react.createElement(Popover/* Popover */.J, {
        text: translator/* translator.getMessage */.O.getMessage('filtering_log_status_blocked')
    }, /*#__PURE__*/ react.createElement("div", {
        className: "status__icon--wrapper"
    }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: "#ban",
        classname: "status__icon"
    }))) : /*#__PURE__*/ react.createElement(Popover/* Popover */.J, {
        text: translator/* translator.getMessage */.O.getMessage('filtering_log_badge_tooltip_http_status_code')
    }, /*#__PURE__*/ react.createElement("div", {
        className: badgeClassNames
    }, statusCode || '----')))), method && /*#__PURE__*/ react.createElement("div", {
        className: "status__item"
    }, /*#__PURE__*/ react.createElement(Popover/* Popover */.J, {
        text: translator/* translator.getMessage */.O.getMessage('filtering_log_badge_tooltip_http_req_method')
    }, /*#__PURE__*/ react.createElement("div", {
        className: "status__badge status__badge--transparent"
    }, method))), requestThirdParty && /*#__PURE__*/ react.createElement("div", {
        className: "status__item"
    }, /*#__PURE__*/ react.createElement(Popover/* Popover */.J, {
        text: translator/* translator.getMessage */.O.getMessage('filtering_log_badge_tooltip_third_party')
    }, /*#__PURE__*/ react.createElement("div", {
        className: "tag tag--third_party tag--party tag--third_party--info"
    }, "3P")))));
};

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Status/NetworkStatus.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 



const NetworkStatus = ({ method, statusCode, isThirdParty })=>{
    const badgeClassNames = getBadgeClassNames(StatusColor.GRAY);
    return /*#__PURE__*/ react.createElement("div", {
        className: "status"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "status__item"
    }, /*#__PURE__*/ react.createElement(Popover/* Popover */.J, {
        text: translator/* translator.getMessage */.O.getMessage('filtering_log_badge_tooltip_http_status_code')
    }, /*#__PURE__*/ react.createElement("div", {
        className: badgeClassNames
    }, statusCode || '----'))), /*#__PURE__*/ react.createElement("div", {
        className: "status__item"
    }, /*#__PURE__*/ react.createElement(Popover/* Popover */.J, {
        text: translator/* translator.getMessage */.O.getMessage('filtering_log_badge_tooltip_http_req_method')
    }, /*#__PURE__*/ react.createElement("div", {
        className: "status__badge status__badge--transparent"
    }, method))), isThirdParty && /*#__PURE__*/ react.createElement("div", {
        className: "status__item"
    }, /*#__PURE__*/ react.createElement(Popover/* Popover */.J, {
        text: translator/* translator.getMessage */.O.getMessage('filtering_log_badge_tooltip_third_party')
    }, /*#__PURE__*/ react.createElement("div", {
        className: "tag tag--third_party tag--party tag--third_party--info"
    }, "3P"))));
};

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Status/FilterStatus.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 





const FilterStatus = ({ statusCode, method, mode })=>{
    const title = getStatusTitle(mode);
    const color = colorMap[mode];
    const itemClassNames = getItemClassName(color);
    const isBlocked = mode === StatusMode.BLOCKED;
    return /*#__PURE__*/ react.createElement("div", {
        className: "status"
    }, /*#__PURE__*/ react.createElement("div", {
        className: itemClassNames
    }, title), /*#__PURE__*/ react.createElement("div", {
        className: itemClassNames
    }, isBlocked ? /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: "#ban",
        classname: "status__icon"
    }) : method && /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: statusCode ? '#transfer-status' : '#arrow-status',
        classname: "status__icon"
    })));
};

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/Status/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 



;// CONCATENATED MODULE: ./Extension/src/pages/common/hooks/useOverflowed.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

/**
 * Detects if container content is overflowed.
 *
 * @param ref Reference to tracking dom element.
 * @param track Tracking flags.
 * @param track.x Tracking overflow on x axis.
 * @param track.y Tracking overflow on y axis.
 * @param throttleTime Throttle time in ms.
 *
 * @returns True if content is overflowed.
 */ const useOverflowed = (ref, track = {
    x: false,
    y: true
}, throttleTime = 500)=>{
    const [isOverflowed, setOverflowed] = (0,react.useState)(false);
    const calcIsOverflowed = (0,react.useCallback)(([entry])=>{
        const el = entry.target;
        let overflowedX = false;
        let overflowedY = false;
        if (track.x) {
            overflowedX = el.scrollWidth > el.offsetWidth;
        }
        if (track.y) {
            overflowedY = el.scrollHeight > el.offsetHeight;
        }
        /**
         * Call setState within requestAnimationFrame to prevent infinite loop
         */ window.requestAnimationFrame(()=>{
            if (ref && ref.current) {
                setOverflowed(overflowedX || overflowedY);
            }
        });
    }, [
        track,
        ref
    ]);
    useResizeObserver(ref, calcIsOverflowed, throttleTime);
    return isOverflowed;
};

// EXTERNAL MODULE: ./Extension/src/pages/options/options-storage/index.ts + 1 modules
var options_storage = __webpack_require__(56877);
;// CONCATENATED MODULE: ./Extension/src/pages/common/hooks/useTextCollapse.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

const useTextCollapse = (text, width, lineCountLimit, defaultCollapsed)=>{
    const [isCollapsed, setCollapsed] = (0,react.useState)(defaultCollapsed);
    const [isOverflown, setOverflown] = (0,react.useState)(false);
    (0,react.useLayoutEffect)(()=>{
        const textWidth = (0,pages_helpers/* measureTextWidth */.Ux)(text);
        const isTextOverflown = textWidth > lineCountLimit * width;
        setOverflown(isTextOverflown);
    }, [
        text,
        width,
        lineCountLimit
    ]);
    const toggleCollapsed = ()=>{
        setCollapsed(!isCollapsed);
    };
    return [
        isCollapsed,
        isOverflown,
        toggleCollapsed
    ];
};

// EXTERNAL MODULE: ./node_modules/.pnpm/nanoid@3.3.6/node_modules/nanoid/index.browser.js
var index_browser = __webpack_require__(61512);
// EXTERNAL MODULE: ./Extension/src/pages/common/components/ui/Tooltip/index.ts + 2 modules
var Tooltip = __webpack_require__(11273);
// EXTERNAL MODULE: ./Extension/src/pages/common/components/AttachmentPortal/index.ts + 1 modules
var AttachmentPortal = __webpack_require__(78413);
;// CONCATENATED MODULE: ./Extension/src/pages/common/components/CopyToClipboard/copyToClipboardStore.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ function copyToClipboardStore_define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function copyToClipboardStore_ts_decorate(decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
}



const TOOLTIP_VISIBLE_TIME_MS = 1500;
class CopyToClipboardStore {
    constructor(){
        copyToClipboardStore_define_property(this, "currentContainerId", null);
        copyToClipboardStore_define_property(this, "tooltipTimer", null);
        copyToClipboardStore_define_property(this, "copyText", (containerId, text)=>{
            clearTimeout(this.tooltipTimer);
            (0,pages_helpers/* copyToClipboard */.vQ)(text);
            this.currentContainerId = containerId;
            this.tooltipTimer = setTimeout(()=>{
                this.resetTooltipId();
            }, TOOLTIP_VISIBLE_TIME_MS);
        });
        copyToClipboardStore_define_property(this, "resetTooltipId", ()=>{
            this.currentContainerId = null;
        });
        (0,mobx_esm/* makeObservable */.rC)(this);
    }
}
copyToClipboardStore_ts_decorate([
    mobx_esm/* observable */.LO
], CopyToClipboardStore.prototype, "currentContainerId", void 0);
copyToClipboardStore_ts_decorate([
    mobx_esm/* action */.aD
], CopyToClipboardStore.prototype, "copyText", void 0);
copyToClipboardStore_ts_decorate([
    mobx_esm/* action */.aD
], CopyToClipboardStore.prototype, "resetTooltipId", void 0);
const copyToClipboardStore = /*#__PURE__*/ (0,react.createContext)(new CopyToClipboardStore());

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/common/components/CopyToClipboard/copy-to-clipboard.pcss
var copy_to_clipboard = __webpack_require__(34418);
;// CONCATENATED MODULE: ./Extension/src/pages/common/components/CopyToClipboard/copy-to-clipboard.pcss

      
      
      
      
      
      
      
      
      

var copy_to_clipboard_options = {};

copy_to_clipboard_options.styleTagTransform = (styleTagTransform_default());
copy_to_clipboard_options.setAttributes = (setAttributesWithoutAttributes_default());

      copy_to_clipboard_options.insert = insertBySelector_default().bind(null, "head");
    
copy_to_clipboard_options.domAPI = (styleDomAPI_default());
copy_to_clipboard_options.insertStyleElement = (insertStyleElement_default());

var copy_to_clipboard_update = injectStylesIntoStyleTag_default()(copy_to_clipboard/* default */.Z, copy_to_clipboard_options);




       /* harmony default export */ const CopyToClipboard_copy_to_clipboard = (copy_to_clipboard/* default */.Z && copy_to_clipboard/* default.locals */.Z.locals ? copy_to_clipboard/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/common/components/CopyToClipboard/CopyToClipboard.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 








const TOOLTIP_MOUSE_PADDING_PX = 4;
const CopyToClipboard = (0,mobxreact_esm/* observer */.Pi)(/*#__PURE__*/ (0,react.forwardRef)(({ children, className, style, wrapperClassName }, ref)=>{
    const [tooltipPosition, setTooltipPosition] = (0,react.useState)({
        x: 0,
        y: 0
    });
    const { currentContainerId, copyText, resetTooltipId } = (0,react.useContext)(copyToClipboardStore);
    const containerRef = (0,react.useRef)((0,index_browser/* nanoid */.x0)());
    // reset tooltip id on component unmount or text changing
    (0,react.useEffect)(()=>{
        return ()=>{
            resetTooltipId();
        };
    }, [
        children,
        resetTooltipId
    ]);
    const copyInnerText = (e)=>{
        copyText(containerRef.current, e.target.innerText);
    };
    const handleClick = (e)=>{
        e.preventDefault();
        // if user highlights text, don't copy whole inner content
        const selectedText = document.getSelection().toString();
        if (selectedText.length < 1) {
            copyInnerText(e);
            // shifting position for prevent cursor flashing on tooltip render
            setTooltipPosition({
                x: e.clientX + TOOLTIP_MOUSE_PADDING_PX,
                y: e.clientY + TOOLTIP_MOUSE_PADDING_PX
            });
        }
    };
    const handleKeyUp = (e)=>{
        if (e.key === 'Enter') {
            e.preventDefault();
            const rect = e.target.getBoundingClientRect();
            copyInnerText(e);
            setTooltipPosition({
                x: rect.left,
                y: rect.bottom
            });
        }
    };
    return /*#__PURE__*/ react.createElement("div", {
        className: classnames_default()('copy-to-clipboard-wrapper', wrapperClassName)
    }, containerRef.current === currentContainerId && /*#__PURE__*/ react.createElement(AttachmentPortal/* AttachmentPortal */.g, {
        rootId: "root-portal",
        position: tooltipPosition
    }, /*#__PURE__*/ react.createElement(Tooltip/* Tooltip */.u, {
        text: translator/* translator.getMessage */.O.getMessage('filtering_modal_copied'),
        visible: true
    })), /*#__PURE__*/ react.createElement("div", {
        ref: ref,
        className: classnames_default()('copy-to-clipboard', className),
        style: style,
        role: "button",
        tabIndex: 0,
        title: translator/* translator.getMessage */.O.getMessage('filtering_modal_copy_to_clipboard'),
        onClick: handleClick,
        onKeyUp: handleKeyUp
    }, children));
}));

;// CONCATENATED MODULE: ./Extension/src/pages/common/components/CopyToClipboard/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/common/components/TextCollapser/text-collapser.pcss
var text_collapser = __webpack_require__(68771);
;// CONCATENATED MODULE: ./Extension/src/pages/common/components/TextCollapser/text-collapser.pcss

      
      
      
      
      
      
      
      
      

var text_collapser_options = {};

text_collapser_options.styleTagTransform = (styleTagTransform_default());
text_collapser_options.setAttributes = (setAttributesWithoutAttributes_default());

      text_collapser_options.insert = insertBySelector_default().bind(null, "head");
    
text_collapser_options.domAPI = (styleDomAPI_default());
text_collapser_options.insertStyleElement = (insertStyleElement_default());

var text_collapser_update = injectStylesIntoStyleTag_default()(text_collapser/* default */.Z, text_collapser_options);




       /* harmony default export */ const TextCollapser_text_collapser = (text_collapser/* default */.Z && text_collapser/* default.locals */.Z.locals ? text_collapser/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/common/components/TextCollapser/TextCollapser.tsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 





const TextCollapser = /*#__PURE__*/ (0,react.forwardRef)(({ text, width, lineCountLimit, collapserButtonMessages, canCopy, children }, ref)=>{
    const [isCollapsed, isOverflown, toggleCollapsed] = useTextCollapse(text, width, lineCountLimit, true);
    const handleClick = ()=>{
        toggleCollapsed();
    };
    const handleKeyUp = (e)=>{
        if (e.key === 'Enter') {
            toggleCollapsed();
        }
    };
    const DEFAULT_SHOW_MESSAGE = 'text_collapser_show_default';
    const DEFAULT_HIDE_MESSAGE = 'text_collapser_hide_default';
    // Pick required collapser button text
    const { showMessage = DEFAULT_SHOW_MESSAGE, hideMessage = DEFAULT_HIDE_MESSAGE } = collapserButtonMessages;
    const collapserButtonText = isCollapsed ? translator/* translator.getMessage */.O.getMessage(showMessage) : translator/* translator.getMessage */.O.getMessage(hideMessage);
    // Pick required text style
    const hasCollapsedStyle = isCollapsed && isOverflown;
    const collapserClassName = hasCollapsedStyle ? 'text-collapser__text-short' : 'text-collapser__text-full';
    const collapsedProps = hasCollapsedStyle && {
        style: {
            WebkitLineClamp: lineCountLimit
        }
    };
    return /*#__PURE__*/ react.createElement(react.Fragment, null, canCopy ? /*#__PURE__*/ react.createElement(CopyToClipboard, {
        ref: ref,
        wrapperClassName: "text-collapser__copy-to-clipboard-wrapper",
        className: classnames_default()('text-collapser__copy-to-clipboard', collapserClassName),
        ...collapsedProps
    }, text) : /*#__PURE__*/ react.createElement("div", {
        className: collapserClassName,
        ...collapsedProps
    }, text), /*#__PURE__*/ react.createElement("div", {
        className: "request-modal__text-actions"
    }, isOverflown && /*#__PURE__*/ react.createElement("div", {
        role: "button",
        className: "button button--link--green request-modal__url-button",
        tabIndex: 0,
        onClick: handleClick,
        onKeyUp: handleKeyUp
    }, collapserButtonText), children));
});

// EXTERNAL MODULE: ./Extension/src/pages/common/components/ui/Popover/Popover.tsx + 1 modules
var Popover_Popover = __webpack_require__(62606);
// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/RequestWizard/RequestInfo/request-info.pcss
var request_info = __webpack_require__(53396);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestInfo/request-info.pcss

      
      
      
      
      
      
      
      
      

var request_info_options = {};

request_info_options.styleTagTransform = (styleTagTransform_default());
request_info_options.setAttributes = (setAttributesWithoutAttributes_default());

      request_info_options.insert = insertBySelector_default().bind(null, "head");
    
request_info_options.domAPI = (styleDomAPI_default());
request_info_options.insertStyleElement = (insertStyleElement_default());

var request_info_update = injectStylesIntoStyleTag_default()(request_info/* default */.Z, request_info_options);




       /* harmony default export */ const RequestInfo_request_info = (request_info/* default */.Z && request_info/* default.locals */.Z.locals ? request_info/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestInfo/RequestInfo.tsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ /*
eslint-disable no-bitwise,
jsx-a11y/click-events-have-key-events,
jsx-a11y/no-static-element-interactions
*/ 























const StealthActionNames = {
    [index_mv3/* StealthActions.HideReferrer */.Zk.HideReferrer]: translator/* translator.getMessage */.O.getMessage('filtering_log_hide_referrer'),
    [index_mv3/* StealthActions.SendDoNotTrack */.Zk.SendDoNotTrack]: translator/* translator.getMessage */.O.getMessage('filtering_log_send_not_track'),
    [index_mv3/* StealthActions.HideSearchQueries */.Zk.HideSearchQueries]: translator/* translator.getMessage */.O.getMessage('filtering_log_hide_search_queries'),
    [index_mv3/* StealthActions.FirstPartyCookies */.Zk.FirstPartyCookies]: translator/* translator.getMessage */.O.getMessage('options_modified_first_party_cookie'),
    [index_mv3/* StealthActions.ThirdPartyCookies */.Zk.ThirdPartyCookies]: translator/* translator.getMessage */.O.getMessage('options_modified_third_party_cookie'),
    [index_mv3/* StealthActions.BlockChromeClientData */.Zk.BlockChromeClientData]: translator/* translator.getMessage */.O.getMessage('filtering_log_remove_client_data')
};
/**
 * Returns stealth actions names.
 *
 * @param actions Stealth actions.
 *
 * @returns Stealth actions names or null.
 */ const getStealthActionNames = (actions)=>{
    if (!actions) {
        return null;
    }
    const result = Object.values(index_mv3/* StealthActions */.Zk).filter((value)=>typeof value === 'number').map((action)=>{
        if ((actions & action) === action) {
            return StealthActionNames[action];
        }
        return null;
    }).filter(identity/* default */.Z);
    return result.length > 0 ? result.join(', ') : null;
};
/**
 * Returns type of the event
 *
 * @param selectedEvent
 * @returns {string}
 */ const getType = (selectedEvent)=>{
    return getRequestEventType(selectedEvent);
};
/**
 * Gets rules text data for the selected event.
 *
 * @param {FilteringEvent} event Event object to get the rule(s) from.
 * @param {RegularFilterMetadata} filtersMetadata Filters metadata.
 * @returns An object with the following properties:
 * - `appliedRuleTexts` - an array of rule texts that were applied to the request.
 *   If there are multiple rules, each rule text is followed by the filter name in parentheses.
 * - `originalRuleTexts` - an array of original rule texts that were converted to the applied rule texts (if any)
 *   If the rule was not converted, `appliedRuleTexts` contains the original rule text and `originalRuleTexts` is empty.
 *   If there are multiple rules, each rule text is followed by the filter name in parentheses.
 */ const getRulesData = (event, filtersMetadata)=>{
    const { requestRule, replaceRules, stealthAllowlistRules } = event;
    const result = {
        appliedRuleTexts: [],
        originalRuleTexts: []
    };
    const addRule = (rule, filterName)=>{
        const { appliedRuleText, originalRuleText } = rule;
        if (appliedRuleText) {
            result.appliedRuleTexts.push(filterName ? `${appliedRuleText} (${filterName})` : appliedRuleText);
        }
        if (originalRuleText) {
            result.originalRuleTexts.push(filterName ? `${originalRuleText} (${filterName})` : originalRuleText);
        }
    };
    const addRuleGroup = (rules)=>{
        if (!rules) {
            return;
        }
        if (rules.length === 1 && rules[0]) {
            addRule(rules[0]);
            return;
        }
        // in this case add rule texts with filter name
        rules.forEach((rule)=>{
            const filterName = filtersMetadata ? getFilterName(rule.filterId, filtersMetadata) : null;
            addRule(rule, filterName);
        });
    };
    if (replaceRules) {
        addRuleGroup(replaceRules);
        return result;
    }
    if (stealthAllowlistRules) {
        addRuleGroup(stealthAllowlistRules);
        return result;
    }
    if (!requestRule) {
        return result;
    }
    // Handle allowlist rules
    if ((requestRule === null || requestRule === void 0 ? void 0 : requestRule.allowlistRule) && (requestRule === null || requestRule === void 0 ? void 0 : requestRule.documentLevelRule) && (requestRule === null || requestRule === void 0 ? void 0 : requestRule.filterId) === constants/* AntiBannerFiltersId.AllowlistFilterId */.m6.AllowlistFilterId) {
        // Empty result
        return result;
    }
    addRule(requestRule);
    return result;
};
const PARTS = {
    URL: 'URL',
    ELEMENT: 'ELEMENT',
    COOKIE: 'COOKIE',
    TYPE: 'TYPE',
    SOURCE: 'SOURCE',
    ASSUMED_RULE: 'ASSUMED_RULE',
    ORIGINAL_RULE: 'ORIGINAL_RULE',
    APPLIED_RULES: 'APPLIED_RULES',
    FILTER: 'FILTER',
    STEALTH: 'STEALTH',
    DECLARATIVE_RULE: 'DECLARATIVE_RULE'
};
const RequestInfo = (0,mobxreact_esm/* observer */.Pi)(()=>{
    var _selectedEvent_declarativeRuleInfo, _selectedEvent_declarativeRuleInfo1, _selectedEvent_declarativeRuleInfo2, _selectedEvent_requestRule, _selectedEvent_requestRule1, _selectedEvent_requestRule2, _selectedEvent_declarativeRuleInfo3;
    const contentRef = (0,react.useRef)(null);
    const contentOverflowed = useOverflowed(contentRef);
    const requestTextRef = (0,react.useRef)(null);
    const { logStore, wizardStore } = (0,react.useContext)(rootStore);
    const { closeModal, addedRuleState } = wizardStore;
    const { selectedEvent, filtersMetadata } = logStore;
    if (!selectedEvent) {
        return null;
    }
    const [textMaxWidth, setTextMaxWidth] = (0,react.useState)(DEFAULT_MODAL_WIDTH_PX);
    (0,react.useLayoutEffect)(()=>{
        const MODAL_PADDINGS_PX = 70;
        const startModalWidth = options_storage/* optionsStorage.getItem */.P.getItem(options_storage/* optionsStorage.KEYS.REQUEST_INFO_MODAL_WIDTH */.P.KEYS.REQUEST_INFO_MODAL_WIDTH) || DEFAULT_MODAL_WIDTH_PX;
        setTextMaxWidth(startModalWidth - MODAL_PADDINGS_PX);
    }, [
        selectedEvent.eventId
    ]);
    // Handle rule texts
    const rulesData = getRulesData(selectedEvent, filtersMetadata);
    const appliedRulesData =  true ? {
        title: translator/* translator.getPlural */.O.getPlural('filtering_modal_applied_rules', ((_selectedEvent_declarativeRuleInfo = selectedEvent.declarativeRuleInfo) === null || _selectedEvent_declarativeRuleInfo === void 0 ? void 0 : _selectedEvent_declarativeRuleInfo.sourceRules.length) || 0),
        data: (_selectedEvent_declarativeRuleInfo1 = selectedEvent.declarativeRuleInfo) === null || _selectedEvent_declarativeRuleInfo1 === void 0 ? void 0 : _selectedEvent_declarativeRuleInfo1.sourceRules.map((r)=>r.sourceRule)
    } : 0;
    const eventPartsMap = {
        [PARTS.URL]: {
            title: translator/* translator.getMessage */.O.getMessage('options_popup_filter_url'),
            data: selectedEvent.requestUrl
        },
        [PARTS.ELEMENT]: {
            title: translator/* translator.getMessage */.O.getMessage('filtering_modal_element'),
            data: selectedEvent.element
        },
        [PARTS.COOKIE]: {
            title: translator/* translator.getMessage */.O.getMessage('filtering_modal_cookie'),
            data: getCookieData(selectedEvent)
        },
        [PARTS.TYPE]: {
            title: translator/* translator.getMessage */.O.getMessage('filtering_modal_type'),
            data: getType(selectedEvent)
        },
        [PARTS.SOURCE]: {
            title: translator/* translator.getMessage */.O.getMessage('filtering_modal_source'),
            data: selectedEvent.frameDomain
        },
        // TODO add converted rule text
        [PARTS.FILTER]: {
            title: translator/* translator.getMessage */.O.getMessage('filtering_modal_filter'),
            data: getRuleFilterName(selectedEvent, filtersMetadata)
        },
        // TODO: determine first/third-party
        [PARTS.STEALTH]: {
            title: translator/* translator.getMessage */.O.getMessage('filtering_modal_privacy'),
            data: getStealthActionNames(selectedEvent.stealthActions)
        },
        [PARTS.APPLIED_RULES]: appliedRulesData,
        [PARTS.DECLARATIVE_RULE]: {
            title: translator/* translator.getMessage */.O.getMessage('filtering_modal_declarative_rule'),
            data: (_selectedEvent_declarativeRuleInfo2 = selectedEvent.declarativeRuleInfo) === null || _selectedEvent_declarativeRuleInfo2 === void 0 ? void 0 : _selectedEvent_declarativeRuleInfo2.declarativeRuleJson
        }
    };
    const isCosmeticRule = ((_selectedEvent_requestRule = selectedEvent.requestRule) === null || _selectedEvent_requestRule === void 0 ? void 0 : _selectedEvent_requestRule.cssRule) || ((_selectedEvent_requestRule1 = selectedEvent.requestRule) === null || _selectedEvent_requestRule1 === void 0 ? void 0 : _selectedEvent_requestRule1.scriptRule);
    const ruleTitle = isCosmeticRule ? translator/* translator.getPlural */.O.getPlural('filtering_modal_applied_rules', Math.max(rulesData.appliedRuleTexts.length, 1)) : translator/* translator.getPlural */.O.getPlural('filtering_modal_assumed_rules', Math.max(rulesData.appliedRuleTexts.length, 1));
    eventPartsMap[PARTS.ASSUMED_RULE] = {
        title: ruleTitle,
        data: rulesData.appliedRuleTexts.length > 0 ? rulesData.appliedRuleTexts : null
    };
    // Original rule texts contains elements only if the rule was converted
    if (rulesData.originalRuleTexts.length > 0) {
        eventPartsMap[PARTS.ORIGINAL_RULE] = {
            title: translator/* translator.getPlural */.O.getPlural('filtering_modal_original_rules', Math.max(rulesData.originalRuleTexts.length, 1)),
            data: rulesData.originalRuleTexts.join('\n')
        };
    }
    let infoElementsToShow = Object.values(PARTS);
    if ((_selectedEvent_requestRule2 = selectedEvent.requestRule) === null || _selectedEvent_requestRule2 === void 0 ? void 0 : _selectedEvent_requestRule2.cookieRule) {
        infoElementsToShow = infoElementsToShow.filter((p)=>p !== PARTS.ELEMENT && p !== PARTS.URL);
    }
    // Note: source rules contains text from already preprocessed rules,
    // that's why we checked appliedRuleText, but not originalRuleText.
    const matchedRulesContainsAssumed =  false || ((_selectedEvent_declarativeRuleInfo3 = selectedEvent.declarativeRuleInfo) === null || _selectedEvent_declarativeRuleInfo3 === void 0 ? void 0 : _selectedEvent_declarativeRuleInfo3.sourceRules.some(({ sourceRule })=>{
        return sourceRule === selectedEvent.appliedRuleText;
    }));
    // If assumed and applied rules are the same - show only applied.
    if (selectedEvent.appliedRuleText && matchedRulesContainsAssumed) {
        // Hide assume rule and it's original (not preprocessed) version
        infoElementsToShow = infoElementsToShow.filter((p)=>p !== PARTS.ASSUMED_RULE && p !== PARTS.ORIGINAL_RULE);
    }
    const openInNewTabHandler = async ()=>{
        const url = selectedEvent.requestUrl;
        await WindowsApi.create({
            url,
            focused: true
        });
    };
    const renderInfoUrlButtons = (event)=>{
        // there is nothing to open if log event reveals blocked element or cookie
        const showOpenInNewTabButton = !(event.element || event.cookieName || event.script);
        return /*#__PURE__*/ react.createElement(react.Fragment, null, showOpenInNewTabButton && /*#__PURE__*/ react.createElement("div", {
            role: "button",
            tabIndex: 0,
            className: "button button--link--green request-modal__url-button",
            onClick: openInNewTabHandler
        }, translator/* translator.getMessage */.O.getMessage('filtering_modal_open_in_new_tab')));
    };
    const renderedInfo = infoElementsToShow.map((elementId)=>eventPartsMap[elementId])// original rule text can be undefined which cause runtime error while destructuring
    .filter((el)=>!!el).map((eventPart)=>{
        var _selectedEvent_declarativeRuleInfo, _selectedEvent_declarativeRuleInfo1, _selectedEvent_declarativeRuleInfo2;
        if (!eventPart) {
            return null;
        }
        const { data, title } = eventPart;
        if (!data) {
            return null;
        }
        const isRequestUrl = data === selectedEvent.requestUrl;
        const isRule = data === selectedEvent.appliedRuleText || data === rulesData.appliedRuleTexts;
        const isDeclarativeRule = data === ((_selectedEvent_declarativeRuleInfo = selectedEvent.declarativeRuleInfo) === null || _selectedEvent_declarativeRuleInfo === void 0 ? void 0 : _selectedEvent_declarativeRuleInfo.declarativeRuleJson);
        const isFilterName = data === selectedEvent.filterName;
        const isElement = data === selectedEvent.element;
        const canCopyToClipboard = isRequestUrl || isRule || isFilterName;
        let lineCountLimit = LINE_COUNT_LIMIT.REQUEST_URL;
        if (isRule) {
            lineCountLimit = LINE_COUNT_LIMIT.RULE;
        }
        let showMessage;
        let hideMessage;
        if (isRequestUrl) {
            showMessage = 'filtering_modal_show_full_url';
            hideMessage = 'filtering_modal_hide_full_url';
        } else if (isRule) {
            showMessage = 'filtering_modal_show_full_rule';
            hideMessage = 'filtering_modal_hide_full_rule';
        } else if (isElement) {
            showMessage = 'filtering_modal_show_full_element';
            hideMessage = 'filtering_modal_hide_full_element';
        }
        const collapserButtonMessages = {
            showMessage,
            hideMessage
        };
        const texts = Array.isArray(data) ? data : [
            data
        ];
        const textsWithCollapsers = texts.map((text)=>{
            return /*#__PURE__*/ react.createElement("div", {
                className: "text",
                key: "text"
            },  true && isRule && !isCosmeticRule && /*#__PURE__*/ react.createElement("span", {
                className: "red-dot"
            }, "*"), /*#__PURE__*/ react.createElement(TextCollapser, {
                text: text,
                ref: isRequestUrl || isRule ? requestTextRef : null,
                width: textMaxWidth,
                lineCountLimit: lineCountLimit,
                collapserButtonMessages: collapserButtonMessages,
                canCopy: canCopyToClipboard
            }, isRequestUrl && renderInfoUrlButtons(selectedEvent)));
        });
        const infoAboutAssumedRule = ()=>{
            const text = reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_log_assumed_rule_description', {
                a: (text)=>/*#__PURE__*/ react.createElement("a", {
                        href: options_constants/* FILTERING_LOG_ASSUMED_RULE_URL */.AE,
                        target: "_blank",
                        rel: "noopener noreferrer",
                        className: "button button--link button--link--underlined button--link--green"
                    }, text)
            });
            return /*#__PURE__*/ react.createElement(Popover_Popover/* Popover */.J, {
                text: text,
                fixedWidth: true
            }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
                id: "#question",
                classname: "icon icon--24 icon--green-default"
            }));
        };
        const content = isDeclarativeRule && ((_selectedEvent_declarativeRuleInfo1 = selectedEvent.declarativeRuleInfo) === null || _selectedEvent_declarativeRuleInfo1 === void 0 ? void 0 : _selectedEvent_declarativeRuleInfo1.declarativeRuleJson) ? /*#__PURE__*/ react.createElement("pre", null, JSON.stringify(JSON.parse(selectedEvent.declarativeRuleInfo.declarativeRuleJson), null, 2)) : textsWithCollapsers;
        const classNames = isDeclarativeRule && ((_selectedEvent_declarativeRuleInfo2 = selectedEvent.declarativeRuleInfo) === null || _selectedEvent_declarativeRuleInfo2 === void 0 ? void 0 : _selectedEvent_declarativeRuleInfo2.declarativeRuleJson) ? classnames_default()('request-info__value', 'scrollable') : classnames_default()('request-info__value');
        return /*#__PURE__*/ react.createElement("div", {
            key: title,
            className: "request-info"
        }, /*#__PURE__*/ react.createElement("div", {
            className: "request-info__main"
        }, /*#__PURE__*/ react.createElement("div", {
            className: "request-info__key"
        }, title), /*#__PURE__*/ react.createElement("div", {
            className: classNames
        }, content)),  true && isRule && !isCosmeticRule && /*#__PURE__*/ react.createElement("div", {
            className: "request-info__details"
        }, infoAboutAssumedRule()));
    });
    const blockHandler = ()=>{
        wizardStore.setBlockState();
    };
    const unblockHandler = ()=>{
        wizardStore.setUnblockState();
    };
    const removeFromUserFilterHandler = (event)=>{
        wizardStore.removeFromUserFilterHandler(event);
    };
    const removeFromAllowlistHandler = ()=>{
        wizardStore.removeFromAllowlistHandler();
    };
    const previewClickHandler = ()=>{
        wizardStore.setPreviewState();
    };
    const renderButton = ({ buttonTitleKey, onClick, className })=>{
        const buttonClass = classnames_default()('button button--l request-modal__button', className);
        const title = translator/* translator.getMessage */.O.getMessage(buttonTitleKey);
        return /*#__PURE__*/ react.createElement("button", {
            disabled: wizardStore.isActionSubmitted,
            className: buttonClass,
            type: "button",
            onClick: onClick,
            title: title
        }, title);
    };
    const renderControlButtons = (event)=>{
        const { requestRule } = event;
        const BUTTON_MAP = {
            BLOCK: {
                buttonTitleKey: 'filtering_modal_block',
                onClick: blockHandler,
                className: 'button--red-bg'
            },
            UNBLOCK: {
                buttonTitleKey: 'filtering_modal_unblock',
                onClick: unblockHandler,
                className: 'button--green-bg'
            },
            ALLOWLIST: {
                buttonTitleKey: 'filtering_modal_remove_allowlist',
                onClick: removeFromAllowlistHandler,
                className: 'button--green-bg'
            },
            USER_FILTER: {
                buttonTitleKey: 'filtering_modal_remove_user',
                onClick: ()=>removeFromUserFilterHandler(event),
                className: 'button--red-bg'
            },
            REMOVE_ADDED_BLOCK_RULE: {
                buttonTitleKey: 'filtering_modal_remove_user',
                onClick: ()=>{
                    wizardStore.removeAddedRuleFromUserFilter();
                },
                className: 'button--red-bg'
            },
            REMOVE_ADDED_UNBLOCK_RULE: {
                buttonTitleKey: 'filtering_modal_block_again',
                onClick: ()=>{
                    wizardStore.removeAddedRuleFromUserFilter();
                },
                className: 'button--red-bg'
            },
            PREVIEW: {
                buttonTitleKey: 'filtering_modal_preview_request_button',
                onClick: previewClickHandler,
                className: 'button--transparent'
            }
        };
        let buttonProps = BUTTON_MAP.BLOCK;
        const previewableTypes = [
            index_mv3/* ContentType.Image */.zc.Image,
            index_mv3/* ContentType.Document */.zc.Document,
            index_mv3/* ContentType.Subdocument */.zc.Subdocument,
            index_mv3/* ContentType.Script */.zc.Script,
            index_mv3/* ContentType.Stylesheet */.zc.Stylesheet
        ];
        const showPreviewButton = event.requestType && previewableTypes.includes(event.requestType) && !(event === null || event === void 0 ? void 0 : event.element) && !(event === null || event === void 0 ? void 0 : event.script) && !(event === null || event === void 0 ? void 0 : event.cookieName) && !(getStatusMode(event) === StatusMode.BLOCKED);
        if (addedRuleState === AddedRuleState.Block) {
            return renderButton(BUTTON_MAP.REMOVE_ADDED_BLOCK_RULE);
        }
        if (addedRuleState === AddedRuleState.Unblock) {
            return renderButton(BUTTON_MAP.REMOVE_ADDED_UNBLOCK_RULE);
        }
        if (!requestRule) {
            buttonProps = BUTTON_MAP.BLOCK;
        } else if (requestRule.filterId === constants/* AntiBannerFiltersId.UserFilterId */.m6.UserFilterId) {
            buttonProps = BUTTON_MAP.USER_FILTER;
            if (requestRule.isStealthModeRule) {
                buttonProps = BUTTON_MAP.UNBLOCK;
            }
            if (requestRule.allowlistRule) {
                return /*#__PURE__*/ react.createElement(react.Fragment, null, renderButton(BUTTON_MAP.BLOCK), renderButton(buttonProps), showPreviewButton && renderButton(BUTTON_MAP.PREVIEW));
            }
        } else if (requestRule.filterId === constants/* AntiBannerFiltersId.AllowlistFilterId */.m6.AllowlistFilterId) {
            buttonProps = BUTTON_MAP.ALLOWLIST;
        } else if (!requestRule.allowlistRule) {
            buttonProps = BUTTON_MAP.UNBLOCK;
        } else if (requestRule.allowlistRule) {
            buttonProps = BUTTON_MAP.BLOCK;
        }
        return /*#__PURE__*/ react.createElement(react.Fragment, null, renderButton(buttonProps), showPreviewButton && renderButton(BUTTON_MAP.PREVIEW));
    };
    const getFilterStatusMode = ()=>{
        if (addedRuleState === AddedRuleState.Block) {
            return StatusMode.BLOCKED;
        }
        if (addedRuleState === AddedRuleState.Unblock) {
            return StatusMode.ALLOWED;
        }
        return getStatusMode(selectedEvent);
    };
    return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement("div", {
        className: classnames_default()('request-modal__title', {
            'request-modal__title_fixed': contentOverflowed
        })
    }, /*#__PURE__*/ react.createElement("button", {
        type: "button",
        onClick: closeModal,
        className: "request-modal__navigation",
        "aria-label": translator/* translator.getMessage */.O.getMessage('close_button_title')
    }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: "#cross",
        classname: "icon--24 icon--gray-default"
    })), /*#__PURE__*/ react.createElement("span", {
        className: "request-modal__header"
    }, translator/* translator.getMessage */.O.getMessage('filtering_modal_info_title'))), /*#__PURE__*/ react.createElement("div", {
        ref: contentRef,
        className: "request-modal__content"
    }, selectedEvent.method && /*#__PURE__*/ react.createElement("div", {
        className: "request-info"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "request-info__main"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "request-info__key"
    }, translator/* translator.getMessage */.O.getMessage('filtering_modal_status_text_desc')), /*#__PURE__*/ react.createElement(NetworkStatus, {
        method: selectedEvent.method,
        statusCode: selectedEvent.statusCode,
        isThirdParty: selectedEvent.requestThirdParty
    }))), /*#__PURE__*/ react.createElement("div", {
        className: "request-info"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "request-info__main"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "request-info__key"
    }, translator/* translator.getMessage */.O.getMessage('filtering_modal_filtering_status_text_desc')), /*#__PURE__*/ react.createElement(FilterStatus, {
        mode: getFilterStatusMode(),
        statusCode: selectedEvent.statusCode,
        method: selectedEvent.method
    }))), renderedInfo), /*#__PURE__*/ react.createElement("div", {
        className: classnames_default()('request-modal__controls', {
            'request-modal__controls_fixed': contentOverflowed
        })
    }, renderControlButtons(selectedEvent)));
});


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestInfo/index.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/RequestWizard/RequestCreateRule/request-create-rule.pcss
var request_create_rule = __webpack_require__(35460);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestCreateRule/request-create-rule.pcss

      
      
      
      
      
      
      
      
      

var request_create_rule_options = {};

request_create_rule_options.styleTagTransform = (styleTagTransform_default());
request_create_rule_options.setAttributes = (setAttributesWithoutAttributes_default());

      request_create_rule_options.insert = insertBySelector_default().bind(null, "head");
    
request_create_rule_options.domAPI = (styleDomAPI_default());
request_create_rule_options.insertStyleElement = (insertStyleElement_default());

var request_create_rule_update = injectStylesIntoStyleTag_default()(request_create_rule/* default */.Z, request_create_rule_options);




       /* harmony default export */ const RequestCreateRule_request_create_rule = (request_create_rule/* default */.Z && request_create_rule/* default.locals */.Z.locals ? request_create_rule/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestCreateRule/RequestCreateRule.tsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 












const RequestCreateRule = (0,mobxreact_esm/* observer */.Pi)(()=>{
    const ref = (0,react.useRef)(null);
    const contentOverflowed = useOverflowed(ref);
    const { wizardStore, logStore } = (0,react.useContext)(rootStore);
    const { selectedEvent } = logStore;
    if (!selectedEvent) {
        return null;
    }
    const RULE_OPTIONS_MAP = {
        [RULE_CREATION_OPTION.DOMAIN]: {
            label: `${translator/* translator.getMessage */.O.getMessage('filtering_modal_apply_domains')}`
        },
        [RULE_CREATION_OPTION.THIRD_PARTY]: {
            label: `${translator/* translator.getMessage */.O.getMessage('filtering_modal_third_party')}`
        },
        [RULE_CREATION_OPTION.IMPORTANT]: {
            label: `${translator/* translator.getMessage */.O.getMessage('filtering_modal_important')}`
        },
        [RULE_CREATION_OPTION.REMOVE_PARAM]: {
            label: `${translator/* translator.getMessage */.O.getMessage('filtering_modal_remove_param')}`
        }
    };
    const handlePatternChange = (pattern)=>()=>{
            wizardStore.setRulePattern(pattern);
        };
    const renderPatterns = (patterns)=>{
        const patternItems = patterns.map((pattern, idx)=>/*#__PURE__*/ react.createElement("div", {
                className: "radio-button-wrapper"
            }, /*#__PURE__*/ react.createElement("input", {
                type: "radio",
                id: pattern,
                name: "rulePattern",
                className: "radio-button-input",
                value: pattern,
                disabled: wizardStore.isActionSubmitted,
                checked: pattern === wizardStore.rulePattern,
                onChange: handlePatternChange(pattern)
            }), /*#__PURE__*/ react.createElement("label", {
                /* eslint-disable-next-line react/no-array-index-key */ key: `pattern${idx}`,
                className: "radio-button-label",
                htmlFor: pattern
            }, /*#__PURE__*/ react.createElement("div", {
                className: "radio-button"
            }), /*#__PURE__*/ react.createElement("div", {
                className: "radio-button-desc",
                title: pattern
            }, pattern))));
        return /*#__PURE__*/ react.createElement("div", {
            className: "patterns__content"
        }, patternItems);
    };
    const handleOptionsChange = (id)=>(e)=>{
            const { checked } = e.target;
            wizardStore.setRuleOptionState(id, checked);
        };
    const renderOptions = ()=>{
        const options = Object.entries(RULE_OPTIONS_MAP);
        const renderedOptions = options.map(([id, { label }])=>{
            var _selectedEvent_requestRule, _selectedEvent_requestUrl, _selectedEvent_requestRule1, _wizardStore_ruleOptions_id;
            if (id === RULE_CREATION_OPTION.DOMAIN && !selectedEvent.frameDomain) {
                return null;
            }
            // $third-party and $important modifiers are active for cookie rules
            // so $domain modifier is forbidden
            if ((selectedEvent === null || selectedEvent === void 0 ? void 0 : (_selectedEvent_requestRule = selectedEvent.requestRule) === null || _selectedEvent_requestRule === void 0 ? void 0 : _selectedEvent_requestRule.cookieRule) && id === RULE_CREATION_OPTION.DOMAIN) {
                return null;
            }
            // $removeparam option is available only for requests with query
            // and is not shown for cookie rules
            if (id === RULE_CREATION_OPTION.REMOVE_PARAM && selectedEvent.requestUrl && (((_selectedEvent_requestUrl = selectedEvent.requestUrl) === null || _selectedEvent_requestUrl === void 0 ? void 0 : _selectedEvent_requestUrl.indexOf('?')) < 0 || ((_selectedEvent_requestRule1 = selectedEvent.requestRule) === null || _selectedEvent_requestRule1 === void 0 ? void 0 : _selectedEvent_requestRule1.cookieRule))) {
                return null;
            }
            return /*#__PURE__*/ react.createElement("div", {
                className: "checkbox-wrapper"
            }, /*#__PURE__*/ react.createElement("input", {
                id: id,
                className: "checkbox-input",
                type: "checkbox",
                name: id,
                value: id,
                disabled: wizardStore.isActionSubmitted,
                onChange: handleOptionsChange(id),
                checked: (_wizardStore_ruleOptions_id = wizardStore.ruleOptions[id]) === null || _wizardStore_ruleOptions_id === void 0 ? void 0 : _wizardStore_ruleOptions_id.checked
            }), /*#__PURE__*/ react.createElement("label", {
                htmlFor: id,
                className: "checkbox-label",
                key: id
            }, /*#__PURE__*/ react.createElement("div", {
                className: "custom-checkbox"
            }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
                id: "#checked",
                classname: "icon--18"
            })), /*#__PURE__*/ react.createElement("div", {
                className: "checkbox-label__desc"
            }, label)));
        });
        return /*#__PURE__*/ react.createElement("form", null, /*#__PURE__*/ react.createElement("div", {
            className: "options__content"
        }, renderedOptions));
    };
    const handleBackClick = ()=>{
        wizardStore.setViewState();
    };
    const handleAddRuleClick = async ()=>{
        if (!wizardStore.rule) {
            common_logger/* logger.error */.k.error('[handleAddRuleClick]: rule is empty.');
            return;
        }
        wizardStore.setActionSubmitted(true);
        await messenger/* messenger.addUserRule */.d.addUserRule(wizardStore.rule);
        const addedRuleState = wizardStore.requestModalState === WizardRequestState.Block ? AddedRuleState.Block : AddedRuleState.Unblock;
        wizardStore.setAddedRuleState(addedRuleState);
        wizardStore.setActionSubmitted(false);
    };
    const handleRuleChange = (e)=>{
        wizardStore.setRuleText(e.currentTarget.value);
    };
    const { element, script, requestRule } = selectedEvent;
    // Must invoke wizardStore.rulePatterns unconditionally to trigger wizardStore.rule computation
    const rulePatterns = renderPatterns(wizardStore.rulePatterns);
    const options = renderOptions();
    const isElementOrScript = element || script;
    const showPatterns = !isElementOrScript && !(requestRule === null || requestRule === void 0 ? void 0 : requestRule.documentLevelRule) && wizardStore.rulePatterns && wizardStore.rulePatterns.length > 1;
    const showOptions = !isElementOrScript && !(requestRule === null || requestRule === void 0 ? void 0 : requestRule.documentLevelRule);
    let title = reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_modal_add_title');
    if (wizardStore.requestModalState === WizardRequestState.Unblock) {
        title = reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_modal_exception_title');
    }
    return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement("div", {
        className: classnames_default()('request-modal__title', {
            'request-modal__title_fixed': contentOverflowed
        })
    }, /*#__PURE__*/ react.createElement("button", {
        type: "button",
        onClick: handleBackClick,
        className: "request-modal__navigation"
    }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: "#arrow-left",
        classname: "icon--24 icon--gray-default"
    }), /*#__PURE__*/ react.createElement("span", {
        className: "request-modal__header"
    }, title))), /*#__PURE__*/ react.createElement("div", {
        ref: ref,
        className: "request-modal__content"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "request-info"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "request-info__main"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "request-info__key"
    }, reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_modal_rule_text_desc')), /*#__PURE__*/ react.createElement("textarea", {
        disabled: wizardStore.isActionSubmitted,
        className: "request-info__value request-modal__rule-text",
        onChange: handleRuleChange,
        value: wizardStore.rule
    }))), showPatterns && /*#__PURE__*/ react.createElement("div", {
        className: "request-info patterns"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "request-info__main"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "request-info__key"
    }, translator/* translator.getMessage */.O.getMessage('filtering_modal_patterns_desc')), rulePatterns)), showOptions && /*#__PURE__*/ react.createElement("div", {
        className: "request-info options"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "request-info__main"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "request-info__key"
    }, translator/* translator.getMessage */.O.getMessage('filtering_modal_options_desc')), options))), /*#__PURE__*/ react.createElement("div", {
        className: classnames_default()('request-modal__controls', {
            'request-modal__controls_fixed': contentOverflowed
        })
    }, /*#__PURE__*/ react.createElement("button", {
        disabled: wizardStore.isActionSubmitted,
        type: "button",
        className: "button button--l button--green-bg request-modal__button",
        onClick: handleAddRuleClick,
        title: translator/* translator.getMessage */.O.getMessage('filtering_modal_add_rule')
    }, translator/* translator.getMessage */.O.getMessage('filtering_modal_add_rule'))));
});


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestCreateRule/index.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

// EXTERNAL MODULE: ./node_modules/.pnpm/xstate@5.19.0/node_modules/xstate/actors/dist/xstate-actors.esm.js
var xstate_actors_esm = __webpack_require__(37642);
;// CONCATENATED MODULE: ./node_modules/.pnpm/use-isomorphic-layout-effect@1.1.2_@types+react@17.0.83_react@17.0.2/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js


var index =  react.useLayoutEffect ;

/* harmony default export */ const use_isomorphic_layout_effect_browser_esm = (index);

// EXTERNAL MODULE: ./node_modules/.pnpm/xstate@5.19.0/node_modules/xstate/dist/raise-c17ec2bc.esm.js + 1 modules
var raise_c17ec2bc_esm = __webpack_require__(42208);
// EXTERNAL MODULE: ./node_modules/.pnpm/use-sync-external-store@1.2.0_react@17.0.2/node_modules/use-sync-external-store/shim/with-selector.js
var with_selector = __webpack_require__(10344);
// EXTERNAL MODULE: ./node_modules/.pnpm/use-sync-external-store@1.2.0_react@17.0.2/node_modules/use-sync-external-store/shim/index.js
var shim = __webpack_require__(39009);
;// CONCATENATED MODULE: ./node_modules/.pnpm/@xstate+react@4.1.3_@types+react@17.0.83_react@17.0.2_xstate@5.19.0/node_modules/@xstate/react/dist/xstate-react.esm.js







const forEachActor = (actorRef, callback) => {
  callback(actorRef);
  const children = actorRef.getSnapshot().children;
  if (children) {
    Object.values(children).forEach(child => {
      forEachActor(child, callback);
    });
  }
};
function stopRootWithRehydration(actorRef) {
  // persist snapshot here in a custom way allows us to persist inline actors and to preserve actor references
  // we do it to avoid setState in useEffect when the effect gets "reconnected"
  // this currently only happens in Strict Effects but it simulates the Offscreen aka Activity API
  // it also just allows us to end up with a somewhat more predictable behavior for the users
  const persistedSnapshots = [];
  forEachActor(actorRef, ref => {
    persistedSnapshots.push([ref, ref.getSnapshot()]);
    // muting observers allow us to avoid `useSelector` from being notified about the stopped snapshot
    // React reconnects its subscribers (from the useSyncExternalStore) on its own
    // and userland subscibers should basically always do the same anyway
    // as each subscription should have its own cleanup logic and that should be called each such reconnect
    ref.observers = new Set();
  });
  const systemSnapshot = actorRef.system.getSnapshot?.();
  actorRef.stop();
  actorRef.system._snapshot = systemSnapshot;
  persistedSnapshots.forEach(([ref, snapshot]) => {
    ref._processingStatus = 0;
    ref._snapshot = snapshot;
  });
}

function useIdleActorRef(logic, ...[options]) {
  let [[currentConfig, actorRef], setCurrent] = (0,react.useState)(() => {
    const actorRef = (0,raise_c17ec2bc_esm.A)(logic, options);
    return [logic.config, actorRef];
  });
  if (logic.config !== currentConfig) {
    const newActorRef = (0,raise_c17ec2bc_esm.A)(logic, {
      ...options,
      snapshot: actorRef.getPersistedSnapshot({
        __unsafeAllowInlineActors: true
      })
    });
    setCurrent([logic.config, newActorRef]);
    actorRef = newActorRef;
  }

  // TODO: consider using `useAsapEffect` that would do this in `useInsertionEffect` is that's available
  use_isomorphic_layout_effect_browser_esm(() => {
    actorRef.logic.implementations = logic.implementations;
  });
  return actorRef;
}
function useActorRef(machine, ...[options, observerOrListener]) {
  const actorRef = useIdleActorRef(machine, options);
  useEffect(() => {
    if (!observerOrListener) {
      return;
    }
    let sub = actorRef.subscribe(toObserver(observerOrListener));
    return () => {
      sub.unsubscribe();
    };
  }, [observerOrListener]);
  useEffect(() => {
    actorRef.start();
    return () => {
      stopRootWithRehydration(actorRef);
    };
  }, [actorRef]);
  return actorRef;
}

function defaultCompare(a, b) {
  return a === b;
}
function useSelector(actor, selector, compare = defaultCompare) {
  const subscribe = useCallback(handleStoreChange => {
    if (!actor) {
      return () => {};
    }
    const {
      unsubscribe
    } = actor.subscribe(handleStoreChange);
    return unsubscribe;
  }, [actor]);
  const boundGetSnapshot = useCallback(() => actor?.getSnapshot(), [actor]);
  const selectedSnapshot = useSyncExternalStoreWithSelector(subscribe, boundGetSnapshot, boundGetSnapshot, selector, compare);
  return selectedSnapshot;
}

function createActorContext(actorLogic, actorOptions) {
  const ReactContext = /*#__PURE__*/React.createContext(null);
  const OriginalProvider = ReactContext.Provider;
  function Provider({
    children,
    logic: providedLogic = actorLogic,
    machine,
    options: providedOptions
  }) {
    if (machine) {
      throw new Error(`The "machine" prop has been deprecated. Please use "logic" instead.`);
    }
    const actor = useActorRef(providedLogic, {
      ...actorOptions,
      ...providedOptions
    });
    return /*#__PURE__*/React.createElement(OriginalProvider, {
      value: actor,
      children
    });
  }

  // TODO: add properties to actor ref to make more descriptive
  Provider.displayName = `ActorProvider`;
  function useContext() {
    const actor = React.useContext(ReactContext);
    if (!actor) {
      throw new Error(`You used a hook from "${Provider.displayName}" but it's not inside a <${Provider.displayName}> component.`);
    }
    return actor;
  }
  function useSelector$1(selector, compare) {
    const actor = useContext();
    return useSelector(actor, selector, compare);
  }
  return {
    Provider: Provider,
    useActorRef: useContext,
    useSelector: useSelector$1
  };
}

// From https://github.com/reduxjs/react-redux/blob/720f0ba79236cdc3e1115f4ef9a7760a21784b48/src/utils/shallowEqual.ts
function is(x, y) {
  if (x === y) {
    return x !== 0 || y !== 0 || 1 / x === 1 / y;
  } else {
    return x !== x && y !== y;
  }
}
function shallowEqual(objA, objB) {
  if (is(objA, objB)) return true;
  if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
    return false;
  }
  const keysA = Object.keys(objA);
  const keysB = Object.keys(objB);
  if (keysA.length !== keysB.length) return false;
  for (let i = 0; i < keysA.length; i++) {
    if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
      return false;
    }
  }
  return true;
}

function useActor(logic, ...[options]) {
  const actorRef = useIdleActorRef(logic, options);
  const getSnapshot = (0,react.useCallback)(() => {
    return actorRef.getSnapshot();
  }, [actorRef]);
  const subscribe = (0,react.useCallback)(handleStoreChange => {
    const {
      unsubscribe
    } = actorRef.subscribe(handleStoreChange);
    return unsubscribe;
  }, [actorRef]);
  const actorSnapshot = (0,shim.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
  (0,react.useEffect)(() => {
    actorRef.start();
    return () => {
      stopRootWithRehydration(actorRef);
    };
  }, [actorRef]);
  return [actorSnapshot, actorRef.send, actorRef];
}

/** @alias useActor */
function useMachine(machine, ...[options]) {
  return useActor(machine, options);
}



// EXTERNAL MODULE: ./node_modules/.pnpm/xstate@5.19.0/node_modules/xstate/dist/log-2a773d37.esm.js
var log_2a773d37_esm = __webpack_require__(82193);
// EXTERNAL MODULE: ./node_modules/.pnpm/xstate@5.19.0/node_modules/xstate/dist/xstate.esm.js
var xstate_esm = __webpack_require__(48030);
;// CONCATENATED MODULE: ./Extension/src/pages/common/machines/fetchMachine.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const FetchStates = {
    IDLE: 'idle',
    LOADING: 'loading',
    SUCCESS: 'success',
    FAILURE: 'failure'
};
const FetchEvents = {
    FETCH: 'FETCH',
    RETRY: 'RETRY'
};
const FETCH_MACHINE_ID = 'fetchMachine';
const fetchMachineConfig = {
    id: FETCH_MACHINE_ID,
    initial: FetchStates.IDLE,
    context: {
        data: null,
        error: null
    },
    states: {
        [FetchStates.IDLE]: {
            on: {
                [FetchEvents.FETCH]: FetchStates.LOADING
            }
        },
        [FetchStates.LOADING]: {
            invoke: {
                src: 'fetchData',
                input: ({ event })=>event,
                onDone: {
                    target: FetchStates.SUCCESS,
                    actions: 'setData'
                },
                onError: {
                    target: FetchStates.FAILURE,
                    actions: 'setError'
                }
            }
        },
        [FetchStates.SUCCESS]: {
            type: 'final'
        },
        [FetchStates.FAILURE]: {
            on: {
                [FetchEvents.RETRY]: FetchStates.LOADING
            }
        }
    }
};
const fetchMachineOptions = {
    actions: {
        setData: (0,log_2a773d37_esm.a)(({ event })=>({
                data: event.output
            })),
        setError: (0,log_2a773d37_esm.a)(({ event })=>({
                error: event.output
            }))
    }
};
const fetchMachine = (0,xstate_esm/* setup */.cY)(fetchMachineOptions).createMachine(fetchMachineConfig);

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/RequestWizard/RequestInfo/request-image.pcss
var request_image = __webpack_require__(25234);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestInfo/request-image.pcss

      
      
      
      
      
      
      
      
      

var request_image_options = {};

request_image_options.styleTagTransform = (styleTagTransform_default());
request_image_options.setAttributes = (setAttributesWithoutAttributes_default());

      request_image_options.insert = insertBySelector_default().bind(null, "head");
    
request_image_options.domAPI = (styleDomAPI_default());
request_image_options.insertStyleElement = (insertStyleElement_default());

var request_image_update = injectStylesIntoStyleTag_default()(request_image/* default */.Z, request_image_options);




       /* harmony default export */ const RequestInfo_request_image = (request_image/* default */.Z && request_image/* default.locals */.Z.locals ? request_image/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestPreview/ImageRequest.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 




const ImageRequest = ({ src })=>{
    (0,react.useEffect)(()=>{
        // clean up blob src on component destroying for preventing memory leak
        return ()=>{
            URL.revokeObjectURL(src);
        };
    });
    return /*#__PURE__*/ react.createElement("img", {
        src: src,
        className: "request-image",
        alt: "request"
    });
};

// EXTERNAL MODULE: ./node_modules/.pnpm/js-beautify@1.14.7/node_modules/js-beautify/js/index.js
var js = __webpack_require__(59440);
var js_default = /*#__PURE__*/__webpack_require__.n(js);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestPreview/TextRequest.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


const getBeautifier = (type)=>{
    switch(type){
        case index_mv3/* ContentType.Document */.zc.Document:
        case index_mv3/* ContentType.Subdocument */.zc.Subdocument:
            return (js_default()).html;
        case index_mv3/* ContentType.Script */.zc.Script:
            return (js_default()).js;
        case index_mv3/* ContentType.Stylesheet */.zc.Stylesheet:
            return (js_default()).css;
        default:
            return (i)=>i;
    }
};
const TextRequest = ({ text, requestType, shouldBeautify })=>{
    const [textState, setTextState] = (0,react.useState)(text);
    (0,react.useEffect)(()=>{
        if (shouldBeautify) {
            const beautifier = getBeautifier(requestType);
            const beautifiedResponse = beautifier(text);
            setTextState(beautifiedResponse);
        }
    }, [
        shouldBeautify,
        requestType,
        text
    ]);
    if (textState) {
        return /*#__PURE__*/ react.createElement("div", {
            className: "request-modal__text"
        }, /*#__PURE__*/ react.createElement("pre", null, /*#__PURE__*/ react.createElement("code", null, textState)));
    }
    return null;
};

// EXTERNAL MODULE: ./node_modules/.pnpm/core-js@3.32.0/node_modules/core-js/modules/es.error.cause.js
var es_error_cause = __webpack_require__(82514);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestPreview/fetchers.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ // async functions invoking by state machine on fetch event.
// https://xstate.js.org/docs/guides/communication.html#invoking-promises
/**
 * Fetches text.
 *
 * @param {object} eventObj Event object.
 * @param {object} eventObj.input Event input property with data object which contains url.
 *
 * @returns {Promise<string>} Text content.
 */ 



const fetchText = async ({ input })=>{
    const { data } = input;
    const { url } = data;
    const res = await fetch(url);
    return res.text();
};
/**
 * Fetches image.
 *
 * @param {object} eventObj Event object.
 * @param {object} eventObj.input Event input property with data object which contains url.
 *
 * @returns {Promise<string>} Image data URL.
 */ const fetchImage = async ({ input })=>{
    const { data } = input;
    const { url } = data;
    const res = await fetch(url);
    const blob = await res.blob();
    const dataUrl = URL.createObjectURL(blob);
    // check image size
    return new Promise((resolve, reject)=>{
        const image = new Image();
        image.src = url;
        const loadHandler = (event)=>{
            const { width, height } = event.target;
            if (width > 1 && height > 1) {
                resolve(dataUrl);
            } else {
                reject(new Error('Image is too small'));
            }
        };
        image.addEventListener('load', loadHandler);
        image.addEventListener('error', reject);
    });
};

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/RequestWizard/RequestPreview/request-preview.pcss
var request_preview = __webpack_require__(98697);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestPreview/request-preview.pcss

      
      
      
      
      
      
      
      
      

var request_preview_options = {};

request_preview_options.styleTagTransform = (styleTagTransform_default());
request_preview_options.setAttributes = (setAttributesWithoutAttributes_default());

      request_preview_options.insert = insertBySelector_default().bind(null, "head");
    
request_preview_options.domAPI = (styleDomAPI_default());
request_preview_options.insertStyleElement = (insertStyleElement_default());

var request_preview_update = injectStylesIntoStyleTag_default()(request_preview/* default */.Z, request_preview_options);




       /* harmony default export */ const RequestPreview_request_preview = (request_preview/* default */.Z && request_preview/* default.locals */.Z.locals ? request_preview/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestPreview/RequestPreview.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 













const RequestPreview = (0,mobxreact_esm/* observer */.Pi)(()=>{
    const { wizardStore, logStore } = (0,react.useContext)(rootStore);
    const { selectedEvent } = logStore;
    const { requestType, requestUrl } = selectedEvent;
    const isText = requestType === index_mv3/* ContentType.Document */.zc.Document || requestType === index_mv3/* ContentType.Subdocument */.zc.Subdocument || requestType === index_mv3/* ContentType.Script */.zc.Script || requestType === index_mv3/* ContentType.Stylesheet */.zc.Stylesheet;
    const isImage = requestType === index_mv3/* ContentType.Image */.zc.Image;
    const getFetcher = ()=>{
        if (isText) {
            return fetchText;
        }
        if (isImage) {
            return fetchImage;
        }
        return null;
    };
    const [previewState, send] = useMachine(fetchMachine.provide({
        actors: {
            fetchData: (0,xstate_actors_esm/* fromPromise */.p4)(getFetcher())
        }
    }));
    const [beautify, setBeautify] = (0,react.useState)(false);
    (0,react.useEffect)(()=>{
        send({
            type: FetchEvents.FETCH,
            data: {
                url: requestUrl
            }
        });
    }, [
        requestUrl,
        send
    ]);
    const onRetry = ()=>{
        send({
            type: FetchEvents.RETRY,
            data: {
                url: requestUrl
            }
        });
    };
    const handleBackToRequestClick = ()=>{
        wizardStore.setViewState();
    };
    const handleBeautifyClick = ()=>{
        setBeautify(true);
    };
    const tryAgainButtonTitle = reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_log_details_modal_try_again');
    const backToRequestButtonTitle = reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_log_details_modal_back_button');
    const beautifyButtonTitle = reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_log_details_modal_beautify_button');
    const renderContent = ()=>{
        if (previewState.matches(FetchStates.LOADING)) {
            return /*#__PURE__*/ react.createElement("div", {
                className: "request-preview__status"
            }, /*#__PURE__*/ react.createElement("span", {
                className: "request-info__value request-preview__text"
            }, reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_modal_status_text_loading')));
        }
        if (previewState.matches(FetchStates.FAILURE)) {
            return /*#__PURE__*/ react.createElement("div", {
                className: "request-preview__status"
            }, /*#__PURE__*/ react.createElement("span", {
                className: "request-info__error request-preview__text"
            }, reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_modal_status_text_error')), /*#__PURE__*/ react.createElement("button", {
                type: "button",
                className: "button button--l button--green-bg request-preview__button",
                onClick: onRetry,
                title: tryAgainButtonTitle
            }, tryAgainButtonTitle));
        }
        if (previewState.matches(FetchStates.SUCCESS)) {
            if (isImage) {
                return /*#__PURE__*/ react.createElement(ImageRequest, {
                    src: previewState.context.data
                });
            }
            if (isText) {
                return /*#__PURE__*/ react.createElement(TextRequest, {
                    text: previewState.context.data,
                    requestType: requestType,
                    shouldBeautify: beautify
                });
            }
            return null;
        }
        return null;
    };
    return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement("div", {
        className: "request-modal__title"
    }, /*#__PURE__*/ react.createElement("button", {
        type: "button",
        onClick: handleBackToRequestClick,
        className: "request-modal__navigation"
    }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: "#arrow-left",
        classname: "icon--24 icon--gray-default"
    }), /*#__PURE__*/ react.createElement("span", {
        className: "request-modal__header"
    }, reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_modal_preview_title')))), /*#__PURE__*/ react.createElement("div", {
        className: "request-modal__content request-preview"
    }, renderContent()), /*#__PURE__*/ react.createElement("div", {
        className: "request-modal__controls"
    }, /*#__PURE__*/ react.createElement("button", {
        type: "button",
        className: "button button--l button--transparent request-modal__button",
        onClick: handleBackToRequestClick,
        title: backToRequestButtonTitle
    }, backToRequestButtonTitle), isText && previewState.matches(FetchStates.SUCCESS) && /*#__PURE__*/ react.createElement("button", {
        type: "button",
        className: "button button--l button--transparent request-modal__button",
        onClick: handleBeautifyClick,
        title: beautifyButtonTitle
    }, beautifyButtonTitle)));
});

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestPreview/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/RequestWizard/RequestModal/request-modal.pcss
var request_modal = __webpack_require__(29889);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestModal/request-modal.pcss

      
      
      
      
      
      
      
      
      

var request_modal_options = {};

request_modal_options.styleTagTransform = (styleTagTransform_default());
request_modal_options.setAttributes = (setAttributesWithoutAttributes_default());

      request_modal_options.insert = insertBySelector_default().bind(null, "head");
    
request_modal_options.domAPI = (styleDomAPI_default());
request_modal_options.insertStyleElement = (insertStyleElement_default());

var request_modal_update = injectStylesIntoStyleTag_default()(request_modal/* default */.Z, request_modal_options);




       /* harmony default export */ const RequestModal_request_modal = (request_modal/* default */.Z && request_modal/* default.locals */.Z.locals ? request_modal/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestModal/RequestModal.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ /* eslint-disable jsx-a11y/no-static-element-interactions */ 











lib_default().setAppElement('#root');
const RequestModal = (0,mobxreact_esm/* observer */.Pi)(()=>{
    const { wizardStore } = (0,react.useContext)(rootStore);
    const onKeyUp = (0,react.useCallback)((e)=>{
        if (e.key === 'Escape') {
            wizardStore.closeModal();
        }
    }, [
        wizardStore
    ]);
    (0,react.useEffect)(()=>{
        window.addEventListener('keyup', onKeyUp);
        return ()=>{
            window.removeEventListener('keyup', onKeyUp);
        };
    }, [
        onKeyUp
    ]);
    const MAX_MODAL_WIDTH_RATIO = 0.75;
    const startModalWidth = options_storage/* optionsStorage.getItem */.P.getItem(options_storage/* optionsStorage.KEYS.REQUEST_INFO_MODAL_WIDTH */.P.KEYS.REQUEST_INFO_MODAL_WIDTH) || DEFAULT_MODAL_WIDTH_PX;
    const [modalWidth, setModalWidth] = (0,react.useState)(startModalWidth);
    const dragBar = (0,react.useRef)(null);
    const { isModalOpen, closeModal, requestModalState, requestModalStateEnum } = wizardStore;
    let modalContent;
    switch(requestModalState){
        case WizardRequestState.View:
            {
                modalContent = /*#__PURE__*/ react.createElement(RequestInfo, null);
                break;
            }
        case WizardRequestState.Block:
        case WizardRequestState.Unblock:
            {
                modalContent = /*#__PURE__*/ react.createElement(RequestCreateRule, null);
                break;
            }
        case WizardRequestState.Preview:
            {
                modalContent = /*#__PURE__*/ react.createElement(RequestPreview, null);
                break;
            }
        default:
            modalContent = /*#__PURE__*/ react.createElement(RequestInfo, null);
    }
    const className = classnames_default()('ReactModal__Content request-modal', {
        'request-modal__view': requestModalStateEnum.isView,
        'request-modal__block': requestModalStateEnum.isBlock,
        'request-modal__unblock': requestModalStateEnum.isUnblock
    });
    const persistModalWidth = (width)=>{
        setModalWidth(width);
        options_storage/* optionsStorage.setItem */.P.setItem(options_storage/* optionsStorage.KEYS.REQUEST_INFO_MODAL_WIDTH */.P.KEYS.REQUEST_INFO_MODAL_WIDTH, width);
    };
    const drag = (e)=>{
        const newWidth = window.innerWidth - e.pageX;
        if (newWidth < DEFAULT_MODAL_WIDTH_PX || newWidth > window.innerWidth * MAX_MODAL_WIDTH_RATIO) {
            return;
        }
        persistModalWidth(newWidth);
    };
    const mouseDownHandler = ()=>{
        const cleaner = ()=>{
            document.removeEventListener('mousemove', drag);
            document.removeEventListener('mouseup', cleaner);
        };
        document.addEventListener('mouseup', cleaner);
        document.addEventListener('mousemove', drag);
    };
    return /*#__PURE__*/ react.createElement((lib_default()), {
        isOpen: isModalOpen,
        onRequestClose: closeModal,
        className: className,
        overlayClassName: "ReactModal__Overlay request-modal__overlay",
        style: {
            content: {
                width: `${modalWidth}px`
            }
        }
    }, /*#__PURE__*/ react.createElement("div", {
        ref: dragBar,
        className: "request-modal__dragbar",
        onMouseDown: mouseDownHandler
    }), modalContent);
});


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/RequestWizard/RequestModal/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

// EXTERNAL MODULE: ./Extension/src/pages/common/components/ui/Icons.tsx + 1 modules
var Icons = __webpack_require__(79087);
// EXTERNAL MODULE: ./Extension/src/pages/common/hooks/useAppearanceTheme.js
var useAppearanceTheme = __webpack_require__(96079);
// EXTERNAL MODULE: ./node_modules/.pnpm/core-js@3.32.0/node_modules/core-js/modules/es.array.reduce.js
var es_array_reduce = __webpack_require__(15004);
;// CONCATENATED MODULE: ./node_modules/.pnpm/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/extends.js
function _extends() {
  _extends = Object.assign ? Object.assign.bind() : function (target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];
      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }
    return target;
  };
  return _extends.apply(this, arguments);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
function _assertThisInitialized(self) {
  if (self === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self;
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
function _setPrototypeOf(o, p) {
  _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
    o.__proto__ = p;
    return o;
  };
  return _setPrototypeOf(o, p);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js

function _inheritsLoose(subClass, superClass) {
  subClass.prototype = Object.create(superClass.prototype);
  subClass.prototype.constructor = subClass;
  _setPrototypeOf(subClass, superClass);
}
;// CONCATENATED MODULE: ./node_modules/.pnpm/memoize-one@5.2.1/node_modules/memoize-one/dist/memoize-one.esm.js
var safeIsNaN = Number.isNaN ||
    function ponyfill(value) {
        return typeof value === 'number' && value !== value;
    };
function isEqual(first, second) {
    if (first === second) {
        return true;
    }
    if (safeIsNaN(first) && safeIsNaN(second)) {
        return true;
    }
    return false;
}
function areInputsEqual(newInputs, lastInputs) {
    if (newInputs.length !== lastInputs.length) {
        return false;
    }
    for (var i = 0; i < newInputs.length; i++) {
        if (!isEqual(newInputs[i], lastInputs[i])) {
            return false;
        }
    }
    return true;
}

function memoizeOne(resultFn, isEqual) {
    if (isEqual === void 0) { isEqual = areInputsEqual; }
    var lastThis;
    var lastArgs = [];
    var lastResult;
    var calledOnce = false;
    function memoized() {
        var newArgs = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            newArgs[_i] = arguments[_i];
        }
        if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
            return lastResult;
        }
        lastResult = resultFn.apply(this, newArgs);
        calledOnce = true;
        lastThis = this;
        lastArgs = newArgs;
        return lastResult;
    }
    return memoized;
}

/* harmony default export */ const memoize_one_esm = (memoizeOne);

;// CONCATENATED MODULE: ./node_modules/.pnpm/react-window@1.8.8_react-dom@17.0.2_react@17.0.2/node_modules/react-window/dist/index.esm.js







// Animation frame based implementation of setTimeout.
// Inspired by Joe Lambert, https://gist.github.com/joelambert/1002116#file-requesttimeout-js
var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
var now = hasNativePerformanceNow ? function () {
  return performance.now();
} : function () {
  return Date.now();
};
function cancelTimeout(timeoutID) {
  cancelAnimationFrame(timeoutID.id);
}
function requestTimeout(callback, delay) {
  var start = now();

  function tick() {
    if (now() - start >= delay) {
      callback.call(null);
    } else {
      timeoutID.id = requestAnimationFrame(tick);
    }
  }

  var timeoutID = {
    id: requestAnimationFrame(tick)
  };
  return timeoutID;
}

var size = -1; // This utility copied from "dom-helpers" package.

function getScrollbarSize(recalculate) {
  if (recalculate === void 0) {
    recalculate = false;
  }

  if (size === -1 || recalculate) {
    var div = document.createElement('div');
    var style = div.style;
    style.width = '50px';
    style.height = '50px';
    style.overflow = 'scroll';
    document.body.appendChild(div);
    size = div.offsetWidth - div.clientWidth;
    document.body.removeChild(div);
  }

  return size;
}
var cachedRTLResult = null; // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).
// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.
// The safest way to check this is to intentionally set a negative offset,
// and then verify that the subsequent "scroll" event matches the negative offset.
// If it does not match, then we can assume a non-standard RTL scroll implementation.

function getRTLOffsetType(recalculate) {
  if (recalculate === void 0) {
    recalculate = false;
  }

  if (cachedRTLResult === null || recalculate) {
    var outerDiv = document.createElement('div');
    var outerStyle = outerDiv.style;
    outerStyle.width = '50px';
    outerStyle.height = '50px';
    outerStyle.overflow = 'scroll';
    outerStyle.direction = 'rtl';
    var innerDiv = document.createElement('div');
    var innerStyle = innerDiv.style;
    innerStyle.width = '100px';
    innerStyle.height = '100px';
    outerDiv.appendChild(innerDiv);
    document.body.appendChild(outerDiv);

    if (outerDiv.scrollLeft > 0) {
      cachedRTLResult = 'positive-descending';
    } else {
      outerDiv.scrollLeft = 1;

      if (outerDiv.scrollLeft === 0) {
        cachedRTLResult = 'negative';
      } else {
        cachedRTLResult = 'positive-ascending';
      }
    }

    document.body.removeChild(outerDiv);
    return cachedRTLResult;
  }

  return cachedRTLResult;
}

var IS_SCROLLING_DEBOUNCE_INTERVAL = 150;

var defaultItemKey = function defaultItemKey(_ref) {
  var columnIndex = _ref.columnIndex,
      data = _ref.data,
      rowIndex = _ref.rowIndex;
  return rowIndex + ":" + columnIndex;
}; // In DEV mode, this Set helps us only log a warning once per component instance.
// This avoids spamming the console every time a render happens.


var devWarningsOverscanCount = null;
var devWarningsOverscanRowsColumnsCount = null;
var devWarningsTagName = null;

if (false) {}

function createGridComponent(_ref2) {
  var _class;

  var getColumnOffset = _ref2.getColumnOffset,
      getColumnStartIndexForOffset = _ref2.getColumnStartIndexForOffset,
      getColumnStopIndexForStartIndex = _ref2.getColumnStopIndexForStartIndex,
      getColumnWidth = _ref2.getColumnWidth,
      getEstimatedTotalHeight = _ref2.getEstimatedTotalHeight,
      getEstimatedTotalWidth = _ref2.getEstimatedTotalWidth,
      getOffsetForColumnAndAlignment = _ref2.getOffsetForColumnAndAlignment,
      getOffsetForRowAndAlignment = _ref2.getOffsetForRowAndAlignment,
      getRowHeight = _ref2.getRowHeight,
      getRowOffset = _ref2.getRowOffset,
      getRowStartIndexForOffset = _ref2.getRowStartIndexForOffset,
      getRowStopIndexForStartIndex = _ref2.getRowStopIndexForStartIndex,
      initInstanceProps = _ref2.initInstanceProps,
      shouldResetStyleCacheOnItemSizeChange = _ref2.shouldResetStyleCacheOnItemSizeChange,
      validateProps = _ref2.validateProps;
  return _class = /*#__PURE__*/function (_PureComponent) {
    _inheritsLoose(Grid, _PureComponent);

    // Always use explicit constructor for React components.
    // It produces less code after transpilation. (#26)
    // eslint-disable-next-line no-useless-constructor
    function Grid(props) {
      var _this;

      _this = _PureComponent.call(this, props) || this;
      _this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(_this));
      _this._resetIsScrollingTimeoutId = null;
      _this._outerRef = void 0;
      _this.state = {
        instance: _assertThisInitialized(_this),
        isScrolling: false,
        horizontalScrollDirection: 'forward',
        scrollLeft: typeof _this.props.initialScrollLeft === 'number' ? _this.props.initialScrollLeft : 0,
        scrollTop: typeof _this.props.initialScrollTop === 'number' ? _this.props.initialScrollTop : 0,
        scrollUpdateWasRequested: false,
        verticalScrollDirection: 'forward'
      };
      _this._callOnItemsRendered = void 0;
      _this._callOnItemsRendered = memoize_one_esm(function (overscanColumnStartIndex, overscanColumnStopIndex, overscanRowStartIndex, overscanRowStopIndex, visibleColumnStartIndex, visibleColumnStopIndex, visibleRowStartIndex, visibleRowStopIndex) {
        return _this.props.onItemsRendered({
          overscanColumnStartIndex: overscanColumnStartIndex,
          overscanColumnStopIndex: overscanColumnStopIndex,
          overscanRowStartIndex: overscanRowStartIndex,
          overscanRowStopIndex: overscanRowStopIndex,
          visibleColumnStartIndex: visibleColumnStartIndex,
          visibleColumnStopIndex: visibleColumnStopIndex,
          visibleRowStartIndex: visibleRowStartIndex,
          visibleRowStopIndex: visibleRowStopIndex
        });
      });
      _this._callOnScroll = void 0;
      _this._callOnScroll = memoize_one_esm(function (scrollLeft, scrollTop, horizontalScrollDirection, verticalScrollDirection, scrollUpdateWasRequested) {
        return _this.props.onScroll({
          horizontalScrollDirection: horizontalScrollDirection,
          scrollLeft: scrollLeft,
          scrollTop: scrollTop,
          verticalScrollDirection: verticalScrollDirection,
          scrollUpdateWasRequested: scrollUpdateWasRequested
        });
      });
      _this._getItemStyle = void 0;

      _this._getItemStyle = function (rowIndex, columnIndex) {
        var _this$props = _this.props,
            columnWidth = _this$props.columnWidth,
            direction = _this$props.direction,
            rowHeight = _this$props.rowHeight;

        var itemStyleCache = _this._getItemStyleCache(shouldResetStyleCacheOnItemSizeChange && columnWidth, shouldResetStyleCacheOnItemSizeChange && direction, shouldResetStyleCacheOnItemSizeChange && rowHeight);

        var key = rowIndex + ":" + columnIndex;
        var style;

        if (itemStyleCache.hasOwnProperty(key)) {
          style = itemStyleCache[key];
        } else {
          var _offset = getColumnOffset(_this.props, columnIndex, _this._instanceProps);

          var isRtl = direction === 'rtl';
          itemStyleCache[key] = style = {
            position: 'absolute',
            left: isRtl ? undefined : _offset,
            right: isRtl ? _offset : undefined,
            top: getRowOffset(_this.props, rowIndex, _this._instanceProps),
            height: getRowHeight(_this.props, rowIndex, _this._instanceProps),
            width: getColumnWidth(_this.props, columnIndex, _this._instanceProps)
          };
        }

        return style;
      };

      _this._getItemStyleCache = void 0;
      _this._getItemStyleCache = memoize_one_esm(function (_, __, ___) {
        return {};
      });

      _this._onScroll = function (event) {
        var _event$currentTarget = event.currentTarget,
            clientHeight = _event$currentTarget.clientHeight,
            clientWidth = _event$currentTarget.clientWidth,
            scrollLeft = _event$currentTarget.scrollLeft,
            scrollTop = _event$currentTarget.scrollTop,
            scrollHeight = _event$currentTarget.scrollHeight,
            scrollWidth = _event$currentTarget.scrollWidth;

        _this.setState(function (prevState) {
          if (prevState.scrollLeft === scrollLeft && prevState.scrollTop === scrollTop) {
            // Scroll position may have been updated by cDM/cDU,
            // In which case we don't need to trigger another render,
            // And we don't want to update state.isScrolling.
            return null;
          }

          var direction = _this.props.direction; // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
          // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
          // It's also easier for this component if we convert offsets to the same format as they would be in for ltr.
          // So the simplest solution is to determine which browser behavior we're dealing with, and convert based on it.

          var calculatedScrollLeft = scrollLeft;

          if (direction === 'rtl') {
            switch (getRTLOffsetType()) {
              case 'negative':
                calculatedScrollLeft = -scrollLeft;
                break;

              case 'positive-descending':
                calculatedScrollLeft = scrollWidth - clientWidth - scrollLeft;
                break;
            }
          } // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.


          calculatedScrollLeft = Math.max(0, Math.min(calculatedScrollLeft, scrollWidth - clientWidth));
          var calculatedScrollTop = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
          return {
            isScrolling: true,
            horizontalScrollDirection: prevState.scrollLeft < scrollLeft ? 'forward' : 'backward',
            scrollLeft: calculatedScrollLeft,
            scrollTop: calculatedScrollTop,
            verticalScrollDirection: prevState.scrollTop < scrollTop ? 'forward' : 'backward',
            scrollUpdateWasRequested: false
          };
        }, _this._resetIsScrollingDebounced);
      };

      _this._outerRefSetter = function (ref) {
        var outerRef = _this.props.outerRef;
        _this._outerRef = ref;

        if (typeof outerRef === 'function') {
          outerRef(ref);
        } else if (outerRef != null && typeof outerRef === 'object' && outerRef.hasOwnProperty('current')) {
          outerRef.current = ref;
        }
      };

      _this._resetIsScrollingDebounced = function () {
        if (_this._resetIsScrollingTimeoutId !== null) {
          cancelTimeout(_this._resetIsScrollingTimeoutId);
        }

        _this._resetIsScrollingTimeoutId = requestTimeout(_this._resetIsScrolling, IS_SCROLLING_DEBOUNCE_INTERVAL);
      };

      _this._resetIsScrolling = function () {
        _this._resetIsScrollingTimeoutId = null;

        _this.setState({
          isScrolling: false
        }, function () {
          // Clear style cache after state update has been committed.
          // This way we don't break pure sCU for items that don't use isScrolling param.
          _this._getItemStyleCache(-1);
        });
      };

      return _this;
    }

    Grid.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {
      validateSharedProps(nextProps, prevState);
      validateProps(nextProps);
      return null;
    };

    var _proto = Grid.prototype;

    _proto.scrollTo = function scrollTo(_ref3) {
      var scrollLeft = _ref3.scrollLeft,
          scrollTop = _ref3.scrollTop;

      if (scrollLeft !== undefined) {
        scrollLeft = Math.max(0, scrollLeft);
      }

      if (scrollTop !== undefined) {
        scrollTop = Math.max(0, scrollTop);
      }

      this.setState(function (prevState) {
        if (scrollLeft === undefined) {
          scrollLeft = prevState.scrollLeft;
        }

        if (scrollTop === undefined) {
          scrollTop = prevState.scrollTop;
        }

        if (prevState.scrollLeft === scrollLeft && prevState.scrollTop === scrollTop) {
          return null;
        }

        return {
          horizontalScrollDirection: prevState.scrollLeft < scrollLeft ? 'forward' : 'backward',
          scrollLeft: scrollLeft,
          scrollTop: scrollTop,
          scrollUpdateWasRequested: true,
          verticalScrollDirection: prevState.scrollTop < scrollTop ? 'forward' : 'backward'
        };
      }, this._resetIsScrollingDebounced);
    };

    _proto.scrollToItem = function scrollToItem(_ref4) {
      var _ref4$align = _ref4.align,
          align = _ref4$align === void 0 ? 'auto' : _ref4$align,
          columnIndex = _ref4.columnIndex,
          rowIndex = _ref4.rowIndex;
      var _this$props2 = this.props,
          columnCount = _this$props2.columnCount,
          height = _this$props2.height,
          rowCount = _this$props2.rowCount,
          width = _this$props2.width;
      var _this$state = this.state,
          scrollLeft = _this$state.scrollLeft,
          scrollTop = _this$state.scrollTop;
      var scrollbarSize = getScrollbarSize();

      if (columnIndex !== undefined) {
        columnIndex = Math.max(0, Math.min(columnIndex, columnCount - 1));
      }

      if (rowIndex !== undefined) {
        rowIndex = Math.max(0, Math.min(rowIndex, rowCount - 1));
      }

      var estimatedTotalHeight = getEstimatedTotalHeight(this.props, this._instanceProps);
      var estimatedTotalWidth = getEstimatedTotalWidth(this.props, this._instanceProps); // The scrollbar size should be considered when scrolling an item into view,
      // to ensure it's fully visible.
      // But we only need to account for its size when it's actually visible.

      var horizontalScrollbarSize = estimatedTotalWidth > width ? scrollbarSize : 0;
      var verticalScrollbarSize = estimatedTotalHeight > height ? scrollbarSize : 0;
      this.scrollTo({
        scrollLeft: columnIndex !== undefined ? getOffsetForColumnAndAlignment(this.props, columnIndex, align, scrollLeft, this._instanceProps, verticalScrollbarSize) : scrollLeft,
        scrollTop: rowIndex !== undefined ? getOffsetForRowAndAlignment(this.props, rowIndex, align, scrollTop, this._instanceProps, horizontalScrollbarSize) : scrollTop
      });
    };

    _proto.componentDidMount = function componentDidMount() {
      var _this$props3 = this.props,
          initialScrollLeft = _this$props3.initialScrollLeft,
          initialScrollTop = _this$props3.initialScrollTop;

      if (this._outerRef != null) {
        var outerRef = this._outerRef;

        if (typeof initialScrollLeft === 'number') {
          outerRef.scrollLeft = initialScrollLeft;
        }

        if (typeof initialScrollTop === 'number') {
          outerRef.scrollTop = initialScrollTop;
        }
      }

      this._callPropsCallbacks();
    };

    _proto.componentDidUpdate = function componentDidUpdate() {
      var direction = this.props.direction;
      var _this$state2 = this.state,
          scrollLeft = _this$state2.scrollLeft,
          scrollTop = _this$state2.scrollTop,
          scrollUpdateWasRequested = _this$state2.scrollUpdateWasRequested;

      if (scrollUpdateWasRequested && this._outerRef != null) {
        // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
        // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
        // So we need to determine which browser behavior we're dealing with, and mimic it.
        var outerRef = this._outerRef;

        if (direction === 'rtl') {
          switch (getRTLOffsetType()) {
            case 'negative':
              outerRef.scrollLeft = -scrollLeft;
              break;

            case 'positive-ascending':
              outerRef.scrollLeft = scrollLeft;
              break;

            default:
              var clientWidth = outerRef.clientWidth,
                  scrollWidth = outerRef.scrollWidth;
              outerRef.scrollLeft = scrollWidth - clientWidth - scrollLeft;
              break;
          }
        } else {
          outerRef.scrollLeft = Math.max(0, scrollLeft);
        }

        outerRef.scrollTop = Math.max(0, scrollTop);
      }

      this._callPropsCallbacks();
    };

    _proto.componentWillUnmount = function componentWillUnmount() {
      if (this._resetIsScrollingTimeoutId !== null) {
        cancelTimeout(this._resetIsScrollingTimeoutId);
      }
    };

    _proto.render = function render() {
      var _this$props4 = this.props,
          children = _this$props4.children,
          className = _this$props4.className,
          columnCount = _this$props4.columnCount,
          direction = _this$props4.direction,
          height = _this$props4.height,
          innerRef = _this$props4.innerRef,
          innerElementType = _this$props4.innerElementType,
          innerTagName = _this$props4.innerTagName,
          itemData = _this$props4.itemData,
          _this$props4$itemKey = _this$props4.itemKey,
          itemKey = _this$props4$itemKey === void 0 ? defaultItemKey : _this$props4$itemKey,
          outerElementType = _this$props4.outerElementType,
          outerTagName = _this$props4.outerTagName,
          rowCount = _this$props4.rowCount,
          style = _this$props4.style,
          useIsScrolling = _this$props4.useIsScrolling,
          width = _this$props4.width;
      var isScrolling = this.state.isScrolling;

      var _this$_getHorizontalR = this._getHorizontalRangeToRender(),
          columnStartIndex = _this$_getHorizontalR[0],
          columnStopIndex = _this$_getHorizontalR[1];

      var _this$_getVerticalRan = this._getVerticalRangeToRender(),
          rowStartIndex = _this$_getVerticalRan[0],
          rowStopIndex = _this$_getVerticalRan[1];

      var items = [];

      if (columnCount > 0 && rowCount) {
        for (var _rowIndex = rowStartIndex; _rowIndex <= rowStopIndex; _rowIndex++) {
          for (var _columnIndex = columnStartIndex; _columnIndex <= columnStopIndex; _columnIndex++) {
            items.push((0,react.createElement)(children, {
              columnIndex: _columnIndex,
              data: itemData,
              isScrolling: useIsScrolling ? isScrolling : undefined,
              key: itemKey({
                columnIndex: _columnIndex,
                data: itemData,
                rowIndex: _rowIndex
              }),
              rowIndex: _rowIndex,
              style: this._getItemStyle(_rowIndex, _columnIndex)
            }));
          }
        }
      } // Read this value AFTER items have been created,
      // So their actual sizes (if variable) are taken into consideration.


      var estimatedTotalHeight = getEstimatedTotalHeight(this.props, this._instanceProps);
      var estimatedTotalWidth = getEstimatedTotalWidth(this.props, this._instanceProps);
      return (0,react.createElement)(outerElementType || outerTagName || 'div', {
        className: className,
        onScroll: this._onScroll,
        ref: this._outerRefSetter,
        style: _extends({
          position: 'relative',
          height: height,
          width: width,
          overflow: 'auto',
          WebkitOverflowScrolling: 'touch',
          willChange: 'transform',
          direction: direction
        }, style)
      }, (0,react.createElement)(innerElementType || innerTagName || 'div', {
        children: items,
        ref: innerRef,
        style: {
          height: estimatedTotalHeight,
          pointerEvents: isScrolling ? 'none' : undefined,
          width: estimatedTotalWidth
        }
      }));
    };

    _proto._callPropsCallbacks = function _callPropsCallbacks() {
      var _this$props5 = this.props,
          columnCount = _this$props5.columnCount,
          onItemsRendered = _this$props5.onItemsRendered,
          onScroll = _this$props5.onScroll,
          rowCount = _this$props5.rowCount;

      if (typeof onItemsRendered === 'function') {
        if (columnCount > 0 && rowCount > 0) {
          var _this$_getHorizontalR2 = this._getHorizontalRangeToRender(),
              _overscanColumnStartIndex = _this$_getHorizontalR2[0],
              _overscanColumnStopIndex = _this$_getHorizontalR2[1],
              _visibleColumnStartIndex = _this$_getHorizontalR2[2],
              _visibleColumnStopIndex = _this$_getHorizontalR2[3];

          var _this$_getVerticalRan2 = this._getVerticalRangeToRender(),
              _overscanRowStartIndex = _this$_getVerticalRan2[0],
              _overscanRowStopIndex = _this$_getVerticalRan2[1],
              _visibleRowStartIndex = _this$_getVerticalRan2[2],
              _visibleRowStopIndex = _this$_getVerticalRan2[3];

          this._callOnItemsRendered(_overscanColumnStartIndex, _overscanColumnStopIndex, _overscanRowStartIndex, _overscanRowStopIndex, _visibleColumnStartIndex, _visibleColumnStopIndex, _visibleRowStartIndex, _visibleRowStopIndex);
        }
      }

      if (typeof onScroll === 'function') {
        var _this$state3 = this.state,
            _horizontalScrollDirection = _this$state3.horizontalScrollDirection,
            _scrollLeft = _this$state3.scrollLeft,
            _scrollTop = _this$state3.scrollTop,
            _scrollUpdateWasRequested = _this$state3.scrollUpdateWasRequested,
            _verticalScrollDirection = _this$state3.verticalScrollDirection;

        this._callOnScroll(_scrollLeft, _scrollTop, _horizontalScrollDirection, _verticalScrollDirection, _scrollUpdateWasRequested);
      }
    } // Lazily create and cache item styles while scrolling,
    // So that pure component sCU will prevent re-renders.
    // We maintain this cache, and pass a style prop rather than index,
    // So that List can clear cached styles and force item re-render if necessary.
    ;

    _proto._getHorizontalRangeToRender = function _getHorizontalRangeToRender() {
      var _this$props6 = this.props,
          columnCount = _this$props6.columnCount,
          overscanColumnCount = _this$props6.overscanColumnCount,
          overscanColumnsCount = _this$props6.overscanColumnsCount,
          overscanCount = _this$props6.overscanCount,
          rowCount = _this$props6.rowCount;
      var _this$state4 = this.state,
          horizontalScrollDirection = _this$state4.horizontalScrollDirection,
          isScrolling = _this$state4.isScrolling,
          scrollLeft = _this$state4.scrollLeft;
      var overscanCountResolved = overscanColumnCount || overscanColumnsCount || overscanCount || 1;

      if (columnCount === 0 || rowCount === 0) {
        return [0, 0, 0, 0];
      }

      var startIndex = getColumnStartIndexForOffset(this.props, scrollLeft, this._instanceProps);
      var stopIndex = getColumnStopIndexForStartIndex(this.props, startIndex, scrollLeft, this._instanceProps); // Overscan by one item in each direction so that tab/focus works.
      // If there isn't at least one extra item, tab loops back around.

      var overscanBackward = !isScrolling || horizontalScrollDirection === 'backward' ? Math.max(1, overscanCountResolved) : 1;
      var overscanForward = !isScrolling || horizontalScrollDirection === 'forward' ? Math.max(1, overscanCountResolved) : 1;
      return [Math.max(0, startIndex - overscanBackward), Math.max(0, Math.min(columnCount - 1, stopIndex + overscanForward)), startIndex, stopIndex];
    };

    _proto._getVerticalRangeToRender = function _getVerticalRangeToRender() {
      var _this$props7 = this.props,
          columnCount = _this$props7.columnCount,
          overscanCount = _this$props7.overscanCount,
          overscanRowCount = _this$props7.overscanRowCount,
          overscanRowsCount = _this$props7.overscanRowsCount,
          rowCount = _this$props7.rowCount;
      var _this$state5 = this.state,
          isScrolling = _this$state5.isScrolling,
          verticalScrollDirection = _this$state5.verticalScrollDirection,
          scrollTop = _this$state5.scrollTop;
      var overscanCountResolved = overscanRowCount || overscanRowsCount || overscanCount || 1;

      if (columnCount === 0 || rowCount === 0) {
        return [0, 0, 0, 0];
      }

      var startIndex = getRowStartIndexForOffset(this.props, scrollTop, this._instanceProps);
      var stopIndex = getRowStopIndexForStartIndex(this.props, startIndex, scrollTop, this._instanceProps); // Overscan by one item in each direction so that tab/focus works.
      // If there isn't at least one extra item, tab loops back around.

      var overscanBackward = !isScrolling || verticalScrollDirection === 'backward' ? Math.max(1, overscanCountResolved) : 1;
      var overscanForward = !isScrolling || verticalScrollDirection === 'forward' ? Math.max(1, overscanCountResolved) : 1;
      return [Math.max(0, startIndex - overscanBackward), Math.max(0, Math.min(rowCount - 1, stopIndex + overscanForward)), startIndex, stopIndex];
    };

    return Grid;
  }(react.PureComponent), _class.defaultProps = {
    direction: 'ltr',
    itemData: undefined,
    useIsScrolling: false
  }, _class;
}

var validateSharedProps = function validateSharedProps(_ref5, _ref6) {
  var children = _ref5.children,
      direction = _ref5.direction,
      height = _ref5.height,
      innerTagName = _ref5.innerTagName,
      outerTagName = _ref5.outerTagName,
      overscanColumnsCount = _ref5.overscanColumnsCount,
      overscanCount = _ref5.overscanCount,
      overscanRowsCount = _ref5.overscanRowsCount,
      width = _ref5.width;
  var instance = _ref6.instance;

  if (false) {}
};

var DEFAULT_ESTIMATED_ITEM_SIZE = 50;

var getEstimatedTotalHeight = function getEstimatedTotalHeight(_ref, _ref2) {
  var rowCount = _ref.rowCount;
  var rowMetadataMap = _ref2.rowMetadataMap,
      estimatedRowHeight = _ref2.estimatedRowHeight,
      lastMeasuredRowIndex = _ref2.lastMeasuredRowIndex;
  var totalSizeOfMeasuredRows = 0; // Edge case check for when the number of items decreases while a scroll is in progress.
  // https://github.com/bvaughn/react-window/pull/138

  if (lastMeasuredRowIndex >= rowCount) {
    lastMeasuredRowIndex = rowCount - 1;
  }

  if (lastMeasuredRowIndex >= 0) {
    var itemMetadata = rowMetadataMap[lastMeasuredRowIndex];
    totalSizeOfMeasuredRows = itemMetadata.offset + itemMetadata.size;
  }

  var numUnmeasuredItems = rowCount - lastMeasuredRowIndex - 1;
  var totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedRowHeight;
  return totalSizeOfMeasuredRows + totalSizeOfUnmeasuredItems;
};

var getEstimatedTotalWidth = function getEstimatedTotalWidth(_ref3, _ref4) {
  var columnCount = _ref3.columnCount;
  var columnMetadataMap = _ref4.columnMetadataMap,
      estimatedColumnWidth = _ref4.estimatedColumnWidth,
      lastMeasuredColumnIndex = _ref4.lastMeasuredColumnIndex;
  var totalSizeOfMeasuredRows = 0; // Edge case check for when the number of items decreases while a scroll is in progress.
  // https://github.com/bvaughn/react-window/pull/138

  if (lastMeasuredColumnIndex >= columnCount) {
    lastMeasuredColumnIndex = columnCount - 1;
  }

  if (lastMeasuredColumnIndex >= 0) {
    var itemMetadata = columnMetadataMap[lastMeasuredColumnIndex];
    totalSizeOfMeasuredRows = itemMetadata.offset + itemMetadata.size;
  }

  var numUnmeasuredItems = columnCount - lastMeasuredColumnIndex - 1;
  var totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedColumnWidth;
  return totalSizeOfMeasuredRows + totalSizeOfUnmeasuredItems;
};

var getItemMetadata = function getItemMetadata(itemType, props, index, instanceProps) {
  var itemMetadataMap, itemSize, lastMeasuredIndex;

  if (itemType === 'column') {
    itemMetadataMap = instanceProps.columnMetadataMap;
    itemSize = props.columnWidth;
    lastMeasuredIndex = instanceProps.lastMeasuredColumnIndex;
  } else {
    itemMetadataMap = instanceProps.rowMetadataMap;
    itemSize = props.rowHeight;
    lastMeasuredIndex = instanceProps.lastMeasuredRowIndex;
  }

  if (index > lastMeasuredIndex) {
    var offset = 0;

    if (lastMeasuredIndex >= 0) {
      var itemMetadata = itemMetadataMap[lastMeasuredIndex];
      offset = itemMetadata.offset + itemMetadata.size;
    }

    for (var i = lastMeasuredIndex + 1; i <= index; i++) {
      var size = itemSize(i);
      itemMetadataMap[i] = {
        offset: offset,
        size: size
      };
      offset += size;
    }

    if (itemType === 'column') {
      instanceProps.lastMeasuredColumnIndex = index;
    } else {
      instanceProps.lastMeasuredRowIndex = index;
    }
  }

  return itemMetadataMap[index];
};

var findNearestItem = function findNearestItem(itemType, props, instanceProps, offset) {
  var itemMetadataMap, lastMeasuredIndex;

  if (itemType === 'column') {
    itemMetadataMap = instanceProps.columnMetadataMap;
    lastMeasuredIndex = instanceProps.lastMeasuredColumnIndex;
  } else {
    itemMetadataMap = instanceProps.rowMetadataMap;
    lastMeasuredIndex = instanceProps.lastMeasuredRowIndex;
  }

  var lastMeasuredItemOffset = lastMeasuredIndex > 0 ? itemMetadataMap[lastMeasuredIndex].offset : 0;

  if (lastMeasuredItemOffset >= offset) {
    // If we've already measured items within this range just use a binary search as it's faster.
    return findNearestItemBinarySearch(itemType, props, instanceProps, lastMeasuredIndex, 0, offset);
  } else {
    // If we haven't yet measured this high, fallback to an exponential search with an inner binary search.
    // The exponential search avoids pre-computing sizes for the full set of items as a binary search would.
    // The overall complexity for this approach is O(log n).
    return findNearestItemExponentialSearch(itemType, props, instanceProps, Math.max(0, lastMeasuredIndex), offset);
  }
};

var findNearestItemBinarySearch = function findNearestItemBinarySearch(itemType, props, instanceProps, high, low, offset) {
  while (low <= high) {
    var middle = low + Math.floor((high - low) / 2);
    var currentOffset = getItemMetadata(itemType, props, middle, instanceProps).offset;

    if (currentOffset === offset) {
      return middle;
    } else if (currentOffset < offset) {
      low = middle + 1;
    } else if (currentOffset > offset) {
      high = middle - 1;
    }
  }

  if (low > 0) {
    return low - 1;
  } else {
    return 0;
  }
};

var findNearestItemExponentialSearch = function findNearestItemExponentialSearch(itemType, props, instanceProps, index, offset) {
  var itemCount = itemType === 'column' ? props.columnCount : props.rowCount;
  var interval = 1;

  while (index < itemCount && getItemMetadata(itemType, props, index, instanceProps).offset < offset) {
    index += interval;
    interval *= 2;
  }

  return findNearestItemBinarySearch(itemType, props, instanceProps, Math.min(index, itemCount - 1), Math.floor(index / 2), offset);
};

var getOffsetForIndexAndAlignment = function getOffsetForIndexAndAlignment(itemType, props, index, align, scrollOffset, instanceProps, scrollbarSize) {
  var size = itemType === 'column' ? props.width : props.height;
  var itemMetadata = getItemMetadata(itemType, props, index, instanceProps); // Get estimated total size after ItemMetadata is computed,
  // To ensure it reflects actual measurements instead of just estimates.

  var estimatedTotalSize = itemType === 'column' ? getEstimatedTotalWidth(props, instanceProps) : getEstimatedTotalHeight(props, instanceProps);
  var maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, itemMetadata.offset));
  var minOffset = Math.max(0, itemMetadata.offset - size + scrollbarSize + itemMetadata.size);

  if (align === 'smart') {
    if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
      align = 'auto';
    } else {
      align = 'center';
    }
  }

  switch (align) {
    case 'start':
      return maxOffset;

    case 'end':
      return minOffset;

    case 'center':
      return Math.round(minOffset + (maxOffset - minOffset) / 2);

    case 'auto':
    default:
      if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
        return scrollOffset;
      } else if (minOffset > maxOffset) {
        // Because we only take into account the scrollbar size when calculating minOffset
        // this value can be larger than maxOffset when at the end of the list
        return minOffset;
      } else if (scrollOffset < minOffset) {
        return minOffset;
      } else {
        return maxOffset;
      }

  }
};

var VariableSizeGrid = /*#__PURE__*/createGridComponent({
  getColumnOffset: function getColumnOffset(props, index, instanceProps) {
    return getItemMetadata('column', props, index, instanceProps).offset;
  },
  getColumnStartIndexForOffset: function getColumnStartIndexForOffset(props, scrollLeft, instanceProps) {
    return findNearestItem('column', props, instanceProps, scrollLeft);
  },
  getColumnStopIndexForStartIndex: function getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, instanceProps) {
    var columnCount = props.columnCount,
        width = props.width;
    var itemMetadata = getItemMetadata('column', props, startIndex, instanceProps);
    var maxOffset = scrollLeft + width;
    var offset = itemMetadata.offset + itemMetadata.size;
    var stopIndex = startIndex;

    while (stopIndex < columnCount - 1 && offset < maxOffset) {
      stopIndex++;
      offset += getItemMetadata('column', props, stopIndex, instanceProps).size;
    }

    return stopIndex;
  },
  getColumnWidth: function getColumnWidth(props, index, instanceProps) {
    return instanceProps.columnMetadataMap[index].size;
  },
  getEstimatedTotalHeight: getEstimatedTotalHeight,
  getEstimatedTotalWidth: getEstimatedTotalWidth,
  getOffsetForColumnAndAlignment: function getOffsetForColumnAndAlignment(props, index, align, scrollOffset, instanceProps, scrollbarSize) {
    return getOffsetForIndexAndAlignment('column', props, index, align, scrollOffset, instanceProps, scrollbarSize);
  },
  getOffsetForRowAndAlignment: function getOffsetForRowAndAlignment(props, index, align, scrollOffset, instanceProps, scrollbarSize) {
    return getOffsetForIndexAndAlignment('row', props, index, align, scrollOffset, instanceProps, scrollbarSize);
  },
  getRowOffset: function getRowOffset(props, index, instanceProps) {
    return getItemMetadata('row', props, index, instanceProps).offset;
  },
  getRowHeight: function getRowHeight(props, index, instanceProps) {
    return instanceProps.rowMetadataMap[index].size;
  },
  getRowStartIndexForOffset: function getRowStartIndexForOffset(props, scrollTop, instanceProps) {
    return findNearestItem('row', props, instanceProps, scrollTop);
  },
  getRowStopIndexForStartIndex: function getRowStopIndexForStartIndex(props, startIndex, scrollTop, instanceProps) {
    var rowCount = props.rowCount,
        height = props.height;
    var itemMetadata = getItemMetadata('row', props, startIndex, instanceProps);
    var maxOffset = scrollTop + height;
    var offset = itemMetadata.offset + itemMetadata.size;
    var stopIndex = startIndex;

    while (stopIndex < rowCount - 1 && offset < maxOffset) {
      stopIndex++;
      offset += getItemMetadata('row', props, stopIndex, instanceProps).size;
    }

    return stopIndex;
  },
  initInstanceProps: function initInstanceProps(props, instance) {
    var _ref5 = props,
        estimatedColumnWidth = _ref5.estimatedColumnWidth,
        estimatedRowHeight = _ref5.estimatedRowHeight;
    var instanceProps = {
      columnMetadataMap: {},
      estimatedColumnWidth: estimatedColumnWidth || DEFAULT_ESTIMATED_ITEM_SIZE,
      estimatedRowHeight: estimatedRowHeight || DEFAULT_ESTIMATED_ITEM_SIZE,
      lastMeasuredColumnIndex: -1,
      lastMeasuredRowIndex: -1,
      rowMetadataMap: {}
    };

    instance.resetAfterColumnIndex = function (columnIndex, shouldForceUpdate) {
      if (shouldForceUpdate === void 0) {
        shouldForceUpdate = true;
      }

      instance.resetAfterIndices({
        columnIndex: columnIndex,
        shouldForceUpdate: shouldForceUpdate
      });
    };

    instance.resetAfterRowIndex = function (rowIndex, shouldForceUpdate) {
      if (shouldForceUpdate === void 0) {
        shouldForceUpdate = true;
      }

      instance.resetAfterIndices({
        rowIndex: rowIndex,
        shouldForceUpdate: shouldForceUpdate
      });
    };

    instance.resetAfterIndices = function (_ref6) {
      var columnIndex = _ref6.columnIndex,
          rowIndex = _ref6.rowIndex,
          _ref6$shouldForceUpda = _ref6.shouldForceUpdate,
          shouldForceUpdate = _ref6$shouldForceUpda === void 0 ? true : _ref6$shouldForceUpda;

      if (typeof columnIndex === 'number') {
        instanceProps.lastMeasuredColumnIndex = Math.min(instanceProps.lastMeasuredColumnIndex, columnIndex - 1);
      }

      if (typeof rowIndex === 'number') {
        instanceProps.lastMeasuredRowIndex = Math.min(instanceProps.lastMeasuredRowIndex, rowIndex - 1);
      } // We could potentially optimize further by only evicting styles after this index,
      // But since styles are only cached while scrolling is in progress-
      // It seems an unnecessary optimization.
      // It's unlikely that resetAfterIndex() will be called while a user is scrolling.


      instance._getItemStyleCache(-1);

      if (shouldForceUpdate) {
        instance.forceUpdate();
      }
    };

    return instanceProps;
  },
  shouldResetStyleCacheOnItemSizeChange: false,
  validateProps: function validateProps(_ref7) {
    var columnWidth = _ref7.columnWidth,
        rowHeight = _ref7.rowHeight;

    if (false) {}
  }
});

var IS_SCROLLING_DEBOUNCE_INTERVAL$1 = 150;

var defaultItemKey$1 = function defaultItemKey(index, data) {
  return index;
}; // In DEV mode, this Set helps us only log a warning once per component instance.
// This avoids spamming the console every time a render happens.


var devWarningsDirection = null;
var devWarningsTagName$1 = null;

if (false) {}

function createListComponent(_ref) {
  var _class;

  var getItemOffset = _ref.getItemOffset,
      getEstimatedTotalSize = _ref.getEstimatedTotalSize,
      getItemSize = _ref.getItemSize,
      getOffsetForIndexAndAlignment = _ref.getOffsetForIndexAndAlignment,
      getStartIndexForOffset = _ref.getStartIndexForOffset,
      getStopIndexForStartIndex = _ref.getStopIndexForStartIndex,
      initInstanceProps = _ref.initInstanceProps,
      shouldResetStyleCacheOnItemSizeChange = _ref.shouldResetStyleCacheOnItemSizeChange,
      validateProps = _ref.validateProps;
  return _class = /*#__PURE__*/function (_PureComponent) {
    _inheritsLoose(List, _PureComponent);

    // Always use explicit constructor for React components.
    // It produces less code after transpilation. (#26)
    // eslint-disable-next-line no-useless-constructor
    function List(props) {
      var _this;

      _this = _PureComponent.call(this, props) || this;
      _this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(_this));
      _this._outerRef = void 0;
      _this._resetIsScrollingTimeoutId = null;
      _this.state = {
        instance: _assertThisInitialized(_this),
        isScrolling: false,
        scrollDirection: 'forward',
        scrollOffset: typeof _this.props.initialScrollOffset === 'number' ? _this.props.initialScrollOffset : 0,
        scrollUpdateWasRequested: false
      };
      _this._callOnItemsRendered = void 0;
      _this._callOnItemsRendered = memoize_one_esm(function (overscanStartIndex, overscanStopIndex, visibleStartIndex, visibleStopIndex) {
        return _this.props.onItemsRendered({
          overscanStartIndex: overscanStartIndex,
          overscanStopIndex: overscanStopIndex,
          visibleStartIndex: visibleStartIndex,
          visibleStopIndex: visibleStopIndex
        });
      });
      _this._callOnScroll = void 0;
      _this._callOnScroll = memoize_one_esm(function (scrollDirection, scrollOffset, scrollUpdateWasRequested) {
        return _this.props.onScroll({
          scrollDirection: scrollDirection,
          scrollOffset: scrollOffset,
          scrollUpdateWasRequested: scrollUpdateWasRequested
        });
      });
      _this._getItemStyle = void 0;

      _this._getItemStyle = function (index) {
        var _this$props = _this.props,
            direction = _this$props.direction,
            itemSize = _this$props.itemSize,
            layout = _this$props.layout;

        var itemStyleCache = _this._getItemStyleCache(shouldResetStyleCacheOnItemSizeChange && itemSize, shouldResetStyleCacheOnItemSizeChange && layout, shouldResetStyleCacheOnItemSizeChange && direction);

        var style;

        if (itemStyleCache.hasOwnProperty(index)) {
          style = itemStyleCache[index];
        } else {
          var _offset = getItemOffset(_this.props, index, _this._instanceProps);

          var size = getItemSize(_this.props, index, _this._instanceProps); // TODO Deprecate direction "horizontal"

          var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
          var isRtl = direction === 'rtl';
          var offsetHorizontal = isHorizontal ? _offset : 0;
          itemStyleCache[index] = style = {
            position: 'absolute',
            left: isRtl ? undefined : offsetHorizontal,
            right: isRtl ? offsetHorizontal : undefined,
            top: !isHorizontal ? _offset : 0,
            height: !isHorizontal ? size : '100%',
            width: isHorizontal ? size : '100%'
          };
        }

        return style;
      };

      _this._getItemStyleCache = void 0;
      _this._getItemStyleCache = memoize_one_esm(function (_, __, ___) {
        return {};
      });

      _this._onScrollHorizontal = function (event) {
        var _event$currentTarget = event.currentTarget,
            clientWidth = _event$currentTarget.clientWidth,
            scrollLeft = _event$currentTarget.scrollLeft,
            scrollWidth = _event$currentTarget.scrollWidth;

        _this.setState(function (prevState) {
          if (prevState.scrollOffset === scrollLeft) {
            // Scroll position may have been updated by cDM/cDU,
            // In which case we don't need to trigger another render,
            // And we don't want to update state.isScrolling.
            return null;
          }

          var direction = _this.props.direction;
          var scrollOffset = scrollLeft;

          if (direction === 'rtl') {
            // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
            // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
            // It's also easier for this component if we convert offsets to the same format as they would be in for ltr.
            // So the simplest solution is to determine which browser behavior we're dealing with, and convert based on it.
            switch (getRTLOffsetType()) {
              case 'negative':
                scrollOffset = -scrollLeft;
                break;

              case 'positive-descending':
                scrollOffset = scrollWidth - clientWidth - scrollLeft;
                break;
            }
          } // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.


          scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
          return {
            isScrolling: true,
            scrollDirection: prevState.scrollOffset < scrollLeft ? 'forward' : 'backward',
            scrollOffset: scrollOffset,
            scrollUpdateWasRequested: false
          };
        }, _this._resetIsScrollingDebounced);
      };

      _this._onScrollVertical = function (event) {
        var _event$currentTarget2 = event.currentTarget,
            clientHeight = _event$currentTarget2.clientHeight,
            scrollHeight = _event$currentTarget2.scrollHeight,
            scrollTop = _event$currentTarget2.scrollTop;

        _this.setState(function (prevState) {
          if (prevState.scrollOffset === scrollTop) {
            // Scroll position may have been updated by cDM/cDU,
            // In which case we don't need to trigger another render,
            // And we don't want to update state.isScrolling.
            return null;
          } // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.


          var scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
          return {
            isScrolling: true,
            scrollDirection: prevState.scrollOffset < scrollOffset ? 'forward' : 'backward',
            scrollOffset: scrollOffset,
            scrollUpdateWasRequested: false
          };
        }, _this._resetIsScrollingDebounced);
      };

      _this._outerRefSetter = function (ref) {
        var outerRef = _this.props.outerRef;
        _this._outerRef = ref;

        if (typeof outerRef === 'function') {
          outerRef(ref);
        } else if (outerRef != null && typeof outerRef === 'object' && outerRef.hasOwnProperty('current')) {
          outerRef.current = ref;
        }
      };

      _this._resetIsScrollingDebounced = function () {
        if (_this._resetIsScrollingTimeoutId !== null) {
          cancelTimeout(_this._resetIsScrollingTimeoutId);
        }

        _this._resetIsScrollingTimeoutId = requestTimeout(_this._resetIsScrolling, IS_SCROLLING_DEBOUNCE_INTERVAL$1);
      };

      _this._resetIsScrolling = function () {
        _this._resetIsScrollingTimeoutId = null;

        _this.setState({
          isScrolling: false
        }, function () {
          // Clear style cache after state update has been committed.
          // This way we don't break pure sCU for items that don't use isScrolling param.
          _this._getItemStyleCache(-1, null);
        });
      };

      return _this;
    }

    List.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {
      validateSharedProps$1(nextProps, prevState);
      validateProps(nextProps);
      return null;
    };

    var _proto = List.prototype;

    _proto.scrollTo = function scrollTo(scrollOffset) {
      scrollOffset = Math.max(0, scrollOffset);
      this.setState(function (prevState) {
        if (prevState.scrollOffset === scrollOffset) {
          return null;
        }

        return {
          scrollDirection: prevState.scrollOffset < scrollOffset ? 'forward' : 'backward',
          scrollOffset: scrollOffset,
          scrollUpdateWasRequested: true
        };
      }, this._resetIsScrollingDebounced);
    };

    _proto.scrollToItem = function scrollToItem(index, align) {
      if (align === void 0) {
        align = 'auto';
      }

      var _this$props2 = this.props,
          itemCount = _this$props2.itemCount,
          layout = _this$props2.layout;
      var scrollOffset = this.state.scrollOffset;
      index = Math.max(0, Math.min(index, itemCount - 1)); // The scrollbar size should be considered when scrolling an item into view, to ensure it's fully visible.
      // But we only need to account for its size when it's actually visible.
      // This is an edge case for lists; normally they only scroll in the dominant direction.

      var scrollbarSize = 0;

      if (this._outerRef) {
        var outerRef = this._outerRef;

        if (layout === 'vertical') {
          scrollbarSize = outerRef.scrollWidth > outerRef.clientWidth ? getScrollbarSize() : 0;
        } else {
          scrollbarSize = outerRef.scrollHeight > outerRef.clientHeight ? getScrollbarSize() : 0;
        }
      }

      this.scrollTo(getOffsetForIndexAndAlignment(this.props, index, align, scrollOffset, this._instanceProps, scrollbarSize));
    };

    _proto.componentDidMount = function componentDidMount() {
      var _this$props3 = this.props,
          direction = _this$props3.direction,
          initialScrollOffset = _this$props3.initialScrollOffset,
          layout = _this$props3.layout;

      if (typeof initialScrollOffset === 'number' && this._outerRef != null) {
        var outerRef = this._outerRef; // TODO Deprecate direction "horizontal"

        if (direction === 'horizontal' || layout === 'horizontal') {
          outerRef.scrollLeft = initialScrollOffset;
        } else {
          outerRef.scrollTop = initialScrollOffset;
        }
      }

      this._callPropsCallbacks();
    };

    _proto.componentDidUpdate = function componentDidUpdate() {
      var _this$props4 = this.props,
          direction = _this$props4.direction,
          layout = _this$props4.layout;
      var _this$state = this.state,
          scrollOffset = _this$state.scrollOffset,
          scrollUpdateWasRequested = _this$state.scrollUpdateWasRequested;

      if (scrollUpdateWasRequested && this._outerRef != null) {
        var outerRef = this._outerRef; // TODO Deprecate direction "horizontal"

        if (direction === 'horizontal' || layout === 'horizontal') {
          if (direction === 'rtl') {
            // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
            // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
            // So we need to determine which browser behavior we're dealing with, and mimic it.
            switch (getRTLOffsetType()) {
              case 'negative':
                outerRef.scrollLeft = -scrollOffset;
                break;

              case 'positive-ascending':
                outerRef.scrollLeft = scrollOffset;
                break;

              default:
                var clientWidth = outerRef.clientWidth,
                    scrollWidth = outerRef.scrollWidth;
                outerRef.scrollLeft = scrollWidth - clientWidth - scrollOffset;
                break;
            }
          } else {
            outerRef.scrollLeft = scrollOffset;
          }
        } else {
          outerRef.scrollTop = scrollOffset;
        }
      }

      this._callPropsCallbacks();
    };

    _proto.componentWillUnmount = function componentWillUnmount() {
      if (this._resetIsScrollingTimeoutId !== null) {
        cancelTimeout(this._resetIsScrollingTimeoutId);
      }
    };

    _proto.render = function render() {
      var _this$props5 = this.props,
          children = _this$props5.children,
          className = _this$props5.className,
          direction = _this$props5.direction,
          height = _this$props5.height,
          innerRef = _this$props5.innerRef,
          innerElementType = _this$props5.innerElementType,
          innerTagName = _this$props5.innerTagName,
          itemCount = _this$props5.itemCount,
          itemData = _this$props5.itemData,
          _this$props5$itemKey = _this$props5.itemKey,
          itemKey = _this$props5$itemKey === void 0 ? defaultItemKey$1 : _this$props5$itemKey,
          layout = _this$props5.layout,
          outerElementType = _this$props5.outerElementType,
          outerTagName = _this$props5.outerTagName,
          style = _this$props5.style,
          useIsScrolling = _this$props5.useIsScrolling,
          width = _this$props5.width;
      var isScrolling = this.state.isScrolling; // TODO Deprecate direction "horizontal"

      var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
      var onScroll = isHorizontal ? this._onScrollHorizontal : this._onScrollVertical;

      var _this$_getRangeToRend = this._getRangeToRender(),
          startIndex = _this$_getRangeToRend[0],
          stopIndex = _this$_getRangeToRend[1];

      var items = [];

      if (itemCount > 0) {
        for (var _index = startIndex; _index <= stopIndex; _index++) {
          items.push((0,react.createElement)(children, {
            data: itemData,
            key: itemKey(_index, itemData),
            index: _index,
            isScrolling: useIsScrolling ? isScrolling : undefined,
            style: this._getItemStyle(_index)
          }));
        }
      } // Read this value AFTER items have been created,
      // So their actual sizes (if variable) are taken into consideration.


      var estimatedTotalSize = getEstimatedTotalSize(this.props, this._instanceProps);
      return (0,react.createElement)(outerElementType || outerTagName || 'div', {
        className: className,
        onScroll: onScroll,
        ref: this._outerRefSetter,
        style: _extends({
          position: 'relative',
          height: height,
          width: width,
          overflow: 'auto',
          WebkitOverflowScrolling: 'touch',
          willChange: 'transform',
          direction: direction
        }, style)
      }, (0,react.createElement)(innerElementType || innerTagName || 'div', {
        children: items,
        ref: innerRef,
        style: {
          height: isHorizontal ? '100%' : estimatedTotalSize,
          pointerEvents: isScrolling ? 'none' : undefined,
          width: isHorizontal ? estimatedTotalSize : '100%'
        }
      }));
    };

    _proto._callPropsCallbacks = function _callPropsCallbacks() {
      if (typeof this.props.onItemsRendered === 'function') {
        var itemCount = this.props.itemCount;

        if (itemCount > 0) {
          var _this$_getRangeToRend2 = this._getRangeToRender(),
              _overscanStartIndex = _this$_getRangeToRend2[0],
              _overscanStopIndex = _this$_getRangeToRend2[1],
              _visibleStartIndex = _this$_getRangeToRend2[2],
              _visibleStopIndex = _this$_getRangeToRend2[3];

          this._callOnItemsRendered(_overscanStartIndex, _overscanStopIndex, _visibleStartIndex, _visibleStopIndex);
        }
      }

      if (typeof this.props.onScroll === 'function') {
        var _this$state2 = this.state,
            _scrollDirection = _this$state2.scrollDirection,
            _scrollOffset = _this$state2.scrollOffset,
            _scrollUpdateWasRequested = _this$state2.scrollUpdateWasRequested;

        this._callOnScroll(_scrollDirection, _scrollOffset, _scrollUpdateWasRequested);
      }
    } // Lazily create and cache item styles while scrolling,
    // So that pure component sCU will prevent re-renders.
    // We maintain this cache, and pass a style prop rather than index,
    // So that List can clear cached styles and force item re-render if necessary.
    ;

    _proto._getRangeToRender = function _getRangeToRender() {
      var _this$props6 = this.props,
          itemCount = _this$props6.itemCount,
          overscanCount = _this$props6.overscanCount;
      var _this$state3 = this.state,
          isScrolling = _this$state3.isScrolling,
          scrollDirection = _this$state3.scrollDirection,
          scrollOffset = _this$state3.scrollOffset;

      if (itemCount === 0) {
        return [0, 0, 0, 0];
      }

      var startIndex = getStartIndexForOffset(this.props, scrollOffset, this._instanceProps);
      var stopIndex = getStopIndexForStartIndex(this.props, startIndex, scrollOffset, this._instanceProps); // Overscan by one item in each direction so that tab/focus works.
      // If there isn't at least one extra item, tab loops back around.

      var overscanBackward = !isScrolling || scrollDirection === 'backward' ? Math.max(1, overscanCount) : 1;
      var overscanForward = !isScrolling || scrollDirection === 'forward' ? Math.max(1, overscanCount) : 1;
      return [Math.max(0, startIndex - overscanBackward), Math.max(0, Math.min(itemCount - 1, stopIndex + overscanForward)), startIndex, stopIndex];
    };

    return List;
  }(react.PureComponent), _class.defaultProps = {
    direction: 'ltr',
    itemData: undefined,
    layout: 'vertical',
    overscanCount: 2,
    useIsScrolling: false
  }, _class;
} // NOTE: I considered further wrapping individual items with a pure ListItem component.
// This would avoid ever calling the render function for the same index more than once,
// But it would also add the overhead of a lot of components/fibers.
// I assume people already do this (render function returning a class component),
// So my doing it would just unnecessarily double the wrappers.

var validateSharedProps$1 = function validateSharedProps(_ref2, _ref3) {
  var children = _ref2.children,
      direction = _ref2.direction,
      height = _ref2.height,
      layout = _ref2.layout,
      innerTagName = _ref2.innerTagName,
      outerTagName = _ref2.outerTagName,
      width = _ref2.width;
  var instance = _ref3.instance;

  if (false) { var isHorizontal; }
};

var DEFAULT_ESTIMATED_ITEM_SIZE$1 = 50;

var getItemMetadata$1 = function getItemMetadata(props, index, instanceProps) {
  var _ref = props,
      itemSize = _ref.itemSize;
  var itemMetadataMap = instanceProps.itemMetadataMap,
      lastMeasuredIndex = instanceProps.lastMeasuredIndex;

  if (index > lastMeasuredIndex) {
    var offset = 0;

    if (lastMeasuredIndex >= 0) {
      var itemMetadata = itemMetadataMap[lastMeasuredIndex];
      offset = itemMetadata.offset + itemMetadata.size;
    }

    for (var i = lastMeasuredIndex + 1; i <= index; i++) {
      var size = itemSize(i);
      itemMetadataMap[i] = {
        offset: offset,
        size: size
      };
      offset += size;
    }

    instanceProps.lastMeasuredIndex = index;
  }

  return itemMetadataMap[index];
};

var findNearestItem$1 = function findNearestItem(props, instanceProps, offset) {
  var itemMetadataMap = instanceProps.itemMetadataMap,
      lastMeasuredIndex = instanceProps.lastMeasuredIndex;
  var lastMeasuredItemOffset = lastMeasuredIndex > 0 ? itemMetadataMap[lastMeasuredIndex].offset : 0;

  if (lastMeasuredItemOffset >= offset) {
    // If we've already measured items within this range just use a binary search as it's faster.
    return findNearestItemBinarySearch$1(props, instanceProps, lastMeasuredIndex, 0, offset);
  } else {
    // If we haven't yet measured this high, fallback to an exponential search with an inner binary search.
    // The exponential search avoids pre-computing sizes for the full set of items as a binary search would.
    // The overall complexity for this approach is O(log n).
    return findNearestItemExponentialSearch$1(props, instanceProps, Math.max(0, lastMeasuredIndex), offset);
  }
};

var findNearestItemBinarySearch$1 = function findNearestItemBinarySearch(props, instanceProps, high, low, offset) {
  while (low <= high) {
    var middle = low + Math.floor((high - low) / 2);
    var currentOffset = getItemMetadata$1(props, middle, instanceProps).offset;

    if (currentOffset === offset) {
      return middle;
    } else if (currentOffset < offset) {
      low = middle + 1;
    } else if (currentOffset > offset) {
      high = middle - 1;
    }
  }

  if (low > 0) {
    return low - 1;
  } else {
    return 0;
  }
};

var findNearestItemExponentialSearch$1 = function findNearestItemExponentialSearch(props, instanceProps, index, offset) {
  var itemCount = props.itemCount;
  var interval = 1;

  while (index < itemCount && getItemMetadata$1(props, index, instanceProps).offset < offset) {
    index += interval;
    interval *= 2;
  }

  return findNearestItemBinarySearch$1(props, instanceProps, Math.min(index, itemCount - 1), Math.floor(index / 2), offset);
};

var getEstimatedTotalSize = function getEstimatedTotalSize(_ref2, _ref3) {
  var itemCount = _ref2.itemCount;
  var itemMetadataMap = _ref3.itemMetadataMap,
      estimatedItemSize = _ref3.estimatedItemSize,
      lastMeasuredIndex = _ref3.lastMeasuredIndex;
  var totalSizeOfMeasuredItems = 0; // Edge case check for when the number of items decreases while a scroll is in progress.
  // https://github.com/bvaughn/react-window/pull/138

  if (lastMeasuredIndex >= itemCount) {
    lastMeasuredIndex = itemCount - 1;
  }

  if (lastMeasuredIndex >= 0) {
    var itemMetadata = itemMetadataMap[lastMeasuredIndex];
    totalSizeOfMeasuredItems = itemMetadata.offset + itemMetadata.size;
  }

  var numUnmeasuredItems = itemCount - lastMeasuredIndex - 1;
  var totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize;
  return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
};

var VariableSizeList = /*#__PURE__*/createListComponent({
  getItemOffset: function getItemOffset(props, index, instanceProps) {
    return getItemMetadata$1(props, index, instanceProps).offset;
  },
  getItemSize: function getItemSize(props, index, instanceProps) {
    return instanceProps.itemMetadataMap[index].size;
  },
  getEstimatedTotalSize: getEstimatedTotalSize,
  getOffsetForIndexAndAlignment: function getOffsetForIndexAndAlignment(props, index, align, scrollOffset, instanceProps, scrollbarSize) {
    var direction = props.direction,
        height = props.height,
        layout = props.layout,
        width = props.width; // TODO Deprecate direction "horizontal"

    var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
    var size = isHorizontal ? width : height;
    var itemMetadata = getItemMetadata$1(props, index, instanceProps); // Get estimated total size after ItemMetadata is computed,
    // To ensure it reflects actual measurements instead of just estimates.

    var estimatedTotalSize = getEstimatedTotalSize(props, instanceProps);
    var maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, itemMetadata.offset));
    var minOffset = Math.max(0, itemMetadata.offset - size + itemMetadata.size + scrollbarSize);

    if (align === 'smart') {
      if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
        align = 'auto';
      } else {
        align = 'center';
      }
    }

    switch (align) {
      case 'start':
        return maxOffset;

      case 'end':
        return minOffset;

      case 'center':
        return Math.round(minOffset + (maxOffset - minOffset) / 2);

      case 'auto':
      default:
        if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
          return scrollOffset;
        } else if (scrollOffset < minOffset) {
          return minOffset;
        } else {
          return maxOffset;
        }

    }
  },
  getStartIndexForOffset: function getStartIndexForOffset(props, offset, instanceProps) {
    return findNearestItem$1(props, instanceProps, offset);
  },
  getStopIndexForStartIndex: function getStopIndexForStartIndex(props, startIndex, scrollOffset, instanceProps) {
    var direction = props.direction,
        height = props.height,
        itemCount = props.itemCount,
        layout = props.layout,
        width = props.width; // TODO Deprecate direction "horizontal"

    var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
    var size = isHorizontal ? width : height;
    var itemMetadata = getItemMetadata$1(props, startIndex, instanceProps);
    var maxOffset = scrollOffset + size;
    var offset = itemMetadata.offset + itemMetadata.size;
    var stopIndex = startIndex;

    while (stopIndex < itemCount - 1 && offset < maxOffset) {
      stopIndex++;
      offset += getItemMetadata$1(props, stopIndex, instanceProps).size;
    }

    return stopIndex;
  },
  initInstanceProps: function initInstanceProps(props, instance) {
    var _ref4 = props,
        estimatedItemSize = _ref4.estimatedItemSize;
    var instanceProps = {
      itemMetadataMap: {},
      estimatedItemSize: estimatedItemSize || DEFAULT_ESTIMATED_ITEM_SIZE$1,
      lastMeasuredIndex: -1
    };

    instance.resetAfterIndex = function (index, shouldForceUpdate) {
      if (shouldForceUpdate === void 0) {
        shouldForceUpdate = true;
      }

      instanceProps.lastMeasuredIndex = Math.min(instanceProps.lastMeasuredIndex, index - 1); // We could potentially optimize further by only evicting styles after this index,
      // But since styles are only cached while scrolling is in progress-
      // It seems an unnecessary optimization.
      // It's unlikely that resetAfterIndex() will be called while a user is scrolling.

      instance._getItemStyleCache(-1);

      if (shouldForceUpdate) {
        instance.forceUpdate();
      }
    };

    return instanceProps;
  },
  shouldResetStyleCacheOnItemSizeChange: false,
  validateProps: function validateProps(_ref5) {
    var itemSize = _ref5.itemSize;

    if (false) {}
  }
});

var FixedSizeGrid = /*#__PURE__*/createGridComponent({
  getColumnOffset: function getColumnOffset(_ref, index) {
    var columnWidth = _ref.columnWidth;
    return index * columnWidth;
  },
  getColumnWidth: function getColumnWidth(_ref2, index) {
    var columnWidth = _ref2.columnWidth;
    return columnWidth;
  },
  getRowOffset: function getRowOffset(_ref3, index) {
    var rowHeight = _ref3.rowHeight;
    return index * rowHeight;
  },
  getRowHeight: function getRowHeight(_ref4, index) {
    var rowHeight = _ref4.rowHeight;
    return rowHeight;
  },
  getEstimatedTotalHeight: function getEstimatedTotalHeight(_ref5) {
    var rowCount = _ref5.rowCount,
        rowHeight = _ref5.rowHeight;
    return rowHeight * rowCount;
  },
  getEstimatedTotalWidth: function getEstimatedTotalWidth(_ref6) {
    var columnCount = _ref6.columnCount,
        columnWidth = _ref6.columnWidth;
    return columnWidth * columnCount;
  },
  getOffsetForColumnAndAlignment: function getOffsetForColumnAndAlignment(_ref7, columnIndex, align, scrollLeft, instanceProps, scrollbarSize) {
    var columnCount = _ref7.columnCount,
        columnWidth = _ref7.columnWidth,
        width = _ref7.width;
    var lastColumnOffset = Math.max(0, columnCount * columnWidth - width);
    var maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
    var minOffset = Math.max(0, columnIndex * columnWidth - width + scrollbarSize + columnWidth);

    if (align === 'smart') {
      if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
        align = 'auto';
      } else {
        align = 'center';
      }
    }

    switch (align) {
      case 'start':
        return maxOffset;

      case 'end':
        return minOffset;

      case 'center':
        // "Centered" offset is usually the average of the min and max.
        // But near the edges of the list, this doesn't hold true.
        var middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);

        if (middleOffset < Math.ceil(width / 2)) {
          return 0; // near the beginning
        } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
          return lastColumnOffset; // near the end
        } else {
          return middleOffset;
        }

      case 'auto':
      default:
        if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
          return scrollLeft;
        } else if (minOffset > maxOffset) {
          // Because we only take into account the scrollbar size when calculating minOffset
          // this value can be larger than maxOffset when at the end of the list
          return minOffset;
        } else if (scrollLeft < minOffset) {
          return minOffset;
        } else {
          return maxOffset;
        }

    }
  },
  getOffsetForRowAndAlignment: function getOffsetForRowAndAlignment(_ref8, rowIndex, align, scrollTop, instanceProps, scrollbarSize) {
    var rowHeight = _ref8.rowHeight,
        height = _ref8.height,
        rowCount = _ref8.rowCount;
    var lastRowOffset = Math.max(0, rowCount * rowHeight - height);
    var maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
    var minOffset = Math.max(0, rowIndex * rowHeight - height + scrollbarSize + rowHeight);

    if (align === 'smart') {
      if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
        align = 'auto';
      } else {
        align = 'center';
      }
    }

    switch (align) {
      case 'start':
        return maxOffset;

      case 'end':
        return minOffset;

      case 'center':
        // "Centered" offset is usually the average of the min and max.
        // But near the edges of the list, this doesn't hold true.
        var middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);

        if (middleOffset < Math.ceil(height / 2)) {
          return 0; // near the beginning
        } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
          return lastRowOffset; // near the end
        } else {
          return middleOffset;
        }

      case 'auto':
      default:
        if (scrollTop >= minOffset && scrollTop <= maxOffset) {
          return scrollTop;
        } else if (minOffset > maxOffset) {
          // Because we only take into account the scrollbar size when calculating minOffset
          // this value can be larger than maxOffset when at the end of the list
          return minOffset;
        } else if (scrollTop < minOffset) {
          return minOffset;
        } else {
          return maxOffset;
        }

    }
  },
  getColumnStartIndexForOffset: function getColumnStartIndexForOffset(_ref9, scrollLeft) {
    var columnWidth = _ref9.columnWidth,
        columnCount = _ref9.columnCount;
    return Math.max(0, Math.min(columnCount - 1, Math.floor(scrollLeft / columnWidth)));
  },
  getColumnStopIndexForStartIndex: function getColumnStopIndexForStartIndex(_ref10, startIndex, scrollLeft) {
    var columnWidth = _ref10.columnWidth,
        columnCount = _ref10.columnCount,
        width = _ref10.width;
    var left = startIndex * columnWidth;
    var numVisibleColumns = Math.ceil((width + scrollLeft - left) / columnWidth);
    return Math.max(0, Math.min(columnCount - 1, startIndex + numVisibleColumns - 1 // -1 is because stop index is inclusive
    ));
  },
  getRowStartIndexForOffset: function getRowStartIndexForOffset(_ref11, scrollTop) {
    var rowHeight = _ref11.rowHeight,
        rowCount = _ref11.rowCount;
    return Math.max(0, Math.min(rowCount - 1, Math.floor(scrollTop / rowHeight)));
  },
  getRowStopIndexForStartIndex: function getRowStopIndexForStartIndex(_ref12, startIndex, scrollTop) {
    var rowHeight = _ref12.rowHeight,
        rowCount = _ref12.rowCount,
        height = _ref12.height;
    var top = startIndex * rowHeight;
    var numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
    return Math.max(0, Math.min(rowCount - 1, startIndex + numVisibleRows - 1 // -1 is because stop index is inclusive
    ));
  },
  initInstanceProps: function initInstanceProps(props) {// Noop
  },
  shouldResetStyleCacheOnItemSizeChange: true,
  validateProps: function validateProps(_ref13) {
    var columnWidth = _ref13.columnWidth,
        rowHeight = _ref13.rowHeight;

    if (false) {}
  }
});

var FixedSizeList = /*#__PURE__*/createListComponent({
  getItemOffset: function getItemOffset(_ref, index) {
    var itemSize = _ref.itemSize;
    return index * itemSize;
  },
  getItemSize: function getItemSize(_ref2, index) {
    var itemSize = _ref2.itemSize;
    return itemSize;
  },
  getEstimatedTotalSize: function getEstimatedTotalSize(_ref3) {
    var itemCount = _ref3.itemCount,
        itemSize = _ref3.itemSize;
    return itemSize * itemCount;
  },
  getOffsetForIndexAndAlignment: function getOffsetForIndexAndAlignment(_ref4, index, align, scrollOffset, instanceProps, scrollbarSize) {
    var direction = _ref4.direction,
        height = _ref4.height,
        itemCount = _ref4.itemCount,
        itemSize = _ref4.itemSize,
        layout = _ref4.layout,
        width = _ref4.width;
    // TODO Deprecate direction "horizontal"
    var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
    var size = isHorizontal ? width : height;
    var lastItemOffset = Math.max(0, itemCount * itemSize - size);
    var maxOffset = Math.min(lastItemOffset, index * itemSize);
    var minOffset = Math.max(0, index * itemSize - size + itemSize + scrollbarSize);

    if (align === 'smart') {
      if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
        align = 'auto';
      } else {
        align = 'center';
      }
    }

    switch (align) {
      case 'start':
        return maxOffset;

      case 'end':
        return minOffset;

      case 'center':
        {
          // "Centered" offset is usually the average of the min and max.
          // But near the edges of the list, this doesn't hold true.
          var middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);

          if (middleOffset < Math.ceil(size / 2)) {
            return 0; // near the beginning
          } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
            return lastItemOffset; // near the end
          } else {
            return middleOffset;
          }
        }

      case 'auto':
      default:
        if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
          return scrollOffset;
        } else if (scrollOffset < minOffset) {
          return minOffset;
        } else {
          return maxOffset;
        }

    }
  },
  getStartIndexForOffset: function getStartIndexForOffset(_ref5, offset) {
    var itemCount = _ref5.itemCount,
        itemSize = _ref5.itemSize;
    return Math.max(0, Math.min(itemCount - 1, Math.floor(offset / itemSize)));
  },
  getStopIndexForStartIndex: function getStopIndexForStartIndex(_ref6, startIndex, scrollOffset) {
    var direction = _ref6.direction,
        height = _ref6.height,
        itemCount = _ref6.itemCount,
        itemSize = _ref6.itemSize,
        layout = _ref6.layout,
        width = _ref6.width;
    // TODO Deprecate direction "horizontal"
    var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
    var offset = startIndex * itemSize;
    var size = isHorizontal ? width : height;
    var numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
    return Math.max(0, Math.min(itemCount - 1, startIndex + numVisibleItems - 1 // -1 is because stop index is inclusive
    ));
  },
  initInstanceProps: function initInstanceProps(props) {// Noop
  },
  shouldResetStyleCacheOnItemSizeChange: true,
  validateProps: function validateProps(_ref7) {
    var itemSize = _ref7.itemSize;

    if (false) {}
  }
});

// Pulled from react-compat
// https://github.com/developit/preact-compat/blob/7c5de00e7c85e2ffd011bf3af02899b63f699d3a/src/index.js#L349
function shallowDiffers(prev, next) {
  for (var attribute in prev) {
    if (!(attribute in next)) {
      return true;
    }
  }

  for (var _attribute in next) {
    if (prev[_attribute] !== next[_attribute]) {
      return true;
    }
  }

  return false;
}

var _excluded = (/* unused pure expression or super */ null && (["style"])),
    _excluded2 = (/* unused pure expression or super */ null && (["style"]));
// It knows to compare individual style props and ignore the wrapper object.
// See https://reactjs.org/docs/react-api.html#reactmemo

function areEqual(prevProps, nextProps) {
  var prevStyle = prevProps.style,
      prevRest = _objectWithoutPropertiesLoose(prevProps, _excluded);

  var nextStyle = nextProps.style,
      nextRest = _objectWithoutPropertiesLoose(nextProps, _excluded2);

  return !shallowDiffers(prevStyle, nextStyle) && !shallowDiffers(prevRest, nextRest);
}

// It knows to compare individual style props and ignore the wrapper object.
// See https://reactjs.org/docs/react-component.html#shouldcomponentupdate

function shouldComponentUpdate(nextProps, nextState) {
  return !areEqual(this.props, nextProps) || shallowDiffers(this.state, nextState);
}



;// CONCATENATED MODULE: ./node_modules/.pnpm/react-virtualized-auto-sizer@1.0.14_react-dom@17.0.2_react@17.0.2/node_modules/react-virtualized-auto-sizer/dist/react-virtualized-auto-sizer.module.js


var $parcel$global =
typeof globalThis !== 'undefined'
  ? globalThis
  : typeof self !== 'undefined'
  ? self
  : typeof window !== 'undefined'
  ? window
  : typeof __webpack_require__.g !== 'undefined'
  ? __webpack_require__.g
  : {};

var $3e40d2fd7fdb47d2$exports = {};
/**
 * Detect Element Resize.
 * https://github.com/sdecima/javascript-detect-element-resize
 * Sebastian Decima
 *
 * Forked from version 0.5.3; includes the following modifications:
 * 1) Guard against unsafe 'window' and 'document' references (to support SSR).
 * 2) Defer initialization code via a top-level function wrapper (to support SSR).
 * 3) Avoid unnecessary reflows by not measuring size for scroll events bubbling from children.
 * 4) Add nonce for style element.
 **/ // Check `document` and `window` in case of server-side rendering
let $3e40d2fd7fdb47d2$var$windowObject;
if (typeof window !== "undefined") $3e40d2fd7fdb47d2$var$windowObject = window;
else if (typeof self !== "undefined") // eslint-disable-next-line no-restricted-globals
$3e40d2fd7fdb47d2$var$windowObject = self;
else $3e40d2fd7fdb47d2$var$windowObject = $parcel$global;
let $3e40d2fd7fdb47d2$var$cancelFrame = null;
let $3e40d2fd7fdb47d2$var$requestFrame = null;
const $3e40d2fd7fdb47d2$var$TIMEOUT_DURATION = 20;
const $3e40d2fd7fdb47d2$var$clearTimeoutFn = $3e40d2fd7fdb47d2$var$windowObject.clearTimeout;
const $3e40d2fd7fdb47d2$var$setTimeoutFn = $3e40d2fd7fdb47d2$var$windowObject.setTimeout;
const $3e40d2fd7fdb47d2$var$cancelAnimationFrameFn = $3e40d2fd7fdb47d2$var$windowObject.cancelAnimationFrame || $3e40d2fd7fdb47d2$var$windowObject.mozCancelAnimationFrame || $3e40d2fd7fdb47d2$var$windowObject.webkitCancelAnimationFrame;
const $3e40d2fd7fdb47d2$var$requestAnimationFrameFn = $3e40d2fd7fdb47d2$var$windowObject.requestAnimationFrame || $3e40d2fd7fdb47d2$var$windowObject.mozRequestAnimationFrame || $3e40d2fd7fdb47d2$var$windowObject.webkitRequestAnimationFrame;
if ($3e40d2fd7fdb47d2$var$cancelAnimationFrameFn == null || $3e40d2fd7fdb47d2$var$requestAnimationFrameFn == null) {
    // For environments that don't support animation frame,
    // fallback to a setTimeout based approach.
    $3e40d2fd7fdb47d2$var$cancelFrame = $3e40d2fd7fdb47d2$var$clearTimeoutFn;
    $3e40d2fd7fdb47d2$var$requestFrame = function requestAnimationFrameViaSetTimeout(callback) {
        return $3e40d2fd7fdb47d2$var$setTimeoutFn(callback, $3e40d2fd7fdb47d2$var$TIMEOUT_DURATION);
    };
} else {
    // Counter intuitively, environments that support animation frames can be trickier.
    // Chrome's "Throttle non-visible cross-origin iframes" flag can prevent rAFs from being called.
    // In this case, we should fallback to a setTimeout() implementation.
    $3e40d2fd7fdb47d2$var$cancelFrame = function cancelFrame([animationFrameID, timeoutID]) {
        $3e40d2fd7fdb47d2$var$cancelAnimationFrameFn(animationFrameID);
        $3e40d2fd7fdb47d2$var$clearTimeoutFn(timeoutID);
    };
    $3e40d2fd7fdb47d2$var$requestFrame = function requestAnimationFrameWithSetTimeoutFallback(callback) {
        const animationFrameID = $3e40d2fd7fdb47d2$var$requestAnimationFrameFn(function animationFrameCallback() {
            $3e40d2fd7fdb47d2$var$clearTimeoutFn(timeoutID);
            callback();
        });
        const timeoutID = $3e40d2fd7fdb47d2$var$setTimeoutFn(function timeoutCallback() {
            $3e40d2fd7fdb47d2$var$cancelAnimationFrameFn(animationFrameID);
            callback();
        }, $3e40d2fd7fdb47d2$var$TIMEOUT_DURATION);
        return [
            animationFrameID,
            timeoutID
        ];
    };
}
function $3e40d2fd7fdb47d2$var$createDetectElementResize(nonce) {
    let animationKeyframes;
    let animationName;
    let animationStartEvent;
    let animationStyle;
    let checkTriggers;
    let resetTriggers;
    let scrollListener;
    const attachEvent = typeof document !== "undefined" && document.attachEvent;
    if (!attachEvent) {
        resetTriggers = function(element) {
            const triggers = element.__resizeTriggers__, expand = triggers.firstElementChild, contract = triggers.lastElementChild, expandChild = expand.firstElementChild;
            contract.scrollLeft = contract.scrollWidth;
            contract.scrollTop = contract.scrollHeight;
            expandChild.style.width = expand.offsetWidth + 1 + "px";
            expandChild.style.height = expand.offsetHeight + 1 + "px";
            expand.scrollLeft = expand.scrollWidth;
            expand.scrollTop = expand.scrollHeight;
        };
        checkTriggers = function(element) {
            return element.offsetWidth !== element.__resizeLast__.width || element.offsetHeight !== element.__resizeLast__.height;
        };
        scrollListener = function(e) {
            // Don't measure (which forces) reflow for scrolls that happen inside of children!
            if (e.target.className && typeof e.target.className.indexOf === "function" && e.target.className.indexOf("contract-trigger") < 0 && e.target.className.indexOf("expand-trigger") < 0) return;
            const element = this;
            resetTriggers(this);
            if (this.__resizeRAF__) $3e40d2fd7fdb47d2$var$cancelFrame(this.__resizeRAF__);
            this.__resizeRAF__ = $3e40d2fd7fdb47d2$var$requestFrame(function animationFrame() {
                if (checkTriggers(element)) {
                    element.__resizeLast__.width = element.offsetWidth;
                    element.__resizeLast__.height = element.offsetHeight;
                    element.__resizeListeners__.forEach(function forEachResizeListener(fn) {
                        fn.call(element, e);
                    });
                }
            });
        };
        /* Detect CSS Animations support to detect element display/re-attach */ let animation = false;
        let keyframeprefix = "";
        animationStartEvent = "animationstart";
        const domPrefixes = "Webkit Moz O ms".split(" ");
        let startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" ");
        let pfx = "";
        {
            const elm = document.createElement("fakeelement");
            if (elm.style.animationName !== undefined) animation = true;
            if (animation === false) {
                for(let i = 0; i < domPrefixes.length; i++)if (elm.style[domPrefixes[i] + "AnimationName"] !== undefined) {
                    pfx = domPrefixes[i];
                    keyframeprefix = "-" + pfx.toLowerCase() + "-";
                    animationStartEvent = startEvents[i];
                    animation = true;
                    break;
                }
            }
        }
        animationName = "resizeanim";
        animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ";
        animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
    }
    const createStyles = function(doc) {
        if (!doc.getElementById("detectElementResize")) {
            //opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
            const css = (animationKeyframes ? animationKeyframes : "") + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', head = doc.head || doc.getElementsByTagName("head")[0], style = doc.createElement("style");
            style.id = "detectElementResize";
            style.type = "text/css";
            if (nonce != null) style.setAttribute("nonce", nonce);
            if (style.styleSheet) style.styleSheet.cssText = css;
            else style.appendChild(doc.createTextNode(css));
            head.appendChild(style);
        }
    };
    const addResizeListener = function(element, fn) {
        if (attachEvent) element.attachEvent("onresize", fn);
        else {
            if (!element.__resizeTriggers__) {
                const doc = element.ownerDocument;
                const elementStyle = $3e40d2fd7fdb47d2$var$windowObject.getComputedStyle(element);
                if (elementStyle && elementStyle.position === "static") element.style.position = "relative";
                createStyles(doc);
                element.__resizeLast__ = {};
                element.__resizeListeners__ = [];
                (element.__resizeTriggers__ = doc.createElement("div")).className = "resize-triggers";
                const expandTrigger = doc.createElement("div");
                expandTrigger.className = "expand-trigger";
                expandTrigger.appendChild(doc.createElement("div"));
                const contractTrigger = doc.createElement("div");
                contractTrigger.className = "contract-trigger";
                element.__resizeTriggers__.appendChild(expandTrigger);
                element.__resizeTriggers__.appendChild(contractTrigger);
                element.appendChild(element.__resizeTriggers__);
                resetTriggers(element);
                element.addEventListener("scroll", scrollListener, true);
                /* Listen for a css animation to detect element display/re-attach */ if (animationStartEvent) {
                    element.__resizeTriggers__.__animationListener__ = function animationListener(e) {
                        if (e.animationName === animationName) resetTriggers(element);
                    };
                    element.__resizeTriggers__.addEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
                }
            }
            element.__resizeListeners__.push(fn);
        }
    };
    const removeResizeListener = function(element, fn) {
        if (attachEvent) element.detachEvent("onresize", fn);
        else {
            element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
            if (!element.__resizeListeners__.length) {
                element.removeEventListener("scroll", scrollListener, true);
                if (element.__resizeTriggers__.__animationListener__) {
                    element.__resizeTriggers__.removeEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
                    element.__resizeTriggers__.__animationListener__ = null;
                }
                try {
                    element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
                } catch (e) {
                // Preact compat; see developit/preact-compat/issues/228
                }
            }
        }
    };
    return {
        addResizeListener: addResizeListener,
        removeResizeListener: removeResizeListener
    };
}
$3e40d2fd7fdb47d2$exports = {
    createDetectElementResize: $3e40d2fd7fdb47d2$var$createDetectElementResize
};


function $6e2bb92d9db3b0c8$var$_defineProperty(obj, key, value) {
    key = $6e2bb92d9db3b0c8$var$_toPropertyKey(key);
    if (key in obj) Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
    });
    else obj[key] = value;
    return obj;
}
function $6e2bb92d9db3b0c8$var$_toPropertyKey(arg) {
    var key = $6e2bb92d9db3b0c8$var$_toPrimitive(arg, "string");
    return typeof key === "symbol" ? key : String(key);
}
function $6e2bb92d9db3b0c8$var$_toPrimitive(input, hint) {
    if (typeof input !== "object" || input === null) return input;
    var prim = input[Symbol.toPrimitive];
    if (prim !== undefined) {
        var res = prim.call(input, hint || "default");
        if (typeof res !== "object") return res;
        throw new TypeError("@@toPrimitive must return a primitive value.");
    }
    return (hint === "string" ? String : Number)(input);
}
class $6e2bb92d9db3b0c8$export$9d94f4ee1d930ff extends (0, react.Component) {
    constructor(...args){
        super(...args);
        $6e2bb92d9db3b0c8$var$_defineProperty(this, "state", {
            height: this.props.defaultHeight || 0,
            scaledHeight: this.props.defaultHeight || 0,
            scaledWidth: this.props.defaultWidth || 0,
            width: this.props.defaultWidth || 0
        });
        $6e2bb92d9db3b0c8$var$_defineProperty(this, "_autoSizer", null);
        $6e2bb92d9db3b0c8$var$_defineProperty(this, "_detectElementResize", null);
        $6e2bb92d9db3b0c8$var$_defineProperty(this, "_parentNode", null);
        $6e2bb92d9db3b0c8$var$_defineProperty(this, "_resizeObserver", null);
        $6e2bb92d9db3b0c8$var$_defineProperty(this, "_onResize", ()=>{
            const { disableHeight: disableHeight , disableWidth: disableWidth , onResize: onResize  } = this.props;
            if (this._parentNode) {
                var _style$paddingLeft, _style$paddingRight, _style$paddingTop, _style$paddingBottom;
                // Guard against AutoSizer component being removed from the DOM immediately after being added.
                // This can result in invalid style values which can result in NaN values if we don't handle them.
                // See issue #150 for more context.
                const style = window.getComputedStyle(this._parentNode) || {};
                const paddingLeft = parseInt((_style$paddingLeft = style.paddingLeft) !== null && _style$paddingLeft !== void 0 ? _style$paddingLeft : "0", 10);
                const paddingRight = parseInt((_style$paddingRight = style.paddingRight) !== null && _style$paddingRight !== void 0 ? _style$paddingRight : "0", 10);
                const paddingTop = parseInt((_style$paddingTop = style.paddingTop) !== null && _style$paddingTop !== void 0 ? _style$paddingTop : "0", 10);
                const paddingBottom = parseInt((_style$paddingBottom = style.paddingBottom) !== null && _style$paddingBottom !== void 0 ? _style$paddingBottom : "0", 10);
                const rect = this._parentNode.getBoundingClientRect();
                const scaledHeight = rect.height - paddingTop - paddingBottom;
                const scaledWidth = rect.width - paddingLeft - paddingRight;
                const height = this._parentNode.offsetHeight - paddingTop - paddingBottom;
                const width = this._parentNode.offsetWidth - paddingLeft - paddingRight;
                if (!disableHeight && (this.state.height !== height || this.state.scaledHeight !== scaledHeight) || !disableWidth && (this.state.width !== width || this.state.scaledWidth !== scaledWidth)) {
                    this.setState({
                        height: height,
                        width: width,
                        scaledHeight: scaledHeight,
                        scaledWidth: scaledWidth
                    });
                    if (typeof onResize === "function") onResize({
                        height: height,
                        scaledHeight: scaledHeight,
                        scaledWidth: scaledWidth,
                        width: width
                    });
                }
            }
        });
        $6e2bb92d9db3b0c8$var$_defineProperty(this, "_setRef", (autoSizer)=>{
            this._autoSizer = autoSizer;
        });
    }
    componentDidMount() {
        const { nonce: nonce  } = this.props;
        if (this._autoSizer && this._autoSizer.parentNode && this._autoSizer.parentNode.ownerDocument && this._autoSizer.parentNode.ownerDocument.defaultView && this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement) {
            // Delay access of parentNode until mount.
            // This handles edge-cases where the component has already been unmounted before its ref has been set,
            // As well as libraries like react-lite which have a slightly different lifecycle.
            this._parentNode = this._autoSizer.parentNode;
            // Defer requiring resize handler in order to support server-side rendering.
            // See issue #41
            if (this._parentNode != null) {
                if (typeof ResizeObserver !== "undefined") {
                    this._resizeObserver = new ResizeObserver(()=>{
                        // Guard against "ResizeObserver loop limit exceeded" error;
                        // could be triggered if the state update causes the ResizeObserver handler to run long.
                        // See https://github.com/bvaughn/react-virtualized-auto-sizer/issues/55
                        setTimeout(this._onResize, 0);
                    });
                    this._resizeObserver.observe(this._parentNode);
                } else {
                    this._detectElementResize = (0, $3e40d2fd7fdb47d2$exports.createDetectElementResize)(nonce);
                    this._detectElementResize.addResizeListener(this._parentNode, this._onResize);
                }
                this._onResize();
            }
        }
    }
    componentWillUnmount() {
        if (this._parentNode) {
            if (this._detectElementResize) this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
            if (this._resizeObserver) {
                this._resizeObserver.observe(this._parentNode);
                this._resizeObserver.disconnect();
            }
        }
    }
    render() {
        const { children: children , defaultHeight: defaultHeight , defaultWidth: defaultWidth , disableHeight: disableHeight , disableWidth: disableWidth , nonce: nonce , onResize: onResize , style: style , tagName: tagName = "div" , ...rest } = this.props;
        const { height: height , scaledHeight: scaledHeight , scaledWidth: scaledWidth , width: width  } = this.state;
        // Outer div should not force width/height since that may prevent containers from shrinking.
        // Inner component should overflow and use calculated width/height.
        // See issue #68 for more information.
        const outerStyle = {
            overflow: "visible"
        };
        const childParams = {};
        // Avoid rendering children before the initial measurements have been collected.
        // At best this would just be wasting cycles.
        let bailoutOnChildren = false;
        if (!disableHeight) {
            if (height === 0) bailoutOnChildren = true;
            outerStyle.height = 0;
            childParams.height = height;
            childParams.scaledHeight = scaledHeight;
        }
        if (!disableWidth) {
            if (width === 0) bailoutOnChildren = true;
            outerStyle.width = 0;
            childParams.width = width;
            childParams.scaledWidth = scaledWidth;
        }
        return (0, react.createElement)(tagName, {
            ref: this._setRef,
            style: {
                ...outerStyle,
                ...style
            },
            ...rest
        }, !bailoutOnChildren && children(childParams));
    }
}
$6e2bb92d9db3b0c8$var$_defineProperty($6e2bb92d9db3b0c8$export$9d94f4ee1d930ff, "defaultProps", {
    onResize: ()=>{},
    disableHeight: false,
    disableWidth: false,
    style: {}
});


var $149c1bd638913645$export$2e2bcd8739ae039 = (0, $6e2bb92d9db3b0c8$export$9d94f4ee1d930ff);




;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/FilteringEvents/FilteringEventsEmpty.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 




const FilteringEventsEmpty = (0,mobxreact_esm/* observer */.Pi)(()=>{
    const { logStore } = (0,react.useContext)(rootStore);
    if (logStore.events.length > 0) {
        return null;
    }
    const resetFilters = async ()=>{
        await logStore.resetAllFilters();
    };
    const refreshPage = async ()=>{
        await logStore.refreshPage();
    };
    return /*#__PURE__*/ react.createElement("div", {
        className: "filtering-log__empty"
    }, /*#__PURE__*/ react.createElement("div", {
        className: "filtering-log__empty-in"
    }, /*#__PURE__*/ react.createElement(Icon/* Icon */.J, {
        id: "#empty-box",
        classname: "icon--gray-default filtering-log__empty-img"
    }), /*#__PURE__*/ react.createElement("div", {
        className: "filtering-log__desc"
    }, reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_table_empty_reload_page_desc', {
        reset: (chunks)=>/*#__PURE__*/ react.createElement("button", {
                className: "button button--link button--link--green",
                type: "button",
                onClick: resetFilters
            }, chunks),
        refresh: (chunks)=>/*#__PURE__*/ react.createElement("button", {
                className: "button button--link button--link--green",
                type: "button",
                onClick: refreshPage
            }, chunks)
    }))));
});

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/components/FilteringEvents/filtering-events.pcss
var filtering_events = __webpack_require__(18118);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/FilteringEvents/filtering-events.pcss

      
      
      
      
      
      
      
      
      

var filtering_events_options = {};

filtering_events_options.styleTagTransform = (styleTagTransform_default());
filtering_events_options.setAttributes = (setAttributesWithoutAttributes_default());

      filtering_events_options.insert = insertBySelector_default().bind(null, "head");
    
filtering_events_options.domAPI = (styleDomAPI_default());
filtering_events_options.insertStyleElement = (insertStyleElement_default());

var filtering_events_update = injectStylesIntoStyleTag_default()(filtering_events/* default */.Z, filtering_events_options);




       /* harmony default export */ const FilteringEvents_filtering_events = (filtering_events/* default */.Z && filtering_events/* default.locals */.Z.locals ? filtering_events/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/FilteringEvents/FilteringEvents.jsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

















const ITEM_HEIGHT_PX = 30;
const filterNameAccessor = (props)=>{
    const { requestRule, filterName, stealthActions } = props;
    if (requestRule && requestRule.isStealthModeRule) {
        return reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_log_privacy_applied_rules');
    }
    if (!filterName && stealthActions) {
        return reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_log_privacy_applied_rules');
    }
    return props.filterName;
};
/**
 * @typedef {object} RowClassName
 * @property {string} YELLOW
 * @property {string} RED
 * @property {string} GREEN
 * @property {string} LIGHT_GREEN
 */ const RowClassName = {
    YELLOW: 'yellow',
    RED: 'red',
    GREEN: 'green',
    LIGHT_GREEN: 'light-green'
};
const rowClassNameMap = {
    [StatusMode.REGULAR]: null,
    [StatusMode.MODIFIED]: RowClassName.YELLOW,
    [StatusMode.BLOCKED]: RowClassName.RED,
    [StatusMode.ALLOWED]: RowClassName.LIGHT_GREEN,
    [StatusMode.ALLOWED_STEALTH]: RowClassName.GREEN
};
const getRowClassName = (event)=>{
    const mode = getStatusMode(event);
    return rowClassNameMap[mode];
};
const urlAccessor = (props)=>{
    const { requestUrl, cookieName, cookieValue, element } = props;
    if (cookieName && cookieValue) {
        return `${cookieName} = ${cookieValue}`;
    }
    if (cookieName) {
        return `${cookieName}`;
    }
    if (element) {
        return element;
    }
    return requestUrl;
};
const typeAccessor = (props)=>{
    return getRequestEventType(props);
};
const ruleAccessor = (props)=>{
    const { requestRule, replaceRules, stealthAllowlistRules, declarativeRuleInfo } = props;
    let ruleText = '';
    if (requestRule) {
        if (requestRule.filterId === constants/* AntiBannerFiltersId.AllowlistFilterId */.m6.AllowlistFilterId) {
            ruleText = translator/* translator.getMessage */.O.getMessage('filtering_log_in_allowlist');
        } else {
            ruleText = requestRule.appliedRuleText;
        }
    }
    if (replaceRules) {
        const rulesCount = replaceRules.length;
        ruleText = `${translator/* translator.getMessage */.O.getMessage('filtering_log_modified_rules', {
            rules_count: rulesCount
        })}`;
    }
    if (stealthAllowlistRules && stealthAllowlistRules.length > 0) {
        const rulesCount = stealthAllowlistRules.length;
        if (rulesCount === 1) {
            return stealthAllowlistRules[0].ruleText;
        }
        ruleText = translator/* translator.getMessage */.O.getMessage('filtering_log_stealth_rules', {
            rules_count: rulesCount
        });
    }
    // If this is a cosmetic rule - we should not check declarative source rules,
    // because they works only with network part.
    const isCosmeticRule = (requestRule === null || requestRule === void 0 ? void 0 : requestRule.cssRule) || (requestRule === null || requestRule === void 0 ? void 0 : requestRule.scriptRule);
    if (isCosmeticRule) {
        return ruleText;
    }
    // If we have exact matched rule - show it.
    if ((declarativeRuleInfo === null || declarativeRuleInfo === void 0 ? void 0 : declarativeRuleInfo.sourceRules.length) > 0) {
        // But for allowlisted sited we do not needed to show source rule,
        // only show "this site is allowlisted".
        if (declarativeRuleInfo.sourceRules[0].filterId === constants/* AntiBannerFiltersId.AllowlistFilterId */.m6.AllowlistFilterId) {
            return translator/* translator.getMessage */.O.getMessage('filtering_log_in_allowlist');
        }
        const exactMatchedRules = declarativeRuleInfo.sourceRules.map(({ sourceRule })=>sourceRule).join('; ');
        if (!ruleText) {
            return exactMatchedRules;
        }
        const { sourceRules } = declarativeRuleInfo;
        // Note: source rules contains text from already preprocessed rules,
        // that's why we checked appliedRuleText, but not originalRuleText.
        const matchedRulesContainsAssumed = sourceRules.some(({ sourceRule })=>sourceRule === ruleText);
        // If exactly matched rules do not contain assumed rule - we render
        // attention mark for this request.
        const attention = !matchedRulesContainsAssumed && /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement("span", null, "❗"));
        return /*#__PURE__*/ react.createElement(react.Fragment, null, attention, exactMatchedRules);
    }
    // Otherwise show assumed (for MV3, but for MV2 it will be exact) rule,
    // if found any.
    const isAssumedRule =  true && ruleText && !isCosmeticRule;
    return /*#__PURE__*/ react.createElement(react.Fragment, null, isAssumedRule && /*#__PURE__*/ react.createElement("span", {
        className: "red-dot"
    }, "*"), ruleText);
};
const statusAccessor = (props)=>{
    return /*#__PURE__*/ react.createElement(Status, props);
};
const Row = (0,mobxreact_esm/* observer */.Pi)(({ event, columns, onClick, style })=>{
    var _logStore_selectedEvent;
    const { logStore } = (0,react.useContext)(rootStore);
    const className = classnames_default()('tr tr--tbody', {
        'tr--active': event.eventId === ((_logStore_selectedEvent = logStore.selectedEvent) === null || _logStore_selectedEvent === void 0 ? void 0 : _logStore_selectedEvent.eventId)
    }, getRowClassName(event));
    return /*#__PURE__*/ react.createElement("button", {
        style: {
            ...style,
            top: `${parseFloat(style.top) + ITEM_HEIGHT_PX}px`
        },
        id: event.eventId,
        onClick: onClick,
        type: "button",
        className: className
    }, columns.map((column)=>{
        const { accessor } = column;
        let cellContent;
        if (typeof accessor === 'string') {
            cellContent = event[accessor];
        } else {
            cellContent = accessor(event);
        }
        return /*#__PURE__*/ react.createElement("div", {
            className: "td",
            key: column.id,
            style: {
                width: column.getWidth()
            }
        }, cellContent);
    }));
});
const VirtualizedRow = ({ index, style, data })=>{
    const { events, columns, handleRowClick } = data;
    const event = events[index];
    return /*#__PURE__*/ react.createElement(Row, {
        event: event,
        columns: columns,
        onClick: handleRowClick,
        style: style
    });
};
const ColumnsContext = /*#__PURE__*/ react.createContext({});
const ColumnsProvider = ColumnsContext.Provider;
const TableHeader = ({ style })=>{
    const { columns } = (0,react.useContext)(ColumnsContext);
    return /*#__PURE__*/ react.createElement("div", {
        className: "thead",
        style: style
    }, /*#__PURE__*/ react.createElement("div", {
        className: "tr"
    }, columns.map((column)=>/*#__PURE__*/ react.createElement("div", {
            className: "th",
            key: column.id,
            style: {
                width: column.getWidth()
            }
        }, column.Header, /*#__PURE__*/ react.createElement("div", {
            role: "separator",
            className: "resizer",
            key: column.id,
            style: {
                cursor: 'col-resize'
            },
            ...column.getResizerProps()
        })))));
};
const TableInnerWrapper = /*#__PURE__*/ (0,react.forwardRef)(({ children, ...rest }, ref)=>{
    return /*#__PURE__*/ react.createElement("div", {
        ref: ref,
        ...rest
    }, /*#__PURE__*/ react.createElement(TableHeader, {
        index: 0,
        key: 0,
        style: {
            top: 0,
            left: 0,
            width: '100%',
            height: 30
        }
    }), children);
});
const FilteringEventsRows = (0,mobxreact_esm/* observer */.Pi)(({ logStore, columns, handleRowClick })=>{
    const { events } = logStore;
    return(/**
         * FixedSizeList does not support passing props to innerElementType component
         * We use React Context API to bypass this limitation
         *
         * https://github.com/bvaughn/react-window/issues/404
         */ /*#__PURE__*/ react.createElement(ColumnsProvider, {
        value: {
            columns
        }
    }, /*#__PURE__*/ react.createElement($149c1bd638913645$export$2e2bcd8739ae039, null, ({ height })=>{
        return /*#__PURE__*/ react.createElement(FixedSizeList, {
            className: "list",
            height: height,
            itemCount: events.length,
            itemData: {
                events,
                columns,
                handleRowClick
            },
            innerElementType: TableInnerWrapper,
            itemSize: ITEM_HEIGHT_PX
        }, VirtualizedRow);
    })));
});
const DEFAULT_COLUMN_WIDTH = 200;
const MIN_COLUMN_WIDTH = 50;
const FilteringEvents = (0,mobxreact_esm/* observer */.Pi)(()=>{
    const { logStore } = (0,react.useContext)(rootStore);
    const tableRef = (0,react.useRef)(null);
    const handleRowClick = (0,react.useCallback)((e)=>{
        const { id } = e.currentTarget;
        logStore.handleSelectEvent(id);
    }, [
        logStore
    ]);
    const columnsData = [
        {
            id: 'status',
            Header: `${reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_table_status')}`,
            accessor: statusAccessor
        },
        {
            id: 'url',
            Header: 'URL',
            accessor: urlAccessor
        },
        {
            id: 'type',
            Header: `${reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_table_type')}`,
            accessor: typeAccessor
        },
        {
            id: 'rule',
            Header: `${reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_table_rule')}`,
            accessor: ruleAccessor
        },
        {
            id: 'filter',
            Header: `${reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_table_filter')}`,
            accessor: filterNameAccessor
        },
        {
            id: 'source',
            Header: `${reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_table_source')}`,
            accessor: 'frameDomain'
        }
    ];
    const [columnsRenderData, setColumnsRenderData] = (0,react.useState)(options_storage/* optionsStorage.getItem */.P.getItem(options_storage/* optionsStorage.KEYS.COLUMNS_DATA */.P.KEYS.COLUMNS_DATA));
    (0,react.useEffect)(()=>{
        options_storage/* optionsStorage.setItem */.P.setItem(options_storage/* optionsStorage.KEYS.COLUMNS_DATA */.P.KEYS.COLUMNS_DATA, columnsRenderData);
    }, [
        columnsRenderData
    ]);
    let startClientX = null;
    const dispatchMove = (0,throttle/* default */.Z)((clientX, columnId)=>{
        var _columnsRenderData_columnId;
        if (!startClientX) {
            return;
        }
        let columnWidth = (_columnsRenderData_columnId = columnsRenderData[columnId]) === null || _columnsRenderData_columnId === void 0 ? void 0 : _columnsRenderData_columnId.width;
        if (!columnWidth) {
            columnWidth = DEFAULT_COLUMN_WIDTH;
        }
        const deltaX = startClientX - clientX;
        const newColumnWidth = columnWidth - deltaX;
        if (newColumnWidth < MIN_COLUMN_WIDTH) {
            return;
        }
        setColumnsRenderData({
            ...columnsRenderData,
            [columnId]: {
                ...columnsRenderData[columnId],
                width: newColumnWidth
            }
        });
    }, 20);
    const dispatchMovingStarted = (clientX)=>{
        startClientX = clientX;
        // fixes cursor blinking and text selection
        document.body.classList.add('col-resize');
    };
    const dispatchEnd = ()=>{
        startClientX = null;
        // clear after dragging end
        document.body.classList.remove('col-resize');
    };
    const onResizeStart = (e, columnId)=>{
        let isTouchEvent = false;
        if (e.type === 'touchstart') {
            // lets not respond to multiple touches (e.g. 2 or 3 fingers)
            if (e.touches && e.touches.length > 1) {
                return;
            }
            isTouchEvent = true;
        }
        const clientX = isTouchEvent ? Math.round(e.touches[0].clientX) : e.clientX;
        const handlersAndEvents = {
            mouse: {
                moveEvent: 'mousemove',
                // eslint-disable-next-line no-shadow
                moveHandler: (e)=>dispatchMove(e.clientX, columnId),
                upEvent: 'mouseup',
                upHandler: ()=>{
                    document.removeEventListener('mousemove', handlersAndEvents.mouse.moveHandler);
                    document.removeEventListener('mouseup', handlersAndEvents.mouse.upHandler);
                    dispatchEnd();
                }
            },
            touch: {
                moveEvent: 'touchmove',
                // eslint-disable-next-line no-shadow
                moveHandler: (e)=>{
                    if (e.cancelable) {
                        e.preventDefault();
                        e.stopPropagation();
                    }
                    dispatchMove(e.touches[0].clientX, columnId);
                    return false;
                },
                upEvent: 'touchend',
                upHandler: ()=>{
                    document.removeEventListener(handlersAndEvents.touch.moveEvent, handlersAndEvents.touch.moveHandler);
                    document.removeEventListener(handlersAndEvents.touch.upEvent, handlersAndEvents.touch.moveHandler);
                    dispatchEnd();
                }
            }
        };
        const events = isTouchEvent ? handlersAndEvents.touch : handlersAndEvents.mouse;
        const passiveIfSupported = (0,pages_helpers/* passiveEventSupported */.n$)() ? {
            passive: false
        } : false;
        document.addEventListener(events.moveEvent, events.moveHandler, passiveIfSupported);
        document.addEventListener(events.upEvent, events.upHandler, passiveIfSupported);
        dispatchMovingStarted(clientX);
    };
    const getResizerProps = (columnId)=>{
        return {
            onMouseDown: (e)=>onResizeStart(e, columnId),
            onTouchStart: (e)=>onResizeStart(e, columnId)
        };
    };
    const addMethods = (columns)=>{
        return columns.map((column)=>{
            return {
                ...column,
                getWidth: ()=>{
                    return `${columnsRenderData[column.id].width}px`;
                },
                getResizerProps: ()=>{
                    return getResizerProps(column.id);
                }
            };
        });
    };
    const minTableWidth = Object.values(columnsRenderData).reduce((acc, { width })=>acc + width + constants/* SCROLLBAR_WIDTH */.nn, 0);
    const columns = addMethods(columnsData);
    return /*#__PURE__*/ react.createElement("div", {
        className: "filtering-log"
    }, /*#__PURE__*/ react.createElement("div", {
        style: {
            minWidth: `${minTableWidth}px`
        },
        className: "table filtering-log__inner",
        ref: tableRef
    }, /*#__PURE__*/ react.createElement("div", {
        className: "tbody",
        style: {
            height: '100%'
        }
    }, /*#__PURE__*/ react.createElement(FilteringEventsRows, {
        logStore: logStore,
        handleRowClick: handleRowClick,
        columns: columns
    }), /*#__PURE__*/ react.createElement(FilteringEventsEmpty, null))));
});


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/FilteringEvents/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/ui/Icons.tsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const Icons_Icons = ()=>{
    return /*#__PURE__*/ react.createElement("svg", {
        xmlns: "http://www.w3.org/2000/svg",
        display: "none"
    }, /*#__PURE__*/ react.createElement("symbol", {
        id: "arrow-down",
        viewBox: "0 0 24 24"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        fill: "none",
        d: "M8.0354 10.9305L11.965 14.9997L16.0342 11.0702",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "ban",
        viewBox: "0 0 16 16"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        fill: "none",
        fillRule: "evenodd",
        clipRule: "evenodd",
        d: "M8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12Z",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }), /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        fill: "none",
        d: "M2.22 13.84 13.55 2.51",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "arrow-status",
        viewBox: "0 0 16 16"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        fill: "none",
        d: "M11.7 4.67 14.67 8H1.33M11.7 11.33 14.67 8",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "transfer-status",
        viewBox: "0 0 16 16"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        fill: "none",
        d: "m10 3 2 2M10 7l2-2M12 5H4M6 9l-2 2M6 13l-2-2M4 11h8",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "record",
        viewBox: "0 0 24 24"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        fill: "currentColor",
        d: "M9.5 12a2.5 2.5 0 1 1 5 0 2.5 2.5 0 0 1-5 0Z",
        strokeWidth: "3",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }), /*#__PURE__*/ react.createElement("circle", {
        stroke: "currentColor",
        fill: "none",
        cx: "12",
        cy: "12",
        r: "8.33",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "empty-box",
        viewBox: "0 0 64 64"
    }, /*#__PURE__*/ react.createElement("g", {
        fill: "none",
        fillRule: "evenodd"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "M55.5 49.39a7 7 0 1 0 0-14 7 7 0 0 0 0 14Z",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }), /*#__PURE__*/ react.createElement("path", {
        fill: "currentColor",
        d: "M55.5 39.28v4.67-4.67Z"
    }), /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "M55.5 39.28v4.67",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }), /*#__PURE__*/ react.createElement("path", {
        fill: "currentColor",
        d: "M55.5 45.8v.16-.15Z"
    }), /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "M55.5 45.8v.16M10.8 22.8v21.54h35.34M53.28 33.1v-10M10.8 14H53.28M36.09 14v30.34",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }), /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "m36.28 14-8.8 8.8H2l8.8-8.8",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }), /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "m35.98 14.3 8.8 8.8h17.6l-9.1-9.1",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }))));
};

// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/filtering-log/styles/styles.pcss
var styles = __webpack_require__(45827);
;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/styles/styles.pcss

      
      
      
      
      
      
      
      
      

var styles_options = {};

styles_options.styleTagTransform = (styleTagTransform_default());
styles_options.setAttributes = (setAttributesWithoutAttributes_default());

      styles_options.insert = insertBySelector_default().bind(null, "head");
    
styles_options.domAPI = (styleDomAPI_default());
styles_options.insertStyleElement = (insertStyleElement_default());

var styles_update = injectStylesIntoStyleTag_default()(styles/* default */.Z, styles_options);




       /* harmony default export */ const styles_styles = (styles/* default */.Z && styles/* default.locals */.Z.locals ? styles/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/FilteringLog/FilteringLog.tsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 













const FilteringLog = (0,mobxreact_esm/* observer */.Pi)(()=>{
    const { wizardStore, logStore } = (0,react.useContext)(rootStore);
    const RESIZE_THROTTLE = 500;
    (0,useAppearanceTheme/* useAppearanceTheme */.D)(logStore.appearanceTheme);
    // init
    (0,react.useEffect)(()=>{
        (async ()=>{
            await Promise.all([
                logStore.synchronizeOpenTabs(),
                logStore.getFilteringLogData()
            ]);
        })();
    }, [
        logStore
    ]);
    (0,react.useEffect)(()=>{
        const FETCH_EVENTS_TIMEOUT_MS = 300;
        logStore.getFilteringLogEvents();
        const intervalId = setInterval(async ()=>{
            await logStore.getFilteringLogEvents();
        }, FETCH_EVENTS_TIMEOUT_MS);
        return ()=>{
            clearInterval(intervalId);
        };
    }, [
        logStore
    ]);
    // listen for hash change
    (0,react.useEffect)(()=>{
        const handleHashChange = async ()=>{
            // Set current tab id as selected, background page provides it with hash value
            const currentTabId = document.location.hash.slice(1);
            await logStore.setSelectedTabId(currentTabId);
        };
        handleHashChange();
        window.addEventListener('hashchange', handleHashChange);
        return function onUnmount() {
            window.removeEventListener('hashchange', handleHashChange);
        };
    }, [
        logStore
    ]);
    // append message listeners
    (0,react.useEffect)(()=>{
        let removeListenerCallback = ()=>{};
        (async ()=>{
            const events = [
                constants/* NotifierType.TabAdded */.uq.TabAdded,
                constants/* NotifierType.TabUpdate */.uq.TabUpdate,
                constants/* NotifierType.TabClose */.uq.TabClose,
                constants/* NotifierType.TabReset */.uq.TabReset,
                constants/* NotifierType.SettingUpdated */.uq.SettingUpdated,
                constants/* NotifierType.CustomFilterAdded */.uq.CustomFilterAdded
            ];
            removeListenerCallback = messenger/* messenger.createLongLivedConnection */.d.createLongLivedConnection(messenger/* Page.FilteringLog */.T.FilteringLog, events, async (message)=>{
                const { type, data } = message;
                switch(type){
                    case constants/* NotifierType.TabAdded */.uq.TabAdded:
                    case constants/* NotifierType.TabUpdate */.uq.TabUpdate:
                        {
                            const [tabInfo] = data;
                            logStore.onTabUpdate(tabInfo);
                            break;
                        }
                    case constants/* NotifierType.TabClose */.uq.TabClose:
                        {
                            const [tabInfo] = data;
                            await logStore.onTabClose(tabInfo);
                            break;
                        }
                    case constants/* NotifierType.TabReset */.uq.TabReset:
                        {
                            const [tabInfo] = data;
                            logStore.onTabReset(tabInfo);
                            wizardStore.closeModal();
                            break;
                        }
                    case constants/* NotifierType.SettingUpdated */.uq.SettingUpdated:
                        {
                            const [{ propertyName, propertyValue }] = data;
                            logStore.onSettingUpdated(propertyName, propertyValue);
                            break;
                        }
                    case constants/* NotifierType.CustomFilterAdded */.uq.CustomFilterAdded:
                        {
                            await logStore.getFilteringLogData();
                            break;
                        }
                    default:
                        {
                            common_logger/* logger.debug */.k.debug('There is no listener for type:', type);
                            break;
                        }
                }
            });
        })();
        return ()=>{
            removeListenerCallback();
        };
    }, [
        logStore,
        wizardStore
    ]);
    (0,react.useEffect)(()=>{
        const windowStateHandler = ()=>{
            const { outerWidth, outerHeight, screenTop, screenLeft, screen } = window;
            const isFullscreen = outerWidth === screen.width && outerHeight === screen.height;
            if (isFullscreen) {
                messenger/* messenger.setFilteringLogWindowState */.d.setFilteringLogWindowState({
                    state: 'fullscreen'
                });
            } else {
                messenger/* messenger.setFilteringLogWindowState */.d.setFilteringLogWindowState({
                    width: outerWidth,
                    height: outerHeight,
                    top: screenTop,
                    left: screenLeft
                });
            }
        };
        const throttledWindowStateHandler = (0,throttle/* default */.Z)(windowStateHandler, RESIZE_THROTTLE);
        window.addEventListener('beforeunload', windowStateHandler);
        window.addEventListener('resize', throttledWindowStateHandler);
        return ()=>{
            window.removeEventListener('beforeunload', windowStateHandler);
            window.removeEventListener('resize', throttledWindowStateHandler);
        };
    }, [
        logStore
    ]);
    return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Icons/* Icons */.P, null), /*#__PURE__*/ react.createElement(Icons_Icons, null), wizardStore.isModalOpen && /*#__PURE__*/ react.createElement(RequestModal, null), /*#__PURE__*/ react.createElement(Filters, null), /*#__PURE__*/ react.createElement(FilteringEvents, null));
});


;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/components/FilteringLog/index.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

;// CONCATENATED MODULE: ./Extension/src/pages/filtering-log/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 




const filteringLog = {
    init: ()=>{
        document.title = reactTranslator/* reactTranslator.getMessage */._.getMessage('filtering_log_title');
        document.documentElement.lang = i18n/* i18n.getUILanguage */.a.getUILanguage();
        react_dom.render(/*#__PURE__*/ react.createElement(FilteringLog, null), document.getElementById('root'));
    }
};

;// CONCATENATED MODULE: ./Extension/pages/filtering-log/index.js
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
filteringLog.init();


/***/ }),

/***/ 73670:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony export annoyancesConsentStorageDataValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const annoyancesConsentStorageDataValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].array */ .ZP.array(zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number());


/***/ }),

/***/ 28111:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _annoyances_consent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73670);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ // Annoyances consent schema entry point
// annoyances consent validators and types



/***/ }),

/***/ 50463:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "c": () => (/* binding */ allowlistValidator)
/* harmony export */ });
/* unused harmony export AllowlistOption */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
// Allowlist configuration
var AllowlistOption = /*#__PURE__*/ function(AllowlistOption) {
    AllowlistOption["Inverted"] = "inverted";
    AllowlistOption["Domains"] = "domains";
    AllowlistOption["InvertedDomains"] = "inverted-domains";
    AllowlistOption["Enabled"] = "enabled";
    return AllowlistOption;
}({});
const allowlistValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * If `AllowlistOption.Inverted` === false (the default state),
     * the extension will use this list of domains to disable ad blocking on
     * them. In other words, the extension will apply ad blocking everywhere,
     * EXCEPT the domains on this list.
     */ ["domains"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].array */ .ZP.array(zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string()),
    /**
     * If `AllowlistOption.Inverted` === true, the extension will use this list
     * to disable ad blocking for all sites but not these sites. In other words,
     * the extension will work ONLY on domains from this list.
     */ ["inverted-domains"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].array */ .ZP.array(zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string()),
    /**
     * Is allowlist list enabled or not.
     */ ["enabled"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean().optional(),
    /**
     * If this flag is true, the application will work ONLY with domains from
     * the 'domains' list, otherwise it will work everywhere EXCLUDING domains
     * from the list.
     */ ["inverted"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean().optional()
});


/***/ }),

/***/ 21496:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "a": () => (/* binding */ customFiltersConfigValidator)
/* harmony export */ });
/* unused harmony export CustomFilterOption */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
/**
 * Keys of options for custom filter in the configuration.
 */ var CustomFilterOption = /*#__PURE__*/ function(CustomFilterOption) {
    CustomFilterOption["CustomUrl"] = "customUrl";
    CustomFilterOption["Title"] = "title";
    CustomFilterOption["Trusted"] = "trusted";
    CustomFilterOption["Enabled"] = "enabled";
    return CustomFilterOption;
}({});
const customFiltersConfigValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].array */ .ZP.array(zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
         * The filter subscription URL from which the application retrieved
         * the rules when adding the filter and should retrieve the rules when
         * updating it.
         */ ["customUrl"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
         * Name of the filter.
         */ ["title"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string().optional(),
    /**
         * If this filter is not trusted - tsurlfilter will not execute JS rules
         * and will not apply header removal rules from this filter.
         * Otherwise, no restrictions.
         *
         * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#trusted-filters.
         */ ["trusted"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
         * Is filter enabled or not.
         */ ["enabled"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean()
}));


/***/ }),

/***/ 86410:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "d": () => (/* binding */ extensionSpecificSettingsConfigValidator)
/* harmony export */ });
/* unused harmony export ExtensionSpecificSettingsOption */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
/**
 * Extension specific settings configuration.
 */ var ExtensionSpecificSettingsOption = /*#__PURE__*/ function(ExtensionSpecificSettingsOption) {
    ExtensionSpecificSettingsOption["UseOptimizedFilters"] = "use-optimized-filters";
    ExtensionSpecificSettingsOption["CollectHitsCount"] = "collect-hits-count";
    ExtensionSpecificSettingsOption["ShowContextMenu"] = "show-context-menu";
    ExtensionSpecificSettingsOption["ShowInfoAboutAdguard"] = "show-info-about-adguard";
    ExtensionSpecificSettingsOption["ShowAppUpdatedInfo"] = "show-app-updated-info";
    ExtensionSpecificSettingsOption["HideRateAdguard"] = "hide-rate-adguard";
    ExtensionSpecificSettingsOption["UserRulesEditorWrap"] = "user-rules-editor-wrap";
    return ExtensionSpecificSettingsOption;
}({});
const extensionSpecificSettingsConfigValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * If the flag is set to true, the application uses the optimized versions
     * of filter lists — the lists which contain needed and popular rules.
     *
     * @see https://adguard.com/kb/general/ad-filtering/create-own-filters/#not_optimized-hint for details.
     */ ["use-optimized-filters"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * If the flag is set to true, the application will send anonymous
     * statistics about the use of ad filters, which will help us to improve and
     * optimize them: for example, to remove obsolete rules in order to reduce
     * the time it takes to apply the rules.
     *
     * @see https://adguard.com/kb/general/ad-filtering/tracking-filter-statistics/ for clarification.
     */ ["collect-hits-count"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Whether or not to add filtering options (add domain to allowlist,
     * enable or disable filtering) to the context menu (available by
     * right-clicking) in the browser.
     */ ["show-context-menu"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * If set to true - a banner will be displayed in the extensions
     * settings with information about AdGuard's system ad blocking app.
     */ ["show-info-about-adguard"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * If set to true - the extension will show app update notifications.
     */ ["show-app-updated-info"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * If set to true - the extension will hide the block about requesting
     * feedback with rating in the extension settings.
     */ ["hide-rate-adguard"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * If set to true - the extension will enable word wrap in the user rules
     * editor to display a window without horizontal scroll bars.
     */ ["user-rules-editor-wrap"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean()
});


/***/ }),

/***/ 98455:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "K": () => (/* binding */ filtersConfigValidator)
/* harmony export */ });
/* unused harmony export FiltersOption */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11615);
/* harmony import */ var _custom_filters__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21496);
/* harmony import */ var _user_filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58178);
/* harmony import */ var _allowlist__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(50463);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 



// AdGuard filters configuration
var FiltersOption = /*#__PURE__*/ function(FiltersOption) {
    FiltersOption["EnabledGroups"] = "enabled-groups";
    FiltersOption["EnabledFilters"] = "enabled-filters";
    FiltersOption["CustomFilters"] = "custom-filters";
    FiltersOption["UserFilter"] = "user-filter";
    FiltersOption["Allowlist"] = "allowlist";
    return FiltersOption;
}({});
const filtersConfigValidator = zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].object */ .ZP.object({
    /**
     * List of IDs of enabled filter groups.
     */ ["enabled-groups"]: zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].array */ .ZP.array(zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].number */ .ZP.number().int()),
    /**
     * List of IDs of enabled filters.
     */ ["enabled-filters"]: zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].array */ .ZP.array(zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].number */ .ZP.number().int()),
    /**
     * List of objects with information about custom filters.
     */ ["custom-filters"]: _custom_filters__WEBPACK_IMPORTED_MODULE_0__/* .customFiltersConfigValidator */ .a,
    /**
     * An object with concatenated user rules and their status - enabled or not.
     */ ["user-filter"]: _user_filter__WEBPACK_IMPORTED_MODULE_1__/* .userFilterValidator */ .u,
    /**
     * Object with the allowlist domains, the inverted allowlist domains and
     * which one applies.
     */ ["allowlist"]: _allowlist__WEBPACK_IMPORTED_MODULE_2__/* .allowlistValidator */ .c
});


/***/ }),

/***/ 14598:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "c": () => (/* binding */ generalSettingsConfigValidator)
/* harmony export */ });
/* unused harmony export GeneralSettingsOption */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11615);
/* harmony import */ var _common_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(45276);
/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(53186);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


// General settings configuration
var GeneralSettingsOption = /*#__PURE__*/ function(GeneralSettingsOption) {
    GeneralSettingsOption["AppLanguage"] = "app-language";
    GeneralSettingsOption["AllowAcceptableAds"] = "allow-acceptable-ads";
    GeneralSettingsOption["ShowBlockedAdsCount"] = "show-blocked-ads-count";
    GeneralSettingsOption["AutodetectFilters"] = "autodetect-filters";
    GeneralSettingsOption["SafebrowsingEnabled"] = "safebrowsing-enabled";
    GeneralSettingsOption["FiltersUpdatePeriod"] = "filters-update-period";
    GeneralSettingsOption["AppearanceTheme"] = "appearance-theme";
    return GeneralSettingsOption;
}({});
const generalSettingsConfigValidator = zod__WEBPACK_IMPORTED_MODULE_2__/* ["default"].object */ .ZP.object({
    /**
     * The two-letter code of the application language that is used to display
     * the translations in the user interface.
     */ ["app-language"]: zod__WEBPACK_IMPORTED_MODULE_2__/* ["default"].string */ .ZP.string().optional(),
    /**
     * This option allows for "Search advertising and self-promotion":
     * advertising that the user sees among search results when using online
     * search engines, as well as a kind of "first-party" advertising on sites
     * that promote that particular site or closely related sites, social
     * networks, and so on.
     *
     * @see https://adguard.com/kb/general/ad-filtering/search-ads/
     */ ["allow-acceptable-ads"]: zod__WEBPACK_IMPORTED_MODULE_2__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Whether or not to show the number of blocked ads on the extension icon.
     */ ["show-blocked-ads-count"]: zod__WEBPACK_IMPORTED_MODULE_2__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Should the extension automatically enable a language filter that matches
     * the top-level domain.
     */ ["autodetect-filters"]: zod__WEBPACK_IMPORTED_MODULE_2__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * This setting enables module that protects against malicious and phishing
     * sites by checking the url hash in a database of malicious or phishing
     * sites.
     *
     * @see https://adguard.com/kb/general/browsing-security/
     */ ["safebrowsing-enabled"]: zod__WEBPACK_IMPORTED_MODULE_2__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Time interval between filter updates.
     */ ["filters-update-period"]: zod__WEBPACK_IMPORTED_MODULE_2__/* ["default"].nativeEnum */ .ZP.nativeEnum(_common_constants__WEBPACK_IMPORTED_MODULE_0__/* .FiltersUpdateTime */ .OL),
    // TODO: Should be not optional?
    /**
     * Appearance theme of the application.
     */ ["appearance-theme"]: _settings__WEBPACK_IMPORTED_MODULE_1__/* .appearanceValidator.optional */ .i.optional()
});


/***/ }),

/***/ 59160:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _main__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3073);
/* harmony import */ var _general_settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14598);
/* harmony import */ var _extension_specific_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(86410);
/* harmony import */ var _custom_filters__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21496);
/* harmony import */ var _user_filter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(58178);
/* harmony import */ var _allowlist__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(50463);
/* harmony import */ var _filters__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(98455);
/* harmony import */ var _stealth__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91404);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 









/***/ }),

/***/ 3073:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony exports PROTOCOL_VERSION, RootOption, configValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(11615);
/* harmony import */ var _general_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14598);
/* harmony import */ var _extension_specific_settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(86410);
/* harmony import */ var _filters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(98455);
/* harmony import */ var _stealth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(91404);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 




// Root configuration
const PROTOCOL_VERSION = '2.0';
var RootOption = /*#__PURE__*/ function(RootOption) {
    RootOption["ProtocolVersion"] = "protocol-version";
    RootOption["GeneralSettings"] = "general-settings";
    RootOption["ExtensionSpecificSettings"] = "extension-specific-settings";
    RootOption["Filters"] = "filters";
    RootOption["Stealth"] = "stealth";
    return RootOption;
}({});
const configValidator = zod__WEBPACK_IMPORTED_MODULE_4__/* ["default"].object */ .ZP.object({
    /**
     * Describes the current version of the object. This is necessary to check
     * if we need to migrate from the old settings.
     */ ["protocol-version"]: zod__WEBPACK_IMPORTED_MODULE_4__/* ["default"].literal */ .ZP.literal(PROTOCOL_VERSION),
    /**
     * Contains general application settings: appearance theme, language, time
     * to check for updates to filters and some filtering options.
     */ ["general-settings"]: _general_settings__WEBPACK_IMPORTED_MODULE_0__/* .generalSettingsConfigValidator */ .c,
    /**
     * Contains some additional extension settings and UI settings.
     */ ["extension-specific-settings"]: _extension_specific_settings__WEBPACK_IMPORTED_MODULE_1__/* .extensionSpecificSettingsConfigValidator */ .d,
    /**
     * Contains all information about filters: regular, custom, user filter and
     * allowlist.
     */ ["filters"]: _filters__WEBPACK_IMPORTED_MODULE_2__/* .filtersConfigValidator */ .K,
    /**
     * Contains various secure browsing settings: cookie deletion time, privacy
     * headers, referrer hiding, and the ability to enable additional filters.
     */ ["stealth"]: _stealth__WEBPACK_IMPORTED_MODULE_3__/* .stealthConfigValidator.optional */ .O.optional()
});


/***/ }),

/***/ 91404:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "O": () => (/* binding */ stealthConfigValidator)
/* harmony export */ });
/* unused harmony export StealthOption */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
// Stealth configuration
var StealthOption = /*#__PURE__*/ function(StealthOption) {
    StealthOption["DisableStealthMode"] = "stealth-disable-stealth-mode";
    StealthOption["HideReferrer"] = "stealth-hide-referrer";
    StealthOption["HideSearchQueries"] = "stealth-hide-search-queries";
    StealthOption["SendDoNotTrack"] = "stealth-send-do-not-track";
    StealthOption["BlockWebRTC"] = "stealth-block-webrtc";
    StealthOption["RemoveXClientData"] = "stealth-remove-x-client";
    StealthOption["SelfDestructThirdPartyCookies"] = "stealth-block-third-party-cookies";
    StealthOption["SelfDestructThirdPartyCookiesTime"] = "stealth-block-third-party-cookies-time";
    StealthOption["SelfDestructFirstPartyCookies"] = "stealth-block-first-party-cookies";
    StealthOption["SelfDestructFirstPartyCookiesTime"] = "stealth-block-first-party-cookies-time";
    StealthOption["BlockKnownTrackers"] = "block-known-trackers";
    StealthOption["StripTrackingParams"] = "strip-tracking-parameters";
    return StealthOption;
}({});
const stealthConfigValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Whether Tracking protection (formerly Stealth mode) is disabled or not.
     */ ["stealth-disable-stealth-mode"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Should the application hide the origin referrer in third-party requests
     * by replacing the referrer url with the url from the requested url.
     */ ["stealth-hide-referrer"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Should the application hide the original referrer from the search page
     * containing the search query in third-party queries, replacing
     * the referrer url with the url from the requested url.
     */ ["stealth-hide-search-queries"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Includes HTTP headers 'DNT' and 'Sec-GPC' in all requests.
     *
     * @see https://www.wikiwand.com/en/Do_Not_Track
     * @see https://globalprivacycontrol.org
     */ ["stealth-send-do-not-track"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Blocks the possibility of leaking your IP address through WebRTC, even if
     * you use a proxy server or VPN.
     */ ["stealth-block-webrtc"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * For Google Chrome, it removes the 'X-Client-Data' header from
     * the requests, which contains information about the browser version
     * and modifications.
     */ ["stealth-remove-x-client"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Whether or not the application should set a fixed lifetime from
     * `StealthOption.SelfDestructThirdPartyCookiesTime` for third-party
     * cookies.
     */ ["stealth-block-third-party-cookies"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Time in milliseconds to delete third-party cookies.
     */ ["stealth-block-third-party-cookies-time"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number(),
    /**
     * Whether or not the application should set a fixed lifetime from
     * `StealthOption.SelfDestructFirstPartyCookiesTime` for first-party
     * cookies.
     */ ["stealth-block-first-party-cookies"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Time in milliseconds to delete first-party cookies.
     */ ["stealth-block-first-party-cookies-time"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number(),
    /**
     * If true application will enable AdGuard Tracking Protection filter
     * {@link AntiBannerFiltersId.TrackingFilterId}.
     */ ["block-known-trackers"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean().optional(),
    /**
     * If true application will enable AdGuard URL Tracking filter
     * {@link AntiBannerFiltersId.UrlTrackingFilterId}.
     */ ["strip-tracking-parameters"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean()
});


/***/ }),

/***/ 58178:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "u": () => (/* binding */ userFilterValidator)
/* harmony export */ });
/* unused harmony export UserFilterOption */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
// User filter configuration
var UserFilterOption = /*#__PURE__*/ function(UserFilterOption) {
    UserFilterOption["Rules"] = "rules";
    UserFilterOption["DisabledRules"] = "disabled-rules";
    UserFilterOption["Enabled"] = "enabled";
    return UserFilterOption;
}({});
const userFilterValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * User rules concatenated with '\n'.
     */ ["rules"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * In previous versions, rules could be marked as disabled.
     * Currently not in use.
     *
     * @deprecated
     */ ["disabled-rules"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * Is enabled user rules or not.
     */ ["enabled"]: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean().optional()
});


/***/ }),

/***/ 69461:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony exports customFilterMetadataValidator, customFilterMetadataStorageDataValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11615);
/* harmony import */ var _metadata_filter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(58555);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

const customFilterMetadataValidator = _metadata_filter__WEBPACK_IMPORTED_MODULE_0__/* .baseMetadataValidator.merge */ .S.merge(zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].object */ .ZP.object({
    /**
         * The filter subscription URL from which the application retrieved
         * the rules when adding the filter and should retrieve the rules when
         * updating it.
         */ customUrl: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].string */ .ZP.string(),
    /**
         * If this filter is not trusted - tsurlfilter will not execute JS rules
         * and will not apply header removal rules from this filter.
         * Otherwise, no restrictions.
         */ trusted: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].boolean */ .ZP.boolean(),
    /**
         * When the filter was last updated in milliseconds since the start of
         * the UNIX epoch.
         */ timeUpdated: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].number */ .ZP.number(),
    /**
         * Contains MD5 checksum for the filter content.
         */ checksum: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].string */ .ZP.string().or(zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"]["null"] */ .ZP["null"]())
}));
const customFilterMetadataStorageDataValidator = customFilterMetadataValidator.array();


/***/ }),

/***/ 64106:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _custom_filter_metadata__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69461);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ // Custom filter metadata schema entry point
// Custom filter metadata validators and types



/***/ }),

/***/ 13019:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony exports filterStateDataValidator, filterStateStorageDataValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11615);
/* harmony import */ var _preprocessor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(35814);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

/**
 * Runtime validator for persistent filter state data.
 */ const filterStateDataValidator = zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].object */ .ZP.object({
    /**
     * Is filter enabled or not.
     */ enabled: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Is filter rules loaded into browser storage or not.
     *
     * TODO: Check if it can be deleted, because we add all filters to
     * the browser storage and this field is always true.
     */ installed: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Is filter loaded.
     *
     * TODO: Check if it can be deleted.
     */ loaded: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].boolean */ .ZP.boolean()
});
/**
 * Runtime validator for persistent key value storage of filter state data.
 *
 * Key is filter metadata id.
 * Value is {@link FilterStateData}.
 */ const filterStateStorageDataValidator = zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].record */ .ZP.record(_preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.numberValidator */ .k.numberValidator, filterStateDataValidator);


/***/ }),

/***/ 59497:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _filter_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13019);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ // Filter state schema entry point
// Filter state validators and types



/***/ }),

/***/ 8069:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony exports filterVersionDataValidator, filterVersionStorageDataValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11615);
/* harmony import */ var _preprocessor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(35814);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

/**
 * Runtime validator for persistent filter version data.
 */ const filterVersionDataValidator = zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].object */ .ZP.object({
    /**
     * Version of filter. Usually consists of 4 parts: 1.2.3.4.
     */ version: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].string */ .ZP.string(),
    /**
     * The time in millisecond of the last forced update: if the user clicks
     * the forced update check from the user interface or if the user enabled
     * the filter or group.
     */ lastCheckTime: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].number */ .ZP.number(),
    /**
     * The time in millisecond of the last check by the scheduler: every
     * {@link FilterUpdateService.CHECK_PERIOD_MS period} the time of the last
     * check will be overwritten by the scheduler.
     */ lastScheduledCheckTime: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].number */ .ZP.number(),
    /**
     * The time in millisecond of the last update filter from remote resources.
     */ lastUpdateTime: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].number */ .ZP.number(),
    /**
     * The time in seconds during which the filter content remains fresh
     * and does not need to be updated. Used to auto-renew filters if the user
     * has not selected a custom update period for filters.
     */ expires: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].number */ .ZP.number(),
    /**
     * Diff-Path - Path to the patches if exists.
     *
     * @see {@link https://github.com/ameshkov/diffupdates/tree/b81243c50d23e0a8be0fe95a80d55abd00b08981?tab=readme-ov-file#-diff-path | Specs}.
     */ diffPath: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].string */ .ZP.string().optional(),
    /**
     * Flag that indicates that the filter could not be updated by patches
     * and should wait for the full update.
     *
     * @see {@link https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2717}
     */ shouldWaitFullUpdate: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].boolean */ .ZP.boolean().optional()
});
/**
 * Runtime validator for persistent key value storage of filter version data.
 *
 * Key is filter metadata id.
 * Value is {@link FilterVersionData}.
 */ const filterVersionStorageDataValidator = zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].record */ .ZP.record(_preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.numberValidator */ .k.numberValidator, filterVersionDataValidator);


/***/ }),

/***/ 36117:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _filter_version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8069);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ // Filter version schema entry point
// Filter version validators and types



/***/ }),

/***/ 40679:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony exports groupStateDataValidator, groupStateStorageDataValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11615);
/* harmony import */ var _preprocessor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(35814);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

/**
 * Runtime validator for persistent group state data.
 */ const groupStateDataValidator = zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].object */ .ZP.object({
    /**
     * Is group enabled or not.
     */ enabled: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].boolean */ .ZP.boolean(),
    /**
     * Whether the group has ever been switched. Can be affected
     * programmatically, e.g. After importing settings.
     */ touched: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].boolean */ .ZP.boolean()
});
/**
 * Runtime validator for persistent key value storage of group state data.
 *
 * Key is group metadata id.
 * Value is {@link GroupStateData}.
 */ const groupStateStorageDataValidator = zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].record */ .ZP.record(_preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.numberValidator */ .k.numberValidator, groupStateDataValidator);


/***/ }),

/***/ 25015:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _group_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40679);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ // Group state schema entry point
// Group state validators and types



/***/ }),

/***/ 5185:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony exports hitStatsValidator, filtersVersionsValidator, hitStatsStorageDataValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const filterRulesHitsValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].record */ .ZP.record(/**
     * Index of rule.
     */ zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(), /**
     * The number of matches of this rule.
     */ zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number());
const filterHitsValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].record */ .ZP.record(/**
     * Filter's id.
     */ zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(), filterRulesHitsValidator.optional());
const hitStatsValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Contains an object with filter IDs as keys and their
     * {@link filterRulesHitsValidator} as values.
     */ filters: filterHitsValidator.optional()
}).strict();
const filtersVersionsValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].record */ .ZP.record(/**
     * Filter's id.
     */ zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(), /**
     * Version of the filter.
     */ zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string());
const hitStatsStorageDataValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * The number of hits in relation to the hit rule.
     */ stats: hitStatsValidator.optional(),
    /**
     * Contains an object with filter IDs as keys and their versions as values.
     */ versions: filtersVersionsValidator.optional(),
    /**
     * The total number of hits with no link to the rules.
     */ totalHits: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number().optional()
}).strict();


/***/ }),

/***/ 2127:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _hit_stats__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5185);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ // Hit stats schema entry point
// hit stats validators and types



/***/ }),

/***/ 90518:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "t": () => (/* binding */ regularFilterI18nMetadataValidator)
/* harmony export */ });
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const filterInfoValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Description of the filter.
     */ description: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * Name of the filter.
     */ name: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string()
});
const regularFilterI18nMetadataValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].record */ .ZP.record(/**
     * Locale code.
     */ zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(), filterInfoValidator);


/***/ }),

/***/ 50045:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "$": () => (/* binding */ groupI18nMetadataValidator)
/* harmony export */ });
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const groupName = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * The name of the filter group.
     */ name: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string()
});
const groupI18nMetadataValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].record */ .ZP.record(/**
     * Locale code.
     */ zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(), groupName);


/***/ }),

/***/ 40160:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony exports filtersI18nRecordValidator, groupsI18nRecordValidator, tagsI18nRecordValidator, i18nMetadataValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(11615);
/* harmony import */ var _preprocessor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(35814);
/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(90518);
/* harmony import */ var _tag__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(94190);
/* harmony import */ var _group__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(50045);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 




const filtersI18nRecordValidator = zod__WEBPACK_IMPORTED_MODULE_4__/* ["default"].record */ .ZP.record(_preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.numberValidator */ .k.numberValidator, _filter__WEBPACK_IMPORTED_MODULE_1__/* .regularFilterI18nMetadataValidator */ .t);
const groupsI18nRecordValidator = zod__WEBPACK_IMPORTED_MODULE_4__/* ["default"].record */ .ZP.record(_preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.numberValidator */ .k.numberValidator, _group__WEBPACK_IMPORTED_MODULE_3__/* .groupI18nMetadataValidator */ .$);
const tagsI18nRecordValidator = zod__WEBPACK_IMPORTED_MODULE_4__/* ["default"].record */ .ZP.record(_preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.numberValidator */ .k.numberValidator, _tag__WEBPACK_IMPORTED_MODULE_2__/* .tagI18nMetadataValidator */ .L);
const i18nMetadataValidator = zod__WEBPACK_IMPORTED_MODULE_4__/* ["default"].object */ .ZP.object({
    /**
     * Item of {@link FiltersI18n}.
     */ filters: filtersI18nRecordValidator,
    /**
     * Item of {@link GroupsI18n}.
     */ groups: groupsI18nRecordValidator,
    /**
     * Item of {@link TagsI18n}.
     */ tags: tagsI18nRecordValidator
});


/***/ }),

/***/ 54531:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _i18n_metadata__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40160);
/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(90518);
/* harmony import */ var _tag__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(94190);
/* harmony import */ var _group__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(50045);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 





/***/ }),

/***/ 94190:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "L": () => (/* binding */ tagI18nMetadataValidator)
/* harmony export */ });
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const tagInfoValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Description of the tag.
     */ description: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * Name of the tag.
     */ name: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string()
});
const tagI18nMetadataValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].record */ .ZP.record(/**
     * Locale code.
     */ zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(), tagInfoValidator);


/***/ }),

/***/ 73204:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "qY": () => (/* reexport safe */ _settings__WEBPACK_IMPORTED_MODULE_1__.qY)
/* harmony export */ });
/* harmony import */ var _configuration__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59160);
/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(53186);
/* harmony import */ var _preprocessor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(35814);
/* harmony import */ var _metadata__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49512);
/* harmony import */ var _i18n_metadata__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(54531);
/* harmony import */ var _filter_version__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(36117);
/* harmony import */ var _filter_state__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(59497);
/* harmony import */ var _group_state__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(25015);
/* harmony import */ var _trusted_domains__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(58774);
/* harmony import */ var _page_stats__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(69136);
/* harmony import */ var _hit_stats__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(2127);
/* harmony import */ var _custom_filter_metadata__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(64106);
/* harmony import */ var _local_script_rules__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(30002);
/* harmony import */ var _notification__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(87758);
/* harmony import */ var _safebrowsing__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(38936);
/* harmony import */ var _annoyances_consent__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(28111);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

















/***/ }),

/***/ 30002:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _local_script_rules__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61405);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


/***/ }),

/***/ 61405:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony export localScriptRulesValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const localScriptRulesValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Contains a comment describing the purpose of the local script rules file.
     */ comment: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * JS rules from all of our filters are pre-assembled into this object to be
     * checked in Firefox AMO to see if they can be executed.
     */ rules: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].record */ .ZP.record(/**
         * Key is the cosmetic rule body.
         */ zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(), /**
         * Value is the array of cosmetic rule scope (on which domains it should be applied).
         * If multiple rules are using the same body, their scopes are pushed to this array,
         * if they are not already there.
         */ zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
        /**
             * The array of domains on which the rule can be executed.
             */ permittedDomains: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].array */ .ZP.array(zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string()),
        /**
             * The array of domains on which the rule cannot be executed.
             */ restrictedDomains: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].array */ .ZP.array(zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string())
    }).array())
}).strict();


/***/ }),

/***/ 58555:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "S": () => (/* binding */ baseMetadataValidator),
/* harmony export */   "v": () => (/* binding */ regularFilterMetadataValidator)
/* harmony export */ });
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const baseMetadataValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Description of the filter.
     */ description: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * Display number is used to arrange the filters in the layout.
     */ displayNumber: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number(),
    /**
     * The time in seconds during which the filter content remains fresh
     * and does not need to be updated. Used to auto-renew filters if the user
     * has not selected a custom update period for filters.
     */ expires: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number(),
    /**
     * Id of the filter.
     */ filterId: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number(),
    /**
     * Id of the filter's group.
     */ groupId: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number(),
    /**
     * URL address of the filter's homepage.
     */ homepage: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * Name of the filter.
     */ name: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * Filter tags are used to group filters by different characteristics:
     * language, target, platform, etc.
     */ tags: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number().array(),
    /**
     * Version filter. Supports up to {@link Version.MAX_LENGTH} parts per
     * version.
     */ version: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * Diff-Path - Path to the patches if exists.
     *
     * @see {@link https://github.com/ameshkov/diffupdates/tree/b81243c50d23e0a8be0fe95a80d55abd00b08981?tab=readme-ov-file#-diff-path | Specs}.
     */ diffPath: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string().optional()
});
const regularFilterMetadataValidator = baseMetadataValidator.merge(zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
         * Two-letter language codes that are associated with the filter.
         */ languages: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string().array(),
    /**
         * Timestamp of adding filters in MS.
         * String format, since these values are retrieved from the backend.
         */ timeAdded: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
         * When the filter was last updated in milliseconds since the start of
         * the UNIX epoch.
         * String format, since these values are retrieved from the backend.
         */ timeUpdated: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
         * The filter subscription URL from which the application retrieved
         * the rules when adding the filter and should retrieve the rules when
         * updating it.
         */ subscriptionUrl: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string()
}));


/***/ }),

/***/ 17502:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "W": () => (/* binding */ groupMetadataValidator)
/* harmony export */ });
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const groupMetadataValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Display number is used to arrange the groups in the layout.
     */ displayNumber: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number(),
    /**
     * Id of the group.
     */ groupId: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number(),
    /**
     * Name of the group.
     */ groupName: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string()
});


/***/ }),

/***/ 49512:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _metadata__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19669);
/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58555);
/* harmony import */ var _tag__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73954);
/* harmony import */ var _group__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(17502);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 





/***/ }),

/***/ 19669:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony export metadataValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11615);
/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(58555);
/* harmony import */ var _tag__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(73954);
/* harmony import */ var _group__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17502);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 



const metadataValidator = zod__WEBPACK_IMPORTED_MODULE_3__/* ["default"].object */ .ZP.object({
    /**
     * Array of {@link RegularFilterMetadata}.
     */ filters: _filter__WEBPACK_IMPORTED_MODULE_0__/* .regularFilterMetadataValidator.array */ .v.array(),
    /**
     * Array of {@link GroupMetadata}.
     */ groups: _group__WEBPACK_IMPORTED_MODULE_2__/* .groupMetadataValidator.array */ .W.array(),
    /**
     * Array of {@link TagMetadata}.
     */ tags: _tag__WEBPACK_IMPORTED_MODULE_1__/* .tagMetadataValidator.array */ .Z.array()
});


/***/ }),

/***/ 73954:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ tagMetadataValidator)
/* harmony export */ });
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const tagMetadataValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Id of the tag.
     */ tagId: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number(),
    /**
     * Tag value, e.g., `lang:en`, `recommended`.
     */ keyword: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * Description of the tag.
     */ description: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string().optional(),
    /**
     * Name of the tag.
     */ name: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string().optional()
});


/***/ }),

/***/ 87758:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _notification_text_record__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(62401);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


/***/ }),

/***/ 62401:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony export notificationTextRecordValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const notificationTextRecordValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Notification title.
     */ title: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * Notification description.
     */ desc: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string().optional(),
    /**
     * Text for the notification button.
     */ btn: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string()
}).strict();


/***/ }),

/***/ 69136:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _page_stats__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8271);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ // Page stats schema entry point
// page stats validators and types



/***/ }),

/***/ 8271:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony exports pageStatsDataItemValidator, pageStatsDataValidator, pageStatsValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
/**
 * Describes the relationship between the number of blocked requests and
 * the name of the group (similar to the tag).
 */ const pageStatsDataItemValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].record */ .ZP.record(zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(), zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number());
const pageStatsDataValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Blocked requests grouped by hours.
     */ hours: pageStatsDataItemValidator.array(),
    /**
     * Blocked requests grouped by days.
     */ days: pageStatsDataItemValidator.array(),
    /**
     * Blocked requests grouped by months.
     */ months: pageStatsDataItemValidator.array(),
    /**
     * The time stamp of the last update. In milliseconds.
     */ updated: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number()
});
const pageStatsValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Total blocked requests.
     */ totalBlocked: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number().optional(),
    /**
     * Blocked requests grouped by time.
     */ data: pageStatsDataValidator.optional()
});


/***/ }),

/***/ 35814:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "k": () => (/* binding */ SchemaPreprocessor)
/* harmony export */ });
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}

/**
 * In some cases we want to preprocessing input before validation
 * For example, cast loaded filter metadata item id field from string to number before validation:
 *
 * { filterId: "1", ... } -> { filterId: 1, ... }.
 */ class SchemaPreprocessor {
    /**
     * If {@link value} is string, cast it to number, else returns original value.
     *
     * @param value Preprocessed value.
     * @returns Number value, if string passed, else returns original value.
     */ static castStringToNumber(value) {
        if (typeof value === 'string') {
            return Number(JSON.parse(value));
        }
        return value;
    }
    /**
     * If {@link value} is string, cast it to boolean, else returns original value.
     *
     * @param value Preprocessed value.
     * @returns Boolean value, if string passed, else returns original value.
     */ static castStringToBoolean(value) {
        if (typeof value === 'string') {
            try {
                return Boolean(JSON.parse(value));
            } catch (e) {
                return value;
            }
        }
        return value;
    }
}
/**
     * Runtime {@link zod} validator with {@link SchemaPreprocessor.castStringToBoolean} preprocessor.
     */ _define_property(SchemaPreprocessor, "booleanValidator", zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].preprocess */ .ZP.preprocess(SchemaPreprocessor.castStringToBoolean, zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].boolean */ .ZP.boolean()));
/**
     * Runtime {@link zod} validator with {@link SchemaPreprocessor.castStringToNumber} preprocessor.
     */ _define_property(SchemaPreprocessor, "numberValidator", zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].preprocess */ .ZP.preprocess(SchemaPreprocessor.castStringToNumber, zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number()));


/***/ }),

/***/ 38936:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _safebrowsing__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81775);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


/***/ }),

/***/ 81775:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony exports safebrowsingCacheDataValidator, safebrowsingStorageDataValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
/**
 * Safebrowsing cache data schema validator.
 */ const safebrowsingCacheDataValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Name of the safebrowsing list.
     */ list: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * Record expiration time in milliseconds.
     * Optional, because it is not defined for safebrowsing allowlist.
     */ expires: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number().optional()
}).strict();
/**
 * Safebrowsing persisted storage data schema validator.
 */ const safebrowsingStorageDataValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * Resource url hash.
     */ key: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * Cache data.
     */ value: safebrowsingCacheDataValidator
}).strict().array();


/***/ }),

/***/ 53186:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "i": () => (/* reexport safe */ _main__WEBPACK_IMPORTED_MODULE_0__.i),
/* harmony export */   "qY": () => (/* reexport safe */ _main__WEBPACK_IMPORTED_MODULE_0__.qY)
/* harmony export */ });
/* harmony import */ var _main__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(79686);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


/***/ }),

/***/ 79686:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "i": () => (/* binding */ appearanceValidator),
/* harmony export */   "qY": () => (/* binding */ SettingOption)
/* harmony export */ });
/* unused harmony export settingsValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11615);
/* harmony import */ var _preprocessor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(35814);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

var SettingOption = /*#__PURE__*/ function(SettingOption) {
    // General settings.
    SettingOption["AppearanceTheme"] = "appearance-theme";
    SettingOption["DisableShowPageStats"] = "disable-show-page-statistic";
    SettingOption["DisableDetectFilters"] = "detect-filters-disabled";
    SettingOption["DisableSafebrowsing"] = "safebrowsing-disabled";
    SettingOption["FiltersUpdatePeriod"] = "filters-update-period";
    // Is filtering disabled or not.
    SettingOption["DisableFiltering"] = "adguard-disabled";
    // Extension specific settings.
    SettingOption["UseOptimizedFilters"] = "use-optimized-filters";
    SettingOption["DisableCollectHits"] = "hits-count-disabled";
    SettingOption["DisableShowContextMenu"] = "context-menu-disabled";
    // Flag used to show link to comparison of desktop and browser extension versions.
    SettingOption["DisableShowAdguardPromoInfo"] = "show-info-about-adguard-disabled";
    SettingOption["DisableShowAppUpdatedNotification"] = "show-app-updated-disabled";
    SettingOption["HideRateBlock"] = "hide-rate-block";
    SettingOption["UserRulesEditorWrap"] = "user-rules-editor-wrap";
    // Allowlist section.
    SettingOption["AllowlistDomains"] = "allowlist-domains";
    SettingOption["InvertedAllowlistDomains"] = "block-list-domains";
    SettingOption["AllowlistEnabled"] = "allowlist-enabled";
    SettingOption["DefaultAllowlistMode"] = "default-allowlist-mode";
    // Tracking protection (formerly Stealth mode).
    SettingOption["DisableStealthMode"] = "stealth-disable-stealth-mode";
    SettingOption["HideReferrer"] = "stealth-hide-referrer";
    SettingOption["HideSearchQueries"] = "stealth-hide-search-queries";
    SettingOption["SendDoNotTrack"] = "stealth-send-do-not-track";
    SettingOption["RemoveXClientData"] = "stealth-remove-x-client";
    SettingOption["BlockWebRTC"] = "stealth-block-webrtc";
    SettingOption["SelfDestructThirdPartyCookies"] = "stealth-block-third-party-cookies";
    SettingOption["SelfDestructThirdPartyCookiesTime"] = "stealth-block-third-party-cookies-time";
    SettingOption["SelfDestructFirstPartyCookies"] = "stealth-block-first-party-cookies";
    SettingOption["SelfDestructFirstPartyCookiesTime"] = "stealth-block-first-party-cookies-time";
    // Filters' statuses and states.
    SettingOption["FiltersState"] = "filters-state";
    SettingOption["FiltersVersion"] = "filters-version";
    SettingOption["GroupsState"] = "groups-state";
    SettingOption["UserFilterEnabled"] = "user-filter-enabled";
    // Filters metadata.
    SettingOption["Metadata"] = "filters-metadata";
    SettingOption["I18nMetadata"] = "filters-i18n-metadata";
    SettingOption["CustomFilters"] = "custom-filters";
    return SettingOption;
}({});
const appearanceValidator = zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"]["enum"] */ .ZP["enum"]([
    'system',
    'dark',
    'light'
]);
// Setting options may be stringified, use preprocessors for correct type casting
const settingsValidator = zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].object */ .ZP.object({
    // ----- General settings section -----
    /**
     * See {@link GeneralSettingsConfig[GeneralSettingsOption.AppearanceTheme]}.
     */ ["appearance-theme"]: appearanceValidator,
    /**
     * See {@link GeneralSettingsConfig[GeneralSettingsOption.ShowBlockedAdsCount]}.
     */ ["disable-show-page-statistic"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link GeneralSettingsConfig[GeneralSettingsOption.AutodetectFilters]}.
     */ ["detect-filters-disabled"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link GeneralSettingsConfig[GeneralSettingsOption.SafebrowsingEnabled]}.
     */ ["safebrowsing-disabled"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link GeneralSettingsConfig[GeneralSettingsOption.FiltersUpdatePeriod]}.
     */ ["filters-update-period"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.numberValidator */ .k.numberValidator,
    // ----- General settings section -----
    // ----- Extension specific settings section -----
    /**
     * See {@link ExtensionSpecificSettingsConfig[ExtensionSpecificSettingsOption.UseOptimizedFilters]}.
     */ ["use-optimized-filters"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link ExtensionSpecificSettingsConfig[ExtensionSpecificSettingsOption.CollectHitsCount]}.
     */ ["hits-count-disabled"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link ExtensionSpecificSettingsConfig[ExtensionSpecificSettingsOption.ShowContextMenu]}.
     */ ["context-menu-disabled"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link ExtensionSpecificSettingsConfig[ExtensionSpecificSettingsOption.ShowInfoAboutAdguard]}.
     */ ["show-info-about-adguard-disabled"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link ExtensionSpecificSettingsConfig[ExtensionSpecificSettingsOption.ShowAppUpdatedInfo]}.
     */ ["show-app-updated-disabled"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link ExtensionSpecificSettingsConfig[ExtensionSpecificSettingsOption.HideRateAdguard]}.
     */ ["hide-rate-block"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link ExtensionSpecificSettingsConfig[ExtensionSpecificSettingsOption.UserRulesEditorWrap]}.
     */ ["user-rules-editor-wrap"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    // ----- Extension specific settings section -----
    // ----- Allowlist section -----
    /**
     * See {@link AllowlistConfig[AllowlistOption.Domains]}.
     */ ["allowlist-domains"]: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].string */ .ZP.string(),
    /**
     * See {@link AllowlistConfig[AllowlistOption.InvertedDomains]}.
     */ ["block-list-domains"]: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].string */ .ZP.string(),
    /**
     * See {@link AllowlistConfig[AllowlistOption.Enabled]}.
     */ ["allowlist-enabled"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link AllowlistConfig[AllowlistOption.Inverted]}.
     */ ["default-allowlist-mode"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    // ----- Allowlist section -----
    // ----- Stealth section -----
    /**
     * See {@link StealthConfig[StealthOption.DisableStealthMode]}.
     */ ["stealth-disable-stealth-mode"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link StealthConfig[StealthOption.HideReferrer]}.
     */ ["stealth-hide-referrer"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link StealthConfig[StealthOption.HideSearchQueries]}.
     */ ["stealth-hide-search-queries"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link StealthConfig[StealthOption.SendDoNotTrack]}.
     */ ["stealth-send-do-not-track"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link StealthConfig[StealthOption.BlockWebRTC]}.
     */ ["stealth-block-webrtc"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link StealthConfig[StealthOption.RemoveXClientData]}.
     */ ["stealth-remove-x-client"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link StealthConfig[StealthOption.SelfDestructThirdPartyCookies]}.
     */ ["stealth-block-third-party-cookies"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link StealthConfig[StealthOption.SelfDestructThirdPartyCookiesTime]}.
     */ ["stealth-block-third-party-cookies-time"]: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].number */ .ZP.number(),
    /**
     * See {@link StealthConfig[StealthOption.SelfDestructFirstPartyCookies]}.
     */ ["stealth-block-first-party-cookies"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link StealthConfig[StealthOption.SelfDestructFirstPartyCookiesTime]}.
     */ ["stealth-block-first-party-cookies-time"]: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].number */ .ZP.number(),
    // ----- Stealth section -----
    // ----- Statuses section -----
    /**
     * See {@link UserFilterConfig[UserFilterOption.Enabled]}.
     */ ["user-filter-enabled"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator,
    /**
     * See {@link FilterStateStorageData}.
     */ ["filters-state"]: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].string */ .ZP.string().optional(),
    /**
     * See {@link FilterVersionStorageData}.
     */ ["filters-version"]: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].string */ .ZP.string().optional(),
    /**
     * See {@link GroupStateStorageData}.
     */ ["groups-state"]: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].string */ .ZP.string().optional(),
    // ----- Statuses section -----
    // ----- Metadata section -----
    /**
     * See {@link Metadata}.
     */ ["filters-metadata"]: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].string */ .ZP.string().optional(),
    /**
     * See {@link I18nMetadata}.
     */ ["filters-i18n-metadata"]: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].string */ .ZP.string().optional(),
    /**
     * See {@link CustomFilterMetadataStorageData}.
     */ ["custom-filters"]: zod__WEBPACK_IMPORTED_MODULE_1__/* ["default"].string */ .ZP.string().optional(),
    // ----- Metadata section -----
    /**
     * Is filtering enabled or not. Is needed for fast toggling filtering
     * without reload entire extension.
     */ ["adguard-disabled"]: _preprocessor__WEBPACK_IMPORTED_MODULE_0__/* .SchemaPreprocessor.booleanValidator */ .k.booleanValidator
});


/***/ }),

/***/ 58774:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony import */ var _trusted_domains__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22398);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


/***/ }),

/***/ 22398:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony export trustedDomainDataValidator */
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11615);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
/**
 * Runtime validator for persistent trusted domains data.
 */ const trustedDomainDataValidator = zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].object */ .ZP.object({
    /**
     * String domain which was excluded from filtering.
     */ domain: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].string */ .ZP.string(),
    /**
     * For what time domain was excluded in milliseconds.
     */ expires: zod__WEBPACK_IMPORTED_MODULE_0__/* ["default"].number */ .ZP.number()
});


/***/ }),

/***/ 45276:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Bx": () => (/* binding */ RECOMMENDED_TAG_ID),
/* harmony export */   "HB": () => (/* binding */ BACKGROUND_TAB_ID),
/* harmony export */   "HP": () => (/* binding */ TRUSTED_TAG_KEYWORD),
/* harmony export */   "K4": () => (/* binding */ NEWLINE_CHAR_UNIX),
/* harmony export */   "OL": () => (/* binding */ FiltersUpdateTime),
/* harmony export */   "XS": () => (/* binding */ WASTE_CHARACTERS),
/* harmony export */   "cz": () => (/* binding */ TOTAL_BLOCKED_STATS_GROUP_ID),
/* harmony export */   "ih": () => (/* binding */ CUSTOM_FILTERS_START_ID),
/* harmony export */   "m6": () => (/* binding */ AntiBannerFiltersId),
/* harmony export */   "nn": () => (/* binding */ SCROLLBAR_WIDTH),
/* harmony export */   "r_": () => (/* binding */ AntibannerGroupsId),
/* harmony export */   "uq": () => (/* binding */ NotifierType),
/* harmony export */   "xN": () => (/* binding */ NEWLINE_CHAR_REGEX),
/* harmony export */   "zN": () => (/* binding */ TRUSTED_TAG_ID),
/* harmony export */   "zb": () => (/* binding */ NavigationTag)
/* harmony export */ });
/* unused harmony exports APP_SCHEMA_VERSION, CLIENT_ID_KEY, APP_VERSION_KEY, SCHEMA_VERSION_KEY, ADGUARD_SETTINGS_KEY, PAGE_STATISTIC_KEY, TRUSTED_DOCUMENTS_CACHE_KEY, SB_LRU_CACHE_KEY, SB_SUSPENDED_CACHE_KEY, VIEWED_NOTIFICATIONS_KEY, LAST_NOTIFICATION_TIME_KEY, FILTERING_LOG_WINDOW_STATE, HIT_STATISTIC_KEY, ANNOYANCES_CONSENT_KEY, RULES_LIMITS_KEY, KEEP_ALIVE_PORT_NAME, CUSTOM_FILTERS_GROUP_DISPLAY_NUMBER, OPTIONS_PAGE, FILTER_LIST_EXTENSION, EXTENSION_INITIALIZED_EVENT, emptyPreprocessedFilterList */
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ /**
 * Current version of app storage data schema.
 *
 * Schema version is used on extension version update.
 *
 * Note: Do not to be confused with the protocol version of the imported config.
 */ const APP_SCHEMA_VERSION = 10;
const CLIENT_ID_KEY = 'client-id';
const APP_VERSION_KEY = 'app-version';
const SCHEMA_VERSION_KEY = 'schema-version';
const ADGUARD_SETTINGS_KEY = 'adguard-settings';
const PAGE_STATISTIC_KEY = 'page-statistic';
const TRUSTED_DOCUMENTS_CACHE_KEY = 'trusted-documents';
const SB_LRU_CACHE_KEY = 'sb-lru-cache';
const SB_SUSPENDED_CACHE_KEY = 'safebrowsing-suspended-from';
const VIEWED_NOTIFICATIONS_KEY = 'viewed-notifications';
const LAST_NOTIFICATION_TIME_KEY = 'viewed-notification-time';
const FILTERING_LOG_WINDOW_STATE = 'filtering-log-window-state';
const HIT_STATISTIC_KEY = 'filters-hit-count';
const ANNOYANCES_CONSENT_KEY = 'annoyances-consent';
const RULES_LIMITS_KEY = 'rules-limits';
// Filter ids used in the code on the background page and filtering log page
var AntiBannerFiltersId = /*#__PURE__*/ function(AntiBannerFiltersId) {
    AntiBannerFiltersId[AntiBannerFiltersId["StealthModeFilterId"] = -1] = "StealthModeFilterId";
    AntiBannerFiltersId[AntiBannerFiltersId["UserFilterId"] = 0] = "UserFilterId";
    AntiBannerFiltersId[AntiBannerFiltersId["EnglishFilterId"] = 2] = "EnglishFilterId";
    AntiBannerFiltersId[AntiBannerFiltersId["TrackingFilterId"] = 3] = "TrackingFilterId";
    AntiBannerFiltersId[AntiBannerFiltersId["SocialFilterId"] = 4] = "SocialFilterId";
    AntiBannerFiltersId[AntiBannerFiltersId["SearchAndSelfPromoFilterId"] = 10] = "SearchAndSelfPromoFilterId";
    AntiBannerFiltersId[AntiBannerFiltersId["AnnoyancesCombinedFilterId"] = 14] = "AnnoyancesCombinedFilterId";
    AntiBannerFiltersId[AntiBannerFiltersId["UrlTrackingFilterId"] = 17] = "UrlTrackingFilterId";
    AntiBannerFiltersId[AntiBannerFiltersId["QuickFixesFilterId"] = 24] = "QuickFixesFilterId";
    AntiBannerFiltersId[AntiBannerFiltersId["AllowlistFilterId"] = 100] = "AllowlistFilterId";
    AntiBannerFiltersId[AntiBannerFiltersId["MobileAdsFilterId"] = 11] = "MobileAdsFilterId";
    return AntiBannerFiltersId;
}({});
// Group ids used in the code on the multiple entry points
var AntibannerGroupsId = /*#__PURE__*/ function(AntibannerGroupsId) {
    // custom filters group identifier
    AntibannerGroupsId[AntibannerGroupsId["CustomFiltersGroupId"] = 0] = "CustomFiltersGroupId";
    AntibannerGroupsId[AntibannerGroupsId["AdBlockingFiltersGroupId"] = 1] = "AdBlockingFiltersGroupId";
    AntibannerGroupsId[AntibannerGroupsId["PrivacyFiltersGroupId"] = 2] = "PrivacyFiltersGroupId";
    AntibannerGroupsId[AntibannerGroupsId["SocialFiltersGroupId"] = 3] = "SocialFiltersGroupId";
    AntibannerGroupsId[AntibannerGroupsId["AnnoyancesFiltersGroupId"] = 4] = "AnnoyancesFiltersGroupId";
    AntibannerGroupsId[AntibannerGroupsId["SecurityFiltersGroupId"] = 5] = "SecurityFiltersGroupId";
    // other filters group identifier
    AntibannerGroupsId[AntibannerGroupsId["OtherFiltersGroupId"] = 6] = "OtherFiltersGroupId";
    // language-specific group identifier
    AntibannerGroupsId[AntibannerGroupsId["LanguageFiltersGroupId"] = 7] = "LanguageFiltersGroupId";
    return AntibannerGroupsId;
}({});
/**
 * Recommended filters tag ID.
 *
 * @see https://github.com/AdguardTeam/FiltersRegistry/blob/4528f7ae6b38aec90111a27efb0a7e0958d0cf37/tags/metadata.json#L40
 */ const RECOMMENDED_TAG_ID = 10;
// TODO: Add types checking for messages payload, because it many messages data
// are not used in the fronted code, except FiltersUpdateCheckReady and FullscreenUserRulesEditorUpdated.
var NotifierType = /*#__PURE__*/ function(NotifierType) {
    NotifierType["RequestFilterUpdated"] = "event.request.filter.updated";
    NotifierType["UserFilterUpdated"] = "event.user.filter.updated";
    NotifierType["CustomFilterAdded"] = "event.custom.filter.added";
    NotifierType["UpdateAllowlistFilterRules"] = "event.update.allowlist.filter.rules";
    NotifierType["SettingUpdated"] = "event.update.setting.value";
    NotifierType["FiltersUpdateCheckReady"] = "event.update.filters.check";
    // Log events
    NotifierType["TabAdded"] = "log.tab.added";
    NotifierType["TabClose"] = "log.tab.close";
    NotifierType["TabUpdate"] = "log.tab.update";
    NotifierType["TabReset"] = "log.tab.reset";
    NotifierType["LogEventAdded"] = "log.event.added";
    // Sync events
    NotifierType["SettingsUpdated"] = "event.sync.finished";
    // Fullscreen user rules events
    NotifierType["FullscreenUserRulesEditorUpdated"] = "event.user.rules.editor.updated";
    return NotifierType;
}({});
const KEEP_ALIVE_PORT_NAME = 'keep-alive';
var NavigationTag = /*#__PURE__*/ function(NavigationTag) {
    NavigationTag["Regular"] = "regular";
    NavigationTag["Party"] = "party";
    return NavigationTag;
}({});
/**
 * Trusted tag for custom filters
 */ const TRUSTED_TAG_KEYWORD = 'trusted';
/**
 * Trusted tag id for custom filters.
 */ const TRUSTED_TAG_ID = 999;
/**
 * Custom filters group display number
 */ const CUSTOM_FILTERS_GROUP_DISPLAY_NUMBER = 99;
/**
 * Custom filters identifiers starts from this number
 */ const CUSTOM_FILTERS_START_ID = 1000;
// Unnecessary characters that will be replaced
const WASTE_CHARACTERS = /[.*+?^${}()|[\]\\]/g;
// Custom scrollbar width
const SCROLLBAR_WIDTH = 12;
const BACKGROUND_TAB_ID = -1;
const TOTAL_BLOCKED_STATS_GROUP_ID = 'total';
/**
 *  Time interval between filter updates.
 */ var FiltersUpdateTime = /*#__PURE__*/ function(FiltersUpdateTime) {
    FiltersUpdateTime[FiltersUpdateTime["Disabled"] = 0] = "Disabled";
    FiltersUpdateTime[FiltersUpdateTime["OneHour"] = 3600000] = "OneHour";
    FiltersUpdateTime[FiltersUpdateTime["SixHours"] = 21600000] = "SixHours";
    FiltersUpdateTime[FiltersUpdateTime["TwelveHours"] = 43200000] = "TwelveHours";
    FiltersUpdateTime[FiltersUpdateTime["TwentyFourHours"] = 86400000] = "TwentyFourHours";
    FiltersUpdateTime[FiltersUpdateTime["FortyEightHours"] = 172800000] = "FortyEightHours";
    FiltersUpdateTime[FiltersUpdateTime["Default"] = -1] = "Default";
    return FiltersUpdateTime;
}({});
const NEWLINE_CHAR_UNIX = '\n';
const NEWLINE_CHAR_REGEX = /\r?\n/;
const OPTIONS_PAGE = 'pages/options.html';
const FILTER_LIST_EXTENSION = '.txt';
/**
 * Special event name for extension initialization, needed for run automatic
 * integration tests.
 */ const EXTENSION_INITIALIZED_EVENT = 'initialized';
/**
 * This is just a syntax sugar for setting default value if we not have
 * preprocessed list for user rules or for custom filters.
 */ const emptyPreprocessedFilterList = {
    filterList: [],
    sourceMap: {},
    rawFilterList: '',
    conversionMap: {}
};


/***/ }),

/***/ 19483:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "OU": () => (/* binding */ Forward),
/* harmony export */   "UU": () => (/* binding */ ForwardFrom),
/* harmony export */   "xD": () => (/* binding */ ForwardAction)
/* harmony export */ });
/* unused harmony export ForwardApp */
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ /**
 * IMPORTANT: do not change the values as tds is already configured for that specific strings.
 */ function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
var ForwardAction = /*#__PURE__*/ function(ForwardAction) {
    ForwardAction["UninstallExtension"] = "adguard_uninstal_ext";
    // used for thank you page
    ForwardAction["ThankYou"] = "thank_you_page";
    // used for thank you page for MV3
    ForwardAction["ThankYouMv3"] = "thank_you_page_mv3";
    // used for "More information" on the page blocked by Safebrowsing
    ForwardAction["SiteReport"] = "site_report_page";
    // used for "Report an issue" in popup or context menu on the page
    ForwardAction["IssueReport"] = "report";
    // used for "Report a bug" on options page in General section
    ForwardAction["BugReport"] = "bug_report";
    ForwardAction["BugReportMv3"] = "bug_report_mv3";
    ForwardAction["Privacy"] = "privacy";
    ForwardAction["Acknowledgments"] = "acknowledgments";
    ForwardAction["Github"] = "github_options";
    ForwardAction["Website"] = "adguard_site";
    ForwardAction["Discuss"] = "discuss";
    ForwardAction["Compare"] = "compare";
    ForwardAction["Changelog"] = "github_version_popup";
    ForwardAction["GlobalPrivacyControl"] = "global_privacy_control";
    ForwardAction["DoNotTrack"] = "do_not_track";
    ForwardAction["HowToCreateRules"] = "userfilter_description";
    ForwardAction["FilterPolicy"] = "filter_policy";
    ForwardAction["AdguardSite"] = "adguard_site";
    ForwardAction["SelfPromotion"] = "self_promotion";
    ForwardAction["ProtectionWorks"] = "protection_works";
    ForwardAction["CollectHitsLearnMore"] = "filter_rules";
    ForwardAction["OperaStore"] = "opera_store";
    ForwardAction["FirefoxStore"] = "firefox_store";
    /**
     * Main supported release version — "AdGuard AdBlocker".
     */ ForwardAction["ChromeStore"] = "chrome_store";
    // TODO: can be removed in few months after v5.0 MV3 release
    // since it will no longer be used
    /**
     * Supported MV3 beta version.
     *
     * Previously known as "AdGuard AdBlocker MV3 Experimental",
     * currently — "AdGuard AdBlocker (MV3 Beta)".
     */ ForwardAction["ChromeMv3Store"] = "chrome_mv3_store";
    /**
     * Supported MV2 release version.
     *
     * Previously known as "AdGuard AdBlocker (Beta)".
     */ ForwardAction["ChromeMv2Store"] = "chrome_mv2_store";
    ForwardAction["EdgeStore"] = "edge_store";
    ForwardAction["IOS"] = "ios_about";
    ForwardAction["Android"] = "android_about";
    ForwardAction["GetTheApp"] = "get_the_app";
    ForwardAction["GithubVersion"] = "github_version_popup";
    ForwardAction["GithubVersionBeta"] = "github_version_popup_beta";
    ForwardAction["LearnAboutAdGuard"] = "learn_about_adguard";
    ForwardAction["FilteringLogAssumedRule"] = "filtering_log_assumed_rule";
    ForwardAction["Christmas24"] = "christmas_24";
    ForwardAction["CustomFiltersMv3Disabled"] = "custom_mv3_disabled";
    return ForwardAction;
}({});
var ForwardFrom = /*#__PURE__*/ function(ForwardFrom) {
    ForwardFrom["Background"] = "background";
    ForwardFrom["Options"] = "options_screen";
    ForwardFrom["OptionsFooter"] = "options_screen_footer";
    ForwardFrom["ContextMenu"] = "context_menu";
    ForwardFrom["Popup"] = "popup";
    ForwardFrom["Safebrowsing"] = "safebrowsing";
    ForwardFrom["Adblocker"] = "adblocked";
    ForwardFrom["VersionPopup"] = "version_popup";
    ForwardFrom["FilteringLog"] = "filtering_log";
    return ForwardFrom;
}({});
var ForwardApp = /*#__PURE__*/ function(ForwardApp) {
    ForwardApp["BrowserExtension"] = "browser_extension";
    return ForwardApp;
}({});
/**
 * Class for creating forward links
 */ class Forward {
    static get(params) {
        const queryString = Object.entries({
            ...Forward.defaultParams,
            ...params
        }).map(([key, value])=>`${key}=${value}`).join('&');
        return `${Forward.url}?${queryString}`;
    }
}
_define_property(Forward, "url", 'https://link.adtidy.org/forward.html');
_define_property(Forward, "defaultParams", {
    app: "browser_extension"
});


/***/ }),

/***/ 41512:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "k": () => (/* binding */ logger)
/* harmony export */ });
/* harmony import */ var core_js_modules_web_self_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(44088);
/* harmony import */ var core_js_modules_web_self_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_self_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _adguard_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21172);
/**
 * @file
 *
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

class ExtendedLogger extends _adguard_logger__WEBPACK_IMPORTED_MODULE_1__/* .Logger */ .Y {
    isVerbose() {
        return this.currentLevel === _adguard_logger__WEBPACK_IMPORTED_MODULE_1__/* .LogLevel.Debug */ .i.Debug;
    }
}
const logger = new ExtendedLogger();
logger.currentLevel =  true ? _adguard_logger__WEBPACK_IMPORTED_MODULE_1__/* .LogLevel.Info */ .i.Info : 0;
// Expose logger to the window object,
// to have possibility to switch log level from the console.
// Example: adguard.logger.currentLevel = 'debug'
// eslint-disable-next-line no-restricted-globals
Object.assign(self, {
    adguard: {
        ...self.adguard,
        logger
    }
});



/***/ }),

/***/ 84154:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "C": () => (/* binding */ MessageType),
/* harmony export */   "Z": () => (/* binding */ APP_MESSAGE_HANDLER_NAME)
/* harmony export */ });
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ /**
 * Message types used for message passing between extension contexts
 * (popup, filtering log, content scripts, background)
 */ const APP_MESSAGE_HANDLER_NAME = 'app';
var MessageType = /*#__PURE__*/ function(MessageType) {
    MessageType["CreateEventListener"] = "createEventListener";
    MessageType["RemoveListener"] = "removeListener";
    MessageType["OpenExtensionStore"] = "openExtensionStore";
    MessageType["AddAndEnableFilter"] = "addAndEnableFilter";
    MessageType["ApplySettingsJson"] = "applySettingsJson";
    MessageType["OpenFilteringLog"] = "openFilteringLog";
    MessageType["OpenFullscreenUserRules"] = "openFullscreenUserRules";
    MessageType["UpdateFullscreenUserRulesTheme"] = "updateFullscreenUserRulesTheme";
    MessageType["ResetBlockedAdsCount"] = "resetBlockedAdsCount";
    MessageType["ResetSettings"] = "resetSettings";
    MessageType["GetUserRules"] = "getUserRules";
    MessageType["SaveUserRules"] = "saveUserRules";
    MessageType["GetAllowlistDomains"] = "getAllowlistDomains";
    MessageType["SaveAllowlistDomains"] = "saveAllowlistDomains";
    MessageType["CheckFiltersUpdate"] = "checkFiltersUpdate";
    MessageType["DisableFiltersGroup"] = "disableFiltersGroup";
    MessageType["DisableFilter"] = "disableFilter";
    MessageType["LoadCustomFilterInfo"] = "loadCustomFilterInfo";
    MessageType["SubscribeToCustomFilter"] = "subscribeToCustomFilter";
    MessageType["RemoveAntiBannerFilter"] = "removeAntiBannerFilter";
    MessageType["GetIsEngineStarted"] = "getIsEngineStarted";
    MessageType["GetTabInfoForPopup"] = "getTabInfoForPopup";
    MessageType["ChangeApplicationFilteringPaused"] = "changeApplicationFilteringPaused";
    MessageType["OpenRulesLimitsTab"] = "openRulesLimitsTab";
    MessageType["OpenSettingsTab"] = "openSettingsTab";
    MessageType["OpenAssistant"] = "openAssistant";
    MessageType["OpenAbuseTab"] = "openAbuseTab";
    MessageType["OpenSiteReportTab"] = "openSiteReportTab";
    MessageType["OpenComparePage"] = "openComparePage";
    MessageType["ResetUserRulesForPage"] = "resetUserRulesForPage";
    MessageType["RemoveAllowlistDomain"] = "removeAllowlistDomain";
    MessageType["AddAllowlistDomain"] = "addAllowlistDomain";
    MessageType["OnOpenFilteringLogPage"] = "onOpenFilteringLogPage";
    MessageType["GetFilteringLogData"] = "getFilteringLogData";
    MessageType["InitializeFrameScript"] = "initializeFrameScript";
    MessageType["OnCloseFilteringLogPage"] = "onCloseFilteringLogPage";
    MessageType["GetFilteringInfoByTabId"] = "getFilteringInfoByTabId";
    MessageType["SynchronizeOpenTabs"] = "synchronizeOpenTabs";
    MessageType["ClearEventsByTabId"] = "clearEventsByTabId";
    MessageType["RefreshPage"] = "refreshPage";
    MessageType["AddUserRule"] = "addUserRule";
    MessageType["RemoveUserRule"] = "removeUserRule";
    MessageType["EnableFiltersGroup"] = "enableFiltersGroup";
    MessageType["NotifyListeners"] = "notifyListeners";
    MessageType["AddLongLivedConnection"] = "addLongLivedConnection";
    MessageType["GetOptionsData"] = "getOptionsData";
    MessageType["ChangeUserSettings"] = "changeUserSetting";
    MessageType["CheckRequestFilterReady"] = "checkRequestFilterReady";
    MessageType["OpenThankyouPage"] = "openThankYouPage";
    MessageType["OpenSafebrowsingTrusted"] = "openSafebrowsingTrusted";
    MessageType["GetSelectorsAndScripts"] = "getSelectorsAndScripts";
    MessageType["CheckPageScriptWrapperRequest"] = "checkPageScriptWrapperRequest";
    MessageType["ProcessShouldCollapse"] = "processShouldCollapse";
    MessageType["ProcessShouldCollapseMany"] = "processShouldCollapseMany";
    MessageType["AddFilteringSubscription"] = "addFilterSubscription";
    MessageType["SetNotificationViewed"] = "setNotificationViewed";
    MessageType["SaveCssHitsStats"] = "saveCssHitStats";
    MessageType["GetCookieRules"] = "getCookieRules";
    MessageType["SaveCookieLogEvent"] = "saveCookieRuleEvent";
    MessageType["LoadSettingsJson"] = "loadSettingsJson";
    MessageType["AddUrlToTrusted"] = "addUrlToTrusted";
    MessageType["SetPreserveLogState"] = "setPreserveLogState";
    MessageType["GetUserRulesEditorData"] = "getUserRulesEditorData";
    MessageType["GetEditorStorageContent"] = "getEditorStorageContent";
    MessageType["SetEditorStorageContent"] = "setEditorStorageContent";
    MessageType["SetFilteringLogWindowState"] = "setFilteringLogWindowState";
    MessageType["AppInitialized"] = "appInitialized";
    MessageType["UpdateTotalBlocked"] = "updateTotalBlocked";
    MessageType["ScriptletCloseWindow"] = "scriptletCloseWindow";
    MessageType["ShowRuleLimitsAlert"] = "showRuleLimitsAlert";
    MessageType["ShowAlertPopup"] = "showAlertPopup";
    MessageType["ShowVersionUpdatedPopup"] = "showVersionUpdatedPopup";
    MessageType["UpdateListeners"] = "updateListeners";
    MessageType["SetConsentedFilters"] = "setConsentedFilters";
    MessageType["GetIsConsentedFilter"] = "getIsConsentedFilter";
    MessageType["GetRulesLimitsCountersMv3"] = "getRulesLimitsCountersMv3";
    MessageType["CanEnableStaticFilterMv3"] = "canEnableStaticFilterMv3";
    MessageType["CanEnableStaticGroupMv3"] = "canEnableStaticGroupMv3";
    MessageType["ClearRulesLimitsWarningMv3"] = "clearRulesLimitsWarningMv3";
    MessageType["RestoreFiltersMv3"] = "restoreFiltersMv3";
    MessageType["CurrentLimitsMv3"] = "currentLimitsMv3";
    return MessageType;
}({});


/***/ }),

/***/ 54633:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Cs": () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.C),
/* harmony export */   "D5": () => (/* reexport safe */ _message_handler__WEBPACK_IMPORTED_MODULE_2__.D5),
/* harmony export */   "XZ": () => (/* reexport safe */ _message_handler__WEBPACK_IMPORTED_MODULE_2__.XZ),
/* harmony export */   "ZA": () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_0__.Z)
/* harmony export */ });
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(84154);
/* harmony import */ var _send_message__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31957);
/* harmony import */ var _message_handler__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(34648);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 




/***/ }),

/***/ 34648:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "D5": () => (/* binding */ messageHasTypeAndDataFields),
/* harmony export */   "XZ": () => (/* binding */ messageHasTypeField)
/* harmony export */ });
/* unused harmony export MessageHandler */
/* harmony import */ var core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82514);
/* harmony import */ var core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var webextension_polyfill__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(70914);
/* harmony import */ var webextension_polyfill__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(webextension_polyfill__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(84154);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}



/**
 * Type guard for messages that have a 'type' field with possible {@link MessageType}.
 * @note Added to no bring here huge zod library.
 *
 * @param message Unknown message.
 *
 * @returns True if message has 'type' field with possible {@link MessageType}.
 */ const messageHasTypeField = (message)=>{
    return typeof message === 'object' && message !== null && 'type' in message;
};
/**
 * Type guard for messages that have a 'type' field and 'data' field and looks like {@link Message}.
 * @note Added to no bring here huge zod library.
 *
 * @param message Unknown message.
 *
 * @returns True if message has 'type' and 'data' fields and looks like {@link Message}.
 */ const messageHasTypeAndDataFields = (message)=>{
    return messageHasTypeField(message) && 'data' in message;
};
/**
 * API for handling Messages via {@link browser.runtime.onMessage}
 */ class MessageHandler {
    init() {
        browser.runtime.onMessage.addListener(this.handleMessage);
    }
    /**
     * Add message listener.
     * Listeners limited to 1 per message type to prevent race
     * condition while response processing.
     *
     * TODO: implement listeners priority execution strategy
     *
     * @param type - {@link ValidMessageTypes}
     * @param listener - {@link MessageListener}
     * @throws error, if message listener already added
     */ addListener(type, listener) {
        if (this.listeners.has(type)) {
            throw new Error(`Message handler: ${type} listener has already been registered`);
        }
        // Cast through unknown to help TS understand that the listener is of
        // the correct type. It will check types at compile time.
        this.listeners.set(type, listener);
    }
    /**
     * Removes message listener.
     *
     * @param type - {@link ValidMessageTypes}
     */ removeListener(type) {
        this.listeners.delete(type);
    }
    /**
     * Removes all listeners
     */ removeListeners() {
        this.listeners.clear();
    }
    /**
     * Check if the message is of type {@link Message}.
     *
     * @param message Message of basic type {@link Message} or {@link EngineMessage}.
     *
     * @returns True if the message is of type {@link Message}.
     */ static isValidMessageType(message) {
        return message.handlerName === APP_MESSAGE_HANDLER_NAME && 'type' in message;
    }
    constructor(){
        _define_property(this, "listeners", new Map());
        this.handleMessage = this.handleMessage.bind(this);
    }
}


/***/ }),

/***/ 31957:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* unused harmony exports sendMessage, sendTabMessage */
/* harmony import */ var webextension_polyfill__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70914);
/* harmony import */ var webextension_polyfill__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(webextension_polyfill__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84154);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

/**
 * TODO: Consider moving this file to the background folder, because all messages
 * from the UI should be send via methods of Messenger class instead of using
 * directly sendMessage to proper types checking.
 *
 * {@link sendMessage} sends app message via {@link browser.runtime.sendMessage} and
 * gets response from another extension page message handler
 *
 * @param message - partial {@link Message} record without {@link Message.handlerName} field
 *
 * @returns message handler response
 */ async function sendMessage(message) {
    try {
        return await browser.runtime.sendMessage({
            handlerName: APP_MESSAGE_HANDLER_NAME,
            ...message
        });
    } catch (e) {
    // do nothing
    }
}
/**
 * {@link sendTabMessage} sends message to specified tab via {@link browser.tabs.sendMessage} and
 * gets response from it
 *
 * @param tabId - tab id
 * @param message - partial {@link Message} record without {@link Message.handlerName} field
 *
 * @returns tab message handler response
 */ async function sendTabMessage(tabId, message) {
    return browser.tabs.sendMessage(tabId, {
        handlerName: APP_MESSAGE_HANDLER_NAME,
        ...message
    });
}


/***/ }),

/***/ 36073:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "hJ": () => (/* binding */ AppearanceTheme)
/* harmony export */ });
/* unused harmony exports DEFAULT_FILTERS_UPDATE_PERIOD, DEFAULT_FIRST_PARTY_COOKIES_SELF_DESTRUCT_MIN, DEFAULT_THIRD_PARTY_COOKIES_SELF_DESTRUCT_MIN, DEFAULT_ALLOWLIST, DEFAULT_INVERTED_ALLOWLIST, defaultSettings */
/* harmony import */ var _background_schema__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73204);
/* harmony import */ var _user_agent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12855);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

var AppearanceTheme = /*#__PURE__*/ function(AppearanceTheme) {
    AppearanceTheme["System"] = "system";
    AppearanceTheme["Dark"] = "dark";
    AppearanceTheme["Light"] = "light";
    return AppearanceTheme;
}({});
const DEFAULT_FILTERS_UPDATE_PERIOD = -1;
const DEFAULT_FIRST_PARTY_COOKIES_SELF_DESTRUCT_MIN = 4320;
const DEFAULT_THIRD_PARTY_COOKIES_SELF_DESTRUCT_MIN = 2880;
const DEFAULT_ALLOWLIST = [];
const DEFAULT_INVERTED_ALLOWLIST = [];
const defaultSettings = {
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.DisableShowAdguardPromoInfo */ .qY.DisableShowAdguardPromoInfo]: !_user_agent__WEBPACK_IMPORTED_MODULE_1__/* .UserAgent.isWindows */ .Z.isWindows && !_user_agent__WEBPACK_IMPORTED_MODULE_1__/* .UserAgent.isMacOs */ .Z.isMacOs || _user_agent__WEBPACK_IMPORTED_MODULE_1__/* .UserAgent.isEdge */ .Z.isEdge,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.DisableSafebrowsing */ .qY.DisableSafebrowsing]: true,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.DisableCollectHits */ .qY.DisableCollectHits]: true,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.DefaultAllowlistMode */ .qY.DefaultAllowlistMode]: true,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.AllowlistEnabled */ .qY.AllowlistEnabled]: true,
    // TODO: consider ditching optimized filters for mobile mv3 builds if (or when) they become available
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.UseOptimizedFilters */ .qY.UseOptimizedFilters]: _user_agent__WEBPACK_IMPORTED_MODULE_1__/* .UserAgent.isAndroid */ .Z.isAndroid,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.DisableDetectFilters */ .qY.DisableDetectFilters]: false,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.DisableShowAppUpdatedNotification */ .qY.DisableShowAppUpdatedNotification]: false,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.FiltersUpdatePeriod */ .qY.FiltersUpdatePeriod]: DEFAULT_FILTERS_UPDATE_PERIOD,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.DisableStealthMode */ .qY.DisableStealthMode]: true,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.HideReferrer */ .qY.HideReferrer]: true,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.HideSearchQueries */ .qY.HideSearchQueries]: true,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.SendDoNotTrack */ .qY.SendDoNotTrack]: true,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.RemoveXClientData */ .qY.RemoveXClientData]: _user_agent__WEBPACK_IMPORTED_MODULE_1__/* .UserAgent.isChrome */ .Z.isChrome,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.BlockWebRTC */ .qY.BlockWebRTC]: false,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.SelfDestructThirdPartyCookies */ .qY.SelfDestructThirdPartyCookies]: true,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.SelfDestructThirdPartyCookiesTime */ .qY.SelfDestructThirdPartyCookiesTime]: DEFAULT_THIRD_PARTY_COOKIES_SELF_DESTRUCT_MIN,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.SelfDestructFirstPartyCookies */ .qY.SelfDestructFirstPartyCookies]: false,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.SelfDestructFirstPartyCookiesTime */ .qY.SelfDestructFirstPartyCookiesTime]: DEFAULT_FIRST_PARTY_COOKIES_SELF_DESTRUCT_MIN,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.AppearanceTheme */ .qY.AppearanceTheme]: "system",
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.UserFilterEnabled */ .qY.UserFilterEnabled]: true,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.HideRateBlock */ .qY.HideRateBlock]: false,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.UserRulesEditorWrap */ .qY.UserRulesEditorWrap]: false,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.DisableFiltering */ .qY.DisableFiltering]: false,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.DisableShowPageStats */ .qY.DisableShowPageStats]: false,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.DisableShowContextMenu */ .qY.DisableShowContextMenu]: false,
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.AllowlistDomains */ .qY.AllowlistDomains]: JSON.stringify(DEFAULT_ALLOWLIST),
    [_background_schema__WEBPACK_IMPORTED_MODULE_0__/* .SettingOption.InvertedAllowlistDomains */ .qY.InvertedAllowlistDomains]: JSON.stringify(DEFAULT_INVERTED_ALLOWLIST)
};


/***/ }),

/***/ 85242:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "a": () => (/* binding */ i18n)
/* harmony export */ });
/* harmony import */ var core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82514);
/* harmony import */ var core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var webextension_polyfill__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(70914);
/* harmony import */ var webextension_polyfill__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(webextension_polyfill__WEBPACK_IMPORTED_MODULE_1__);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

const BASE_LOCALE = 'en';
const baseMessages = __webpack_require__(41910);
const uiLanguage = webextension_polyfill__WEBPACK_IMPORTED_MODULE_1___default().i18n.getUILanguage();
/**
 * Retrieves the localized message for the given key.
 *
 * @param key - The key corresponding to the message in the localization files
 * @returns The localized message, or an empty string if the message is the same as the base locale (indicating no
 * translation)
 * @throws {Error} If there is no such key in the messages
 */ const getMessage = (key)=>{
    const receivedMessage = webextension_polyfill__WEBPACK_IMPORTED_MODULE_1___default().i18n.getMessage(key);
    if (uiLanguage !== BASE_LOCALE) {
        var _baseMessages_key;
        const baseMessage = (_baseMessages_key = baseMessages[key]) === null || _baseMessages_key === void 0 ? void 0 : _baseMessages_key.message;
        if (!baseMessage) {
            throw new Error(`There is no such key "${key}" in the messages`);
        }
        // The same strings mean that the message is not translated.
        // We return an empty string for @adguard/translator to fall back to the base message and base locale.
        // Without this, browser.i18n.getMessage returns the base locale message and the wrong UI language,
        // and @adguard/translator fails on plural forms validations.
        if (receivedMessage === baseMessage) {
            return '';
        }
    }
    return receivedMessage;
};
const i18n = {
    getMessage,
    /**
     * Retrieves the UI language, truncated to a 2-letter code.
     * This is because react translator supports only 2-letter codes.
     *
     * @returns The 2-letter UI language code
     */ getUILanguage: ()=>{
        return uiLanguage.substring(0, 2);
    },
    getBaseMessage: (key)=>{
        // thus we can test the base messages with keys without translations
        if (false) {}
        return webextension_polyfill__WEBPACK_IMPORTED_MODULE_1___default().i18n.getMessage(key);
    },
    getBaseUILanguage: ()=>BASE_LOCALE
};


/***/ }),

/***/ 47562:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "_": () => (/* binding */ reactTranslator)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70654);
/* harmony import */ var _adguard_translate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26462);
/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(85242);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


/**
 * Retrieves localized messages by key, formats and converts into react components or string
 */ const reactTranslator = _adguard_translate__WEBPACK_IMPORTED_MODULE_1__/* .translate.createReactTranslator */ .Iu.createReactTranslator(_i18n__WEBPACK_IMPORTED_MODULE_2__/* .i18n */ .a, react__WEBPACK_IMPORTED_MODULE_0__);


/***/ }),

/***/ 88325:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "O": () => (/* binding */ translator)
/* harmony export */ });
/* harmony import */ var _adguard_translate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26462);
/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85242);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

/**
 * Retrieves localized message by key, formats it and converts into string
 */ const translator = _adguard_translate__WEBPACK_IMPORTED_MODULE_0__/* .translate.createTranslator */ .Iu.createTranslator(_i18n__WEBPACK_IMPORTED_MODULE_1__/* .i18n */ .a);


/***/ }),

/***/ 12855:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ UserAgent)
/* harmony export */ });
/* harmony import */ var ua_parser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51218);
/* harmony import */ var ua_parser_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(ua_parser_js__WEBPACK_IMPORTED_MODULE_0__);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}

/**
 * Helper class for user agent data.
 *
 * @see https://developer.mozilla.org/en-US/docs/Web/API/User-Agent_Client_Hints_API#browser_compatibility
 */ class UserAgent {
    /**
     * Returns current browser name.
     *
     * @returns user agent browser name.
     */ static getBrowserName() {
        return UserAgent.isFirefoxMobile ? 'Firefox Mobile' : UserAgent.parser.getBrowser().name;
    }
    /**
     * Returns current OS name.
     *
     * @returns OS name as string if possible to detect, undefined otherwise.
     */ static getSystemName() {
        return UserAgent.parser.getOS().name;
    }
    /**
     * Returns current OS version.
     *
     * @returns OS version as string if possible to detect, undefined otherwise.
     */ static getSystemVersion() {
        return UserAgent.parser.getOS().version;
    }
    /**
     * Returns current platform version.
     * Uses NavigatorUAData.getHighEntropyValues() to get platform version.
     *
     * @returns Actual platform version as string if possible to detect, undefined otherwise.
     */ static async getPlatformVersion() {
        let platformVersion;
        try {
            // @ts-ignore
            const ua = await navigator.userAgentData.getHighEntropyValues([
                UserAgent.PLATFORM_VERSION
            ]);
            platformVersion = ua[UserAgent.PLATFORM_VERSION];
        } catch (e) {
        // do nothing
        }
        return platformVersion;
    }
    /**
     * Returns actual Windows version if it is parsed from user agent as Windows 10.
     *
     * @see {@link https://learn.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11#sample-code-for-detecting-windows-11}.
     *
     * @returns Actual Windows version.
     */ static async getActualWindowsVersion(version) {
        let actualVersion = version;
        const platformVersion = await UserAgent.getPlatformVersion();
        if (typeof platformVersion !== 'undefined') {
            const rawMajorPlatformVersion = platformVersion.split('.')[0];
            const majorPlatformVersion = rawMajorPlatformVersion && parseInt(rawMajorPlatformVersion, 10);
            if (!majorPlatformVersion || Number.isNaN(majorPlatformVersion)) {
                return actualVersion;
            }
            if (majorPlatformVersion >= UserAgent.MIN_WINDOWS_11_PLATFORM_VERSION) {
                actualVersion = UserAgent.WINDOWS_11_OS_VERSION;
            }
        }
        return actualVersion;
    }
    /**
     * Returns actual MacOS version if it is possible to detect, otherwise returns passed `version`.
     *
     * @param version MacOS version parsed from user agent.
     *
     * @returns Actual MacOS version.
     */ static async getActualMacosVersion(version) {
        let actualVersion = version;
        const platformVersion = await UserAgent.getPlatformVersion();
        if (typeof platformVersion !== 'undefined') {
            actualVersion = platformVersion;
        }
        return actualVersion;
    }
    /**
     * Returns current system info — OS name and version.
     *
     * @returns System info as string if possible to detect, undefined otherwise.
     */ static async getSystemInfo() {
        let systemInfo = '';
        const osName = UserAgent.getSystemName();
        let osVersion = UserAgent.getSystemVersion();
        if (typeof osName !== 'undefined') {
            systemInfo += osName;
        }
        if (typeof osVersion !== 'undefined') {
            // windows 11 is parsed as windows 10 from user agent
            if (UserAgent.isWindows && osVersion === UserAgent.WINDOWS_10_OS_VERSION) {
                osVersion = await UserAgent.getActualWindowsVersion(osVersion);
            } else if (UserAgent.isMacOs) {
                // mac os version can be parsed from user agent as 10.15.7
                // so it also might be more specific version like 13.5.2
                osVersion = await UserAgent.getActualMacosVersion(osVersion);
            }
            systemInfo += ` ${osVersion}`;
        }
        if (systemInfo.length === 0) {
            return undefined;
        }
        return systemInfo;
    }
    /**
     * Check if the current browser is as given.
     *
     * @param browserName Browser Name.
     * @returns true, if current browser has specified name.
     */ static isTargetBrowser(browserName) {
        return UserAgent.parser.getBrowser().name === browserName;
    }
    /**
     * Check if current platform is as given.
     *
     * @param platformName Platform name.
     * @returns true, if current browser has specified name.
     */ static isTargetPlatform(platformName) {
        return UserAgent.getSystemName() === platformName;
    }
    /**
     * Check if current engine is as given.
     *
     * @param engineName Engine name.
     * @returns true, if current engine has specified name.
     */ static isTargetEngine(engineName) {
        return UserAgent.parser.getEngine().name === engineName;
    }
    static isTargetDeviceType(deviceType) {
        return UserAgent.parser.getDevice().type === deviceType;
    }
    /**
     * Returns a major browser version.
     *
     * @returns browser version number or undefined.
     */ static getVersion() {
        var _browser_version;
        const browser = this.parser.getBrowser();
        const versionNumber = Number((_browser_version = browser.version) === null || _browser_version === void 0 ? void 0 : _browser_version.split('.')[0]);
        return Number.isNaN(versionNumber) ? undefined : versionNumber;
    }
}
_define_property(UserAgent, "WINDOWS_10_OS_VERSION", '10');
_define_property(UserAgent, "WINDOWS_11_OS_VERSION", '11');
_define_property(UserAgent, "PLATFORM_VERSION", 'platformVersion');
_define_property(UserAgent, "MIN_WINDOWS_11_PLATFORM_VERSION", 13);
_define_property(UserAgent, "parser", new (ua_parser_js__WEBPACK_IMPORTED_MODULE_0___default())(navigator.userAgent));
_define_property(UserAgent, "version", UserAgent.getVersion());
_define_property(UserAgent, "isChrome", UserAgent.isTargetBrowser('Chrome'));
_define_property(UserAgent, "isFirefox", UserAgent.isTargetBrowser('Firefox'));
_define_property(UserAgent, "isOpera", UserAgent.isTargetBrowser('Opera'));
_define_property(UserAgent, "isYandex", UserAgent.isTargetBrowser('Yandex'));
_define_property(UserAgent, "isEdge", UserAgent.isTargetBrowser('Edge'));
_define_property(UserAgent, "isEdgeChromium", UserAgent.isEdge && !!(UserAgent.version && UserAgent.version >= 79));
_define_property(UserAgent, "isMacOs", UserAgent.isTargetPlatform('Mac OS'));
_define_property(UserAgent, "isWindows", UserAgent.isTargetPlatform('Windows'));
_define_property(UserAgent, "isAndroid", UserAgent.isTargetPlatform('Android'));
_define_property(UserAgent, "isChromium", UserAgent.isTargetEngine('Blink'));
_define_property(UserAgent, "isMobileDevice", UserAgent.isTargetDeviceType('mobile'));
_define_property(UserAgent, "isFirefoxMobile", UserAgent.isFirefox && UserAgent.isMobileDevice);
_define_property(UserAgent, "isSupportedBrowser", UserAgent.isChrome && Number(UserAgent.version) >= 79 || UserAgent.isEdgeChromium && Number(UserAgent.version) >= 79 || UserAgent.isFirefox && Number(UserAgent.version) >= 78 || UserAgent.isFirefoxMobile && Number(UserAgent.version) >= 113 || UserAgent.isOpera && Number(UserAgent.version) >= 66);
_define_property(UserAgent, "browserName", UserAgent.getBrowserName());


/***/ }),

/***/ 78413:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "g": () => (/* reexport */ AttachmentPortal)
});

// EXTERNAL MODULE: ./node_modules/.pnpm/react@17.0.2/node_modules/react/index.js
var react = __webpack_require__(70654);
// EXTERNAL MODULE: ./node_modules/.pnpm/react-dom@17.0.2_react@17.0.2/node_modules/react-dom/index.js
var react_dom = __webpack_require__(75940);
;// CONCATENATED MODULE: ./Extension/src/pages/common/components/AttachmentPortal/AttachmentPortal.tsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

const TOOLTIP_EDGE_PADDING = 4; // px
const getCssString = (position, visible)=>{
    const { x, y } = position;
    let css = `z-index:999;position:absolute;top:${y}px;left:${x}px;`;
    if (!visible) {
        css += 'visibility:hidden;';
    }
    return css;
};
const AttachmentPortal = ({ rootId, position, children })=>{
    const parent = document.getElementById(rootId);
    const ref = (0,react.useRef)(document.createElement('div'));
    (0,react.useEffect)(()=>{
        const el = ref.current;
        el.setAttribute('style', getCssString(position, false));
        parent === null || parent === void 0 ? void 0 : parent.appendChild(el);
        const rect = el.getBoundingClientRect();
        const offsetEdge = {
            top: rect.y,
            right: window.innerWidth - rect.right,
            bottom: window.innerHeight - rect.bottom,
            left: rect.x
        };
        const nextPosition = {
            ...position
        };
        if (offsetEdge.right < TOOLTIP_EDGE_PADDING) {
            nextPosition.x = rect.x + offsetEdge.right - TOOLTIP_EDGE_PADDING;
        }
        if (offsetEdge.left < TOOLTIP_EDGE_PADDING) {
            nextPosition.x = rect.x - offsetEdge.left + TOOLTIP_EDGE_PADDING;
        }
        if (offsetEdge.top < TOOLTIP_EDGE_PADDING) {
            nextPosition.y = rect.y - offsetEdge.top + TOOLTIP_EDGE_PADDING;
        }
        if (offsetEdge.bottom < TOOLTIP_EDGE_PADDING) {
            nextPosition.y = rect.y + offsetEdge.bottom - TOOLTIP_EDGE_PADDING;
        }
        el.setAttribute('style', getCssString(nextPosition, true));
        return ()=>{
            parent === null || parent === void 0 ? void 0 : parent.removeChild(el);
        };
    }, [
        ref,
        parent,
        position
    ]);
    return /*#__PURE__*/ (0,react_dom.createPortal)(children, ref.current);
};

;// CONCATENATED MODULE: ./Extension/src/pages/common/components/AttachmentPortal/index.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


/***/ }),

/***/ 85464:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "J": () => (/* binding */ Icon)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70654);
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14271);
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

const Svg = ({ id, classname, title })=>/*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", {
        className: classname
    }, title && /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_0__.createElement("title", null, title), /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_0__.createElement("use", {
        xlinkHref: id
    }));
/**
 * Wrapper removes animation stuttering and makes icon resetting on animation end smooth
 */ const AnimatedWrapper = ({ children, className })=>/*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", {
        className: className
    }, children);
const Icon = ({ id, classname, title, animationCondition, animationClassname })=>{
    const iconClassname = classnames__WEBPACK_IMPORTED_MODULE_1___default()('icon', classname);
    const icon = /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_0__.createElement(Svg, {
        id: id,
        classname: iconClassname,
        title: title
    });
    return animationCondition && animationClassname ? /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_0__.createElement(AnimatedWrapper, {
        className: animationClassname
    }, icon) : icon;
};


/***/ }),

/***/ 79087:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "P": () => (/* binding */ Icons)
});

// EXTERNAL MODULE: ./node_modules/.pnpm/react@17.0.2/node_modules/react/index.js
var react = __webpack_require__(70654);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
var injectStylesIntoStyleTag = __webpack_require__(2829);
var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/styleDomAPI.js
var styleDomAPI = __webpack_require__(65281);
var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/insertBySelector.js
var insertBySelector = __webpack_require__(29927);
var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js
var setAttributesWithoutAttributes = __webpack_require__(68323);
var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/insertStyleElement.js
var insertStyleElement = __webpack_require__(53062);
var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/styleTagTransform.js
var styleTagTransform = __webpack_require__(84051);
var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform);
// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/common/styles/icons.pcss
var icons = __webpack_require__(74027);
;// CONCATENATED MODULE: ./Extension/src/pages/common/styles/icons.pcss

      
      
      
      
      
      
      
      
      

var options = {};

options.styleTagTransform = (styleTagTransform_default());
options.setAttributes = (setAttributesWithoutAttributes_default());

      options.insert = insertBySelector_default().bind(null, "head");
    
options.domAPI = (styleDomAPI_default());
options.insertStyleElement = (insertStyleElement_default());

var update = injectStylesIntoStyleTag_default()(icons/* default */.Z, options);




       /* harmony default export */ const styles_icons = (icons/* default */.Z && icons/* default.locals */.Z.locals ? icons/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/common/components/ui/Icons.tsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 

const Icons = ()=>{
    return /*#__PURE__*/ react.createElement("svg", {
        xmlns: "http://www.w3.org/2000/svg",
        display: "none"
    }, /*#__PURE__*/ react.createElement("symbol", {
        id: "arrow-left",
        viewBox: "0 0 24 24",
        xmlns: "http://www.w3.org/2000/svg"
    }, /*#__PURE__*/ react.createElement("g", {
        fill: "none",
        fillRule: "evenodd"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "m15 18-6-6 6-6",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }))), /*#__PURE__*/ react.createElement("symbol", {
        id: "cross",
        viewBox: "0 0 24 24",
        xmlns: "http://www.w3.org/2000/svg"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "M6.42857 6.42857L17.6043 17.6043",
        strokeWidth: "1.5",
        strokeLinecap: "round"
    }), /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "M6.42871 17.5714L17.6045 6.39563",
        strokeWidth: "1.5",
        strokeLinecap: "round"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "checked",
        viewBox: "0 0 20 20"
    }, /*#__PURE__*/ react.createElement("g", {
        fill: "none",
        fillRule: "evenodd"
    }, /*#__PURE__*/ react.createElement("rect", {
        fill: "#67b279",
        width: "20",
        height: "20",
        rx: "2"
    }), /*#__PURE__*/ react.createElement("path", {
        stroke: "#fff",
        d: "m5.05 9.04 4.47 4.47 5.43-7.02",
        strokeWidth: "1.5",
        strokeLinecap: "round"
    }))), /*#__PURE__*/ react.createElement("symbol", {
        id: "logo",
        viewBox: "0 0 107 24"
    }, /*#__PURE__*/ react.createElement("g", {
        fill: "none",
        fillRule: "evenodd"
    }, /*#__PURE__*/ react.createElement("path", {
        fill: "#67b279",
        d: "M12.4997 0C8.74899 0 4.22465.860534.500004 2.75463.500004 6.84537.448591 17.0366 12.4997 24 24.5511 17.0366 24.5 6.84537 24.5 2.75463 20.7751.860534 16.2507 0 12.4997 0Z"
    }), /*#__PURE__*/ react.createElement("path", {
        fill: "#5b9f6b",
        d: "M12.5 0h-.0003C8.74898 0 4.22464.860534.500002 2.75463v.05192C.499784 6.931.499251 17.0659 12.4997 24c.0001-.0001.0002-.0001.0003-.0002V0Z"
    }), /*#__PURE__*/ react.createElement("path", {
        fill: "#fff",
        d: "m12.3942 15.4286 6.963-9.22598c-.5103-.40206-.9578-.1183-1.2042.10139l-.009.0007-5.8057 5.93749-2.1875-2.58795C9.10728 8.46897 7.68859 9.37307 7.35718 9.612l5.03702 5.8166Z"
    }), /*#__PURE__*/ react.createElement("path", {
        fill: "currentColor",
        d: "M57.1774 17.4737c-1.6568 0-3.006-.5141-4.0479-1.5423-1.0418-1.0282-1.5627-2.3387-1.5627-3.9314 0-1.5222.5336-2.81497 1.6008-3.87846 1.0673-1.0635 2.3988-1.59523 3.9946-1.59523.9249 0 1.7075.11844 2.3479.35533.6403.23689 1.2553.60231 1.8448 1.09625L59.876 9.74701c-.4472-.37298-.8792-.64515-1.2959-.81652-.4168-.17137-.9148-.25705-1.4942-.25705-.8538 0-1.578.32509-2.1726.97529-.5946.65017-.8919 1.43397-.8919 2.35127 0 .9677.3024 1.7691.9072 2.4042.6048.635 1.3798.9526 2.325.9526.8742 0 1.6111-.2117 2.2107-.6351v-1.5121h-2.3631v-2.011h4.6348v4.5967c-1.3315 1.1189-2.851 1.6784-4.5586 1.6784ZM32.5739 6.63214 28 17.2922h2.3937l.9757-2.3739h4.5129l.9758 2.3739h2.4546L34.7389 6.63214h-2.165Zm1.052 2.7973 1.4179 3.43236h-2.8359l1.418-3.43236Zm6.9122 7.86276V6.70776h4.1623c1.6669 0 3.0289.5015 4.086 1.50451C49.8435 9.21528 50.372 10.4778 50.372 12c0 1.5121-.5311 2.7721-1.5932 3.7802-1.0622 1.008-2.4216 1.512-4.0784 1.512h-4.1623Zm4.1621-2.1017h-1.8143V8.80954h1.8143c.9555 0 1.7305.29737 2.3251.89212.5946.59474.8919 1.36084.8919 2.29834 0 .9476-.2948 1.7162-.8843 2.3059-.5895.5897-1.3671.8846-2.3327.8846Zm20.3443 1.066c.8131.8014 1.9464 1.2021 3.3999 1.2021 1.4636 0 2.6096-.4033 3.438-1.2097.8284-.8064 1.2426-1.9959 1.2426-3.5685V6.70776h-2.3479v6.06344c0 .8266-.2008 1.4566-.6023 1.89-.4014.4335-.9681.6502-1.6999.6502s-1.2985-.2243-1.7-.6728c-.4015-.4486-.6022-1.0963-.6022-1.943V6.70776h-2.3479V12.756c0 1.5323.4065 2.6991 1.2197 3.5005Zm8.7169 1.0357 4.5738-10.66006h2.165l4.5739 10.66006h-2.4547l-.9757-2.3739h-4.5129l-.9758 2.3739h-2.3936Zm5.6258-7.86276 1.4179 3.43236h-2.8358l1.4179-3.43236Zm6.9123-2.72168h4.8788c1.3519 0 2.3886.35786 3.1103 1.07357.6098.60483.9147 1.42134.9147 2.44957 0 1.6229-.7623 2.7167-2.2869 3.2812l2.6071 3.7801h-2.7443l-2.3175-3.387h-1.8143v3.387h-2.3479V6.70776Zm4.7262 5.14104h-2.3784V8.80954H90.98c.5793 0 1.0316.12852 1.3569.38558.3252.25705.4879.63254.4879 1.12648 0 .4637-.1576.8342-.4727 1.1114-.3151.2772-.7572.4158-1.3264.4158Zm5.8754-5.14104h4.1619c1.667 0 3.029.5015 4.086 1.50451 1.057 1.00301 1.586 2.26553 1.586 3.78773 0 1.5121-.531 2.7721-1.593 3.7802-1.062 1.008-2.422 1.512-4.079 1.512h-4.1619V6.70776Zm4.1619 8.48274h-1.8139V8.80954h1.8139c.956 0 1.731.29737 2.325.89212.595.59474.892 1.36084.892 2.29834 0 .9476-.294 1.7162-.884 2.3059-.589.5897-1.367.8846-2.333.8846Z"
    }))), /*#__PURE__*/ react.createElement("symbol", {
        id: "magnifying",
        viewBox: "0 0 24 24"
    }, /*#__PURE__*/ react.createElement("circle", {
        cx: "9.5",
        cy: "9.5",
        r: "5.5",
        fill: "none",
        stroke: "currentColor",
        strokeWidth: "1.5"
    }), /*#__PURE__*/ react.createElement("path", {
        d: "M14 14L19 19",
        fill: "none",
        stroke: "currentColor",
        strokeWidth: "1.5",
        strokeLinecap: "round"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "tick",
        viewBox: "0 0 24 24"
    }, /*#__PURE__*/ react.createElement("g", {
        fill: "none",
        fillRule: "evenodd"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "m5 12 6 6 8-9",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }))), /*#__PURE__*/ react.createElement("symbol", {
        id: "trash",
        viewBox: "0 0 24 24"
    }, /*#__PURE__*/ react.createElement("g", {
        fill: "none",
        fillRule: "evenodd",
        stroke: "currentColor"
    }, /*#__PURE__*/ react.createElement("path", {
        clipRule: "evenodd",
        d: "M7 9h10l-.7633 10.0755c-.0395.5215-.4742.9245-.9971.9245H8.76044c-.52298 0-.95763-.403-.99714-.9245L7 9Z",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }), /*#__PURE__*/ react.createElement("path", {
        d: "M6 6.5h12M14 6V4h-4v2",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }), /*#__PURE__*/ react.createElement("path", {
        clipRule: "evenodd",
        d: "M13.5 12v5-5ZM10.5 12v5-5Z",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }))), /*#__PURE__*/ react.createElement("symbol", {
        id: "reload",
        viewBox: "0 0 24 24"
    }, /*#__PURE__*/ react.createElement("g", {
        fill: "none",
        fillRule: "evenodd"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "M6 6.99999C9.6 1.79999 19.5 3.49996 20 12v1.5M18 16.9999c-3.6 5.2-13.5 3.5001-14-5V11",
        strokeWidth: "1.5",
        strokeLinecap: "round"
    }), /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "m22 12-2 2-2-2M2 12l2-2 2 2",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }))), /*#__PURE__*/ react.createElement("symbol", {
        id: "select",
        viewBox: "0 0 14 8"
    }, /*#__PURE__*/ react.createElement("path", {
        d: "m6 10 6 6 6-6",
        fill: "none",
        stroke: "currentColor",
        strokeLinecap: "round",
        strokeWidth: "1.5",
        transform: "translate(-5 -9)"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "extend",
        viewBox: "0 0 24 24"
    }, /*#__PURE__*/ react.createElement("rect", {
        width: "24",
        height: "24",
        fill: "none"
    }), /*#__PURE__*/ react.createElement("path", {
        d: "M6 10V6H10M6 14V18H10M18 10V6H14M18 14V18H14",
        fill: "none",
        stroke: "currentColor",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "line-break-on",
        viewBox: "0 0 24 24"
    }, /*#__PURE__*/ react.createElement("path", {
        fill: "currentColor",
        fillRule: "evenodd",
        clipRule: "evenodd",
        d: "M4.08 4.74a.75.75 0 0 0 0 1.5h15.54a.75.75 0 0 0 0-1.5H4.08ZM4 8.96a.75.75 0 0 0 0 1.5h11.54a3.25 3.25 0 0 1 .02 6.48l.73-.73a.75.75 0 0 0-1.06-1.06L13.3 17.1c-.3.29-.3.76 0 1.06l1.94 1.94a.75.75 0 0 0 1.06-1.06l-.6-.6a4.75 4.75 0 0 0-.15-9.49H4Zm-.67 4.78c0-.41.34-.75.75-.75h6.8a.75.75 0 0 1 0 1.5h-6.8a.75.75 0 0 1-.75-.75Zm0 3.89c0-.42.34-.75.75-.75h6.8a.75.75 0 0 1 0 1.5h-6.8a.75.75 0 0 1-.75-.75Z"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "line-break-off",
        viewBox: "0 0 24 24"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "M4 6h16M4 18h16M4 14h16M4 10h16",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "info",
        viewBox: "0 0 24 24"
    }, /*#__PURE__*/ react.createElement("circle", {
        stroke: "currentColor",
        fill: "none",
        cx: "12",
        cy: "12",
        r: "9",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }), /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "M12 16V10",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }), /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "M11.997 7.59552C12.009 7.59745 11.997 7.40446 11.997 7.40446",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "reduce",
        viewBox: "0 0 24 24"
    }, /*#__PURE__*/ react.createElement("g", {
        fill: "none",
        fillRule: "evenodd"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "M10 6v4H6M10 18v-4H6M14 6v4h4M14 18v-4h4",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }))), /*#__PURE__*/ react.createElement("symbol", {
        id: "cross",
        width: "24",
        height: "24"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "M6.429 6.796 17.604 18.61M6.429 18.576 17.605 6.76"
    })), /*#__PURE__*/ react.createElement("symbol", {
        id: "question",
        width: "24",
        height: "24"
    }, /*#__PURE__*/ react.createElement("g", {
        fill: "none",
        fillRule: "evenodd"
    }, /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        clipRule: "evenodd",
        d: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Z",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }), /*#__PURE__*/ react.createElement("path", {
        stroke: "currentColor",
        d: "M10 9.3c.02-.82 1-1.52 2-1.52s1.6.39 2 1.22c.32.7.01 1.55-1.06 2.28-.87.56-1.14 1.13-1.14 2.18M11.8 15.9v-.2",
        strokeWidth: "1.5",
        strokeLinecap: "round",
        strokeLinejoin: "round"
    }))));
};


/***/ }),

/***/ 62606:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "J": () => (/* binding */ Popover)
});

// EXTERNAL MODULE: ./node_modules/.pnpm/react@17.0.2/node_modules/react/index.js
var react = __webpack_require__(70654);
// EXTERNAL MODULE: ./Extension/src/pages/common/components/AttachmentPortal/index.ts + 1 modules
var AttachmentPortal = __webpack_require__(78413);
// EXTERNAL MODULE: ./Extension/src/pages/common/components/ui/Tooltip/index.ts + 2 modules
var Tooltip = __webpack_require__(11273);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
var injectStylesIntoStyleTag = __webpack_require__(2829);
var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/styleDomAPI.js
var styleDomAPI = __webpack_require__(65281);
var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/insertBySelector.js
var insertBySelector = __webpack_require__(29927);
var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js
var setAttributesWithoutAttributes = __webpack_require__(68323);
var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/insertStyleElement.js
var insertStyleElement = __webpack_require__(53062);
var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/styleTagTransform.js
var styleTagTransform = __webpack_require__(84051);
var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform);
// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/common/components/ui/Popover/popover.pcss
var popover = __webpack_require__(65426);
;// CONCATENATED MODULE: ./Extension/src/pages/common/components/ui/Popover/popover.pcss

      
      
      
      
      
      
      
      
      

var options = {};

options.styleTagTransform = (styleTagTransform_default());
options.setAttributes = (setAttributesWithoutAttributes_default());

      options.insert = insertBySelector_default().bind(null, "head");
    
options.domAPI = (styleDomAPI_default());
options.insertStyleElement = (insertStyleElement_default());

var update = injectStylesIntoStyleTag_default()(popover/* default */.Z, options);




       /* harmony default export */ const Popover_popover = (popover/* default */.Z && popover/* default.locals */.Z.locals ? popover/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/common/components/ui/Popover/Popover.tsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 



/**
 * Default delay before showing popover.
 */ const POPOVER_SHOW_DELAY_MS = 500;
/**
 * Wrap child container for handle tooltips rendering in overlay on hover
 */ const Popover = ({ text, delay, comingSoon, fixedWidth, children, ...props })=>{
    const defaultTooltip = {
        visible: false,
        position: null
    };
    const [tooltip, setTooltip] = (0,react.useState)(defaultTooltip);
    const timer = (0,react.useRef)();
    // clear timer on unmounting
    (0,react.useEffect)(()=>{
        return ()=>{
            clearTimeout(timer.current);
        };
    }, []);
    const handleMouseEnter = (e)=>{
        const { left, bottom } = e.currentTarget.getBoundingClientRect();
        timer.current = setTimeout(()=>{
            setTooltip({
                visible: true,
                position: {
                    x: left + window.scrollX,
                    y: bottom + window.scrollY
                }
            });
        }, delay || POPOVER_SHOW_DELAY_MS);
    };
    const handleMouseLeave = ()=>{
        clearTimeout(timer.current);
        setTooltip({
            visible: false,
            position: null
        });
    };
    const popoverClassName = comingSoon ? 'popover popover--coming-soon' : 'popover';
    return /*#__PURE__*/ react.createElement("div", {
        className: popoverClassName,
        ...props,
        onMouseEnter: handleMouseEnter,
        onMouseLeave: handleMouseLeave
    }, tooltip.visible && tooltip.position && /*#__PURE__*/ react.createElement(AttachmentPortal/* AttachmentPortal */.g, {
        rootId: "root-portal",
        position: tooltip.position
    }, /*#__PURE__*/ react.createElement(Tooltip/* Tooltip */.u, {
        text: text,
        visible: tooltip.visible,
        fixedWidth: true
    })), children);
};


/***/ }),

/***/ 70006:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "J": () => (/* reexport safe */ _Popover__WEBPACK_IMPORTED_MODULE_0__.J)
/* harmony export */ });
/* harmony import */ var _Popover__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(62606);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


/***/ }),

/***/ 11273:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "u": () => (/* reexport */ Tooltip)
});

// EXTERNAL MODULE: ./node_modules/.pnpm/react@17.0.2/node_modules/react/index.js
var react = __webpack_require__(70654);
// EXTERNAL MODULE: ./node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js
var classnames = __webpack_require__(14271);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
var injectStylesIntoStyleTag = __webpack_require__(2829);
var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/styleDomAPI.js
var styleDomAPI = __webpack_require__(65281);
var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/insertBySelector.js
var insertBySelector = __webpack_require__(29927);
var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js
var setAttributesWithoutAttributes = __webpack_require__(68323);
var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/insertStyleElement.js
var insertStyleElement = __webpack_require__(53062);
var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement);
// EXTERNAL MODULE: ./node_modules/.pnpm/style-loader@3.3.2_webpack@5.79.0/node_modules/style-loader/dist/runtime/styleTagTransform.js
var styleTagTransform = __webpack_require__(84051);
var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform);
// EXTERNAL MODULE: ./node_modules/.pnpm/css-loader@6.7.3_webpack@5.79.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/.pnpm/postcss-loader@6.1.1_postcss@8.4.12_webpack@5.79.0/node_modules/postcss-loader/dist/cjs.js!./Extension/src/pages/common/components/ui/Tooltip/tooltip.pcss
var tooltip = __webpack_require__(70540);
;// CONCATENATED MODULE: ./Extension/src/pages/common/components/ui/Tooltip/tooltip.pcss

      
      
      
      
      
      
      
      
      

var options = {};

options.styleTagTransform = (styleTagTransform_default());
options.setAttributes = (setAttributesWithoutAttributes_default());

      options.insert = insertBySelector_default().bind(null, "head");
    
options.domAPI = (styleDomAPI_default());
options.insertStyleElement = (insertStyleElement_default());

var update = injectStylesIntoStyleTag_default()(tooltip/* default */.Z, options);




       /* harmony default export */ const Tooltip_tooltip = (tooltip/* default */.Z && tooltip/* default.locals */.Z.locals ? tooltip/* default.locals */.Z.locals : undefined);

;// CONCATENATED MODULE: ./Extension/src/pages/common/components/ui/Tooltip/Tooltip.tsx
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


const Tooltip = ({ text, visible, fixedWidth })=>{
    return /*#__PURE__*/ react.createElement("div", {
        className: classnames_default()('tooltip', {
            'tooltip--on': visible,
            'tooltip--off': !visible,
            'tooltip--fixed-width': fixedWidth
        })
    }, text);
};

;// CONCATENATED MODULE: ./Extension/src/pages/common/components/ui/Tooltip/index.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


/***/ }),

/***/ 96079:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "D": () => (/* binding */ useAppearanceTheme)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70654);
/* harmony import */ var lodash_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22002);
/* harmony import */ var _common_settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(36073);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 


const useAppearanceTheme = (appearanceTheme)=>{
    (0,react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect)(()=>{
        const STORAGE_KEY = 'appearance_theme';
        const DARK_THEME_CLASS = 'dark-mode';
        const LIGHT_THEME_CLASS = 'light-mode';
        const SET_TO_STORAGE_TIMEOUT = 500;
        const throttledSetToStorage = (0,lodash_es__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)((mode)=>{
            localStorage.setItem(STORAGE_KEY, mode);
        }, SET_TO_STORAGE_TIMEOUT);
        let theme = appearanceTheme;
        if (!theme) {
            theme = localStorage.getItem(STORAGE_KEY);
        } else {
            throttledSetToStorage(theme);
        }
        switch(theme){
            case _common_settings__WEBPACK_IMPORTED_MODULE_1__/* .AppearanceTheme.Dark */ .hJ.Dark:
                {
                    document.documentElement.classList.add(DARK_THEME_CLASS);
                    document.documentElement.classList.remove(LIGHT_THEME_CLASS);
                    break;
                }
            case _common_settings__WEBPACK_IMPORTED_MODULE_1__/* .AppearanceTheme.Light */ .hJ.Light:
                {
                    document.documentElement.classList.add(LIGHT_THEME_CLASS);
                    document.documentElement.classList.remove(DARK_THEME_CLASS);
                    break;
                }
            default:
                {
                    document.documentElement.classList.remove(DARK_THEME_CLASS);
                    document.documentElement.classList.remove(LIGHT_THEME_CLASS);
                }
        }
    }, [
        appearanceTheme
    ]);
};


/***/ }),

/***/ 78424:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "O": () => (/* binding */ useOutsideClick)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70654);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const useOutsideClick = (ref, callback)=>{
    const handleClick = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((e)=>{
        if (ref.current && !ref.current.contains(e.target)) {
            callback();
        }
    }, [
        ref,
        callback
    ]);
    (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{
        document.addEventListener('click', handleClick);
        return ()=>{
            document.removeEventListener('click', handleClick);
        };
    }, [
        ref,
        handleClick
    ]);
};


/***/ }),

/***/ 39239:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "W": () => (/* binding */ useOutsideFocus)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70654);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const useOutsideFocus = (ref, callback)=>{
    const handleFocus = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((e)=>{
        if (ref.current && !ref.current.contains(e.target)) {
            callback();
        }
    }, [
        ref,
        callback
    ]);
    (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{
        document.addEventListener('focusin', handleFocus);
        return ()=>{
            document.removeEventListener('focusin', handleFocus);
        };
    }, [
        ref,
        handleFocus
    ]);
};


/***/ }),

/***/ 14921:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "U": () => (/* binding */ matchesSearch),
/* harmony export */   "k": () => (/* binding */ asyncWrapper)
/* harmony export */ });
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9008);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const matchesSearch = (filteringEvent, search)=>{
    let matches = !search || (0,_helpers__WEBPACK_IMPORTED_MODULE_0__/* .containsIgnoreCase */ .ms)(filteringEvent.requestUrl, search) || (0,_helpers__WEBPACK_IMPORTED_MODULE_0__/* .containsIgnoreCase */ .ms)(filteringEvent.element, search) || (0,_helpers__WEBPACK_IMPORTED_MODULE_0__/* .containsIgnoreCase */ .ms)(filteringEvent.cookieName, search) || (0,_helpers__WEBPACK_IMPORTED_MODULE_0__/* .containsIgnoreCase */ .ms)(filteringEvent.cookieValue, search);
    const { appliedRuleText, filterName } = filteringEvent;
    if (appliedRuleText) {
        matches = matches || (0,_helpers__WEBPACK_IMPORTED_MODULE_0__/* .containsIgnoreCase */ .ms)(appliedRuleText, search);
    }
    if (filterName) {
        matches = matches || (0,_helpers__WEBPACK_IMPORTED_MODULE_0__/* .containsIgnoreCase */ .ms)(filterName, search);
    }
    // allow to search for Tracking protection rules by the current module name and its old name
    if (filteringEvent.requestRule && filteringEvent.requestRule.isStealthModeRule || !!(filteringEvent === null || filteringEvent === void 0 ? void 0 : filteringEvent.stealthActions)) {
        matches = matches || (0,_helpers__WEBPACK_IMPORTED_MODULE_0__/* .containsIgnoreCase */ .ms)('tracking protection', search) || (0,_helpers__WEBPACK_IMPORTED_MODULE_0__/* .containsIgnoreCase */ .ms)('stealth mode', search);
    }
    return matches;
};
/**
 * Calls a callback function with async/await if the extension is MV3.
 * Otherwise, calls the callback function without async/await.
 *
 * @param callback Callback to execute.
 * @param args Arguments to pass to the callback.
 */ const asyncWrapper = async (callback, ...args)=>{
    if (true) {
        await callback(...args);
        return;
    }
    callback(...args);
};


/***/ }),

/***/ 9008:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "$8": () => (/* binding */ updateFilterDescription),
/* harmony export */   "$p": () => (/* binding */ handleFileUpload),
/* harmony export */   "Ux": () => (/* binding */ measureTextWidth),
/* harmony export */   "fQ": () => (/* binding */ isVerticalScroll),
/* harmony export */   "ms": () => (/* binding */ containsIgnoreCase),
/* harmony export */   "n$": () => (/* binding */ passiveEventSupported),
/* harmony export */   "tE": () => (/* binding */ findChunks),
/* harmony export */   "vQ": () => (/* binding */ copyToClipboard)
/* harmony export */ });
/* unused harmony export getFilenameExtension */
/* harmony import */ var core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(82514);
/* harmony import */ var core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12106);
/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _common_translators_translator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(88325);
/* harmony import */ var _options_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(78715);
/* harmony import */ var _options_stores_UiStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16877);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 




const getFilenameExtension = (filename)=>{
    if (!filename) {
        return undefined;
    }
    const parts = filename.split('.');
    if (parts.length < 2) {
        return undefined;
    }
    return parts[parts.length - 1];
};
/**
 * Handles file upload
 *
 * @param file File to upload.
 * @param requiredExtension Required file extension.
 *
 * @returns Promise that resolves with file content as string if file is uploaded successfully,
 * and rejects with error message otherwise.
 */ const handleFileUpload = (file, requiredExtension)=>{
    return new Promise((resolve, reject)=>{
        if (getFilenameExtension(file.name) !== requiredExtension) {
            reject(new Error(_common_translators_translator__WEBPACK_IMPORTED_MODULE_2__/* .translator.getMessage */ .O.getMessage('options_popup_import_settings_wrong_file_ext', {
                extension: requiredExtension
            }), {
                cause: _options_constants__WEBPACK_IMPORTED_MODULE_3__/* .FILE_WRONG_EXTENSION_CAUSE */ .w9
            }));
        }
        const reader = new FileReader();
        reader.readAsText(file, 'UTF-8');
        reader.onload = (event)=>{
            if (event.target) {
                // @ts-ignore
                resolve(event.target.result);
            }
        };
        reader.onerror = ()=>{
            reject(new Error(_common_translators_translator__WEBPACK_IMPORTED_MODULE_2__/* .translator.getMessage */ .O.getMessage('options_popup_import_error_file_description')));
        };
    });
};
const indexOfIgnoreCase = (str, searchString)=>{
    return str.toLowerCase().indexOf(searchString.toLowerCase());
};
const containsIgnoreCase = (str, searchString)=>{
    return !!(str && searchString && indexOfIgnoreCase(str, searchString) >= 0);
};
const findChunks = (str, searchString, chunks = [])=>{
    const ind = indexOfIgnoreCase(str, searchString);
    if (ind > -1) {
        chunks.push(str.slice(0, ind));
        chunks.push(str.slice(ind, ind + searchString.length));
        const restStr = str.slice(ind + searchString.length);
        if (containsIgnoreCase(restStr, searchString)) {
            findChunks(restStr, searchString, chunks);
        } else {
            chunks.push(restStr);
        }
    }
    return chunks.filter((i)=>!!i);
};
const passiveEventSupported = (()=>{
    let passiveSupported = null;
    return ()=>{
        // memoize support to avoid adding multiple test events
        if (typeof passiveSupported === 'boolean') {
            return passiveSupported;
        }
        let supported = false;
        try {
            const options = {
                get passive () {
                    supported = true;
                    return false;
                }
            };
            // @ts-ignore
            window.addEventListener('test', null, options);
            // @ts-ignore
            window.removeEventListener('test', null, options);
        } catch (err) {
            supported = false;
        }
        passiveSupported = supported;
        return passiveSupported;
    };
})();
const copyToClipboard = (text)=>{
    const textarea = document.createElement('textarea');
    textarea.innerText = text;
    // @ts-ignore
    textarea.style = `
        position: absolute;
        display: hidden;
        width: 0;
        height: 0;
    `;
    document.body.appendChild(textarea);
    textarea.select();
    document.execCommand('copy');
    textarea.remove();
};
const measureTextWidth = (text)=>{
    const el = document.createElement('p');
    el.innerText = text;
    // @ts-ignore
    el.style = `
        position: absolute;
        display: hidden;
        height: 0;
        white-space: nowrap;
        font-family: Roboto, "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, Arial, sans-serif;
        font-size: 14px;
    `;
    document.body.appendChild(el);
    const pxLength = el.clientWidth;
    el.remove();
    return pxLength;
};
/**
 * Calculates the angle of radius vector of the scroll motion
 * and detect whether scroll is vertical
 *
 * @param deltaY Wheel event deltaY value.
 * @param  deltaX Wheel event deltaX value.
 *
 * @returns True if scroll is vertical, false otherwise.
 */ const isVerticalScroll = (()=>{
    const degToRad = (deg)=>deg * (Math.PI / 180);
    const deg60ToRad = degToRad(60);
    const deg90ToRad = degToRad(90);
    const deg120ToRad = degToRad(120);
    const deg240ToRad = degToRad(240);
    const deg270ToRad = degToRad(270);
    const deg300ToRad = degToRad(300);
    return (deltaY, deltaX)=>{
        if (deltaY === 0) {
            return false;
        }
        let angle = Math.atan(deltaX / deltaY);
        angle = deltaY > 0 ? angle + deg90ToRad : angle + deg270ToRad;
        return angle > deg60ToRad && angle < deg120ToRad || angle > deg240ToRad && angle < deg300ToRad;
    };
})();
/**
 * Checks the length of the array with filters and returns the contents for notification.
 *
 * @param updatedFilters Array with updated filters.
 *
 * @returns Object with title and description describing error if `updatedFilters` is not provided,
 * otherwise description with information about updated filters.
 */ const updateFilterDescription = (updatedFilters)=>{
    if (!updatedFilters) {
        return {
            description: _common_translators_translator__WEBPACK_IMPORTED_MODULE_2__/* .translator.getMessage */ .O.getMessage('options_popup_update_error'),
            type: _options_stores_UiStore__WEBPACK_IMPORTED_MODULE_4__/* .NotificationType.ERROR */ .k.ERROR
        };
    }
    const filterNames = updatedFilters.map((filter)=>filter.name).join(', ');
    // no updated filters
    let description = `${filterNames} ${_common_translators_translator__WEBPACK_IMPORTED_MODULE_2__/* .translator.getMessage */ .O.getMessage('options_popup_update_not_found')}`;
    if (updatedFilters.length === 1) {
        description = `${filterNames} ${_common_translators_translator__WEBPACK_IMPORTED_MODULE_2__/* .translator.getMessage */ .O.getMessage('options_popup_update_filter')}`;
    } else if (updatedFilters.length > 1) {
        description = `${filterNames} ${_common_translators_translator__WEBPACK_IMPORTED_MODULE_2__/* .translator.getMessage */ .O.getMessage('options_popup_update_filters')}`;
    }
    return {
        description,
        type: _options_stores_UiStore__WEBPACK_IMPORTED_MODULE_4__/* .NotificationType.SUCCESS */ .k.SUCCESS
    };
};


/***/ }),

/***/ 58213:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "O": () => (/* binding */ getStaticWarningMessage),
/* harmony export */   "r": () => (/* binding */ getDynamicWarningMessage)
/* harmony export */ });
/* harmony import */ var _common_translators_translator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(88325);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
/**
 * Returns a warning message based on the data.
 *
 * @param data Result of limits check of static rules.
 *
 * @returns Warning message or null if the data is invalid.
 */ const getStaticWarningMessage = (data)=>{
    const { filtersCount, rulesCount, rulesRegexpsCount } = data;
    if (filtersCount) {
        if (filtersCount.expected !== undefined && filtersCount.current !== undefined) {
            return _common_translators_translator__WEBPACK_IMPORTED_MODULE_0__/* .translator.getMessage */ .O.getMessage('options_all_limits_exceeded_warning', {
                current: filtersCount.current,
                expected: filtersCount.expected
            });
        }
        if (filtersCount.maximum !== undefined && filtersCount.current !== undefined) {
            return _common_translators_translator__WEBPACK_IMPORTED_MODULE_0__/* .translator.getMessage */ .O.getMessage('options_limits_warning_static_filters', {
                current: filtersCount.current,
                maximum: filtersCount.maximum
            });
        }
    }
    if (rulesCount) {
        return _common_translators_translator__WEBPACK_IMPORTED_MODULE_0__/* .translator.getMessage */ .O.getMessage('options_limits_warning_static_rules', {
            current: rulesCount.current,
            maximum: rulesCount.maximum
        });
    }
    if (rulesRegexpsCount) {
        return _common_translators_translator__WEBPACK_IMPORTED_MODULE_0__/* .translator.getMessage */ .O.getMessage('options_limits_warning_static_regex_rules', {
            current: rulesRegexpsCount.current,
            maximum: rulesRegexpsCount.maximum
        });
    }
    return null;
};
/**
 * Returns a warning message based on the data.
 *
 * @param data Result of limits check of dynamic rules.
 *
 * @returns Warning message or null if the data is invalid.
 */ const getDynamicWarningMessage = (data)=>{
    const { rulesCount, rulesRegexpsCount } = data;
    if (rulesCount) {
        return _common_translators_translator__WEBPACK_IMPORTED_MODULE_0__/* .translator.getMessage */ .O.getMessage('options_limits_warning_dynamic_rules', {
            current: rulesCount.current,
            maximum: rulesCount.maximum
        });
    }
    if (rulesRegexpsCount) {
        return _common_translators_translator__WEBPACK_IMPORTED_MODULE_0__/* .translator.getMessage */ .O.getMessage('options_limits_warning_dynamic_regex_rules', {
            current: rulesRegexpsCount.current,
            maximum: rulesRegexpsCount.maximum
        });
    }
    return null;
};


/***/ }),

/***/ 78715:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "AE": () => (/* binding */ FILTERING_LOG_ASSUMED_RULE_URL),
/* harmony export */   "D2": () => (/* binding */ CHANGELOG_URL),
/* harmony export */   "Ds": () => (/* binding */ CUSTOM_FILTERS_DISABLED_IN_MV3_DUE_TO_CWS),
/* harmony export */   "Kd": () => (/* binding */ GITHUB_URL),
/* harmony export */   "Sb": () => (/* binding */ PRIVACY_URL),
/* harmony export */   "Y0": () => (/* binding */ GLOBAL_PRIVACY_CONTROL_URL),
/* harmony export */   "YH": () => (/* binding */ ACKNOWLEDGMENTS_URL),
/* harmony export */   "Z5": () => (/* binding */ DO_NOT_TRACK_URL),
/* harmony export */   "_T": () => (/* binding */ COLLECT_HITS_LEARN_MORE_URL),
/* harmony export */   "jo": () => (/* binding */ FILTER_POLICY_URL),
/* harmony export */   "kR": () => (/* binding */ ACCEPTABLE_ADS_LEARN_MORE_URL),
/* harmony export */   "l7": () => (/* binding */ HOW_TO_CREATE_RULES_URL),
/* harmony export */   "mT": () => (/* binding */ BUG_REPORT_MV3_URL),
/* harmony export */   "o6": () => (/* binding */ WEBSITE_URL),
/* harmony export */   "sn": () => (/* binding */ DISCUSS_URL),
/* harmony export */   "w9": () => (/* binding */ FILE_WRONG_EXTENSION_CAUSE)
/* harmony export */ });
/* unused harmony exports COMPARE_URL, SAFEBROWSING_LEARN_MORE_URL, BUG_REPORT_URL */
/* harmony import */ var _common_forward__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19483);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const PRIVACY_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.Privacy */ .xD.Privacy,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const ACKNOWLEDGMENTS_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.Acknowledgments */ .xD.Acknowledgments,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const GITHUB_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.Github */ .xD.Github,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const WEBSITE_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.Website */ .xD.Website,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.OptionsFooter */ .UU.OptionsFooter
});
const DISCUSS_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.Discuss */ .xD.Discuss,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const COMPARE_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.Compare */ .xD.Compare,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const CHANGELOG_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.Changelog */ .xD.Changelog,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const GLOBAL_PRIVACY_CONTROL_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.GlobalPrivacyControl */ .xD.GlobalPrivacyControl,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const DO_NOT_TRACK_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.DoNotTrack */ .xD.DoNotTrack,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const HOW_TO_CREATE_RULES_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.HowToCreateRules */ .xD.HowToCreateRules,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const FILTER_POLICY_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.FilterPolicy */ .xD.FilterPolicy,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const ACCEPTABLE_ADS_LEARN_MORE_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.SelfPromotion */ .xD.SelfPromotion,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const SAFEBROWSING_LEARN_MORE_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.ProtectionWorks */ .xD.ProtectionWorks,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const BUG_REPORT_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.BugReport */ .xD.BugReport,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const BUG_REPORT_MV3_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.BugReportMv3 */ .xD.BugReportMv3,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const FILTERING_LOG_ASSUMED_RULE_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.FilteringLogAssumedRule */ .xD.FilteringLogAssumedRule,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.FilteringLog */ .UU.FilteringLog
});
const COLLECT_HITS_LEARN_MORE_URL = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.CollectHitsLearnMore */ .xD.CollectHitsLearnMore,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const CUSTOM_FILTERS_DISABLED_IN_MV3_DUE_TO_CWS = _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .Forward.get */ .OU.get({
    action: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardAction.CustomFiltersMv3Disabled */ .xD.CustomFiltersMv3Disabled,
    from: _common_forward__WEBPACK_IMPORTED_MODULE_0__/* .ForwardFrom.Options */ .UU.Options
});
const FILE_WRONG_EXTENSION_CAUSE = 'fileWrongExtension';


/***/ }),

/***/ 56877:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "P": () => (/* binding */ optionsStorage)
});

// EXTERNAL MODULE: ./Extension/src/common/logger.ts
var logger = __webpack_require__(41512);
;// CONCATENATED MODULE: ./Extension/src/pages/options/options-storage/OptionsStorage.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}

/**
 * Module used to keep options page settings, which do not need extension level persistence
 */ class OptionsStorage {
    /**
     * Set item to storage.
     *
     * @param key Key
     * @param value Value
     */ setItem(key, value) {
        try {
            this.storage.setItem(key, JSON.stringify(value));
        } catch (e) {
            logger/* logger.debug */.k.debug(e);
        }
    }
    /**
     * Get item from storage.
     *
     * @param key Key
     */ getItem(key) {
        let storedValue = null;
        const item = this.storage.getItem(key);
        if (item !== null) {
            try {
                storedValue = JSON.parse(item);
            } catch (e) {
                logger/* logger.debug */.k.debug(e);
            }
        }
        return storedValue === null ? this.DEFAULTS[key] : storedValue;
    }
    constructor(){
        _define_property(this, "KEYS", {
            /**
         * Allowlist editor wrap setting
         */ ALLOWLIST_EDITOR_WRAP: 'allowlist-editor-wrap',
            /**
         * Filtering log columns widths
         */ COLUMNS_WIDTHS_PX: 'columns-widths-px',
            /**
         * Filtering log columns widths
         */ COLUMNS_DATA: 'columns-data',
            /**
         * Request modal width
         */ REQUEST_INFO_MODAL_WIDTH: 'request-info-modal-width'
        });
        _define_property(this, "DEFAULTS", {
            [this.KEYS.ALLOWLIST_EDITOR_WRAP]: false,
            [this.KEYS.REQUEST_INFO_MODAL_WIDTH]: null,
            [this.KEYS.COLUMNS_DATA]: {
                status: {
                    width: 260
                },
                url: {
                    width: 260
                },
                type: {
                    width: 100
                },
                rule: {
                    width: 260
                },
                filter: {
                    width: 260
                },
                source: {
                    width: 200
                }
            }
        });
        /**
     * Storage object
     */ _define_property(this, "storage", void 0);
        this.storage = localStorage;
    }
}

;// CONCATENATED MODULE: ./Extension/src/pages/options/options-storage/index.ts
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ 
const optionsStorage = new OptionsStorage();


/***/ }),

/***/ 16877:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */   "k": () => (/* binding */ NotificationType)
/* harmony export */ });
/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12106);
/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(82514);
/* harmony import */ var core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_error_cause_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1299);
/* harmony import */ var nanoid__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(61512);
/* harmony import */ var _components_Warnings_messages__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(58213);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _ts_decorate(decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
}




// TODO: Maybe not import from components folder here?

var NotificationType = /*#__PURE__*/ function(NotificationType) {
    NotificationType["SUCCESS"] = "success";
    NotificationType["ERROR"] = "error";
    return NotificationType;
}({});
class UiStore {
    addNotification({ description, type, extra }) {
        const id = (0,nanoid__WEBPACK_IMPORTED_MODULE_3__/* .nanoid */ .x0)();
        this.notifications.push({
            id,
            description,
            extra,
            type
        });
        return id;
    }
    removeNotification(id) {
        this.notifications = this.notifications.filter((notification)=>notification.id !== id);
    }
    /**
     * Sets the loader visibility state. **Used for mv3**
     *
     * @param value Loader visibility state. Default value is false.
     */ setShowLoader(value = false) {
        this.showLoader = value;
    }
    /**
     * Sets a specific limit warning message to be displayed about static filters.
     *
     * @throws Error if the warning type is incorrect.
     *
     * @param data Result of limits check of static rules.
     */ setStaticFiltersLimitsWarning(data) {
        if (!data) {
            this.staticFiltersLimitsWarning = null;
            return;
        }
        if (data.type !== 'static') {
            throw new Error('Incorrect warning type');
        }
        this.staticFiltersLimitsWarning = (0,_components_Warnings_messages__WEBPACK_IMPORTED_MODULE_2__/* .getStaticWarningMessage */ .O)(data);
    }
    /**
     * Sets a specific limit warning message to be displayed about dynamic section with user rules.
     *
     * @throws Error if the warning type is incorrect.
     *
     * @param data Result of limits check of dynamic rules.
     */ setDynamicRulesLimitsWarning(data) {
        if (!data) {
            this.dynamicRulesLimitsWarning = null;
            return;
        }
        if (data.type !== 'dynamic') {
            throw new Error('Incorrect warning type');
        }
        this.dynamicRulesLimitsWarning = (0,_components_Warnings_messages__WEBPACK_IMPORTED_MODULE_2__/* .getDynamicWarningMessage */ .r)(data);
    }
    constructor(rootStore){
        /**
     * Root store instance. Added in advance, even though it is not used.
     */ _define_property(this, "rootStore", void 0);
        /**
     * Notifications list
     */ _define_property(this, "notifications", []);
        /**
     * Loader visibility state. **Used for mv3**.
     */ _define_property(this, "showLoader", false);
        /**
     * Specific limits warning message to be displayed about static filters.
     */ _define_property(this, "staticFiltersLimitsWarning", null);
        /**
     * Specific limits warning message to be displayed about dynamic section with user rules.
     */ _define_property(this, "dynamicRulesLimitsWarning", null);
        this.rootStore = rootStore;
        (0,mobx__WEBPACK_IMPORTED_MODULE_4__/* .makeObservable */ .rC)(this);
        this.setShowLoader = this.setShowLoader.bind(this);
        this.setStaticFiltersLimitsWarning = this.setStaticFiltersLimitsWarning.bind(this);
        this.setDynamicRulesLimitsWarning = this.setDynamicRulesLimitsWarning.bind(this);
    }
}
_ts_decorate([
    mobx__WEBPACK_IMPORTED_MODULE_4__/* .observable */ .LO
], UiStore.prototype, "notifications", void 0);
_ts_decorate([
    mobx__WEBPACK_IMPORTED_MODULE_4__/* .observable */ .LO
], UiStore.prototype, "showLoader", void 0);
_ts_decorate([
    mobx__WEBPACK_IMPORTED_MODULE_4__/* .observable */ .LO
], UiStore.prototype, "staticFiltersLimitsWarning", void 0);
_ts_decorate([
    mobx__WEBPACK_IMPORTED_MODULE_4__/* .observable */ .LO
], UiStore.prototype, "dynamicRulesLimitsWarning", void 0);
_ts_decorate([
    mobx__WEBPACK_IMPORTED_MODULE_4__/* .action */ .aD
], UiStore.prototype, "addNotification", null);
_ts_decorate([
    mobx__WEBPACK_IMPORTED_MODULE_4__/* .action */ .aD
], UiStore.prototype, "removeNotification", null);
_ts_decorate([
    mobx__WEBPACK_IMPORTED_MODULE_4__/* .action */ .aD
], UiStore.prototype, "setShowLoader", null);
_ts_decorate([
    mobx__WEBPACK_IMPORTED_MODULE_4__/* .action */ .aD
], UiStore.prototype, "setStaticFiltersLimitsWarning", null);
_ts_decorate([
    mobx__WEBPACK_IMPORTED_MODULE_4__/* .action */ .aD
], UiStore.prototype, "setDynamicRulesLimitsWarning", null);
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (UiStore);


/***/ }),

/***/ 13979:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "T": () => (/* binding */ Page),
/* harmony export */   "d": () => (/* binding */ messenger)
/* harmony export */ });
/* harmony import */ var webextension_polyfill__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70914);
/* harmony import */ var webextension_polyfill__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(webextension_polyfill__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var nanoid__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(61512);
/* harmony import */ var _common_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41512);
/* harmony import */ var _common_messages__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(54633);
/**
 * @file
 * This file is part of AdGuard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
 *
 * AdGuard Browser Extension is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AdGuard Browser Extension is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
 */ function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}




var Page = /*#__PURE__*/ function(Page) {
    Page["FullscreenUserRules"] = "fullscreen-user-rules";
    Page["FilteringLog"] = "filtering-log";
    return Page;
}({});
/**
 * Messenger class, used to communicate with the background page from the UI.
 * Actually, it's a wrapper around the browser.runtime.sendMessage method.
 */ class Messenger {
    /**
     * Sends a message to the background page.
     *
     * All messages described in the {@link MessageType} enum.
     * All answers described in the {@link MessageMap} type.
     *
     * @param type Message type.
     * @param data Message data. Optional because not all messages have data.
     *
     * @returns Promise that resolves with the response from the background page.
     * Type of the response depends on the message type. Go to {@link MessageMap}
     * to see all possible message types and their responses.
     */ // eslint-disable-next-line class-methods-use-this
    async sendMessage(type, data) {
        const response = await webextension_polyfill__WEBPACK_IMPORTED_MODULE_0___default().runtime.sendMessage({
            handlerName: _common_messages__WEBPACK_IMPORTED_MODULE_2__/* .APP_MESSAGE_HANDLER_NAME */ .ZA,
            type,
            data
        });
        return response;
    }
    /**
     * Sends a message from background page to update listeners on the UI.
     *
     * @returns Promise that resolves when the message is sent.
     */ async updateListeners() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.UpdateListeners */ .Cs.UpdateListeners);
    }
    /**
     * Sends a message to the background page to get the settings data for
     * the options page with some additional info.
     *
     * @returns Promise that resolves with the settings data for
     * the options page with some additional info.
     */ async getOptionsData() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.GetOptionsData */ .Cs.GetOptionsData);
    }
    /**
     * Sends a message to the background page to change the user setting.
     *
     * @param settingId Setting identifier.
     * @param value Setting value.
     *
     * @returns Promise that resolves after the message is sent.
     */ async changeUserSetting(settingId, value) {
        await this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.ChangeUserSettings */ .Cs.ChangeUserSettings, {
            key: settingId,
            value
        });
    }
    /**
     * Sends a message to the background page to open the extension store.
     *
     * @returns Promise that resolves after the message is sent.
     */ async openExtensionStore() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.OpenExtensionStore */ .Cs.OpenExtensionStore);
    }
    /**
     * Sends a message to the background page to open the compare page.
     *
     * @returns Promise that resolves after the message is sent.
     */ async openComparePage() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.OpenComparePage */ .Cs.OpenComparePage);
    }
    /**
     * Sends a message to the background page to enable a filter by filter id.
     *
     * @param filterId Filter identifier.
     * @returns Promise that resolves after the message is sent.
     */ async enableFilter(filterId) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.AddAndEnableFilter */ .Cs.AddAndEnableFilter, {
            filterId
        });
    }
    /**
     * Sends a message to the background page to disable a filter by filter id.
     *
     * @param filterId Filter identifier.
     * @returns Promise that resolves after the message is sent.
     */ async disableFilter(filterId) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.DisableFilter */ .Cs.DisableFilter, {
            filterId
        });
    }
    /**
     * Sends a message to the background page to apply settings from a JSON object.
     *
     * @param json JSON object representing the settings to apply.
     * @returns Promise that resolves after the message is sent.
     */ async applySettingsJson(json) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.ApplySettingsJson */ .Cs.ApplySettingsJson, {
            json
        });
    }
    /**
     * Sends a message to the background page to open the filtering log.
     *
     * @returns Promise that resolves after the message is sent.
     */ async openFilteringLog() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.OpenFilteringLog */ .Cs.OpenFilteringLog);
    }
    /**
     * Sends a message to the background page to reset the blocked ads statistics.
     *
     * @returns Promise that resolves after the message is sent.
     */ async resetStatistics() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.ResetBlockedAdsCount */ .Cs.ResetBlockedAdsCount);
    }
    /**
     * Sends a message to the background page to set the filtering log window state.
     *
     * @param windowState State of the filtering log window.
     * @returns Promise that resolves after the message is sent.
     */ async setFilteringLogWindowState(windowState) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.SetFilteringLogWindowState */ .Cs.SetFilteringLogWindowState, {
            windowState
        });
    }
    /**
     * Sends a message to the background page to reset the settings.
     *
     * @returns Promise that resolves after the message is sent.
     */ async resetSettings() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.ResetSettings */ .Cs.ResetSettings);
    }
    /**
     * Sends a message to the background page to get the user rules.
     *
     * @returns Promise that resolves with the user rules.
     */ async getUserRules() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.GetUserRules */ .Cs.GetUserRules);
    }
    /**
     * Sends a message to the background page to save user rules.
     *
     * @param value User rules value to save.
     * @returns Promise that resolves after the message is sent.
     */ async saveUserRules(value) {
        await this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.SaveUserRules */ .Cs.SaveUserRules, {
            value
        });
    }
    /**
     * Sends a message to the background page to open user rules editor in fullscreen.
     *
     * @returns Promise that resolves after the message is sent.
     */ async openFullscreenUserRules() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.OpenFullscreenUserRules */ .Cs.OpenFullscreenUserRules);
    }
    /**
     * Sends a message to the background page to get the allowlist domains.
     *
     * @returns Promise that resolves with the list of allowlist domains.
     */ async getAllowlist() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.GetAllowlistDomains */ .Cs.GetAllowlistDomains);
    }
    /**
     * Sends a message to the background page to save the allowlist domains.
     *
     * @param value Allowlist domains value to save.
     * @returns Promise that resolves after the message is sent.
     */ async saveAllowlist(value) {
        await this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.SaveAllowlistDomains */ .Cs.SaveAllowlistDomains, {
            value
        });
    }
    /**
     * Sends a message to the background page to mark a notification as viewed.
     *
     * @param withDelay Whether the notification should be marked as viewed after a delay.
     * @returns Promise that resolves after the message is sent.
     */ async setNotificationViewed(withDelay) {
        await this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.SetNotificationViewed */ .Cs.SetNotificationViewed, {
            withDelay
        });
    }
    /**
     * Sends a message to the background page to update filters.
     *
     * @returns Promise that resolves with the list of filters.
     */ async updateFilters() {
        if (true) {
            _common_logger__WEBPACK_IMPORTED_MODULE_1__/* .logger.debug */ .k.debug('Filters update is not supported in MV3');
            return [];
        }
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.CheckFiltersUpdate */ .Cs.CheckFiltersUpdate);
    }
    /**
     * Sends a message to the background page to update the status of a filter group.
     *
     * @param id Group identifier.
     * @param enabled Whether the group should be enabled or disabled.
     * @returns Promise that resolves after the message is sent.
     */ async updateGroupStatus(id, enabled) {
        const type = enabled ? _common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.EnableFiltersGroup */ .Cs.EnableFiltersGroup : _common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.DisableFiltersGroup */ .Cs.DisableFiltersGroup;
        const groupId = Number.parseInt(id, 10);
        return this.sendMessage(type, {
            groupId
        });
    }
    /**
     * Sends a message to the background page to set consented filters.
     *
     * @param filterIds List of filter identifiers.
     * @returns Promise that resolves after the message is sent.
     */ async setConsentedFilters(filterIds) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.SetConsentedFilters */ .Cs.SetConsentedFilters, {
            filterIds
        });
    }
    /**
     * Sends a message to the background page to check if a filter is consented.
     *
     * @param filterId Filter identifier.
     * @returns Promise that resolves with the result of the check.
     */ async getIsConsentedFilter(filterId) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.GetIsConsentedFilter */ .Cs.GetIsConsentedFilter, {
            filterId
        });
    }
    /**
     * Sends a message to the background page to check a custom filter URL.
     *
     * @param url Custom filter URL.
     * @returns Promise that resolves with the result of the check.
     */ async checkCustomUrl(url) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.LoadCustomFilterInfo */ .Cs.LoadCustomFilterInfo, {
            url
        });
    }
    /**
     * Sends a message to the background page to add a custom filter.
     *
     * @param {CustomFilterSubscriptionData} filter Custom filter data.
     *
     * @returns {Promise<CustomFilterMetadata>} Custom filter metadata.
     */ async addCustomFilter(filter) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.SubscribeToCustomFilter */ .Cs.SubscribeToCustomFilter, {
            filter
        });
    }
    /**
     * Sends a message to the background page to remove a custom filter.
     *
     * @param filterId Custom filter ID.
     *
     * @returns Promise that resolves after the filter is removed.
     */ async removeCustomFilter(filterId) {
        await this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.RemoveAntiBannerFilter */ .Cs.RemoveAntiBannerFilter, {
            filterId
        });
    }
    /**
     * Sends a message to the background page to check if the engine is started.
     *
     * @returns Promise that resolves to a boolean value:
     * true if the engine is started, false otherwise.
     */ async getIsEngineStarted() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.GetIsEngineStarted */ .Cs.GetIsEngineStarted);
    }
    /**
     * Sends a message to the background to get the tab info for the popup.
     *
     * @param tabId Tab ID.
     *
     * @returns Promise that resolves with the tab info or undefined.
     */ async getTabInfoForPopup(tabId) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.GetTabInfoForPopup */ .Cs.GetTabInfoForPopup, {
            tabId
        });
    }
    /**
     * Sends a message to the background page to change application filtering state.
     *
     * @param state Application filtering state.
     *
     * @returns Promise that resolves after the state is changed.
     */ async changeApplicationFilteringPaused(state) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.ChangeApplicationFilteringPaused */ .Cs.ChangeApplicationFilteringPaused, {
            state
        });
    }
    /**
     * Sends a message to the background page to update the theme of the fullscreen user rules.
     *
     * @param theme Theme to set.
     *
     * @returns Promise that resolves after the theme is updated.
     */ async updateFullscreenUserRulesTheme(theme) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.UpdateFullscreenUserRulesTheme */ .Cs.UpdateFullscreenUserRulesTheme, {
            theme
        });
    }
    /**
     * Sends a message to the background page to open the rules limits tab.
     *
     * @returns Promise that resolves after the tab is opened.
     */ async openRulesLimitsTab() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.OpenRulesLimitsTab */ .Cs.OpenRulesLimitsTab);
    }
    /**
     * Sends a message to the background page to open the settings tab.
     *
     * @returns Promise that resolves after the tab is opened.
     */ async openSettingsTab() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.OpenSettingsTab */ .Cs.OpenSettingsTab);
    }
    /**
     * Sends a message to the background page to open the assistant.
     *
     * @returns Promise that resolves after the assistant is opened.
     */ async openAssistant() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.OpenAssistant */ .Cs.OpenAssistant);
    }
    /**
     * Sends a message to the background page to open the abuse reporting tab for a site.
     *
     * @param url The URL of the site to report abuse for.
     * @param from The source of the request.
     *
     * @returns Promise that resolves after the tab is opened.
     */ async openAbuseSite(url, from) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.OpenAbuseTab */ .Cs.OpenAbuseTab, {
            url,
            from
        });
    }
    /**
     * Sends a message to the background page to check site security.
     *
     * @param url The URL of the site to check.
     * @param from The source of the request.
     *
     * @returns Promise that resolves with the site security info.
     */ async checkSiteSecurity(url, from) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.OpenSiteReportTab */ .Cs.OpenSiteReportTab, {
            url,
            from
        });
    }
    /**
     * Sends a message to the background page to reset user rules for a specific page.
     *
     * @param url The URL of the page.
     *
     * @returns Promise that resolves after the user rules are reset.
     */ async resetUserRulesForPage(url) {
        const [currentTab] = await webextension_polyfill__WEBPACK_IMPORTED_MODULE_0___default().tabs.query({
            active: true,
            currentWindow: true
        });
        if (!(currentTab === null || currentTab === void 0 ? void 0 : currentTab.id)) {
            _common_logger__WEBPACK_IMPORTED_MODULE_1__/* .logger.debug */ .k.debug('[resetUserRulesForPage]: cannot get current tab id');
            return;
        }
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.ResetUserRulesForPage */ .Cs.ResetUserRulesForPage, {
            url,
            tabId: currentTab === null || currentTab === void 0 ? void 0 : currentTab.id
        });
    }
    /**
     * Sends a message to the background page to remove an allowlist domain.
     *
     * @param tabId The ID of the tab.
     * @param tabRefresh Whether the tab should be refreshed.
     *
     * @returns Promise that resolves after the domain is removed.
     */ async removeAllowlistDomain(tabId, tabRefresh) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.RemoveAllowlistDomain */ .Cs.RemoveAllowlistDomain, {
            tabId,
            tabRefresh
        });
    }
    /**
     * Sends a message to the background page to add an allowlist domain.
     *
     * @param tabId The ID of the tab.
     *
     * @returns Promise that resolves after the domain is added.
     */ async addAllowlistDomain(tabId) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.AddAllowlistDomain */ .Cs.AddAllowlistDomain, {
            tabId
        });
    }
    /**
     * Works only in MV2, since MV3 doesn't support filtering log yet.
     *
     * @returns Promise that resolves after the filtering log page is opened.
     */ async onOpenFilteringLogPage() {
        await this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.OnOpenFilteringLogPage */ .Cs.OnOpenFilteringLogPage);
    }
    /**
     * Sends a message to the background page to get filtering log data.
     *
     * @returns Promise that resolves with filtering log data.
     */ async getFilteringLogData() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.GetFilteringLogData */ .Cs.GetFilteringLogData);
    }
    /**
     * Sends a message to the background page to close the filtering log page.
     *
     * @returns Promise that resolves after the page is closed.
     */ async onCloseFilteringLogPage() {
        await this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.OnCloseFilteringLogPage */ .Cs.OnCloseFilteringLogPage);
    }
    /**
     * Sends a message to the background page to get filtering info by tab ID.
     *
     * @param tabId The ID of the tab.
     *
     * @returns Promise that resolves with filtering info about the tab.
     */ async getFilteringInfoByTabId(tabId) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.GetFilteringInfoByTabId */ .Cs.GetFilteringInfoByTabId, {
            tabId
        });
    }
    /**
     * Sends a message to the background page to synchronize the list of open tabs.
     *
     * @returns Promise that resolves with an array of filtering info about open tabs.
     */ async synchronizeOpenTabs() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.SynchronizeOpenTabs */ .Cs.SynchronizeOpenTabs);
    }
    /**
     * Sends a message to the background page to clear events by tab ID.
     *
     * @param tabId The ID of the tab.
     * @param ignorePreserveLog Optional flag to ignore the preserve log state.
     *
     * @returns Promise that resolves after the events are cleared.
     */ async clearEventsByTabId(tabId, ignorePreserveLog) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.ClearEventsByTabId */ .Cs.ClearEventsByTabId, {
            tabId,
            ignorePreserveLog
        });
    }
    /**
     * Sends a message to the background page to refresh the current page by tab ID.
     *
     * @param tabId The ID of the tab.
     *
     * @returns Promise that resolves after the page is refreshed.
     */ async refreshPage(tabId) {
        await this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.RefreshPage */ .Cs.RefreshPage, {
            tabId
        });
    }
    /**
     * Sends a message to the background page to add a user rule.
     *
     * @param ruleText User rule text to be added.
     *
     * @returns Promise that resolves after the message is sent.
     */ async addUserRule(ruleText) {
        await this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.AddUserRule */ .Cs.AddUserRule, {
            ruleText
        });
    }
    /**
     * Sends a message to the background page to remove a user rule.
     *
     * @param ruleText User rule text to be removed.
     *
     * @returns Promise that resolves after the message is sent.
     */ async removeUserRule(ruleText) {
        await this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.RemoveUserRule */ .Cs.RemoveUserRule, {
            ruleText
        });
    }
    /**
     * Sends a message to the background page to set the preserve log state.
     *
     * @param state State indicating whether to preserve the log.
     *
     * @returns Promise that resolves after the message is sent.
     */ async setPreserveLogState(state) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.SetPreserveLogState */ .Cs.SetPreserveLogState, {
            state
        });
    }
    /**
     * Sends a message to the background page to get the editor storage content.
     *
     * @returns Promise that resolves with the editor storage content.
     */ async getEditorStorageContent() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.GetEditorStorageContent */ .Cs.GetEditorStorageContent);
    }
    /**
     * Sends a message to the background page to set the editor storage content.
     *
     * @param content Content to be stored in the editor.
     *
     * @returns Promise that resolves after the message is sent.
     */ async setEditorStorageContent(content) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.SetEditorStorageContent */ .Cs.SetEditorStorageContent, {
            content
        });
    }
    /**
     * Sends a message to the background page to get the rules limits counters for MV3.
     *
     * @returns Promise that resolves with the rules limits counters for MV3.
     */ async getRulesLimitsCounters() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.GetRulesLimitsCountersMv3 */ .Cs.GetRulesLimitsCountersMv3);
    }
    /**
     * Sends a message to the background page to check if it is possible to enable a static filter.
     *
     * @param filterId Filter ID to check.
     *
     * @returns Promise that resolves with the result of the static filter check.
     * @throws Error If the filter is not static.
     */ async canEnableStaticFilter(filterId) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.CanEnableStaticFilterMv3 */ .Cs.CanEnableStaticFilterMv3, {
            filterId
        });
    }
    /**
     * Sends a message to the background page to check if all dynamic rules for a user rules' group can be enabled.
     *
     * @param groupId Group identifier to check.
     *
     * @returns Promise that resolves with the result of the static group check.
     */ async canEnableStaticGroup(groupId) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.CanEnableStaticGroupMv3 */ .Cs.CanEnableStaticGroupMv3, {
            groupId
        });
    }
    /**
     * Sends a message to the background page to get the current static filters limits.
     *
     * @returns Promise that resolves with the current static filters limits.
     */ async getCurrentLimits() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.CurrentLimitsMv3 */ .Cs.CurrentLimitsMv3);
    }
    /**
     * Sends a message to the background page to check if the request filter is ready.
     *
     * @returns Promise that resolves to a boolean indicating if the request filter is ready.
     */ async checkRequestFilterReady() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.CheckRequestFilterReady */ .Cs.CheckRequestFilterReady);
    }
    /**
     * Sends a message to the background page to add a URL to the trusted list.
     *
     * @param url URL to be added to the trusted list.
     *
     * @returns Promise that resolves after the message is sent.
     */ async addUrlToTrusted(url) {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.AddUrlToTrusted */ .Cs.AddUrlToTrusted, {
            url
        });
    }
    /**
     * Sends a message to the background page to get user rules editor data.
     *
     * @returns Promise that resolves with the user rules editor data.
     */ async getUserRulesEditorData() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.GetUserRulesEditorData */ .Cs.GetUserRulesEditorData);
    }
    /**
     * Sends a message to the background page to restore filters in MV3.
     *
     * @returns Promise that resolves after the message is sent.
     */ async restoreFiltersMv3() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.RestoreFiltersMv3 */ .Cs.RestoreFiltersMv3);
    }
    /**
     * Sends a message to the background page to clear the rules limits warning in MV3.
     *
     * @returns Promise that resolves after the message is sent.
     */ async clearRulesLimitsWarningMv3() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.ClearRulesLimitsWarningMv3 */ .Cs.ClearRulesLimitsWarningMv3);
    }
    /**
     * Sends a message to the background page to get the allowlist domains.
     *
     * @returns Promise that resolves with the allowlist domains.
     */ async getAllowlistDomains() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.GetAllowlistDomains */ .Cs.GetAllowlistDomains);
    }
    /**
     * Sends a message to the background page to load the settings JSON.
     *
     * @returns Promise that resolves with the loaded settings JSON.
     */ async loadSettingsJson() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.LoadSettingsJson */ .Cs.LoadSettingsJson);
    }
    /**
     * Sends a message to the background page to open the thank you page.
     *
     * @returns Promise that resolves after the message is sent.
     */ async openThankyouPage() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.OpenThankyouPage */ .Cs.OpenThankyouPage);
    }
    /**
     * Sends a message to the background page to initialize the frame script.
     *
     * @returns Promise that resolves with the initialization data for the frame script.
     */ async initializeFrameScript() {
        return this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.InitializeFrameScript */ .Cs.InitializeFrameScript);
    }
    /**
     * Creates an instance of the Messenger class.
     */ constructor(){
        _define_property(this, "onMessage", (webextension_polyfill__WEBPACK_IMPORTED_MODULE_0___default().runtime.onMessage));
        /**
     * Creates long-lived connections between popup and background page.
     *
     * @param page Page name.
     * @param events List of events to which subscribe.
     * @param callback Callback called when event fires.
     *
     * @returns Function to remove listener on unload.
     */ _define_property(this, "createLongLivedConnection", (page, events, callback)=>{
            let port;
            let forceDisconnected = false;
            const connect = ()=>{
                port = webextension_polyfill__WEBPACK_IMPORTED_MODULE_0___default().runtime.connect({
                    name: `${page}_${(0,nanoid__WEBPACK_IMPORTED_MODULE_3__/* .nanoid */ .x0)()}`
                });
                port.postMessage({
                    type: _common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.AddLongLivedConnection */ .Cs.AddLongLivedConnection,
                    data: {
                        events
                    }
                });
                port.onMessage.addListener((message)=>{
                    if (!(0,_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .messageHasTypeField */ .XZ)(message)) {
                        _common_logger__WEBPACK_IMPORTED_MODULE_1__/* .logger.warn */ .k.warn('Received message in Messenger.createLongLivedConnection has no type field: ', message);
                        return;
                    }
                    if (message.type === _common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.NotifyListeners */ .Cs.NotifyListeners) {
                        if (!(0,_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .messageHasTypeAndDataFields */ .D5)(message)) {
                            _common_logger__WEBPACK_IMPORTED_MODULE_1__/* .logger.warn */ .k.warn('Received message with type MessageType.NotifyListeners has no data: ', message);
                            return;
                        }
                        const castedMessage = message;
                        const [type, ...data] = castedMessage.data;
                        callback({
                            type,
                            data
                        });
                    }
                });
                port.onDisconnect.addListener(()=>{
                    if ((webextension_polyfill__WEBPACK_IMPORTED_MODULE_0___default().runtime.lastError)) {
                        _common_logger__WEBPACK_IMPORTED_MODULE_1__/* .logger.error */ .k.error((webextension_polyfill__WEBPACK_IMPORTED_MODULE_0___default().runtime.lastError.message));
                    }
                    // we try to connect again if the background page was terminated
                    if (!forceDisconnected) {
                        connect();
                    }
                });
            };
            connect();
            const onUnload = ()=>{
                if (port) {
                    forceDisconnected = true;
                    port.disconnect();
                }
            };
            window.addEventListener('beforeunload', onUnload);
            window.addEventListener('unload', onUnload);
            return onUnload;
        });
        /**
     * Method subscribes to notifier module events.
     *
     * @param events List of events to which subscribe.
     * @param callback Callback called when event fires.
     * @param onUnloadCallback Callback used to remove listener on unload.
     *
     * @returns Function to remove listener on unload.
     */ _define_property(this, "createEventListener", async (events, callback, onUnloadCallback)=>{
            let listenerId;
            const response = await this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.CreateEventListener */ .Cs.CreateEventListener, {
                events
            });
            listenerId = response.listenerId;
            const onUpdateListeners = async ()=>{
                const updatedResponse = await this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.CreateEventListener */ .Cs.CreateEventListener, {
                    events
                });
                listenerId = updatedResponse.listenerId;
            };
            webextension_polyfill__WEBPACK_IMPORTED_MODULE_0___default().runtime.onMessage.addListener((message)=>{
                if (!(0,_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .messageHasTypeField */ .XZ)(message)) {
                    _common_logger__WEBPACK_IMPORTED_MODULE_1__/* .logger.warn */ .k.warn('Received message in Messenger.createEventListener has no type field: ', message);
                    return undefined;
                }
                if (message.type === _common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.NotifyListeners */ .Cs.NotifyListeners) {
                    if (!(0,_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .messageHasTypeAndDataFields */ .D5)(message)) {
                        _common_logger__WEBPACK_IMPORTED_MODULE_1__/* .logger.warn */ .k.warn('Received message with type MessageType.NotifyListeners has no data: ', message);
                        return undefined;
                    }
                    const castedMessage = message;
                    const [type, ...data] = castedMessage.data;
                    callback({
                        type,
                        data
                    });
                }
                if (message.type === _common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.UpdateListeners */ .Cs.UpdateListeners) {
                    onUpdateListeners();
                }
            });
            const onUnload = ()=>{
                if (!listenerId) {
                    return;
                }
                this.sendMessage(_common_messages__WEBPACK_IMPORTED_MODULE_2__/* .MessageType.RemoveListener */ .Cs.RemoveListener, {
                    listenerId
                });
                listenerId = null;
                if (typeof onUnloadCallback === 'function') {
                    onUnloadCallback();
                }
            };
            window.addEventListener('beforeunload', onUnload);
            window.addEventListener('unload', onUnload);
            return onUnload;
        });
        this.resetUserRulesForPage = this.resetUserRulesForPage.bind(this);
        this.updateFilters = this.updateFilters.bind(this);
        this.removeAllowlistDomain = this.removeAllowlistDomain.bind(this);
        this.addAllowlistDomain = this.addAllowlistDomain.bind(this);
    }
}
const messenger = new Messenger();



/***/ }),

/***/ 21172:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Y": () => (/* binding */ Logger),
/* harmony export */   "i": () => (/* binding */ LogLevel)
/* harmony export */ });
/**
 * Checks if error has message.
 *
 * @param error Error object.
 * @returns True if error has message.
 */
function isErrorWithMessage(error) {
    return (typeof error === 'object'
        && error !== null
        && 'message' in error
        && typeof error.message === 'string');
}
/**
 * Converts error to the error with a message.
 *
 * @param maybeError Possible error.
 * @returns Error with a message.
 */
function toErrorWithMessage(maybeError) {
    if (isErrorWithMessage(maybeError)) {
        return maybeError;
    }
    try {
        return new Error(JSON.stringify(maybeError));
    }
    catch {
        // fallback in case there's an error stringifying the maybeError
        // like with circular references, for example.
        return new Error(String(maybeError));
    }
}
/**
 * Converts an error object to an error with a message. This method might be helpful to handle thrown errors.
 *
 * @param error Error object.
 *
 * @returns Message of the error.
 */
function getErrorMessage(error) {
    return toErrorWithMessage(error).message;
}

/**
 * Pads a number with leading zeros.
 * @param num The number to pad.
 * @param size The number of digits to pad to.
 * @returns The padded number.
 */
const pad = (num, size = 2) => {
    return num.toString().padStart(size, '0');
};
/**
 * Formats a date into an ISO 8601-like string with milliseconds.
 *
 * @param {Date|number} date The date object or timestamp to format.
 * @returns {string} The formatted date string.
 */
const formatTime = (date) => {
    const d = (date instanceof Date) ? date : new Date(date);
    const year = d.getFullYear();
    const month = pad(d.getMonth() + 1); // Months are 0-based
    const day = pad(d.getDate());
    const hour = pad(d.getHours());
    const minute = pad(d.getMinutes());
    const second = pad(d.getSeconds());
    const millisecond = pad(d.getMilliseconds(), 3); // Milliseconds are 3 digits
    return `${year}-${month}-${day}T${hour}:${minute}:${second}:${millisecond}`;
};

/**
 * String presentation of log levels, for convenient users usage.
 */
var LogLevel;
(function (LogLevel) {
    LogLevel["Error"] = "error";
    LogLevel["Warn"] = "warn";
    LogLevel["Info"] = "info";
    LogLevel["Debug"] = "debug";
    LogLevel["Trace"] = "trace";
})(LogLevel || (LogLevel = {}));
/**
 * Log levels map, which maps number level to string level.
 */
const levelMapNumToString = {
    [1 /* LogLevelNumeric.Error */]: LogLevel.Error,
    [2 /* LogLevelNumeric.Warn */]: LogLevel.Warn,
    [3 /* LogLevelNumeric.Info */]: LogLevel.Info,
    [4 /* LogLevelNumeric.Debug */]: LogLevel.Debug,
    [5 /* LogLevelNumeric.Trace */]: LogLevel.Trace,
};
/**
 * Log levels map, which maps string level to number level.
 */
const levelMapStringToNum = Object.entries(levelMapNumToString)
    .reduce((acc, [key, value]) => {
    // Here, key is originally a string since Object.entries() returns [string, string][].
    // We need to cast the key to LogLevelNumeric correctly without causing type mismatches.
    const numericKey = Number(key);
    if (!Number.isNaN(numericKey)) {
        acc[value] = numericKey;
    }
    return acc;
}, {});
/**
 * Simple logger with log levels.
 */
class Logger {
    currentLevelValue = 3 /* LogLevelNumeric.Info */;
    writer;
    /**
     * Constructor.
     * @param writer Writer object.
     */
    constructor(writer = console) {
        this.writer = writer;
        // bind the logging methods to avoid losing context
        this.debug = this.debug.bind(this);
        this.info = this.info.bind(this);
        this.warn = this.warn.bind(this);
        this.error = this.error.bind(this);
    }
    /**
     * Print debug messages. Usually used for technical information.
     * Will be printed in 'log' channel.
     *
     * @param args Printed arguments.
     */
    debug(...args) {
        this.print(4 /* LogLevelNumeric.Debug */, "log" /* LogMethod.Log */, args);
    }
    /**
     * Print messages you want to disclose to users.
     *
     * @param args Printed arguments.
     */
    info(...args) {
        this.print(3 /* LogLevelNumeric.Info */, "info" /* LogMethod.Info */, args);
    }
    /**
     * Print warn messages.
     * NOTE: We do not use 'warn' channel, since in the extensions warn is
     * counted as error. Instead of this we use 'info' channel.
     *
     * @param args Printed arguments.
     */
    warn(...args) {
        this.print(2 /* LogLevelNumeric.Warn */, "info" /* LogMethod.Info */, args);
    }
    /**
     * Print error messages.
     *
     * @param args Printed arguments.
     */
    error(...args) {
        this.print(1 /* LogLevelNumeric.Error */, "error" /* LogMethod.Error */, args);
    }
    /**
     * Getter for log level.
     * @returns Logger level.
     */
    get currentLevel() {
        return levelMapNumToString[this.currentLevelValue];
    }
    /**
     * Setter for log level. With this method log level can be updated dynamically.
     *
     * @param logLevel Logger level.
     * @throws Error if log level is not supported.
     */
    set currentLevel(logLevel) {
        const level = levelMapStringToNum[logLevel];
        if (level === undefined) {
            throw new Error(`Logger supports only the following levels: ${[Object.values(LogLevel).join(', ')]}`);
        }
        this.currentLevelValue = level;
    }
    /**
     * Converts error to string, and adds stack trace.
     *
     * @param error Error to print.
     * @private
     * @returns Error message.
     */
    static errorToString(error) {
        const message = getErrorMessage(error);
        return `${message}\nStack trace:\n${error.stack}`;
    }
    /**
     * Wrapper over log methods.
     *
     * @param level Logger level.
     * @param method Logger method.
     * @param args Printed arguments.
     * @private
     */
    print(level, method, args) {
        // skip writing if the basic conditions are not met
        if (this.currentLevelValue < level) {
            return;
        }
        if (!args || args.length === 0 || !args[0]) {
            return;
        }
        const formattedArgs = args.map((value) => {
            if (value instanceof Error) {
                return Logger.errorToString(value);
            }
            if (value && typeof value.message === 'string') {
                return value.message;
            }
            if (typeof value === 'object' && value !== null) {
                return JSON.stringify(value);
            }
            return String(value);
        });
        const formattedTime = `${formatTime(new Date())}:`;
        /**
         * Conditions in which trace can happen:
         * 1. Method is not error (because console.error provides call stack trace)
         * 2. Log level is equal or higher that `LogLevel.Trace`.
         * 3. Writer has `trace` method.
         */
        if (method === "error" /* LogMethod.Error */
            || this.currentLevelValue < levelMapStringToNum[LogLevel.Trace]
            || !this.writer.trace) {
            // Print with regular method
            this.writer[method](formattedTime, ...formattedArgs);
            return;
        }
        if (!this.writer.groupCollapsed || !this.writer.groupEnd) {
            // Print expanded trace
            this.writer.trace(formattedTime, ...formattedArgs);
            return;
        }
        // Print collapsed trace
        this.writer.groupCollapsed(formattedTime, ...formattedArgs);
        this.writer.trace();
        this.writer.groupEnd();
    }
}




/***/ }),

/***/ 22002:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _debounce_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(72135);
/* harmony import */ var _isObject_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(62893);



/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

/**
 * Creates a throttled function that only invokes `func` at most once per
 * every `wait` milliseconds. The throttled function comes with a `cancel`
 * method to cancel delayed `func` invocations and a `flush` method to
 * immediately invoke them. Provide `options` to indicate whether `func`
 * should be invoked on the leading and/or trailing edge of the `wait`
 * timeout. The `func` is invoked with the last arguments provided to the
 * throttled function. Subsequent calls to the throttled function return the
 * result of the last `func` invocation.
 *
 * **Note:** If `leading` and `trailing` options are `true`, `func` is
 * invoked on the trailing edge of the timeout only if the throttled function
 * is invoked more than once during the `wait` timeout.
 *
 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
 *
 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
 * for details over the differences between `_.throttle` and `_.debounce`.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Function
 * @param {Function} func The function to throttle.
 * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
 * @param {Object} [options={}] The options object.
 * @param {boolean} [options.leading=true]
 *  Specify invoking on the leading edge of the timeout.
 * @param {boolean} [options.trailing=true]
 *  Specify invoking on the trailing edge of the timeout.
 * @returns {Function} Returns the new throttled function.
 * @example
 *
 * // Avoid excessively updating the position while scrolling.
 * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
 *
 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
 * jQuery(element).on('click', throttled);
 *
 * // Cancel the trailing throttled invocation.
 * jQuery(window).on('popstate', throttled.cancel);
 */
function throttle(func, wait, options) {
  var leading = true,
      trailing = true;

  if (typeof func != 'function') {
    throw new TypeError(FUNC_ERROR_TEXT);
  }
  if ((0,_isObject_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(options)) {
    leading = 'leading' in options ? !!options.leading : leading;
    trailing = 'trailing' in options ? !!options.trailing : trailing;
  }
  return (0,_debounce_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(func, wait, {
    'leading': leading,
    'maxWait': wait,
    'trailing': trailing
  });
}

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (throttle);


/***/ }),

/***/ 61512:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "x0": () => (/* binding */ nanoid)
/* harmony export */ });
/* unused harmony exports customAlphabet, customRandom, random */

let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))
let customRandom = (alphabet, defaultSize, getRandom) => {
  let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
  let step = -~((1.6 * mask * defaultSize) / alphabet.length)
  return (size = defaultSize) => {
    let id = ''
    while (true) {
      let bytes = getRandom(step)
      let j = step
      while (j--) {
        id += alphabet[bytes[j] & mask] || ''
        if (id.length === size) return id
      }
    }
  }
}
let customAlphabet = (alphabet, size = 21) =>
  customRandom(alphabet, size, random)
let nanoid = (size = 21) =>
  crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
    byte &= 63
    if (byte < 36) {
      id += byte.toString(36)
    } else if (byte < 62) {
      id += (byte - 26).toString(36).toUpperCase()
    } else if (byte > 62) {
      id += '-'
    } else {
      id += '_'
    }
    return id
  }, '')



/***/ }),

/***/ 11615:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "NL": () => (/* binding */ ZodIssueCode),
/* harmony export */   "ZP": () => (/* binding */ z),
/* harmony export */   "jm": () => (/* binding */ ZodError)
/* harmony export */ });
/* unused harmony exports BRAND, DIRTY, EMPTY_PATH, INVALID, NEVER, OK, ParseStatus, Schema, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodBranded, ZodCatch, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodEffects, ZodEnum, ZodFirstPartyTypeKind, ZodFunction, ZodIntersection, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodParsedType, ZodPipeline, ZodPromise, ZodReadonly, ZodRecord, ZodSchema, ZodSet, ZodString, ZodSymbol, ZodTransformer, ZodTuple, ZodType, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, addIssueToContext, any, array, bigint, boolean, coerce, custom, date, datetimeRegex, defaultErrorMap, discriminatedUnion, effect, enum, function, getErrorMap, getParsedType, instanceof, intersection, isAborted, isAsync, isDirty, isValid, late, lazy, literal, makeIssue, map, nan, nativeEnum, never, null, nullable, number, object, objectUtil, oboolean, onumber, optional, ostring, pipeline, preprocess, promise, quotelessJson, record, set, setErrorMap, strictObject, string, symbol, transformer, tuple, undefined, union, unknown, util, void, z */
var util;
(function (util) {
    util.assertEqual = (val) => val;
    function assertIs(_arg) { }
    util.assertIs = assertIs;
    function assertNever(_x) {
        throw new Error();
    }
    util.assertNever = assertNever;
    util.arrayToEnum = (items) => {
        const obj = {};
        for (const item of items) {
            obj[item] = item;
        }
        return obj;
    };
    util.getValidEnumValues = (obj) => {
        const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
        const filtered = {};
        for (const k of validKeys) {
            filtered[k] = obj[k];
        }
        return util.objectValues(filtered);
    };
    util.objectValues = (obj) => {
        return util.objectKeys(obj).map(function (e) {
            return obj[e];
        });
    };
    util.objectKeys = typeof Object.keys === "function" // eslint-disable-line ban/ban
        ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban
        : (object) => {
            const keys = [];
            for (const key in object) {
                if (Object.prototype.hasOwnProperty.call(object, key)) {
                    keys.push(key);
                }
            }
            return keys;
        };
    util.find = (arr, checker) => {
        for (const item of arr) {
            if (checker(item))
                return item;
        }
        return undefined;
    };
    util.isInteger = typeof Number.isInteger === "function"
        ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
        : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
    function joinValues(array, separator = " | ") {
        return array
            .map((val) => (typeof val === "string" ? `'${val}'` : val))
            .join(separator);
    }
    util.joinValues = joinValues;
    util.jsonStringifyReplacer = (_, value) => {
        if (typeof value === "bigint") {
            return value.toString();
        }
        return value;
    };
})(util || (util = {}));
var objectUtil;
(function (objectUtil) {
    objectUtil.mergeShapes = (first, second) => {
        return {
            ...first,
            ...second, // second overwrites first
        };
    };
})(objectUtil || (objectUtil = {}));
const ZodParsedType = util.arrayToEnum([
    "string",
    "nan",
    "number",
    "integer",
    "float",
    "boolean",
    "date",
    "bigint",
    "symbol",
    "function",
    "undefined",
    "null",
    "array",
    "object",
    "unknown",
    "promise",
    "void",
    "never",
    "map",
    "set",
]);
const getParsedType = (data) => {
    const t = typeof data;
    switch (t) {
        case "undefined":
            return ZodParsedType.undefined;
        case "string":
            return ZodParsedType.string;
        case "number":
            return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
        case "boolean":
            return ZodParsedType.boolean;
        case "function":
            return ZodParsedType.function;
        case "bigint":
            return ZodParsedType.bigint;
        case "symbol":
            return ZodParsedType.symbol;
        case "object":
            if (Array.isArray(data)) {
                return ZodParsedType.array;
            }
            if (data === null) {
                return ZodParsedType.null;
            }
            if (data.then &&
                typeof data.then === "function" &&
                data.catch &&
                typeof data.catch === "function") {
                return ZodParsedType.promise;
            }
            if (typeof Map !== "undefined" && data instanceof Map) {
                return ZodParsedType.map;
            }
            if (typeof Set !== "undefined" && data instanceof Set) {
                return ZodParsedType.set;
            }
            if (typeof Date !== "undefined" && data instanceof Date) {
                return ZodParsedType.date;
            }
            return ZodParsedType.object;
        default:
            return ZodParsedType.unknown;
    }
};

const ZodIssueCode = util.arrayToEnum([
    "invalid_type",
    "invalid_literal",
    "custom",
    "invalid_union",
    "invalid_union_discriminator",
    "invalid_enum_value",
    "unrecognized_keys",
    "invalid_arguments",
    "invalid_return_type",
    "invalid_date",
    "invalid_string",
    "too_small",
    "too_big",
    "invalid_intersection_types",
    "not_multiple_of",
    "not_finite",
]);
const quotelessJson = (obj) => {
    const json = JSON.stringify(obj, null, 2);
    return json.replace(/"([^"]+)":/g, "$1:");
};
class ZodError extends Error {
    constructor(issues) {
        super();
        this.issues = [];
        this.addIssue = (sub) => {
            this.issues = [...this.issues, sub];
        };
        this.addIssues = (subs = []) => {
            this.issues = [...this.issues, ...subs];
        };
        const actualProto = new.target.prototype;
        if (Object.setPrototypeOf) {
            // eslint-disable-next-line ban/ban
            Object.setPrototypeOf(this, actualProto);
        }
        else {
            this.__proto__ = actualProto;
        }
        this.name = "ZodError";
        this.issues = issues;
    }
    get errors() {
        return this.issues;
    }
    format(_mapper) {
        const mapper = _mapper ||
            function (issue) {
                return issue.message;
            };
        const fieldErrors = { _errors: [] };
        const processError = (error) => {
            for (const issue of error.issues) {
                if (issue.code === "invalid_union") {
                    issue.unionErrors.map(processError);
                }
                else if (issue.code === "invalid_return_type") {
                    processError(issue.returnTypeError);
                }
                else if (issue.code === "invalid_arguments") {
                    processError(issue.argumentsError);
                }
                else if (issue.path.length === 0) {
                    fieldErrors._errors.push(mapper(issue));
                }
                else {
                    let curr = fieldErrors;
                    let i = 0;
                    while (i < issue.path.length) {
                        const el = issue.path[i];
                        const terminal = i === issue.path.length - 1;
                        if (!terminal) {
                            curr[el] = curr[el] || { _errors: [] };
                            // if (typeof el === "string") {
                            //   curr[el] = curr[el] || { _errors: [] };
                            // } else if (typeof el === "number") {
                            //   const errorArray: any = [];
                            //   errorArray._errors = [];
                            //   curr[el] = curr[el] || errorArray;
                            // }
                        }
                        else {
                            curr[el] = curr[el] || { _errors: [] };
                            curr[el]._errors.push(mapper(issue));
                        }
                        curr = curr[el];
                        i++;
                    }
                }
            }
        };
        processError(this);
        return fieldErrors;
    }
    static assert(value) {
        if (!(value instanceof ZodError)) {
            throw new Error(`Not a ZodError: ${value}`);
        }
    }
    toString() {
        return this.message;
    }
    get message() {
        return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
    }
    get isEmpty() {
        return this.issues.length === 0;
    }
    flatten(mapper = (issue) => issue.message) {
        const fieldErrors = {};
        const formErrors = [];
        for (const sub of this.issues) {
            if (sub.path.length > 0) {
                fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
                fieldErrors[sub.path[0]].push(mapper(sub));
            }
            else {
                formErrors.push(mapper(sub));
            }
        }
        return { formErrors, fieldErrors };
    }
    get formErrors() {
        return this.flatten();
    }
}
ZodError.create = (issues) => {
    const error = new ZodError(issues);
    return error;
};

const errorMap = (issue, _ctx) => {
    let message;
    switch (issue.code) {
        case ZodIssueCode.invalid_type:
            if (issue.received === ZodParsedType.undefined) {
                message = "Required";
            }
            else {
                message = `Expected ${issue.expected}, received ${issue.received}`;
            }
            break;
        case ZodIssueCode.invalid_literal:
            message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
            break;
        case ZodIssueCode.unrecognized_keys:
            message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
            break;
        case ZodIssueCode.invalid_union:
            message = `Invalid input`;
            break;
        case ZodIssueCode.invalid_union_discriminator:
            message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
            break;
        case ZodIssueCode.invalid_enum_value:
            message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
            break;
        case ZodIssueCode.invalid_arguments:
            message = `Invalid function arguments`;
            break;
        case ZodIssueCode.invalid_return_type:
            message = `Invalid function return type`;
            break;
        case ZodIssueCode.invalid_date:
            message = `Invalid date`;
            break;
        case ZodIssueCode.invalid_string:
            if (typeof issue.validation === "object") {
                if ("includes" in issue.validation) {
                    message = `Invalid input: must include "${issue.validation.includes}"`;
                    if (typeof issue.validation.position === "number") {
                        message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
                    }
                }
                else if ("startsWith" in issue.validation) {
                    message = `Invalid input: must start with "${issue.validation.startsWith}"`;
                }
                else if ("endsWith" in issue.validation) {
                    message = `Invalid input: must end with "${issue.validation.endsWith}"`;
                }
                else {
                    util.assertNever(issue.validation);
                }
            }
            else if (issue.validation !== "regex") {
                message = `Invalid ${issue.validation}`;
            }
            else {
                message = "Invalid";
            }
            break;
        case ZodIssueCode.too_small:
            if (issue.type === "array")
                message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
            else if (issue.type === "string")
                message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
            else if (issue.type === "number")
                message = `Number must be ${issue.exact
                    ? `exactly equal to `
                    : issue.inclusive
                        ? `greater than or equal to `
                        : `greater than `}${issue.minimum}`;
            else if (issue.type === "date")
                message = `Date must be ${issue.exact
                    ? `exactly equal to `
                    : issue.inclusive
                        ? `greater than or equal to `
                        : `greater than `}${new Date(Number(issue.minimum))}`;
            else
                message = "Invalid input";
            break;
        case ZodIssueCode.too_big:
            if (issue.type === "array")
                message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
            else if (issue.type === "string")
                message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
            else if (issue.type === "number")
                message = `Number must be ${issue.exact
                    ? `exactly`
                    : issue.inclusive
                        ? `less than or equal to`
                        : `less than`} ${issue.maximum}`;
            else if (issue.type === "bigint")
                message = `BigInt must be ${issue.exact
                    ? `exactly`
                    : issue.inclusive
                        ? `less than or equal to`
                        : `less than`} ${issue.maximum}`;
            else if (issue.type === "date")
                message = `Date must be ${issue.exact
                    ? `exactly`
                    : issue.inclusive
                        ? `smaller than or equal to`
                        : `smaller than`} ${new Date(Number(issue.maximum))}`;
            else
                message = "Invalid input";
            break;
        case ZodIssueCode.custom:
            message = `Invalid input`;
            break;
        case ZodIssueCode.invalid_intersection_types:
            message = `Intersection results could not be merged`;
            break;
        case ZodIssueCode.not_multiple_of:
            message = `Number must be a multiple of ${issue.multipleOf}`;
            break;
        case ZodIssueCode.not_finite:
            message = "Number must be finite";
            break;
        default:
            message = _ctx.defaultError;
            util.assertNever(issue);
    }
    return { message };
};

let overrideErrorMap = errorMap;
function setErrorMap(map) {
    overrideErrorMap = map;
}
function getErrorMap() {
    return overrideErrorMap;
}

const makeIssue = (params) => {
    const { data, path, errorMaps, issueData } = params;
    const fullPath = [...path, ...(issueData.path || [])];
    const fullIssue = {
        ...issueData,
        path: fullPath,
    };
    if (issueData.message !== undefined) {
        return {
            ...issueData,
            path: fullPath,
            message: issueData.message,
        };
    }
    let errorMessage = "";
    const maps = errorMaps
        .filter((m) => !!m)
        .slice()
        .reverse();
    for (const map of maps) {
        errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
    }
    return {
        ...issueData,
        path: fullPath,
        message: errorMessage,
    };
};
const EMPTY_PATH = [];
function addIssueToContext(ctx, issueData) {
    const overrideMap = getErrorMap();
    const issue = makeIssue({
        issueData: issueData,
        data: ctx.data,
        path: ctx.path,
        errorMaps: [
            ctx.common.contextualErrorMap,
            ctx.schemaErrorMap,
            overrideMap,
            overrideMap === errorMap ? undefined : errorMap, // then global default map
        ].filter((x) => !!x),
    });
    ctx.common.issues.push(issue);
}
class ParseStatus {
    constructor() {
        this.value = "valid";
    }
    dirty() {
        if (this.value === "valid")
            this.value = "dirty";
    }
    abort() {
        if (this.value !== "aborted")
            this.value = "aborted";
    }
    static mergeArray(status, results) {
        const arrayValue = [];
        for (const s of results) {
            if (s.status === "aborted")
                return INVALID;
            if (s.status === "dirty")
                status.dirty();
            arrayValue.push(s.value);
        }
        return { status: status.value, value: arrayValue };
    }
    static async mergeObjectAsync(status, pairs) {
        const syncPairs = [];
        for (const pair of pairs) {
            const key = await pair.key;
            const value = await pair.value;
            syncPairs.push({
                key,
                value,
            });
        }
        return ParseStatus.mergeObjectSync(status, syncPairs);
    }
    static mergeObjectSync(status, pairs) {
        const finalObject = {};
        for (const pair of pairs) {
            const { key, value } = pair;
            if (key.status === "aborted")
                return INVALID;
            if (value.status === "aborted")
                return INVALID;
            if (key.status === "dirty")
                status.dirty();
            if (value.status === "dirty")
                status.dirty();
            if (key.value !== "__proto__" &&
                (typeof value.value !== "undefined" || pair.alwaysSet)) {
                finalObject[key.value] = value.value;
            }
        }
        return { status: status.value, value: finalObject };
    }
}
const INVALID = Object.freeze({
    status: "aborted",
});
const DIRTY = (value) => ({ status: "dirty", value });
const OK = (value) => ({ status: "valid", value });
const isAborted = (x) => x.status === "aborted";
const isDirty = (x) => x.status === "dirty";
const isValid = (x) => x.status === "valid";
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;

/******************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

function __classPrivateFieldGet(receiver, state, kind, f) {
    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}

function __classPrivateFieldSet(receiver, state, value, kind, f) {
    if (kind === "m") throw new TypeError("Private method is not writable");
    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
    return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}

typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
    var e = new Error(message);
    return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};

var errorUtil;
(function (errorUtil) {
    errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
    errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
})(errorUtil || (errorUtil = {}));

var _ZodEnum_cache, _ZodNativeEnum_cache;
class ParseInputLazyPath {
    constructor(parent, value, path, key) {
        this._cachedPath = [];
        this.parent = parent;
        this.data = value;
        this._path = path;
        this._key = key;
    }
    get path() {
        if (!this._cachedPath.length) {
            if (this._key instanceof Array) {
                this._cachedPath.push(...this._path, ...this._key);
            }
            else {
                this._cachedPath.push(...this._path, this._key);
            }
        }
        return this._cachedPath;
    }
}
const handleResult = (ctx, result) => {
    if (isValid(result)) {
        return { success: true, data: result.value };
    }
    else {
        if (!ctx.common.issues.length) {
            throw new Error("Validation failed but no issues detected.");
        }
        return {
            success: false,
            get error() {
                if (this._error)
                    return this._error;
                const error = new ZodError(ctx.common.issues);
                this._error = error;
                return this._error;
            },
        };
    }
};
function processCreateParams(params) {
    if (!params)
        return {};
    const { errorMap, invalid_type_error, required_error, description } = params;
    if (errorMap && (invalid_type_error || required_error)) {
        throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
    }
    if (errorMap)
        return { errorMap: errorMap, description };
    const customMap = (iss, ctx) => {
        var _a, _b;
        const { message } = params;
        if (iss.code === "invalid_enum_value") {
            return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
        }
        if (typeof ctx.data === "undefined") {
            return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
        }
        if (iss.code !== "invalid_type")
            return { message: ctx.defaultError };
        return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
    };
    return { errorMap: customMap, description };
}
class ZodType {
    constructor(def) {
        /** Alias of safeParseAsync */
        this.spa = this.safeParseAsync;
        this._def = def;
        this.parse = this.parse.bind(this);
        this.safeParse = this.safeParse.bind(this);
        this.parseAsync = this.parseAsync.bind(this);
        this.safeParseAsync = this.safeParseAsync.bind(this);
        this.spa = this.spa.bind(this);
        this.refine = this.refine.bind(this);
        this.refinement = this.refinement.bind(this);
        this.superRefine = this.superRefine.bind(this);
        this.optional = this.optional.bind(this);
        this.nullable = this.nullable.bind(this);
        this.nullish = this.nullish.bind(this);
        this.array = this.array.bind(this);
        this.promise = this.promise.bind(this);
        this.or = this.or.bind(this);
        this.and = this.and.bind(this);
        this.transform = this.transform.bind(this);
        this.brand = this.brand.bind(this);
        this.default = this.default.bind(this);
        this.catch = this.catch.bind(this);
        this.describe = this.describe.bind(this);
        this.pipe = this.pipe.bind(this);
        this.readonly = this.readonly.bind(this);
        this.isNullable = this.isNullable.bind(this);
        this.isOptional = this.isOptional.bind(this);
    }
    get description() {
        return this._def.description;
    }
    _getType(input) {
        return getParsedType(input.data);
    }
    _getOrReturnCtx(input, ctx) {
        return (ctx || {
            common: input.parent.common,
            data: input.data,
            parsedType: getParsedType(input.data),
            schemaErrorMap: this._def.errorMap,
            path: input.path,
            parent: input.parent,
        });
    }
    _processInputParams(input) {
        return {
            status: new ParseStatus(),
            ctx: {
                common: input.parent.common,
                data: input.data,
                parsedType: getParsedType(input.data),
                schemaErrorMap: this._def.errorMap,
                path: input.path,
                parent: input.parent,
            },
        };
    }
    _parseSync(input) {
        const result = this._parse(input);
        if (isAsync(result)) {
            throw new Error("Synchronous parse encountered promise.");
        }
        return result;
    }
    _parseAsync(input) {
        const result = this._parse(input);
        return Promise.resolve(result);
    }
    parse(data, params) {
        const result = this.safeParse(data, params);
        if (result.success)
            return result.data;
        throw result.error;
    }
    safeParse(data, params) {
        var _a;
        const ctx = {
            common: {
                issues: [],
                async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
                contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
            },
            path: (params === null || params === void 0 ? void 0 : params.path) || [],
            schemaErrorMap: this._def.errorMap,
            parent: null,
            data,
            parsedType: getParsedType(data),
        };
        const result = this._parseSync({ data, path: ctx.path, parent: ctx });
        return handleResult(ctx, result);
    }
    async parseAsync(data, params) {
        const result = await this.safeParseAsync(data, params);
        if (result.success)
            return result.data;
        throw result.error;
    }
    async safeParseAsync(data, params) {
        const ctx = {
            common: {
                issues: [],
                contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
                async: true,
            },
            path: (params === null || params === void 0 ? void 0 : params.path) || [],
            schemaErrorMap: this._def.errorMap,
            parent: null,
            data,
            parsedType: getParsedType(data),
        };
        const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
        const result = await (isAsync(maybeAsyncResult)
            ? maybeAsyncResult
            : Promise.resolve(maybeAsyncResult));
        return handleResult(ctx, result);
    }
    refine(check, message) {
        const getIssueProperties = (val) => {
            if (typeof message === "string" || typeof message === "undefined") {
                return { message };
            }
            else if (typeof message === "function") {
                return message(val);
            }
            else {
                return message;
            }
        };
        return this._refinement((val, ctx) => {
            const result = check(val);
            const setError = () => ctx.addIssue({
                code: ZodIssueCode.custom,
                ...getIssueProperties(val),
            });
            if (typeof Promise !== "undefined" && result instanceof Promise) {
                return result.then((data) => {
                    if (!data) {
                        setError();
                        return false;
                    }
                    else {
                        return true;
                    }
                });
            }
            if (!result) {
                setError();
                return false;
            }
            else {
                return true;
            }
        });
    }
    refinement(check, refinementData) {
        return this._refinement((val, ctx) => {
            if (!check(val)) {
                ctx.addIssue(typeof refinementData === "function"
                    ? refinementData(val, ctx)
                    : refinementData);
                return false;
            }
            else {
                return true;
            }
        });
    }
    _refinement(refinement) {
        return new ZodEffects({
            schema: this,
            typeName: ZodFirstPartyTypeKind.ZodEffects,
            effect: { type: "refinement", refinement },
        });
    }
    superRefine(refinement) {
        return this._refinement(refinement);
    }
    optional() {
        return ZodOptional.create(this, this._def);
    }
    nullable() {
        return ZodNullable.create(this, this._def);
    }
    nullish() {
        return this.nullable().optional();
    }
    array() {
        return ZodArray.create(this, this._def);
    }
    promise() {
        return ZodPromise.create(this, this._def);
    }
    or(option) {
        return ZodUnion.create([this, option], this._def);
    }
    and(incoming) {
        return ZodIntersection.create(this, incoming, this._def);
    }
    transform(transform) {
        return new ZodEffects({
            ...processCreateParams(this._def),
            schema: this,
            typeName: ZodFirstPartyTypeKind.ZodEffects,
            effect: { type: "transform", transform },
        });
    }
    default(def) {
        const defaultValueFunc = typeof def === "function" ? def : () => def;
        return new ZodDefault({
            ...processCreateParams(this._def),
            innerType: this,
            defaultValue: defaultValueFunc,
            typeName: ZodFirstPartyTypeKind.ZodDefault,
        });
    }
    brand() {
        return new ZodBranded({
            typeName: ZodFirstPartyTypeKind.ZodBranded,
            type: this,
            ...processCreateParams(this._def),
        });
    }
    catch(def) {
        const catchValueFunc = typeof def === "function" ? def : () => def;
        return new ZodCatch({
            ...processCreateParams(this._def),
            innerType: this,
            catchValue: catchValueFunc,
            typeName: ZodFirstPartyTypeKind.ZodCatch,
        });
    }
    describe(description) {
        const This = this.constructor;
        return new This({
            ...this._def,
            description,
        });
    }
    pipe(target) {
        return ZodPipeline.create(this, target);
    }
    readonly() {
        return ZodReadonly.create(this);
    }
    isOptional() {
        return this.safeParse(undefined).success;
    }
    isNullable() {
        return this.safeParse(null).success;
    }
}
const cuidRegex = /^c[^\s-]{8,}$/i;
const cuid2Regex = /^[0-9a-z]+$/;
const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
// const uuidRegex =
//   /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
const uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
const nanoidRegex = /^[a-z0-9_-]{21}$/i;
const durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
// from https://stackoverflow.com/a/46181/1550155
// old version: too slow, didn't support unicode
// const emailRegex = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
//old email regex
// const emailRegex = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@((?!-)([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{1,})[^-<>()[\].,;:\s@"]$/i;
// eslint-disable-next-line
// const emailRegex =
//   /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/;
// const emailRegex =
//   /^[a-zA-Z0-9\.\!\#\$\%\&\'\*\+\/\=\?\^\_\`\{\|\}\~\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
// const emailRegex =
//   /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i;
const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
// const emailRegex =
//   /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9\-]+)*$/i;
// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
let emojiRegex;
// faster, simpler, safer
const ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
const ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
const base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
// simple
// const dateRegexSource = `\\d{4}-\\d{2}-\\d{2}`;
// no leap year validation
// const dateRegexSource = `\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\d|2\\d))`;
// with leap year validation
const dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
const dateRegex = new RegExp(`^${dateRegexSource}$`);
function timeRegexSource(args) {
    // let regex = `\\d{2}:\\d{2}:\\d{2}`;
    let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
    if (args.precision) {
        regex = `${regex}\\.\\d{${args.precision}}`;
    }
    else if (args.precision == null) {
        regex = `${regex}(\\.\\d+)?`;
    }
    return regex;
}
function timeRegex(args) {
    return new RegExp(`^${timeRegexSource(args)}$`);
}
// Adapted from https://stackoverflow.com/a/3143231
function datetimeRegex(args) {
    let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
    const opts = [];
    opts.push(args.local ? `Z?` : `Z`);
    if (args.offset)
        opts.push(`([+-]\\d{2}:?\\d{2})`);
    regex = `${regex}(${opts.join("|")})`;
    return new RegExp(`^${regex}$`);
}
function isValidIP(ip, version) {
    if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
        return true;
    }
    if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
        return true;
    }
    return false;
}
class ZodString extends ZodType {
    _parse(input) {
        if (this._def.coerce) {
            input.data = String(input.data);
        }
        const parsedType = this._getType(input);
        if (parsedType !== ZodParsedType.string) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.string,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        const status = new ParseStatus();
        let ctx = undefined;
        for (const check of this._def.checks) {
            if (check.kind === "min") {
                if (input.data.length < check.value) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.too_small,
                        minimum: check.value,
                        type: "string",
                        inclusive: true,
                        exact: false,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "max") {
                if (input.data.length > check.value) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.too_big,
                        maximum: check.value,
                        type: "string",
                        inclusive: true,
                        exact: false,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "length") {
                const tooBig = input.data.length > check.value;
                const tooSmall = input.data.length < check.value;
                if (tooBig || tooSmall) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    if (tooBig) {
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.too_big,
                            maximum: check.value,
                            type: "string",
                            inclusive: true,
                            exact: true,
                            message: check.message,
                        });
                    }
                    else if (tooSmall) {
                        addIssueToContext(ctx, {
                            code: ZodIssueCode.too_small,
                            minimum: check.value,
                            type: "string",
                            inclusive: true,
                            exact: true,
                            message: check.message,
                        });
                    }
                    status.dirty();
                }
            }
            else if (check.kind === "email") {
                if (!emailRegex.test(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        validation: "email",
                        code: ZodIssueCode.invalid_string,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "emoji") {
                if (!emojiRegex) {
                    emojiRegex = new RegExp(_emojiRegex, "u");
                }
                if (!emojiRegex.test(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        validation: "emoji",
                        code: ZodIssueCode.invalid_string,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "uuid") {
                if (!uuidRegex.test(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        validation: "uuid",
                        code: ZodIssueCode.invalid_string,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "nanoid") {
                if (!nanoidRegex.test(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        validation: "nanoid",
                        code: ZodIssueCode.invalid_string,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "cuid") {
                if (!cuidRegex.test(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        validation: "cuid",
                        code: ZodIssueCode.invalid_string,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "cuid2") {
                if (!cuid2Regex.test(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        validation: "cuid2",
                        code: ZodIssueCode.invalid_string,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "ulid") {
                if (!ulidRegex.test(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        validation: "ulid",
                        code: ZodIssueCode.invalid_string,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "url") {
                try {
                    new URL(input.data);
                }
                catch (_a) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        validation: "url",
                        code: ZodIssueCode.invalid_string,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "regex") {
                check.regex.lastIndex = 0;
                const testResult = check.regex.test(input.data);
                if (!testResult) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        validation: "regex",
                        code: ZodIssueCode.invalid_string,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "trim") {
                input.data = input.data.trim();
            }
            else if (check.kind === "includes") {
                if (!input.data.includes(check.value, check.position)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.invalid_string,
                        validation: { includes: check.value, position: check.position },
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "toLowerCase") {
                input.data = input.data.toLowerCase();
            }
            else if (check.kind === "toUpperCase") {
                input.data = input.data.toUpperCase();
            }
            else if (check.kind === "startsWith") {
                if (!input.data.startsWith(check.value)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.invalid_string,
                        validation: { startsWith: check.value },
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "endsWith") {
                if (!input.data.endsWith(check.value)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.invalid_string,
                        validation: { endsWith: check.value },
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "datetime") {
                const regex = datetimeRegex(check);
                if (!regex.test(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.invalid_string,
                        validation: "datetime",
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "date") {
                const regex = dateRegex;
                if (!regex.test(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.invalid_string,
                        validation: "date",
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "time") {
                const regex = timeRegex(check);
                if (!regex.test(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.invalid_string,
                        validation: "time",
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "duration") {
                if (!durationRegex.test(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        validation: "duration",
                        code: ZodIssueCode.invalid_string,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "ip") {
                if (!isValidIP(input.data, check.version)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        validation: "ip",
                        code: ZodIssueCode.invalid_string,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "base64") {
                if (!base64Regex.test(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        validation: "base64",
                        code: ZodIssueCode.invalid_string,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else {
                util.assertNever(check);
            }
        }
        return { status: status.value, value: input.data };
    }
    _regex(regex, validation, message) {
        return this.refinement((data) => regex.test(data), {
            validation,
            code: ZodIssueCode.invalid_string,
            ...errorUtil.errToObj(message),
        });
    }
    _addCheck(check) {
        return new ZodString({
            ...this._def,
            checks: [...this._def.checks, check],
        });
    }
    email(message) {
        return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
    }
    url(message) {
        return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
    }
    emoji(message) {
        return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
    }
    uuid(message) {
        return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
    }
    nanoid(message) {
        return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
    }
    cuid(message) {
        return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
    }
    cuid2(message) {
        return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
    }
    ulid(message) {
        return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
    }
    base64(message) {
        return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
    }
    ip(options) {
        return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
    }
    datetime(options) {
        var _a, _b;
        if (typeof options === "string") {
            return this._addCheck({
                kind: "datetime",
                precision: null,
                offset: false,
                local: false,
                message: options,
            });
        }
        return this._addCheck({
            kind: "datetime",
            precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
            offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
            local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
            ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
        });
    }
    date(message) {
        return this._addCheck({ kind: "date", message });
    }
    time(options) {
        if (typeof options === "string") {
            return this._addCheck({
                kind: "time",
                precision: null,
                message: options,
            });
        }
        return this._addCheck({
            kind: "time",
            precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
            ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
        });
    }
    duration(message) {
        return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
    }
    regex(regex, message) {
        return this._addCheck({
            kind: "regex",
            regex: regex,
            ...errorUtil.errToObj(message),
        });
    }
    includes(value, options) {
        return this._addCheck({
            kind: "includes",
            value: value,
            position: options === null || options === void 0 ? void 0 : options.position,
            ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
        });
    }
    startsWith(value, message) {
        return this._addCheck({
            kind: "startsWith",
            value: value,
            ...errorUtil.errToObj(message),
        });
    }
    endsWith(value, message) {
        return this._addCheck({
            kind: "endsWith",
            value: value,
            ...errorUtil.errToObj(message),
        });
    }
    min(minLength, message) {
        return this._addCheck({
            kind: "min",
            value: minLength,
            ...errorUtil.errToObj(message),
        });
    }
    max(maxLength, message) {
        return this._addCheck({
            kind: "max",
            value: maxLength,
            ...errorUtil.errToObj(message),
        });
    }
    length(len, message) {
        return this._addCheck({
            kind: "length",
            value: len,
            ...errorUtil.errToObj(message),
        });
    }
    /**
     * @deprecated Use z.string().min(1) instead.
     * @see {@link ZodString.min}
     */
    nonempty(message) {
        return this.min(1, errorUtil.errToObj(message));
    }
    trim() {
        return new ZodString({
            ...this._def,
            checks: [...this._def.checks, { kind: "trim" }],
        });
    }
    toLowerCase() {
        return new ZodString({
            ...this._def,
            checks: [...this._def.checks, { kind: "toLowerCase" }],
        });
    }
    toUpperCase() {
        return new ZodString({
            ...this._def,
            checks: [...this._def.checks, { kind: "toUpperCase" }],
        });
    }
    get isDatetime() {
        return !!this._def.checks.find((ch) => ch.kind === "datetime");
    }
    get isDate() {
        return !!this._def.checks.find((ch) => ch.kind === "date");
    }
    get isTime() {
        return !!this._def.checks.find((ch) => ch.kind === "time");
    }
    get isDuration() {
        return !!this._def.checks.find((ch) => ch.kind === "duration");
    }
    get isEmail() {
        return !!this._def.checks.find((ch) => ch.kind === "email");
    }
    get isURL() {
        return !!this._def.checks.find((ch) => ch.kind === "url");
    }
    get isEmoji() {
        return !!this._def.checks.find((ch) => ch.kind === "emoji");
    }
    get isUUID() {
        return !!this._def.checks.find((ch) => ch.kind === "uuid");
    }
    get isNANOID() {
        return !!this._def.checks.find((ch) => ch.kind === "nanoid");
    }
    get isCUID() {
        return !!this._def.checks.find((ch) => ch.kind === "cuid");
    }
    get isCUID2() {
        return !!this._def.checks.find((ch) => ch.kind === "cuid2");
    }
    get isULID() {
        return !!this._def.checks.find((ch) => ch.kind === "ulid");
    }
    get isIP() {
        return !!this._def.checks.find((ch) => ch.kind === "ip");
    }
    get isBase64() {
        return !!this._def.checks.find((ch) => ch.kind === "base64");
    }
    get minLength() {
        let min = null;
        for (const ch of this._def.checks) {
            if (ch.kind === "min") {
                if (min === null || ch.value > min)
                    min = ch.value;
            }
        }
        return min;
    }
    get maxLength() {
        let max = null;
        for (const ch of this._def.checks) {
            if (ch.kind === "max") {
                if (max === null || ch.value < max)
                    max = ch.value;
            }
        }
        return max;
    }
}
ZodString.create = (params) => {
    var _a;
    return new ZodString({
        checks: [],
        typeName: ZodFirstPartyTypeKind.ZodString,
        coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
        ...processCreateParams(params),
    });
};
// https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034
function floatSafeRemainder(val, step) {
    const valDecCount = (val.toString().split(".")[1] || "").length;
    const stepDecCount = (step.toString().split(".")[1] || "").length;
    const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
    const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
    const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
    return (valInt % stepInt) / Math.pow(10, decCount);
}
class ZodNumber extends ZodType {
    constructor() {
        super(...arguments);
        this.min = this.gte;
        this.max = this.lte;
        this.step = this.multipleOf;
    }
    _parse(input) {
        if (this._def.coerce) {
            input.data = Number(input.data);
        }
        const parsedType = this._getType(input);
        if (parsedType !== ZodParsedType.number) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.number,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        let ctx = undefined;
        const status = new ParseStatus();
        for (const check of this._def.checks) {
            if (check.kind === "int") {
                if (!util.isInteger(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.invalid_type,
                        expected: "integer",
                        received: "float",
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "min") {
                const tooSmall = check.inclusive
                    ? input.data < check.value
                    : input.data <= check.value;
                if (tooSmall) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.too_small,
                        minimum: check.value,
                        type: "number",
                        inclusive: check.inclusive,
                        exact: false,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "max") {
                const tooBig = check.inclusive
                    ? input.data > check.value
                    : input.data >= check.value;
                if (tooBig) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.too_big,
                        maximum: check.value,
                        type: "number",
                        inclusive: check.inclusive,
                        exact: false,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "multipleOf") {
                if (floatSafeRemainder(input.data, check.value) !== 0) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.not_multiple_of,
                        multipleOf: check.value,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "finite") {
                if (!Number.isFinite(input.data)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.not_finite,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else {
                util.assertNever(check);
            }
        }
        return { status: status.value, value: input.data };
    }
    gte(value, message) {
        return this.setLimit("min", value, true, errorUtil.toString(message));
    }
    gt(value, message) {
        return this.setLimit("min", value, false, errorUtil.toString(message));
    }
    lte(value, message) {
        return this.setLimit("max", value, true, errorUtil.toString(message));
    }
    lt(value, message) {
        return this.setLimit("max", value, false, errorUtil.toString(message));
    }
    setLimit(kind, value, inclusive, message) {
        return new ZodNumber({
            ...this._def,
            checks: [
                ...this._def.checks,
                {
                    kind,
                    value,
                    inclusive,
                    message: errorUtil.toString(message),
                },
            ],
        });
    }
    _addCheck(check) {
        return new ZodNumber({
            ...this._def,
            checks: [...this._def.checks, check],
        });
    }
    int(message) {
        return this._addCheck({
            kind: "int",
            message: errorUtil.toString(message),
        });
    }
    positive(message) {
        return this._addCheck({
            kind: "min",
            value: 0,
            inclusive: false,
            message: errorUtil.toString(message),
        });
    }
    negative(message) {
        return this._addCheck({
            kind: "max",
            value: 0,
            inclusive: false,
            message: errorUtil.toString(message),
        });
    }
    nonpositive(message) {
        return this._addCheck({
            kind: "max",
            value: 0,
            inclusive: true,
            message: errorUtil.toString(message),
        });
    }
    nonnegative(message) {
        return this._addCheck({
            kind: "min",
            value: 0,
            inclusive: true,
            message: errorUtil.toString(message),
        });
    }
    multipleOf(value, message) {
        return this._addCheck({
            kind: "multipleOf",
            value: value,
            message: errorUtil.toString(message),
        });
    }
    finite(message) {
        return this._addCheck({
            kind: "finite",
            message: errorUtil.toString(message),
        });
    }
    safe(message) {
        return this._addCheck({
            kind: "min",
            inclusive: true,
            value: Number.MIN_SAFE_INTEGER,
            message: errorUtil.toString(message),
        })._addCheck({
            kind: "max",
            inclusive: true,
            value: Number.MAX_SAFE_INTEGER,
            message: errorUtil.toString(message),
        });
    }
    get minValue() {
        let min = null;
        for (const ch of this._def.checks) {
            if (ch.kind === "min") {
                if (min === null || ch.value > min)
                    min = ch.value;
            }
        }
        return min;
    }
    get maxValue() {
        let max = null;
        for (const ch of this._def.checks) {
            if (ch.kind === "max") {
                if (max === null || ch.value < max)
                    max = ch.value;
            }
        }
        return max;
    }
    get isInt() {
        return !!this._def.checks.find((ch) => ch.kind === "int" ||
            (ch.kind === "multipleOf" && util.isInteger(ch.value)));
    }
    get isFinite() {
        let max = null, min = null;
        for (const ch of this._def.checks) {
            if (ch.kind === "finite" ||
                ch.kind === "int" ||
                ch.kind === "multipleOf") {
                return true;
            }
            else if (ch.kind === "min") {
                if (min === null || ch.value > min)
                    min = ch.value;
            }
            else if (ch.kind === "max") {
                if (max === null || ch.value < max)
                    max = ch.value;
            }
        }
        return Number.isFinite(min) && Number.isFinite(max);
    }
}
ZodNumber.create = (params) => {
    return new ZodNumber({
        checks: [],
        typeName: ZodFirstPartyTypeKind.ZodNumber,
        coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
        ...processCreateParams(params),
    });
};
class ZodBigInt extends ZodType {
    constructor() {
        super(...arguments);
        this.min = this.gte;
        this.max = this.lte;
    }
    _parse(input) {
        if (this._def.coerce) {
            input.data = BigInt(input.data);
        }
        const parsedType = this._getType(input);
        if (parsedType !== ZodParsedType.bigint) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.bigint,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        let ctx = undefined;
        const status = new ParseStatus();
        for (const check of this._def.checks) {
            if (check.kind === "min") {
                const tooSmall = check.inclusive
                    ? input.data < check.value
                    : input.data <= check.value;
                if (tooSmall) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.too_small,
                        type: "bigint",
                        minimum: check.value,
                        inclusive: check.inclusive,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "max") {
                const tooBig = check.inclusive
                    ? input.data > check.value
                    : input.data >= check.value;
                if (tooBig) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.too_big,
                        type: "bigint",
                        maximum: check.value,
                        inclusive: check.inclusive,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "multipleOf") {
                if (input.data % check.value !== BigInt(0)) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.not_multiple_of,
                        multipleOf: check.value,
                        message: check.message,
                    });
                    status.dirty();
                }
            }
            else {
                util.assertNever(check);
            }
        }
        return { status: status.value, value: input.data };
    }
    gte(value, message) {
        return this.setLimit("min", value, true, errorUtil.toString(message));
    }
    gt(value, message) {
        return this.setLimit("min", value, false, errorUtil.toString(message));
    }
    lte(value, message) {
        return this.setLimit("max", value, true, errorUtil.toString(message));
    }
    lt(value, message) {
        return this.setLimit("max", value, false, errorUtil.toString(message));
    }
    setLimit(kind, value, inclusive, message) {
        return new ZodBigInt({
            ...this._def,
            checks: [
                ...this._def.checks,
                {
                    kind,
                    value,
                    inclusive,
                    message: errorUtil.toString(message),
                },
            ],
        });
    }
    _addCheck(check) {
        return new ZodBigInt({
            ...this._def,
            checks: [...this._def.checks, check],
        });
    }
    positive(message) {
        return this._addCheck({
            kind: "min",
            value: BigInt(0),
            inclusive: false,
            message: errorUtil.toString(message),
        });
    }
    negative(message) {
        return this._addCheck({
            kind: "max",
            value: BigInt(0),
            inclusive: false,
            message: errorUtil.toString(message),
        });
    }
    nonpositive(message) {
        return this._addCheck({
            kind: "max",
            value: BigInt(0),
            inclusive: true,
            message: errorUtil.toString(message),
        });
    }
    nonnegative(message) {
        return this._addCheck({
            kind: "min",
            value: BigInt(0),
            inclusive: true,
            message: errorUtil.toString(message),
        });
    }
    multipleOf(value, message) {
        return this._addCheck({
            kind: "multipleOf",
            value,
            message: errorUtil.toString(message),
        });
    }
    get minValue() {
        let min = null;
        for (const ch of this._def.checks) {
            if (ch.kind === "min") {
                if (min === null || ch.value > min)
                    min = ch.value;
            }
        }
        return min;
    }
    get maxValue() {
        let max = null;
        for (const ch of this._def.checks) {
            if (ch.kind === "max") {
                if (max === null || ch.value < max)
                    max = ch.value;
            }
        }
        return max;
    }
}
ZodBigInt.create = (params) => {
    var _a;
    return new ZodBigInt({
        checks: [],
        typeName: ZodFirstPartyTypeKind.ZodBigInt,
        coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
        ...processCreateParams(params),
    });
};
class ZodBoolean extends ZodType {
    _parse(input) {
        if (this._def.coerce) {
            input.data = Boolean(input.data);
        }
        const parsedType = this._getType(input);
        if (parsedType !== ZodParsedType.boolean) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.boolean,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        return OK(input.data);
    }
}
ZodBoolean.create = (params) => {
    return new ZodBoolean({
        typeName: ZodFirstPartyTypeKind.ZodBoolean,
        coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
        ...processCreateParams(params),
    });
};
class ZodDate extends ZodType {
    _parse(input) {
        if (this._def.coerce) {
            input.data = new Date(input.data);
        }
        const parsedType = this._getType(input);
        if (parsedType !== ZodParsedType.date) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.date,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        if (isNaN(input.data.getTime())) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_date,
            });
            return INVALID;
        }
        const status = new ParseStatus();
        let ctx = undefined;
        for (const check of this._def.checks) {
            if (check.kind === "min") {
                if (input.data.getTime() < check.value) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.too_small,
                        message: check.message,
                        inclusive: true,
                        exact: false,
                        minimum: check.value,
                        type: "date",
                    });
                    status.dirty();
                }
            }
            else if (check.kind === "max") {
                if (input.data.getTime() > check.value) {
                    ctx = this._getOrReturnCtx(input, ctx);
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.too_big,
                        message: check.message,
                        inclusive: true,
                        exact: false,
                        maximum: check.value,
                        type: "date",
                    });
                    status.dirty();
                }
            }
            else {
                util.assertNever(check);
            }
        }
        return {
            status: status.value,
            value: new Date(input.data.getTime()),
        };
    }
    _addCheck(check) {
        return new ZodDate({
            ...this._def,
            checks: [...this._def.checks, check],
        });
    }
    min(minDate, message) {
        return this._addCheck({
            kind: "min",
            value: minDate.getTime(),
            message: errorUtil.toString(message),
        });
    }
    max(maxDate, message) {
        return this._addCheck({
            kind: "max",
            value: maxDate.getTime(),
            message: errorUtil.toString(message),
        });
    }
    get minDate() {
        let min = null;
        for (const ch of this._def.checks) {
            if (ch.kind === "min") {
                if (min === null || ch.value > min)
                    min = ch.value;
            }
        }
        return min != null ? new Date(min) : null;
    }
    get maxDate() {
        let max = null;
        for (const ch of this._def.checks) {
            if (ch.kind === "max") {
                if (max === null || ch.value < max)
                    max = ch.value;
            }
        }
        return max != null ? new Date(max) : null;
    }
}
ZodDate.create = (params) => {
    return new ZodDate({
        checks: [],
        coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
        typeName: ZodFirstPartyTypeKind.ZodDate,
        ...processCreateParams(params),
    });
};
class ZodSymbol extends ZodType {
    _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType !== ZodParsedType.symbol) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.symbol,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        return OK(input.data);
    }
}
ZodSymbol.create = (params) => {
    return new ZodSymbol({
        typeName: ZodFirstPartyTypeKind.ZodSymbol,
        ...processCreateParams(params),
    });
};
class ZodUndefined extends ZodType {
    _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType !== ZodParsedType.undefined) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.undefined,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        return OK(input.data);
    }
}
ZodUndefined.create = (params) => {
    return new ZodUndefined({
        typeName: ZodFirstPartyTypeKind.ZodUndefined,
        ...processCreateParams(params),
    });
};
class ZodNull extends ZodType {
    _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType !== ZodParsedType.null) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.null,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        return OK(input.data);
    }
}
ZodNull.create = (params) => {
    return new ZodNull({
        typeName: ZodFirstPartyTypeKind.ZodNull,
        ...processCreateParams(params),
    });
};
class ZodAny extends ZodType {
    constructor() {
        super(...arguments);
        // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.
        this._any = true;
    }
    _parse(input) {
        return OK(input.data);
    }
}
ZodAny.create = (params) => {
    return new ZodAny({
        typeName: ZodFirstPartyTypeKind.ZodAny,
        ...processCreateParams(params),
    });
};
class ZodUnknown extends ZodType {
    constructor() {
        super(...arguments);
        // required
        this._unknown = true;
    }
    _parse(input) {
        return OK(input.data);
    }
}
ZodUnknown.create = (params) => {
    return new ZodUnknown({
        typeName: ZodFirstPartyTypeKind.ZodUnknown,
        ...processCreateParams(params),
    });
};
class ZodNever extends ZodType {
    _parse(input) {
        const ctx = this._getOrReturnCtx(input);
        addIssueToContext(ctx, {
            code: ZodIssueCode.invalid_type,
            expected: ZodParsedType.never,
            received: ctx.parsedType,
        });
        return INVALID;
    }
}
ZodNever.create = (params) => {
    return new ZodNever({
        typeName: ZodFirstPartyTypeKind.ZodNever,
        ...processCreateParams(params),
    });
};
class ZodVoid extends ZodType {
    _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType !== ZodParsedType.undefined) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.void,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        return OK(input.data);
    }
}
ZodVoid.create = (params) => {
    return new ZodVoid({
        typeName: ZodFirstPartyTypeKind.ZodVoid,
        ...processCreateParams(params),
    });
};
class ZodArray extends ZodType {
    _parse(input) {
        const { ctx, status } = this._processInputParams(input);
        const def = this._def;
        if (ctx.parsedType !== ZodParsedType.array) {
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.array,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        if (def.exactLength !== null) {
            const tooBig = ctx.data.length > def.exactLength.value;
            const tooSmall = ctx.data.length < def.exactLength.value;
            if (tooBig || tooSmall) {
                addIssueToContext(ctx, {
                    code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
                    minimum: (tooSmall ? def.exactLength.value : undefined),
                    maximum: (tooBig ? def.exactLength.value : undefined),
                    type: "array",
                    inclusive: true,
                    exact: true,
                    message: def.exactLength.message,
                });
                status.dirty();
            }
        }
        if (def.minLength !== null) {
            if (ctx.data.length < def.minLength.value) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.too_small,
                    minimum: def.minLength.value,
                    type: "array",
                    inclusive: true,
                    exact: false,
                    message: def.minLength.message,
                });
                status.dirty();
            }
        }
        if (def.maxLength !== null) {
            if (ctx.data.length > def.maxLength.value) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.too_big,
                    maximum: def.maxLength.value,
                    type: "array",
                    inclusive: true,
                    exact: false,
                    message: def.maxLength.message,
                });
                status.dirty();
            }
        }
        if (ctx.common.async) {
            return Promise.all([...ctx.data].map((item, i) => {
                return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
            })).then((result) => {
                return ParseStatus.mergeArray(status, result);
            });
        }
        const result = [...ctx.data].map((item, i) => {
            return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
        });
        return ParseStatus.mergeArray(status, result);
    }
    get element() {
        return this._def.type;
    }
    min(minLength, message) {
        return new ZodArray({
            ...this._def,
            minLength: { value: minLength, message: errorUtil.toString(message) },
        });
    }
    max(maxLength, message) {
        return new ZodArray({
            ...this._def,
            maxLength: { value: maxLength, message: errorUtil.toString(message) },
        });
    }
    length(len, message) {
        return new ZodArray({
            ...this._def,
            exactLength: { value: len, message: errorUtil.toString(message) },
        });
    }
    nonempty(message) {
        return this.min(1, message);
    }
}
ZodArray.create = (schema, params) => {
    return new ZodArray({
        type: schema,
        minLength: null,
        maxLength: null,
        exactLength: null,
        typeName: ZodFirstPartyTypeKind.ZodArray,
        ...processCreateParams(params),
    });
};
function deepPartialify(schema) {
    if (schema instanceof ZodObject) {
        const newShape = {};
        for (const key in schema.shape) {
            const fieldSchema = schema.shape[key];
            newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
        }
        return new ZodObject({
            ...schema._def,
            shape: () => newShape,
        });
    }
    else if (schema instanceof ZodArray) {
        return new ZodArray({
            ...schema._def,
            type: deepPartialify(schema.element),
        });
    }
    else if (schema instanceof ZodOptional) {
        return ZodOptional.create(deepPartialify(schema.unwrap()));
    }
    else if (schema instanceof ZodNullable) {
        return ZodNullable.create(deepPartialify(schema.unwrap()));
    }
    else if (schema instanceof ZodTuple) {
        return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
    }
    else {
        return schema;
    }
}
class ZodObject extends ZodType {
    constructor() {
        super(...arguments);
        this._cached = null;
        /**
         * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
         * If you want to pass through unknown properties, use `.passthrough()` instead.
         */
        this.nonstrict = this.passthrough;
        // extend<
        //   Augmentation extends ZodRawShape,
        //   NewOutput extends util.flatten<{
        //     [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
        //       ? Augmentation[k]["_output"]
        //       : k extends keyof Output
        //       ? Output[k]
        //       : never;
        //   }>,
        //   NewInput extends util.flatten<{
        //     [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
        //       ? Augmentation[k]["_input"]
        //       : k extends keyof Input
        //       ? Input[k]
        //       : never;
        //   }>
        // >(
        //   augmentation: Augmentation
        // ): ZodObject<
        //   extendShape<T, Augmentation>,
        //   UnknownKeys,
        //   Catchall,
        //   NewOutput,
        //   NewInput
        // > {
        //   return new ZodObject({
        //     ...this._def,
        //     shape: () => ({
        //       ...this._def.shape(),
        //       ...augmentation,
        //     }),
        //   }) as any;
        // }
        /**
         * @deprecated Use `.extend` instead
         *  */
        this.augment = this.extend;
    }
    _getCached() {
        if (this._cached !== null)
            return this._cached;
        const shape = this._def.shape();
        const keys = util.objectKeys(shape);
        return (this._cached = { shape, keys });
    }
    _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType !== ZodParsedType.object) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.object,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        const { status, ctx } = this._processInputParams(input);
        const { shape, keys: shapeKeys } = this._getCached();
        const extraKeys = [];
        if (!(this._def.catchall instanceof ZodNever &&
            this._def.unknownKeys === "strip")) {
            for (const key in ctx.data) {
                if (!shapeKeys.includes(key)) {
                    extraKeys.push(key);
                }
            }
        }
        const pairs = [];
        for (const key of shapeKeys) {
            const keyValidator = shape[key];
            const value = ctx.data[key];
            pairs.push({
                key: { status: "valid", value: key },
                value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
                alwaysSet: key in ctx.data,
            });
        }
        if (this._def.catchall instanceof ZodNever) {
            const unknownKeys = this._def.unknownKeys;
            if (unknownKeys === "passthrough") {
                for (const key of extraKeys) {
                    pairs.push({
                        key: { status: "valid", value: key },
                        value: { status: "valid", value: ctx.data[key] },
                    });
                }
            }
            else if (unknownKeys === "strict") {
                if (extraKeys.length > 0) {
                    addIssueToContext(ctx, {
                        code: ZodIssueCode.unrecognized_keys,
                        keys: extraKeys,
                    });
                    status.dirty();
                }
            }
            else if (unknownKeys === "strip") ;
            else {
                throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
            }
        }
        else {
            // run catchall validation
            const catchall = this._def.catchall;
            for (const key of extraKeys) {
                const value = ctx.data[key];
                pairs.push({
                    key: { status: "valid", value: key },
                    value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)
                    ),
                    alwaysSet: key in ctx.data,
                });
            }
        }
        if (ctx.common.async) {
            return Promise.resolve()
                .then(async () => {
                const syncPairs = [];
                for (const pair of pairs) {
                    const key = await pair.key;
                    const value = await pair.value;
                    syncPairs.push({
                        key,
                        value,
                        alwaysSet: pair.alwaysSet,
                    });
                }
                return syncPairs;
            })
                .then((syncPairs) => {
                return ParseStatus.mergeObjectSync(status, syncPairs);
            });
        }
        else {
            return ParseStatus.mergeObjectSync(status, pairs);
        }
    }
    get shape() {
        return this._def.shape();
    }
    strict(message) {
        errorUtil.errToObj;
        return new ZodObject({
            ...this._def,
            unknownKeys: "strict",
            ...(message !== undefined
                ? {
                    errorMap: (issue, ctx) => {
                        var _a, _b, _c, _d;
                        const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
                        if (issue.code === "unrecognized_keys")
                            return {
                                message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,
                            };
                        return {
                            message: defaultError,
                        };
                    },
                }
                : {}),
        });
    }
    strip() {
        return new ZodObject({
            ...this._def,
            unknownKeys: "strip",
        });
    }
    passthrough() {
        return new ZodObject({
            ...this._def,
            unknownKeys: "passthrough",
        });
    }
    // const AugmentFactory =
    //   <Def extends ZodObjectDef>(def: Def) =>
    //   <Augmentation extends ZodRawShape>(
    //     augmentation: Augmentation
    //   ): ZodObject<
    //     extendShape<ReturnType<Def["shape"]>, Augmentation>,
    //     Def["unknownKeys"],
    //     Def["catchall"]
    //   > => {
    //     return new ZodObject({
    //       ...def,
    //       shape: () => ({
    //         ...def.shape(),
    //         ...augmentation,
    //       }),
    //     }) as any;
    //   };
    extend(augmentation) {
        return new ZodObject({
            ...this._def,
            shape: () => ({
                ...this._def.shape(),
                ...augmentation,
            }),
        });
    }
    /**
     * Prior to zod@1.0.12 there was a bug in the
     * inferred type of merged objects. Please
     * upgrade if you are experiencing issues.
     */
    merge(merging) {
        const merged = new ZodObject({
            unknownKeys: merging._def.unknownKeys,
            catchall: merging._def.catchall,
            shape: () => ({
                ...this._def.shape(),
                ...merging._def.shape(),
            }),
            typeName: ZodFirstPartyTypeKind.ZodObject,
        });
        return merged;
    }
    // merge<
    //   Incoming extends AnyZodObject,
    //   Augmentation extends Incoming["shape"],
    //   NewOutput extends {
    //     [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
    //       ? Augmentation[k]["_output"]
    //       : k extends keyof Output
    //       ? Output[k]
    //       : never;
    //   },
    //   NewInput extends {
    //     [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
    //       ? Augmentation[k]["_input"]
    //       : k extends keyof Input
    //       ? Input[k]
    //       : never;
    //   }
    // >(
    //   merging: Incoming
    // ): ZodObject<
    //   extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
    //   Incoming["_def"]["unknownKeys"],
    //   Incoming["_def"]["catchall"],
    //   NewOutput,
    //   NewInput
    // > {
    //   const merged: any = new ZodObject({
    //     unknownKeys: merging._def.unknownKeys,
    //     catchall: merging._def.catchall,
    //     shape: () =>
    //       objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
    //     typeName: ZodFirstPartyTypeKind.ZodObject,
    //   }) as any;
    //   return merged;
    // }
    setKey(key, schema) {
        return this.augment({ [key]: schema });
    }
    // merge<Incoming extends AnyZodObject>(
    //   merging: Incoming
    // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
    // ZodObject<
    //   extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
    //   Incoming["_def"]["unknownKeys"],
    //   Incoming["_def"]["catchall"]
    // > {
    //   // const mergedShape = objectUtil.mergeShapes(
    //   //   this._def.shape(),
    //   //   merging._def.shape()
    //   // );
    //   const merged: any = new ZodObject({
    //     unknownKeys: merging._def.unknownKeys,
    //     catchall: merging._def.catchall,
    //     shape: () =>
    //       objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
    //     typeName: ZodFirstPartyTypeKind.ZodObject,
    //   }) as any;
    //   return merged;
    // }
    catchall(index) {
        return new ZodObject({
            ...this._def,
            catchall: index,
        });
    }
    pick(mask) {
        const shape = {};
        util.objectKeys(mask).forEach((key) => {
            if (mask[key] && this.shape[key]) {
                shape[key] = this.shape[key];
            }
        });
        return new ZodObject({
            ...this._def,
            shape: () => shape,
        });
    }
    omit(mask) {
        const shape = {};
        util.objectKeys(this.shape).forEach((key) => {
            if (!mask[key]) {
                shape[key] = this.shape[key];
            }
        });
        return new ZodObject({
            ...this._def,
            shape: () => shape,
        });
    }
    /**
     * @deprecated
     */
    deepPartial() {
        return deepPartialify(this);
    }
    partial(mask) {
        const newShape = {};
        util.objectKeys(this.shape).forEach((key) => {
            const fieldSchema = this.shape[key];
            if (mask && !mask[key]) {
                newShape[key] = fieldSchema;
            }
            else {
                newShape[key] = fieldSchema.optional();
            }
        });
        return new ZodObject({
            ...this._def,
            shape: () => newShape,
        });
    }
    required(mask) {
        const newShape = {};
        util.objectKeys(this.shape).forEach((key) => {
            if (mask && !mask[key]) {
                newShape[key] = this.shape[key];
            }
            else {
                const fieldSchema = this.shape[key];
                let newField = fieldSchema;
                while (newField instanceof ZodOptional) {
                    newField = newField._def.innerType;
                }
                newShape[key] = newField;
            }
        });
        return new ZodObject({
            ...this._def,
            shape: () => newShape,
        });
    }
    keyof() {
        return createZodEnum(util.objectKeys(this.shape));
    }
}
ZodObject.create = (shape, params) => {
    return new ZodObject({
        shape: () => shape,
        unknownKeys: "strip",
        catchall: ZodNever.create(),
        typeName: ZodFirstPartyTypeKind.ZodObject,
        ...processCreateParams(params),
    });
};
ZodObject.strictCreate = (shape, params) => {
    return new ZodObject({
        shape: () => shape,
        unknownKeys: "strict",
        catchall: ZodNever.create(),
        typeName: ZodFirstPartyTypeKind.ZodObject,
        ...processCreateParams(params),
    });
};
ZodObject.lazycreate = (shape, params) => {
    return new ZodObject({
        shape,
        unknownKeys: "strip",
        catchall: ZodNever.create(),
        typeName: ZodFirstPartyTypeKind.ZodObject,
        ...processCreateParams(params),
    });
};
class ZodUnion extends ZodType {
    _parse(input) {
        const { ctx } = this._processInputParams(input);
        const options = this._def.options;
        function handleResults(results) {
            // return first issue-free validation if it exists
            for (const result of results) {
                if (result.result.status === "valid") {
                    return result.result;
                }
            }
            for (const result of results) {
                if (result.result.status === "dirty") {
                    // add issues from dirty option
                    ctx.common.issues.push(...result.ctx.common.issues);
                    return result.result;
                }
            }
            // return invalid
            const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_union,
                unionErrors,
            });
            return INVALID;
        }
        if (ctx.common.async) {
            return Promise.all(options.map(async (option) => {
                const childCtx = {
                    ...ctx,
                    common: {
                        ...ctx.common,
                        issues: [],
                    },
                    parent: null,
                };
                return {
                    result: await option._parseAsync({
                        data: ctx.data,
                        path: ctx.path,
                        parent: childCtx,
                    }),
                    ctx: childCtx,
                };
            })).then(handleResults);
        }
        else {
            let dirty = undefined;
            const issues = [];
            for (const option of options) {
                const childCtx = {
                    ...ctx,
                    common: {
                        ...ctx.common,
                        issues: [],
                    },
                    parent: null,
                };
                const result = option._parseSync({
                    data: ctx.data,
                    path: ctx.path,
                    parent: childCtx,
                });
                if (result.status === "valid") {
                    return result;
                }
                else if (result.status === "dirty" && !dirty) {
                    dirty = { result, ctx: childCtx };
                }
                if (childCtx.common.issues.length) {
                    issues.push(childCtx.common.issues);
                }
            }
            if (dirty) {
                ctx.common.issues.push(...dirty.ctx.common.issues);
                return dirty.result;
            }
            const unionErrors = issues.map((issues) => new ZodError(issues));
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_union,
                unionErrors,
            });
            return INVALID;
        }
    }
    get options() {
        return this._def.options;
    }
}
ZodUnion.create = (types, params) => {
    return new ZodUnion({
        options: types,
        typeName: ZodFirstPartyTypeKind.ZodUnion,
        ...processCreateParams(params),
    });
};
/////////////////////////////////////////////////////
/////////////////////////////////////////////////////
//////////                                 //////////
//////////      ZodDiscriminatedUnion      //////////
//////////                                 //////////
/////////////////////////////////////////////////////
/////////////////////////////////////////////////////
const getDiscriminator = (type) => {
    if (type instanceof ZodLazy) {
        return getDiscriminator(type.schema);
    }
    else if (type instanceof ZodEffects) {
        return getDiscriminator(type.innerType());
    }
    else if (type instanceof ZodLiteral) {
        return [type.value];
    }
    else if (type instanceof ZodEnum) {
        return type.options;
    }
    else if (type instanceof ZodNativeEnum) {
        // eslint-disable-next-line ban/ban
        return util.objectValues(type.enum);
    }
    else if (type instanceof ZodDefault) {
        return getDiscriminator(type._def.innerType);
    }
    else if (type instanceof ZodUndefined) {
        return [undefined];
    }
    else if (type instanceof ZodNull) {
        return [null];
    }
    else if (type instanceof ZodOptional) {
        return [undefined, ...getDiscriminator(type.unwrap())];
    }
    else if (type instanceof ZodNullable) {
        return [null, ...getDiscriminator(type.unwrap())];
    }
    else if (type instanceof ZodBranded) {
        return getDiscriminator(type.unwrap());
    }
    else if (type instanceof ZodReadonly) {
        return getDiscriminator(type.unwrap());
    }
    else if (type instanceof ZodCatch) {
        return getDiscriminator(type._def.innerType);
    }
    else {
        return [];
    }
};
class ZodDiscriminatedUnion extends ZodType {
    _parse(input) {
        const { ctx } = this._processInputParams(input);
        if (ctx.parsedType !== ZodParsedType.object) {
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.object,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        const discriminator = this.discriminator;
        const discriminatorValue = ctx.data[discriminator];
        const option = this.optionsMap.get(discriminatorValue);
        if (!option) {
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_union_discriminator,
                options: Array.from(this.optionsMap.keys()),
                path: [discriminator],
            });
            return INVALID;
        }
        if (ctx.common.async) {
            return option._parseAsync({
                data: ctx.data,
                path: ctx.path,
                parent: ctx,
            });
        }
        else {
            return option._parseSync({
                data: ctx.data,
                path: ctx.path,
                parent: ctx,
            });
        }
    }
    get discriminator() {
        return this._def.discriminator;
    }
    get options() {
        return this._def.options;
    }
    get optionsMap() {
        return this._def.optionsMap;
    }
    /**
     * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
     * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
     * have a different value for each object in the union.
     * @param discriminator the name of the discriminator property
     * @param types an array of object schemas
     * @param params
     */
    static create(discriminator, options, params) {
        // Get all the valid discriminator values
        const optionsMap = new Map();
        // try {
        for (const type of options) {
            const discriminatorValues = getDiscriminator(type.shape[discriminator]);
            if (!discriminatorValues.length) {
                throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
            }
            for (const value of discriminatorValues) {
                if (optionsMap.has(value)) {
                    throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
                }
                optionsMap.set(value, type);
            }
        }
        return new ZodDiscriminatedUnion({
            typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
            discriminator,
            options,
            optionsMap,
            ...processCreateParams(params),
        });
    }
}
function mergeValues(a, b) {
    const aType = getParsedType(a);
    const bType = getParsedType(b);
    if (a === b) {
        return { valid: true, data: a };
    }
    else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
        const bKeys = util.objectKeys(b);
        const sharedKeys = util
            .objectKeys(a)
            .filter((key) => bKeys.indexOf(key) !== -1);
        const newObj = { ...a, ...b };
        for (const key of sharedKeys) {
            const sharedValue = mergeValues(a[key], b[key]);
            if (!sharedValue.valid) {
                return { valid: false };
            }
            newObj[key] = sharedValue.data;
        }
        return { valid: true, data: newObj };
    }
    else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
        if (a.length !== b.length) {
            return { valid: false };
        }
        const newArray = [];
        for (let index = 0; index < a.length; index++) {
            const itemA = a[index];
            const itemB = b[index];
            const sharedValue = mergeValues(itemA, itemB);
            if (!sharedValue.valid) {
                return { valid: false };
            }
            newArray.push(sharedValue.data);
        }
        return { valid: true, data: newArray };
    }
    else if (aType === ZodParsedType.date &&
        bType === ZodParsedType.date &&
        +a === +b) {
        return { valid: true, data: a };
    }
    else {
        return { valid: false };
    }
}
class ZodIntersection extends ZodType {
    _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        const handleParsed = (parsedLeft, parsedRight) => {
            if (isAborted(parsedLeft) || isAborted(parsedRight)) {
                return INVALID;
            }
            const merged = mergeValues(parsedLeft.value, parsedRight.value);
            if (!merged.valid) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.invalid_intersection_types,
                });
                return INVALID;
            }
            if (isDirty(parsedLeft) || isDirty(parsedRight)) {
                status.dirty();
            }
            return { status: status.value, value: merged.data };
        };
        if (ctx.common.async) {
            return Promise.all([
                this._def.left._parseAsync({
                    data: ctx.data,
                    path: ctx.path,
                    parent: ctx,
                }),
                this._def.right._parseAsync({
                    data: ctx.data,
                    path: ctx.path,
                    parent: ctx,
                }),
            ]).then(([left, right]) => handleParsed(left, right));
        }
        else {
            return handleParsed(this._def.left._parseSync({
                data: ctx.data,
                path: ctx.path,
                parent: ctx,
            }), this._def.right._parseSync({
                data: ctx.data,
                path: ctx.path,
                parent: ctx,
            }));
        }
    }
}
ZodIntersection.create = (left, right, params) => {
    return new ZodIntersection({
        left: left,
        right: right,
        typeName: ZodFirstPartyTypeKind.ZodIntersection,
        ...processCreateParams(params),
    });
};
class ZodTuple extends ZodType {
    _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        if (ctx.parsedType !== ZodParsedType.array) {
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.array,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        if (ctx.data.length < this._def.items.length) {
            addIssueToContext(ctx, {
                code: ZodIssueCode.too_small,
                minimum: this._def.items.length,
                inclusive: true,
                exact: false,
                type: "array",
            });
            return INVALID;
        }
        const rest = this._def.rest;
        if (!rest && ctx.data.length > this._def.items.length) {
            addIssueToContext(ctx, {
                code: ZodIssueCode.too_big,
                maximum: this._def.items.length,
                inclusive: true,
                exact: false,
                type: "array",
            });
            status.dirty();
        }
        const items = [...ctx.data]
            .map((item, itemIndex) => {
            const schema = this._def.items[itemIndex] || this._def.rest;
            if (!schema)
                return null;
            return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
        })
            .filter((x) => !!x); // filter nulls
        if (ctx.common.async) {
            return Promise.all(items).then((results) => {
                return ParseStatus.mergeArray(status, results);
            });
        }
        else {
            return ParseStatus.mergeArray(status, items);
        }
    }
    get items() {
        return this._def.items;
    }
    rest(rest) {
        return new ZodTuple({
            ...this._def,
            rest,
        });
    }
}
ZodTuple.create = (schemas, params) => {
    if (!Array.isArray(schemas)) {
        throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
    }
    return new ZodTuple({
        items: schemas,
        typeName: ZodFirstPartyTypeKind.ZodTuple,
        rest: null,
        ...processCreateParams(params),
    });
};
class ZodRecord extends ZodType {
    get keySchema() {
        return this._def.keyType;
    }
    get valueSchema() {
        return this._def.valueType;
    }
    _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        if (ctx.parsedType !== ZodParsedType.object) {
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.object,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        const pairs = [];
        const keyType = this._def.keyType;
        const valueType = this._def.valueType;
        for (const key in ctx.data) {
            pairs.push({
                key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
                value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
                alwaysSet: key in ctx.data,
            });
        }
        if (ctx.common.async) {
            return ParseStatus.mergeObjectAsync(status, pairs);
        }
        else {
            return ParseStatus.mergeObjectSync(status, pairs);
        }
    }
    get element() {
        return this._def.valueType;
    }
    static create(first, second, third) {
        if (second instanceof ZodType) {
            return new ZodRecord({
                keyType: first,
                valueType: second,
                typeName: ZodFirstPartyTypeKind.ZodRecord,
                ...processCreateParams(third),
            });
        }
        return new ZodRecord({
            keyType: ZodString.create(),
            valueType: first,
            typeName: ZodFirstPartyTypeKind.ZodRecord,
            ...processCreateParams(second),
        });
    }
}
class ZodMap extends ZodType {
    get keySchema() {
        return this._def.keyType;
    }
    get valueSchema() {
        return this._def.valueType;
    }
    _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        if (ctx.parsedType !== ZodParsedType.map) {
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.map,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        const keyType = this._def.keyType;
        const valueType = this._def.valueType;
        const pairs = [...ctx.data.entries()].map(([key, value], index) => {
            return {
                key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
                value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"])),
            };
        });
        if (ctx.common.async) {
            const finalMap = new Map();
            return Promise.resolve().then(async () => {
                for (const pair of pairs) {
                    const key = await pair.key;
                    const value = await pair.value;
                    if (key.status === "aborted" || value.status === "aborted") {
                        return INVALID;
                    }
                    if (key.status === "dirty" || value.status === "dirty") {
                        status.dirty();
                    }
                    finalMap.set(key.value, value.value);
                }
                return { status: status.value, value: finalMap };
            });
        }
        else {
            const finalMap = new Map();
            for (const pair of pairs) {
                const key = pair.key;
                const value = pair.value;
                if (key.status === "aborted" || value.status === "aborted") {
                    return INVALID;
                }
                if (key.status === "dirty" || value.status === "dirty") {
                    status.dirty();
                }
                finalMap.set(key.value, value.value);
            }
            return { status: status.value, value: finalMap };
        }
    }
}
ZodMap.create = (keyType, valueType, params) => {
    return new ZodMap({
        valueType,
        keyType,
        typeName: ZodFirstPartyTypeKind.ZodMap,
        ...processCreateParams(params),
    });
};
class ZodSet extends ZodType {
    _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        if (ctx.parsedType !== ZodParsedType.set) {
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.set,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        const def = this._def;
        if (def.minSize !== null) {
            if (ctx.data.size < def.minSize.value) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.too_small,
                    minimum: def.minSize.value,
                    type: "set",
                    inclusive: true,
                    exact: false,
                    message: def.minSize.message,
                });
                status.dirty();
            }
        }
        if (def.maxSize !== null) {
            if (ctx.data.size > def.maxSize.value) {
                addIssueToContext(ctx, {
                    code: ZodIssueCode.too_big,
                    maximum: def.maxSize.value,
                    type: "set",
                    inclusive: true,
                    exact: false,
                    message: def.maxSize.message,
                });
                status.dirty();
            }
        }
        const valueType = this._def.valueType;
        function finalizeSet(elements) {
            const parsedSet = new Set();
            for (const element of elements) {
                if (element.status === "aborted")
                    return INVALID;
                if (element.status === "dirty")
                    status.dirty();
                parsedSet.add(element.value);
            }
            return { status: status.value, value: parsedSet };
        }
        const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
        if (ctx.common.async) {
            return Promise.all(elements).then((elements) => finalizeSet(elements));
        }
        else {
            return finalizeSet(elements);
        }
    }
    min(minSize, message) {
        return new ZodSet({
            ...this._def,
            minSize: { value: minSize, message: errorUtil.toString(message) },
        });
    }
    max(maxSize, message) {
        return new ZodSet({
            ...this._def,
            maxSize: { value: maxSize, message: errorUtil.toString(message) },
        });
    }
    size(size, message) {
        return this.min(size, message).max(size, message);
    }
    nonempty(message) {
        return this.min(1, message);
    }
}
ZodSet.create = (valueType, params) => {
    return new ZodSet({
        valueType,
        minSize: null,
        maxSize: null,
        typeName: ZodFirstPartyTypeKind.ZodSet,
        ...processCreateParams(params),
    });
};
class ZodFunction extends ZodType {
    constructor() {
        super(...arguments);
        this.validate = this.implement;
    }
    _parse(input) {
        const { ctx } = this._processInputParams(input);
        if (ctx.parsedType !== ZodParsedType.function) {
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.function,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        function makeArgsIssue(args, error) {
            return makeIssue({
                data: args,
                path: ctx.path,
                errorMaps: [
                    ctx.common.contextualErrorMap,
                    ctx.schemaErrorMap,
                    getErrorMap(),
                    errorMap,
                ].filter((x) => !!x),
                issueData: {
                    code: ZodIssueCode.invalid_arguments,
                    argumentsError: error,
                },
            });
        }
        function makeReturnsIssue(returns, error) {
            return makeIssue({
                data: returns,
                path: ctx.path,
                errorMaps: [
                    ctx.common.contextualErrorMap,
                    ctx.schemaErrorMap,
                    getErrorMap(),
                    errorMap,
                ].filter((x) => !!x),
                issueData: {
                    code: ZodIssueCode.invalid_return_type,
                    returnTypeError: error,
                },
            });
        }
        const params = { errorMap: ctx.common.contextualErrorMap };
        const fn = ctx.data;
        if (this._def.returns instanceof ZodPromise) {
            // Would love a way to avoid disabling this rule, but we need
            // an alias (using an arrow function was what caused 2651).
            // eslint-disable-next-line @typescript-eslint/no-this-alias
            const me = this;
            return OK(async function (...args) {
                const error = new ZodError([]);
                const parsedArgs = await me._def.args
                    .parseAsync(args, params)
                    .catch((e) => {
                    error.addIssue(makeArgsIssue(args, e));
                    throw error;
                });
                const result = await Reflect.apply(fn, this, parsedArgs);
                const parsedReturns = await me._def.returns._def.type
                    .parseAsync(result, params)
                    .catch((e) => {
                    error.addIssue(makeReturnsIssue(result, e));
                    throw error;
                });
                return parsedReturns;
            });
        }
        else {
            // Would love a way to avoid disabling this rule, but we need
            // an alias (using an arrow function was what caused 2651).
            // eslint-disable-next-line @typescript-eslint/no-this-alias
            const me = this;
            return OK(function (...args) {
                const parsedArgs = me._def.args.safeParse(args, params);
                if (!parsedArgs.success) {
                    throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
                }
                const result = Reflect.apply(fn, this, parsedArgs.data);
                const parsedReturns = me._def.returns.safeParse(result, params);
                if (!parsedReturns.success) {
                    throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
                }
                return parsedReturns.data;
            });
        }
    }
    parameters() {
        return this._def.args;
    }
    returnType() {
        return this._def.returns;
    }
    args(...items) {
        return new ZodFunction({
            ...this._def,
            args: ZodTuple.create(items).rest(ZodUnknown.create()),
        });
    }
    returns(returnType) {
        return new ZodFunction({
            ...this._def,
            returns: returnType,
        });
    }
    implement(func) {
        const validatedFunc = this.parse(func);
        return validatedFunc;
    }
    strictImplement(func) {
        const validatedFunc = this.parse(func);
        return validatedFunc;
    }
    static create(args, returns, params) {
        return new ZodFunction({
            args: (args
                ? args
                : ZodTuple.create([]).rest(ZodUnknown.create())),
            returns: returns || ZodUnknown.create(),
            typeName: ZodFirstPartyTypeKind.ZodFunction,
            ...processCreateParams(params),
        });
    }
}
class ZodLazy extends ZodType {
    get schema() {
        return this._def.getter();
    }
    _parse(input) {
        const { ctx } = this._processInputParams(input);
        const lazySchema = this._def.getter();
        return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
    }
}
ZodLazy.create = (getter, params) => {
    return new ZodLazy({
        getter: getter,
        typeName: ZodFirstPartyTypeKind.ZodLazy,
        ...processCreateParams(params),
    });
};
class ZodLiteral extends ZodType {
    _parse(input) {
        if (input.data !== this._def.value) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                received: ctx.data,
                code: ZodIssueCode.invalid_literal,
                expected: this._def.value,
            });
            return INVALID;
        }
        return { status: "valid", value: input.data };
    }
    get value() {
        return this._def.value;
    }
}
ZodLiteral.create = (value, params) => {
    return new ZodLiteral({
        value: value,
        typeName: ZodFirstPartyTypeKind.ZodLiteral,
        ...processCreateParams(params),
    });
};
function createZodEnum(values, params) {
    return new ZodEnum({
        values,
        typeName: ZodFirstPartyTypeKind.ZodEnum,
        ...processCreateParams(params),
    });
}
class ZodEnum extends ZodType {
    constructor() {
        super(...arguments);
        _ZodEnum_cache.set(this, void 0);
    }
    _parse(input) {
        if (typeof input.data !== "string") {
            const ctx = this._getOrReturnCtx(input);
            const expectedValues = this._def.values;
            addIssueToContext(ctx, {
                expected: util.joinValues(expectedValues),
                received: ctx.parsedType,
                code: ZodIssueCode.invalid_type,
            });
            return INVALID;
        }
        if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
            __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
        }
        if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
            const ctx = this._getOrReturnCtx(input);
            const expectedValues = this._def.values;
            addIssueToContext(ctx, {
                received: ctx.data,
                code: ZodIssueCode.invalid_enum_value,
                options: expectedValues,
            });
            return INVALID;
        }
        return OK(input.data);
    }
    get options() {
        return this._def.values;
    }
    get enum() {
        const enumValues = {};
        for (const val of this._def.values) {
            enumValues[val] = val;
        }
        return enumValues;
    }
    get Values() {
        const enumValues = {};
        for (const val of this._def.values) {
            enumValues[val] = val;
        }
        return enumValues;
    }
    get Enum() {
        const enumValues = {};
        for (const val of this._def.values) {
            enumValues[val] = val;
        }
        return enumValues;
    }
    extract(values, newDef = this._def) {
        return ZodEnum.create(values, {
            ...this._def,
            ...newDef,
        });
    }
    exclude(values, newDef = this._def) {
        return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
            ...this._def,
            ...newDef,
        });
    }
}
_ZodEnum_cache = new WeakMap();
ZodEnum.create = createZodEnum;
class ZodNativeEnum extends ZodType {
    constructor() {
        super(...arguments);
        _ZodNativeEnum_cache.set(this, void 0);
    }
    _parse(input) {
        const nativeEnumValues = util.getValidEnumValues(this._def.values);
        const ctx = this._getOrReturnCtx(input);
        if (ctx.parsedType !== ZodParsedType.string &&
            ctx.parsedType !== ZodParsedType.number) {
            const expectedValues = util.objectValues(nativeEnumValues);
            addIssueToContext(ctx, {
                expected: util.joinValues(expectedValues),
                received: ctx.parsedType,
                code: ZodIssueCode.invalid_type,
            });
            return INVALID;
        }
        if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
            __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
        }
        if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
            const expectedValues = util.objectValues(nativeEnumValues);
            addIssueToContext(ctx, {
                received: ctx.data,
                code: ZodIssueCode.invalid_enum_value,
                options: expectedValues,
            });
            return INVALID;
        }
        return OK(input.data);
    }
    get enum() {
        return this._def.values;
    }
}
_ZodNativeEnum_cache = new WeakMap();
ZodNativeEnum.create = (values, params) => {
    return new ZodNativeEnum({
        values: values,
        typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
        ...processCreateParams(params),
    });
};
class ZodPromise extends ZodType {
    unwrap() {
        return this._def.type;
    }
    _parse(input) {
        const { ctx } = this._processInputParams(input);
        if (ctx.parsedType !== ZodParsedType.promise &&
            ctx.common.async === false) {
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.promise,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        const promisified = ctx.parsedType === ZodParsedType.promise
            ? ctx.data
            : Promise.resolve(ctx.data);
        return OK(promisified.then((data) => {
            return this._def.type.parseAsync(data, {
                path: ctx.path,
                errorMap: ctx.common.contextualErrorMap,
            });
        }));
    }
}
ZodPromise.create = (schema, params) => {
    return new ZodPromise({
        type: schema,
        typeName: ZodFirstPartyTypeKind.ZodPromise,
        ...processCreateParams(params),
    });
};
class ZodEffects extends ZodType {
    innerType() {
        return this._def.schema;
    }
    sourceType() {
        return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects
            ? this._def.schema.sourceType()
            : this._def.schema;
    }
    _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        const effect = this._def.effect || null;
        const checkCtx = {
            addIssue: (arg) => {
                addIssueToContext(ctx, arg);
                if (arg.fatal) {
                    status.abort();
                }
                else {
                    status.dirty();
                }
            },
            get path() {
                return ctx.path;
            },
        };
        checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
        if (effect.type === "preprocess") {
            const processed = effect.transform(ctx.data, checkCtx);
            if (ctx.common.async) {
                return Promise.resolve(processed).then(async (processed) => {
                    if (status.value === "aborted")
                        return INVALID;
                    const result = await this._def.schema._parseAsync({
                        data: processed,
                        path: ctx.path,
                        parent: ctx,
                    });
                    if (result.status === "aborted")
                        return INVALID;
                    if (result.status === "dirty")
                        return DIRTY(result.value);
                    if (status.value === "dirty")
                        return DIRTY(result.value);
                    return result;
                });
            }
            else {
                if (status.value === "aborted")
                    return INVALID;
                const result = this._def.schema._parseSync({
                    data: processed,
                    path: ctx.path,
                    parent: ctx,
                });
                if (result.status === "aborted")
                    return INVALID;
                if (result.status === "dirty")
                    return DIRTY(result.value);
                if (status.value === "dirty")
                    return DIRTY(result.value);
                return result;
            }
        }
        if (effect.type === "refinement") {
            const executeRefinement = (acc) => {
                const result = effect.refinement(acc, checkCtx);
                if (ctx.common.async) {
                    return Promise.resolve(result);
                }
                if (result instanceof Promise) {
                    throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
                }
                return acc;
            };
            if (ctx.common.async === false) {
                const inner = this._def.schema._parseSync({
                    data: ctx.data,
                    path: ctx.path,
                    parent: ctx,
                });
                if (inner.status === "aborted")
                    return INVALID;
                if (inner.status === "dirty")
                    status.dirty();
                // return value is ignored
                executeRefinement(inner.value);
                return { status: status.value, value: inner.value };
            }
            else {
                return this._def.schema
                    ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
                    .then((inner) => {
                    if (inner.status === "aborted")
                        return INVALID;
                    if (inner.status === "dirty")
                        status.dirty();
                    return executeRefinement(inner.value).then(() => {
                        return { status: status.value, value: inner.value };
                    });
                });
            }
        }
        if (effect.type === "transform") {
            if (ctx.common.async === false) {
                const base = this._def.schema._parseSync({
                    data: ctx.data,
                    path: ctx.path,
                    parent: ctx,
                });
                if (!isValid(base))
                    return base;
                const result = effect.transform(base.value, checkCtx);
                if (result instanceof Promise) {
                    throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
                }
                return { status: status.value, value: result };
            }
            else {
                return this._def.schema
                    ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
                    .then((base) => {
                    if (!isValid(base))
                        return base;
                    return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
                });
            }
        }
        util.assertNever(effect);
    }
}
ZodEffects.create = (schema, effect, params) => {
    return new ZodEffects({
        schema,
        typeName: ZodFirstPartyTypeKind.ZodEffects,
        effect,
        ...processCreateParams(params),
    });
};
ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
    return new ZodEffects({
        schema,
        effect: { type: "preprocess", transform: preprocess },
        typeName: ZodFirstPartyTypeKind.ZodEffects,
        ...processCreateParams(params),
    });
};
class ZodOptional extends ZodType {
    _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType === ZodParsedType.undefined) {
            return OK(undefined);
        }
        return this._def.innerType._parse(input);
    }
    unwrap() {
        return this._def.innerType;
    }
}
ZodOptional.create = (type, params) => {
    return new ZodOptional({
        innerType: type,
        typeName: ZodFirstPartyTypeKind.ZodOptional,
        ...processCreateParams(params),
    });
};
class ZodNullable extends ZodType {
    _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType === ZodParsedType.null) {
            return OK(null);
        }
        return this._def.innerType._parse(input);
    }
    unwrap() {
        return this._def.innerType;
    }
}
ZodNullable.create = (type, params) => {
    return new ZodNullable({
        innerType: type,
        typeName: ZodFirstPartyTypeKind.ZodNullable,
        ...processCreateParams(params),
    });
};
class ZodDefault extends ZodType {
    _parse(input) {
        const { ctx } = this._processInputParams(input);
        let data = ctx.data;
        if (ctx.parsedType === ZodParsedType.undefined) {
            data = this._def.defaultValue();
        }
        return this._def.innerType._parse({
            data,
            path: ctx.path,
            parent: ctx,
        });
    }
    removeDefault() {
        return this._def.innerType;
    }
}
ZodDefault.create = (type, params) => {
    return new ZodDefault({
        innerType: type,
        typeName: ZodFirstPartyTypeKind.ZodDefault,
        defaultValue: typeof params.default === "function"
            ? params.default
            : () => params.default,
        ...processCreateParams(params),
    });
};
class ZodCatch extends ZodType {
    _parse(input) {
        const { ctx } = this._processInputParams(input);
        // newCtx is used to not collect issues from inner types in ctx
        const newCtx = {
            ...ctx,
            common: {
                ...ctx.common,
                issues: [],
            },
        };
        const result = this._def.innerType._parse({
            data: newCtx.data,
            path: newCtx.path,
            parent: {
                ...newCtx,
            },
        });
        if (isAsync(result)) {
            return result.then((result) => {
                return {
                    status: "valid",
                    value: result.status === "valid"
                        ? result.value
                        : this._def.catchValue({
                            get error() {
                                return new ZodError(newCtx.common.issues);
                            },
                            input: newCtx.data,
                        }),
                };
            });
        }
        else {
            return {
                status: "valid",
                value: result.status === "valid"
                    ? result.value
                    : this._def.catchValue({
                        get error() {
                            return new ZodError(newCtx.common.issues);
                        },
                        input: newCtx.data,
                    }),
            };
        }
    }
    removeCatch() {
        return this._def.innerType;
    }
}
ZodCatch.create = (type, params) => {
    return new ZodCatch({
        innerType: type,
        typeName: ZodFirstPartyTypeKind.ZodCatch,
        catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
        ...processCreateParams(params),
    });
};
class ZodNaN extends ZodType {
    _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType !== ZodParsedType.nan) {
            const ctx = this._getOrReturnCtx(input);
            addIssueToContext(ctx, {
                code: ZodIssueCode.invalid_type,
                expected: ZodParsedType.nan,
                received: ctx.parsedType,
            });
            return INVALID;
        }
        return { status: "valid", value: input.data };
    }
}
ZodNaN.create = (params) => {
    return new ZodNaN({
        typeName: ZodFirstPartyTypeKind.ZodNaN,
        ...processCreateParams(params),
    });
};
const BRAND = Symbol("zod_brand");
class ZodBranded extends ZodType {
    _parse(input) {
        const { ctx } = this._processInputParams(input);
        const data = ctx.data;
        return this._def.type._parse({
            data,
            path: ctx.path,
            parent: ctx,
        });
    }
    unwrap() {
        return this._def.type;
    }
}
class ZodPipeline extends ZodType {
    _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        if (ctx.common.async) {
            const handleAsync = async () => {
                const inResult = await this._def.in._parseAsync({
                    data: ctx.data,
                    path: ctx.path,
                    parent: ctx,
                });
                if (inResult.status === "aborted")
                    return INVALID;
                if (inResult.status === "dirty") {
                    status.dirty();
                    return DIRTY(inResult.value);
                }
                else {
                    return this._def.out._parseAsync({
                        data: inResult.value,
                        path: ctx.path,
                        parent: ctx,
                    });
                }
            };
            return handleAsync();
        }
        else {
            const inResult = this._def.in._parseSync({
                data: ctx.data,
                path: ctx.path,
                parent: ctx,
            });
            if (inResult.status === "aborted")
                return INVALID;
            if (inResult.status === "dirty") {
                status.dirty();
                return {
                    status: "dirty",
                    value: inResult.value,
                };
            }
            else {
                return this._def.out._parseSync({
                    data: inResult.value,
                    path: ctx.path,
                    parent: ctx,
                });
            }
        }
    }
    static create(a, b) {
        return new ZodPipeline({
            in: a,
            out: b,
            typeName: ZodFirstPartyTypeKind.ZodPipeline,
        });
    }
}
class ZodReadonly extends ZodType {
    _parse(input) {
        const result = this._def.innerType._parse(input);
        const freeze = (data) => {
            if (isValid(data)) {
                data.value = Object.freeze(data.value);
            }
            return data;
        };
        return isAsync(result)
            ? result.then((data) => freeze(data))
            : freeze(result);
    }
    unwrap() {
        return this._def.innerType;
    }
}
ZodReadonly.create = (type, params) => {
    return new ZodReadonly({
        innerType: type,
        typeName: ZodFirstPartyTypeKind.ZodReadonly,
        ...processCreateParams(params),
    });
};
function custom(check, params = {}, 
/**
 * @deprecated
 *
 * Pass `fatal` into the params object instead:
 *
 * ```ts
 * z.string().custom((val) => val.length > 5, { fatal: false })
 * ```
 *
 */
fatal) {
    if (check)
        return ZodAny.create().superRefine((data, ctx) => {
            var _a, _b;
            if (!check(data)) {
                const p = typeof params === "function"
                    ? params(data)
                    : typeof params === "string"
                        ? { message: params }
                        : params;
                const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
                const p2 = typeof p === "string" ? { message: p } : p;
                ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
            }
        });
    return ZodAny.create();
}
const late = {
    object: ZodObject.lazycreate,
};
var ZodFirstPartyTypeKind;
(function (ZodFirstPartyTypeKind) {
    ZodFirstPartyTypeKind["ZodString"] = "ZodString";
    ZodFirstPartyTypeKind["ZodNumber"] = "ZodNumber";
    ZodFirstPartyTypeKind["ZodNaN"] = "ZodNaN";
    ZodFirstPartyTypeKind["ZodBigInt"] = "ZodBigInt";
    ZodFirstPartyTypeKind["ZodBoolean"] = "ZodBoolean";
    ZodFirstPartyTypeKind["ZodDate"] = "ZodDate";
    ZodFirstPartyTypeKind["ZodSymbol"] = "ZodSymbol";
    ZodFirstPartyTypeKind["ZodUndefined"] = "ZodUndefined";
    ZodFirstPartyTypeKind["ZodNull"] = "ZodNull";
    ZodFirstPartyTypeKind["ZodAny"] = "ZodAny";
    ZodFirstPartyTypeKind["ZodUnknown"] = "ZodUnknown";
    ZodFirstPartyTypeKind["ZodNever"] = "ZodNever";
    ZodFirstPartyTypeKind["ZodVoid"] = "ZodVoid";
    ZodFirstPartyTypeKind["ZodArray"] = "ZodArray";
    ZodFirstPartyTypeKind["ZodObject"] = "ZodObject";
    ZodFirstPartyTypeKind["ZodUnion"] = "ZodUnion";
    ZodFirstPartyTypeKind["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
    ZodFirstPartyTypeKind["ZodIntersection"] = "ZodIntersection";
    ZodFirstPartyTypeKind["ZodTuple"] = "ZodTuple";
    ZodFirstPartyTypeKind["ZodRecord"] = "ZodRecord";
    ZodFirstPartyTypeKind["ZodMap"] = "ZodMap";
    ZodFirstPartyTypeKind["ZodSet"] = "ZodSet";
    ZodFirstPartyTypeKind["ZodFunction"] = "ZodFunction";
    ZodFirstPartyTypeKind["ZodLazy"] = "ZodLazy";
    ZodFirstPartyTypeKind["ZodLiteral"] = "ZodLiteral";
    ZodFirstPartyTypeKind["ZodEnum"] = "ZodEnum";
    ZodFirstPartyTypeKind["ZodEffects"] = "ZodEffects";
    ZodFirstPartyTypeKind["ZodNativeEnum"] = "ZodNativeEnum";
    ZodFirstPartyTypeKind["ZodOptional"] = "ZodOptional";
    ZodFirstPartyTypeKind["ZodNullable"] = "ZodNullable";
    ZodFirstPartyTypeKind["ZodDefault"] = "ZodDefault";
    ZodFirstPartyTypeKind["ZodCatch"] = "ZodCatch";
    ZodFirstPartyTypeKind["ZodPromise"] = "ZodPromise";
    ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
    ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
    ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
const instanceOfType = (
// const instanceOfType = <T extends new (...args: any[]) => any>(
cls, params = {
    message: `Input not instance of ${cls.name}`,
}) => custom((data) => data instanceof cls, params);
const stringType = ZodString.create;
const numberType = ZodNumber.create;
const nanType = ZodNaN.create;
const bigIntType = ZodBigInt.create;
const booleanType = ZodBoolean.create;
const dateType = ZodDate.create;
const symbolType = ZodSymbol.create;
const undefinedType = ZodUndefined.create;
const nullType = ZodNull.create;
const anyType = ZodAny.create;
const unknownType = ZodUnknown.create;
const neverType = ZodNever.create;
const voidType = ZodVoid.create;
const arrayType = ZodArray.create;
const objectType = ZodObject.create;
const strictObjectType = ZodObject.strictCreate;
const unionType = ZodUnion.create;
const discriminatedUnionType = ZodDiscriminatedUnion.create;
const intersectionType = ZodIntersection.create;
const tupleType = ZodTuple.create;
const recordType = ZodRecord.create;
const mapType = ZodMap.create;
const setType = ZodSet.create;
const functionType = ZodFunction.create;
const lazyType = ZodLazy.create;
const literalType = ZodLiteral.create;
const enumType = ZodEnum.create;
const nativeEnumType = ZodNativeEnum.create;
const promiseType = ZodPromise.create;
const effectsType = ZodEffects.create;
const optionalType = ZodOptional.create;
const nullableType = ZodNullable.create;
const preprocessType = ZodEffects.createWithPreprocess;
const pipelineType = ZodPipeline.create;
const ostring = () => stringType().optional();
const onumber = () => numberType().optional();
const oboolean = () => booleanType().optional();
const coerce = {
    string: ((arg) => ZodString.create({ ...arg, coerce: true })),
    number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
    boolean: ((arg) => ZodBoolean.create({
        ...arg,
        coerce: true,
    })),
    bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
    date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
};
const NEVER = INVALID;

var z = /*#__PURE__*/Object.freeze({
    __proto__: null,
    defaultErrorMap: errorMap,
    setErrorMap: setErrorMap,
    getErrorMap: getErrorMap,
    makeIssue: makeIssue,
    EMPTY_PATH: EMPTY_PATH,
    addIssueToContext: addIssueToContext,
    ParseStatus: ParseStatus,
    INVALID: INVALID,
    DIRTY: DIRTY,
    OK: OK,
    isAborted: isAborted,
    isDirty: isDirty,
    isValid: isValid,
    isAsync: isAsync,
    get util () { return util; },
    get objectUtil () { return objectUtil; },
    ZodParsedType: ZodParsedType,
    getParsedType: getParsedType,
    ZodType: ZodType,
    datetimeRegex: datetimeRegex,
    ZodString: ZodString,
    ZodNumber: ZodNumber,
    ZodBigInt: ZodBigInt,
    ZodBoolean: ZodBoolean,
    ZodDate: ZodDate,
    ZodSymbol: ZodSymbol,
    ZodUndefined: ZodUndefined,
    ZodNull: ZodNull,
    ZodAny: ZodAny,
    ZodUnknown: ZodUnknown,
    ZodNever: ZodNever,
    ZodVoid: ZodVoid,
    ZodArray: ZodArray,
    ZodObject: ZodObject,
    ZodUnion: ZodUnion,
    ZodDiscriminatedUnion: ZodDiscriminatedUnion,
    ZodIntersection: ZodIntersection,
    ZodTuple: ZodTuple,
    ZodRecord: ZodRecord,
    ZodMap: ZodMap,
    ZodSet: ZodSet,
    ZodFunction: ZodFunction,
    ZodLazy: ZodLazy,
    ZodLiteral: ZodLiteral,
    ZodEnum: ZodEnum,
    ZodNativeEnum: ZodNativeEnum,
    ZodPromise: ZodPromise,
    ZodEffects: ZodEffects,
    ZodTransformer: ZodEffects,
    ZodOptional: ZodOptional,
    ZodNullable: ZodNullable,
    ZodDefault: ZodDefault,
    ZodCatch: ZodCatch,
    ZodNaN: ZodNaN,
    BRAND: BRAND,
    ZodBranded: ZodBranded,
    ZodPipeline: ZodPipeline,
    ZodReadonly: ZodReadonly,
    custom: custom,
    Schema: ZodType,
    ZodSchema: ZodType,
    late: late,
    get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },
    coerce: coerce,
    any: anyType,
    array: arrayType,
    bigint: bigIntType,
    boolean: booleanType,
    date: dateType,
    discriminatedUnion: discriminatedUnionType,
    effect: effectsType,
    'enum': enumType,
    'function': functionType,
    'instanceof': instanceOfType,
    intersection: intersectionType,
    lazy: lazyType,
    literal: literalType,
    map: mapType,
    nan: nanType,
    nativeEnum: nativeEnumType,
    never: neverType,
    'null': nullType,
    nullable: nullableType,
    number: numberType,
    object: objectType,
    oboolean: oboolean,
    onumber: onumber,
    optional: optionalType,
    ostring: ostring,
    pipeline: pipelineType,
    preprocess: preprocessType,
    promise: promiseType,
    record: recordType,
    set: setType,
    strictObject: strictObjectType,
    string: stringType,
    symbol: symbolType,
    transformer: effectsType,
    tuple: tupleType,
    'undefined': undefinedType,
    union: unionType,
    unknown: unknownType,
    'void': voidType,
    NEVER: NEVER,
    ZodIssueCode: ZodIssueCode,
    quotelessJson: quotelessJson,
    ZodError: ZodError
});




/***/ }),

/***/ 41910:
/***/ ((module) => {

"use strict";
module.exports = JSON.parse('{"options_popup_title_placeholder":{"message":"Enter a filter name"},"options_filters_list_search_display_option_all_filters":{"message":"All filters"},"options_filters_list_search_display_option_enabled":{"message":"Enabled"},"options_filters_list_search_display_option_disabled":{"message":"Disabled"},"options_filters_empty_title":{"message":"Nothing found"},"options_antibanner_custom_filter_already_exists":{"message":"This custom filter has already been added"},"options_filters_annoyances_consent_title":{"message":"Please read carefully before enabling annoyance filters"},"options_filters_annoyances_consent_description":{"message":"You are about to enable one or more annoyance filters. They block elements that are either unrelated to website content or related but annoying to your user experience. Website owners may consider these elements mandatory: if you block them, you may be violating their terms; some functionality of websites may not be available or may not work properly. You understand and agree that you are solely responsible to comply with the terms of use of websites you visit and that AdGuard is not responsible for your compliance with the terms of use of websites you visit."},"options_filters_annoyances_consent_question":{"message":"Enable these filters?"},"options_filters_annoyances_consent_filter_policy":{"message":"For details on what AdGuard\'s annoyance filters block, see <a>Filter policy</a>"},"options_filters_annoyances_consent_enable_button":{"message":"Enable"},"popup_header_cta_link":{"message":"How to enhance protection"},"popup_header_update_filters":{"message":"Check for filter updates"},"options_popup_import_settings_wrong_file_ext":{"message":"The file extension must be %extension%"},"popup_resume_protection_button":{"message":"Resume"},"popup_adguard_for_ios":{"message":"AdGuard for iOS"},"popup_adguard_for_android":{"message":"AdGuard for Android"},"options_filters_filter_version":{"message":"version:"},"options_filters_filter_link":{"message":"Go to homepage"},"options_filters_filter_updated":{"message":"updated:"},"options_popup_version_update_disable_notification":{"message":"Disable notifications"},"popup_adguard_footer_title":{"message":"Protect your mobile device"},"options_popup_call_to_action":{"message":"Enter the valid URL or file path of the filter into the field above."},"options_popup_description":{"message":"You will be subscribed to that filter."},"options_popup_url_title":{"message":"New filter subscription"},"options_popup_url_placeholder":{"message":"Enter URL or file path"},"options_popup_next_button":{"message":"Next"},"options_popup_checking_filter":{"message":"Checking your filter"},"options_popup_check_false_title":{"message":"Error"},"options_popup_check_false_description":{"message":"Error while adding your custom filter."},"options_add_custom_filter_modal_title":{"message":"Add custom filter"},"options_add_custom_filter_modal_checking_filter":{"message":"Checking your filter..."},"options_add_custom_filter_modal_error_title":{"message":"Failed to add custom filter"},"options_add_custom_filter_modal_error_subtitle":{"message":"Please try again or contact support"},"options_add_custom_filter_modal_add_button":{"message":"Add"},"options_add_custom_filter_modal_filter_name":{"message":"Filter name:"},"options_add_custom_filter_modal_filter_trusted":{"message":"Trusted"},"options_add_custom_filter_modal_filter_trusted_description":{"message":"Some filter rules can significantly alter your browsing experience and compromise your privacy. Make sure to only use filters from developers you trust"},"options_popup_try_again_button":{"message":"Try again"},"options_popup_filter_title":{"message":"Title:"},"options_popup_filter_description":{"message":"Description:"},"options_popup_filter_version":{"message":"Version:"},"options_popup_filter_rules_count":{"message":"Rules count:"},"options_popup_filter_homepage":{"message":"Homepage:"},"options_popup_filter_url":{"message":"URL:"},"options_popup_subscribe_button":{"message":"Subscribe"},"name":{"message":"AdGuard AdBlocker"},"description":{"message":"Unmatched adblock extension against advertising and pop-ups. Blocks ads on Facebook, YouTube and all other websites.","description":"TEXT MAX LENGTH: 132"},"background_tab_title":{"message":"Background tab"},"options_allowlist":{"message":"Allowlist"},"options_allowlist_desc":{"message":"AdGuard does not filter websites from the allowlist"},"options_allowlist_invert":{"message":"Invert allowlist"},"options_allowlist_invert_desc":{"message":"Unblock ads everywhere except for the allowlist"},"options_allowlist_alert_invert":{"message":"Allowlist is inverted. Ads are blocked only on websites added to it. <a>Disable</a>"},"options_allowlist_leave_subtitle":{"message":"Your changes to Allowlist will be lost"},"options_userfilter":{"message":"User rules"},"filtering_log_modified_rules":{"message":"Modified rules: %rules_count%"},"filtering_log_stealth_rules":{"message":"Tracking protection rules: %rules_count%"},"filtering_log_privacy_applied_rules":{"message":"Tracking protection applied"},"filtering_log_in_allowlist":{"message":"The site is allowed"},"filtering_log_hide_referrer":{"message":"Referer hidden from third-parties"},"filtering_log_hide_search_queries":{"message":"Your search queries hidden"},"filtering_log_remove_client_data":{"message":"X-Client-Data header removed"},"filtering_log_send_not_track":{"message":"Do-Not-Track header sent"},"options_select_update_period_default":{"message":"Default"},"options_select_update_period_48h":{"message":"48 hours"},"options_select_update_period_24h":{"message":"24 hours"},"options_select_update_period_12h":{"message":"12 hours"},"options_select_update_period_6h":{"message":"6 hours"},"options_select_update_period_1h":{"message":"1 hour"},"options_select_update_period_disabled":{"message":"Disabled"},"options_filters":{"message":"Filters"},"options_antibanner_rules_count":{"message":"Filter rules count: %rules_count%"},"options_antibanner_custom_group":{"message":"Custom"},"options_filters_enabled":{"message":"Enabled:"},"options_filters_enabled_and_more":{"message":"%enabled% and %more% more"},"options_filters_enabled_and_last":{"message":"%enabled% and %last%"},"options_filters_no_enabled":{"message":"No filters enabled"},"options_filters_filter_trusted_tag_desc":{"message":"You chose to trust this filter."},"options_filters_info_mv3_total_rules":{"message":"Total rules: %num%"},"options_add_custom_filter":{"message":"Add custom filter"},"options_filters_custom_disabled_cws":{"message":"Custom filters will be coming back soon. Learn more in our blog"},"options_empty_custom_filter":{"message":"You don\'t have any custom filters yet"},"options_loader_applying_changes":{"message":"Applying changes..."},"options_editor_indicator_saving":{"message":"Saving..."},"options_editor_indicator_saved":{"message":"Saved"},"options_popup_import_error_required_privacy_permission":{"message":"To import this settings file, allow AdGuard to change your privacy-related settings."},"options_popup_import_success_title":{"message":"Settings imported"},"options_popup_import_error_title":{"message":"Failed to import settings"},"options_popup_import_error_file_description":{"message":"Something went wrong."},"options_popup_trusted_filter_title":{"message":"Trusted"},"options_popup_trusted_filter_description":{"message":"Trusted filters can use powerful filtering rules modifiers which can be dangerous in the wrong hands. Do not check this box unless you fully trust it."},"popup_site_filtering_state_secure_page":{"message":"Secure page"},"popup_site_filtering_state_loading":{"message":"Loading..."},"popup_site_filtering_state_enabling":{"message":"Enabling protection..."},"popup_site_filtering_state_enabled":{"message":"Protection is enabled"},"popup_site_filtering_state_disabling":{"message":"Disabling protection..."},"popup_site_filtering_state_disabled":{"message":"Protection is disabled"},"popup_site_filtering_state_pausing":{"message":"Pausing protection..."},"popup_site_filtering_state_paused":{"message":"Protection is paused"},"popup_site_filtering_state_resuming":{"message":"Resuming protection..."},"popup_site_filtering_state_subtitle_all_websites":{"message":"for all websites"},"popup_site_exception_information":{"message":"Filtering is disabled because it can interfere with this website\'s operation."},"popup_tab_blocked_count":{"message":"Blocked: %num%"},"popup_tab_blocked_all_count":{"message":"Total blocked: %num%"},"popup_statistics_total":{"message":"Total"},"popup_statistics_all_categories":{"message":"All"},"popup_statistics_category_advertising":{"message":"Advertising"},"popup_statistics_category_trackers":{"message":"Trackers"},"popup_statistics_category_social_media":{"message":"Social media"},"popup_statistics_category_cdn":{"message":"CDN"},"popup_statistics_category_other":{"message":"Other"},"popup_statistics_week_days_mon":{"message":"Mon"},"popup_statistics_week_days_tue":{"message":"Tue"},"popup_statistics_week_days_wed":{"message":"Wed"},"popup_statistics_week_days_thu":{"message":"Thu"},"popup_statistics_week_days_fri":{"message":"Fri"},"popup_statistics_week_days_sat":{"message":"Sat"},"popup_statistics_week_days_sun":{"message":"Sun"},"popup_statistics_months_jan":{"message":"Jan"},"popup_statistics_months_feb":{"message":"Feb"},"popup_statistics_months_mar":{"message":"Mar"},"popup_statistics_months_apr":{"message":"Apr"},"popup_statistics_months_may":{"message":"May"},"popup_statistics_months_jun":{"message":"Jun"},"popup_statistics_months_jul":{"message":"Jul"},"popup_statistics_months_aug":{"message":"Aug"},"popup_statistics_months_sep":{"message":"Sep"},"popup_statistics_months_oct":{"message":"Oct"},"popup_statistics_months_nov":{"message":"Nov"},"popup_statistics_months_dec":{"message":"Dec"},"options_popup_update_title_error":{"message":"Error updating filters"},"options_popup_update_not_found":{"message":"No updates found"},"options_popup_update_error":{"message":"Failed to get updates. Please try again later."},"options_popup_update_filter":{"message":"was updated."},"options_popup_update_filters":{"message":"were updated."},"options_popup_version_update_title_text":{"message":"AdGuard extension has been updated to version %current_version%"},"options_popup_version_update_description_minor":{"message":"This version contains mostly bugfixes and minor improvements."},"options_popup_version_update_description_major":{"message":"This is a major extension upgrade that brings a lot of new features and improvements."},"options_popup_version_update_changelog_text":{"message":"What\'s new in this version?"},"options_popup_version_update_offer":{"message":"Did you know that AdGuard capabilities are not limited to this browser?"},"options_popup_version_update_offer_button_text":{"message":"LEARN MORE"},"popup_block_site_ads_option":{"message":"Block ads manually"},"popup_security_report":{"message":"Check website security"},"popup_reset_page_user_rules":{"message":"Delete user rules for this website"},"context_block_site_ads":{"message":"Block ads manually"},"context_security_report":{"message":"Check website security"},"context_complaint_website":{"message":"Report an issue"},"context_site_filtering_disabled":{"message":"AdGuard can\'t filter this page"},"context_disable_protection":{"message":"Pause AdGuard protection"},"context_enable_protection":{"message":"Resume AdGuard protection"},"context_site_protection_disabled":{"message":"AdGuard protection is paused"},"context_open_settings":{"message":"AdGuard settings"},"context_open_log":{"message":"Filtering log"},"context_site_exception":{"message":"This website is in the exceptions"},"context_site_filtering_on":{"message":"Enable filtering on this website"},"context_site_filtering_off":{"message":"Disable filtering on this website"},"context_update_antibanner_filters":{"message":"Check for filter updates"},"alert_popup_filter_enabled_title":{"message":"Auto-activation of the filters"},"alert_popup_filter_enabled_desc":{"message":"%filter_name% has been activated automatically."},"filters_download_title":{"message":"Filters database is loading..."},"filters_download_loading":{"message":"Please wait while filters database is loading..."},"post_install_loading":{"message":"Loading extension..."},"filtering_modal_element":{"message":"Element:"},"filtering_modal_cookie":{"message":"Cookie:"},"filtering_modal_important":{"message":"Give a higher priority to the rule"},"filtering_log_title":{"message":"Filtering log"},"filtering_log_search_string":{"message":"Filter log records"},"filtering_log_search_tabs_placeholder":{"message":"Search in tabs"},"filtering_log_preserve_log_off":{"message":"Do not record log"},"filtering_log_preserve_log_on":{"message":"Record log"},"filtering_refresh_tab_short":{"message":"Refresh"},"filtering_clear_log_events":{"message":"Clear log"},"filtering_type_all":{"message":"All"},"filtering_type_other":{"message":"Other"},"filtering_table_status":{"message":"Status"},"filtering_table_type":{"message":"Type"},"filtering_table_rule":{"message":"Filtering rule"},"filtering_table_source":{"message":"Source"},"filtering_table_filter":{"message":"Filter"},"filtering_table_empty_reload_page_desc":{"message":"Nothing found. <reset>Disable filters</reset> or <refresh>reload the page</refresh> to view log records."},"filtering_modal_info_title":{"message":"Request details"},"filtering_modal_preview_title":{"message":"Preview"},"filtering_modal_type":{"message":"Type:"},"filtering_modal_source":{"message":"Source:"},"filtering_modal_rule":{"message":"Rule:"},"filtering_modal_rules":{"message":"Rules:"},"filtering_modal_privacy":{"message":"Tracking protection:"},"filtering_modal_filter":{"message":"Filter:"},"filtering_modal_block":{"message":"Block"},"filtering_modal_block_again":{"message":"Block again"},"filtering_modal_unblock":{"message":"Unblock"},"filtering_modal_remove_user":{"message":"Delete rule"},"filtering_modal_preview_request_button":{"message":"Preview"},"filtering_modal_remove_allowlist":{"message":"Remove from the Allowlist"},"filtering_modal_add_title":{"message":"Adding a rule"},"filtering_modal_status_text_desc":{"message":"Status:"},"filtering_modal_status_text_error":{"message":"Failed to load preview. Please try again"},"filtering_modal_status_text_loading":{"message":"Loading..."},"filtering_modal_filtering_status_text_desc":{"message":"Filtering status:"},"filtering_modal_rule_text_desc":{"message":"Rule text:"},"filtering_modal_patterns_desc":{"message":"Patterns:"},"filtering_modal_options_desc":{"message":"Options:"},"filtering_modal_apply_domains":{"message":"Apply the rule to all websites"},"filtering_modal_third_party":{"message":"Apply to third-party requests only"},"filtering_modal_remove_param":{"message":"Remove query parameters"},"filtering_modal_add_rule":{"message":"Add a rule"},"filtering_modal_exception_title":{"message":"Add an exception"},"filtering_modal_open_in_new_tab":{"message":"Open in a new tab"},"filtering_modal_show_full_url":{"message":"Show full URL"},"filtering_modal_hide_full_url":{"message":"Hide full URL"},"filtering_modal_show_full_rule":{"message":"Show full rule"},"filtering_modal_hide_full_rule":{"message":"Hide full rule"},"filtering_modal_show_full_element":{"message":"Show full element"},"filtering_modal_hide_full_element":{"message":"Hide full element"},"filtering_modal_copy_to_clipboard":{"message":"Copy to clipboard"},"filtering_modal_copied":{"message":"Copied"},"filtering_modal_converted_to":{"message":"Converted to:"},"filtering_log_filter_regular":{"message":"Regular"},"filtering_log_filter_allowed":{"message":"Allowed"},"filtering_log_filter_blocked":{"message":"Blocked"},"filtering_log_filter_modified":{"message":"Modified"},"filtering_log_filter_user_rules":{"message":"User rules"},"filtering_log_status_processed":{"message":"Processed"},"filtering_log_status_allowed":{"message":"Allowed"},"filtering_log_status_blocked":{"message":"Blocked"},"filtering_log_status_modified":{"message":"Modified"},"options_settings":{"message":"AdGuard Settings"},"options_general_settings":{"message":"General"},"options_block_acceptable_ads":{"message":"Block search ads and websites\' self-promotion"},"options_block_acceptable_ads_desc":{"message":"Remove self-promotional ads from websites and contextual ads from search results. <a>Learn more</a>"},"options_show_blocked_ads_count_title":{"message":"Indicate the number of blocked ads on the AdGuard extension icon"},"options_enable_autodetect_filter":{"message":"Activate the most appropriate filters automatically"},"options_enable_autodetect_filter_desc":{"message":"Language-specific filters will turn on depending on the site language"},"options_select_theme":{"message":"Theme"},"options_theme_selector_system":{"message":"System default"},"options_theme_selector_light":{"message":"Light"},"options_theme_selector_dark":{"message":"Dark"},"options_export_settings":{"message":"Export settings"},"options_import_settings":{"message":"Import settings"},"options_report_bug":{"message":"Report a bug"},"options_leave_feedback":{"message":"Leave feedback"},"options_privacy":{"message":"Tracking protection"},"options_update_antibanner_filters":{"message":"Check for filter updates"},"options_check_update":{"message":"Check for updates"},"options_check_update_progress":{"message":"Checking..."},"options_set_update_interval":{"message":"Auto-update filters"},"options_set_update_interval_desc":{"message":"For more effective blocking, the filters need to be updated regularly"},"options_userfilter_export":{"message":"Export"},"options_editor_save":{"message":"Save"},"options_editor_leave_title":{"message":"Leave without saving?"},"options_editor_leave_confirm":{"message":"Yes, leave"},"options_editor_leave_cancel":{"message":"Back to editing"},"options_userfilter_import":{"message":"Import"},"options_userfilter_description_key":{"message":"You can add your own rules here. This option is recommended for advanced users familiar with HTML/CSS. Read the <a>filter rules tutorial</a> to learn how to write your own filter rules."},"options_userfilter_subtitle_key":{"message":"Fine-tune ad blocking with your own filtering rules"},"options_userfilter_line_break_off":{"message":"Line break: Disabled"},"options_userfilter_line_break_on":{"message":"Line break: Enabled"},"options_userfilter_leave_subtitle":{"message":"Your changes to the rules will be lost"},"options_open_changelog":{"message":"Changelog"},"options_safebrowsing_enabled":{"message":"Phishing and malware protection"},"options_safebrowsing_enabled_desc":{"message":"Enable AdGuard Browsing Security module that detects potentially malicious and phishing sites by checking them against an online database. <a>Read more</a>"},"options_site":{"message":"Official Website"},"options_discuss":{"message":"Discuss AdGuard"},"options_do_you_like_question":{"message":"Do you like AdGuard?"},"options_footer_like_us_cta":{"message":"Rate it!"},"options_miscellaneous_settings":{"message":"Additional settings"},"options_rule_syntax":{"message":"Rule syntax"},"options_rule_limits":{"message":"Rule limits"},"options_rule_limits_description":{"message":"Chrome limits the number of rules that can be applied"},"options_rule_limits_dynamic":{"message":"Dynamic rules"},"options_rule_limits_dynamic_user_rules":{"message":"User-added rules, such as <user_rules>user rules</user_rules>, <allowlist>allowlisted websites</allowlist>, <custom_filters>custom filters</custom_filters>, and <quick_fixes>Quick Fixes filter</quick_fixes>"},"options_rule_limits_dynamic_regex":{"message":"Regex rules — included in the above"},"options_rule_limits_static_rulesets":{"message":"Static rulesets"},"options_rule_limits_static_rulesets_builtin":{"message":"<a>Built-in filters</a>, such as Block annoyances or Language-specific filters"},"options_rule_limits_static_rules":{"message":"Static rules"},"options_rule_limits_static_rules_all":{"message":"Rules from <a>built-in filters</a>"},"options_rule_limits_static_rules_regex":{"message":"Regex rules — included in the above"},"options_rule_limits_numbers":{"message":"%current% of %maximum%"},"options_rule_limits_warning_title":{"message":"The browser has modified the list of active filters"},"options_rule_limits_warning_explanation_title":{"message":"What happened?"},"options_rule_limits_warning_explanation_description":{"message":"The limit of active built-in rules was exceeded after an update or adding a new extension. As per Manifest V3, your Chrome browser reacted by disabling all the extension\'s built-in filters except the default ones."},"options_rule_limits_warning_list_enabled_before_title":{"message":"Filters enabled before the update"},"options_rule_limits_warning_list_enabled_now_title":{"message":"Filters enabled now"},"options_rule_limits_warning_actions_title":{"message":"Your possible actions"},"options_rule_limits_warning_actions_delete_filters":{"message":"Option 1. Delete unnecessary ad-blocking extensions from your browser. To reactivate the filters mentioned in the \\"Filters enabled before the update\\" section, click <a>reactivate filters.</a>"},"options_rule_limits_warning_actions_install_app":{"message":"Option 2. Install the AdGuard Ad Blocker app: it has no restrictions on filtering rules. <a>Get the AdGuard app</a>"},"options_rule_limits_warning_actions_close_warning_one_filter":{"message":"Option 3. If you\'re satisfied with the currently enabled default filter, <a>close this warning.</a>"},"options_rule_limits_warning_actions_close_warning_multiple_filters":{"message":"Option 3. If you\'re satisfied with the currently enabled default filters, <a>close this warning.</a>"},"options_all_limits_exceeded_warning":{"message":"You\'ve reached the limit of active built-in rules. Your browser has modified the list of active built-in filters. The number of filters enabled has changed from %expected% to %current%."},"options_limits_warning_static_filters":{"message":"You\'ve reached the limit of active built-in filters. %maximum% of %current% filters are enabled. To activate new rules, disable some built-in filters."},"options_limits_warning_static_rules":{"message":"You\'ve reached the limit of active built-in rules. %maximum% of %current% rules are enabled. To activate new rules, disable some built-in filters."},"options_limits_warning_static_regex_rules":{"message":"You\'ve reached the limit of active built-in regex rules. %maximum% of %current% regex rules are enabled. To activate new rules, disable some built-in filters."},"options_limits_warning_dynamic_rules":{"message":"You\'ve reached the limit of user-added rules. %maximum% of %current% rules are enabled."},"options_limits_warning_dynamic_regex_rules":{"message":"You\'ve reached the limit of user-added regex rules. %maximum% of %current% regex rules are enabled."},"options_show_adguard_full_version_title":{"message":"Show information on the AdGuard full version"},"options_show_app_updated_notification":{"message":"Notify about extension updates"},"options_open_log":{"message":"Open filtering log"},"options_reset_stats":{"message":"Clear statistics"},"options_reset_stats_done":{"message":"Statistics have been reset"},"options_reset_settings":{"message":"Reset settings"},"options_reset_settings_done":{"message":"Settings have been reset"},"options_reset_settings_error":{"message":"Error while resetting settings"},"options_collect_hit_stats_title":{"message":"Help with the development of AdGuard filters"},"options_collect_hit_stats_desc":{"message":"Send <a>anonymous stats on ad filter usage</a> to help AdGuard improve its filters"},"options_show_context_menu_title":{"message":"Add AdGuard item to the browser\'s context menu"},"options_use_optimized_filters":{"message":"Use optimized filters"},"options_use_optimized_filters_desc":{"message":"Uses shorter versions of filters with only the most popular rules to save traffic. Better suited to mobile browsers"},"options_privacy_title":{"message":"Tracking protection"},"options_privacy_desc":{"message":"Protect your identity and sensitive personal information from thousands of online trackers by blocking the most popular tracking methods"},"options_hide_referrer_title":{"message":"Hide Referer from third parties"},"options_hide_referrer_desc":{"message":"Prevent third parties from knowing what website you are visiting"},"options_hide_search_queries_title":{"message":"Hide your search queries"},"options_hide_search_queries_desc":{"message":"Hide the queries for websites visited from a search engine"},"options_send_not_track_title":{"message":"Ask websites not to track you"},"options_send_not_track_desc":{"message":"Send the <gpc>Global Privacy Control</gpc> and <dnt>Do Not Track</dnt> signals to the websites you visit"},"options_stripped_tracking_parameters":{"message":"Tracking parameters removed"},"options_modified_first_party_cookie":{"message":"First-party cookie modified"},"options_modified_third_party_cookie":{"message":"Third-party cookie modified"},"options_remove_client_data_title":{"message":"Remove X-Client-Data header"},"options_remove_client_data_desc":{"message":"Block Google Chrome from sending its version and modifications information to Google domains"},"options_disable_webrtc_title":{"message":"Disable WebRTC"},"options_disable_webrtc_desc":{"message":"WebRTC can leak your IP address even if you use a proxy or a VPN. Disabling WebRTC can break some websites"},"options_strip_tracking_params_title":{"message":"Remove tracking parameters"},"options_strip_tracking_params_description":{"message":"Remove parameters from web requests with AdGuard URL Tracking filter"},"options_block_known_trackers_title":{"message":"Block trackers"},"options_block_known_trackers_description":{"message":"Block trackers and web analytics tools with AdGuard Tracking Protection filter"},"options_third_party_title":{"message":"Self-destruction of third-party cookies"},"options_third_party_desc":{"message":"Limit the lifetime of third-party cookies (minutes)"},"options_first_party_title":{"message":"Self-destruction of first-party cookies (not recommended)"},"options_first_party_desc":{"message":"Limit the lifetime of first-party cookies (minutes)"},"popup_abuse_site":{"message":"Report an issue"},"popup_open_filtering_log":{"message":"Open filtering log"},"popup_tab_actions":{"message":"Actions"},"popup_tab_statistics":{"message":"Statistics"},"popup_statistics_time_day":{"message":"Last day"},"popup_statistics_time_week":{"message":"Last week"},"popup_statistics_time_month":{"message":"Last month"},"popup_statistics_time_year":{"message":"Last year"},"popup_switch_button":{"message":"Protection switch"},"popup_limits_exceeded_warning":{"message":"Your browser has modified the list of active built-in filters"},"snack_on_websites_limits_exceeded_warning":{"message":"Rule limit exceeded in AdGuard Browser Extension. Please check your filters and disable the ones you don\'t need"},"short_name":{"message":"AdGuard"},"options_about":{"message":"About"},"options_privacy_policy":{"message":"Privacy Policy"},"options_acknowledgment":{"message":"Acknowledgments"},"options_github":{"message":"GitHub"},"options_about_version":{"message":"Version"},"options_copyright":{"message":"All rights reserved."},"options_remove_filter_confirm_modal_title":{"message":"Remove this filter?"},"options_remove_filter_confirm_modal_ok_button":{"message":"Remove"},"options_nav_better_than_extension":{"message":"Why is the AdGuard app better than the extension?"},"options_nav_compare":{"message":"Compare"},"options_filters_search":{"message":"Search"},"options_about_title":{"message":"AdGuard Browser extension"},"group_description_adblocking":{"message":"Configure ad blocking here to deal with annoying banners, pop-ups, video ads and such, once and for all"},"group_description_stealth":{"message":"Protect your identity and sensitive personal info from thousands of online trackers by blocking all known popular tracking methods"},"group_description_social":{"message":"Hide unwanted \\"Like\\"/\\"Share\\" buttons and other social media widgets"},"group_description_annoyances":{"message":"Remove pop-up windows and other annoying notifications like cookie notices"},"group_description_security":{"message":"Protect yourself from malware, phishing and other online threats"},"group_description_miscellaneous":{"message":"More settings to configure your web surfing with AdGuard even further"},"group_description_custom":{"message":"Create your own filters to fine-tune web filtering to your preference."},"group_description_lang":{"message":"Don\'t limit yourself — block ads on websites in any languages"},"fullscreen_user_rules_title":{"message":"User rules"},"options_user_rules_editor_stub_title":{"message":"Editor opened in another window"},"options_user_rules_editor_stub_subtitle":{"message":"Your rules will appear here after you close it"},"options_user_rules_editor_stub_go_to_editor_button":{"message":"Go to editor"},"options_editor_open_fullscreen_button_tooltip":{"message":"Open Editor in a new window"},"options_editor_close_fullscreen_button_tooltip":{"message":"Exit the window mode"},"options_clear_stats_confirm_modal_title":{"message":"Clear statistics?"},"options_clear_stats_confirm_modal_clear_button":{"message":"Clear"},"options_reset_settings_confirm_modal_title":{"message":"Reset settings?"},"options_reset_settings_confirm_modal_clear_button":{"message":"Reset"},"options_confirm_modal_cancel_button":{"message":"Cancel"},"filtering_log_details_modal_beautify_button":{"message":"Beautify"},"filtering_log_details_modal_back_button":{"message":"Back to request"},"filtering_log_details_modal_try_again":{"message":"Try again"},"filtering_log_tag_tooltip_first_party":{"message":"First-party requests"},"filtering_log_tag_tooltip_third_party":{"message":"Third-party requests"},"filtering_log_tag_tooltip_regular":{"message":"Requests processed without filtering"},"filtering_log_tag_tooltip_allowed":{"message":"Allowed and unblocked requests"},"filtering_log_tag_tooltip_blocked":{"message":"Blocked requests"},"filtering_log_tag_tooltip_modified":{"message":"Modified requests"},"filtering_log_tag_tooltip_user_rules":{"message":"Requests affected by user rules"},"filtering_log_tag_tooltip_html":{"message":"Documents and subdocuments"},"filtering_log_tag_tooltip_css":{"message":"Stylesheets"},"filtering_log_tag_tooltip_js":{"message":"Scripts"},"filtering_log_tag_tooltip_xhr":{"message":"XMLHttpRequests and fetch requests"},"filtering_log_tag_tooltip_img":{"message":"Images"},"filtering_log_tag_tooltip_media":{"message":"Media"},"filtering_log_tag_tooltip_other":{"message":"Fonts, pings, WebRTC, WebSocket..."},"filtering_log_badge_tooltip_third_party":{"message":"Third-party request"},"filtering_log_badge_tooltip_http_req_method":{"message":"HTTP request method"},"filtering_log_badge_tooltip_http_status_code":{"message":"HTTP status code"},"filtering_log_assumed_rule_description":{"message":"This is an assumed rule. For details, see our <a>Knowledge base</a>"},"options_stealth_general_title":{"message":"General"},"options_stealth_cookies_title":{"message":"Cookies"},"options_stealth_miscellaneous_title":{"message":"Miscellaneous"},"options_coming_soon":{"message":"Coming soon"},"blocking_pages_malware":{"message":"This web page at <strong>%host%</strong> has been reported as a malware page and has been blocked based on your security preferences."},"blocking_pages_phishing":{"message":"This web page at <strong>%host%</strong> has been reported as a phishing page and has been blocked based on your security preferences."},"blocking_pages_advanced_button":{"message":"Advanced"},"blocking_pages_more_info_button":{"message":"More information"},"blocking_pages_page_title":{"message":"Access denied"},"blocking_pages_safe_header_title":{"message":"AdGuard has blocked access to this page"},"blocking_pages_rule_header_title":{"message":"Blocked by AdGuard"},"blocking_pages_rule_content_title":{"message":"AdGuard has prevented this page from loading due to the following filter rule"},"blocking_pages_btn_go_back":{"message":"Go back"},"blocking_pages_btn_proceed":{"message":"Proceed anyway"},"text_collapser_show_default":{"message":"Show full text"},"text_collapser_hide_default":{"message":"Hide full text"},"close_button_title":{"message":"Close"},"filtering_modal_applied_rules":{"message":"| Applied rule: | Applied rules:","description":"WARNING: correct number of plural forms is required"},"filtering_modal_assumed_rules":{"message":"| Assumed rule: | Assumed rules:","description":"WARNING: correct number of plural forms is required"},"filtering_modal_original_rules":{"message":"| Original rule: | Original rules:","description":"WARNING: correct number of plural forms is required"},"filtering_modal_declarative_rule":{"message":"DNR rule:"}}');

/***/ })

},
/******/ __webpack_require__ => { // webpackRuntimeModules
/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
/******/ __webpack_require__.O(0, [870,645,89,59,776,974,374,49,981], () => (__webpack_exec__(19167)));
/******/ var __webpack_exports__ = __webpack_require__.O();
/******/ }
]);