adnbn 0.0.39 → 0.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.cjs +122 -76
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.mts +6 -1
- package/dist/browser/index.d.ts +6 -1
- package/dist/browser/index.js +120 -77
- package/dist/browser/index.js.map +1 -1
- package/dist/cli/index.cjs +39 -32
- package/dist/cli/index.cjs.map +1 -1
- package/dist/entry/command/index.cjs +24 -4
- package/dist/entry/command/index.cjs.map +1 -1
- package/dist/entry/command/index.js +24 -4
- package/dist/entry/command/index.js.map +1 -1
- package/dist/entry/service/index.cjs +77 -40
- package/dist/entry/service/index.cjs.map +1 -1
- package/dist/entry/service/index.js +77 -40
- package/dist/entry/service/index.js.map +1 -1
- package/dist/index.cjs +76 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +76 -39
- package/dist/index.js.map +1 -1
- package/dist/message/index.cjs +75 -37
- package/dist/message/index.cjs.map +1 -1
- package/dist/message/index.d.mts +12 -10
- package/dist/message/index.d.ts +12 -10
- package/dist/message/index.js +75 -38
- package/dist/message/index.js.map +1 -1
- package/dist/message/react.cjs +74 -37
- package/dist/message/react.cjs.map +1 -1
- package/dist/message/react.d.mts +2 -2
- package/dist/message/react.d.ts +2 -2
- package/dist/message/react.js +74 -37
- package/dist/message/react.js.map +1 -1
- package/dist/message-CXzpmlXD.d.mts +28 -0
- package/dist/message-CXzpmlXD.d.ts +28 -0
- package/dist/relay/index.cjs +73 -68
- package/dist/relay/index.cjs.map +1 -1
- package/dist/relay/index.d.mts +34 -20
- package/dist/relay/index.d.ts +34 -20
- package/dist/relay/index.js +72 -66
- package/dist/relay/index.js.map +1 -1
- package/dist/service/index.cjs +77 -40
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +2 -2
- package/dist/service/index.d.ts +2 -2
- package/dist/service/index.js +77 -40
- package/dist/service/index.js.map +1 -1
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/react.cjs.map +1 -1
- package/dist/storage/react.js.map +1 -1
- package/package.json +6 -5
- package/types/client.d.ts +148 -125
- package/dist/message-DO3GF4T9.d.mts +0 -27
- package/dist/message-DO3GF4T9.d.ts +0 -27
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/app.ts","../src/main/background.ts","../src/types/browser.ts","../src/types/command.ts","../src/main/command.ts","../src/main/config.ts","../src/types/content.ts","../src/entry/content/core/resolvers/mount.ts","../src/entry/content/core/resolvers/render.ts","../src/entry/content/core/resolvers/definition.ts","../src/main/content.ts","../src/main/env.ts","../src/types/locale.ts","../src/locale/providers/AbstractLocale.ts","../src/browser/browser.ts","../src/browser/runtime.ts","../src/browser/i18n.ts","../src/locale/utils.ts","../src/locale/providers/NativeLocale.ts","../src/main/locale.ts","../src/main/page.ts","../src/main/plugin.ts","../src/types/service.ts","../src/service/ServiceManager.ts","../src/service/providers/BaseService.ts","../src/message/providers/AbstractMessage.ts","../src/message/MessageManager.ts","../src/message/handlers/AbstractHandler.ts","../src/message/handlers/SingleHandler.ts","../src/message/handlers/MapHandler.ts","../src/message/handlers/GeneralHandler.ts","../src/message/providers/Message.ts","../src/service/providers/ProxyService.ts","../src/main/service.ts"],"names":["Mode","Command","Browser","ContentScriptAppend","browser","Language","LocaleDir","_","i18n","nanoid"],"mappings":";;;;;;AAGY,IAAA,IAAA,qBAAAA,KAAL,KAAA;AACH,EAAAA,MAAA,MAAO,CAAA,GAAA,MAAA;AACP,EAAAA,MAAA,aAAc,CAAA,GAAA,aAAA;AACd,EAAAA,MAAA,YAAa,CAAA,GAAA,YAAA;AAHL,EAAAA,OAAAA,KAAAA;AAAA,CAAA,EAAA,IAAA,IAAA,EAAA;AAMA,IAAA,OAAA,qBAAAC,QAAL,KAAA;AACH,EAAAA,SAAA,OAAQ,CAAA,GAAA,OAAA;AACR,EAA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AAa,OAAO,YAAA,KAAiB,QAAU,EAAA;AAChE,UAAA,OAAO,OAAQ,CAAA,GAAA,CAAI,OAAS,EAAA,YAAA,EAAc,QAAQ,CAAA;AAAA;AAGtD,QAAM,MAAA,OAAA,GAAU,QAAQ,IAAO,GAAA,YAAA,GAAe,GAAG,IAAI,CAAA,CAAA,EAAI,MAAO,CAAA,YAAY,CAAC,CAAA,CAAA;AAE7E,QAAO,OAAA,IAAA,CAAK,YAAY,OAAO,CAAA;AAAA;AACnC,KACH,CAAA;AAGD,IAAA,KAAA,CAAM,OAAU,GAAA,IAAA;AAEhB,IAAO,OAAA,KAAA;AAAA;AACX,EAEO,GAAS,GAAA;AACZ,IAAA,IAAI,cAAgB,EAAA;AAChB,MAAM,MAAA,IAAI,MAAM,uDAAuD,CAAA;AAAA;AAG3E,IAAA,OAAO,KAAK,WAAY,EAAA;AAAA;AAEhC,CAAA;;;AC5Ca,IAAA,aAAA,GAAgB,CAAwB,OAAwD,KAAA;AACzG,EAAO,OAAA,OAAA;AACX;AAEa,IAAA,UAAA,GAAa,CAAqD,IAAkD,KAAA;AAC7H,EAAA,OAAO,IAAI,oBAAA,CAAa,IAAI,CAAA,CAAE,GAAI,EAAA;AACtC","file":"index.cjs","sourcesContent":["export const PackageName = 'adnbn';\nexport const SystemDir = '.adnbn';\n\nexport enum Mode {\n None = 'none',\n Development = 'development',\n Production = 'production',\n}\n\nexport enum Command {\n Build = 'build',\n Watch = 'watch',\n}","import {BackgroundConfig, BackgroundDefinition, BackgroundMainHandler} from \"@typing/background\";\n\nexport type {BackgroundConfig, BackgroundDefinition, BackgroundMainHandler};\n\nexport const defineBackground = (options: BackgroundDefinition): BackgroundDefinition => {\n return options;\n}\n","export enum Browser {\n Chrome = 'chrome',\n Chromium = 'chromium',\n Edge = 'edge',\n Firefox = 'firefox',\n Opera = 'opera',\n Safari = 'safari',\n}\n","import {Required} from \"utility-types\";\n\nimport {EntrypointBuilder, EntrypointOptions} from \"@typing/entrypoint\";\nimport {BackgroundConfig} from \"@typing/background\";\nimport {Awaiter} from \"@typing/helpers\";\n\ntype Tab = chrome.tabs.Tab;\n\nexport const CommandExecuteActionName = '_execute_action';\n\nexport interface CommandConfig extends BackgroundConfig {\n name: string;\n description?: string;\n global?: boolean;\n defaultKey?: string;\n windowsKey?: string;\n macKey?: string;\n chromeosKey?: string;\n linuxKey?: string;\n}\n\nexport type CommandOptions = CommandConfig & EntrypointOptions;\n\nexport type CommandEntrypointOptions = Partial<CommandOptions>;\n\nexport type CommandExecute = (tab: Tab | undefined, options: CommandOptions) => Awaiter<void>;\n\nexport interface CommandDefinition extends CommandEntrypointOptions {\n execute: CommandExecute;\n}\n\nexport type ExecuteActionCommandDefinition = Omit<CommandDefinition, 'name'>;\n\nexport type CommandUnresolvedDefinition = Partial<CommandDefinition>;\n\nexport type CommandResolvedDefinition = Required<CommandDefinition, 'name' | 'execute'>;\n\nexport type CommandBuilder = EntrypointBuilder;","import {\n CommandConfig,\n CommandDefinition,\n CommandExecute,\n CommandExecuteActionName,\n ExecuteActionCommandDefinition\n} from \"@typing/command\";\n\nexport {\n type CommandDefinition,\n type ExecuteActionCommandDefinition,\n CommandExecuteActionName,\n type CommandConfig,\n type CommandExecute\n};\n\nexport const defineCommand = (options: CommandDefinition): CommandDefinition => {\n return options;\n}\n\nexport const defineExecuteActionCommand = (options: ExecuteActionCommandDefinition): CommandDefinition => {\n return {...options, name: CommandExecuteActionName};\n}","import {Config, ConfigDefinition, ReadonlyConfig, UserConfig} from \"@typing/config\";\n\nexport type {Config, ReadonlyConfig, ConfigDefinition, UserConfig};\n\nexport const defineConfig = (config: ConfigDefinition): ConfigDefinition => {\n return config;\n}","import type {FC, ReactNode} from \"react\"\nimport {Optional} from 'utility-types';\n\nimport {EntrypointBuilder, EntrypointOptions} from \"@typing/entrypoint\";\nimport {Awaiter, PickNonFunctionProperties} from \"@typing/helpers\";\n\ntype ExecutionWorld = chrome.scripting.ExecutionWorld;\ntype RunAt = chrome.userScripts.RunAt;\n\nexport const ContentScriptMatches = ['*://*/*'];\n\nexport interface ContentScriptConfig {\n matches?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default \"documentIdle\"\n */\n runAt?: RunAt;\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default false\n */\n matchAboutBlank?: boolean;\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default []\n */\n excludeMatches?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default []\n */\n includeGlobs?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default []\n */\n excludeGlobs?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default false\n */\n allFrames?: boolean;\n /**\n * See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world\n */\n world?: ExecutionWorld;\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default false\n */\n matchOriginAsFallback?: boolean;\n}\n\nexport type ContentScriptEntrypointOptions = ContentScriptConfig & EntrypointOptions;\n\n// Append\nexport enum ContentScriptAppend {\n Last = 'last',\n First = 'first',\n Replace = 'replace',\n Before = 'before',\n After = 'after',\n}\n\n// Mount\nexport type ContentScriptMountFunction = (anchor: Element, container: Element) => void | (() => void);\n\nexport interface ContentScriptMount {\n mount(): void;\n\n unmount(): void;\n}\n\n// Props\nexport interface ContentScriptProps extends ContentScriptEntrypointOptions {\n anchor: Element;\n}\n\n// Anchor\nexport type ContentScriptAnchor = string | Element | null | undefined;\nexport type ContentScriptAnchorGetter = () => Awaiter<ContentScriptAnchor>;\nexport type ContentScriptAnchorResolver = () => Awaiter<Element[]>;\n\n// Render\nexport type ContentScriptRenderReactComponent = FC<ContentScriptProps>;\nexport type ContentScriptRenderValue = Element | ReactNode | ContentScriptRenderReactComponent;\nexport type ContentScriptRenderHandler = (props: ContentScriptProps) => Awaiter<void | ContentScriptRenderValue>;\n\n// Container\nexport type ContentScriptContainerTag = Exclude<keyof HTMLElementTagNameMap, 'html' | 'body'>;\n\nexport type ContentScriptContainerOptions = {\n [Tag in ContentScriptContainerTag]: {\n tagName: Tag\n} & Exclude<Optional<PickNonFunctionProperties<HTMLElementTagNameMap[Tag]>>, 'id'>;\n}[ContentScriptContainerTag];\n\nexport type ContentScriptContainerFactory = (props: ContentScriptProps) => Awaiter<Element | ContentScriptContainerTag | ContentScriptContainerOptions>;\nexport type ContentScriptContainerCreator = (props: ContentScriptProps) => Awaiter<Element>;\n\n// Watch\nexport type ContentScriptWatchStrategy = (update: () => void, context: ContentScriptContext) => () => void;\n\n// Context\nexport interface ContentScriptContext extends ContentScriptMount {\n nodes: ReadonlySet<ContentScriptNode>;\n}\n\n// Main\nexport type ContentScriptMainFunction = (context: ContentScriptContext) => Awaiter<void>;\n\n// Node\nexport interface ContentScriptNode extends ContentScriptMount {\n anchor: Element;\n container?: Element;\n}\n\nexport type ContentScriptNodeSet = Set<ContentScriptNode>;\n\n// Definition\nexport interface ContentScriptDefinition extends ContentScriptEntrypointOptions {\n anchor?: ContentScriptAnchor | ContentScriptAnchorGetter;\n mount?: ContentScriptMountFunction;\n render?: ContentScriptRenderValue | ContentScriptRenderHandler;\n container?: ContentScriptContainerTag | ContentScriptContainerOptions | ContentScriptContainerFactory;\n watch?: true | ContentScriptWatchStrategy;\n main?: ContentScriptMainFunction;\n}\n\nexport interface ContentScriptResolvedDefinition extends Omit<ContentScriptDefinition, 'anchor' | 'mount' | 'container' | 'render' | 'watch'> {\n anchor: ContentScriptAnchorResolver;\n mount: ContentScriptMountFunction;\n render: ContentScriptRenderHandler;\n container: ContentScriptContainerCreator;\n watch: ContentScriptWatchStrategy;\n}\n\nexport interface ContentScriptAppendDefinition extends Omit<ContentScriptDefinition, 'mount'> {\n append?: ContentScriptAppend;\n}\n\n// Builder\nexport type ContentScriptBuilder = EntrypointBuilder;\n","import {ContentScriptAppend, ContentScriptMountFunction} from \"@typing/content\";\n\nexport const contentScriptMountAppendResolver = (append?: ContentScriptAppend): ContentScriptMountFunction => (\n anchor: Element,\n container: Element\n): void => {\n switch (append) {\n case ContentScriptAppend.Last:\n anchor.append(container);\n break;\n default:\n case undefined:\n case ContentScriptAppend.First:\n anchor.prepend(container);\n break;\n case ContentScriptAppend.Replace:\n anchor.replaceWith(container);\n break;\n case ContentScriptAppend.After:\n anchor.parentElement?.insertBefore(container, anchor.nextElementSibling);\n break;\n case ContentScriptAppend.Before:\n anchor.parentElement?.insertBefore(container, anchor);\n break;\n }\n}","import {ContentScriptRenderHandler, ContentScriptRenderValue} from \"@typing/content\";\n\nexport const isValidContentScriptRenderValue = (value: unknown): value is string | number | Element => {\n return (typeof value === \"string\" && value.length > 0) || typeof value === \"number\" || value instanceof Element;\n}\n\nexport const contentScriptRenderResolver = (\n render?: ContentScriptRenderValue | ContentScriptRenderHandler\n): ContentScriptRenderHandler => async (props): Promise<void | ContentScriptRenderValue> => {\n let resolvedRender = typeof render === \"function\" ? render(props) : render;\n\n if (resolvedRender instanceof Promise) {\n resolvedRender = await resolvedRender;\n }\n\n if (!isValidContentScriptRenderValue(resolvedRender)) {\n return;\n }\n\n return resolvedRender;\n}","import {isValidContentScriptRenderValue} from \"../resolvers/render\";\n\nimport {ContentScriptDefinition, ContentScriptRenderHandler, ContentScriptRenderValue} from \"@typing/content\";\n\nexport const isContentScriptDefinition = (definition: any): definition is ContentScriptDefinition => {\n return definition && typeof definition === 'object' && definition.constructor === Object && !('$$typeof' in definition);\n}\n\nexport const isValidContentScriptDefinitionRenderValue =\n (definition: any): definition is ContentScriptRenderValue | ContentScriptRenderHandler => {\n return isValidContentScriptRenderValue(definition) ||\n typeof definition === \"function\" ||\n (\n typeof definition === \"object\" &&\n definition.constructor === Object &&\n '$$typeof' in definition\n );\n }","import {contentScriptMountAppendResolver} from \"@entry/content\";\n\nimport {ContentScriptAppendDefinition, ContentScriptDefinition} from \"@typing/content\";\n\nexport * from \"@entry/content\";\nexport * from \"@typing/content\";\n\nexport const defineContentScript = (options: ContentScriptDefinition): ContentScriptDefinition => {\n return options;\n}\n\nexport const defineContentScriptAppend = (options: ContentScriptAppendDefinition): ContentScriptDefinition => {\n const {append, ...definition} = options;\n\n return {\n ...definition,\n mount: contentScriptMountAppendResolver(append),\n };\n}","import {Browser} from \"@typing/browser\";\nimport {ManifestVersion} from \"@typing/manifest\";\n\nexport const getEnv: {\n <T extends string>(key: string): T | undefined;\n <T extends string, D>(key: string, defaults: D): T | D;\n} = (key: string, defaults?: string) => {\n const env = process.env;\n\n return (env[key] ?? defaults) as any;\n};\n\nexport const getApp = (): string => {\n const app = getEnv('APP');\n\n if (app === undefined) {\n throw new Error('App is not defined');\n }\n\n return app;\n};\n\nexport const getBrowser = (): Browser => {\n const browser = getEnv<Browser>('BROWSER');\n\n if (browser === undefined) {\n throw new Error('Browser is not defined');\n }\n\n return browser;\n}\n\nexport const isBrowser = (browser: Browser): browser is Browser => {\n return getBrowser() === browser;\n}\n\nexport const getManifestVersion = (): ManifestVersion => {\n const manifestVersion = getEnv('MANIFEST_VERSION', '3');\n\n return parseInt(manifestVersion) as ManifestVersion;\n}","export enum Language {\n Arabic = 'ar',\n Amharic = 'am',\n Bulgarian = 'bg',\n Bengali = 'bn',\n Catalan = 'ca',\n Czech = 'cs',\n Danish = 'da',\n German = 'de',\n Greek = 'el',\n English = 'en',\n EnglishAustralia = 'en_AU',\n EnglishGreatBritain = 'en_GB',\n EnglishUSA = 'en_US',\n Spanish = 'es',\n SpanishLatinAmericaAndCaribbean = 'es_419',\n Estonian = 'et',\n Persian = 'fa',\n Finnish = 'fi',\n Filipino = 'fil',\n French = 'fr',\n Gujarati = 'gu',\n Hebrew = 'he',\n Hindi = 'hi',\n Croatian = 'hr',\n Hungarian = 'hu',\n Indonesian = 'id',\n Italian = 'it',\n Japanese = 'ja',\n Kannada = 'kn',\n Korean = 'ko',\n Lithuanian = 'lt',\n Latvian = 'lv',\n Malayalam = 'ml',\n Marathi = 'mr',\n Malay = 'ms',\n Dutch = 'nl',\n Norwegian = 'no',\n Polish = 'pl',\n PortugueseBrazil = 'pt_BR',\n PortuguesePortugal = 'pt_PT',\n Romanian = 'ro',\n Russian = 'ru',\n Slovak = 'sk',\n Slovenian = 'sl',\n Serbian = 'sr',\n Swedish = 'sv',\n Swahili = 'sw',\n Tamil = 'ta',\n Telugu = 'te',\n Thai = 'th',\n Turkish = 'tr',\n Ukrainian = 'uk',\n Vietnamese = 'vi',\n ChineseChina = 'zh_CN',\n ChineseTaiwan = 'zh_TW',\n}\n\nexport enum LocaleDir {\n RightToLeft = 'rtl',\n LeftToRight = 'ltr',\n}\n\nexport const RtlLanguages: ReadonlySet<Language> = new Set([\n Language.Arabic,\n Language.Persian,\n Language.Hebrew,\n]);\n\nexport const LocaleNestedKeysSeparator = '.';\n\nexport const LocaleKeysSeparator = '_';\n\nexport const LocaleValuesSeparator = '|';\n\nexport const LocaleCustomKeyForLanguage = 'locale';\n\nexport const LocaleKeyMarker = '@';\n\nexport const LanguageCodes: ReadonlySet<string> = new Set(Object.values(Language));\n\nexport const LocaleFileExtensions: ReadonlySet<string> = new Set(['yaml', 'yml', 'json']);\n\nexport const LocaleDirectoryName = 'locales';\n\nexport type LocaleValue = string | number | string[] | number[];\n\nexport type LocaleData = {\n [key: string]: LocaleValue | LocaleData;\n};\n\nexport type LocaleItems = Map<string, string>;\n\nexport type LocaleKeys = ReadonlySet<string>;\n\nexport type LocaleMessages = {\n [key: string]: {\n message: string;\n };\n};\n\nexport interface LocaleBuilder {\n lang(): Language;\n\n merge(data: LocaleData): this;\n\n build(): LocaleMessages;\n\n get(): LocaleItems;\n\n keys(): LocaleKeys;\n\n structure(): LocaleStructure;\n\n isValid(): boolean;\n\n validate(): this;\n}\n\nexport interface LocaleValidator {\n isValid(locale: LocaleBuilder): boolean;\n\n validate(locale: LocaleBuilder): this;\n}\n\nexport type LocaleFutures = {\n plural: boolean;\n substitutions: readonly string[];\n};\n\nexport interface LocaleStructure {\n [key: string]: LocaleFutures;\n}\n\nexport type LocaleNonPluralKeys<T extends LocaleStructure> =\n { [K in keyof T]: T[K] extends { plural: false } ? K : never }[keyof T] & string\n\nexport type LocalePluralKeys<T extends LocaleStructure> =\n { [K in keyof T]: T[K] extends { plural: true } ? K : never }[keyof T] & string\n\nexport type LocaleSubstitutionsFor<\n T extends LocaleStructure,\n K extends keyof T\n> = T[K] extends { substitutions: readonly (infer U)[] }\n ? Partial<Record<U & string, string | number>>\n : never\n\nexport interface LocaleProvider<S extends LocaleStructure> {\n lang(): Language;\n\n keys(): ReadonlySet<keyof S>;\n\n // non-plural keys\n trans<K extends LocaleNonPluralKeys<S>>(\n key: K,\n substitutions?: LocaleSubstitutionsFor<S, K>\n ): string;\n\n // plural keys\n choice<K extends LocalePluralKeys<S>>(\n key: K,\n count: number,\n substitutions?: LocaleSubstitutionsFor<S, K>\n ): string;\n}\n","import {\n Language,\n LocaleNonPluralKeys,\n LocalePluralKeys,\n LocaleProvider,\n LocaleStructure,\n LocaleSubstitutionsFor,\n LocaleValuesSeparator\n} from \"@typing/locale\";\n\nexport default abstract class AbstractLocale<S extends LocaleStructure>\n implements LocaleProvider<S> {\n\n public abstract lang(): Language;\n\n public abstract keys(): Set<keyof S>;\n\n protected abstract value(key: keyof S & string): string | undefined;\n\n /**\n * Non-plural перевод\n */\n public trans<K extends LocaleNonPluralKeys<S>>(\n key: K,\n substitutions?: LocaleSubstitutionsFor<S, K>\n ): string {\n return this.get(key, substitutions);\n }\n\n /**\n * Plural-перевод\n */\n public choice<K extends LocalePluralKeys<S>>(\n key: K,\n count: number,\n substitutions?: LocaleSubstitutionsFor<S, K>\n ): string {\n const parts = this.get(key, substitutions).split(LocaleValuesSeparator);\n const idx = this.getPluralIndex(count);\n return parts[idx] ?? parts[0] ?? (key as string);\n }\n\n public get<K extends keyof S & string>(\n key: K,\n substitutions?: LocaleSubstitutionsFor<S, K>\n ): string {\n const template = this.value(key);\n\n if (template === undefined) {\n console.warn(`Locale key \"${key}\" not found in \"${this.lang()}\" language.`);\n return key as string;\n }\n\n if (substitutions) {\n return template.replace(/{{(.*?)}}/g, (_, placeholder: string) => {\n if (placeholder in substitutions) {\n return substitutions[placeholder]!.toString();\n }\n console.warn(\n `Locale substitution \"${placeholder}\" not found for key \"${key}\" in \"${this.lang()}\" language.`\n );\n return placeholder;\n });\n }\n\n return template;\n }\n\n private getPluralIndex(count: number): number {\n switch (this.lang()) {\n case Language.Indonesian:\n case Language.Japanese:\n case Language.Kannada:\n case Language.Korean:\n case Language.Malay:\n case Language.Thai:\n case Language.Turkish:\n case Language.Vietnamese:\n return 0;\n\n case Language.Bengali:\n case Language.Bulgarian:\n case Language.Catalan:\n case Language.Danish:\n case Language.German:\n case Language.Greek:\n case Language.English:\n case Language.EnglishAustralia:\n case Language.EnglishGreatBritain:\n case Language.EnglishUSA:\n case Language.Spanish:\n case Language.SpanishLatinAmericaAndCaribbean:\n case Language.Estonian:\n case Language.Persian:\n case Language.Finnish:\n case Language.Gujarati:\n case Language.Hebrew:\n case Language.Hungarian:\n case Language.Italian:\n case Language.Malayalam:\n case Language.Marathi:\n case Language.Dutch:\n case Language.Norwegian:\n case Language.Swedish:\n case Language.Swahili:\n case Language.Tamil:\n case Language.Telugu:\n case Language.ChineseChina:\n case Language.ChineseTaiwan:\n case Language.PortugueseBrazil:\n case Language.PortuguesePortugal:\n return (count == 1) ? 0 : 1;\n\n case Language.Amharic:\n case Language.Filipino:\n case Language.French:\n case Language.Hindi:\n return ((count == 0) || (count == 1)) ? 0 : 1;\n\n case Language.Croatian:\n case Language.Russian:\n case Language.Serbian:\n case Language.Ukrainian:\n return ((count % 10 == 1) && (count % 100 != 11)) ? 0 : (((count % 10 >= 2) && (count % 10 <= 4) && ((count % 100 < 10) || (count % 100 >= 20))) ? 1 : 2);\n\n case Language.Czech:\n case Language.Slovak:\n return (count == 1) ? 0 : (((count >= 2) && (count <= 4)) ? 1 : 2);\n\n case Language.Lithuanian:\n return ((count % 10 == 1) && (count % 100 != 11)) ? 0 : (((count % 10 >= 2) && ((count % 100 < 10) || (count % 100 >= 20))) ? 1 : 2);\n\n case Language.Slovenian:\n return (count % 100 == 1) ? 0 : ((count % 100 == 2) ? 1 : (((count % 100 == 3) || (count % 100 == 4)) ? 2 : 3));\n\n case Language.Latvian:\n return (count == 0) ? 0 : (((count % 10 == 1) && (count % 100 != 11)) ? 1 : 2);\n\n case Language.Polish:\n return (count == 1) ? 0 : (((count % 10 >= 2) && (count % 10 <= 4) && ((count % 100 < 12) || (count % 100 > 14))) ? 1 : 2);\n\n case Language.Romanian:\n return (count == 1) ? 0 : (((count == 0) || ((count % 100 > 0) && (count % 100 < 20))) ? 1 : 2);\n\n case Language.Arabic:\n return (count == 0) ? 0 : ((count == 1) ? 1 : ((count == 2) ? 2 : (((count % 100 >= 3) && (count % 100 <= 10)) ? 3 : (((count % 100 >= 11) && (count % 100 <= 99)) ? 4 : 5))));\n\n default:\n return 0;\n }\n }\n}\n\n","export const browser = (): typeof chrome => {\n return chrome;\n}","import {browser} from \"./browser\";\nimport {ManifestVersion} from \"@typing/manifest\";\n\ntype Manifest = chrome.runtime.Manifest;\ntype PlatformInfo = chrome.runtime.PlatformInfo;\ntype ContextFilter = chrome.runtime.ContextFilter;\ntype ExtensionContext = chrome.runtime.ExtensionContext;\n\nconst runtime = () => browser().runtime;\n\nconst backgroundPaths = [\n '/_generated_background_page.view',\n];\n\nexport const getId = (): string => runtime().id;\n\nexport const getUrl = (path: string) => runtime().getURL(path);\n\nexport const getManifest = (): Manifest => runtime().getManifest();\n\nexport const getManifestVersion = (): ManifestVersion => getManifest().manifest_version;\n\nexport const getRuntimeContexts = (filter: ContextFilter) => new Promise<ExtensionContext[]>((resolve, reject) => {\n runtime().getContexts(filter, contexts => {\n try {\n throwRuntimeError();\n\n resolve(contexts);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const getPlatformInfo = (): Promise<PlatformInfo> => new Promise<PlatformInfo>((resolve, reject) => {\n runtime().getPlatformInfo((platformInfo) => {\n try {\n throwRuntimeError();\n\n resolve(platformInfo);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const isManifestVersion3 = (): boolean => getManifestVersion() === 3;\n\nexport const isBackground = (): boolean => {\n if (!getId()) {\n return false;\n }\n\n const manifest = getManifest();\n\n if (!manifest.background) {\n return false;\n }\n\n if (manifest.manifest_version === 3) {\n return typeof window === \"undefined\";\n }\n\n return window !== undefined && backgroundPaths.includes(location.pathname);\n}\n\nexport const throwRuntimeError = (): void => {\n const error = runtime().lastError;\n\n if (error) {\n throw new Error(error.message);\n }\n}\n\nexport const onRuntimeInstalled = (callback: Parameters<typeof chrome.runtime.onInstalled.addListener>[0]): () => void => {\n runtime().onInstalled.addListener(callback);\n\n return () => runtime().onInstalled.removeListener(callback);\n}\n","import {browser} from \"./browser\";\nimport {throwRuntimeError} from \"./runtime\";\n\ntype LanguageDetectionResult = chrome.i18n.LanguageDetectionResult\n\nconst i18n = () => browser().i18n;\n\nexport const canUseNativeI18nMessage = (): boolean => typeof (i18n().getMessage) !== \"undefined\";\n\nexport const getI18nMessage = (key: string): string | undefined => {\n if (!canUseNativeI18nMessage()) {\n return;\n }\n\n return i18n().getMessage(key);\n}\n\nexport const getI18nAcceptLanguages = (): Promise<string[]> => new Promise<string[]>((resolve, reject) => {\n i18n().getAcceptLanguages(locales => {\n try {\n throwRuntimeError();\n\n resolve(locales);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const getI18nUILanguage = (): string | undefined => {\n const i18n = browser().i18n;\n\n if (!i18n['getUILanguage']) {\n return;\n }\n\n return i18n.getUILanguage();\n}\n\nexport const detectI18Language = (text: string): Promise<LanguageDetectionResult> => new Promise<LanguageDetectionResult>((resolve, reject) => {\n i18n().detectLanguage(text, result => {\n try {\n throwRuntimeError();\n\n resolve(result);\n } catch (e) {\n reject(e);\n }\n });\n});\n","import {Language, LocaleKeyMarker, LocaleKeysSeparator, LocaleNestedKeysSeparator} from \"@typing/locale\";\n\nexport const getLocaleFilename = (lang: Language): string => {\n return `_locales/${lang}/messages.json`;\n};\n\nexport const convertLocaleKey = (key: string): string => {\n return key.replaceAll(LocaleNestedKeysSeparator, LocaleKeysSeparator);\n}\n\nexport const convertLocaleMessageKey = (key: string): string => {\n return `__MSG_${convertLocaleKey(key)}__`;\n}\n\nexport const extractLocaleKey = (key?: string): string | undefined => {\n if (isLocaleKey(key)) {\n return key.substring(1);\n }\n}\n\nexport const isLocaleKey = (key?: string): key is string => {\n return key?.startsWith(LocaleKeyMarker) ?? false;\n}\n\nexport const modifyLocaleMessageKey = (key?: string): string | undefined => {\n if (typeof key !== \"string\") {\n return undefined;\n }\n\n const localeKey = extractLocaleKey(key);\n\n if (localeKey) {\n return convertLocaleMessageKey(localeKey);\n }\n\n return key;\n}\n\n","import {getI18nMessage, getI18nUILanguage} from \"@browser/i18n\";\n\nimport AbstractLocale from \"./AbstractLocale\";\n\nimport {convertLocaleKey} from \"@locale/utils\";\nimport {isBrowser} from \"@main/env\";\n\nimport {Language, LanguageCodes, LocaleCustomKeyForLanguage, LocaleProvider, LocaleStructure} from \"@typing/locale\";\nimport {Browser} from \"@typing/browser\";\n\nexport interface LocaleNativeStructure extends LocaleStructure {\n}\n\nexport default class NativeLocale extends AbstractLocale<LocaleNativeStructure> {\n private static instance?: LocaleProvider<LocaleNativeStructure>;\n\n public static getInstance<S extends LocaleStructure = LocaleNativeStructure>(): LocaleProvider<S> {\n return NativeLocale.instance ??= new NativeLocale();\n }\n\n public lang(): Language {\n let lang: Language | undefined;\n\n /**\n * The Opera browser does not support RTL languages,\n * and for Opera you need to directly indicate what kind of language it is.\n * interface language is always different\n */\n if (isBrowser(Browser.Opera)) {\n lang = getI18nMessage(LocaleCustomKeyForLanguage) as Language;\n\n if (LanguageCodes.has(lang)) {\n return lang;\n }\n }\n\n lang = getI18nUILanguage() as Language;\n\n if (!lang) {\n throw new Error(\"Locale Native: Unable to get UI language\");\n }\n\n return lang;\n }\n\n\n public keys(): Set<keyof LocaleNativeStructure> {\n try {\n // @ts-expect-error\n return new Set<string>(LOCALE_KEYS);\n } catch (e) {\n console.error(\"Locale Native: Unable to get keys\", e);\n\n return new Set<string>();\n }\n }\n\n protected value(key: Extract<keyof LocaleNativeStructure, string>): string | undefined {\n const value = getI18nMessage(convertLocaleKey(key));\n\n if (!value || value.length === 0) {\n return undefined;\n }\n\n return value;\n }\n}","import {LocaleNativeStructure, NativeLocale} from \"@locale/providers\";\n\nimport {convertLocaleMessageKey, extractLocaleKey} from \"@locale/utils\";\n\nimport {\n Language,\n LanguageCodes,\n LocaleDir,\n LocaleNonPluralKeys,\n LocalePluralKeys,\n LocaleSubstitutionsFor\n} from \"@typing/locale\";\n\nexport {Language, LanguageCodes, LocaleDir};\n\n/**\n * Translates a given locale key into the corresponding localized string.\n *\n * @template K - A type representing the non-plural keys of the locale structure.\n * @param {K} key - The locale key to be translated.\n * @param {LocaleSubstitutionsFor<LocaleNativeStructure, K>} [substitutions] - Optional substitutions to be applied\n * within the localized string. These are typically placeholders replaced with dynamic values.\n * @returns {string} - The translated string for the given key, with substitutions applied if provided.\n */\nexport const _ = <K extends LocaleNonPluralKeys<LocaleNativeStructure>>(\n key: K,\n substitutions?: LocaleSubstitutionsFor<LocaleNativeStructure, K>,\n): string => {\n return NativeLocale.getInstance().trans(key, substitutions);\n};\n\n/**\n * Translates a given locale key into the corresponding localized string\n * based on a specific count for pluralization.\n *\n * @template K - A type representing the non-plural keys of the locale structure.\n * @param {K} key - The locale key to be translated.\n * @param {number} count - The count used to determine the pluralization form.\n * @param {LocaleSubstitutionsFor<LocaleNativeStructure, K>} [substitutions] - Optional substitutions to be applied\n * within the localized string. These are typically placeholders replaced with dynamic values.\n * @returns {string} - The translated string for the given key, adjusted for pluralization and with substitutions applied if provided.\n */\nexport const _c = <K extends LocalePluralKeys<LocaleNativeStructure>>(\n key: K,\n count: number,\n substitutions?: LocaleSubstitutionsFor<LocaleNativeStructure, K>,\n): string => {\n return NativeLocale.getInstance().choice(key, count, substitutions);\n};\n\n/**\n * Converts a locale key into a standardized format and logs a warning if the key is not found\n * in the current language's locale keys.\n *\n * @param {Extract<keyof LocaleNativeStructure, string>} key - The locale key to be converted.\n * This key must be a string and exist within the `LocaleNativeStructure`.\n * @returns {string} - The converted locale message key.\n */\nexport const __ = (key: keyof LocaleNativeStructure & string): string => {\n const locale = NativeLocale.getInstance();\n\n if (!locale.keys().has(key)) {\n console.warn(`Locale key \"${key}\" not found in \"${locale.lang()}\" language.`);\n }\n\n return convertLocaleMessageKey(key);\n};\n\n\n/**\n * Attempts to extract a locale key from the provided string and translates it\n * into the corresponding localized string. If no locale key can be extracted,\n * the original string is returned.\n *\n * @param {string} input - The input string from which a locale key is to be extracted.\n * @returns {string} - The translated string if a locale key is successfully extracted,\n * or the original string if no locale key is found.\n */\nexport const __t = (input: string): string => {\n const localeKey = extractLocaleKey(input);\n\n if (localeKey) {\n return _(localeKey as LocaleNonPluralKeys<LocaleNativeStructure>);\n }\n\n return input;\n};","import {getUrl} from \"@browser/runtime\";\n\nimport {PageConfig, PageDefinition, PageProps} from \"@typing/page\";\n\nexport type {PageDefinition, PageProps, PageConfig};\n\nexport type PageAlias = string;\n\nexport type PageMap = Map<PageAlias, string>;\n\nexport const definePage = (options: PageDefinition): PageDefinition => {\n return options;\n};\n\nexport const getPages = (): PageMap => {\n const pages: PageMap = new Map();\n\n try {\n // @ts-expect-error: PAGE_ALIAS is a virtual variable generated by the bundler `src/cli/plugins/page/index.ts`\n Object.entries<string>(PAGE_ALIAS).forEach(([key, value]) => {\n pages.set(key, value);\n });\n } catch (e) {\n console.error('Error getting pages:', e);\n }\n\n return pages;\n}\n\nexport const getPageUrl = (alias: PageAlias): string => {\n let path = getPages().get(alias);\n\n if (!path) {\n console.warn(`Cannot find page: ${alias}`);\n\n path = alias;\n }\n\n return getUrl(path);\n}","import {Plugin, PluginDefinition} from \"@typing/plugin\";\n\nexport type {Plugin, PluginDefinition};\n\nexport function definePlugin<T extends any[] = []>(plugin: PluginDefinition<T>): PluginDefinition<T> {\n return plugin;\n}","import {Required} from \"utility-types\";\n\nimport {EntrypointBuilder, EntrypointOptions} from \"@typing/entrypoint\";\nimport {BackgroundConfig} from \"@typing/background\";\nimport {Awaiter, DeepAsyncProxy} from \"@typing/helpers\";\n\nexport const ServiceGlobalKey = 'adnbnService';\n\nexport type ServiceType = ((...args: any[]) => Promise<any>) | { [key: string]: any | ServiceType };\n\nexport interface ServiceDictionary {\n [key: string]: any;\n}\n\nexport type ServiceName = Extract<keyof ServiceDictionary, string>;\n\nexport type ServiceTarget<T extends ServiceDictionary, K extends keyof T> = T[K];\n\nexport type ServiceProxyTarget<T extends ServiceDictionary, K extends keyof T> = DeepAsyncProxy<T[K]>;\n\nexport interface ServiceManager {\n add<K extends ServiceName>(\n name: K,\n instance: ServiceDictionary[K]\n ): this;\n\n get<K extends ServiceName>(\n name: K\n ): ServiceDictionary[K] | undefined;\n\n has(name: ServiceName): boolean;\n\n remove<K extends ServiceName>(\n name: K\n ): ServiceDictionary[K] | undefined;\n\n clear(): this;\n}\n\nexport interface ServiceConfig extends BackgroundConfig {\n name: string;\n}\n\nexport type ServiceOptions = ServiceConfig & EntrypointOptions;\n\nexport type ServiceEntrypointOptions = Partial<ServiceOptions>;\n\nexport type ServiceInitGetter<T extends ServiceType> = (options: ServiceOptions) => T;\n\nexport type ServiceMainHandler<T extends ServiceType> = (service: T, options: ServiceOptions) => Awaiter<void>;\n\nexport type ServiceDefinition<T extends ServiceType> = ServiceEntrypointOptions & {\n init?: ServiceInitGetter<T>;\n main?: ServiceMainHandler<T>;\n};\n\nexport type ServiceUnresolvedDefinition<T extends ServiceType> = Partial<ServiceDefinition<T>>;\n\nexport type ServiceResolvedDefinition<T extends ServiceType> = Required<ServiceDefinition<T>, 'name' | 'init'>;\n\nexport type ServiceBuilder = EntrypointBuilder;\n","import {\n ServiceDictionary,\n ServiceGlobalKey,\n ServiceManager as ServiceManagerContract,\n ServiceName\n} from \"@typing/service\";\n\nexport default class ServiceManager implements ServiceManagerContract {\n private services = new Map<\n ServiceName,\n ServiceDictionary[ServiceName]\n >();\n\n public static getInstance(): ServiceManagerContract {\n return globalThis[ServiceGlobalKey] ??= new ServiceManager();\n }\n\n public add<K extends ServiceName>(\n name: K,\n instance: ServiceDictionary[K]\n ): this {\n this.services.set(name, instance);\n\n return this;\n }\n\n public get<K extends ServiceName>(\n name: K\n ): ServiceDictionary[K] | undefined {\n return this.services.get(name) as ServiceDictionary[K] | undefined;\n }\n\n public has(name: ServiceName): boolean {\n return this.services.has(name);\n }\n\n public remove<K extends ServiceName>(\n name: K\n ): ServiceDictionary[K] | undefined {\n const service = this.get(name);\n\n this.services.delete(name);\n\n return service;\n }\n\n public clear(): this {\n this.services.clear();\n\n return this;\n }\n}","import {isBackground} from \"@browser/runtime\";\n\nimport ServiceManager from \"../ServiceManager\";\n\nimport {ServiceDictionary, ServiceManager as ServiceManagerContract, ServiceName} from \"@typing/service\";\n\nexport default class<N extends ServiceName, T = ServiceDictionary[N]> {\n constructor(protected readonly name: N) {\n }\n\n protected get manager(): ServiceManagerContract {\n return ServiceManager.getInstance();\n }\n\n public get(): T {\n if (!isBackground()) {\n throw new Error('BaseService.get() must be called from within the background context.');\n }\n\n return this.manager.get(this.name);\n }\n\n public destroy(): void {\n this.manager.remove(this.name);\n }\n}\n","import {nanoid} from 'nanoid';\nimport {\n MessageBody,\n MessageData,\n MessageGeneralHandler,\n MessageTargetHandler,\n MessageMap,\n MessageMapHandler,\n MessageProvider,\n MessageResponse,\n MessageType\n} from '@typing/message'\n\nexport default abstract class AbstractMessage<T extends MessageMap, TOptions> implements MessageProvider<T, TOptions> {\n public abstract send<K extends MessageType<T>>(type: K, data: MessageData<T, K>, options?: TOptions): Promise<MessageResponse<T, K>>;\n\n public abstract watch<K extends MessageType<T>>(type: K, handler: MessageTargetHandler<T, K>): () => void;\n\n public abstract watch(map: MessageMapHandler<T>): () => void;\n\n public abstract watch<K extends MessageType<T>>(general: MessageGeneralHandler<T, K>): () => void;\n\n protected buildMessage<K extends MessageType<T>>(type: K, data: MessageData<T, K>): MessageBody<T, K> {\n return {\n id: nanoid(),\n type,\n data,\n timestamp: Date.now(),\n };\n }\n}\n","import {browser} from '@browser/browser'\n\nimport {MessageBody, MessageHandler, MessageMap, MessageSender, MessageType} from '@typing/message';\n\nexport default class MessageManager<T extends MessageMap> {\n private handlers: Set<MessageHandler<T>> = new Set()\n private isListenerAttached = false;\n\n private static instance: MessageManager<MessageMap> | null = null;\n\n public static getInstance<T extends MessageMap>(): MessageManager<T> {\n if (MessageManager.instance === null) {\n MessageManager.instance = new MessageManager<T>();\n }\n return MessageManager.instance;\n }\n\n constructor() {\n this.listener = this.listener.bind(this);\n }\n\n public add(handler: MessageHandler<T>) {\n this.handlers.add(handler);\n this.updateListener();\n }\n\n public remove(handler: MessageHandler<T>) {\n this.handlers.delete(handler);\n this.updateListener();\n }\n\n public clear() {\n this.handlers = new Set();\n this.updateListener();\n }\n\n private updateListener() {\n if (this.handlers.size > 0 && !this.isListenerAttached) {\n browser().runtime.onMessage.addListener(this.listener);\n this.isListenerAttached = true;\n } else if (this.handlers.size === 0 && this.isListenerAttached) {\n browser().runtime.onMessage.removeListener(this.listener);\n this.isListenerAttached = false;\n }\n }\n\n private listener<K extends MessageType<T>>(\n message: MessageBody<T, K>,\n sender: MessageSender,\n sendResponse: (response?: any) => void\n ): boolean | void {\n if (!message || typeof message !== 'object' || !message.type) return;\n\n const results: Promise<any>[] = [];\n\n for (const handler of this.handlers) {\n try {\n const result = handler.run(message.type, message.data, sender);\n if (result !== undefined) {\n results.push(Promise.resolve(result));\n }\n } catch (err) {\n console.error('Message handler error:', err);\n }\n }\n\n if (results.length > 1) {\n throw new Error(`Message type \"${message.type}\" has multiple handlers returning a response. Only one response is allowed.`)\n }\n\n if (results.length === 1) {\n results[0].then(sendResponse);\n return true;\n }\n };\n}\n","import {MessageHandler, MessageData, MessageMap, MessageResponse, MessageSender, MessageType} from \"@typing/message\";\n\nexport default abstract class AbstractHandler<T extends MessageMap> implements MessageHandler<T> {\n\n public abstract run(type: MessageType<T>, data: MessageData<T, MessageType<T>>, sender: MessageSender): MessageResponse<T, MessageType<T>> | undefined\n}\n","import AbstractHandler from \"./AbstractHandler\";\nimport {MessageData, MessageTargetHandler, MessageMap, MessageResponse, MessageSender, MessageType} from \"@typing/message\";\n\nexport default class SingleHandler<T extends MessageMap> extends AbstractHandler<T> {\n\n constructor(private messageType: MessageType<T>, private handler: MessageTargetHandler<T, MessageType<T>>) {\n super();\n }\n\n public run(type: MessageType<T>, data: MessageData<T, MessageType<T>>, sender: MessageSender): MessageResponse<T, MessageType<T>> | undefined {\n if (type === this.messageType) {\n return this.handler(data, sender);\n }\n }\n}\n","import AbstractHandler from \"./AbstractHandler\";\nimport {\n MessageData,\n MessageMap,\n MessageMapHandler,\n MessageResponse,\n MessageSender,\n MessageType\n} from \"@typing/message\";\n\nexport default class MapHandler<T extends MessageMap> extends AbstractHandler<T> {\n\n constructor(private map: MessageMapHandler<T>) {\n super();\n }\n\n public run(type: MessageType<T>, data: MessageData<T, MessageType<T>>, sender: MessageSender): MessageResponse<T, MessageType<T>> | undefined {\n const handler = this.map[type];\n if (handler) {\n if (typeof handler === \"function\") {\n return handler(data, sender);\n } else {\n throw new Error(`Handler for type \"${type}\" in object of handlers must be a function`)\n }\n }\n }\n}\n","import AbstractHandler from \"./AbstractHandler\";\nimport {\n MessageData,\n MessageGeneralHandler,\n MessageMap,\n MessageResponse,\n MessageSender,\n MessageType\n} from \"@typing/message\";\n\nexport default class GeneralHandler<T extends MessageMap, K extends MessageType<T>> extends AbstractHandler<T> {\n\n constructor(private generalHandler: MessageGeneralHandler<T, K>) {\n super();\n }\n\n public run(type: K, data: MessageData<T, MessageType<T>>, sender: MessageSender): MessageResponse<T, MessageType<T>> | undefined {\n return this.generalHandler(type, data, sender);\n }\n}\n","import {browser} from '@browser/browser'\nimport {throwRuntimeError} from \"@browser/runtime\";\nimport {\n MessageData,\n MessageGeneralHandler,\n MessageHandler,\n MessageMap,\n MessageMapHandler,\n MessageResponse,\n MessageTargetHandler,\n MessageType\n} from '@typing/message';\n\nimport AbstractMessage from './AbstractMessage';\nimport MessageManager from \"../MessageManager\";\n\nimport {GeneralHandler, MapHandler, SingleHandler} from \"../handlers\";\n\nexport type MessageSendOptions = number | { tabId: number; frameId?: number };\n\nexport default class Message<T extends MessageMap> extends AbstractMessage<T, MessageSendOptions> {\n protected manager = MessageManager.getInstance<T>();\n\n public send<K extends MessageType<T>>(type: K, data: MessageData<T, K>, options?: MessageSendOptions): Promise<MessageResponse<T, K>> {\n const message = this.buildMessage(type, data);\n\n if (typeof options === 'number' || typeof options === 'object') {\n const tabId = typeof options === 'number' ? options : options.tabId;\n const frameId = typeof options === 'object' && options.frameId !== undefined ? options.frameId : undefined;\n\n return new Promise((resolve, reject) => {\n browser().tabs.sendMessage(tabId, message, {frameId}, (response) => {\n try {\n throwRuntimeError()\n resolve(response);\n } catch (e) {\n reject(e)\n }\n });\n });\n }\n\n return new Promise((resolve, reject) => {\n browser().runtime.sendMessage(message, (response) => {\n try {\n throwRuntimeError()\n resolve(response);\n } catch (e) {\n reject(e)\n }\n });\n });\n }\n\n public watch<K extends MessageType<T>>(\n arg1: K | MessageMapHandler<T> | MessageGeneralHandler<T, K>,\n arg2?: MessageTargetHandler<T, K>\n ): () => void {\n\n let handler: MessageHandler<T>\n\n if (typeof arg1 === 'function') {\n handler = new GeneralHandler<T, K>(arg1);\n } else if (typeof arg1 === 'object' && arg2 === undefined) {\n handler = new MapHandler<T>(arg1);\n } else if (typeof arg1 === 'string' && arg2) {\n handler = new SingleHandler<T>(arg1, arg2);\n } else {\n throw new Error('Invalid arguments passed to watch()');\n }\n\n this.manager.add(handler);\n\n return () => this.manager.remove(handler);\n }\n}\n","import {isBackground} from \"@browser/runtime\";\nimport {Message, MessageSendOptions} from \"@message/providers\";\n\nimport BaseService from \"./BaseService\";\n\nimport {ServiceDictionary, ServiceName} from \"@typing/service\";\nimport {MessageMap, MessageProvider} from \"@typing/message\";\nimport {DeepAsyncProxy} from \"@typing/helpers\";\n\nexport default class<N extends ServiceName, T = DeepAsyncProxy<ServiceDictionary[N]>> extends BaseService<N, T> {\n private _message?: MessageProvider<MessageMap, MessageSendOptions>;\n\n protected readonly messageKey: string;\n\n constructor(name: N) {\n super(name);\n\n this.messageKey = `service.${this.name}`;\n }\n\n protected get message(): MessageProvider<MessageMap, MessageSendOptions> {\n return this._message ??= new Message();\n }\n\n private createProxy(path?: string): T {\n const wrapped = () => {\n }\n\n const proxy = new Proxy(wrapped, {\n apply: async (_target, _thisArg, args) => {\n return this.message.send(this.messageKey, {path, args});\n },\n\n get: (_target, propertyName, receiver) => {\n if (propertyName === '__proxy' || typeof propertyName !== 'string') {\n return Reflect.get(wrapped, propertyName, receiver);\n }\n\n const newPath = path == null ? propertyName : `${path}.${String(propertyName)}`;\n\n return this.createProxy(newPath);\n },\n });\n\n // @ts-expect-error — Adding a hidden property\n proxy.__proxy = true;\n\n return proxy as unknown as T;\n }\n\n public get(): T {\n if (isBackground()) {\n throw new Error('ProxyService.get() cannot be called in the background');\n }\n\n return this.createProxy();\n }\n}\n","import {ProxyService} from \"@service/providers\";\n\nimport {\n ServiceDefinition,\n ServiceDictionary,\n ServiceInitGetter,\n ServiceMainHandler,\n ServiceType\n} from \"@typing/service\";\nimport {DeepAsyncProxy} from \"@typing/helpers\";\n\nexport type {ServiceDefinition, ServiceMainHandler, ServiceInitGetter};\n\nexport const defineService = <T extends ServiceType>(options: ServiceDefinition<T>): ServiceDefinition<T> => {\n return options;\n}\n\nexport const getService = <N extends Extract<keyof ServiceDictionary, string>>(name: N): DeepAsyncProxy<ServiceDictionary[N]> => {\n return new ProxyService(name).get();\n}"]}
|
|
1
|
+
{"version":3,"sources":["../src/types/app.ts","../src/main/background.ts","../src/types/browser.ts","../src/types/command.ts","../src/main/command.ts","../src/main/config.ts","../src/types/content.ts","../src/entry/content/core/resolvers/mount.ts","../src/entry/content/core/resolvers/render.ts","../src/entry/content/core/resolvers/definition.ts","../src/main/content.ts","../src/main/env.ts","../src/types/locale.ts","../src/locale/providers/AbstractLocale.ts","../src/browser/browser.ts","../src/browser/utils.ts","../src/browser/runtime.ts","../src/browser/i18n.ts","../src/locale/utils.ts","../src/locale/providers/NativeLocale.ts","../src/main/locale.ts","../src/main/page.ts","../src/main/plugin.ts","../src/types/service.ts","../src/service/ServiceManager.ts","../src/service/providers/BaseService.ts","../src/browser/tab.ts","../src/message/providers/AbstractMessage.ts","../src/types/message.ts","../src/message/MessageManager.ts","../src/message/handlers/AbstractHandler.ts","../src/message/handlers/SingleHandler.ts","../src/message/handlers/MapHandler.ts","../src/message/handlers/GeneralHandler.ts","../src/message/providers/Message.ts","../src/service/providers/ProxyService.ts","../src/main/service.ts"],"names":["Mode","Command","Browser","ContentScriptAppend","browser","Language","LocaleDir","_","i18n","nanoid"],"mappings":";;;;;;AAGY,IAAA,IAAA,qBAAAA,KAAL,KAAA;AACH,EAAAA,MAAA,MAAO,CAAA,GAAA,MAAA;AACP,EAAAA,MAAA,aAAc,CAAA,GAAA,aAAA;AACd,EAAAA,MAAA,YAAa,CAAA,GAAA,YAAA;AAHL,EAAAA,OAAAA,KAAAA;AAAA,CAAA,EAAA,IAAA,IAAA,EAAA;AAMA,IAAA,OAAA,qBAAAC,QAAL,KAAA;AACH,EAAAA,SAAA,OAAQ,CAAA,GAAA,OAAA;AACR,EAAAA,SAAA,OAAQ,CAAA,GAAA,OAAA;AAFA,EAAAA,OAAAA,QAAAA;AAAA,CAAA,EAAA,OAAA,IAAA,EAAA;;;ACLC,IAAA,gBAAA,GAAmB,CAAC,OAAwD,KAAA;AACrF,EAAO,OAAA,OAAA;AACX;;;ACNY,IAAA,OAAA,qBAAAC,QAAL,KAAA;AACH,EAAAA,SAAA,QAAS,CAAA,GAAA,QAAA;AACT,EAAAA,SAAA,UAAW,CAAA,GAAA,UAAA;AACX,EAAAA,SAAA,MAAO,CAAA,GAAA,MAAA;AACP,EAAAA,S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AA,CAAA;AAAA;AAG9H,IAAA,OAAO,KAAK,WAAY,EAAA;AAAA;AAEhC,CAAA;;;AC5Ca,IAAA,aAAA,GAAgB,CAAwB,OAAwD,KAAA;AACzG,EAAO,OAAA,OAAA;AACX;AAEa,IAAA,UAAA,GAAa,CAAqD,IAAkD,KAAA;AAC7H,EAAA,OAAO,IAAI,oBAAA,CAAa,IAAI,CAAA,CAAE,GAAI,EAAA;AACtC","file":"index.cjs","sourcesContent":["export const PackageName = 'adnbn';\nexport const SystemDir = '.adnbn';\n\nexport enum Mode {\n None = 'none',\n Development = 'development',\n Production = 'production',\n}\n\nexport enum Command {\n Build = 'build',\n Watch = 'watch',\n}","import {BackgroundConfig, BackgroundDefinition, BackgroundMainHandler} from \"@typing/background\";\n\nexport type {BackgroundConfig, BackgroundDefinition, BackgroundMainHandler};\n\nexport const defineBackground = (options: BackgroundDefinition): BackgroundDefinition => {\n return options;\n}\n","export enum Browser {\n Chrome = 'chrome',\n Chromium = 'chromium',\n Edge = 'edge',\n Firefox = 'firefox',\n Opera = 'opera',\n Safari = 'safari',\n}\n","import {Required} from \"utility-types\";\n\nimport {EntrypointBuilder, EntrypointOptions} from \"@typing/entrypoint\";\nimport {BackgroundConfig} from \"@typing/background\";\nimport {Awaiter} from \"@typing/helpers\";\n\ntype Tab = chrome.tabs.Tab;\n\nexport const CommandExecuteActionName = '_execute_action';\n\nexport interface CommandConfig extends BackgroundConfig {\n name: string;\n description?: string;\n global?: boolean;\n defaultKey?: string;\n windowsKey?: string;\n macKey?: string;\n chromeosKey?: string;\n linuxKey?: string;\n}\n\nexport type CommandOptions = CommandConfig & EntrypointOptions;\n\nexport type CommandEntrypointOptions = Partial<CommandOptions>;\n\nexport type CommandExecute = (tab: Tab | undefined, options: CommandOptions) => Awaiter<void>;\n\nexport interface CommandDefinition extends CommandEntrypointOptions {\n execute: CommandExecute;\n}\n\nexport type ExecuteActionCommandDefinition = Omit<CommandDefinition, 'name'>;\n\nexport type CommandUnresolvedDefinition = Partial<CommandDefinition>;\n\nexport type CommandResolvedDefinition = Required<CommandDefinition, 'name' | 'execute'>;\n\nexport type CommandBuilder = EntrypointBuilder;","import {\n CommandConfig,\n CommandDefinition,\n CommandExecute,\n CommandExecuteActionName,\n ExecuteActionCommandDefinition\n} from \"@typing/command\";\n\nexport {\n type CommandDefinition,\n type ExecuteActionCommandDefinition,\n CommandExecuteActionName,\n type CommandConfig,\n type CommandExecute\n};\n\nexport const defineCommand = (options: CommandDefinition): CommandDefinition => {\n return options;\n}\n\nexport const defineExecuteActionCommand = (options: ExecuteActionCommandDefinition): CommandDefinition => {\n return {...options, name: CommandExecuteActionName};\n}","import {Config, ConfigDefinition, ReadonlyConfig, UserConfig} from \"@typing/config\";\n\nexport type {Config, ReadonlyConfig, ConfigDefinition, UserConfig};\n\nexport const defineConfig = (config: ConfigDefinition): ConfigDefinition => {\n return config;\n}","import type {FC, ReactNode} from \"react\"\nimport {Optional} from 'utility-types';\n\nimport {EntrypointBuilder, EntrypointOptions} from \"@typing/entrypoint\";\nimport {Awaiter, PickNonFunctionProperties} from \"@typing/helpers\";\n\ntype ExecutionWorld = chrome.scripting.ExecutionWorld;\ntype RunAt = chrome.userScripts.RunAt;\n\nexport const ContentScriptMatches = ['*://*/*'];\n\nexport interface ContentScriptConfig {\n matches?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default \"documentIdle\"\n */\n runAt?: RunAt;\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default false\n */\n matchAboutBlank?: boolean;\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default []\n */\n excludeMatches?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default []\n */\n includeGlobs?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default []\n */\n excludeGlobs?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default false\n */\n allFrames?: boolean;\n /**\n * See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world\n */\n world?: ExecutionWorld;\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default false\n */\n matchOriginAsFallback?: boolean;\n}\n\nexport type ContentScriptEntrypointOptions = ContentScriptConfig & EntrypointOptions;\n\n// Append\nexport enum ContentScriptAppend {\n Last = 'last',\n First = 'first',\n Replace = 'replace',\n Before = 'before',\n After = 'after',\n}\n\n// Mount\nexport type ContentScriptMountFunction = (anchor: Element, container: Element) => void | (() => void);\n\nexport interface ContentScriptMount {\n mount(): void;\n\n unmount(): void;\n}\n\n// Props\nexport interface ContentScriptProps extends ContentScriptEntrypointOptions {\n anchor: Element;\n}\n\n// Anchor\nexport type ContentScriptAnchor = string | Element | null | undefined;\nexport type ContentScriptAnchorGetter = () => Awaiter<ContentScriptAnchor>;\nexport type ContentScriptAnchorResolver = () => Awaiter<Element[]>;\n\n// Render\nexport type ContentScriptRenderReactComponent = FC<ContentScriptProps>;\nexport type ContentScriptRenderValue = Element | ReactNode | ContentScriptRenderReactComponent;\nexport type ContentScriptRenderHandler = (props: ContentScriptProps) => Awaiter<void | ContentScriptRenderValue>;\n\n// Container\nexport type ContentScriptContainerTag = Exclude<keyof HTMLElementTagNameMap, 'html' | 'body'>;\n\nexport type ContentScriptContainerOptions = {\n [Tag in ContentScriptContainerTag]: {\n tagName: Tag\n} & Exclude<Optional<PickNonFunctionProperties<HTMLElementTagNameMap[Tag]>>, 'id'>;\n}[ContentScriptContainerTag];\n\nexport type ContentScriptContainerFactory = (props: ContentScriptProps) => Awaiter<Element | ContentScriptContainerTag | ContentScriptContainerOptions>;\nexport type ContentScriptContainerCreator = (props: ContentScriptProps) => Awaiter<Element>;\n\n// Watch\nexport type ContentScriptWatchStrategy = (update: () => void, context: ContentScriptContext) => () => void;\n\n// Context\nexport interface ContentScriptContext extends ContentScriptMount {\n nodes: ReadonlySet<ContentScriptNode>;\n}\n\n// Main\nexport type ContentScriptMainFunction = (context: ContentScriptContext) => Awaiter<void>;\n\n// Node\nexport interface ContentScriptNode extends ContentScriptMount {\n anchor: Element;\n container?: Element;\n}\n\nexport type ContentScriptNodeSet = Set<ContentScriptNode>;\n\n// Definition\nexport interface ContentScriptDefinition extends ContentScriptEntrypointOptions {\n anchor?: ContentScriptAnchor | ContentScriptAnchorGetter;\n mount?: ContentScriptMountFunction;\n render?: ContentScriptRenderValue | ContentScriptRenderHandler;\n container?: ContentScriptContainerTag | ContentScriptContainerOptions | ContentScriptContainerFactory;\n watch?: true | ContentScriptWatchStrategy;\n main?: ContentScriptMainFunction;\n}\n\nexport interface ContentScriptResolvedDefinition extends Omit<ContentScriptDefinition, 'anchor' | 'mount' | 'container' | 'render' | 'watch'> {\n anchor: ContentScriptAnchorResolver;\n mount: ContentScriptMountFunction;\n render: ContentScriptRenderHandler;\n container: ContentScriptContainerCreator;\n watch: ContentScriptWatchStrategy;\n}\n\nexport interface ContentScriptAppendDefinition extends Omit<ContentScriptDefinition, 'mount'> {\n append?: ContentScriptAppend;\n}\n\n// Builder\nexport type ContentScriptBuilder = EntrypointBuilder;\n","import {ContentScriptAppend, ContentScriptMountFunction} from \"@typing/content\";\n\nexport const contentScriptMountAppendResolver = (append?: ContentScriptAppend): ContentScriptMountFunction => (\n anchor: Element,\n container: Element\n): void => {\n switch (append) {\n case ContentScriptAppend.Last:\n anchor.append(container);\n break;\n default:\n case undefined:\n case ContentScriptAppend.First:\n anchor.prepend(container);\n break;\n case ContentScriptAppend.Replace:\n anchor.replaceWith(container);\n break;\n case ContentScriptAppend.After:\n anchor.parentElement?.insertBefore(container, anchor.nextElementSibling);\n break;\n case ContentScriptAppend.Before:\n anchor.parentElement?.insertBefore(container, anchor);\n break;\n }\n}","import {ContentScriptRenderHandler, ContentScriptRenderValue} from \"@typing/content\";\n\nexport const isValidContentScriptRenderValue = (value: unknown): value is string | number | Element => {\n return (typeof value === \"string\" && value.length > 0) || typeof value === \"number\" || value instanceof Element;\n}\n\nexport const contentScriptRenderResolver = (\n render?: ContentScriptRenderValue | ContentScriptRenderHandler\n): ContentScriptRenderHandler => async (props): Promise<void | ContentScriptRenderValue> => {\n let resolvedRender = typeof render === \"function\" ? render(props) : render;\n\n if (resolvedRender instanceof Promise) {\n resolvedRender = await resolvedRender;\n }\n\n if (!isValidContentScriptRenderValue(resolvedRender)) {\n return;\n }\n\n return resolvedRender;\n}","import {isValidContentScriptRenderValue} from \"../resolvers/render\";\n\nimport {ContentScriptDefinition, ContentScriptRenderHandler, ContentScriptRenderValue} from \"@typing/content\";\n\nexport const isContentScriptDefinition = (definition: any): definition is ContentScriptDefinition => {\n return definition && typeof definition === 'object' && definition.constructor === Object && !('$$typeof' in definition);\n}\n\nexport const isValidContentScriptDefinitionRenderValue =\n (definition: any): definition is ContentScriptRenderValue | ContentScriptRenderHandler => {\n return isValidContentScriptRenderValue(definition) ||\n typeof definition === \"function\" ||\n (\n typeof definition === \"object\" &&\n definition.constructor === Object &&\n '$$typeof' in definition\n );\n }","import {contentScriptMountAppendResolver} from \"@entry/content\";\n\nimport {ContentScriptAppendDefinition, ContentScriptDefinition} from \"@typing/content\";\n\nexport * from \"@entry/content\";\nexport * from \"@typing/content\";\n\nexport const defineContentScript = (options: ContentScriptDefinition): ContentScriptDefinition => {\n return options;\n}\n\nexport const defineContentScriptAppend = (options: ContentScriptAppendDefinition): ContentScriptDefinition => {\n const {append, ...definition} = options;\n\n return {\n ...definition,\n mount: contentScriptMountAppendResolver(append),\n };\n}","import {Browser} from \"@typing/browser\";\nimport {ManifestVersion} from \"@typing/manifest\";\n\nexport const getEnv: {\n <T extends string>(key: string): T | undefined;\n <T extends string, D>(key: string, defaults: D): T | D;\n} = (key: string, defaults?: string) => {\n const env = process.env;\n\n return (env[key] ?? defaults) as any;\n};\n\nexport const getApp = (): string => {\n const app = getEnv('APP');\n\n if (app === undefined) {\n throw new Error('App is not defined');\n }\n\n return app;\n};\n\nexport const getBrowser = (): Browser => {\n const browser = getEnv<Browser>('BROWSER');\n\n if (browser === undefined) {\n throw new Error('Browser is not defined');\n }\n\n return browser;\n}\n\nexport const isBrowser = (browser: Browser): browser is Browser => {\n return getBrowser() === browser;\n}\n\nexport const getManifestVersion = (): ManifestVersion => {\n const manifestVersion = getEnv('MANIFEST_VERSION', '3');\n\n return parseInt(manifestVersion) as ManifestVersion;\n}","export enum Language {\n Arabic = 'ar',\n Amharic = 'am',\n Bulgarian = 'bg',\n Bengali = 'bn',\n Catalan = 'ca',\n Czech = 'cs',\n Danish = 'da',\n German = 'de',\n Greek = 'el',\n English = 'en',\n EnglishAustralia = 'en_AU',\n EnglishGreatBritain = 'en_GB',\n EnglishUSA = 'en_US',\n Spanish = 'es',\n SpanishLatinAmericaAndCaribbean = 'es_419',\n Estonian = 'et',\n Persian = 'fa',\n Finnish = 'fi',\n Filipino = 'fil',\n French = 'fr',\n Gujarati = 'gu',\n Hebrew = 'he',\n Hindi = 'hi',\n Croatian = 'hr',\n Hungarian = 'hu',\n Indonesian = 'id',\n Italian = 'it',\n Japanese = 'ja',\n Kannada = 'kn',\n Korean = 'ko',\n Lithuanian = 'lt',\n Latvian = 'lv',\n Malayalam = 'ml',\n Marathi = 'mr',\n Malay = 'ms',\n Dutch = 'nl',\n Norwegian = 'no',\n Polish = 'pl',\n PortugueseBrazil = 'pt_BR',\n PortuguesePortugal = 'pt_PT',\n Romanian = 'ro',\n Russian = 'ru',\n Slovak = 'sk',\n Slovenian = 'sl',\n Serbian = 'sr',\n Swedish = 'sv',\n Swahili = 'sw',\n Tamil = 'ta',\n Telugu = 'te',\n Thai = 'th',\n Turkish = 'tr',\n Ukrainian = 'uk',\n Vietnamese = 'vi',\n ChineseChina = 'zh_CN',\n ChineseTaiwan = 'zh_TW',\n}\n\nexport enum LocaleDir {\n RightToLeft = 'rtl',\n LeftToRight = 'ltr',\n}\n\nexport const RtlLanguages: ReadonlySet<Language> = new Set([\n Language.Arabic,\n Language.Persian,\n Language.Hebrew,\n]);\n\nexport const LocaleNestedKeysSeparator = '.';\n\nexport const LocaleKeysSeparator = '_';\n\nexport const LocaleValuesSeparator = '|';\n\nexport const LocaleCustomKeyForLanguage = 'locale';\n\nexport const LocaleKeyMarker = '@';\n\nexport const LanguageCodes: ReadonlySet<string> = new Set(Object.values(Language));\n\nexport const LocaleFileExtensions: ReadonlySet<string> = new Set(['yaml', 'yml', 'json']);\n\nexport const LocaleDirectoryName = 'locales';\n\nexport type LocaleValue = string | number | string[] | number[];\n\nexport type LocaleData = {\n [key: string]: LocaleValue | LocaleData;\n};\n\nexport type LocaleItems = Map<string, string>;\n\nexport type LocaleKeys = ReadonlySet<string>;\n\nexport type LocaleMessages = {\n [key: string]: {\n message: string;\n };\n};\n\nexport interface LocaleBuilder {\n lang(): Language;\n\n merge(data: LocaleData): this;\n\n build(): LocaleMessages;\n\n get(): LocaleItems;\n\n keys(): LocaleKeys;\n\n structure(): LocaleStructure;\n\n isValid(): boolean;\n\n validate(): this;\n}\n\nexport interface LocaleValidator {\n isValid(locale: LocaleBuilder): boolean;\n\n validate(locale: LocaleBuilder): this;\n}\n\nexport type LocaleFutures = {\n plural: boolean;\n substitutions: readonly string[];\n};\n\nexport interface LocaleStructure {\n [key: string]: LocaleFutures;\n}\n\nexport type LocaleNonPluralKeys<T extends LocaleStructure> =\n { [K in keyof T]: T[K] extends { plural: false } ? K : never }[keyof T] & string\n\nexport type LocalePluralKeys<T extends LocaleStructure> =\n { [K in keyof T]: T[K] extends { plural: true } ? K : never }[keyof T] & string\n\nexport type LocaleSubstitutionsFor<\n T extends LocaleStructure,\n K extends keyof T\n> = T[K] extends { substitutions: readonly (infer U)[] }\n ? Partial<Record<U & string, string | number>>\n : never\n\nexport interface LocaleProvider<S extends LocaleStructure> {\n lang(): Language;\n\n keys(): ReadonlySet<keyof S>;\n\n // non-plural keys\n trans<K extends LocaleNonPluralKeys<S>>(\n key: K,\n substitutions?: LocaleSubstitutionsFor<S, K>\n ): string;\n\n // plural keys\n choice<K extends LocalePluralKeys<S>>(\n key: K,\n count: number,\n substitutions?: LocaleSubstitutionsFor<S, K>\n ): string;\n}\n","import {\n Language,\n LocaleNonPluralKeys,\n LocalePluralKeys,\n LocaleProvider,\n LocaleStructure,\n LocaleSubstitutionsFor,\n LocaleValuesSeparator\n} from \"@typing/locale\";\n\nexport default abstract class AbstractLocale<S extends LocaleStructure>\n implements LocaleProvider<S> {\n\n public abstract lang(): Language;\n\n public abstract keys(): Set<keyof S>;\n\n protected abstract value(key: keyof S & string): string | undefined;\n\n /**\n * Non-plural перевод\n */\n public trans<K extends LocaleNonPluralKeys<S>>(\n key: K,\n substitutions?: LocaleSubstitutionsFor<S, K>\n ): string {\n return this.get(key, substitutions);\n }\n\n /**\n * Plural-перевод\n */\n public choice<K extends LocalePluralKeys<S>>(\n key: K,\n count: number,\n substitutions?: LocaleSubstitutionsFor<S, K>\n ): string {\n const parts = this.get(key, substitutions).split(LocaleValuesSeparator);\n const idx = this.getPluralIndex(count);\n return parts[idx] ?? parts[0] ?? (key as string);\n }\n\n public get<K extends keyof S & string>(\n key: K,\n substitutions?: LocaleSubstitutionsFor<S, K>\n ): string {\n const template = this.value(key);\n\n if (template === undefined) {\n console.warn(`Locale key \"${key}\" not found in \"${this.lang()}\" language.`);\n return key as string;\n }\n\n if (substitutions) {\n return template.replace(/{{(.*?)}}/g, (_, placeholder: string) => {\n if (placeholder in substitutions) {\n return substitutions[placeholder]!.toString();\n }\n console.warn(\n `Locale substitution \"${placeholder}\" not found for key \"${key}\" in \"${this.lang()}\" language.`\n );\n return placeholder;\n });\n }\n\n return template;\n }\n\n private getPluralIndex(count: number): number {\n switch (this.lang()) {\n case Language.Indonesian:\n case Language.Japanese:\n case Language.Kannada:\n case Language.Korean:\n case Language.Malay:\n case Language.Thai:\n case Language.Turkish:\n case Language.Vietnamese:\n return 0;\n\n case Language.Bengali:\n case Language.Bulgarian:\n case Language.Catalan:\n case Language.Danish:\n case Language.German:\n case Language.Greek:\n case Language.English:\n case Language.EnglishAustralia:\n case Language.EnglishGreatBritain:\n case Language.EnglishUSA:\n case Language.Spanish:\n case Language.SpanishLatinAmericaAndCaribbean:\n case Language.Estonian:\n case Language.Persian:\n case Language.Finnish:\n case Language.Gujarati:\n case Language.Hebrew:\n case Language.Hungarian:\n case Language.Italian:\n case Language.Malayalam:\n case Language.Marathi:\n case Language.Dutch:\n case Language.Norwegian:\n case Language.Swedish:\n case Language.Swahili:\n case Language.Tamil:\n case Language.Telugu:\n case Language.ChineseChina:\n case Language.ChineseTaiwan:\n case Language.PortugueseBrazil:\n case Language.PortuguesePortugal:\n return (count == 1) ? 0 : 1;\n\n case Language.Amharic:\n case Language.Filipino:\n case Language.French:\n case Language.Hindi:\n return ((count == 0) || (count == 1)) ? 0 : 1;\n\n case Language.Croatian:\n case Language.Russian:\n case Language.Serbian:\n case Language.Ukrainian:\n return ((count % 10 == 1) && (count % 100 != 11)) ? 0 : (((count % 10 >= 2) && (count % 10 <= 4) && ((count % 100 < 10) || (count % 100 >= 20))) ? 1 : 2);\n\n case Language.Czech:\n case Language.Slovak:\n return (count == 1) ? 0 : (((count >= 2) && (count <= 4)) ? 1 : 2);\n\n case Language.Lithuanian:\n return ((count % 10 == 1) && (count % 100 != 11)) ? 0 : (((count % 10 >= 2) && ((count % 100 < 10) || (count % 100 >= 20))) ? 1 : 2);\n\n case Language.Slovenian:\n return (count % 100 == 1) ? 0 : ((count % 100 == 2) ? 1 : (((count % 100 == 3) || (count % 100 == 4)) ? 2 : 3));\n\n case Language.Latvian:\n return (count == 0) ? 0 : (((count % 10 == 1) && (count % 100 != 11)) ? 1 : 2);\n\n case Language.Polish:\n return (count == 1) ? 0 : (((count % 10 >= 2) && (count % 10 <= 4) && ((count % 100 < 12) || (count % 100 > 14))) ? 1 : 2);\n\n case Language.Romanian:\n return (count == 1) ? 0 : (((count == 0) || ((count % 100 > 0) && (count % 100 < 20))) ? 1 : 2);\n\n case Language.Arabic:\n return (count == 0) ? 0 : ((count == 1) ? 1 : ((count == 2) ? 2 : (((count % 100 >= 3) && (count % 100 <= 10)) ? 3 : (((count % 100 >= 11) && (count % 100 <= 99)) ? 4 : 5))));\n\n default:\n return 0;\n }\n }\n}\n\n","export const browser = (): typeof chrome => {\n return chrome;\n}","type Event<T extends Function> = chrome.events.Event<T>\n\nexport function safeListener<T extends (...args: any[]) => any>(listener: T): T {\n return ((...args: Parameters<T>): ReturnType<T> | void => {\n try {\n const result = listener(...args);\n\n if (result instanceof Promise) {\n result.catch(err => {\n console.error('Listener async error:', err);\n });\n }\n\n return result;\n } catch (err) {\n console.error('Listener sync error:', err);\n }\n }) as T;\n}\n\nexport function handleListener<T extends (...args: any[]) => void>(\n target: Event<T>,\n callback: T,\n): () => void {\n const listener = safeListener(callback);\n\n target.addListener(listener);\n\n return () => target.removeListener(listener);\n}","import {browser} from \"./browser\";\nimport {handleListener} from \"./utils\";\n\nimport {ManifestVersion} from \"@typing/manifest\";\nimport {MessageBody, MessageDictionary, MessageResponse, MessageType} from \"@typing/message\";\n\ntype Manifest = chrome.runtime.Manifest;\ntype PlatformInfo = chrome.runtime.PlatformInfo;\ntype ContextFilter = chrome.runtime.ContextFilter;\ntype ExtensionContext = chrome.runtime.ExtensionContext;\n\nconst runtime = () => browser().runtime;\n\nconst backgroundPaths = [\n '/_generated_background_page.view',\n];\n\nexport const getId = (): string => runtime().id;\n\nexport const getUrl = (path: string) => runtime().getURL(path);\n\nexport const getManifest = (): Manifest => runtime().getManifest();\n\nexport const getManifestVersion = (): ManifestVersion => getManifest().manifest_version;\n\nexport const getRuntimeContexts = (filter: ContextFilter) => new Promise<ExtensionContext[]>((resolve, reject) => {\n runtime().getContexts(filter, contexts => {\n try {\n throwRuntimeError();\n\n resolve(contexts);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const getPlatformInfo = (): Promise<PlatformInfo> => new Promise<PlatformInfo>((resolve, reject) => {\n runtime().getPlatformInfo((platformInfo) => {\n try {\n throwRuntimeError();\n\n resolve(platformInfo);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const isManifestVersion3 = (): boolean => getManifestVersion() === 3;\n\nexport const isBackground = (): boolean => {\n if (!getId()) {\n return false;\n }\n\n const manifest = getManifest();\n\n if (!manifest.background) {\n return false;\n }\n\n if (manifest.manifest_version === 3) {\n return typeof window === \"undefined\";\n }\n\n return window !== undefined && backgroundPaths.includes(location.pathname);\n}\n\nexport const throwRuntimeError = (): void => {\n const error = runtime().lastError;\n\n if (error) {\n throw new Error(error.message);\n }\n}\n\nexport const sendMessage = <\n T extends MessageDictionary,\n K extends MessageType<T>\n>(\n message: MessageBody<T, K>\n): Promise<MessageResponse<T, K>> => new Promise<MessageResponse<T, K>>((resolve, reject) => {\n runtime().sendMessage(message, (response) => {\n try {\n throwRuntimeError();\n\n resolve(response);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const onRuntimeInstalled = (callback: Parameters<typeof chrome.runtime.onInstalled.addListener>[0]): () => void => {\n return handleListener(runtime().onInstalled, callback)\n}\n\nexport const onMessage = (callback: Parameters<typeof chrome.runtime.onMessage.addListener>[0]): () => void => {\n return handleListener(runtime().onMessage, callback)\n}\n","import {browser} from \"./browser\";\nimport {throwRuntimeError} from \"./runtime\";\n\ntype LanguageDetectionResult = chrome.i18n.LanguageDetectionResult\n\nconst i18n = () => browser().i18n;\n\nexport const canUseNativeI18nMessage = (): boolean => typeof (i18n().getMessage) !== \"undefined\";\n\nexport const getI18nMessage = (key: string): string | undefined => {\n if (!canUseNativeI18nMessage()) {\n return;\n }\n\n return i18n().getMessage(key);\n}\n\nexport const getI18nAcceptLanguages = (): Promise<string[]> => new Promise<string[]>((resolve, reject) => {\n i18n().getAcceptLanguages(locales => {\n try {\n throwRuntimeError();\n\n resolve(locales);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const getI18nUILanguage = (): string | undefined => {\n const i18n = browser().i18n;\n\n if (!i18n['getUILanguage']) {\n return;\n }\n\n return i18n.getUILanguage();\n}\n\nexport const detectI18Language = (text: string): Promise<LanguageDetectionResult> => new Promise<LanguageDetectionResult>((resolve, reject) => {\n i18n().detectLanguage(text, result => {\n try {\n throwRuntimeError();\n\n resolve(result);\n } catch (e) {\n reject(e);\n }\n });\n});\n","import {Language, LocaleKeyMarker, LocaleKeysSeparator, LocaleNestedKeysSeparator} from \"@typing/locale\";\n\nexport const getLocaleFilename = (lang: Language): string => {\n return `_locales/${lang}/messages.json`;\n};\n\nexport const convertLocaleKey = (key: string): string => {\n return key.replaceAll(LocaleNestedKeysSeparator, LocaleKeysSeparator);\n}\n\nexport const convertLocaleMessageKey = (key: string): string => {\n return `__MSG_${convertLocaleKey(key)}__`;\n}\n\nexport const extractLocaleKey = (key?: string): string | undefined => {\n if (isLocaleKey(key)) {\n return key.substring(1);\n }\n}\n\nexport const isLocaleKey = (key?: string): key is string => {\n return key?.startsWith(LocaleKeyMarker) ?? false;\n}\n\nexport const modifyLocaleMessageKey = (key?: string): string | undefined => {\n if (typeof key !== \"string\") {\n return undefined;\n }\n\n const localeKey = extractLocaleKey(key);\n\n if (localeKey) {\n return convertLocaleMessageKey(localeKey);\n }\n\n return key;\n}\n\n","import {getI18nMessage, getI18nUILanguage} from \"@browser/i18n\";\n\nimport AbstractLocale from \"./AbstractLocale\";\n\nimport {convertLocaleKey} from \"@locale/utils\";\nimport {isBrowser} from \"@main/env\";\n\nimport {Language, LanguageCodes, LocaleCustomKeyForLanguage, LocaleProvider, LocaleStructure} from \"@typing/locale\";\nimport {Browser} from \"@typing/browser\";\n\nexport interface LocaleNativeStructure extends LocaleStructure {\n}\n\nexport default class NativeLocale extends AbstractLocale<LocaleNativeStructure> {\n private static instance?: LocaleProvider<LocaleNativeStructure>;\n\n public static getInstance<S extends LocaleStructure = LocaleNativeStructure>(): LocaleProvider<S> {\n return NativeLocale.instance ??= new NativeLocale();\n }\n\n public lang(): Language {\n let lang: Language | undefined;\n\n /**\n * The Opera browser does not support RTL languages,\n * and for Opera you need to directly indicate what kind of language it is.\n * interface language is always different\n */\n if (isBrowser(Browser.Opera)) {\n lang = getI18nMessage(LocaleCustomKeyForLanguage) as Language;\n\n if (LanguageCodes.has(lang)) {\n return lang;\n }\n }\n\n lang = getI18nUILanguage() as Language;\n\n if (!lang) {\n throw new Error(\"Locale Native: Unable to get UI language\");\n }\n\n return lang;\n }\n\n\n public keys(): Set<keyof LocaleNativeStructure> {\n try {\n // @ts-expect-error\n return new Set<string>(LOCALE_KEYS);\n } catch (e) {\n console.error(\"Locale Native: Unable to get keys\", e);\n\n return new Set<string>();\n }\n }\n\n protected value(key: Extract<keyof LocaleNativeStructure, string>): string | undefined {\n const value = getI18nMessage(convertLocaleKey(key));\n\n if (!value || value.length === 0) {\n return undefined;\n }\n\n return value;\n }\n}","import {LocaleNativeStructure, NativeLocale} from \"@locale/providers\";\n\nimport {convertLocaleMessageKey, extractLocaleKey} from \"@locale/utils\";\n\nimport {\n Language,\n LanguageCodes,\n LocaleDir,\n LocaleNonPluralKeys,\n LocalePluralKeys,\n LocaleSubstitutionsFor\n} from \"@typing/locale\";\n\nexport {Language, LanguageCodes, LocaleDir};\n\n/**\n * Translates a given locale key into the corresponding localized string.\n *\n * @template K - A type representing the non-plural keys of the locale structure.\n * @param {K} key - The locale key to be translated.\n * @param {LocaleSubstitutionsFor<LocaleNativeStructure, K>} [substitutions] - Optional substitutions to be applied\n * within the localized string. These are typically placeholders replaced with dynamic values.\n * @returns {string} - The translated string for the given key, with substitutions applied if provided.\n */\nexport const _ = <K extends LocaleNonPluralKeys<LocaleNativeStructure>>(\n key: K,\n substitutions?: LocaleSubstitutionsFor<LocaleNativeStructure, K>,\n): string => {\n return NativeLocale.getInstance().trans(key, substitutions);\n};\n\n/**\n * Translates a given locale key into the corresponding localized string\n * based on a specific count for pluralization.\n *\n * @template K - A type representing the non-plural keys of the locale structure.\n * @param {K} key - The locale key to be translated.\n * @param {number} count - The count used to determine the pluralization form.\n * @param {LocaleSubstitutionsFor<LocaleNativeStructure, K>} [substitutions] - Optional substitutions to be applied\n * within the localized string. These are typically placeholders replaced with dynamic values.\n * @returns {string} - The translated string for the given key, adjusted for pluralization and with substitutions applied if provided.\n */\nexport const _c = <K extends LocalePluralKeys<LocaleNativeStructure>>(\n key: K,\n count: number,\n substitutions?: LocaleSubstitutionsFor<LocaleNativeStructure, K>,\n): string => {\n return NativeLocale.getInstance().choice(key, count, substitutions);\n};\n\n/**\n * Converts a locale key into a standardized format and logs a warning if the key is not found\n * in the current language's locale keys.\n *\n * @param {Extract<keyof LocaleNativeStructure, string>} key - The locale key to be converted.\n * This key must be a string and exist within the `LocaleNativeStructure`.\n * @returns {string} - The converted locale message key.\n */\nexport const __ = (key: keyof LocaleNativeStructure & string): string => {\n const locale = NativeLocale.getInstance();\n\n if (!locale.keys().has(key)) {\n console.warn(`Locale key \"${key}\" not found in \"${locale.lang()}\" language.`);\n }\n\n return convertLocaleMessageKey(key);\n};\n\n\n/**\n * Attempts to extract a locale key from the provided string and translates it\n * into the corresponding localized string. If no locale key can be extracted,\n * the original string is returned.\n *\n * @param {string} input - The input string from which a locale key is to be extracted.\n * @returns {string} - The translated string if a locale key is successfully extracted,\n * or the original string if no locale key is found.\n */\nexport const __t = (input: string): string => {\n const localeKey = extractLocaleKey(input);\n\n if (localeKey) {\n return _(localeKey as LocaleNonPluralKeys<LocaleNativeStructure>);\n }\n\n return input;\n};","import {getUrl} from \"@browser/runtime\";\n\nimport {PageConfig, PageDefinition, PageProps} from \"@typing/page\";\n\nexport type {PageDefinition, PageProps, PageConfig};\n\nexport type PageAlias = string;\n\nexport type PageMap = Map<PageAlias, string>;\n\nexport const definePage = (options: PageDefinition): PageDefinition => {\n return options;\n};\n\nexport const getPages = (): PageMap => {\n const pages: PageMap = new Map();\n\n try {\n // @ts-expect-error: PAGE_ALIAS is a virtual variable generated by the bundler `src/cli/plugins/page/index.ts`\n Object.entries<string>(PAGE_ALIAS).forEach(([key, value]) => {\n pages.set(key, value);\n });\n } catch (e) {\n console.error('Error getting pages:', e);\n }\n\n return pages;\n}\n\nexport const getPageUrl = (alias: PageAlias): string => {\n let path = getPages().get(alias);\n\n if (!path) {\n console.warn(`Cannot find page: ${alias}`);\n\n path = alias;\n }\n\n return getUrl(path);\n}","import {Plugin, PluginDefinition} from \"@typing/plugin\";\n\nexport type {Plugin, PluginDefinition};\n\nexport function definePlugin<T extends any[] = []>(plugin: PluginDefinition<T>): PluginDefinition<T> {\n return plugin;\n}","import {Required} from \"utility-types\";\n\nimport {EntrypointBuilder, EntrypointOptions} from \"@typing/entrypoint\";\nimport {BackgroundConfig} from \"@typing/background\";\nimport {Awaiter, DeepAsyncProxy} from \"@typing/helpers\";\n\nexport const ServiceGlobalKey = 'adnbnService';\n\nexport type ServiceType = ((...args: any[]) => Promise<any>) | { [key: string]: any | ServiceType };\n\nexport interface ServiceDictionary {\n [key: string]: any;\n}\n\nexport type ServiceName = Extract<keyof ServiceDictionary, string>;\n\nexport type ServiceTarget<T extends ServiceDictionary, K extends keyof T> = T[K];\n\nexport type ServiceProxyTarget<T extends ServiceDictionary, K extends keyof T> = DeepAsyncProxy<T[K]>;\n\nexport interface ServiceManager {\n add<K extends ServiceName>(\n name: K,\n instance: ServiceDictionary[K]\n ): this;\n\n get<K extends ServiceName>(\n name: K\n ): ServiceDictionary[K] | undefined;\n\n has(name: ServiceName): boolean;\n\n remove<K extends ServiceName>(\n name: K\n ): ServiceDictionary[K] | undefined;\n\n clear(): this;\n}\n\nexport interface ServiceConfig extends BackgroundConfig {\n name: string;\n}\n\nexport type ServiceOptions = ServiceConfig & EntrypointOptions;\n\nexport type ServiceEntrypointOptions = Partial<ServiceOptions>;\n\nexport type ServiceInitGetter<T extends ServiceType> = (options: ServiceOptions) => T;\n\nexport type ServiceMainHandler<T extends ServiceType> = (service: T, options: ServiceOptions) => Awaiter<void>;\n\nexport type ServiceDefinition<T extends ServiceType> = ServiceEntrypointOptions & {\n init?: ServiceInitGetter<T>;\n main?: ServiceMainHandler<T>;\n};\n\nexport type ServiceUnresolvedDefinition<T extends ServiceType> = Partial<ServiceDefinition<T>>;\n\nexport type ServiceResolvedDefinition<T extends ServiceType> = Required<ServiceDefinition<T>, 'name' | 'init'>;\n\nexport type ServiceBuilder = EntrypointBuilder;\n","import {\n ServiceDictionary,\n ServiceGlobalKey,\n ServiceManager as ServiceManagerContract,\n ServiceName\n} from \"@typing/service\";\n\nexport default class ServiceManager implements ServiceManagerContract {\n private services = new Map<\n ServiceName,\n ServiceDictionary[ServiceName]\n >();\n\n public static getInstance(): ServiceManagerContract {\n return globalThis[ServiceGlobalKey] ??= new ServiceManager();\n }\n\n public add<K extends ServiceName>(\n name: K,\n instance: ServiceDictionary[K]\n ): this {\n this.services.set(name, instance);\n\n return this;\n }\n\n public get<K extends ServiceName>(\n name: K\n ): ServiceDictionary[K] | undefined {\n return this.services.get(name) as ServiceDictionary[K] | undefined;\n }\n\n public has(name: ServiceName): boolean {\n return this.services.has(name);\n }\n\n public remove<K extends ServiceName>(\n name: K\n ): ServiceDictionary[K] | undefined {\n const service = this.get(name);\n\n this.services.delete(name);\n\n return service;\n }\n\n public clear(): this {\n this.services.clear();\n\n return this;\n }\n}","import {isBackground} from \"@browser/runtime\";\n\nimport ServiceManager from \"../ServiceManager\";\n\nimport {ServiceDictionary, ServiceManager as ServiceManagerContract, ServiceName} from \"@typing/service\";\n\nexport default class<N extends ServiceName, T = ServiceDictionary[N]> {\n constructor(protected readonly name: N) {\n }\n\n protected get manager(): ServiceManagerContract {\n return ServiceManager.getInstance();\n }\n\n public get(): T {\n if (!isBackground()) {\n throw new Error(`Service \"${this.name}\" can be getting only from background context.`);\n }\n\n return this.manager.get(this.name);\n }\n\n public destroy(): void {\n this.manager.remove(this.name);\n }\n}\n","import {browser} from \"./browser\";\nimport {handleListener} from \"./utils\";\nimport {throwRuntimeError} from \"./runtime\";\nimport {MessageBody, MessageDictionary, MessageResponse, MessageType} from \"@typing/message\";\n\ntype Tab = chrome.tabs.Tab;\n\ntype Window = chrome.windows.Window;\n\ntype ZoomSettings = chrome.tabs.ZoomSettings;\ntype InjectDetails = chrome.tabs.InjectDetails;\n\ntype QueryInfo = chrome.tabs.QueryInfo;\ntype HighlightInfo = chrome.tabs.HighlightInfo;\n\ntype GroupOptions = chrome.tabs.GroupOptions;\ntype CaptureVisibleTabOptions = chrome.tabs.CaptureVisibleTabOptions;\n\ntype MoveProperties = chrome.tabs.MoveProperties;\ntype UpdateProperties = chrome.tabs.UpdateProperties;\ntype CreateProperties = chrome.tabs.CreateProperties;\n\ntype MessageSendOptions = chrome.tabs.MessageSendOptions;\n\nconst tabs = () => browser().tabs;\n\n// =================================\n// ============ METHODS ============\n// =================================\nexport const captureVisibleTab = (windowId: number, options: CaptureVisibleTabOptions) => new Promise<string>((resolve, reject) => {\n tabs().captureVisibleTab(windowId, options, (dataUrl) => {\n try {\n throwRuntimeError();\n\n resolve(dataUrl);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const createTab = (properties: CreateProperties): Promise<Tab> => new Promise<Tab>((resolve, reject) => {\n tabs().create(properties, (tab) => {\n try {\n throwRuntimeError();\n\n resolve(tab);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const detectTabLanguage = (tabId: number) => new Promise<string>((resolve, reject) => {\n // For an unknown/undefined language, und is returned.\n tabs().detectLanguage(tabId, (language) => {\n try {\n throwRuntimeError();\n\n resolve(language);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const discardTab = (tabId: number) => new Promise<Tab>((resolve, reject) => {\n tabs().discard(tabId, (tab) => {\n try {\n throwRuntimeError();\n\n resolve(tab);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const duplicateTab = (tabId: number) => new Promise<Tab | undefined>((resolve, reject) => {\n tabs().duplicate(tabId, (tab) => {\n try {\n throwRuntimeError();\n\n resolve(tab);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const getTab = (tabId: number) => new Promise<Tab>((resolve, reject) => {\n tabs().get(tabId, (tab) => {\n try {\n throwRuntimeError();\n\n resolve(tab);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const getCurrentTab = () => new Promise<Tab | undefined>((resolve, reject) => {\n // Returns undefined if called from a non-tab context (for example, a background view or popup view)\n tabs().getCurrent((tab) => {\n try {\n throwRuntimeError();\n\n resolve(tab);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const getTabZoom = (tabId: number) => new Promise<number>((resolve, reject) => {\n tabs().getZoom(tabId, (zoomFactor) => {\n try {\n throwRuntimeError();\n\n resolve(zoomFactor);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const getTabZoomSettings = (tabId: number) => new Promise<ZoomSettings>((resolve, reject) => {\n tabs().getZoomSettings(tabId, (zoomSettings) => {\n try {\n throwRuntimeError();\n\n resolve(zoomSettings);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const goTabBack = (tabId: number) => new Promise<void>((resolve, reject) => {\n tabs().goBack(tabId, () => {\n try {\n throwRuntimeError();\n\n resolve();\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const goTabForward = (tabId: number) => new Promise<void>((resolve, reject) => {\n tabs().goForward(tabId, () => {\n try {\n throwRuntimeError();\n\n resolve();\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const groupTabs = (options: GroupOptions) => new Promise<number>((resolve, reject) => {\n tabs().group(options, (tabs) => {\n try {\n throwRuntimeError();\n\n resolve(tabs);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const highlightTab = (highlightInfo: HighlightInfo) => new Promise<Window>((resolve, reject) => {\n tabs().highlight(highlightInfo, (window) => {\n try {\n throwRuntimeError();\n\n resolve(window);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const moveTab = (tabId: number, moveProperties: MoveProperties) => new Promise<Tab>((resolve, reject) => {\n tabs().move(tabId, moveProperties, (tab) => {\n try {\n throwRuntimeError();\n\n resolve(tab);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const moveTabs = (tabIds: number[], moveProperties: MoveProperties) => new Promise<Tab[]>((resolve, reject) => {\n tabs().move(tabIds, moveProperties, (tabs) => {\n try {\n throwRuntimeError();\n\n resolve(tabs);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const queryTabs = (queryInfo?: QueryInfo) => new Promise<Tab[]>((resolve, reject) => {\n tabs().query(queryInfo || {}, (tabs) => {\n try {\n throwRuntimeError();\n\n resolve(tabs);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const reloadTab = (tabId: number, bypassCache?: boolean | undefined) => new Promise<void>((resolve, reject) => {\n tabs().reload(tabId, {bypassCache}, () => {\n try {\n throwRuntimeError();\n\n resolve();\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const removeTab = (tabId: number): Promise<void> => new Promise<void>((resolve, reject) => {\n tabs().remove(tabId, () => {\n try {\n throwRuntimeError();\n\n resolve();\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const setTabZoom = (tabId: number, zoomFactor: number) => new Promise<void>((resolve, reject) => {\n tabs().setZoom(tabId, zoomFactor, () => {\n try {\n throwRuntimeError();\n\n resolve();\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const setTabZoomSettings = (tabId: number, zoomSettings: ZoomSettings) => new Promise<void>((resolve, reject) => {\n tabs().setZoomSettings(tabId, zoomSettings, () => {\n try {\n throwRuntimeError();\n\n resolve();\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const ungroupTab = (tabIds: number | number[]) => new Promise<void>((resolve, reject) => {\n tabs().ungroup(tabIds, () => {\n try {\n throwRuntimeError();\n\n resolve();\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const updateTab = (tabId: number, updateProperties: UpdateProperties) => new Promise<Tab | undefined>((resolve, reject) => {\n tabs().update(tabId, updateProperties, (tab) => {\n try {\n throwRuntimeError();\n\n resolve(tab);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const executeScriptTab = (tabId: number, details: InjectDetails) => new Promise<any[]>((resolve, reject) => {\n tabs().executeScript(tabId, details, (result) => {\n try {\n throwRuntimeError();\n\n resolve(result);\n } catch (e) {\n reject(e);\n }\n });\n});\n\nexport const sendTabMessage = <\n T extends MessageDictionary,\n K extends MessageType<T>\n>(\n tabId: number,\n message: MessageBody<T, K>,\n options: MessageSendOptions = {}\n): Promise<MessageResponse<T, K>> => new Promise<MessageResponse<T, K>>((resolve, reject) => {\n tabs().sendMessage(tabId, message, options, (response) => {\n try {\n throwRuntimeError();\n\n resolve(response);\n } catch (e) {\n reject(e);\n }\n });\n});\n\n// =================================\n// ======== CUSTOM METHODS =========\n// =================================\nexport const getTabUrl = async (tabId: number): Promise<string> => {\n const tab = await findTabById(tabId);\n\n if (!tab) {\n throw new Error(`Tab id \"${tabId}\" not exist`);\n }\n\n const {url} = tab;\n\n if (!url) {\n throw new Error(`URL not exist by tab id ${tabId}`);\n }\n\n return url;\n}\n\nexport const getActiveTab = async (): Promise<Tab> => {\n const tabs = await queryTabs({active: true, currentWindow: true})\n\n if (!tabs || !tabs[0]) {\n throw new Error('Tab not found');\n }\n\n return tabs[0];\n}\n\nexport const queryTabIds = async (queryInfo?: QueryInfo): Promise<number[]> => (await queryTabs(queryInfo)).reduce((ids, {id}) => {\n if (typeof id === 'number') {\n return [...ids, id];\n }\n\n return ids;\n}, [] as number[]);\n\nexport const findTab = (queryInfo?: QueryInfo): Promise<Tab | undefined> => queryTabs(queryInfo).then(tabs => tabs.length ? tabs[0] : undefined);\n\nexport const findTabById = (tabId: number): Promise<Tab | undefined> => getTab(tabId).then(tab => tab).catch(() => undefined);\n\nexport const updateTabAsSelected = (tabId: number) => updateTab(tabId, {highlighted: true});\n\nexport const updateTabAsActive = (tabId: number) => updateTab(tabId, {active: true});\n\nexport const openOrCreateTab = async (tab: Tab): Promise<void> => {\n const {id, url} = tab;\n\n if (id && url) {\n const existTab = await findTab({url});\n\n if (existTab && id && existTab.id === id) {\n await updateTabAsSelected(id);\n\n return;\n }\n }\n\n await createTab({url});\n}\n\n// =================================\n// ============ EVENTS =============\n// =================================\nexport const onTabActivated = (callback: Parameters<typeof chrome.tabs.onActivated.addListener>[0]): () => void => {\n return handleListener(tabs().onActivated, callback)\n}\n\nexport const onTabAttached = (callback: Parameters<typeof chrome.tabs.onAttached.addListener>[0]): () => void => {\n return handleListener(tabs().onAttached, callback)\n}\n\nexport const onTabCreated = (callback: Parameters<typeof chrome.tabs.onCreated.addListener>[0]): () => void => {\n return handleListener(tabs().onCreated, callback)\n}\n\nexport const onTabDetached = (callback: Parameters<typeof chrome.tabs.onDetached.addListener>[0]): () => void => {\n return handleListener(tabs().onDetached, callback)\n}\n\nexport const onTabHighlighted = (callback: Parameters<typeof chrome.tabs.onHighlighted.addListener>[0]): () => void => {\n return handleListener(tabs().onHighlighted, callback)\n};\n\nexport const onTabMoved = (callback: Parameters<typeof chrome.tabs.onMoved.addListener>[0]): () => void => {\n return handleListener(tabs().onMoved, callback)\n}\n\nexport const onTabRemoved = (callback: Parameters<typeof chrome.tabs.onRemoved.addListener>[0]): () => void => {\n return handleListener(tabs().onRemoved, callback)\n};\n\nexport const onTabReplaced = (callback: Parameters<typeof chrome.tabs.onReplaced.addListener>[0]): () => void => {\n return handleListener(tabs().onReplaced, callback)\n};\n\nexport const onTabUpdated = (callback: Parameters<typeof chrome.tabs.onUpdated.addListener>[0]): () => void => {\n return handleListener(tabs().onUpdated, callback)\n}\n\nexport const onTabZoomChange = (callback: Parameters<typeof chrome.tabs.onZoomChange.addListener>[0]): () => void => {\n return handleListener(tabs().onZoomChange, callback)\n}\n","import {nanoid} from 'nanoid';\nimport {\n MessageBody,\n MessageData,\n MessageDictionary,\n MessageGeneralHandler,\n MessageMapHandler,\n MessageProvider,\n MessageResponse,\n MessageTargetHandler,\n MessageType\n} from '@typing/message'\n\nexport default abstract class AbstractMessage<T extends MessageDictionary, TOptions> implements MessageProvider<T, TOptions> {\n public abstract send<K extends MessageType<T>>(type: K, data: MessageData<T, K>, options?: TOptions): Promise<MessageResponse<T, K>>;\n\n public abstract watch<K extends MessageType<T>>(type: K, handler: MessageTargetHandler<T, K>): () => void;\n\n public abstract watch(map: MessageMapHandler<T>): () => void;\n\n public abstract watch<K extends MessageType<T>>(general: MessageGeneralHandler<T, K>): () => void;\n\n protected buildMessage<K extends MessageType<T>>(type: K, data: MessageData<T, K>): MessageBody<T, K> {\n return {\n id: nanoid(),\n type,\n data,\n timestamp: Date.now(),\n };\n }\n}\n","export const MessageGlobalKey = 'adnbnMessage';\n\nexport type MessageSender = chrome.runtime.MessageSender;\n\nexport type MessageDictionary = Record<string, (data: any) => any>;\n\nexport type MessageType<T extends MessageDictionary> = Extract<keyof T, string>;\nexport type MessageData<T extends MessageDictionary, K extends MessageType<T>> = Parameters<T[K]>[0];\nexport type MessageResponse<T extends MessageDictionary, K extends MessageType<T>> = ReturnType<T[K]>;\n\nexport type MessageTargetHandler<T extends MessageDictionary, K extends MessageType<T>> = (data: MessageData<T, K>, sender: MessageSender) => MessageResponse<T, K>\nexport type MessageMapHandler<T extends MessageDictionary> = { [K in MessageType<T>]?: MessageTargetHandler<T, K> }\nexport type MessageGeneralHandler<T extends MessageDictionary, K extends MessageType<T>> = (type: K, data: MessageData<T, K>, sender: MessageSender) => any\n\nexport interface MessageBody<T extends MessageDictionary, K extends MessageType<T>> {\n id: string;\n type: K;\n data: MessageData<T, K>;\n timestamp: number;\n}\n\nexport interface MessageProvider<T extends MessageDictionary, TOptions = void> {\n send<K extends MessageType<T>>(type: K, data: MessageData<T, K>, options?: TOptions): Promise<MessageResponse<T, K>>;\n\n watch<K extends MessageType<T>>(type: K, handler: MessageTargetHandler<T, K>): () => void;\n\n watch(map: MessageMapHandler<T>): () => void;\n\n watch<K extends MessageType<T>>(general: MessageGeneralHandler<T, K>): () => void;\n}\n\nexport interface MessageHandler<T extends MessageDictionary> {\n run(type: MessageType<T>, data: MessageData<T, MessageType<T>>, sender: MessageSender): MessageResponse<T, MessageType<T>> | undefined;\n}\n","import {onMessage} from '@browser/runtime'\n\nimport {\n MessageBody,\n MessageDictionary,\n MessageGlobalKey,\n MessageHandler,\n MessageSender,\n MessageType\n} from '@typing/message';\n\nexport default class MessageManager<T extends MessageDictionary> {\n private handlers: Set<MessageHandler<T>> = new Set()\n private unsubscribe: (() => void) | null = null;\n\n public static getInstance<T extends MessageDictionary>(): MessageManager<T> {\n return globalThis[MessageGlobalKey] ??= new MessageManager<T>();\n }\n\n constructor() {\n this.listener = this.listener.bind(this);\n }\n\n public add(handler: MessageHandler<T>) {\n this.handlers.add(handler);\n this.updateListener();\n }\n\n public remove(handler: MessageHandler<T>) {\n this.handlers.delete(handler);\n this.updateListener();\n }\n\n public clear() {\n this.handlers = new Set();\n this.updateListener();\n }\n\n private updateListener() {\n if (this.handlers.size > 0 && !this.unsubscribe) {\n this.unsubscribe = onMessage(this.listener);\n } else if (this.handlers.size === 0 && this.unsubscribe) {\n this.unsubscribe();\n this.unsubscribe = null;\n }\n }\n\n private listener<K extends MessageType<T>>(\n message: MessageBody<T, K>,\n sender: MessageSender,\n sendResponse: (response?: any) => void\n ): boolean | void {\n if (!message || typeof message !== 'object' || !message.type) return;\n\n const results: Promise<any>[] = [];\n\n for (const handler of this.handlers) {\n try {\n const result = handler.run(message.type, message.data, sender);\n if (result !== undefined) {\n results.push(Promise.resolve(result));\n }\n } catch (err) {\n console.error('Message handler error:', err);\n }\n }\n\n if (results.length > 1) {\n throw new Error(`Message type \"${message.type}\" has multiple handlers returning a response. Only one response is allowed.`)\n }\n\n if (results.length === 1) {\n results[0].then(sendResponse);\n return true;\n }\n };\n}\n","import {\n MessageData,\n MessageDictionary,\n MessageHandler,\n MessageResponse,\n MessageSender,\n MessageType\n} from \"@typing/message\";\n\nexport default abstract class AbstractHandler<T extends MessageDictionary> implements MessageHandler<T> {\n\n public abstract run(type: MessageType<T>, data: MessageData<T, MessageType<T>>, sender: MessageSender): MessageResponse<T, MessageType<T>> | undefined\n}\n","import AbstractHandler from \"./AbstractHandler\";\nimport {\n MessageData,\n MessageDictionary,\n MessageResponse,\n MessageSender,\n MessageTargetHandler,\n MessageType\n} from \"@typing/message\";\n\nexport default class SingleHandler<T extends MessageDictionary> extends AbstractHandler<T> {\n\n constructor(private messageType: MessageType<T>, private handler: MessageTargetHandler<T, MessageType<T>>) {\n super();\n }\n\n public run(type: MessageType<T>, data: MessageData<T, MessageType<T>>, sender: MessageSender): MessageResponse<T, MessageType<T>> | undefined {\n if (type === this.messageType) {\n return this.handler(data, sender);\n }\n }\n}\n","import AbstractHandler from \"./AbstractHandler\";\nimport {\n MessageData,\n MessageDictionary,\n MessageMapHandler,\n MessageResponse,\n MessageSender,\n MessageType\n} from \"@typing/message\";\n\nexport default class MapHandler<T extends MessageDictionary> extends AbstractHandler<T> {\n\n constructor(private map: MessageMapHandler<T>) {\n super();\n }\n\n public run(type: MessageType<T>, data: MessageData<T, MessageType<T>>, sender: MessageSender): MessageResponse<T, MessageType<T>> | undefined {\n const handler = this.map[type];\n if (handler) {\n if (typeof handler === \"function\") {\n return handler(data, sender);\n } else {\n throw new Error(`Handler for type \"${type}\" in object of handlers must be a function`)\n }\n }\n }\n}\n","import AbstractHandler from \"./AbstractHandler\";\nimport {\n MessageData,\n MessageDictionary,\n MessageGeneralHandler,\n MessageResponse,\n MessageSender,\n MessageType\n} from \"@typing/message\";\n\nexport default class GeneralHandler<T extends MessageDictionary, K extends MessageType<T>> extends AbstractHandler<T> {\n\n constructor(private generalHandler: MessageGeneralHandler<T, K>) {\n super();\n }\n\n public run(type: K, data: MessageData<T, MessageType<T>>, sender: MessageSender): MessageResponse<T, MessageType<T>> | undefined {\n return this.generalHandler(type, data, sender);\n }\n}\n","import {sendMessage} from \"@browser/runtime\";\nimport {sendTabMessage} from \"@browser/tab\";\nimport {\n MessageData,\n MessageDictionary,\n MessageGeneralHandler,\n MessageHandler,\n MessageMapHandler,\n MessageResponse,\n MessageTargetHandler,\n MessageType\n} from '@typing/message';\n\nimport AbstractMessage from './AbstractMessage';\nimport MessageManager from \"../MessageManager\";\n\nimport {GeneralHandler, MapHandler, SingleHandler} from \"../handlers\";\n\nexport type MessageSendOptions = number | { tabId: number; frameId?: number; documentId?: string };\n\nexport default class Message<T extends MessageDictionary> extends AbstractMessage<T, MessageSendOptions> {\n private static instance: Message<MessageDictionary> | null = null;\n\n public static getInstance<T extends MessageDictionary>() {\n return this.instance ??= new Message<T>();\n }\n\n protected get manager(): MessageManager<T> {\n return MessageManager.getInstance<T>();\n }\n\n public send<K extends MessageType<T>>(type: K, data: MessageData<T, K>, options?: MessageSendOptions): Promise<MessageResponse<T, K>> {\n const message = this.buildMessage(type, data);\n\n if (options) {\n if (typeof options === 'number') {\n return sendTabMessage(options, message)\n }\n\n const {tabId, ...other} = options;\n\n return sendTabMessage(tabId, message, other);\n\n }\n\n return sendMessage(message)\n }\n\n public watch<K extends MessageType<T>>(\n arg1: K | MessageMapHandler<T> | MessageGeneralHandler<T, K>,\n arg2?: MessageTargetHandler<T, K>\n ): () => void {\n\n let handler: MessageHandler<T>\n\n if (typeof arg1 === 'function') {\n handler = new GeneralHandler<T, K>(arg1);\n } else if (typeof arg1 === 'object' && arg2 === undefined) {\n handler = new MapHandler<T>(arg1);\n } else if (typeof arg1 === 'string' && arg2) {\n handler = new SingleHandler<T>(arg1, arg2);\n } else {\n throw new Error('Invalid arguments passed to watch()');\n }\n\n this.manager.add(handler);\n\n return () => this.manager.remove(handler);\n }\n}\n","import {isBackground} from \"@browser/runtime\";\nimport {Message, MessageSendOptions} from \"@message/providers\";\n\nimport BaseService from \"./BaseService\";\n\nimport {ServiceDictionary, ServiceName} from \"@typing/service\";\nimport {MessageDictionary, MessageProvider} from \"@typing/message\";\nimport {DeepAsyncProxy} from \"@typing/helpers\";\n\nexport default class<N extends ServiceName, T = DeepAsyncProxy<ServiceDictionary[N]>> extends BaseService<N, T> {\n private _message?: MessageProvider<MessageDictionary, MessageSendOptions>;\n\n protected readonly messageKey: string;\n\n constructor(name: N) {\n super(name);\n\n this.messageKey = `service.${this.name}`;\n }\n\n protected get message(): MessageProvider<MessageDictionary, MessageSendOptions> {\n return this._message ??= new Message();\n }\n\n private createProxy(path?: string): T {\n const wrapped = () => {\n }\n\n const proxy = new Proxy(wrapped, {\n apply: async (_target, _thisArg, args) => {\n return this.message.send(this.messageKey, {path, args});\n },\n\n get: (_target, propertyName, receiver) => {\n if (propertyName === '__proxy' || typeof propertyName !== 'string') {\n return Reflect.get(wrapped, propertyName, receiver);\n }\n\n const newPath = path == null ? propertyName : `${path}.${String(propertyName)}`;\n\n return this.createProxy(newPath);\n },\n });\n\n // @ts-expect-error — Adding a hidden property\n proxy.__proxy = true;\n\n return proxy as unknown as T;\n }\n\n public get(): T {\n if (isBackground()) {\n throw new Error(`You are trying to get proxy service \"${this.name}\" from background. You can get original service instead`);\n }\n\n return this.createProxy();\n }\n}\n","import {ProxyService} from \"@service/providers\";\n\nimport {\n ServiceDefinition,\n ServiceDictionary,\n ServiceInitGetter,\n ServiceMainHandler,\n ServiceType\n} from \"@typing/service\";\nimport {DeepAsyncProxy} from \"@typing/helpers\";\n\nexport type {ServiceDefinition, ServiceMainHandler, ServiceInitGetter};\n\nexport const defineService = <T extends ServiceType>(options: ServiceDefinition<T>): ServiceDefinition<T> => {\n return options;\n}\n\nexport const getService = <N extends Extract<keyof ServiceDictionary, string>>(name: N): DeepAsyncProxy<ServiceDictionary[N]> => {\n return new ProxyService(name).get();\n}"]}
|
package/dist/index.js
CHANGED
|
@@ -318,6 +318,28 @@ var browser = () => {
|
|
|
318
318
|
return chrome;
|
|
319
319
|
};
|
|
320
320
|
|
|
321
|
+
// src/browser/utils.ts
|
|
322
|
+
function safeListener(listener) {
|
|
323
|
+
return (...args) => {
|
|
324
|
+
try {
|
|
325
|
+
const result = listener(...args);
|
|
326
|
+
if (result instanceof Promise) {
|
|
327
|
+
result.catch((err) => {
|
|
328
|
+
console.error("Listener async error:", err);
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
return result;
|
|
332
|
+
} catch (err) {
|
|
333
|
+
console.error("Listener sync error:", err);
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
function handleListener(target, callback) {
|
|
338
|
+
const listener = safeListener(callback);
|
|
339
|
+
target.addListener(listener);
|
|
340
|
+
return () => target.removeListener(listener);
|
|
341
|
+
}
|
|
342
|
+
|
|
321
343
|
// src/browser/runtime.ts
|
|
322
344
|
var runtime = () => browser().runtime;
|
|
323
345
|
var backgroundPaths = [
|
|
@@ -345,6 +367,19 @@ var throwRuntimeError = () => {
|
|
|
345
367
|
throw new Error(error.message);
|
|
346
368
|
}
|
|
347
369
|
};
|
|
370
|
+
var sendMessage = (message) => new Promise((resolve, reject) => {
|
|
371
|
+
runtime().sendMessage(message, (response) => {
|
|
372
|
+
try {
|
|
373
|
+
throwRuntimeError();
|
|
374
|
+
resolve(response);
|
|
375
|
+
} catch (e) {
|
|
376
|
+
reject(e);
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
var onMessage = (callback) => {
|
|
381
|
+
return handleListener(runtime().onMessage, callback);
|
|
382
|
+
};
|
|
348
383
|
|
|
349
384
|
// src/browser/i18n.ts
|
|
350
385
|
var i18n = () => browser().i18n;
|
|
@@ -508,7 +543,7 @@ var BaseService_default = class {
|
|
|
508
543
|
}
|
|
509
544
|
get() {
|
|
510
545
|
if (!isBackground()) {
|
|
511
|
-
throw new Error("
|
|
546
|
+
throw new Error(`Service "${this.name}" can be getting only from background context.`);
|
|
512
547
|
}
|
|
513
548
|
return this.manager.get(this.name);
|
|
514
549
|
}
|
|
@@ -516,6 +551,19 @@ var BaseService_default = class {
|
|
|
516
551
|
this.manager.remove(this.name);
|
|
517
552
|
}
|
|
518
553
|
};
|
|
554
|
+
|
|
555
|
+
// src/browser/tab.ts
|
|
556
|
+
var tabs = () => browser().tabs;
|
|
557
|
+
var sendTabMessage = (tabId, message, options = {}) => new Promise((resolve, reject) => {
|
|
558
|
+
tabs().sendMessage(tabId, message, options, (response) => {
|
|
559
|
+
try {
|
|
560
|
+
throwRuntimeError();
|
|
561
|
+
resolve(response);
|
|
562
|
+
} catch (e) {
|
|
563
|
+
reject(e);
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
});
|
|
519
567
|
var AbstractMessage = class {
|
|
520
568
|
buildMessage(type, data) {
|
|
521
569
|
return {
|
|
@@ -527,16 +575,16 @@ var AbstractMessage = class {
|
|
|
527
575
|
}
|
|
528
576
|
};
|
|
529
577
|
|
|
578
|
+
// src/types/message.ts
|
|
579
|
+
var MessageGlobalKey = "adnbnMessage";
|
|
580
|
+
|
|
530
581
|
// src/message/MessageManager.ts
|
|
531
582
|
var MessageManager = class _MessageManager {
|
|
532
583
|
handlers = /* @__PURE__ */ new Set();
|
|
533
|
-
|
|
534
|
-
static instance = null;
|
|
584
|
+
unsubscribe = null;
|
|
535
585
|
static getInstance() {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}
|
|
539
|
-
return _MessageManager.instance;
|
|
586
|
+
var _a;
|
|
587
|
+
return globalThis[_a = MessageGlobalKey] ?? (globalThis[_a] = new _MessageManager());
|
|
540
588
|
}
|
|
541
589
|
constructor() {
|
|
542
590
|
this.listener = this.listener.bind(this);
|
|
@@ -554,12 +602,11 @@ var MessageManager = class _MessageManager {
|
|
|
554
602
|
this.updateListener();
|
|
555
603
|
}
|
|
556
604
|
updateListener() {
|
|
557
|
-
if (this.handlers.size > 0 && !this.
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
this.isListenerAttached = false;
|
|
605
|
+
if (this.handlers.size > 0 && !this.unsubscribe) {
|
|
606
|
+
this.unsubscribe = onMessage(this.listener);
|
|
607
|
+
} else if (this.handlers.size === 0 && this.unsubscribe) {
|
|
608
|
+
this.unsubscribe();
|
|
609
|
+
this.unsubscribe = null;
|
|
563
610
|
}
|
|
564
611
|
}
|
|
565
612
|
listener(message, sender, sendResponse) {
|
|
@@ -633,34 +680,24 @@ var GeneralHandler = class extends AbstractHandler {
|
|
|
633
680
|
};
|
|
634
681
|
|
|
635
682
|
// src/message/providers/Message.ts
|
|
636
|
-
var Message = class extends AbstractMessage {
|
|
637
|
-
|
|
683
|
+
var Message = class _Message extends AbstractMessage {
|
|
684
|
+
static instance = null;
|
|
685
|
+
static getInstance() {
|
|
686
|
+
return this.instance ?? (this.instance = new _Message());
|
|
687
|
+
}
|
|
688
|
+
get manager() {
|
|
689
|
+
return MessageManager.getInstance();
|
|
690
|
+
}
|
|
638
691
|
send(type, data, options) {
|
|
639
692
|
const message = this.buildMessage(type, data);
|
|
640
|
-
if (
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
throwRuntimeError();
|
|
647
|
-
resolve(response);
|
|
648
|
-
} catch (e) {
|
|
649
|
-
reject(e);
|
|
650
|
-
}
|
|
651
|
-
});
|
|
652
|
-
});
|
|
693
|
+
if (options) {
|
|
694
|
+
if (typeof options === "number") {
|
|
695
|
+
return sendTabMessage(options, message);
|
|
696
|
+
}
|
|
697
|
+
const { tabId, ...other } = options;
|
|
698
|
+
return sendTabMessage(tabId, message, other);
|
|
653
699
|
}
|
|
654
|
-
return
|
|
655
|
-
browser().runtime.sendMessage(message, (response) => {
|
|
656
|
-
try {
|
|
657
|
-
throwRuntimeError();
|
|
658
|
-
resolve(response);
|
|
659
|
-
} catch (e) {
|
|
660
|
-
reject(e);
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
|
-
});
|
|
700
|
+
return sendMessage(message);
|
|
664
701
|
}
|
|
665
702
|
watch(arg1, arg2) {
|
|
666
703
|
let handler;
|
|
@@ -709,7 +746,7 @@ var ProxyService_default = class extends BaseService_default {
|
|
|
709
746
|
}
|
|
710
747
|
get() {
|
|
711
748
|
if (isBackground()) {
|
|
712
|
-
throw new Error("
|
|
749
|
+
throw new Error(`You are trying to get proxy service "${this.name}" from background. You can get original service instead`);
|
|
713
750
|
}
|
|
714
751
|
return this.createProxy();
|
|
715
752
|
}
|