azot 0.9.3 → 5.0.0-alpha.10
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/README.md +2 -2
- package/dist/azt.cjs +2 -0
- package/dist/azt.mjs +2 -0
- package/dist/chunk-350yNsax.cjs +1 -0
- package/dist/chunk-DtROqxiw.mjs +1 -0
- package/dist/context-BdQ_7L4n.cjs +4 -0
- package/dist/context-vs4jQyij.mjs +4 -0
- package/dist/context.cjs +1 -0
- package/dist/context.mjs +1 -0
- package/dist/main.cjs +1 -0
- package/dist/main.mjs +1 -0
- package/dist/vitest.cjs +1 -0
- package/dist/vitest.mjs +1 -0
- package/package.json +57 -56
- package/types/context.d.ts +4 -0
- package/types/extension.d.ts +51 -15
- package/types/feedback.d.ts +62 -0
- package/types/main.d.ts +132 -0
- package/LICENSE +0 -21
- package/bin/cli.js +0 -2
- package/dist/index.js +0 -1
- package/index.d.ts +0 -10
- package/public.pem +0 -14
- package/types/azot.d.ts +0 -116
- package/types/cookie-store.d.ts +0 -34
- package/types/document.d.ts +0 -8
- package/types/globals.d.ts +0 -33
- package/types/navigator.d.ts +0 -28
- package/types/options.d.ts +0 -46
- package/types/uint8array.extensions.d.ts +0 -17
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Azot API
|
|
2
2
|
|
|
3
|
-
Type definitions for the latest [Azot](https://azot.
|
|
3
|
+
Type definitions for the latest [Azot](https://azot.mov) API.
|
|
4
4
|
|
|
5
5
|
## Getting Started
|
|
6
6
|
|
|
7
|
-
Check [TypeScript interfaces](https://www.npmjs.com/package/azot?activeTab=code) to get started with our API. If you want to discover and install extensions, check out [Extension List](https://github.com/azot-labs/
|
|
7
|
+
Check [TypeScript interfaces](https://www.npmjs.com/package/azot?activeTab=code) to get started with our API. If you want to discover and install extensions, check out [Extension List](https://github.com/azot-labs/azot/blob/main/extensions.json).
|
|
8
8
|
|
|
9
9
|
## Community
|
|
10
10
|
|
package/dist/azt.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const e=require(`./chunk-350yNsax.cjs`);let t=require(`node:util`),n=require(`node:fs`),r=require(`node:path`);r=e.n(r);let i=require(`tsdown`),a=require(`node:crypto`),o=require(`javascript-obfuscator`);o=e.n(o);const s=Buffer.from(`STX`,`utf8`),c=(e,t,r)=>{let i=(0,a.randomBytes)(32),o=(0,a.randomBytes)(16),c=(0,n.readFileSync)(t),l=(0,a.createCipheriv)(`aes-256-cbc`,i,o),u=Buffer.concat([l.update(c),l.final()]),d=(0,a.publicEncrypt)(e,i),f=Buffer.concat([s,o,d,u]);return r&&(0,n.writeFileSync)(r,f),{aesIv:o,encryptedAesKey:d,encryptedCode:u}},l=(e,t,r)=>{let i=(0,n.readFileSync)(t),o=s.byteLength;if(!i.subarray(0,o).equals(s))throw Error(`Incorrect file format`);let c=o,l=c+16,u=l+512,d=i.subarray(c,l),f=i.subarray(l,u),p=i.subarray(u),m=(0,a.createDecipheriv)(`aes-256-cbc`,(0,a.privateDecrypt)(e,f),d),h=Buffer.concat([m.update(p),m.final()]).toString(`utf8`);return r&&(0,n.writeFileSync)(r,h),h},u=(e,t)=>{let r=(0,n.readFileSync)(e,`utf8`);console.log(`Obfuscating...`),console.time(`Obfuscation complete in`);let i=o.default.obfuscate(r,{target:`node`,compact:!0,controlFlowFlattening:!0,controlFlowFlatteningThreshold:1,deadCodeInjection:!0,debugProtection:!0,identifierNamesGenerator:`hexadecimal`,numbersToExpressions:!0,selfDefending:!0,simplify:!0,splitStrings:!0,splitStringsChunkLength:5,stringArray:!0,stringArrayCallsTransform:!0,stringArrayCallsTransformThreshold:1,stringArrayEncoding:[`base64`],stringArrayIndexShift:!0,stringArrayRotate:!0,stringArrayShuffle:!0,stringArrayWrappersCount:2,stringArrayWrappersChainedCalls:!0,stringArrayWrappersType:`function`,stringArrayThreshold:1,transformObjectKeys:!0,unicodeEscapeSequence:!1});console.timeEnd(`Obfuscation complete in`);let a=i.getObfuscatedCode();return(0,n.writeFileSync)(t||e,a),a},d=(0,t.parseArgs)({allowPositionals:!0,allowNegative:!0,options:{input:{type:`string`,short:`i`,description:`Path to the input file`},key:{type:`string`,short:`k`,description:`Path to the key file (public for encrypt, private for decrypt)`},output:{type:`string`,short:`o`,description:`Path to the output file`},format:{type:`string`,short:`f`,description:`Output format`},watch:{type:`boolean`,description:`Watch file changes`},minify:{type:`boolean`,description:`Minify output`},obfuscate:{type:`boolean`,description:`Obfuscate output`},encrypt:{type:`boolean`,description:`Encrypt extension source code (.js will be packed inside .stx)`},decrypt:{type:`boolean`,description:`Decrypt encrypted extension`}}}),f=()=>{let e=[process.cwd(),r.default.join(process.cwd(),`src`),r.default.join(process.cwd(),`lib`)];for(let t of e){let e=(0,n.readdirSync)(t).filter(e=>!e.endsWith(`.d.ts`)).filter(e=>new Set([`.ts`,`.js`]).has(r.default.extname(e))),i=e=>r.default.basename(e,r.default.extname(e)),a=e.find(e=>i(e)===`index`)||e.find(e=>i(e)===`main`)||e[0];if(a)return r.default.join(t,a)}};(async()=>{let[e,...t]=d.positionals,a=d.values.input||t[0]||f();if(!a)throw Error(`No entry file found`);if(e===`build`||e===`pack`){let t=typeof d.values.minify==`boolean`?d.values.minify:!0;await(0,i.build)({entry:a.replace(process.cwd(),`.`).replace(r.default.sep,`/`),format:d.values.format??`cjs`,platform:`node`,target:`node22`,watch:d.values.watch,minify:t}),d.values.input=r.default.join(process.cwd(),`dist`,r.default.basename(a).replace(/\.ts$/,`.js`));let o=require(r.default.join(process.cwd(),`package.json`));if((typeof d.values.obfuscate==`boolean`?d.values.obfuscate:o.private)&&u(d.values.input,d.values.input),d.values.encrypt||e===`pack`){let e=(0,n.readFileSync)(d.values.key||r.default.join(__dirname,`../public.pem`),`utf8`),t=d.values.output||d.values.input.replace(/\.js$/,`-${o.version}.stx`);c(e,d.values.input,t),(0,n.rmSync)(d.values.input)}}else if(e===`decrypt`)l((0,n.readFileSync)(d.values.key||r.default.join(__dirname,`../private.pem`),`utf8`),a,d.values.output||a.replace(/\.stx$/,`.js`)),d.values.input&&(0,n.rmSync)(d.values.input);else if(e===`dev`||e===`develop`||!e){let e=typeof d.values.minify==`boolean`?d.values.minify:!1;await(0,i.build)({entry:a,format:d.values.format??`cjs`,platform:`node`,target:`node20`,watch:!0,minify:e})}})();
|
package/dist/azt.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{n as e}from"./chunk-DtROqxiw.mjs";import{parseArgs as t}from"node:util";import{readFileSync as n,readdirSync as r,rmSync as i,writeFileSync as a}from"node:fs";import o from"node:path";import{build as s}from"tsdown";import{createCipheriv as c,createDecipheriv as l,privateDecrypt as u,publicEncrypt as d,randomBytes as f}from"node:crypto";import p from"javascript-obfuscator";const m=Buffer.from(`STX`,`utf8`),h=(e,t,r)=>{let i=f(32),o=f(16),s=n(t),l=c(`aes-256-cbc`,i,o),u=Buffer.concat([l.update(s),l.final()]),p=d(e,i),h=Buffer.concat([m,o,p,u]);return r&&a(r,h),{aesIv:o,encryptedAesKey:p,encryptedCode:u}},g=(e,t,r)=>{let i=n(t),o=m.byteLength;if(!i.subarray(0,o).equals(m))throw Error(`Incorrect file format`);let s=o,c=s+16,d=c+512,f=i.subarray(s,c),p=i.subarray(c,d),h=i.subarray(d),g=l(`aes-256-cbc`,u(e,p),f),_=Buffer.concat([g.update(h),g.final()]).toString(`utf8`);return r&&a(r,_),_},_=(e,t)=>{let r=n(e,`utf8`);console.log(`Obfuscating...`),console.time(`Obfuscation complete in`);let i=p.obfuscate(r,{target:`node`,compact:!0,controlFlowFlattening:!0,controlFlowFlatteningThreshold:1,deadCodeInjection:!0,debugProtection:!0,identifierNamesGenerator:`hexadecimal`,numbersToExpressions:!0,selfDefending:!0,simplify:!0,splitStrings:!0,splitStringsChunkLength:5,stringArray:!0,stringArrayCallsTransform:!0,stringArrayCallsTransformThreshold:1,stringArrayEncoding:[`base64`],stringArrayIndexShift:!0,stringArrayRotate:!0,stringArrayShuffle:!0,stringArrayWrappersCount:2,stringArrayWrappersChainedCalls:!0,stringArrayWrappersType:`function`,stringArrayThreshold:1,transformObjectKeys:!0,unicodeEscapeSequence:!1});console.timeEnd(`Obfuscation complete in`);let o=i.getObfuscatedCode();return a(t||e,o),o},v=t({allowPositionals:!0,allowNegative:!0,options:{input:{type:`string`,short:`i`,description:`Path to the input file`},key:{type:`string`,short:`k`,description:`Path to the key file (public for encrypt, private for decrypt)`},output:{type:`string`,short:`o`,description:`Path to the output file`},format:{type:`string`,short:`f`,description:`Output format`},watch:{type:`boolean`,description:`Watch file changes`},minify:{type:`boolean`,description:`Minify output`},obfuscate:{type:`boolean`,description:`Obfuscate output`},encrypt:{type:`boolean`,description:`Encrypt extension source code (.js will be packed inside .stx)`},decrypt:{type:`boolean`,description:`Decrypt encrypted extension`}}}),y=()=>{let e=[process.cwd(),o.join(process.cwd(),`src`),o.join(process.cwd(),`lib`)];for(let t of e){let e=r(t).filter(e=>!e.endsWith(`.d.ts`)).filter(e=>new Set([`.ts`,`.js`]).has(o.extname(e))),n=e=>o.basename(e,o.extname(e)),i=e.find(e=>n(e)===`index`)||e.find(e=>n(e)===`main`)||e[0];if(i)return o.join(t,i)}};(async()=>{let[t,...r]=v.positionals,a=v.values.input||r[0]||y();if(!a)throw Error(`No entry file found`);if(t===`build`||t===`pack`){let r=typeof v.values.minify==`boolean`?v.values.minify:!0;await s({entry:a.replace(process.cwd(),`.`).replace(o.sep,`/`),format:v.values.format??`cjs`,platform:`node`,target:`node22`,watch:v.values.watch,minify:r}),v.values.input=o.join(process.cwd(),`dist`,o.basename(a).replace(/\.ts$/,`.js`));let c=e(o.join(process.cwd(),`package.json`));if((typeof v.values.obfuscate==`boolean`?v.values.obfuscate:c.private)&&_(v.values.input,v.values.input),v.values.encrypt||t===`pack`){let e=n(v.values.key||o.join(__dirname,`../public.pem`),`utf8`),t=v.values.output||v.values.input.replace(/\.js$/,`-${c.version}.stx`);h(e,v.values.input,t),i(v.values.input)}}else if(t===`decrypt`)g(n(v.values.key||o.join(__dirname,`../private.pem`),`utf8`),a,v.values.output||a.replace(/\.stx$/,`.js`)),v.values.input&&i(v.values.input);else if(t===`dev`||t===`develop`||!t){let e=typeof v.values.minify==`boolean`?v.values.minify:!1;await s({entry:a,format:v.values.format??`cjs`,platform:`node`,target:`node20`,watch:!0,minify:e})}})();export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";var t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),n=e(import.meta.url);export{n,t};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const e=require(`./chunk-350yNsax.cjs`);let t=require(`node:fs`),n=require(`node:path`);n=e.n(n);let r=require(`node:os`);r=e.n(r);let i=require(`node:timers/promises`),a=require(`@inquirer/prompts`),o=require(`node:fs/promises`);o=e.n(o);let s=require(`@logtape/logtape`),c=require(`@logtape/file`),l=require(`@logtape/pretty`),u=require(`node:process`),d=require(`node:events`);d=e.n(d),require(`urlpattern-polyfill`);let f=require(`node:readline/promises`),p=require(`impit`),m=require(`undici`),h=require(`metavm`);h=e.n(h),require(`picocolors`),require(`nanospinner`);let g=require(`conf`);g=e.n(g);var _=`azot-desktop`,v=`5.0.0-alpha.39`,y=`Azot`,b={name:_,version:v,description:`A powerful, extensible app for downloading videos`,keywords:[`api`,`azot`,`extensions`,`types`],homepage:`https://azot.mov`,author:`Vitaly Gashkov <vitalygashkov@vk.com>`,repository:{type:`git`,url:`https://github.com/azot-labs/azot.git`},funding:[{type:`individual`,url:`https://t.me/tribute/app?startapp=dqW2`}],files:[`out`],os:[`darwin`,`linux`,`win32`],main:`./out/main.js`,scripts:{start:`tsx --env-file .env ./src/main/cli.ts`,preview:`electron-vite preview --config vite.desktop.config.mjs`,dev:`electron-vite dev --config vite.desktop.config.mjs --watch`,cli:`pnpm run bundle:extensions && bun run ./src/main/cli.ts --env-file .env`,test:`vitest`,coverage:`vitest run --coverage`,"bundle:extensions":`node ./scripts/bundle-extensions.mjs`,"bundle:cli":`pnpm run bundle:extensions && node -e "require('fs').rmSync('azot',{force:true})" && STANDALONE=1 electron-vite build --config vite.cli.config.mjs`,bundle:`pnpm run bundle:cli && electron-vite build --config vite.desktop.config.mjs`,prebuild:`pnpm -C ../../packages/api build`,"build:cli":`pnpm run bundle:cli && bun build --compile ./out/cli.mjs --minify --outfile ./release/azot`,build:`pnpm run bundle && electron-builder build --config electron-builder.config.js`,"build:mac":`pnpm run bundle && electron-builder build --mac --arm64 --config electron-builder.config.js`,"build:mac:intel":`pnpm run bundle && electron-builder build --mac --x64 --config electron-builder.config.js`,"build:win":`pnpm run bundle && electron-builder build --win --config electron-builder.config.js`,"build:linux":`pnpm run bundle && electron-builder build --linux --config electron-builder.config.js`,"publish:desktop":`pnpm run bundle && electron-builder build --publish always --config electron-builder.config.js`,typecheck:`pnpm run typecheck:node && pnpm run typecheck:web`,"typecheck:node":`tsc --noEmit -p tsconfig.node.json --composite false`,"typecheck:web":`vue-tsc --noEmit -p tsconfig.web.json --composite false`,lint:`../../node_modules/.bin/oxlint -c ../../.oxlintrc.json .`,"lint:fix":`../../node_modules/.bin/oxlint -c ../../.oxlintrc.json --fix .`,fmt:`../../node_modules/.bin/oxfmt -c ../../.oxfmtrc.json .`,"fmt:check":`../../node_modules/.bin/oxfmt -c ../../.oxfmtrc.json --check .`},dependencies:{"@electron-toolkit/preload":`^3.0.2`,"@electron-toolkit/utils":`^4.0.0`,"@gitbeaker/rest":`^43.8.0`,"@inquirer/prompts":`^8.2.0`,"@logtape/file":`^2.0.2`,"@logtape/logtape":`^2.0.2`,"@logtape/pretty":`^2.0.2`,"@tanstack/query-core":`^5.90.20`,"@tribute-tg/better-auth":`^2.1.8`,azot:`workspace:*`,"better-auth":`^1.4.18`,bytenode:`^1.5.7`,conf:`^15.1.0`,cookie:`^1.1.1`,"cross-spawn":`^7.0.6`,dasha:`4.0.0-alpha.11`,"electron-squirrel-startup":`^1.0.1`,"electron-updater":`^6.7.3`,impit:`^0.9.1`,ky:`^1.14.3`,mediabunny:`^1.32.2`,metavm:`^1.4.5`,molnia:`workspace:*`,nanospinner:`^1.2.2`,okova:`^0.10.5`,open:`^11.0.0`,"p-queue":`^9.1.0`,picocolors:`^1.1.1`,"posthog-js":`^1.342.1`,semver:`^7.7.4`,"telegram-better-auth":`^0.0.8`,undici:`^7.21.0`,"urlpattern-polyfill":`^10.1.0`,yargs:`^18.0.0`,yauzl:`^3.2.0`,zod:`^4.3.6`},devDependencies:{"@electron-toolkit/tsconfig":`^2.0.0`,"@iconify/vue":`^5.0.0`,"@intlify/unplugin-vue-i18n":`^11.0.3`,"@tailwindcss/vite":`^4.1.18`,"@tanstack/vue-query":`^5.92.9`,"@types/node":`^25.2.1`,"@types/semver":`^7.7.1`,"@types/wicg-file-system-access":`^2023.10.7`,"@types/yargs":`^17.0.35`,"@vee-validate/zod":`^4.15.1`,"@vitejs/plugin-vue":`^6.0.4`,"@vueuse/core":`^14.2.0`,"class-variance-authority":`^0.7.1`,clsx:`^2.1.1`,dotenv:`^17.2.4`,electron:`39.5.1`,"electron-builder":`^26.4.0`,"electron-vite":`^5.0.0`,esbuild:`^0.27.3`,execa:`^9.6.0`,globals:`^16.3.0`,"lucide-vue-next":`^0.541.0`,"non.geist":`^1.0.4`,pinia:`^3.0.4`,postcss:`^8.5.6`,"reka-ui":`^2.8.0`,rolldown:`^1.0.0-rc.3`,sass:`^1.90.0`,"tailwind-merge":`^3.3.1`,tailwindcss:`^4.1.12`,"tailwindcss-animate":`^1.0.7`,tsdown:`^0.20.3`,tsx:`^4.21.0`,typescript:`^5.9.3`,"vee-validate":`^4.15.1`,vite:`^7.3.1`,"vite-plugin-static-copy":`^3.1.2`,vitest:`^4.0.18`,vue:`^3.5.27`,"vue-i18n":`^11.2.8`,"vue-sonner":`^2.0.9`,"vue-tsc":`^3.2.4`},peerDependencies:{vitest:`>=3.2.0`},engines:{node:`>=22`},productName:y,readmeFilename:`README.md`};`pkg`in process&&process.pkg,process.versions.electron,`${v}${u.platform}${u.arch}${u.version}`,`${v}`,_.split(`/`)[0]?.split(`-`)[0]?.replace(`@`,``);const x=y,ee={darwin:`macOS`,win32:`Windows`,linux:`Linux`}[process.platform],S=e=>{let n=typeof e==`string`?e:e[ee];return(0,t.existsSync)(n)||(0,t.mkdirSync)(n,{recursive:!0}),n},C=(0,r.homedir)(),te=(0,r.tmpdir)(),w=S({Windows:process.env.APPDATA||(0,n.join)(C,`AppData`,`Roaming`),macOS:(0,n.join)(C,`Library`,`Application Support`),Linux:process.env.XDG_DATA_HOME||(0,n.join)(C,`.local`,`share`)}),T=S({Windows:process.env.APPDATA||(0,n.join)(C,`AppData`,`Roaming`),macOS:(0,n.join)(C,`Library`,`Application Support`),Linux:process.env.XDG_CONFIG_HOME||(0,n.join)(C,`.config`)});S({Windows:process.env.LOCALAPPDATA||(0,n.join)(C,`AppData`,`Local`),macOS:(0,n.join)(C,`Library`,`Caches`),Linux:process.env.XDG_CACHE_HOME||(0,n.join)(C,`.cache`)}),S({Windows:(0,n.join)(C,`Downloads`),macOS:(0,n.join)(C,`Downloads`),Linux:process.env.XDG_DOWNLOAD_DIR||(0,n.join)(C,`Downloads`)});const ne=S({Windows:(0,n.join)(w,x),macOS:(0,n.join)(w,x),Linux:(0,n.join)(w,x.toLowerCase())}),re=S({Windows:(0,n.join)(T,x),macOS:(0,n.join)(T,x),Linux:(0,n.join)(T,x.toLowerCase())}),ie=S({Windows:(0,n.join)(T,x,`logs`),macOS:(0,n.join)(C,`Library`,`Logs`,x),Linux:(0,n.join)(T,x.toLowerCase(),`logs`)});(0,n.join)(te,x.toLowerCase());const E=S((0,n.join)(ne,`extensions`));S((0,n.join)(E,`installed`)),S((0,n.join)(E,`work`)),S((0,n.join)(E,`index.json`)),(0,n.join)(re,`settings.json`);const ae=process.argv.includes(`-d`)||process.argv.includes(`--debug`)||process.env.NODE_ENV_ELECTRON_VITE===`development`||!!process.env.ELECTRON_CLI_ARGS;(0,s.configureSync)({sinks:{console:(0,s.withFilter)((0,s.getConsoleSink)({formatter:(0,l.getPrettyFormatter)({timestamp:`time`,messageColor:null,messageStyle:null,levelStyle:null,icons:!1,colors:!0,level:`FULL`,categoryWidth:0,categoryStyle:null,categoryTruncate:`end`,wordWrap:!0})}),ae?`debug`:`info`),file:(0,c.getFileSink)((0,n.join)(ie,`Azot_${new Date().toISOString().split(`.`)[0].replace(`T`,`_`).replaceAll(`-`,``).replaceAll(`:`,``)}.log`),{flushInterval:0})},loggers:[{category:[],lowestLevel:`trace`,sinks:[`console`,`file`]},{category:[`logtape`,`meta`],lowestLevel:`error`,sinks:[`console`]}]});const D=(0,s.getLogger)([]),O=new class e extends d.EventEmitter{static requestEventName=`feedback`;static responseEventName=`feedback:response`;#e=Promise.resolve();async ask(t){let n=()=>new Promise(n=>{this.once(e.responseEventName,e=>{n(e)}),this.emit(e.requestEventName,t)}),r=this.#e.then(n,n);return this.#e=r.then(()=>void 0,()=>void 0),r}listen(t){this.addListener(e.requestEventName,async n=>{let r=await t(n);this.emit(e.responseEventName,r)})}},oe=e=>{let t=[`}`,`{`,`%`,`>`,`<`,`^`,`;`,"`",`$`,`"`,`@`,`=`],n=e;for(let e in t)n=n.replaceAll(`/`,`_`).replaceAll(t[e],``);return n},se=(e,t,n)=>{let r={},i={};for(let a of n)for(let n of t){let t=new URLPattern(n,a).exec(e);t&&(Object.assign(r,t.pathname.groups),Object.assign(i,t.search.groups))}return{pathname:r,search:i}},ce=(e=new Map)=>{let t=(t,n)=>{for(let r of e.keys())for(let i of e.get(r)||[]){let e=n===void 0||isNaN(n),a=t===void 0||isNaN(t),o=!1;if(o=a?r===n:(e?isNaN(r):r===n)&&i===t,o)return!0}return!1},n=(t,n)=>{let r=n||NaN,i=t||NaN;e.has(r)?e.get(r)?.add(i):e.set(r,new Set([i]))},r=()=>Array.from(e.values()).flatMap(e=>Array.from(e)),i=e.size,a=r();return{items:e,has:t,set:n,getMin:()=>Math.min(...a),getMax:()=>Math.max(...a),seasonsCount:i,episodesCount:a.length}};new Intl.DateTimeFormat(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}),new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});const k=new class e extends d.EventEmitter{static requestEventName=`form`;static responseEventName=`form:response`;title;#e=Promise.resolve();constructor(e={}){super(),this.title=e.title,this.listen(async e=>{let t=(0,f.createInterface)({input:u.stdin,output:u.stdout}),{title:n,description:r,fields:a,...o}=e,s={};for(let[e,{label:c,type:l}]of Object.entries(a||o)){let a=l===`confirm`,o=[n,r,c].filter(Boolean).join(`. `)+(a?` (y/n)`:``)+`: `;s[e]=await Promise.race([t.question(o),(0,i.setTimeout)(ue,``)])}return t.close(),s})}async ask(t){let n=()=>new Promise(n=>{this.once(e.responseEventName,e=>{n(e)}),this.emit(e.requestEventName,t)}),r=this.#e.then(n,n);return this.#e=r.then(()=>void 0,()=>void 0),r}listen(t){this.addListener(e.requestEventName,async n=>{let r=await t(n);this.emit(e.responseEventName,r)})}},le=async(e,t)=>{let n=t?.fields??{answer:{label:e}};return await k.ask({title:t?.title,description:e,fields:n})},ue=12e4;var A=class extends Error{response;request;options;constructor(e,t,n){let r=`${e.status||e.status===0?e.status:``} ${e.statusText??``}`.trim(),i=r?`status code ${r}`:`an unknown error`;super(`Request failed with ${i}: ${t.method} ${t.url}`),this.name=`HTTPError`,this.response=e,this.request=t,this.options=n}},de=class extends Error{name=`NonError`;value;constructor(e){let t=`Non-error value was thrown`;try{typeof e==`string`?t=e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`&&(t=e.message)}catch{}super(t),this.value=e}},j=class extends Error{name=`ForceRetryError`;customDelay;code;customRequest;constructor(e){let t=e?.cause?e.cause instanceof Error?e.cause:new de(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:`Forced retry`,t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}};const fe=(()=>{let e=!1,t=!1,n=typeof globalThis.ReadableStream==`function`,r=typeof globalThis.Request==`function`;if(n&&r)try{t=new globalThis.Request(`https://empty.invalid`,{body:new globalThis.ReadableStream,method:`POST`,get duplex(){return e=!0,`half`}}).headers.has(`Content-Type`)}catch(e){if(e instanceof Error&&e.message===`unsupported BodyInit type`)return!1;throw e}return e&&!t})(),pe=typeof globalThis.AbortController==`function`,M=typeof globalThis.AbortSignal==`function`&&typeof globalThis.AbortSignal.any==`function`,me=typeof globalThis.ReadableStream==`function`,he=typeof globalThis.FormData==`function`,N=[`get`,`post`,`put`,`patch`,`head`,`delete`],ge={json:`application/json`,text:`text/*`,formData:`multipart/form-data`,arrayBuffer:`*/*`,blob:`*/*`,bytes:`*/*`},P=2147483647,_e=new TextEncoder().encode(`------WebKitFormBoundaryaxpyiPgbbPti10Rw`).length,F=Symbol(`stop`);var I=class{options;constructor(e){this.options=e}};const ve=e=>new I(e),ye={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},be={next:!0},xe={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},Se=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[n,r]of e)t+=_e,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${n}"`).length,t+=typeof r==`string`?new TextEncoder().encode(r).length:r.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e==`string`)return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if(`byteLength`in e)return e.byteLength;if(typeof e==`object`&&e)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},L=(e,t,n)=>{let r,i=0;return e.pipeThrough(new TransformStream({transform(e,a){if(a.enqueue(e),r){i+=r.byteLength;let e=t===0?0:i/t;e>=1&&(e=1-2**-52),n?.({percent:e,totalBytes:Math.max(t,i),transferredBytes:i},r)}r=e},flush(){r&&(i+=r.byteLength,n?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},r))}}))},Ce=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let n=Math.max(0,Number(e.headers.get(`content-length`))||0);return new Response(L(e.body,n,t),{status:e.status,statusText:e.statusText,headers:e.headers})},we=(e,t,n)=>{if(!e.body)return e;let r=Se(n??e.body);return new Request(e,{duplex:`half`,body:L(e.body,r,t)})},R=e=>typeof e==`object`&&!!e,z=(...e)=>{for(let t of e)if((!R(t)||Array.isArray(t))&&t!==void 0)throw TypeError("The `options` argument must be an object");return U({},...e)},B=(e={},t={})=>{let n=new globalThis.Headers(e),r=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[e,t]of i.entries())r&&t===`undefined`||t===void 0?n.delete(e):n.set(e,t);return n};function V(e,t,n){return Object.hasOwn(t,n)&&t[n]===void 0?[]:U(e[n]??[],t[n]??[])}const H=(e={},t={})=>({beforeRequest:V(e,t,`beforeRequest`),beforeRetry:V(e,t,`beforeRetry`),afterResponse:V(e,t,`afterResponse`),beforeError:V(e,t,`beforeError`)}),Te=(e,t)=>{let n=new URLSearchParams;for(let r of[e,t])if(r!==void 0)if(r instanceof URLSearchParams)for(let[e,t]of r.entries())n.append(e,t);else if(Array.isArray(r))for(let e of r){if(!Array.isArray(e)||e.length!==2)throw TypeError(`Array search parameters must be provided in [[key, value], ...] format`);n.append(String(e[0]),String(e[1]))}else if(R(r))for(let[e,t]of Object.entries(r))t!==void 0&&n.append(e,String(t));else{let e=new URLSearchParams(r);for(let[t,r]of e.entries())n.append(t,r)}return n},U=(...e)=>{let t={},n={},r={},i,a=[];for(let o of e)if(Array.isArray(o))Array.isArray(t)||(t=[]),t=[...t,...o];else if(R(o)){for(let[e,n]of Object.entries(o)){if(e===`signal`&&n instanceof globalThis.AbortSignal){a.push(n);continue}if(e===`context`){if(n!=null&&(!R(n)||Array.isArray(n)))throw TypeError("The `context` option must be an object");t={...t,context:n==null?{}:{...t.context,...n}};continue}if(e===`searchParams`){i=n==null?void 0:i===void 0?n:Te(i,n);continue}R(n)&&e in t&&(n=U(t[e],n)),t={...t,[e]:n}}R(o.hooks)&&(r=H(r,o.hooks),t.hooks=r),R(o.headers)&&(n=B(n,o.headers),t.headers=n)}return i!==void 0&&(t.searchParams=i),a.length>0&&(a.length===1?t.signal=a[0]:M?t.signal=AbortSignal.any(a):t.signal=a.at(-1)),t},Ee=e=>N.includes(e)?e.toUpperCase():e,De={limit:2,methods:[`get`,`put`,`head`,`delete`,`options`,`trace`],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:1/0,backoffLimit:1/0,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},Oe=(e={})=>{if(typeof e==`number`)return{...De,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error(`retry.methods must be an array`);if(e.methods&&=e.methods.map(e=>e.toLowerCase()),e.statusCodes&&!Array.isArray(e.statusCodes))throw Error(`retry.statusCodes must be an array`);let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0));return{...De,...t}};var W=class extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name=`TimeoutError`,this.request=e}};async function ke(e,t,n,r){return new Promise((i,a)=>{let o=setTimeout(()=>{n&&n.abort(),a(new W(e))},r.timeout);r.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function Ae(e,{signal:t}){return new Promise((n,r)=>{t&&(t.throwIfAborted(),t.addEventListener(`abort`,i,{once:!0}));function i(){clearTimeout(a),r(t.reason)}let a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e)})}const je=(e,t)=>{let n={};for(let r in t)Object.hasOwn(t,r)&&!(r in xe)&&!(r in ye)&&(!(r in e)||r in be)&&(n[r]=t[r]);return n},Me=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e==`object`?Object.keys(e).length>0:typeof e==`string`?e.trim().length>0:!!e;function Ne(e){return e instanceof A||e?.name===A.name}function Pe(e){return e instanceof W||e?.name===W.name}var Fe=class e{static create(t,n){let r=new e(t,n),i=r.#p(async()=>{if(typeof r.#i.timeout==`number`&&r.#i.timeout>P)throw RangeError(`The \`timeout\` option cannot be greater than ${P}`);await Promise.resolve();let e=await r.#m();for(let t of r.#i.hooks.afterResponse){let n=r.#u(e.clone()),i;try{i=await t(r.request,r.#h(),n,{retryCount:r.#n})}catch(t){throw r.#f(n),r.#f(e),t}if(i instanceof I)throw r.#f(n),r.#f(e),new j(i.options);let a=i instanceof globalThis.Response?i:e;n!==a&&r.#f(n),e!==a&&r.#f(e),e=a}if(r.#u(e),!e.ok&&(typeof r.#i.throwHttpErrors==`function`?r.#i.throwHttpErrors(e.status):r.#i.throwHttpErrors)){let t=new A(e,r.request,r.#h());for(let e of r.#i.hooks.beforeError)t=await e(t,{retryCount:r.#n});throw t}if(r.#i.onDownloadProgress){if(typeof r.#i.onDownloadProgress!=`function`)throw TypeError("The `onDownloadProgress` option must be a function");if(!me)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let t=e.clone();return r.#f(e),Ce(t,r.#i.onDownloadProgress)}return e}).finally(()=>{let e=r.#a;r.#d(e?.body??void 0),r.#d(r.request.body??void 0)});for(let[e,t]of Object.entries(ge))e===`bytes`&&typeof globalThis.Response?.prototype?.bytes!=`function`||(i[e]=async()=>{r.request.headers.set(`accept`,r.request.headers.get(`accept`)||t);let a=await i;if(e===`json`){if(a.status===204)return``;let e=await a.text();return e===``?``:n.parseJson?n.parseJson(e):JSON.parse(e)}return a[e]()});return i}static#e(e){return e&&typeof e==`object`&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)):e}request;#t;#n=0;#r;#i;#a;#o;#s;constructor(t,n={}){if(this.#r=t,this.#i={...n,headers:B(this.#r.headers,n.headers),hooks:H({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:Ee(n.method??this.#r.method??`GET`),prefixUrl:String(n.prefixUrl||``),retry:Oe(n.retry),throwHttpErrors:n.throwHttpErrors??!0,timeout:n.timeout??1e4,fetch:n.fetch??globalThis.fetch.bind(globalThis),context:n.context??{}},typeof this.#r!=`string`&&!(this.#r instanceof URL||this.#r instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(this.#i.prefixUrl&&typeof this.#r==`string`){if(this.#r.startsWith(`/`))throw Error("`input` must not begin with a slash when using `prefixUrl`");this.#i.prefixUrl.endsWith(`/`)||(this.#i.prefixUrl+=`/`),this.#r=this.#i.prefixUrl+this.#r}pe&&M&&(this.#o=this.#i.signal??this.#r.signal,this.#t=new globalThis.AbortController,this.#i.signal=this.#o?AbortSignal.any([this.#o,this.#t.signal]):this.#t.signal),fe&&(this.#i.duplex=`half`),this.#i.json!==void 0&&(this.#i.body=this.#i.stringifyJson?.(this.#i.json)??JSON.stringify(this.#i.json),this.#i.headers.set(`content-type`,this.#i.headers.get(`content-type`)??`application/json`));let r=n.headers&&new globalThis.Headers(n.headers).has(`content-type`);if(this.#r instanceof globalThis.Request&&(he&&this.#i.body instanceof globalThis.FormData||this.#i.body instanceof URLSearchParams)&&!r&&this.#i.headers.delete(`content-type`),this.request=new globalThis.Request(this.#r,this.#i),Me(this.#i.searchParams)){let t=`?`+(typeof this.#i.searchParams==`string`?this.#i.searchParams.replace(/^\?/,``):new URLSearchParams(e.#e(this.#i.searchParams)).toString()),n=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,t);this.request=new globalThis.Request(n,this.#i)}if(this.#i.onUploadProgress){if(typeof this.#i.onUploadProgress!=`function`)throw TypeError("The `onUploadProgress` option must be a function");if(!fe)throw Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#_(this.request,this.#i.body??void 0)}}#c(){let e=this.#i.retry.delay(this.#n),t=e;this.#i.retry.jitter===!0?t=Math.random()*e:typeof this.#i.retry.jitter==`function`&&(t=this.#i.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e));let n=this.#i.retry.backoffLimit??1/0;return Math.min(n,t)}async#l(e){if(this.#n++,this.#n>this.#i.retry.limit)throw e;let t=e instanceof Error?e:new de(e);if(t instanceof j)return t.customDelay??this.#c();if(!this.#i.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#i.retry.shouldRetry!==void 0){let n=await this.#i.retry.shouldRetry({error:t,retryCount:this.#n});if(n===!1)throw e;if(n===!0)return this.#c()}if(Pe(e)&&!this.#i.retry.retryOnTimeout)throw e;if(Ne(e)){if(!this.#i.retry.statusCodes.includes(e.response.status))throw e;let t=e.response.headers.get(`Retry-After`)??e.response.headers.get(`RateLimit-Reset`)??e.response.headers.get(`X-RateLimit-Retry-After`)??e.response.headers.get(`X-RateLimit-Reset`)??e.response.headers.get(`X-Rate-Limit-Reset`);if(t&&this.#i.retry.afterStatusCodes.includes(e.response.status)){let e=Number(t)*1e3;Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse(`2024-01-01`)&&(e-=Date.now());let n=this.#i.retry.maxRetryAfter??e;return e<n?e:n}if(e.response.status===413)throw e}return this.#c()}#u(e){return this.#i.parseJson&&(e.json=async()=>this.#i.parseJson(await e.text())),e}#d(e){e&&e.cancel().catch(()=>void 0)}#f(e){this.#d(e.body??void 0)}async#p(e){try{return await e()}catch(t){let n=Math.min(await this.#l(t),P);if(this.#n<1)throw t;if(await Ae(n,this.#o?{signal:this.#o}:{}),t instanceof j&&t.customRequest){let e=this.#i.signal?new globalThis.Request(t.customRequest,{signal:this.#i.signal}):new globalThis.Request(t.customRequest);this.#g(e)}for(let e of this.#i.hooks.beforeRetry){let n=await e({request:this.request,options:this.#h(),error:t,retryCount:this.#n});if(n instanceof globalThis.Request){this.#g(n);break}if(n instanceof globalThis.Response)return n;if(n===F)return}return this.#p(e)}}async#m(){this.#t?.signal.aborted&&(this.#t=new globalThis.AbortController,this.#i.signal=this.#o?AbortSignal.any([this.#o,this.#t.signal]):this.#t.signal,this.request=new globalThis.Request(this.request,{signal:this.#i.signal}));for(let e of this.#i.hooks.beforeRequest){let t=await e(this.request,this.#h(),{retryCount:this.#n});if(t instanceof Response)return t;if(t instanceof globalThis.Request){this.#g(t);break}}let e=je(this.request,this.#i);return this.#a=this.request,this.request=this.#a.clone(),this.#i.timeout===!1?this.#i.fetch(this.#a,e):ke(this.#a,e,this.#t,this.#i)}#h(){if(!this.#s){let{hooks:e,...t}=this.#i;this.#s=Object.freeze(t)}return this.#s}#g(e){this.#s=void 0,this.request=this.#_(e)}#_(e,t){return!this.#i.onUploadProgress||!e.body?e:we(e,this.#i.onUploadProgress,t??this.#i.body??void 0)}};
|
|
2
|
+
/*! MIT License © Sindre Sorhus */
|
|
3
|
+
const G=e=>{let t=(t,n)=>Fe.create(t,z(e,n));for(let n of N)t[n]=(t,r)=>Fe.create(t,z(e,r,{method:n}));return t.create=e=>G(z(e)),t.extend=t=>(typeof t==`function`&&(t=t(e??{})),G(z(e,t))),t.stop=F,t.retry=ve,t},Ie=G();var Le=e.t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.stringifySetCookie=s,e.serialize=s,e.parseSetCookie=c,e.stringifySetCookie=s,e.serialize=s;let t=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,n=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,i=/^[\u0020-\u003A\u003D-\u007E]*$/,a=/^-?\d+$/,o=Object.prototype.toString;function s(e,a,o){let s=typeof e==`object`?e:{...o,name:e,value:String(a)},c=(typeof a==`object`?a:o)?.encode||encodeURIComponent;if(!t.test(s.name))throw TypeError(`argument name is invalid: ${s.name}`);let l=s.value?c(s.value):``;if(!n.test(l))throw TypeError(`argument val is invalid: ${s.value}`);let u=s.name+`=`+l;if(s.maxAge!==void 0){if(!Number.isInteger(s.maxAge))throw TypeError(`option maxAge is invalid: ${s.maxAge}`);u+=`; Max-Age=`+s.maxAge}if(s.domain){if(!r.test(s.domain))throw TypeError(`option domain is invalid: ${s.domain}`);u+=`; Domain=`+s.domain}if(s.path){if(!i.test(s.path))throw TypeError(`option path is invalid: ${s.path}`);u+=`; Path=`+s.path}if(s.expires){if(!p(s.expires)||!Number.isFinite(s.expires.valueOf()))throw TypeError(`option expires is invalid: ${s.expires}`);u+=`; Expires=`+s.expires.toUTCString()}if(s.httpOnly&&(u+=`; HttpOnly`),s.secure&&(u+=`; Secure`),s.partitioned&&(u+=`; Partitioned`),s.priority)switch(typeof s.priority==`string`?s.priority.toLowerCase():void 0){case`low`:u+=`; Priority=Low`;break;case`medium`:u+=`; Priority=Medium`;break;case`high`:u+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid: ${s.priority}`)}if(s.sameSite)switch(typeof s.sameSite==`string`?s.sameSite.toLowerCase():s.sameSite){case!0:case`strict`:u+=`; SameSite=Strict`;break;case`lax`:u+=`; SameSite=Lax`;break;case`none`:u+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid: ${s.sameSite}`)}return u}function c(e,t){let n=t?.decode||f,r=e.length,i=l(e,0,r),o=u(e,0,i),s=o===-1?{name:``,value:n(d(e,0,i))}:{name:d(e,0,o),value:n(d(e,o+1,i))},c=i+1;for(;c<r;){let t=l(e,c,r),n=u(e,c,t),i=n===-1?d(e,c,t):d(e,c,n),o=n===-1?void 0:d(e,n+1,t);switch(i.toLowerCase()){case`httponly`:s.httpOnly=!0;break;case`secure`:s.secure=!0;break;case`partitioned`:s.partitioned=!0;break;case`domain`:s.domain=o;break;case`path`:s.path=o;break;case`max-age`:o&&a.test(o)&&(s.maxAge=Number(o));break;case`expires`:if(!o)break;let e=new Date(o);Number.isFinite(e.valueOf())&&(s.expires=e);break;case`priority`:if(!o)break;let t=o.toLowerCase();(t===`low`||t===`medium`||t===`high`)&&(s.priority=t);break;case`samesite`:if(!o)break;let n=o.toLowerCase();(n===`lax`||n===`strict`||n===`none`)&&(s.sameSite=n);break}c=t+1}return s}function l(e,t,n){let r=e.indexOf(`;`,t);return r===-1?n:r}function u(e,t,n){let r=e.indexOf(`=`,t);return r<n?r:-1}function d(e,t,n){let r=t,i=n;do{let t=e.charCodeAt(r);if(t!==32&&t!==9)break}while(++r<i);for(;i>r;){let t=e.charCodeAt(i-1);if(t!==32&&t!==9)break;i--}return e.slice(r,i)}function f(e){if(e.indexOf(`%`)===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function p(e){return o.call(e)===`[object Date]`}}))();const K=e=>{let t=[];for(let n of e)try{let e=(0,Le.parseSetCookie)(n),r={...e,expires:e.expires instanceof Date?e.expires.getTime():e.expires,sameSite:typeof e.sameSite==`boolean`?`strict`:e.sameSite};t.push(r)}catch(e){D.debug(e)}return t},Re=async e=>{let t=await(0,o.readFile)(e,`utf8`).catch(()=>``);if(!t)return[];let n=t.split(r.EOL).flatMap(e=>e.split(`
|
|
4
|
+
`)).filter(e=>!!e.trim()&&!e.startsWith(`# `)).map(e=>e.split(` `)),i=[];for(let e of n){let[t,n,r,a,o,s,c]=e;i.push({name:s,value:c,expires:Number(o),maxAge:void 0,domain:t.replace(`#HttpOnly_`,``),path:r,secure:a===`TRUE`,httpOnly:void 0,sameSite:void 0})}return i};var ze=class{#e={};#t;#n;#r=!1;static parse(e){return K(e)}constructor({storagePath:e}={}){this.#n=e,this.#t=[]}async import(e){(await(0,o.stat)(e).catch(()=>null))?.isFile()&&(this.#t=await Re(e),await(0,o.rm)(e,{recursive:!0,force:!0}))}async#i(){if(!(!this.#n||this.#r)){if((await(0,o.stat)(this.#n).catch(()=>null))?.isFile()){let e=await(0,o.readFile)(this.#n,`utf8`);this.#e=e?JSON.parse(e):{},this.#t=`cookies`in this.#e?this.#e.cookies:[]}this.#r=!0}}async#a(){if(!this.#n)return;let e=JSON.stringify({...this.#e,cookies:this.#t},null,2);await(0,o.writeFile)(this.#n,e,`utf8`)}async get(e){await this.#i();let t=typeof e==`string`?e:e.name;return this.#t.find(e=>e.name===t)??null}async getAll(e){if(await this.#i(),!e)return this.#t;let t=typeof e==`string`?e:e.name;return this.#t.filter(e=>e.name===t)??null}async set(e){await this.#i(),this.#t=this.#t.filter(t=>!(t.name===e.name&&t.domain===e.domain)),this.#t.push(e),await this.#a()}async delete(e){if(await this.#i(),!e)this.#t=[];else{let t=typeof e==`string`?e:e.name;this.#t=this.#t.filter(e=>e.name!==t)}await this.#a()}toString(){return this.#t.map(e=>`${e.name}=${e.value}`).join(`; `)}};const Be=Ie.default??Ie,Ve=e=>e?e instanceof Headers?e.has(`User-Agent`):typeof e==`object`&&e?`User-Agent`in e||`user-agent`in e:!1:!1,He=e=>e instanceof URL?e:e instanceof Request?new URL(e.url):new URL(e);var Ue=class{cookieStore;headers;#e;#t;constructor(e={}){this.headers=new Headers,this.configure(e)}configure({maxRetries:e=3,proxyUrl:t,allowH2:n=!0,cookieStore:r}={}){this.cookieStore=r??this.cookieStore??new ze;let i=t?new m.ProxyAgent({uri:t,allowH2:n}):new m.Agent({allowH2:n}),a={retry:e};this.#e=Be.create({dispatcher:i,proxy:t,...a});let o=new p.Impit({browser:`chrome`,proxyUrl:t,ignoreTlsErrors:!0,followRedirects:!0});this.#t=Be.create({fetch:o.fetch.bind(o),...a})}async fetch(e,t={}){let n=this.appendHeaders(t?.headers),r=await this.cookieStore.getAll(),i=r.filter(t=>!t.domain||He(e).hostname.includes(t.domain));for(let e of r)i.find(t=>t.name===e.name)||e.domain||i.push(e);let a=i.map(e=>`${e.name}=${e.value}`).join(`; `);n.has(`cookie`)?n.get(`cookie`)||n.delete(`cookie`):n.set(`cookie`,a);let o=(Ve(t?.headers)?this.#e:this.#t)[t?.method?.toLowerCase()??`get`],s=await o(e,{...t,headers:n}),c=s.headers.getSetCookie();return c&&await this.setCookies(c),s}async setCookies(e){let t=[];if(typeof e==`string`){let[n]=K([e]);n&&t.push(n)}else if(Array.isArray(e)&&typeof e.at(0)==`string`){let n=K(e);t.push(...n)}else Array.isArray(e)&&typeof e[0]!=`string`&&t.push(...e);if(!(!t||!t?.length))for(let e of t)await this.cookieStore.set(e)}appendHeaders(e){let t=new Headers(this.headers);for(let[n,r]of Object.entries(e??{}))t.set(n,r);return t}setHeader(e,t){this.headers.set(e,t)}removeHeader(e){this.headers.delete(e)}};new Ue;const{COMMON_CONTEXT:We}=h.default,Ge=(e,t=`Eval`,n)=>{try{return h.default.createScript(t,e,n)}catch(t){return console.debug(t),console.debug(e),console.error(`Syntax Error: ${t.message}`),null}},Ke=(e,t=1)=>{if(Array.isArray(e)||typeof e==`string`){let n=[];for(let r=1;r<=t;r++)n.push(e[Math.floor(Math.random()*e.length)]);return n}else return[]},qe=e=>new(`default`in g.default?g.default.default:g.default)(e);var Je=class{#e;constructor(e){this.#e=qe({cwd:(0,n.dirname)(e),configName:(0,n.basename)(e,`.json`)})}get length(){return Object.keys(this.#e.store).length}clear(){this.#e.clear()}getItem(e){return this.#e.get(e)??null}key(e){return Object.keys(this.#e.store).at(e)??null}removeItem(e){this.#e.delete(e)}setItem(e,t){this.#e.set(e,t)}};const Ye=new d.default,q=e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return t===`ExitPromptError`||t===`AbortPromptError`},Xe=e=>e[0].toUpperCase()+e.slice(1),J=(e,t=!1)=>{if(typeof e==`boolean`)return e;if(typeof e!=`string`)return t;let n=e.trim().toLowerCase();return[`1`,`true`,`yes`,`y`,`on`].includes(n)?!0:[`0`,`false`,`no`,`n`,`off`].includes(n)?!1:t},Y=(e,t=0)=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`)return t;let n=Number(e);return Number.isFinite(n)?n:t},Ze=e=>{switch(e.type){case`checkbox`:return J(e.defaultValue,!1);case`number`:return Y(e.defaultValue,0);default:return e.defaultValue??``}},Qe=(e,t)=>{switch(e.type){case`checkbox`:return J(t,J(e.defaultValue,!1));case`number`:return Y(t,Y(e.defaultValue,0));default:return typeof t==`string`?t:t==null?e.defaultValue??``:String(t)}},$e=e=>{let t=Object.entries(e).map(([e,t])=>[e,Ze(t)]);return Object.fromEntries(t)},X=(e,t)=>{let n=Object.entries(e).map(([e,n])=>[e,Qe(n,t[e])]);return Object.fromEntries(n)},Z=async e=>{e?.onAction&&await e.onAction()},Q=async(e,t)=>{if(!t.length)return`dismiss`;try{return await(0,a.select)({message:e,loop:!1,choices:t.map(e=>({name:e.action.title,value:e.kind}))})}catch(e){if(q(e))return`dismiss`;throw e}},$=()=>{switch(r.default.type()){case`Darwin`:return`macOS`;case`Windows_NT`:return`Windows`;default:return`Linux`}};Object.defineProperties(Uint8Array.prototype,{toBase64:{value:function(){return Buffer.from(this).toString(`base64`)},writable:!0,configurable:!0},toHex:{value:function(){return Buffer.from(this).toString(`hex`)},writable:!0,configurable:!0}}),Object.defineProperties(Uint8Array,{fromBase64:{value:function(e){return new Uint8Array(Buffer.from(e,`base64`))},writable:!0,configurable:!0},fromHex:{value:function(e){return new Uint8Array(Buffer.from(e,`hex`))},writable:!0,configurable:!0}});const et=new Map([[24,[`Sequoia`,`15`]],[23,[`Sonoma`,`14`]],[22,[`Ventura`,`13`]],[21,[`Monterey`,`12`]],[20,[`Big Sur`,`11`]],[19,[`Catalina`,`10.15`]],[18,[`Mojave`,`10.14`]],[17,[`High Sierra`,`10.13`]],[16,[`Sierra`,`10.12`]],[15,[`El Capitan`,`10.11`]],[14,[`Yosemite`,`10.10`]],[13,[`Mavericks`,`10.9`]],[12,[`Mountain Lion`,`10.8`]],[11,[`Lion`,`10.7`]],[10,[`Snow Leopard`,`10.6`]],[9,[`Leopard`,`10.5`]],[8,[`Tiger`,`10.4`]],[7,[`Panther`,`10.3`]],[6,[`Jaguar`,`10.2`]],[5,[`Puma`,`10.1`]]]),tt=()=>{let e=Number(r.default.release().split(`.`)[0]),[t,n]=et.get(e)||[`Unknown`,``];return{name:t,version:n}},nt=()=>{switch($()){case`macOS`:return tt().version;case`Windows`:return r.default.release();case`Linux`:return r.default.release()}},rt=()=>{let e=[{brand:`Azot`,version:b.version.split(`.`).slice(0,2).join(`.`)},{brand:`Node.js`,version:process.version.replace(`v`,``).split(`.`).slice(0,1).join(`.`)}];return{mobile:!1,platform:$(),brands:e,getHighEntropyValues:async t=>{let n={mobile:!1,platform:$(),brands:e};return t.includes(`architecture`)&&(n.architecture=r.default.arch()),t.includes(`platform`)&&(n.platform=$()),t.includes(`platformVersion`)&&(n.platformVersion=nt()),t.includes(`fullVersionList`)&&(n.fullVersionList=[{brand:`Azot`,version:b.version},{brand:`Node.js`,version:process.version}]),n}}},it=({name:e=`extension`,dir:t=process.cwd(),title:r}={})=>{let o=S((0,n.join)(t,e)),s=new Je((0,n.join)(o,`storage.json`)),c=new ze({storagePath:(0,n.join)(o,`cookies.json`)}),l=new Ue({cookieStore:c}),u=(e,t,n)=>e.split(t)[1]?.split(n)[0]?.trim(),d={sanitizeString:oe,execUrlPatterns:se,extendEpisodes:ce,between:u,getRandomElements:Ke},f=r?Xe(r):void 0,p=e=>e||f,m=async e=>(e.title||=f,await k.ask(e)),h={defineExtension:e=>e,version:b.version,sleep:i.setTimeout,sanitizeString:oe,execUrlPatterns:se,extendEpisodes:ce,between:u,getRandomElements:Ke,utils:d,prompt:m,input:le,notify:async(e,t={})=>{let n=p(t.title)??`Azot`,r=[t.primaryAction?{kind:`primary`,action:t.primaryAction}:null,t.secondaryAction?{kind:`secondary`,action:t.secondaryAction}:null].filter(Boolean);{if(D.info(`[Extension notification] ${n}: ${e}`),!r.length)return;let i=await Q(e,r);i===`primary`&&await Z(t.primaryAction),i===`secondary`&&await Z(t.secondaryAction);return}let i=(await O.ask({variant:`notify`,title:n,message:e,style:t.style,primaryAction:t.primaryAction?{title:t.primaryAction.title,style:t.primaryAction.style}:void 0,secondaryAction:t.secondaryAction?{title:t.secondaryAction.title,style:t.secondaryAction.style}:void 0})).action??`dismiss`;i===`primary`&&await Z(t.primaryAction),i===`secondary`&&await Z(t.secondaryAction)},confirm:async(e,t={})=>{let n=p(t.title)??`Azot`,r=!!t.primaryAction||!!t.secondaryAction,i=t.primaryAction??{title:`OK`},o=t.secondaryAction??{title:`Cancel`,style:`cancel`};if(r){let t=await Q(e,[{kind:`primary`,action:i},{kind:`secondary`,action:o}]);return t===`primary`?(await Z(i),!0):(t===`secondary`&&await Z(o),!1)}try{let n=await(0,a.confirm)({message:e,default:!0});return n?await Z(t.primaryAction):await Z(t.secondaryAction),n}catch(e){if(q(e))return!1;throw e}let s=await O.ask({variant:`confirm`,title:n,message:e,style:t.style,primaryAction:{title:i.title,style:i.style},secondaryAction:{title:o.title,style:o.style}}),c=s.action===`primary`;return c?await Z(i):s.action===`secondary`&&await Z(o),c},ask:async(e,t)=>{let n=$e(t.form),r=Object.entries(t.form),i=!!t.primaryAction||!!t.secondaryAction,o=t.primaryAction??{title:`Submit`},s=t.secondaryAction??{title:`Cancel`,style:`cancel`};{let c={};try{for(let[e,t]of r){let n=[t.title||e,t.description].filter(Boolean).join(` - `);if(t.type===`checkbox`){c[e]=await(0,a.confirm)({message:n,default:J(t.defaultValue,!1)});continue}if(t.type===`number`){let r=Y(t.defaultValue,NaN);c[e]=await(0,a.number)({message:n,default:Number.isFinite(r)?r:void 0,validate:e=>(e===void 0||Number.isNaN(e))&&t.required?`This field is required`:!0});continue}if(t.type===`password`){c[e]=await(0,a.password)({message:n,validate:t.required?e=>String(e??``).trim()?!0:`This field is required`:void 0});continue}c[e]=await(0,a.input)({message:n,default:t.defaultValue,validate:t.required?e=>String(e??``).trim()?!0:`This field is required`:void 0})}}catch(e){if(q(e))return n;throw e}if(!i)return X(t.form,c);let l=await Q(e,[{kind:`primary`,action:o},{kind:`secondary`,action:s}]);return l===`primary`?(await Z(o),X(t.form,c)):(l===`secondary`&&await Z(s),n)}let c=Object.fromEntries(r.map(([e,t])=>[e,{type:t.type,label:t.title||e,description:t.description,placeholder:t.placeholder,defaultValue:t.defaultValue,value:t.defaultValue,required:t.required,autoFocus:t.autoFocus}])),l=await m({title:p(t.title),description:e,fields:c,actions:i?{primaryAction:{title:o.title,style:o.style},secondaryAction:{title:s.title,style:s.style}}:void 0}),u=l.__action??`primary`,d={...l};return delete d.__action,u===`primary`?(await Z(t.primaryAction),X(t.form,d)):(u===`secondary`&&await Z(t.secondaryAction),n)}};class g{get cookie(){return c.toString()}}let _={fetch:l.fetch.bind(l),Response,Request,Headers,AbortController,AbortSignal,URL,URLSearchParams,URLPattern,Blob,structuredClone,btoa,atob,TextEncoder,TextDecoder,Uint8Array,crypto,console:{log:console.log,info:D.info.bind(D),warn:D.warn.bind(D),error:(...e)=>{let t=String(e[0]??`Unknown error`);Ye.emit(`error`,{message:t}),D.error(t)},trace:D.trace.bind(D),debug:D.debug.bind(D)},Event,EventTarget,localStorage:s,cookieStore:c,document:new g,eval:e=>Ge(e)?.exports,navigator:{appName:`Azot`,appVersion:b.version,platform:process.platform,userAgent:`Azot/${b.version}`,userAgentData:rt()}};return{http:l,question:k,common:d,Streamyx:h,Azot:h,window:_,..._}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return it}});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{t as e}from"./chunk-DtROqxiw.mjs";import{existsSync as t,mkdirSync as n}from"node:fs";import r,{basename as i,dirname as a,join as o}from"node:path";import s,{EOL as c,homedir as l,tmpdir as u}from"node:os";import{setTimeout as d}from"node:timers/promises";import{confirm as f,input as ee,number as te,password as ne,select as p}from"@inquirer/prompts";import{readFile as m,rm as h,stat as g,writeFile as _}from"node:fs/promises";import{configureSync as re,getConsoleSink as ie,getLogger as ae,withFilter as oe}from"@logtape/logtape";import{getFileSink as se}from"@logtape/file";import{getPrettyFormatter as ce}from"@logtape/pretty";import{arch as le,platform as ue,stdin as de,stdout as fe,version as pe}from"node:process";import me,{EventEmitter as v}from"node:events";import"urlpattern-polyfill";import{createInterface as he}from"node:readline/promises";import{Impit as ge}from"impit";import{Agent as _e,ProxyAgent as ve}from"undici";import y from"metavm";import"picocolors";import"nanospinner";import b from"conf";var x=`azot-desktop`,S=`5.0.0-alpha.39`,ye=`Azot`,C={name:x,version:S,description:`A powerful, extensible app for downloading videos`,keywords:[`api`,`azot`,`extensions`,`types`],homepage:`https://azot.mov`,author:`Vitaly Gashkov <vitalygashkov@vk.com>`,repository:{type:`git`,url:`https://github.com/azot-labs/azot.git`},funding:[{type:`individual`,url:`https://t.me/tribute/app?startapp=dqW2`}],files:[`out`],os:[`darwin`,`linux`,`win32`],main:`./out/main.js`,scripts:{start:`tsx --env-file .env ./src/main/cli.ts`,preview:`electron-vite preview --config vite.desktop.config.mjs`,dev:`electron-vite dev --config vite.desktop.config.mjs --watch`,cli:`pnpm run bundle:extensions && bun run ./src/main/cli.ts --env-file .env`,test:`vitest`,coverage:`vitest run --coverage`,"bundle:extensions":`node ./scripts/bundle-extensions.mjs`,"bundle:cli":`pnpm run bundle:extensions && node -e "require('fs').rmSync('azot',{force:true})" && STANDALONE=1 electron-vite build --config vite.cli.config.mjs`,bundle:`pnpm run bundle:cli && electron-vite build --config vite.desktop.config.mjs`,prebuild:`pnpm -C ../../packages/api build`,"build:cli":`pnpm run bundle:cli && bun build --compile ./out/cli.mjs --minify --outfile ./release/azot`,build:`pnpm run bundle && electron-builder build --config electron-builder.config.js`,"build:mac":`pnpm run bundle && electron-builder build --mac --arm64 --config electron-builder.config.js`,"build:mac:intel":`pnpm run bundle && electron-builder build --mac --x64 --config electron-builder.config.js`,"build:win":`pnpm run bundle && electron-builder build --win --config electron-builder.config.js`,"build:linux":`pnpm run bundle && electron-builder build --linux --config electron-builder.config.js`,"publish:desktop":`pnpm run bundle && electron-builder build --publish always --config electron-builder.config.js`,typecheck:`pnpm run typecheck:node && pnpm run typecheck:web`,"typecheck:node":`tsc --noEmit -p tsconfig.node.json --composite false`,"typecheck:web":`vue-tsc --noEmit -p tsconfig.web.json --composite false`,lint:`../../node_modules/.bin/oxlint -c ../../.oxlintrc.json .`,"lint:fix":`../../node_modules/.bin/oxlint -c ../../.oxlintrc.json --fix .`,fmt:`../../node_modules/.bin/oxfmt -c ../../.oxfmtrc.json .`,"fmt:check":`../../node_modules/.bin/oxfmt -c ../../.oxfmtrc.json --check .`},dependencies:{"@electron-toolkit/preload":`^3.0.2`,"@electron-toolkit/utils":`^4.0.0`,"@gitbeaker/rest":`^43.8.0`,"@inquirer/prompts":`^8.2.0`,"@logtape/file":`^2.0.2`,"@logtape/logtape":`^2.0.2`,"@logtape/pretty":`^2.0.2`,"@tanstack/query-core":`^5.90.20`,"@tribute-tg/better-auth":`^2.1.8`,azot:`workspace:*`,"better-auth":`^1.4.18`,bytenode:`^1.5.7`,conf:`^15.1.0`,cookie:`^1.1.1`,"cross-spawn":`^7.0.6`,dasha:`4.0.0-alpha.11`,"electron-squirrel-startup":`^1.0.1`,"electron-updater":`^6.7.3`,impit:`^0.9.1`,ky:`^1.14.3`,mediabunny:`^1.32.2`,metavm:`^1.4.5`,molnia:`workspace:*`,nanospinner:`^1.2.2`,okova:`^0.10.5`,open:`^11.0.0`,"p-queue":`^9.1.0`,picocolors:`^1.1.1`,"posthog-js":`^1.342.1`,semver:`^7.7.4`,"telegram-better-auth":`^0.0.8`,undici:`^7.21.0`,"urlpattern-polyfill":`^10.1.0`,yargs:`^18.0.0`,yauzl:`^3.2.0`,zod:`^4.3.6`},devDependencies:{"@electron-toolkit/tsconfig":`^2.0.0`,"@iconify/vue":`^5.0.0`,"@intlify/unplugin-vue-i18n":`^11.0.3`,"@tailwindcss/vite":`^4.1.18`,"@tanstack/vue-query":`^5.92.9`,"@types/node":`^25.2.1`,"@types/semver":`^7.7.1`,"@types/wicg-file-system-access":`^2023.10.7`,"@types/yargs":`^17.0.35`,"@vee-validate/zod":`^4.15.1`,"@vitejs/plugin-vue":`^6.0.4`,"@vueuse/core":`^14.2.0`,"class-variance-authority":`^0.7.1`,clsx:`^2.1.1`,dotenv:`^17.2.4`,electron:`39.5.1`,"electron-builder":`^26.4.0`,"electron-vite":`^5.0.0`,esbuild:`^0.27.3`,execa:`^9.6.0`,globals:`^16.3.0`,"lucide-vue-next":`^0.541.0`,"non.geist":`^1.0.4`,pinia:`^3.0.4`,postcss:`^8.5.6`,"reka-ui":`^2.8.0`,rolldown:`^1.0.0-rc.3`,sass:`^1.90.0`,"tailwind-merge":`^3.3.1`,tailwindcss:`^4.1.12`,"tailwindcss-animate":`^1.0.7`,tsdown:`^0.20.3`,tsx:`^4.21.0`,typescript:`^5.9.3`,"vee-validate":`^4.15.1`,vite:`^7.3.1`,"vite-plugin-static-copy":`^3.1.2`,vitest:`^4.0.18`,vue:`^3.5.27`,"vue-i18n":`^11.2.8`,"vue-sonner":`^2.0.9`,"vue-tsc":`^3.2.4`},peerDependencies:{vitest:`>=3.2.0`},engines:{node:`>=22`},productName:ye,readmeFilename:`README.md`};`pkg`in process&&process.pkg,process.versions.electron,`${S}${ue}${le}${pe}`,`${S}`,x.split(`/`)[0]?.split(`-`)[0]?.replace(`@`,``);const w=ye,be={darwin:`macOS`,win32:`Windows`,linux:`Linux`}[process.platform],T=e=>{let r=typeof e==`string`?e:e[be];return t(r)||n(r,{recursive:!0}),r},E=l(),xe=u(),D=T({Windows:process.env.APPDATA||o(E,`AppData`,`Roaming`),macOS:o(E,`Library`,`Application Support`),Linux:process.env.XDG_DATA_HOME||o(E,`.local`,`share`)}),O=T({Windows:process.env.APPDATA||o(E,`AppData`,`Roaming`),macOS:o(E,`Library`,`Application Support`),Linux:process.env.XDG_CONFIG_HOME||o(E,`.config`)});T({Windows:process.env.LOCALAPPDATA||o(E,`AppData`,`Local`),macOS:o(E,`Library`,`Caches`),Linux:process.env.XDG_CACHE_HOME||o(E,`.cache`)}),T({Windows:o(E,`Downloads`),macOS:o(E,`Downloads`),Linux:process.env.XDG_DOWNLOAD_DIR||o(E,`Downloads`)});const Se=T({Windows:o(D,w),macOS:o(D,w),Linux:o(D,w.toLowerCase())}),Ce=T({Windows:o(O,w),macOS:o(O,w),Linux:o(O,w.toLowerCase())}),we=T({Windows:o(O,w,`logs`),macOS:o(E,`Library`,`Logs`,w),Linux:o(O,w.toLowerCase(),`logs`)});o(xe,w.toLowerCase());const k=T(o(Se,`extensions`));T(o(k,`installed`)),T(o(k,`work`)),T(o(k,`index.json`)),o(Ce,`settings.json`);const Te=process.argv.includes(`-d`)||process.argv.includes(`--debug`)||process.env.NODE_ENV_ELECTRON_VITE===`development`||!!process.env.ELECTRON_CLI_ARGS;re({sinks:{console:oe(ie({formatter:ce({timestamp:`time`,messageColor:null,messageStyle:null,levelStyle:null,icons:!1,colors:!0,level:`FULL`,categoryWidth:0,categoryStyle:null,categoryTruncate:`end`,wordWrap:!0})}),Te?`debug`:`info`),file:se(o(we,`Azot_${new Date().toISOString().split(`.`)[0].replace(`T`,`_`).replaceAll(`-`,``).replaceAll(`:`,``)}.log`),{flushInterval:0})},loggers:[{category:[],lowestLevel:`trace`,sinks:[`console`,`file`]},{category:[`logtape`,`meta`],lowestLevel:`error`,sinks:[`console`]}]});const A=ae([]),Ee=new class e extends v{static requestEventName=`feedback`;static responseEventName=`feedback:response`;#e=Promise.resolve();async ask(t){let n=()=>new Promise(n=>{this.once(e.responseEventName,e=>{n(e)}),this.emit(e.requestEventName,t)}),r=this.#e.then(n,n);return this.#e=r.then(()=>void 0,()=>void 0),r}listen(t){this.addListener(e.requestEventName,async n=>{let r=await t(n);this.emit(e.responseEventName,r)})}},De=e=>{let t=[`}`,`{`,`%`,`>`,`<`,`^`,`;`,"`",`$`,`"`,`@`,`=`],n=e;for(let e in t)n=n.replaceAll(`/`,`_`).replaceAll(t[e],``);return n},Oe=(e,t,n)=>{let r={},i={};for(let a of n)for(let n of t){let t=new URLPattern(n,a).exec(e);t&&(Object.assign(r,t.pathname.groups),Object.assign(i,t.search.groups))}return{pathname:r,search:i}},j=(e=new Map)=>{let t=(t,n)=>{for(let r of e.keys())for(let i of e.get(r)||[]){let e=n===void 0||isNaN(n),a=t===void 0||isNaN(t),o=!1;if(o=a?r===n:(e?isNaN(r):r===n)&&i===t,o)return!0}return!1},n=(t,n)=>{let r=n||NaN,i=t||NaN;e.has(r)?e.get(r)?.add(i):e.set(r,new Set([i]))},r=()=>Array.from(e.values()).flatMap(e=>Array.from(e)),i=e.size,a=r();return{items:e,has:t,set:n,getMin:()=>Math.min(...a),getMax:()=>Math.max(...a),seasonsCount:i,episodesCount:a.length}};new Intl.DateTimeFormat(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}),new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});const M=new class e extends v{static requestEventName=`form`;static responseEventName=`form:response`;title;#e=Promise.resolve();constructor(e={}){super(),this.title=e.title,this.listen(async e=>{let t=he({input:de,output:fe}),{title:n,description:r,fields:i,...a}=e,o={};for(let[e,{label:s,type:c}]of Object.entries(i||a)){let i=c===`confirm`,a=[n,r,s].filter(Boolean).join(`. `)+(i?` (y/n)`:``)+`: `;o[e]=await Promise.race([t.question(a),d(Ae,``)])}return t.close(),o})}async ask(t){let n=()=>new Promise(n=>{this.once(e.responseEventName,e=>{n(e)}),this.emit(e.requestEventName,t)}),r=this.#e.then(n,n);return this.#e=r.then(()=>void 0,()=>void 0),r}listen(t){this.addListener(e.requestEventName,async n=>{let r=await t(n);this.emit(e.responseEventName,r)})}},ke=async(e,t)=>{let n=t?.fields??{answer:{label:e}};return await M.ask({title:t?.title,description:e,fields:n})},Ae=12e4;var N=class extends Error{response;request;options;constructor(e,t,n){let r=`${e.status||e.status===0?e.status:``} ${e.statusText??``}`.trim(),i=r?`status code ${r}`:`an unknown error`;super(`Request failed with ${i}: ${t.method} ${t.url}`),this.name=`HTTPError`,this.response=e,this.request=t,this.options=n}},je=class extends Error{name=`NonError`;value;constructor(e){let t=`Non-error value was thrown`;try{typeof e==`string`?t=e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`&&(t=e.message)}catch{}super(t),this.value=e}},P=class extends Error{name=`ForceRetryError`;customDelay;code;customRequest;constructor(e){let t=e?.cause?e.cause instanceof Error?e.cause:new je(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:`Forced retry`,t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}};const Me=(()=>{let e=!1,t=!1,n=typeof globalThis.ReadableStream==`function`,r=typeof globalThis.Request==`function`;if(n&&r)try{t=new globalThis.Request(`https://empty.invalid`,{body:new globalThis.ReadableStream,method:`POST`,get duplex(){return e=!0,`half`}}).headers.has(`Content-Type`)}catch(e){if(e instanceof Error&&e.message===`unsupported BodyInit type`)return!1;throw e}return e&&!t})(),Ne=typeof globalThis.AbortController==`function`,Pe=typeof globalThis.AbortSignal==`function`&&typeof globalThis.AbortSignal.any==`function`,Fe=typeof globalThis.ReadableStream==`function`,Ie=typeof globalThis.FormData==`function`,Le=[`get`,`post`,`put`,`patch`,`head`,`delete`],Re={json:`application/json`,text:`text/*`,formData:`multipart/form-data`,arrayBuffer:`*/*`,blob:`*/*`,bytes:`*/*`},F=2147483647,ze=new TextEncoder().encode(`------WebKitFormBoundaryaxpyiPgbbPti10Rw`).length,Be=Symbol(`stop`);var Ve=class{options;constructor(e){this.options=e}};const He=e=>new Ve(e),Ue={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},We={next:!0},Ge={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},Ke=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[n,r]of e)t+=ze,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${n}"`).length,t+=typeof r==`string`?new TextEncoder().encode(r).length:r.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e==`string`)return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if(`byteLength`in e)return e.byteLength;if(typeof e==`object`&&e)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},I=(e,t,n)=>{let r,i=0;return e.pipeThrough(new TransformStream({transform(e,a){if(a.enqueue(e),r){i+=r.byteLength;let e=t===0?0:i/t;e>=1&&(e=1-2**-52),n?.({percent:e,totalBytes:Math.max(t,i),transferredBytes:i},r)}r=e},flush(){r&&(i+=r.byteLength,n?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},r))}}))},qe=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let n=Math.max(0,Number(e.headers.get(`content-length`))||0);return new Response(I(e.body,n,t),{status:e.status,statusText:e.statusText,headers:e.headers})},Je=(e,t,n)=>{if(!e.body)return e;let r=Ke(n??e.body);return new Request(e,{duplex:`half`,body:I(e.body,r,t)})},L=e=>typeof e==`object`&&!!e,R=(...e)=>{for(let t of e)if((!L(t)||Array.isArray(t))&&t!==void 0)throw TypeError("The `options` argument must be an object");return H({},...e)},z=(e={},t={})=>{let n=new globalThis.Headers(e),r=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[e,t]of i.entries())r&&t===`undefined`||t===void 0?n.delete(e):n.set(e,t);return n};function B(e,t,n){return Object.hasOwn(t,n)&&t[n]===void 0?[]:H(e[n]??[],t[n]??[])}const V=(e={},t={})=>({beforeRequest:B(e,t,`beforeRequest`),beforeRetry:B(e,t,`beforeRetry`),afterResponse:B(e,t,`afterResponse`),beforeError:B(e,t,`beforeError`)}),Ye=(e,t)=>{let n=new URLSearchParams;for(let r of[e,t])if(r!==void 0)if(r instanceof URLSearchParams)for(let[e,t]of r.entries())n.append(e,t);else if(Array.isArray(r))for(let e of r){if(!Array.isArray(e)||e.length!==2)throw TypeError(`Array search parameters must be provided in [[key, value], ...] format`);n.append(String(e[0]),String(e[1]))}else if(L(r))for(let[e,t]of Object.entries(r))t!==void 0&&n.append(e,String(t));else{let e=new URLSearchParams(r);for(let[t,r]of e.entries())n.append(t,r)}return n},H=(...e)=>{let t={},n={},r={},i,a=[];for(let o of e)if(Array.isArray(o))Array.isArray(t)||(t=[]),t=[...t,...o];else if(L(o)){for(let[e,n]of Object.entries(o)){if(e===`signal`&&n instanceof globalThis.AbortSignal){a.push(n);continue}if(e===`context`){if(n!=null&&(!L(n)||Array.isArray(n)))throw TypeError("The `context` option must be an object");t={...t,context:n==null?{}:{...t.context,...n}};continue}if(e===`searchParams`){i=n==null?void 0:i===void 0?n:Ye(i,n);continue}L(n)&&e in t&&(n=H(t[e],n)),t={...t,[e]:n}}L(o.hooks)&&(r=V(r,o.hooks),t.hooks=r),L(o.headers)&&(n=z(n,o.headers),t.headers=n)}return i!==void 0&&(t.searchParams=i),a.length>0&&(a.length===1?t.signal=a[0]:Pe?t.signal=AbortSignal.any(a):t.signal=a.at(-1)),t},Xe=e=>Le.includes(e)?e.toUpperCase():e,U={limit:2,methods:[`get`,`put`,`head`,`delete`,`options`,`trace`],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:1/0,backoffLimit:1/0,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},Ze=(e={})=>{if(typeof e==`number`)return{...U,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error(`retry.methods must be an array`);if(e.methods&&=e.methods.map(e=>e.toLowerCase()),e.statusCodes&&!Array.isArray(e.statusCodes))throw Error(`retry.statusCodes must be an array`);let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0));return{...U,...t}};var W=class extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name=`TimeoutError`,this.request=e}};async function Qe(e,t,n,r){return new Promise((i,a)=>{let o=setTimeout(()=>{n&&n.abort(),a(new W(e))},r.timeout);r.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function $e(e,{signal:t}){return new Promise((n,r)=>{t&&(t.throwIfAborted(),t.addEventListener(`abort`,i,{once:!0}));function i(){clearTimeout(a),r(t.reason)}let a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e)})}const et=(e,t)=>{let n={};for(let r in t)Object.hasOwn(t,r)&&!(r in Ge)&&!(r in Ue)&&(!(r in e)||r in We)&&(n[r]=t[r]);return n},tt=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e==`object`?Object.keys(e).length>0:typeof e==`string`?e.trim().length>0:!!e;function nt(e){return e instanceof N||e?.name===N.name}function rt(e){return e instanceof W||e?.name===W.name}var it=class e{static create(t,n){let r=new e(t,n),i=r.#p(async()=>{if(typeof r.#i.timeout==`number`&&r.#i.timeout>F)throw RangeError(`The \`timeout\` option cannot be greater than ${F}`);await Promise.resolve();let e=await r.#m();for(let t of r.#i.hooks.afterResponse){let n=r.#u(e.clone()),i;try{i=await t(r.request,r.#h(),n,{retryCount:r.#n})}catch(t){throw r.#f(n),r.#f(e),t}if(i instanceof Ve)throw r.#f(n),r.#f(e),new P(i.options);let a=i instanceof globalThis.Response?i:e;n!==a&&r.#f(n),e!==a&&r.#f(e),e=a}if(r.#u(e),!e.ok&&(typeof r.#i.throwHttpErrors==`function`?r.#i.throwHttpErrors(e.status):r.#i.throwHttpErrors)){let t=new N(e,r.request,r.#h());for(let e of r.#i.hooks.beforeError)t=await e(t,{retryCount:r.#n});throw t}if(r.#i.onDownloadProgress){if(typeof r.#i.onDownloadProgress!=`function`)throw TypeError("The `onDownloadProgress` option must be a function");if(!Fe)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let t=e.clone();return r.#f(e),qe(t,r.#i.onDownloadProgress)}return e}).finally(()=>{let e=r.#a;r.#d(e?.body??void 0),r.#d(r.request.body??void 0)});for(let[e,t]of Object.entries(Re))e===`bytes`&&typeof globalThis.Response?.prototype?.bytes!=`function`||(i[e]=async()=>{r.request.headers.set(`accept`,r.request.headers.get(`accept`)||t);let a=await i;if(e===`json`){if(a.status===204)return``;let e=await a.text();return e===``?``:n.parseJson?n.parseJson(e):JSON.parse(e)}return a[e]()});return i}static#e(e){return e&&typeof e==`object`&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)):e}request;#t;#n=0;#r;#i;#a;#o;#s;constructor(t,n={}){if(this.#r=t,this.#i={...n,headers:z(this.#r.headers,n.headers),hooks:V({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:Xe(n.method??this.#r.method??`GET`),prefixUrl:String(n.prefixUrl||``),retry:Ze(n.retry),throwHttpErrors:n.throwHttpErrors??!0,timeout:n.timeout??1e4,fetch:n.fetch??globalThis.fetch.bind(globalThis),context:n.context??{}},typeof this.#r!=`string`&&!(this.#r instanceof URL||this.#r instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(this.#i.prefixUrl&&typeof this.#r==`string`){if(this.#r.startsWith(`/`))throw Error("`input` must not begin with a slash when using `prefixUrl`");this.#i.prefixUrl.endsWith(`/`)||(this.#i.prefixUrl+=`/`),this.#r=this.#i.prefixUrl+this.#r}Ne&&Pe&&(this.#o=this.#i.signal??this.#r.signal,this.#t=new globalThis.AbortController,this.#i.signal=this.#o?AbortSignal.any([this.#o,this.#t.signal]):this.#t.signal),Me&&(this.#i.duplex=`half`),this.#i.json!==void 0&&(this.#i.body=this.#i.stringifyJson?.(this.#i.json)??JSON.stringify(this.#i.json),this.#i.headers.set(`content-type`,this.#i.headers.get(`content-type`)??`application/json`));let r=n.headers&&new globalThis.Headers(n.headers).has(`content-type`);if(this.#r instanceof globalThis.Request&&(Ie&&this.#i.body instanceof globalThis.FormData||this.#i.body instanceof URLSearchParams)&&!r&&this.#i.headers.delete(`content-type`),this.request=new globalThis.Request(this.#r,this.#i),tt(this.#i.searchParams)){let t=`?`+(typeof this.#i.searchParams==`string`?this.#i.searchParams.replace(/^\?/,``):new URLSearchParams(e.#e(this.#i.searchParams)).toString()),n=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,t);this.request=new globalThis.Request(n,this.#i)}if(this.#i.onUploadProgress){if(typeof this.#i.onUploadProgress!=`function`)throw TypeError("The `onUploadProgress` option must be a function");if(!Me)throw Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#_(this.request,this.#i.body??void 0)}}#c(){let e=this.#i.retry.delay(this.#n),t=e;this.#i.retry.jitter===!0?t=Math.random()*e:typeof this.#i.retry.jitter==`function`&&(t=this.#i.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e));let n=this.#i.retry.backoffLimit??1/0;return Math.min(n,t)}async#l(e){if(this.#n++,this.#n>this.#i.retry.limit)throw e;let t=e instanceof Error?e:new je(e);if(t instanceof P)return t.customDelay??this.#c();if(!this.#i.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#i.retry.shouldRetry!==void 0){let n=await this.#i.retry.shouldRetry({error:t,retryCount:this.#n});if(n===!1)throw e;if(n===!0)return this.#c()}if(rt(e)&&!this.#i.retry.retryOnTimeout)throw e;if(nt(e)){if(!this.#i.retry.statusCodes.includes(e.response.status))throw e;let t=e.response.headers.get(`Retry-After`)??e.response.headers.get(`RateLimit-Reset`)??e.response.headers.get(`X-RateLimit-Retry-After`)??e.response.headers.get(`X-RateLimit-Reset`)??e.response.headers.get(`X-Rate-Limit-Reset`);if(t&&this.#i.retry.afterStatusCodes.includes(e.response.status)){let e=Number(t)*1e3;Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse(`2024-01-01`)&&(e-=Date.now());let n=this.#i.retry.maxRetryAfter??e;return e<n?e:n}if(e.response.status===413)throw e}return this.#c()}#u(e){return this.#i.parseJson&&(e.json=async()=>this.#i.parseJson(await e.text())),e}#d(e){e&&e.cancel().catch(()=>void 0)}#f(e){this.#d(e.body??void 0)}async#p(e){try{return await e()}catch(t){let n=Math.min(await this.#l(t),F);if(this.#n<1)throw t;if(await $e(n,this.#o?{signal:this.#o}:{}),t instanceof P&&t.customRequest){let e=this.#i.signal?new globalThis.Request(t.customRequest,{signal:this.#i.signal}):new globalThis.Request(t.customRequest);this.#g(e)}for(let e of this.#i.hooks.beforeRetry){let n=await e({request:this.request,options:this.#h(),error:t,retryCount:this.#n});if(n instanceof globalThis.Request){this.#g(n);break}if(n instanceof globalThis.Response)return n;if(n===Be)return}return this.#p(e)}}async#m(){this.#t?.signal.aborted&&(this.#t=new globalThis.AbortController,this.#i.signal=this.#o?AbortSignal.any([this.#o,this.#t.signal]):this.#t.signal,this.request=new globalThis.Request(this.request,{signal:this.#i.signal}));for(let e of this.#i.hooks.beforeRequest){let t=await e(this.request,this.#h(),{retryCount:this.#n});if(t instanceof Response)return t;if(t instanceof globalThis.Request){this.#g(t);break}}let e=et(this.request,this.#i);return this.#a=this.request,this.request=this.#a.clone(),this.#i.timeout===!1?this.#i.fetch(this.#a,e):Qe(this.#a,e,this.#t,this.#i)}#h(){if(!this.#s){let{hooks:e,...t}=this.#i;this.#s=Object.freeze(t)}return this.#s}#g(e){this.#s=void 0,this.request=this.#_(e)}#_(e,t){return!this.#i.onUploadProgress||!e.body?e:Je(e,this.#i.onUploadProgress,t??this.#i.body??void 0)}};
|
|
2
|
+
/*! MIT License © Sindre Sorhus */
|
|
3
|
+
const G=e=>{let t=(t,n)=>it.create(t,R(e,n));for(let n of Le)t[n]=(t,r)=>it.create(t,R(e,r,{method:n}));return t.create=e=>G(R(e)),t.extend=t=>(typeof t==`function`&&(t=t(e??{})),G(R(e,t))),t.stop=Be,t.retry=He,t},at=G();var ot=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.stringifySetCookie=s,e.serialize=s,e.parseSetCookie=c,e.stringifySetCookie=s,e.serialize=s;let t=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,n=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,i=/^[\u0020-\u003A\u003D-\u007E]*$/,a=/^-?\d+$/,o=Object.prototype.toString;function s(e,a,o){let s=typeof e==`object`?e:{...o,name:e,value:String(a)},c=(typeof a==`object`?a:o)?.encode||encodeURIComponent;if(!t.test(s.name))throw TypeError(`argument name is invalid: ${s.name}`);let l=s.value?c(s.value):``;if(!n.test(l))throw TypeError(`argument val is invalid: ${s.value}`);let u=s.name+`=`+l;if(s.maxAge!==void 0){if(!Number.isInteger(s.maxAge))throw TypeError(`option maxAge is invalid: ${s.maxAge}`);u+=`; Max-Age=`+s.maxAge}if(s.domain){if(!r.test(s.domain))throw TypeError(`option domain is invalid: ${s.domain}`);u+=`; Domain=`+s.domain}if(s.path){if(!i.test(s.path))throw TypeError(`option path is invalid: ${s.path}`);u+=`; Path=`+s.path}if(s.expires){if(!ee(s.expires)||!Number.isFinite(s.expires.valueOf()))throw TypeError(`option expires is invalid: ${s.expires}`);u+=`; Expires=`+s.expires.toUTCString()}if(s.httpOnly&&(u+=`; HttpOnly`),s.secure&&(u+=`; Secure`),s.partitioned&&(u+=`; Partitioned`),s.priority)switch(typeof s.priority==`string`?s.priority.toLowerCase():void 0){case`low`:u+=`; Priority=Low`;break;case`medium`:u+=`; Priority=Medium`;break;case`high`:u+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid: ${s.priority}`)}if(s.sameSite)switch(typeof s.sameSite==`string`?s.sameSite.toLowerCase():s.sameSite){case!0:case`strict`:u+=`; SameSite=Strict`;break;case`lax`:u+=`; SameSite=Lax`;break;case`none`:u+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid: ${s.sameSite}`)}return u}function c(e,t){let n=t?.decode||f,r=e.length,i=l(e,0,r),o=u(e,0,i),s=o===-1?{name:``,value:n(d(e,0,i))}:{name:d(e,0,o),value:n(d(e,o+1,i))},c=i+1;for(;c<r;){let t=l(e,c,r),n=u(e,c,t),i=n===-1?d(e,c,t):d(e,c,n),o=n===-1?void 0:d(e,n+1,t);switch(i.toLowerCase()){case`httponly`:s.httpOnly=!0;break;case`secure`:s.secure=!0;break;case`partitioned`:s.partitioned=!0;break;case`domain`:s.domain=o;break;case`path`:s.path=o;break;case`max-age`:o&&a.test(o)&&(s.maxAge=Number(o));break;case`expires`:if(!o)break;let e=new Date(o);Number.isFinite(e.valueOf())&&(s.expires=e);break;case`priority`:if(!o)break;let t=o.toLowerCase();(t===`low`||t===`medium`||t===`high`)&&(s.priority=t);break;case`samesite`:if(!o)break;let n=o.toLowerCase();(n===`lax`||n===`strict`||n===`none`)&&(s.sameSite=n);break}c=t+1}return s}function l(e,t,n){let r=e.indexOf(`;`,t);return r===-1?n:r}function u(e,t,n){let r=e.indexOf(`=`,t);return r<n?r:-1}function d(e,t,n){let r=t,i=n;do{let t=e.charCodeAt(r);if(t!==32&&t!==9)break}while(++r<i);for(;i>r;){let t=e.charCodeAt(i-1);if(t!==32&&t!==9)break;i--}return e.slice(r,i)}function f(e){if(e.indexOf(`%`)===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function ee(e){return o.call(e)===`[object Date]`}}))();const K=e=>{let t=[];for(let n of e)try{let e=(0,ot.parseSetCookie)(n),r={...e,expires:e.expires instanceof Date?e.expires.getTime():e.expires,sameSite:typeof e.sameSite==`boolean`?`strict`:e.sameSite};t.push(r)}catch(e){A.debug(e)}return t},st=async e=>{let t=await m(e,`utf8`).catch(()=>``);if(!t)return[];let n=t.split(c).flatMap(e=>e.split(`
|
|
4
|
+
`)).filter(e=>!!e.trim()&&!e.startsWith(`# `)).map(e=>e.split(` `)),r=[];for(let e of n){let[t,n,i,a,o,s,c]=e;r.push({name:s,value:c,expires:Number(o),maxAge:void 0,domain:t.replace(`#HttpOnly_`,``),path:i,secure:a===`TRUE`,httpOnly:void 0,sameSite:void 0})}return r};var ct=class{#e={};#t;#n;#r=!1;static parse(e){return K(e)}constructor({storagePath:e}={}){this.#n=e,this.#t=[]}async import(e){(await g(e).catch(()=>null))?.isFile()&&(this.#t=await st(e),await h(e,{recursive:!0,force:!0}))}async#i(){if(!(!this.#n||this.#r)){if((await g(this.#n).catch(()=>null))?.isFile()){let e=await m(this.#n,`utf8`);this.#e=e?JSON.parse(e):{},this.#t=`cookies`in this.#e?this.#e.cookies:[]}this.#r=!0}}async#a(){if(!this.#n)return;let e=JSON.stringify({...this.#e,cookies:this.#t},null,2);await _(this.#n,e,`utf8`)}async get(e){await this.#i();let t=typeof e==`string`?e:e.name;return this.#t.find(e=>e.name===t)??null}async getAll(e){if(await this.#i(),!e)return this.#t;let t=typeof e==`string`?e:e.name;return this.#t.filter(e=>e.name===t)??null}async set(e){await this.#i(),this.#t=this.#t.filter(t=>!(t.name===e.name&&t.domain===e.domain)),this.#t.push(e),await this.#a()}async delete(e){if(await this.#i(),!e)this.#t=[];else{let t=typeof e==`string`?e:e.name;this.#t=this.#t.filter(e=>e.name!==t)}await this.#a()}toString(){return this.#t.map(e=>`${e.name}=${e.value}`).join(`; `)}};const lt=at.default??at,ut=e=>e?e instanceof Headers?e.has(`User-Agent`):typeof e==`object`&&e?`User-Agent`in e||`user-agent`in e:!1:!1,dt=e=>e instanceof URL?e:e instanceof Request?new URL(e.url):new URL(e);var ft=class{cookieStore;headers;#e;#t;constructor(e={}){this.headers=new Headers,this.configure(e)}configure({maxRetries:e=3,proxyUrl:t,allowH2:n=!0,cookieStore:r}={}){this.cookieStore=r??this.cookieStore??new ct;let i=t?new ve({uri:t,allowH2:n}):new _e({allowH2:n}),a={retry:e};this.#e=lt.create({dispatcher:i,proxy:t,...a});let o=new ge({browser:`chrome`,proxyUrl:t,ignoreTlsErrors:!0,followRedirects:!0});this.#t=lt.create({fetch:o.fetch.bind(o),...a})}async fetch(e,t={}){let n=this.appendHeaders(t?.headers),r=await this.cookieStore.getAll(),i=r.filter(t=>!t.domain||dt(e).hostname.includes(t.domain));for(let e of r)i.find(t=>t.name===e.name)||e.domain||i.push(e);let a=i.map(e=>`${e.name}=${e.value}`).join(`; `);n.has(`cookie`)?n.get(`cookie`)||n.delete(`cookie`):n.set(`cookie`,a);let o=(ut(t?.headers)?this.#e:this.#t)[t?.method?.toLowerCase()??`get`],s=await o(e,{...t,headers:n}),c=s.headers.getSetCookie();return c&&await this.setCookies(c),s}async setCookies(e){let t=[];if(typeof e==`string`){let[n]=K([e]);n&&t.push(n)}else if(Array.isArray(e)&&typeof e.at(0)==`string`){let n=K(e);t.push(...n)}else Array.isArray(e)&&typeof e[0]!=`string`&&t.push(...e);if(!(!t||!t?.length))for(let e of t)await this.cookieStore.set(e)}appendHeaders(e){let t=new Headers(this.headers);for(let[n,r]of Object.entries(e??{}))t.set(n,r);return t}setHeader(e,t){this.headers.set(e,t)}removeHeader(e){this.headers.delete(e)}};new ft;const{COMMON_CONTEXT:pt}=y,mt=(e,t=`Eval`,n)=>{try{return y.createScript(t,e,n)}catch(t){return console.debug(t),console.debug(e),console.error(`Syntax Error: ${t.message}`),null}},ht=(e,t=1)=>{if(Array.isArray(e)||typeof e==`string`){let n=[];for(let r=1;r<=t;r++)n.push(e[Math.floor(Math.random()*e.length)]);return n}else return[]},gt=e=>new(`default`in b?b.default:b)(e);var _t=class{#e;constructor(e){this.#e=gt({cwd:a(e),configName:i(e,`.json`)})}get length(){return Object.keys(this.#e.store).length}clear(){this.#e.clear()}getItem(e){return this.#e.get(e)??null}key(e){return Object.keys(this.#e.store).at(e)??null}removeItem(e){this.#e.delete(e)}setItem(e,t){this.#e.set(e,t)}};const vt=new me,q=e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return t===`ExitPromptError`||t===`AbortPromptError`},yt=e=>e[0].toUpperCase()+e.slice(1),J=(e,t=!1)=>{if(typeof e==`boolean`)return e;if(typeof e!=`string`)return t;let n=e.trim().toLowerCase();return[`1`,`true`,`yes`,`y`,`on`].includes(n)?!0:[`0`,`false`,`no`,`n`,`off`].includes(n)?!1:t},Y=(e,t=0)=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`)return t;let n=Number(e);return Number.isFinite(n)?n:t},bt=e=>{switch(e.type){case`checkbox`:return J(e.defaultValue,!1);case`number`:return Y(e.defaultValue,0);default:return e.defaultValue??``}},xt=(e,t)=>{switch(e.type){case`checkbox`:return J(t,J(e.defaultValue,!1));case`number`:return Y(t,Y(e.defaultValue,0));default:return typeof t==`string`?t:t==null?e.defaultValue??``:String(t)}},St=e=>{let t=Object.entries(e).map(([e,t])=>[e,bt(t)]);return Object.fromEntries(t)},X=(e,t)=>{let n=Object.entries(e).map(([e,n])=>[e,xt(n,t[e])]);return Object.fromEntries(n)},Z=async e=>{e?.onAction&&await e.onAction()},Q=async(e,t)=>{if(!t.length)return`dismiss`;try{return await p({message:e,loop:!1,choices:t.map(e=>({name:e.action.title,value:e.kind}))})}catch(e){if(q(e))return`dismiss`;throw e}},$=()=>{switch(s.type()){case`Darwin`:return`macOS`;case`Windows_NT`:return`Windows`;default:return`Linux`}};Object.defineProperties(Uint8Array.prototype,{toBase64:{value:function(){return Buffer.from(this).toString(`base64`)},writable:!0,configurable:!0},toHex:{value:function(){return Buffer.from(this).toString(`hex`)},writable:!0,configurable:!0}}),Object.defineProperties(Uint8Array,{fromBase64:{value:function(e){return new Uint8Array(Buffer.from(e,`base64`))},writable:!0,configurable:!0},fromHex:{value:function(e){return new Uint8Array(Buffer.from(e,`hex`))},writable:!0,configurable:!0}});const Ct=new Map([[24,[`Sequoia`,`15`]],[23,[`Sonoma`,`14`]],[22,[`Ventura`,`13`]],[21,[`Monterey`,`12`]],[20,[`Big Sur`,`11`]],[19,[`Catalina`,`10.15`]],[18,[`Mojave`,`10.14`]],[17,[`High Sierra`,`10.13`]],[16,[`Sierra`,`10.12`]],[15,[`El Capitan`,`10.11`]],[14,[`Yosemite`,`10.10`]],[13,[`Mavericks`,`10.9`]],[12,[`Mountain Lion`,`10.8`]],[11,[`Lion`,`10.7`]],[10,[`Snow Leopard`,`10.6`]],[9,[`Leopard`,`10.5`]],[8,[`Tiger`,`10.4`]],[7,[`Panther`,`10.3`]],[6,[`Jaguar`,`10.2`]],[5,[`Puma`,`10.1`]]]),wt=()=>{let e=Number(s.release().split(`.`)[0]),[t,n]=Ct.get(e)||[`Unknown`,``];return{name:t,version:n}},Tt=()=>{switch($()){case`macOS`:return wt().version;case`Windows`:return s.release();case`Linux`:return s.release()}},Et=()=>{let e=[{brand:`Azot`,version:C.version.split(`.`).slice(0,2).join(`.`)},{brand:`Node.js`,version:process.version.replace(`v`,``).split(`.`).slice(0,1).join(`.`)}];return{mobile:!1,platform:$(),brands:e,getHighEntropyValues:async t=>{let n={mobile:!1,platform:$(),brands:e};return t.includes(`architecture`)&&(n.architecture=s.arch()),t.includes(`platform`)&&(n.platform=$()),t.includes(`platformVersion`)&&(n.platformVersion=Tt()),t.includes(`fullVersionList`)&&(n.fullVersionList=[{brand:`Azot`,version:C.version},{brand:`Node.js`,version:process.version}]),n}}},Dt=({name:e=`extension`,dir:t=process.cwd(),title:n}={})=>{let r=T(o(t,e)),i=new _t(o(r,`storage.json`)),a=new ct({storagePath:o(r,`cookies.json`)}),s=new ft({cookieStore:a}),c=(e,t,n)=>e.split(t)[1]?.split(n)[0]?.trim(),l={sanitizeString:De,execUrlPatterns:Oe,extendEpisodes:j,between:c,getRandomElements:ht},u=n?yt(n):void 0,p=e=>e||u,m=async e=>(e.title||=u,await M.ask(e)),h={defineExtension:e=>e,version:C.version,sleep:d,sanitizeString:De,execUrlPatterns:Oe,extendEpisodes:j,between:c,getRandomElements:ht,utils:l,prompt:m,input:ke,notify:async(e,t={})=>{let n=p(t.title)??`Azot`,r=[t.primaryAction?{kind:`primary`,action:t.primaryAction}:null,t.secondaryAction?{kind:`secondary`,action:t.secondaryAction}:null].filter(Boolean);{if(A.info(`[Extension notification] ${n}: ${e}`),!r.length)return;let i=await Q(e,r);i===`primary`&&await Z(t.primaryAction),i===`secondary`&&await Z(t.secondaryAction);return}let i=(await Ee.ask({variant:`notify`,title:n,message:e,style:t.style,primaryAction:t.primaryAction?{title:t.primaryAction.title,style:t.primaryAction.style}:void 0,secondaryAction:t.secondaryAction?{title:t.secondaryAction.title,style:t.secondaryAction.style}:void 0})).action??`dismiss`;i===`primary`&&await Z(t.primaryAction),i===`secondary`&&await Z(t.secondaryAction)},confirm:async(e,t={})=>{let n=p(t.title)??`Azot`,r=!!t.primaryAction||!!t.secondaryAction,i=t.primaryAction??{title:`OK`},a=t.secondaryAction??{title:`Cancel`,style:`cancel`};if(r){let t=await Q(e,[{kind:`primary`,action:i},{kind:`secondary`,action:a}]);return t===`primary`?(await Z(i),!0):(t===`secondary`&&await Z(a),!1)}try{let n=await f({message:e,default:!0});return n?await Z(t.primaryAction):await Z(t.secondaryAction),n}catch(e){if(q(e))return!1;throw e}let o=await Ee.ask({variant:`confirm`,title:n,message:e,style:t.style,primaryAction:{title:i.title,style:i.style},secondaryAction:{title:a.title,style:a.style}}),s=o.action===`primary`;return s?await Z(i):o.action===`secondary`&&await Z(a),s},ask:async(e,t)=>{let n=St(t.form),r=Object.entries(t.form),i=!!t.primaryAction||!!t.secondaryAction,a=t.primaryAction??{title:`Submit`},o=t.secondaryAction??{title:`Cancel`,style:`cancel`};{let s={};try{for(let[e,t]of r){let n=[t.title||e,t.description].filter(Boolean).join(` - `);if(t.type===`checkbox`){s[e]=await f({message:n,default:J(t.defaultValue,!1)});continue}if(t.type===`number`){let r=Y(t.defaultValue,NaN);s[e]=await te({message:n,default:Number.isFinite(r)?r:void 0,validate:e=>(e===void 0||Number.isNaN(e))&&t.required?`This field is required`:!0});continue}if(t.type===`password`){s[e]=await ne({message:n,validate:t.required?e=>String(e??``).trim()?!0:`This field is required`:void 0});continue}s[e]=await ee({message:n,default:t.defaultValue,validate:t.required?e=>String(e??``).trim()?!0:`This field is required`:void 0})}}catch(e){if(q(e))return n;throw e}if(!i)return X(t.form,s);let c=await Q(e,[{kind:`primary`,action:a},{kind:`secondary`,action:o}]);return c===`primary`?(await Z(a),X(t.form,s)):(c===`secondary`&&await Z(o),n)}let s=Object.fromEntries(r.map(([e,t])=>[e,{type:t.type,label:t.title||e,description:t.description,placeholder:t.placeholder,defaultValue:t.defaultValue,value:t.defaultValue,required:t.required,autoFocus:t.autoFocus}])),c=await m({title:p(t.title),description:e,fields:s,actions:i?{primaryAction:{title:a.title,style:a.style},secondaryAction:{title:o.title,style:o.style}}:void 0}),l=c.__action??`primary`,u={...c};return delete u.__action,l===`primary`?(await Z(t.primaryAction),X(t.form,u)):(l===`secondary`&&await Z(t.secondaryAction),n)}};class g{get cookie(){return a.toString()}}let _={fetch:s.fetch.bind(s),Response,Request,Headers,AbortController,AbortSignal,URL,URLSearchParams,URLPattern,Blob,structuredClone,btoa,atob,TextEncoder,TextDecoder,Uint8Array,crypto,console:{log:console.log,info:A.info.bind(A),warn:A.warn.bind(A),error:(...e)=>{let t=String(e[0]??`Unknown error`);vt.emit(`error`,{message:t}),A.error(t)},trace:A.trace.bind(A),debug:A.debug.bind(A)},Event,EventTarget,localStorage:i,cookieStore:a,document:new g,eval:e=>mt(e)?.exports,navigator:{appName:`Azot`,appVersion:C.version,platform:process.platform,userAgent:`Azot/${C.version}`,userAgentData:Et()}};return{http:s,question:M,common:l,Streamyx:h,Azot:h,window:_,..._}};export{Dt as t};
|
package/dist/context.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./context-BdQ_7L4n.cjs`);exports.createContext=e.t;
|
package/dist/context.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./context-vs4jQyij.mjs";export{e as createContext};
|
package/dist/main.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=Azot??Streamyx??{};e&&(!e.input&&e.prompt&&(e.input=async(t,n)=>{let r=n?.fields??{answer:{label:t}};return await e.prompt({title:n?.title,description:n?.description,fields:r})}),e.defineExtension||=e=>e);const t=e.defineExtension,n=e.version,r=e.sleep,i=e.input,a=e.prompt,o=e.notify,s=e.confirm,c=e.ask,l=e.utils;exports.ask=c,exports.confirm=s,exports.default=e,exports.defineExtension=t,exports.input=i,exports.notify=o,exports.prompt=a,exports.sleep=r,exports.utils=l,exports.version=n;
|
package/dist/main.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=Azot??Streamyx??{};e&&(!e.input&&e.prompt&&(e.input=async(t,n)=>{let r=n?.fields??{answer:{label:t}};return await e.prompt({title:n?.title,description:n?.description,fields:r})}),e.defineExtension||=e=>e);const t=e.defineExtension,n=e.version,r=e.sleep,i=e.input,a=e.prompt,o=e.notify,s=e.confirm,c=e.ask,l=e.utils;export{c as ask,s as confirm,e as default,t as defineExtension,i as input,o as notify,a as prompt,r as sleep,l as utils,n as version};
|
package/dist/vitest.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-350yNsax.cjs`);const e=require(`./context-BdQ_7L4n.cjs`);require(`./context.cjs`);let t=require(`vitest`);t.vi.mock(`azot`,()=>{let n=e.t();return Object.entries(n).forEach(([e,n])=>{t.vi.stubGlobal(e,n)}),n.Azot});
|
package/dist/vitest.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./context-vs4jQyij.mjs";import"./context.mjs";import{vi as t}from"vitest";t.mock(`azot`,()=>{let n=e();return Object.entries(n).forEach(([e,n])=>{t.stubGlobal(e,n)}),n.Azot});export{};
|
package/package.json
CHANGED
|
@@ -1,71 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "5.0.0-alpha.10",
|
|
4
4
|
"description": "Build extensions for Azot with Node.js",
|
|
5
|
-
"homepage": "https://developers.azot.so",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"bin": {
|
|
8
|
-
"azt": "./bin/cli.js"
|
|
9
|
-
},
|
|
10
|
-
"types": "index.d.ts",
|
|
11
|
-
"files": [
|
|
12
|
-
"index.d.ts",
|
|
13
|
-
"bin",
|
|
14
|
-
"dist",
|
|
15
|
-
"types",
|
|
16
|
-
"public.pem"
|
|
17
|
-
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"dev": "tsdown ./lib/cli.js --target node22 --format cjs --watch --out-dir ./bin",
|
|
20
|
-
"build:cli": "tsdown ./lib/cli.js --target node22 --format cjs --minify --out-dir ./bin",
|
|
21
|
-
"build:lib": "tsdown index.js --target node22 --format cjs --minify",
|
|
22
|
-
"build": "npm run build:cli && npm run build:lib",
|
|
23
|
-
"lint": "eslint . && prettier --check .",
|
|
24
|
-
"fix": "eslint . --fix && prettier --write ."
|
|
25
|
-
},
|
|
26
|
-
"repository": {
|
|
27
|
-
"type": "git",
|
|
28
|
-
"url": "git+https://github.com/azot-labs/extensions.git"
|
|
29
|
-
},
|
|
30
5
|
"keywords": [
|
|
6
|
+
"api",
|
|
31
7
|
"azot",
|
|
32
8
|
"extensions",
|
|
33
|
-
"types"
|
|
34
|
-
"api"
|
|
9
|
+
"types"
|
|
35
10
|
],
|
|
36
|
-
"
|
|
37
|
-
"url": "https://github.com/azot-labs/extensions/issues",
|
|
38
|
-
"email": "vitalygashkov@vk.com"
|
|
39
|
-
},
|
|
40
|
-
"author": "Vitaly Gashkov <vitalygashkov@vk.com>",
|
|
11
|
+
"homepage": "https://azot.mov/docs",
|
|
41
12
|
"license": "MIT",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
13
|
+
"author": "Vitaly Gashkov <vitalygashkov@vk.com>",
|
|
14
|
+
"bin": {
|
|
15
|
+
"azt": "./dist/azt.cjs"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"types"
|
|
20
|
+
],
|
|
21
|
+
"main": "./dist/main.cjs",
|
|
22
|
+
"types": "./types/main.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./types/main.d.ts",
|
|
26
|
+
"import": "./dist/main.mjs",
|
|
27
|
+
"require": "./dist/main.cjs"
|
|
47
28
|
},
|
|
48
|
-
{
|
|
49
|
-
"
|
|
50
|
-
"
|
|
29
|
+
"./context": {
|
|
30
|
+
"types": "./types/context.d.ts",
|
|
31
|
+
"import": "./dist/context.mjs",
|
|
32
|
+
"require": "./dist/context.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./vitest": {
|
|
35
|
+
"import": "./dist/vitest.mjs",
|
|
36
|
+
"require": "./dist/vitest.cjs"
|
|
51
37
|
}
|
|
52
|
-
],
|
|
53
|
-
"engines": {
|
|
54
|
-
"node": ">=20"
|
|
55
38
|
},
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"globals": "^16.3.0",
|
|
64
|
-
"prettier": "^3.6.2",
|
|
65
|
-
"typescript": "^5.9.2"
|
|
39
|
+
"scripts": {
|
|
40
|
+
"dev": "tsdown --watch",
|
|
41
|
+
"build": "tsdown",
|
|
42
|
+
"lint": "../../node_modules/.bin/oxlint -c ../../.oxlintrc.json .",
|
|
43
|
+
"lint:fix": "../../node_modules/.bin/oxlint -c ../../.oxlintrc.json --fix .",
|
|
44
|
+
"fmt": "../../node_modules/.bin/oxfmt -c ../../.oxfmtrc.json .",
|
|
45
|
+
"fmt:check": "../../node_modules/.bin/oxfmt -c ../../.oxfmtrc.json --check ."
|
|
66
46
|
},
|
|
67
47
|
"dependencies": {
|
|
48
|
+
"@logtape/file": "^2.0.2",
|
|
49
|
+
"@logtape/logtape": "^2.0.2",
|
|
50
|
+
"@logtape/pretty": "^2.0.2",
|
|
51
|
+
"conf": "^15.1.0",
|
|
52
|
+
"impit": "^0.9.2",
|
|
68
53
|
"javascript-obfuscator": "^4.1.1",
|
|
69
|
-
"
|
|
70
|
-
|
|
54
|
+
"metavm": "^1.4.5",
|
|
55
|
+
"nanospinner": "^1.2.2",
|
|
56
|
+
"tsdown": "^0.20.3",
|
|
57
|
+
"undici": "^7.22.0",
|
|
58
|
+
"urlpattern-polyfill": "^10.1.0"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/node": "^25.3.0",
|
|
62
|
+
"dasha": "^3.1.9",
|
|
63
|
+
"typescript": "^5.9.3"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"vitest": ">=4.0.0"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=22"
|
|
70
|
+
},
|
|
71
|
+
"readmeFilename": "README.md"
|
|
71
72
|
}
|
package/types/extension.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { VideoCodec, DynamicRange, AudioCodec } from 'dasha';
|
|
2
2
|
|
|
3
3
|
export interface ExtensionConfig {
|
|
4
4
|
id: string;
|
|
@@ -12,7 +12,7 @@ export interface Extension {
|
|
|
12
12
|
/**
|
|
13
13
|
* Can handle URL or URL pattern
|
|
14
14
|
*/
|
|
15
|
-
canHandle?: ((url:
|
|
15
|
+
canHandle?: ((url: string) => boolean | Promise<boolean>) | string;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Performs initialization of extension (e.g. token refresh)
|
|
@@ -20,24 +20,18 @@ export interface Extension {
|
|
|
20
20
|
init?(): void | Promise<void>;
|
|
21
21
|
|
|
22
22
|
isAuthenticated?(): Promise<boolean>;
|
|
23
|
-
login?(username?: string
|
|
23
|
+
login?(credentials: { username?: string; password?: string; otp?: string }): Promise<void>;
|
|
24
24
|
logout?(): Promise<void>;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Fetches content metadata from URL
|
|
28
28
|
*/
|
|
29
|
-
fetchContentMetadata: (
|
|
30
|
-
url: string,
|
|
31
|
-
options: Options,
|
|
32
|
-
) => Promise<ContentMetadata[]>;
|
|
29
|
+
fetchContentMetadata: (url: string, options: Options) => Promise<ContentMetadata[]>;
|
|
33
30
|
|
|
34
31
|
/**
|
|
35
32
|
* Fetches data about content source (e.g. manifest URL, external subtitles, etc.)
|
|
36
33
|
*/
|
|
37
|
-
fetchContentSource?: (
|
|
38
|
-
contentId: string,
|
|
39
|
-
options: Options,
|
|
40
|
-
) => Promise<ContentSource | null>;
|
|
34
|
+
fetchContentSource?: (contentId: string, options: Options) => Promise<ContentSource | null>;
|
|
41
35
|
|
|
42
36
|
/**
|
|
43
37
|
* Fetches just content DRM config (e.g. license server URL, request headers, etc.)
|
|
@@ -71,6 +65,51 @@ export interface Extension {
|
|
|
71
65
|
match?: string;
|
|
72
66
|
}
|
|
73
67
|
|
|
68
|
+
export type Options = {
|
|
69
|
+
videoQuality?: string;
|
|
70
|
+
videoCodecs?: VideoCodec[];
|
|
71
|
+
videoRange?: DynamicRange;
|
|
72
|
+
videoBitrate?: number;
|
|
73
|
+
videoDimension?: '2D' | '3D';
|
|
74
|
+
|
|
75
|
+
audioCodecs?: AudioCodec[];
|
|
76
|
+
audioChannels?: number;
|
|
77
|
+
audioBitrate?: number;
|
|
78
|
+
|
|
79
|
+
subtitleFormat?: string;
|
|
80
|
+
subtitleLanguages?: string[];
|
|
81
|
+
|
|
82
|
+
languages?: string[];
|
|
83
|
+
|
|
84
|
+
skipVideo?: boolean;
|
|
85
|
+
skipAudio?: boolean;
|
|
86
|
+
skipSubtitles?: boolean;
|
|
87
|
+
skipMux?: boolean;
|
|
88
|
+
|
|
89
|
+
select?: boolean;
|
|
90
|
+
|
|
91
|
+
episodes?: Map<number, Set<number>>;
|
|
92
|
+
retry?: number;
|
|
93
|
+
connections?: number;
|
|
94
|
+
proxy?: string | null;
|
|
95
|
+
proxyMeta?: string | null;
|
|
96
|
+
proxyMedia?: string | null;
|
|
97
|
+
|
|
98
|
+
movieTemplate?: string;
|
|
99
|
+
episodeTemplate?: string;
|
|
100
|
+
hardsub?: boolean;
|
|
101
|
+
trimBegin?: string;
|
|
102
|
+
trimEnd?: string;
|
|
103
|
+
|
|
104
|
+
pssh?: string;
|
|
105
|
+
drmTemplate?: string;
|
|
106
|
+
header?: Record<string, string>;
|
|
107
|
+
|
|
108
|
+
http2?: boolean;
|
|
109
|
+
keys?: { kid: string; key: string }[];
|
|
110
|
+
debug?: boolean;
|
|
111
|
+
};
|
|
112
|
+
|
|
74
113
|
export interface MediaInfo {
|
|
75
114
|
id: string;
|
|
76
115
|
type?: 'movie' | 'tv';
|
|
@@ -109,10 +148,7 @@ export interface MediaDrm {
|
|
|
109
148
|
transformRequest?(request: Request): Request;
|
|
110
149
|
transformResponse?(response: Response): Response;
|
|
111
150
|
|
|
112
|
-
fetchCertificate?(
|
|
113
|
-
message: Uint8Array,
|
|
114
|
-
sessionId: string,
|
|
115
|
-
): Promise<Uint8Array>;
|
|
151
|
+
fetchCertificate?(message: Uint8Array, sessionId: string): Promise<Uint8Array>;
|
|
116
152
|
fetchLicense?(message: Uint8Array, sessionId: string): Promise<Uint8Array>;
|
|
117
153
|
}
|
|
118
154
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type AlertStyle = 'default' | 'destructive';
|
|
2
|
+
|
|
3
|
+
export type ActionOptions = {
|
|
4
|
+
title: string;
|
|
5
|
+
style?: 'default' | 'destructive' | 'cancel';
|
|
6
|
+
onAction: () => void | Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export async function notify(
|
|
10
|
+
message: string,
|
|
11
|
+
options?: {
|
|
12
|
+
title?: string;
|
|
13
|
+
style?: AlertStyle;
|
|
14
|
+
primaryAction?: ActionOptions;
|
|
15
|
+
secondaryAction?: ActionOptions;
|
|
16
|
+
},
|
|
17
|
+
): Promise<void>;
|
|
18
|
+
|
|
19
|
+
export async function confirm(
|
|
20
|
+
message: string,
|
|
21
|
+
options?: {
|
|
22
|
+
title?: string;
|
|
23
|
+
style?: AlertStyle;
|
|
24
|
+
primaryAction?: ActionOptions;
|
|
25
|
+
secondaryAction?: ActionOptions;
|
|
26
|
+
},
|
|
27
|
+
): Promise<boolean>;
|
|
28
|
+
|
|
29
|
+
export type AskFieldType = 'text' | 'password' | 'number' | 'checkbox';
|
|
30
|
+
|
|
31
|
+
export type AskField = {
|
|
32
|
+
type: AskFieldType;
|
|
33
|
+
title?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
defaultValue?: string;
|
|
37
|
+
required?: boolean;
|
|
38
|
+
autoFocus?: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type AskForm = Record<string, AskField>;
|
|
42
|
+
|
|
43
|
+
export type AskFieldValue<T extends AskField> = T['type'] extends 'checkbox'
|
|
44
|
+
? boolean
|
|
45
|
+
: T['type'] extends 'number'
|
|
46
|
+
? number
|
|
47
|
+
: string;
|
|
48
|
+
|
|
49
|
+
export type AskResult<TForm extends AskForm> = {
|
|
50
|
+
[K in keyof TForm]: AskFieldValue<TForm[K]>;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export async function ask<TForm extends AskForm>(
|
|
54
|
+
message: string,
|
|
55
|
+
options: {
|
|
56
|
+
title?: string;
|
|
57
|
+
style?: AlertStyle;
|
|
58
|
+
primaryAction?: ActionOptions;
|
|
59
|
+
secondaryAction?: ActionOptions;
|
|
60
|
+
form: TForm;
|
|
61
|
+
},
|
|
62
|
+
): Promise<AskResult<TForm>>;
|
package/types/main.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Extension } from './extension';
|
|
2
|
+
|
|
3
|
+
export * from './extension';
|
|
4
|
+
export * from './feedback';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Simple wrapper to support type checking
|
|
8
|
+
*/
|
|
9
|
+
export function defineExtension(extension: Extension): Extension;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Get Azot version
|
|
13
|
+
*/
|
|
14
|
+
export const version: string;
|
|
15
|
+
|
|
16
|
+
export const utils: {
|
|
17
|
+
sanitizeString: (text: string) => string;
|
|
18
|
+
|
|
19
|
+
execUrlPatterns: (
|
|
20
|
+
url: string,
|
|
21
|
+
patterns: string[],
|
|
22
|
+
baseUrls: string[],
|
|
23
|
+
) => {
|
|
24
|
+
pathname: Record<string, string | undefined>;
|
|
25
|
+
search: Record<string, string | undefined>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
extendEpisodes: (episodesBySeasons?: Map<number, Set<number>>) => {
|
|
29
|
+
items: Map<number, Set<number>>;
|
|
30
|
+
has: (episode?: number, season?: number) => boolean;
|
|
31
|
+
set: (episode?: number, season?: number) => void;
|
|
32
|
+
getMin: () => number;
|
|
33
|
+
getMax: () => number;
|
|
34
|
+
seasonsCount: number;
|
|
35
|
+
episodesCount: number;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
getRandomElements: (array: unknown, count?: number) => unknown[];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
declare global {
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* A partial implementation of [Navigator](https://developer.mozilla.org/ru/docs/Web/API/Navigator) for Azot
|
|
45
|
+
*/
|
|
46
|
+
var navigator: Navigator;
|
|
47
|
+
|
|
48
|
+
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Window/cookieStore) */
|
|
49
|
+
const cookieStore: CookieStore;
|
|
50
|
+
|
|
51
|
+
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) */
|
|
52
|
+
function fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
53
|
+
|
|
54
|
+
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) */
|
|
55
|
+
function eval(x: string): any;
|
|
56
|
+
|
|
57
|
+
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/CookieStore) */
|
|
58
|
+
interface CookieStore {
|
|
59
|
+
get(cookie: string | { name: string; url: string }): Promise<Cookie | null>;
|
|
60
|
+
getAll(cookie?: string | { name: string; url: string }): Promise<Cookie[]>;
|
|
61
|
+
set(cookie: Cookie): Promise<void>;
|
|
62
|
+
delete(
|
|
63
|
+
cookie?:
|
|
64
|
+
| string
|
|
65
|
+
| {
|
|
66
|
+
name: string;
|
|
67
|
+
domain?: string;
|
|
68
|
+
path?: string;
|
|
69
|
+
partitioned?: boolean;
|
|
70
|
+
},
|
|
71
|
+
): Promise<void>;
|
|
72
|
+
addToHeaders(headers: Headers): void;
|
|
73
|
+
toString(): string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/CookieStore/get#return_value) */
|
|
77
|
+
interface Cookie {
|
|
78
|
+
name: string;
|
|
79
|
+
value: string;
|
|
80
|
+
domain?: string;
|
|
81
|
+
path?: string;
|
|
82
|
+
expires?: string;
|
|
83
|
+
httpOnly?: boolean;
|
|
84
|
+
secure?: boolean;
|
|
85
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
86
|
+
partitioned?: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** A partial implementation of [Navigator](https://developer.mozilla.org/ru/docs/Web/API/Navigator) for Azot */
|
|
90
|
+
interface Navigator {
|
|
91
|
+
appName: string;
|
|
92
|
+
appVersion: string;
|
|
93
|
+
platform: string;
|
|
94
|
+
userAgentData: {
|
|
95
|
+
mobile: boolean;
|
|
96
|
+
platform: string;
|
|
97
|
+
getHighEntropyValues(hints: string[]): Promise<UADataValues>;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
interface NavigatorUABrandVersion {
|
|
102
|
+
brand: string;
|
|
103
|
+
version: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface UADataValues {
|
|
107
|
+
architecture: string;
|
|
108
|
+
fullVersionList: NavigatorUABrandVersion[];
|
|
109
|
+
mobile: boolean;
|
|
110
|
+
platform: string;
|
|
111
|
+
platformVersion: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** A partial implementation of the [Document](https://developer.mozilla.org/en-US/docs/Web/API/Document) for Azot */
|
|
115
|
+
interface Document {
|
|
116
|
+
readonly cookie: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
interface Uint8Array {
|
|
120
|
+
/** [TC39 proposal](https://github.com/tc39/proposal-arraybuffer-base64) */
|
|
121
|
+
toBase64(): string;
|
|
122
|
+
/** [TC39 proposal](https://github.com/tc39/proposal-arraybuffer-base64) */
|
|
123
|
+
toHex(): string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface Uint8ArrayConstructor {
|
|
127
|
+
/** [TC39 proposal](https://github.com/tc39/proposal-arraybuffer-base64) */
|
|
128
|
+
fromBase64(base64String: string): Uint8Array;
|
|
129
|
+
/** [TC39 proposal](https://github.com/tc39/proposal-arraybuffer-base64) */
|
|
130
|
+
fromHex(hexString: string): Uint8Array;
|
|
131
|
+
}
|
|
132
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Vitaly Gashkov <vitalygashkov@vk.com>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/bin/cli.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),t=e(((exports,t)=>{let{createCipheriv:n,createDecipheriv:r,publicEncrypt:i,privateDecrypt:a,randomBytes:o}=require(`node:crypto`),{readFileSync:s,writeFileSync:c}=require(`node:fs`),l=Buffer.from(`STX`,`utf8`),u=(e,t,r)=>{let a=o(32),u=o(16),d=s(t),f=n(`aes-256-cbc`,a,u),p=Buffer.concat([f.update(d),f.final()]),m=i(e,a),h=Buffer.concat([l,u,m,p]);return r&&c(r,h),{aesIv:u,encryptedAesKey:m,encryptedCode:p}},d=(e,t,n)=>{let i=s(t),o=l.byteLength,u=i.subarray(0,o);if(!u.equals(l))throw Error(`Incorrect file format`);let d=o,f=d+16,p=f+512,m=i.subarray(d,f),h=i.subarray(f,p),g=i.subarray(p),_=a(e,h),v=r(`aes-256-cbc`,_,m),y=Buffer.concat([v.update(g),v.final()]),b=y.toString(`utf8`);return n&&c(n,b),b};t.exports={encrypt:u,decrypt:d}})),n=e(((exports,t)=>{let{readFileSync:n,writeFileSync:r}=require(`node:fs`),i=require(`javascript-obfuscator`),a=(e,t)=>{let a=n(e,`utf8`);console.log(`Obfuscating...`),console.time(`Obfuscation complete in`);let o=i.obfuscate(a,{target:`node`,compact:!0,controlFlowFlattening:!0,controlFlowFlatteningThreshold:1,deadCodeInjection:!0,debugProtection:!0,identifierNamesGenerator:`hexadecimal`,numbersToExpressions:!0,selfDefending:!0,simplify:!0,splitStrings:!0,splitStringsChunkLength:5,stringArray:!0,stringArrayCallsTransform:!0,stringArrayCallsTransformThreshold:1,stringArrayEncoding:[`base64`],stringArrayIndexShift:!0,stringArrayRotate:!0,stringArrayShuffle:!0,stringArrayWrappersCount:2,stringArrayWrappersChainedCalls:!0,stringArrayWrappersType:`function`,stringArrayThreshold:1,transformObjectKeys:!0,unicodeEscapeSequence:!1});console.timeEnd(`Obfuscation complete in`);let s=o.getObfuscatedCode();return r(t||e,s),s};t.exports={obfuscate:a}}));const{parseArgs:r}=require(`node:util`),{rmSync:i,readdirSync:a,readFileSync:o}=require(`node:fs`),s=require(`node:path`),{build:c}=require(`tsdown`),{encrypt:l,decrypt:u}=t(),{obfuscate:d}=n(),f=r({allowPositionals:!0,allowNegative:!0,options:{input:{type:`string`,short:`i`,description:`Path to the input file`},key:{type:`string`,short:`k`,description:`Path to the key file (public for encrypt, private for decrypt)`},output:{type:`string`,short:`o`,description:`Path to the output file`},format:{type:`string`,short:`f`,description:`Output format`},watch:{type:`boolean`,description:`Watch file changes`},minify:{type:`boolean`,description:`Minify output`},obfuscate:{type:`boolean`,description:`Obfuscate output`},encrypt:{type:`boolean`,description:`Encrypt extension source code (.js will be packed inside .stx)`},decrypt:{type:`boolean`,description:`Decrypt encrypted extension`}}}),p=()=>{let e=[process.cwd(),s.join(process.cwd(),`src`),s.join(process.cwd(),`lib`)];for(let t of e){let e=a(t),n=e.filter(e=>!e.endsWith(`.d.ts`)).filter(e=>new Set([`.ts`,`.js`]).has(s.extname(e))),r=e=>s.basename(e,s.extname(e)),i=n.find(e=>r(e)===`index`)||n.find(e=>r(e)===`main`)||n[0];if(i)return s.join(t,i)}};(async()=>{let[e,...t]=f.positionals,n=f.values.input||t[0]||p();if(e===`build`||e===`pack`){let t=typeof f.values.minify==`boolean`?f.values.minify:!0;await c({entry:n,format:f.values.format??`cjs`,platform:`node`,target:`node22`,watch:f.values.watch,minify:t}),f.values.input=s.join(process.cwd(),`dist`,s.basename(n).replace(/\.ts$/,`.js`));let r=require(s.join(process.cwd(),`package.json`)),a=typeof f.values.obfuscate==`boolean`,u=a?f.values.obfuscate:r.private;u&&d(f.values.input,f.values.input);let p=f.values.encrypt||e===`pack`;if(p){let e=o(f.values.key||s.join(__dirname,`../public.pem`)),t=f.values.output||f.values.input.replace(/\.js$/,`-${r.version}.stx`);l(e,f.values.input,t),i(f.values.input)}}else if(e===`decrypt`){let e=o(f.values.key||s.join(__dirname,`../private.pem`)),t=f.values.output||n.replace(/\.stx$/,`.js`);u(e,n,t),i(f.values.input)}else if(e===`dev`||e===`develop`||!e){let e=typeof f.values.minify==`boolean`?f.values.minify:!1;await c({entry:n,format:f.values.format??`cjs`,platform:`node`,target:`node20`,watch:!0,minify:e})}})();
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=e=>e,t=`Streamyx`in globalThis?globalThis.Streamyx:{},n=`Azot`in globalThis?globalThis.Azot:{};if(!globalThis.Azot&&globalThis.Streamyx&&(globalThis.Azot=globalThis.Streamyx),globalThis.Azot&&!globalThis.Azot.input){let e=async(e,t)=>{let n=t?.fields??{answer:{label:e}},r=await globalThis.Azot.prompt.ask({title:t?.title,description:e,fields:n});return r};globalThis.Azot.input=e}module.exports={defineExtension:e,...t,...n};
|
package/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import './types/globals';
|
|
2
|
-
import { Extension } from './types/extension';
|
|
3
|
-
|
|
4
|
-
export function defineExtension(extension: Extension): Extension;
|
|
5
|
-
|
|
6
|
-
export const version: AzotModule['version'];
|
|
7
|
-
export const utils: AzotModule['utils'];
|
|
8
|
-
export const prompt: AzotModule['prompt'];
|
|
9
|
-
|
|
10
|
-
export * from './types/extension';
|
package/public.pem
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
-----BEGIN PUBLIC KEY-----
|
|
2
|
-
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEApJVKjJzoV4ati1NHAXjN
|
|
3
|
-
D3CRULVU8g7OzFNCcjqH9fAeByTevYTo4ryttcaljf2qOBNE0RLVgMh1gaU/EjrA
|
|
4
|
-
CA+nXYU4USjknctSKFFspIdnPJfYTe2pu42tQeOr88AASYt/PjHBxHXSr/z2D7H/
|
|
5
|
-
GB51DaakFqM6T6wUyjXOduVuMnVkWtNDexQkjp6AItq2IRyCSjc8X4VtnuIm4D/F
|
|
6
|
-
/Ny7cw0+HBP3c58BBiTpjCc1EI/5gYfqzlo9bGKmbn/s8rRgGAA0v1aPGjjN0Ask
|
|
7
|
-
gTgd4iQE0Qjumu5QiaiYghWiGaiK9Q5RQW0YIu/vh59Ylyul62jUC0+1a+UsoW/U
|
|
8
|
-
0ZQwqub0NnEpHeBboGYQzA6cjDFf7vvlpVp/7vHwsBXcub7pqmi1IVEEpvsaIy11
|
|
9
|
-
dnLFkfWsUHD8w0f6basX8gtd7HRacjWZD+SiBoGCfu3t8KQZizdMeUgBkDuNojij
|
|
10
|
-
UtpyQ5rczO+EuLjkHgjwFpplyOUme1ePENjRzhVdHzPMLohet4EFgMQV6s7vNJgA
|
|
11
|
-
rp71hOnAkOJJ/Pe2/PgFBBbQWgEOqsMopWesVDUV84rIkSnbsuzzzDT9Cfs5Veje
|
|
12
|
-
fyERt4rbt8EEUwDnqZl2vRNDGHjjCl/d1U1iITt6OVSeMd6jA8cg8PmDBq3Wl6bP
|
|
13
|
-
RMZ+4GiuFSJsJG3+bzKaFxMCAwEAAQ==
|
|
14
|
-
-----END PUBLIC KEY-----
|
package/types/azot.d.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
/**
|
|
3
|
-
* Azot runtime APIs
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
*
|
|
7
|
-
* ```js
|
|
8
|
-
* import { sanitizeString } from 'azot';
|
|
9
|
-
*
|
|
10
|
-
* const sanitized = sanitizeString('Hello, world!');
|
|
11
|
-
* // Sanitize string to be able use it in filenames
|
|
12
|
-
* console.log(sanitized);
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* This module aliases `globalThis.Azot`.
|
|
16
|
-
*/
|
|
17
|
-
const Azot: AzotModule;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* In v5.0.0+ use `Azot` instead
|
|
21
|
-
*/
|
|
22
|
-
const Streamyx: AzotModule;
|
|
23
|
-
|
|
24
|
-
interface AzotModule {
|
|
25
|
-
version: string;
|
|
26
|
-
utils: Common;
|
|
27
|
-
prompt<T = PromptResponse>(request: PromptRequest): Promise<T>;
|
|
28
|
-
|
|
29
|
-
input<T extends string = 'answer'>(
|
|
30
|
-
message: string,
|
|
31
|
-
options?: DialogOptions<T>,
|
|
32
|
-
): Promise<Record<T, string>>;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface DialogOptions<T extends string> {
|
|
37
|
-
title?: string;
|
|
38
|
-
fields?: Record<T, InputField>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type InputType =
|
|
42
|
-
| 'text'
|
|
43
|
-
| 'password'
|
|
44
|
-
| 'number'
|
|
45
|
-
| 'checkbox'
|
|
46
|
-
| 'select'
|
|
47
|
-
| 'date'
|
|
48
|
-
| 'confirm';
|
|
49
|
-
|
|
50
|
-
export type InputField = {
|
|
51
|
-
type?: InputType;
|
|
52
|
-
label: string;
|
|
53
|
-
placeholder?: string;
|
|
54
|
-
defaultValue?: string;
|
|
55
|
-
required?: boolean;
|
|
56
|
-
options?: string[];
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export type PromptRequest = {
|
|
60
|
-
title?: string;
|
|
61
|
-
description?: string;
|
|
62
|
-
fields: Record<string, InputField>;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export type PromptResponse = {
|
|
66
|
-
[field: string]: string; // TODO: Add more types with inference from InputField type
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export type Common = {
|
|
70
|
-
sanitizeString: (text: string) => string;
|
|
71
|
-
|
|
72
|
-
execUrlPatterns: (
|
|
73
|
-
url: string,
|
|
74
|
-
patterns: string[],
|
|
75
|
-
baseUrls: string[],
|
|
76
|
-
) => {
|
|
77
|
-
pathname: Record<string, string | undefined>;
|
|
78
|
-
search: Record<string, string | undefined>;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
extendEpisodes: (episodesBySeasons?: Map<number, Set<number>>) => {
|
|
82
|
-
items: Map<number, Set<number>>;
|
|
83
|
-
has: (episode?: number, season?: number) => boolean;
|
|
84
|
-
set: (episode?: number, season?: number) => void;
|
|
85
|
-
getMin: () => number;
|
|
86
|
-
getMax: () => number;
|
|
87
|
-
seasonsCount: number;
|
|
88
|
-
episodesCount: number;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
getRandomElements: (array: unknown, count?: number) => unknown[];
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export type HttpClient = {
|
|
95
|
-
headers: Record<string, string>;
|
|
96
|
-
cookies: string[];
|
|
97
|
-
userAgents: Record<
|
|
98
|
-
'chromeWindows' | 'chromeMacOS' | 'chromeLinux' | 'smartTv' | 'tizen',
|
|
99
|
-
string
|
|
100
|
-
>;
|
|
101
|
-
fetch(
|
|
102
|
-
resource: string | URL | Request,
|
|
103
|
-
options?: RequestInit,
|
|
104
|
-
): Promise<Response>;
|
|
105
|
-
fetchAsChrome(
|
|
106
|
-
resource: string | URL | Request,
|
|
107
|
-
options?: RequestInit,
|
|
108
|
-
): Promise<Response>;
|
|
109
|
-
appendCookies(setCookie: string | string[]): void;
|
|
110
|
-
setAgent(proxy?: string | null): void;
|
|
111
|
-
setCookies(cookies: string[]): void;
|
|
112
|
-
setHeader(name: string, value: string): void;
|
|
113
|
-
setHeaders(headers: Record<string, string>): void;
|
|
114
|
-
removeHeader(name: string): void;
|
|
115
|
-
destroySessions(): Promise<void>;
|
|
116
|
-
};
|
package/types/cookie-store.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/CookieStore) */
|
|
3
|
-
interface CookieStore {
|
|
4
|
-
get(cookie: string | { name: string; url: string }): Promise<Cookie | null>;
|
|
5
|
-
getAll(cookie?: string | { name: string; url: string }): Promise<Cookie[]>;
|
|
6
|
-
set(cookie: Cookie): Promise<void>;
|
|
7
|
-
delete(
|
|
8
|
-
cookie?:
|
|
9
|
-
| string
|
|
10
|
-
| {
|
|
11
|
-
name: string;
|
|
12
|
-
domain?: string;
|
|
13
|
-
path?: string;
|
|
14
|
-
partitioned?: boolean;
|
|
15
|
-
},
|
|
16
|
-
): Promise<void>;
|
|
17
|
-
addToHeaders(headers: Headers): void;
|
|
18
|
-
toString(): string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface Cookie {
|
|
22
|
-
name: string;
|
|
23
|
-
value: string;
|
|
24
|
-
domain?: string;
|
|
25
|
-
path?: string;
|
|
26
|
-
expires?: string;
|
|
27
|
-
httpOnly?: boolean;
|
|
28
|
-
secure?: boolean;
|
|
29
|
-
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
30
|
-
partitioned?: boolean;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export {};
|
package/types/document.d.ts
DELETED
package/types/globals.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import './azot';
|
|
2
|
-
import './cookie-store';
|
|
3
|
-
import './navigator';
|
|
4
|
-
import './document';
|
|
5
|
-
import './uin8array.extensions';
|
|
6
|
-
|
|
7
|
-
declare global {
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* A partial implementation of [Navigator](https://developer.mozilla.org/ru/docs/Web/API/Navigator) for Azot
|
|
11
|
-
*/
|
|
12
|
-
var navigator: Navigator;
|
|
13
|
-
|
|
14
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Window/cookieStore) */
|
|
15
|
-
const cookieStore: CookieStore;
|
|
16
|
-
|
|
17
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt) */
|
|
18
|
-
function prompt(message?: string, _default?: string): string | null;
|
|
19
|
-
|
|
20
|
-
/** [MDN Reference](https://developer.mozilla.org/ru/docs/Web/API/Window/alert) */
|
|
21
|
-
function alert(message?: any): void;
|
|
22
|
-
|
|
23
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) */
|
|
24
|
-
function fetch(
|
|
25
|
-
input: RequestInfo | URL,
|
|
26
|
-
init?: RequestInit,
|
|
27
|
-
): Promise<Response>;
|
|
28
|
-
|
|
29
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) */
|
|
30
|
-
function eval(x: string): any;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export {};
|
package/types/navigator.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
/** A partial implementation of [Navigator](https://developer.mozilla.org/ru/docs/Web/API/Navigator) for Azot */
|
|
3
|
-
interface Navigator {
|
|
4
|
-
appName: string;
|
|
5
|
-
appVersion: string;
|
|
6
|
-
platform: string;
|
|
7
|
-
userAgentData: {
|
|
8
|
-
mobile: boolean;
|
|
9
|
-
platform: string;
|
|
10
|
-
getHighEntropyValues(hints: string[]): Promise<UADataValues>;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface NavigatorUABrandVersion {
|
|
15
|
-
brand: string;
|
|
16
|
-
version: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface UADataValues {
|
|
20
|
-
architecture: string;
|
|
21
|
-
fullVersionList: NavigatorUABrandVersion[];
|
|
22
|
-
mobile: boolean;
|
|
23
|
-
platform: string;
|
|
24
|
-
platformVersion: string;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export {};
|
package/types/options.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { VideoCodec, DynamicRange, AudioCodec } from 'dasha';
|
|
2
|
-
|
|
3
|
-
export type Options = {
|
|
4
|
-
videoQuality?: string;
|
|
5
|
-
videoCodecs?: VideoCodec[];
|
|
6
|
-
videoRange?: DynamicRange;
|
|
7
|
-
videoBitrate?: number;
|
|
8
|
-
videoDimension?: '2D' | '3D';
|
|
9
|
-
|
|
10
|
-
audioCodecs?: AudioCodec[];
|
|
11
|
-
audioChannels?: number;
|
|
12
|
-
audioBitrate?: number;
|
|
13
|
-
|
|
14
|
-
subtitleFormat?: string;
|
|
15
|
-
subtitleLanguages?: string[];
|
|
16
|
-
|
|
17
|
-
languages?: string[];
|
|
18
|
-
|
|
19
|
-
skipVideo?: boolean;
|
|
20
|
-
skipAudio?: boolean;
|
|
21
|
-
skipSubtitles?: boolean;
|
|
22
|
-
skipMux?: boolean;
|
|
23
|
-
|
|
24
|
-
experimentalSelectTracks?: boolean;
|
|
25
|
-
|
|
26
|
-
episodes?: Map<number, Set<number>>;
|
|
27
|
-
retry?: number;
|
|
28
|
-
connections?: number;
|
|
29
|
-
proxy?: string | null;
|
|
30
|
-
proxyMeta?: string | null;
|
|
31
|
-
proxyMedia?: string | null;
|
|
32
|
-
|
|
33
|
-
movieTemplate?: string;
|
|
34
|
-
episodeTemplate?: string;
|
|
35
|
-
hardsub?: boolean;
|
|
36
|
-
trimBegin?: string;
|
|
37
|
-
trimEnd?: string;
|
|
38
|
-
|
|
39
|
-
pssh?: string;
|
|
40
|
-
drmTemplate?: string;
|
|
41
|
-
header?: Record<string, string>;
|
|
42
|
-
|
|
43
|
-
http2?: boolean;
|
|
44
|
-
keys?: { kid: string; key: string }[];
|
|
45
|
-
debug?: boolean;
|
|
46
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
interface Uint8Array {
|
|
3
|
-
/** [TC39 proposal](https://github.com/tc39/proposal-arraybuffer-base64) */
|
|
4
|
-
toBase64(): string;
|
|
5
|
-
/** [TC39 proposal](https://github.com/tc39/proposal-arraybuffer-base64) */
|
|
6
|
-
toHex(): string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface Uint8ArrayConstructor {
|
|
10
|
-
/** [TC39 proposal](https://github.com/tc39/proposal-arraybuffer-base64) */
|
|
11
|
-
fromBase64(base64String: string): Uint8Array;
|
|
12
|
-
/** [TC39 proposal](https://github.com/tc39/proposal-arraybuffer-base64) */
|
|
13
|
-
fromHex(hexString: string): Uint8Array;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export {};
|