@barbapapazes/video-toolkit 0.1.0 → 0.3.0

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.
@@ -0,0 +1,31 @@
1
+ //#region src/types.d.ts
2
+ /**
3
+ * Configuration schema for video-toolkit
4
+ */
5
+ interface Config {
6
+ /**
7
+ * OpenAI API key for transcription
8
+ */
9
+ openaiApiKey?: string;
10
+ /**
11
+ * Language code for transcription (e.g., 'en', 'fr', 'es')
12
+ * @default 'fr'
13
+ */
14
+ language?: string;
15
+ /**
16
+ * OpenAI Whisper model to use
17
+ * @default 'whisper-1'
18
+ */
19
+ model?: string;
20
+ /**
21
+ * Directory where SVG templates are stored
22
+ * Can be absolute or relative to the current working directory
23
+ * @default ~/.config/video-toolkit/templates
24
+ */
25
+ templatesDir?: string;
26
+ }
27
+ //#endregion
28
+ //#region src/index.d.ts
29
+ declare function defineConfig(config: Config): Config;
30
+ //#endregion
31
+ export { defineConfig };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ function e(e){return e}export{e as defineConfig};
@@ -1,2 +1,2 @@
1
- import{l as e,u as t}from"./cli.mjs";import{n,t as r}from"./node-Xk6BB16L.mjs";var i=e((e=>{var i=Object.defineProperty,a=(e,t)=>i(e,`name`,{value:t,configurable:!0});let o=r();t(`node:http`),t(`node:https`),t(`node:zlib`),t(`node:stream`),t(`node:buffer`),t(`node:util`),n(),t(`node:url`),t(`node:net`),t(`node:fs`),t(`node:path`);let s=0,c={START_BOUNDARY:s++,HEADER_FIELD_START:s++,HEADER_FIELD:s++,HEADER_VALUE_START:s++,HEADER_VALUE:s++,HEADER_VALUE_ALMOST_DONE:s++,HEADERS_ALMOST_DONE:s++,PART_DATA_START:s++,PART_DATA:s++,END:s++},l=1,u={PART_BOUNDARY:l,LAST_BOUNDARY:l*=2},d=a(e=>e|32,`lower`),f=a(()=>{},`noop`),p=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=f,this.onHeaderField=f,this.onHeadersEnd=f,this.onHeaderValue=f,this.onPartBegin=f,this.onPartData=f,this.onPartEnd=f,this.boundaryChars={},e=`\r
1
+ import{l as e,u as t}from"./cli.mjs";import{n,t as r}from"./node-LMiQoyLP.mjs";var i=e((e=>{var i=Object.defineProperty,a=(e,t)=>i(e,`name`,{value:t,configurable:!0});let o=r();t(`node:http`),t(`node:https`),t(`node:zlib`),t(`node:stream`),t(`node:buffer`),t(`node:util`),n(),t(`node:url`),t(`node:net`),t(`node:fs`),t(`node:path`);let s=0,c={START_BOUNDARY:s++,HEADER_FIELD_START:s++,HEADER_FIELD:s++,HEADER_VALUE_START:s++,HEADER_VALUE:s++,HEADER_VALUE_ALMOST_DONE:s++,HEADERS_ALMOST_DONE:s++,PART_DATA_START:s++,PART_DATA:s++,END:s++},l=1,u={PART_BOUNDARY:l,LAST_BOUNDARY:l*=2},d=a(e=>e|32,`lower`),f=a(()=>{},`noop`),p=class{constructor(e){this.index=0,this.flags=0,this.onHeaderEnd=f,this.onHeaderField=f,this.onHeadersEnd=f,this.onHeaderValue=f,this.onPartBegin=f,this.onPartData=f,this.onPartEnd=f,this.boundaryChars={},e=`\r
2
2
  --`+e;let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n),this.boundaryChars[t[n]]=!0;this.boundary=t,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=c.START_BOUNDARY}write(e){let t=0,n=e.length,r=this.index,{lookbehind:i,boundary:o,boundaryChars:s,index:l,state:f,flags:p}=this,m=this.boundary.length,h=m-1,g=e.length,_,v,y=a(e=>{this[e+`Mark`]=t},`mark`),b=a(e=>{delete this[e+`Mark`]},`clear`),x=a((e,t,n,r)=>{(t===void 0||t!==n)&&this[e](r&&r.subarray(t,n))},`callback`),S=a((n,r)=>{let i=n+`Mark`;i in this&&(r?(x(n,this[i],t,e),delete this[i]):(x(n,this[i],e.length,e),this[i]=0))},`dataCallback`);for(t=0;t<n;t++)switch(_=e[t],f){case c.START_BOUNDARY:if(l===o.length-2){if(_===45)p|=u.LAST_BOUNDARY;else if(_!==13)return;l++;break}else if(l-1==o.length-2){if(p&u.LAST_BOUNDARY&&_===45)f=c.END,p=0;else if(!(p&u.LAST_BOUNDARY)&&_===10)l=0,x(`onPartBegin`),f=c.HEADER_FIELD_START;else return;break}_!==o[l+2]&&(l=-2),_===o[l+2]&&l++;break;case c.HEADER_FIELD_START:f=c.HEADER_FIELD,y(`onHeaderField`),l=0;case c.HEADER_FIELD:if(_===13){b(`onHeaderField`),f=c.HEADERS_ALMOST_DONE;break}if(l++,_===45)break;if(_===58){if(l===1)return;S(`onHeaderField`,!0),f=c.HEADER_VALUE_START;break}if(v=d(_),v<97||v>122)return;break;case c.HEADER_VALUE_START:if(_===32)break;y(`onHeaderValue`),f=c.HEADER_VALUE;case c.HEADER_VALUE:_===13&&(S(`onHeaderValue`,!0),x(`onHeaderEnd`),f=c.HEADER_VALUE_ALMOST_DONE);break;case c.HEADER_VALUE_ALMOST_DONE:if(_!==10)return;f=c.HEADER_FIELD_START;break;case c.HEADERS_ALMOST_DONE:if(_!==10)return;x(`onHeadersEnd`),f=c.PART_DATA_START;break;case c.PART_DATA_START:f=c.PART_DATA,y(`onPartData`);case c.PART_DATA:if(r=l,l===0){for(t+=h;t<g&&!(e[t]in s);)t+=m;t-=h,_=e[t]}if(l<o.length)o[l]===_?(l===0&&S(`onPartData`,!0),l++):l=0;else if(l===o.length)l++,_===13?p|=u.PART_BOUNDARY:_===45?p|=u.LAST_BOUNDARY:l=0;else if(l-1===o.length)if(p&u.PART_BOUNDARY){if(l=0,_===10){p&=~u.PART_BOUNDARY,x(`onPartEnd`),x(`onPartBegin`),f=c.HEADER_FIELD_START;break}}else p&u.LAST_BOUNDARY&&_===45?(x(`onPartEnd`),f=c.END,p=0):l=0;if(l>0)i[l-1]=_;else if(r>0){let e=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);x(`onPartData`,0,r,e),r=0,y(`onPartData`),t--}break;case c.END:break;default:throw Error(`Unexpected state entered: ${f}`)}S(`onHeaderField`),S(`onHeaderValue`),S(`onPartData`),this.index=l,this.state=f,this.flags=p}end(){if(this.state===c.HEADER_FIELD_START&&this.index===0||this.state===c.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==c.END)throw Error(`MultipartParser.end(): stream ended unexpectedly`)}};a(p,`MultipartParser`);let m=p;function h(e){let t=e.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!t)return;let n=t[2]||t[3]||``,r=n.slice(n.lastIndexOf(`\\`)+1);return r=r.replace(/%22/g,`"`),r=r.replace(/&#(\d{4});/g,(e,t)=>String.fromCharCode(t)),r}a(h,`_fileName`);async function g(e,t){if(!/multipart/i.test(t))throw TypeError(`Failed to fetch`);let n=t.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!n)throw TypeError(`no or bad content-type header, no multipart boundary`);let r=new m(n[1]||n[2]),i,s,c,l,u,d,f=[],p=new o.FormData,g=a(e=>{c+=b.decode(e,{stream:!0})},`onPartData`),_=a(e=>{f.push(e)},`appendToFile`),v=a(()=>{let e=new o.File(f,d,{type:u});p.append(l,e)},`appendFileToFormData`),y=a(()=>{p.append(l,c)},`appendEntryToFormData`),b=new TextDecoder(`utf-8`);b.decode(),r.onPartBegin=function(){r.onPartData=g,r.onPartEnd=y,i=``,s=``,c=``,l=``,u=``,d=null,f.length=0},r.onHeaderField=function(e){i+=b.decode(e,{stream:!0})},r.onHeaderValue=function(e){s+=b.decode(e,{stream:!0})},r.onHeaderEnd=function(){if(s+=b.decode(),i=i.toLowerCase(),i===`content-disposition`){let e=s.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);e&&(l=e[2]||e[3]||``),d=h(s),d&&(r.onPartData=_,r.onPartEnd=v)}else i===`content-type`&&(u=s);s=``,i=``};for await(let t of e)r.write(t);return r.end(),p}a(g,`toFormData`),e.toFormData=g}));export default i();export{};
@@ -10,7 +10,7 @@ ${e.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
10
10
  Content-Type: ${e.type||`application/octet-stream`}\r
11
11
  \r
12
12
  `,e,`\r
13
- `)),r.push(`--${n}--`),new t(r,{type:`multipart/form-data; boundary=`+n})}o(Oe,`formDataToBlob`);let ke=class extends Error{constructor(e,t){super(e),Error.captureStackTrace(this,this.constructor),this.type=t}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};o(ke,`FetchBaseError`);let Ae=ke,je=class extends Ae{constructor(e,t,n){super(e,t),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}};o(je,`FetchError`);let P=je,Me=Symbol.toStringTag,Ne=o(e=>typeof e==`object`&&typeof e.append==`function`&&typeof e.delete==`function`&&typeof e.get==`function`&&typeof e.getAll==`function`&&typeof e.has==`function`&&typeof e.set==`function`&&typeof e.sort==`function`&&e[Me]===`URLSearchParams`,`isURLSearchParameters`),Pe=o(e=>e&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&typeof e.constructor==`function`&&/^(Blob|File)$/.test(e[Me]),`isBlob`),Fe=o(e=>typeof e==`object`&&(e[Me]===`AbortSignal`||e[Me]===`EventTarget`),`isAbortSignal`),Ie=o((e,t)=>{let n=new URL(t).hostname,r=new URL(e).hostname;return n===r||n.endsWith(`.${r}`)},`isDomainOrSubdomain`),Le=o((e,t)=>new URL(t).protocol===new URL(e).protocol,`isSameProtocol`),Re=E.promisify(O.pipeline),F=Symbol(`Body internals`),ze=class{constructor(e,{size:t=0}={}){let n=null;e===null?e=null:Ne(e)?e=T.Buffer.from(e.toString()):Pe(e)||T.Buffer.isBuffer(e)||(E.types.isAnyArrayBuffer(e)?e=T.Buffer.from(e):ArrayBuffer.isView(e)?e=T.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof O||(e instanceof N?(e=Oe(e),n=e.type.split(`=`)[1]):e=T.Buffer.from(String(e))));let r=e;T.Buffer.isBuffer(e)?r=O.Readable.from(e):Pe(e)&&(r=O.Readable.from(e.stream())),this[F]={body:e,stream:r,boundary:n,disturbed:!1,error:null},this.size=t,e instanceof O&&e.on(`error`,e=>{let t=e instanceof Ae?e:new P(`Invalid response body while trying to fetch ${this.url}: ${e.message}`,`system`,e);this[F].error=t})}get body(){return this[F].stream}get bodyUsed(){return this[F].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:t,byteLength:n}=await L(this);return e.slice(t,t+n)}async formData(){let t=this.headers.get(`content-type`);if(t.startsWith(`application/x-www-form-urlencoded`)){let e=new N,t=new URLSearchParams(await this.text());for(let[n,r]of t)e.append(n,r);return e}let{toFormData:n}=await import(`./multipart-parser-DMrr6Wla.mjs`).then(e(1));return n(this.body,t)}async blob(){let e=this.headers&&this.headers.get(`content-type`)||this[F].body&&this[F].body.type||``;return new ye([await this.arrayBuffer()],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await L(this);return new TextDecoder().decode(e)}buffer(){return L(this)}};o(ze,`Body`);let I=ze;I.prototype.buffer=E.deprecate(I.prototype.buffer,`Please use 'response.arrayBuffer()' instead of 'response.buffer()'`,`node-fetch#buffer`),Object.defineProperties(I.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:E.deprecate(()=>{},`data doesn't exist, use json(), text(), arrayBuffer(), or body instead`,`https://github.com/node-fetch/node-fetch/issues/1000 (response)`)}});async function L(e){if(e[F].disturbed)throw TypeError(`body used already for: ${e.url}`);if(e[F].disturbed=!0,e[F].error)throw e[F].error;let{body:t}=e;if(t===null||!(t instanceof O))return T.Buffer.alloc(0);let n=[],r=0;try{for await(let i of t){if(e.size>0&&r+i.length>e.size){let n=new P(`content size at ${e.url} over limit: ${e.size}`,`max-size`);throw t.destroy(n),n}r+=i.length,n.push(i)}}catch(t){throw t instanceof Ae?t:new P(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,`system`,t)}if(t.readableEnded===!0||t._readableState.ended===!0)try{return n.every(e=>typeof e==`string`)?T.Buffer.from(n.join(``)):T.Buffer.concat(n,r)}catch(t){throw new P(`Could not create Buffer from response body for ${e.url}: ${t.message}`,`system`,t)}else throw new P(`Premature close of server response while trying to fetch ${e.url}`)}o(L,`consumeBody`);let Be=o((e,t)=>{let n,r,{body:i}=e[F];if(e.bodyUsed)throw Error(`cannot clone body after it is used`);return i instanceof O&&typeof i.getBoundary!=`function`&&(n=new w.PassThrough({highWaterMark:t}),r=new w.PassThrough({highWaterMark:t}),i.pipe(n),i.pipe(r),e[F].stream=n,i=r),i},`clone`),Ve=E.deprecate(e=>e.getBoundary(),`form-data doesn't follow the spec and requires special treatment. Use alternative package`,`https://github.com/node-fetch/node-fetch/issues/1167`),He=o((e,t)=>e===null?null:typeof e==`string`?`text/plain;charset=UTF-8`:Ne(e)?`application/x-www-form-urlencoded;charset=UTF-8`:Pe(e)?e.type||null:T.Buffer.isBuffer(e)||E.types.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e instanceof N?`multipart/form-data; boundary=${t[F].boundary}`:e&&typeof e.getBoundary==`function`?`multipart/form-data;boundary=${Ve(e)}`:e instanceof O?null:`text/plain;charset=UTF-8`,`extractContentType`),Ue=o(e=>{let{body:t}=e[F];return t===null?0:Pe(t)?t.size:T.Buffer.isBuffer(t)?t.length:t&&typeof t.getLengthSync==`function`&&t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null},`getTotalBytes`),We=o(async(e,{body:t})=>{t===null?e.end():await Re(t,e)},`writeToStream`),Ge=typeof ce.validateHeaderName==`function`?ce.validateHeaderName:e=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let t=TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(t,`code`,{value:`ERR_INVALID_HTTP_TOKEN`}),t}},Ke=typeof ce.validateHeaderValue==`function`?ce.validateHeaderValue:(e,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){let t=TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(t,`code`,{value:`ERR_INVALID_CHAR`}),t}},qe=class e extends URLSearchParams{constructor(t){let n=[];if(t instanceof e){let e=t.raw();for(let[t,r]of Object.entries(e))n.push(...r.map(e=>[t,e]))}else if(t!=null)if(typeof t==`object`&&!E.types.isBoxedPrimitive(t)){let e=t[Symbol.iterator];if(e==null)n.push(...Object.entries(t));else{if(typeof e!=`function`)throw TypeError(`Header pairs must be iterable`);n=[...t].map(e=>{if(typeof e!=`object`||E.types.isBoxedPrimitive(e))throw TypeError(`Each header pair must be an iterable object`);return[...e]}).map(e=>{if(e.length!==2)throw TypeError(`Each header pair must be a name/value tuple`);return[...e]})}}else throw TypeError(`Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)`);return n=n.length>0?n.map(([e,t])=>(Ge(e),Ke(e,String(t)),[String(e).toLowerCase(),String(t)])):void 0,super(n),new Proxy(this,{get(e,t,n){switch(t){case`append`:case`set`:return(n,r)=>(Ge(n),Ke(n,String(r)),URLSearchParams.prototype[t].call(e,String(n).toLowerCase(),String(r)));case`delete`:case`has`:case`getAll`:return n=>(Ge(n),URLSearchParams.prototype[t].call(e,String(n).toLowerCase()));case`keys`:return()=>(e.sort(),new Set(URLSearchParams.prototype.keys.call(e)).keys());default:return Reflect.get(e,t,n)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let t=this.getAll(e);if(t.length===0)return null;let n=t.join(`, `);return/^content-encoding$/i.test(e)&&(n=n.toLowerCase()),n}forEach(e,t=void 0){for(let n of this.keys())Reflect.apply(e,t,[this.get(n),n,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,t)=>(e[t]=this.getAll(t),e),{})}[Symbol.for(`nodejs.util.inspect.custom`)](){return[...this.keys()].reduce((e,t)=>{let n=this.getAll(t);return t===`host`?e[t]=n[0]:e[t]=n.length>1?n:n[0],e},{})}};o(qe,`Headers`);let R=qe;Object.defineProperties(R.prototype,[`get`,`entries`,`forEach`,`values`].reduce((e,t)=>(e[t]={enumerable:!0},e),{}));function Je(e=[]){return new R(e.reduce((e,t,n,r)=>(n%2==0&&e.push(r.slice(n,n+2)),e),[]).filter(([e,t])=>{try{return Ge(e),Ke(e,String(t)),!0}catch{return!1}}))}o(Je,`fromRawHeaders`);let Ye=new Set([301,302,303,307,308]),Xe=o(e=>Ye.has(e),`isRedirect`),z=Symbol(`Response internals`),B=class e extends I{constructor(e=null,t={}){super(e,t);let n=t.status==null?200:t.status,r=new R(t.headers);if(e!==null&&!r.has(`Content-Type`)){let t=He(e,this);t&&r.append(`Content-Type`,t)}this[z]={type:`default`,url:t.url,status:n,statusText:t.statusText||``,headers:r,counter:t.counter,highWaterMark:t.highWaterMark}}get type(){return this[z].type}get url(){return this[z].url||``}get status(){return this[z].status}get ok(){return this[z].status>=200&&this[z].status<300}get redirected(){return this[z].counter>0}get statusText(){return this[z].statusText}get headers(){return this[z].headers}get highWaterMark(){return this[z].highWaterMark}clone(){return new e(Be(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(t,n=302){if(!Xe(n))throw RangeError(`Failed to execute "redirect" on "response": Invalid status code`);return new e(null,{headers:{location:new URL(t).toString()},status:n})}static error(){let t=new e(null,{status:0,statusText:``});return t[z].type=`error`,t}static json(t=void 0,n={}){let r=JSON.stringify(t);if(r===void 0)throw TypeError(`data is not JSON serializable`);let i=new R(n&&n.headers);return i.has(`content-type`)||i.set(`content-type`,`application/json`),new e(r,{...n,headers:i})}get[Symbol.toStringTag](){return`Response`}};o(B,`Response`);let V=B;Object.defineProperties(V.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});let Ze=o(e=>{if(e.search)return e.search;let t=e.href.length-1,n=e.hash||(e.href[t]===`#`?`#`:``);return e.href[t-n.length]===`?`?`?`:``},`getSearch`);function Qe(e,t=!1){return e==null||(e=new URL(e),/^(about|blob|data):$/.test(e.protocol))?`no-referrer`:(e.username=``,e.password=``,e.hash=``,t&&(e.pathname=``,e.search=``),e)}o(Qe,`stripURLForUseAsAReferrer`);let $e=new Set([``,`no-referrer`,`no-referrer-when-downgrade`,`same-origin`,`origin`,`strict-origin`,`origin-when-cross-origin`,`strict-origin-when-cross-origin`,`unsafe-url`]);function et(e){if(!$e.has(e))throw TypeError(`Invalid referrerPolicy: ${e}`);return e}o(et,`validateReferrerPolicy`);function tt(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let t=e.host.replace(/(^\[)|(]$)/g,``),n=D.isIP(t);return n===4&&/^127\./.test(t)||n===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(t)?!0:e.host===`localhost`||e.host.endsWith(`.localhost`)?!1:e.protocol===`file:`}o(tt,`isOriginPotentiallyTrustworthy`);function H(e){return/^about:(blank|srcdoc)$/.test(e)||e.protocol===`data:`||/^(blob|filesystem):$/.test(e.protocol)?!0:tt(e)}o(H,`isUrlPotentiallyTrustworthy`);function U(e,{referrerURLCallback:t,referrerOriginCallback:n}={}){if(e.referrer===`no-referrer`||e.referrerPolicy===``)return null;let r=e.referrerPolicy;if(e.referrer===`about:client`)return`no-referrer`;let i=e.referrer,a=Qe(i),o=Qe(i,!0);a.toString().length>4096&&(a=o),t&&(a=t(a)),n&&(o=n(o));let s=new URL(e.url);switch(r){case`no-referrer`:return`no-referrer`;case`origin`:return o;case`unsafe-url`:return a;case`strict-origin`:return H(a)&&!H(s)?`no-referrer`:o.toString();case`strict-origin-when-cross-origin`:return a.origin===s.origin?a:H(a)&&!H(s)?`no-referrer`:o;case`same-origin`:return a.origin===s.origin?a:`no-referrer`;case`origin-when-cross-origin`:return a.origin===s.origin?a:o;case`no-referrer-when-downgrade`:return H(a)&&!H(s)?`no-referrer`:a;default:throw TypeError(`Invalid referrerPolicy: ${r}`)}}o(U,`determineRequestsReferrer`);function nt(e){let t=(e.get(`referrer-policy`)||``).split(/[,\s]+/),n=``;for(let e of t)e&&$e.has(e)&&(n=e);return n}o(nt,`parseReferrerPolicyFromHeader`);let W=Symbol(`Request internals`),rt=o(e=>typeof e==`object`&&typeof e[W]==`object`,`isRequest`),it=E.deprecate(()=>{},`.data is not a valid RequestInit property, use .body instead`,`https://github.com/node-fetch/node-fetch/issues/1000 (request)`),at=class e extends I{constructor(e,t={}){let n;if(rt(e)?n=new URL(e.url):(n=new URL(e),e={}),n.username!==``||n.password!==``)throw TypeError(`${n} is an url with embedded credentials.`);let r=t.method||e.method||`GET`;if(/^(delete|get|head|options|post|put)$/i.test(r)&&(r=r.toUpperCase()),!rt(t)&&`data`in t&&it(),(t.body!=null||rt(e)&&e.body!==null)&&(r===`GET`||r===`HEAD`))throw TypeError(`Request with GET/HEAD method cannot have body`);let i=t.body?t.body:rt(e)&&e.body!==null?Be(e):null;super(i,{size:t.size||e.size||0});let a=new R(t.headers||e.headers||{});if(i!==null&&!a.has(`Content-Type`)){let e=He(i,this);e&&a.set(`Content-Type`,e)}let o=rt(e)?e.signal:null;if(`signal`in t&&(o=t.signal),o!=null&&!Fe(o))throw TypeError(`Expected signal to be an instanceof AbortSignal or EventTarget`);let s=t.referrer==null?e.referrer:t.referrer;if(s===``)s=`no-referrer`;else if(s){let e=new URL(s);s=/^about:(\/\/)?client$/.test(e)?`client`:e}else s=void 0;this[W]={method:r,redirect:t.redirect||e.redirect||`follow`,headers:a,parsedURL:n,signal:o,referrer:s},this.follow=t.follow===void 0?e.follow===void 0?20:e.follow:t.follow,this.compress=t.compress===void 0?e.compress===void 0?!0:e.compress:t.compress,this.counter=t.counter||e.counter||0,this.agent=t.agent||e.agent,this.highWaterMark=t.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=t.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=t.referrerPolicy||e.referrerPolicy||``}get method(){return this[W].method}get url(){return ie.format(this[W].parsedURL)}get headers(){return this[W].headers}get redirect(){return this[W].redirect}get signal(){return this[W].signal}get referrer(){if(this[W].referrer===`no-referrer`)return``;if(this[W].referrer===`client`)return`about:client`;if(this[W].referrer)return this[W].referrer.toString()}get referrerPolicy(){return this[W].referrerPolicy}set referrerPolicy(e){this[W].referrerPolicy=et(e)}clone(){return new e(this)}get[Symbol.toStringTag](){return`Request`}};o(at,`Request`);let ot=at;Object.defineProperties(ot.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});let st=o(e=>{let{parsedURL:t}=e[W],n=new R(e[W].headers);n.has(`Accept`)||n.set(`Accept`,`*/*`);let r=null;if(e.body===null&&/^(post|put)$/i.test(e.method)&&(r=`0`),e.body!==null){let t=Ue(e);typeof t==`number`&&!Number.isNaN(t)&&(r=String(t))}r&&n.set(`Content-Length`,r),e.referrerPolicy===``&&(e.referrerPolicy=`strict-origin-when-cross-origin`),e.referrer&&e.referrer!==`no-referrer`?e[W].referrer=U(e):e[W].referrer=`no-referrer`,e[W].referrer instanceof URL&&n.set(`Referer`,e.referrer),n.has(`User-Agent`)||n.set(`User-Agent`,`node-fetch`),e.compress&&!n.has(`Accept-Encoding`)&&n.set(`Accept-Encoding`,`gzip, deflate, br`);let{agent:i}=e;typeof i==`function`&&(i=i(t));let a=Ze(t);return{parsedURL:t,options:{path:t.pathname+a,method:e.method,headers:n[Symbol.for(`nodejs.util.inspect.custom`)](),insecureHTTPParser:e.insecureHTTPParser,agent:i}}},`getNodeRequestOptions`),ct=class extends Ae{constructor(e,t=`aborted`){super(e,t)}};o(ct,`AbortError`);let lt=ct;
13
+ `)),r.push(`--${n}--`),new t(r,{type:`multipart/form-data; boundary=`+n})}o(Oe,`formDataToBlob`);let ke=class extends Error{constructor(e,t){super(e),Error.captureStackTrace(this,this.constructor),this.type=t}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};o(ke,`FetchBaseError`);let Ae=ke,je=class extends Ae{constructor(e,t,n){super(e,t),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}};o(je,`FetchError`);let P=je,Me=Symbol.toStringTag,Ne=o(e=>typeof e==`object`&&typeof e.append==`function`&&typeof e.delete==`function`&&typeof e.get==`function`&&typeof e.getAll==`function`&&typeof e.has==`function`&&typeof e.set==`function`&&typeof e.sort==`function`&&e[Me]===`URLSearchParams`,`isURLSearchParameters`),Pe=o(e=>e&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&typeof e.constructor==`function`&&/^(Blob|File)$/.test(e[Me]),`isBlob`),Fe=o(e=>typeof e==`object`&&(e[Me]===`AbortSignal`||e[Me]===`EventTarget`),`isAbortSignal`),Ie=o((e,t)=>{let n=new URL(t).hostname,r=new URL(e).hostname;return n===r||n.endsWith(`.${r}`)},`isDomainOrSubdomain`),Le=o((e,t)=>new URL(t).protocol===new URL(e).protocol,`isSameProtocol`),Re=E.promisify(O.pipeline),F=Symbol(`Body internals`),ze=class{constructor(e,{size:t=0}={}){let n=null;e===null?e=null:Ne(e)?e=T.Buffer.from(e.toString()):Pe(e)||T.Buffer.isBuffer(e)||(E.types.isAnyArrayBuffer(e)?e=T.Buffer.from(e):ArrayBuffer.isView(e)?e=T.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof O||(e instanceof N?(e=Oe(e),n=e.type.split(`=`)[1]):e=T.Buffer.from(String(e))));let r=e;T.Buffer.isBuffer(e)?r=O.Readable.from(e):Pe(e)&&(r=O.Readable.from(e.stream())),this[F]={body:e,stream:r,boundary:n,disturbed:!1,error:null},this.size=t,e instanceof O&&e.on(`error`,e=>{let t=e instanceof Ae?e:new P(`Invalid response body while trying to fetch ${this.url}: ${e.message}`,`system`,e);this[F].error=t})}get body(){return this[F].stream}get bodyUsed(){return this[F].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:t,byteLength:n}=await L(this);return e.slice(t,t+n)}async formData(){let t=this.headers.get(`content-type`);if(t.startsWith(`application/x-www-form-urlencoded`)){let e=new N,t=new URLSearchParams(await this.text());for(let[n,r]of t)e.append(n,r);return e}let{toFormData:n}=await import(`./multipart-parser-67La25QJ.mjs`).then(e(1));return n(this.body,t)}async blob(){let e=this.headers&&this.headers.get(`content-type`)||this[F].body&&this[F].body.type||``;return new ye([await this.arrayBuffer()],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await L(this);return new TextDecoder().decode(e)}buffer(){return L(this)}};o(ze,`Body`);let I=ze;I.prototype.buffer=E.deprecate(I.prototype.buffer,`Please use 'response.arrayBuffer()' instead of 'response.buffer()'`,`node-fetch#buffer`),Object.defineProperties(I.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:E.deprecate(()=>{},`data doesn't exist, use json(), text(), arrayBuffer(), or body instead`,`https://github.com/node-fetch/node-fetch/issues/1000 (response)`)}});async function L(e){if(e[F].disturbed)throw TypeError(`body used already for: ${e.url}`);if(e[F].disturbed=!0,e[F].error)throw e[F].error;let{body:t}=e;if(t===null||!(t instanceof O))return T.Buffer.alloc(0);let n=[],r=0;try{for await(let i of t){if(e.size>0&&r+i.length>e.size){let n=new P(`content size at ${e.url} over limit: ${e.size}`,`max-size`);throw t.destroy(n),n}r+=i.length,n.push(i)}}catch(t){throw t instanceof Ae?t:new P(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,`system`,t)}if(t.readableEnded===!0||t._readableState.ended===!0)try{return n.every(e=>typeof e==`string`)?T.Buffer.from(n.join(``)):T.Buffer.concat(n,r)}catch(t){throw new P(`Could not create Buffer from response body for ${e.url}: ${t.message}`,`system`,t)}else throw new P(`Premature close of server response while trying to fetch ${e.url}`)}o(L,`consumeBody`);let Be=o((e,t)=>{let n,r,{body:i}=e[F];if(e.bodyUsed)throw Error(`cannot clone body after it is used`);return i instanceof O&&typeof i.getBoundary!=`function`&&(n=new w.PassThrough({highWaterMark:t}),r=new w.PassThrough({highWaterMark:t}),i.pipe(n),i.pipe(r),e[F].stream=n,i=r),i},`clone`),Ve=E.deprecate(e=>e.getBoundary(),`form-data doesn't follow the spec and requires special treatment. Use alternative package`,`https://github.com/node-fetch/node-fetch/issues/1167`),He=o((e,t)=>e===null?null:typeof e==`string`?`text/plain;charset=UTF-8`:Ne(e)?`application/x-www-form-urlencoded;charset=UTF-8`:Pe(e)?e.type||null:T.Buffer.isBuffer(e)||E.types.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e instanceof N?`multipart/form-data; boundary=${t[F].boundary}`:e&&typeof e.getBoundary==`function`?`multipart/form-data;boundary=${Ve(e)}`:e instanceof O?null:`text/plain;charset=UTF-8`,`extractContentType`),Ue=o(e=>{let{body:t}=e[F];return t===null?0:Pe(t)?t.size:T.Buffer.isBuffer(t)?t.length:t&&typeof t.getLengthSync==`function`&&t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null},`getTotalBytes`),We=o(async(e,{body:t})=>{t===null?e.end():await Re(t,e)},`writeToStream`),Ge=typeof ce.validateHeaderName==`function`?ce.validateHeaderName:e=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let t=TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(t,`code`,{value:`ERR_INVALID_HTTP_TOKEN`}),t}},Ke=typeof ce.validateHeaderValue==`function`?ce.validateHeaderValue:(e,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){let t=TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(t,`code`,{value:`ERR_INVALID_CHAR`}),t}},qe=class e extends URLSearchParams{constructor(t){let n=[];if(t instanceof e){let e=t.raw();for(let[t,r]of Object.entries(e))n.push(...r.map(e=>[t,e]))}else if(t!=null)if(typeof t==`object`&&!E.types.isBoxedPrimitive(t)){let e=t[Symbol.iterator];if(e==null)n.push(...Object.entries(t));else{if(typeof e!=`function`)throw TypeError(`Header pairs must be iterable`);n=[...t].map(e=>{if(typeof e!=`object`||E.types.isBoxedPrimitive(e))throw TypeError(`Each header pair must be an iterable object`);return[...e]}).map(e=>{if(e.length!==2)throw TypeError(`Each header pair must be a name/value tuple`);return[...e]})}}else throw TypeError(`Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)`);return n=n.length>0?n.map(([e,t])=>(Ge(e),Ke(e,String(t)),[String(e).toLowerCase(),String(t)])):void 0,super(n),new Proxy(this,{get(e,t,n){switch(t){case`append`:case`set`:return(n,r)=>(Ge(n),Ke(n,String(r)),URLSearchParams.prototype[t].call(e,String(n).toLowerCase(),String(r)));case`delete`:case`has`:case`getAll`:return n=>(Ge(n),URLSearchParams.prototype[t].call(e,String(n).toLowerCase()));case`keys`:return()=>(e.sort(),new Set(URLSearchParams.prototype.keys.call(e)).keys());default:return Reflect.get(e,t,n)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let t=this.getAll(e);if(t.length===0)return null;let n=t.join(`, `);return/^content-encoding$/i.test(e)&&(n=n.toLowerCase()),n}forEach(e,t=void 0){for(let n of this.keys())Reflect.apply(e,t,[this.get(n),n,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,t)=>(e[t]=this.getAll(t),e),{})}[Symbol.for(`nodejs.util.inspect.custom`)](){return[...this.keys()].reduce((e,t)=>{let n=this.getAll(t);return t===`host`?e[t]=n[0]:e[t]=n.length>1?n:n[0],e},{})}};o(qe,`Headers`);let R=qe;Object.defineProperties(R.prototype,[`get`,`entries`,`forEach`,`values`].reduce((e,t)=>(e[t]={enumerable:!0},e),{}));function Je(e=[]){return new R(e.reduce((e,t,n,r)=>(n%2==0&&e.push(r.slice(n,n+2)),e),[]).filter(([e,t])=>{try{return Ge(e),Ke(e,String(t)),!0}catch{return!1}}))}o(Je,`fromRawHeaders`);let Ye=new Set([301,302,303,307,308]),Xe=o(e=>Ye.has(e),`isRedirect`),z=Symbol(`Response internals`),B=class e extends I{constructor(e=null,t={}){super(e,t);let n=t.status==null?200:t.status,r=new R(t.headers);if(e!==null&&!r.has(`Content-Type`)){let t=He(e,this);t&&r.append(`Content-Type`,t)}this[z]={type:`default`,url:t.url,status:n,statusText:t.statusText||``,headers:r,counter:t.counter,highWaterMark:t.highWaterMark}}get type(){return this[z].type}get url(){return this[z].url||``}get status(){return this[z].status}get ok(){return this[z].status>=200&&this[z].status<300}get redirected(){return this[z].counter>0}get statusText(){return this[z].statusText}get headers(){return this[z].headers}get highWaterMark(){return this[z].highWaterMark}clone(){return new e(Be(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(t,n=302){if(!Xe(n))throw RangeError(`Failed to execute "redirect" on "response": Invalid status code`);return new e(null,{headers:{location:new URL(t).toString()},status:n})}static error(){let t=new e(null,{status:0,statusText:``});return t[z].type=`error`,t}static json(t=void 0,n={}){let r=JSON.stringify(t);if(r===void 0)throw TypeError(`data is not JSON serializable`);let i=new R(n&&n.headers);return i.has(`content-type`)||i.set(`content-type`,`application/json`),new e(r,{...n,headers:i})}get[Symbol.toStringTag](){return`Response`}};o(B,`Response`);let V=B;Object.defineProperties(V.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});let Ze=o(e=>{if(e.search)return e.search;let t=e.href.length-1,n=e.hash||(e.href[t]===`#`?`#`:``);return e.href[t-n.length]===`?`?`?`:``},`getSearch`);function Qe(e,t=!1){return e==null||(e=new URL(e),/^(about|blob|data):$/.test(e.protocol))?`no-referrer`:(e.username=``,e.password=``,e.hash=``,t&&(e.pathname=``,e.search=``),e)}o(Qe,`stripURLForUseAsAReferrer`);let $e=new Set([``,`no-referrer`,`no-referrer-when-downgrade`,`same-origin`,`origin`,`strict-origin`,`origin-when-cross-origin`,`strict-origin-when-cross-origin`,`unsafe-url`]);function et(e){if(!$e.has(e))throw TypeError(`Invalid referrerPolicy: ${e}`);return e}o(et,`validateReferrerPolicy`);function tt(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let t=e.host.replace(/(^\[)|(]$)/g,``),n=D.isIP(t);return n===4&&/^127\./.test(t)||n===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(t)?!0:e.host===`localhost`||e.host.endsWith(`.localhost`)?!1:e.protocol===`file:`}o(tt,`isOriginPotentiallyTrustworthy`);function H(e){return/^about:(blank|srcdoc)$/.test(e)||e.protocol===`data:`||/^(blob|filesystem):$/.test(e.protocol)?!0:tt(e)}o(H,`isUrlPotentiallyTrustworthy`);function U(e,{referrerURLCallback:t,referrerOriginCallback:n}={}){if(e.referrer===`no-referrer`||e.referrerPolicy===``)return null;let r=e.referrerPolicy;if(e.referrer===`about:client`)return`no-referrer`;let i=e.referrer,a=Qe(i),o=Qe(i,!0);a.toString().length>4096&&(a=o),t&&(a=t(a)),n&&(o=n(o));let s=new URL(e.url);switch(r){case`no-referrer`:return`no-referrer`;case`origin`:return o;case`unsafe-url`:return a;case`strict-origin`:return H(a)&&!H(s)?`no-referrer`:o.toString();case`strict-origin-when-cross-origin`:return a.origin===s.origin?a:H(a)&&!H(s)?`no-referrer`:o;case`same-origin`:return a.origin===s.origin?a:`no-referrer`;case`origin-when-cross-origin`:return a.origin===s.origin?a:o;case`no-referrer-when-downgrade`:return H(a)&&!H(s)?`no-referrer`:a;default:throw TypeError(`Invalid referrerPolicy: ${r}`)}}o(U,`determineRequestsReferrer`);function nt(e){let t=(e.get(`referrer-policy`)||``).split(/[,\s]+/),n=``;for(let e of t)e&&$e.has(e)&&(n=e);return n}o(nt,`parseReferrerPolicyFromHeader`);let W=Symbol(`Request internals`),rt=o(e=>typeof e==`object`&&typeof e[W]==`object`,`isRequest`),it=E.deprecate(()=>{},`.data is not a valid RequestInit property, use .body instead`,`https://github.com/node-fetch/node-fetch/issues/1000 (request)`),at=class e extends I{constructor(e,t={}){let n;if(rt(e)?n=new URL(e.url):(n=new URL(e),e={}),n.username!==``||n.password!==``)throw TypeError(`${n} is an url with embedded credentials.`);let r=t.method||e.method||`GET`;if(/^(delete|get|head|options|post|put)$/i.test(r)&&(r=r.toUpperCase()),!rt(t)&&`data`in t&&it(),(t.body!=null||rt(e)&&e.body!==null)&&(r===`GET`||r===`HEAD`))throw TypeError(`Request with GET/HEAD method cannot have body`);let i=t.body?t.body:rt(e)&&e.body!==null?Be(e):null;super(i,{size:t.size||e.size||0});let a=new R(t.headers||e.headers||{});if(i!==null&&!a.has(`Content-Type`)){let e=He(i,this);e&&a.set(`Content-Type`,e)}let o=rt(e)?e.signal:null;if(`signal`in t&&(o=t.signal),o!=null&&!Fe(o))throw TypeError(`Expected signal to be an instanceof AbortSignal or EventTarget`);let s=t.referrer==null?e.referrer:t.referrer;if(s===``)s=`no-referrer`;else if(s){let e=new URL(s);s=/^about:(\/\/)?client$/.test(e)?`client`:e}else s=void 0;this[W]={method:r,redirect:t.redirect||e.redirect||`follow`,headers:a,parsedURL:n,signal:o,referrer:s},this.follow=t.follow===void 0?e.follow===void 0?20:e.follow:t.follow,this.compress=t.compress===void 0?e.compress===void 0?!0:e.compress:t.compress,this.counter=t.counter||e.counter||0,this.agent=t.agent||e.agent,this.highWaterMark=t.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=t.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=t.referrerPolicy||e.referrerPolicy||``}get method(){return this[W].method}get url(){return ie.format(this[W].parsedURL)}get headers(){return this[W].headers}get redirect(){return this[W].redirect}get signal(){return this[W].signal}get referrer(){if(this[W].referrer===`no-referrer`)return``;if(this[W].referrer===`client`)return`about:client`;if(this[W].referrer)return this[W].referrer.toString()}get referrerPolicy(){return this[W].referrerPolicy}set referrerPolicy(e){this[W].referrerPolicy=et(e)}clone(){return new e(this)}get[Symbol.toStringTag](){return`Request`}};o(at,`Request`);let ot=at;Object.defineProperties(ot.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});let st=o(e=>{let{parsedURL:t}=e[W],n=new R(e[W].headers);n.has(`Accept`)||n.set(`Accept`,`*/*`);let r=null;if(e.body===null&&/^(post|put)$/i.test(e.method)&&(r=`0`),e.body!==null){let t=Ue(e);typeof t==`number`&&!Number.isNaN(t)&&(r=String(t))}r&&n.set(`Content-Length`,r),e.referrerPolicy===``&&(e.referrerPolicy=`strict-origin-when-cross-origin`),e.referrer&&e.referrer!==`no-referrer`?e[W].referrer=U(e):e[W].referrer=`no-referrer`,e[W].referrer instanceof URL&&n.set(`Referer`,e.referrer),n.has(`User-Agent`)||n.set(`User-Agent`,`node-fetch`),e.compress&&!n.has(`Accept-Encoding`)&&n.set(`Accept-Encoding`,`gzip, deflate, br`);let{agent:i}=e;typeof i==`function`&&(i=i(t));let a=Ze(t);return{parsedURL:t,options:{path:t.pathname+a,method:e.method,headers:n[Symbol.for(`nodejs.util.inspect.custom`)](),insecureHTTPParser:e.insecureHTTPParser,agent:i}}},`getNodeRequestOptions`),ct=class extends Ae{constructor(e,t=`aborted`){super(e,t)}};o(ct,`AbortError`);let lt=ct;
14
14
  /*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */var ut,dt;function ft(){if(dt)return ut;if(dt=1,!globalThis.DOMException)try{let{MessageChannel:e}=n(`worker_threads`),t=new e().port1,r=new ArrayBuffer;t.postMessage(r,[r,r])}catch(e){e.constructor.name===`DOMException`&&(globalThis.DOMException=e.constructor)}return ut=globalThis.DOMException,ut}o(ft,`requireNodeDomexception`);var pt=ft();let mt=re.getDefaultExportFromCjs(pt),{stat:ht}=ae.promises,gt=o((e,t)=>bt(ae.statSync(e),e,t),`blobFromSync`),_t=o((e,t)=>ht(e).then(n=>bt(n,e,t)),`blobFrom`),vt=o((e,t)=>ht(e).then(n=>xt(n,e,t)),`fileFrom`),yt=o((e,t)=>xt(ae.statSync(e),e,t),`fileFromSync`),bt=o((e,t,n=``)=>new ye([new Ct({path:t,size:e.size,lastModified:e.mtimeMs,start:0})],{type:n}),`fromBlob`),xt=o((e,t,n=``)=>new be([new Ct({path:t,size:e.size,lastModified:e.mtimeMs,start:0})],oe.basename(t),{type:n,lastModified:e.mtimeMs}),`fromFile`),St=class e{constructor(e){l(this,x),l(this,S),u(this,x,e.path),u(this,S,e.start),this.size=e.size,this.lastModified=e.lastModified}slice(t,n){return new e({path:c(this,x),lastModified:this.lastModified,size:n-t,start:c(this,S)+t})}async*stream(){let{mtimeMs:e}=await ht(c(this,x));if(e>this.lastModified)throw new mt(`The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.`,`NotReadableError`);yield*ae.createReadStream(c(this,x),{start:c(this,S),end:c(this,S)+this.size-1})}get[Symbol.toStringTag](){return`Blob`}};x=new WeakMap,S=new WeakMap,o(St,`BlobDataItem`);let Ct=St,G=new Set([`data:`,`http:`,`https:`]);async function wt(e,t){return new Promise((n,r)=>{let i=new ot(e,t),{parsedURL:a,options:s}=st(i);if(!G.has(a.protocol))throw TypeError(`node-fetch cannot load ${e}. URL scheme "${a.protocol.replace(/:$/,``)}" is not supported.`);if(a.protocol===`data:`){let e=de(i.url);n(new V(e,{headers:{"Content-Type":e.typeFull}}));return}let c=(a.protocol===`https:`?le:ce).request,{signal:l}=i,u=null,d=o(()=>{let e=new lt(`The operation was aborted.`);r(e),i.body&&i.body instanceof O.Readable&&i.body.destroy(e),!(!u||!u.body)&&u.body.emit(`error`,e)},`abort`);if(l&&l.aborted){d();return}let f=o(()=>{d(),m()},`abortAndFinalize`),p=c(a.toString(),s);l&&l.addEventListener(`abort`,f);let m=o(()=>{p.abort(),l&&l.removeEventListener(`abort`,f)},`finalize`);p.on(`error`,e=>{r(new P(`request to ${i.url} failed, reason: ${e.message}`,`system`,e)),m()}),Tt(p,e=>{u&&u.body&&u.body.destroy(e)}),process.version<`v14`&&p.on(`socket`,e=>{let t;e.prependListener(`end`,()=>{t=e._eventsCount}),e.prependListener(`close`,n=>{if(u&&t<e._eventsCount&&!n){let e=Error(`Premature close`);e.code=`ERR_STREAM_PREMATURE_CLOSE`,u.body.emit(`error`,e)}})}),p.on(`response`,e=>{p.setTimeout(0);let a=Je(e.rawHeaders);if(Xe(e.statusCode)){let o=a.get(`Location`),s=null;try{s=o===null?null:new URL(o,i.url)}catch{if(i.redirect!==`manual`){r(new P(`uri requested responds with an invalid redirect URL: ${o}`,`invalid-redirect`)),m();return}}switch(i.redirect){case`error`:r(new P(`uri requested responds with a redirect, redirect mode is set to error: ${i.url}`,`no-redirect`)),m();return;case`manual`:break;case`follow`:{if(s===null)break;if(i.counter>=i.follow){r(new P(`maximum redirect reached at: ${i.url}`,`max-redirect`)),m();return}let o={headers:new R(i.headers),follow:i.follow,counter:i.counter+1,agent:i.agent,compress:i.compress,method:i.method,body:Be(i),signal:i.signal,size:i.size,referrer:i.referrer,referrerPolicy:i.referrerPolicy};if(!Ie(i.url,s)||!Le(i.url,s))for(let e of[`authorization`,`www-authenticate`,`cookie`,`cookie2`])o.headers.delete(e);if(e.statusCode!==303&&i.body&&t.body instanceof O.Readable){r(new P(`Cannot follow redirect with body being a readable stream`,`unsupported-redirect`)),m();return}(e.statusCode===303||(e.statusCode===301||e.statusCode===302)&&i.method===`POST`)&&(o.method=`GET`,o.body=void 0,o.headers.delete(`content-length`));let c=nt(a);c&&(o.referrerPolicy=c),n(wt(new ot(s,o))),m();return}default:return r(TypeError(`Redirect option '${i.redirect}' is not a valid value of RequestRedirect`))}}l&&e.once(`end`,()=>{l.removeEventListener(`abort`,f)});let o=w.pipeline(e,new w.PassThrough,e=>{e&&r(e)});process.version<`v12.10`&&e.on(`aborted`,f);let s={url:i.url,status:e.statusCode,statusText:e.statusMessage,headers:a,size:i.size,counter:i.counter,highWaterMark:i.highWaterMark},c=a.get(`Content-Encoding`);if(!i.compress||i.method===`HEAD`||c===null||e.statusCode===204||e.statusCode===304){u=new V(o,s),n(u);return}let d={flush:ue.Z_SYNC_FLUSH,finishFlush:ue.Z_SYNC_FLUSH};if(c===`gzip`||c===`x-gzip`){o=w.pipeline(o,ue.createGunzip(d),e=>{e&&r(e)}),u=new V(o,s),n(u);return}if(c===`deflate`||c===`x-deflate`){let t=w.pipeline(e,new w.PassThrough,e=>{e&&r(e)});t.once(`data`,e=>{o=(e[0]&15)==8?w.pipeline(o,ue.createInflate(),e=>{e&&r(e)}):w.pipeline(o,ue.createInflateRaw(),e=>{e&&r(e)}),u=new V(o,s),n(u)}),t.once(`end`,()=>{u||(u=new V(o,s),n(u))});return}if(c===`br`){o=w.pipeline(o,ue.createBrotliDecompress(),e=>{e&&r(e)}),u=new V(o,s),n(u);return}u=new V(o,s),n(u)}),We(p,i).catch(r)})}o(wt,`fetch$1`);function Tt(e,t){let n=T.Buffer.from(`0\r
15
15
  \r
16
16
  `),r=!1,i=!1,a;e.on(`response`,e=>{let{headers:t}=e;r=t[`transfer-encoding`]===`chunked`&&!t[`content-length`]}),e.on(`socket`,s=>{let c=o(()=>{if(r&&!i){let e=Error(`Premature close`);e.code=`ERR_STREAM_PREMATURE_CLOSE`,t(e)}},`onSocketClose`),l=o(e=>{i=T.Buffer.compare(e.slice(-5),n)===0,!i&&a&&(i=T.Buffer.compare(a.slice(-3),n.slice(0,3))===0&&T.Buffer.compare(e.slice(-2),n.slice(3))===0),a=e},`onData`);s.prependListener(`close`,c),s.on(`data`,l),e.on(`close`,()=>{s.removeListener(`close`,c),s.removeListener(`data`,l)})})}o(Tt,`fixResponseChunkedTransferBadEnding`);let Et=new WeakMap,Dt=new WeakMap;function K(e){let t=Et.get(e);return console.assert(t!=null,`'this' is expected an Event object, but got`,e),t}o(K,`pd`);function Ot(e){if(e.passiveListener!=null){typeof console<`u`&&typeof console.error==`function`&&console.error(`Unable to preventDefault inside passive event listener invocation.`,e.passiveListener);return}e.event.cancelable&&(e.canceled=!0,typeof e.event.preventDefault==`function`&&e.event.preventDefault())}o(Ot,`setCancelFlag`);function kt(e,t){Et.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,`isTrusted`,{value:!1,enumerable:!0});let n=Object.keys(t);for(let e=0;e<n.length;++e){let t=n[e];t in this||Object.defineProperty(this,t,At(t))}}o(kt,`Event`),kt.prototype={get type(){return K(this).event.type},get target(){return K(this).eventTarget},get currentTarget(){return K(this).currentTarget},composedPath(){let e=K(this).currentTarget;return e==null?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return K(this).eventPhase},stopPropagation(){let e=K(this);e.stopped=!0,typeof e.event.stopPropagation==`function`&&e.event.stopPropagation()},stopImmediatePropagation(){let e=K(this);e.stopped=!0,e.immediateStopped=!0,typeof e.event.stopImmediatePropagation==`function`&&e.event.stopImmediatePropagation()},get bubbles(){return!!K(this).event.bubbles},get cancelable(){return!!K(this).event.cancelable},preventDefault(){Ot(K(this))},get defaultPrevented(){return K(this).canceled},get composed(){return!!K(this).event.composed},get timeStamp(){return K(this).timeStamp},get srcElement(){return K(this).eventTarget},get cancelBubble(){return K(this).stopped},set cancelBubble(e){if(!e)return;let t=K(this);t.stopped=!0,typeof t.event.cancelBubble==`boolean`&&(t.event.cancelBubble=!0)},get returnValue(){return!K(this).canceled},set returnValue(e){e||Ot(K(this))},initEvent(){}},Object.defineProperty(kt.prototype,`constructor`,{value:kt,configurable:!0,writable:!0}),typeof window<`u`&&typeof window.Event<`u`&&(Object.setPrototypeOf(kt.prototype,window.Event.prototype),Dt.set(window.Event.prototype,kt));function At(e){return{get(){return K(this).event[e]},set(t){K(this).event[e]=t},configurable:!0,enumerable:!0}}o(At,`defineRedirectDescriptor`);function jt(e){return{value(){let t=K(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}o(jt,`defineCallDescriptor`);function Mt(e,t){let n=Object.keys(t);if(n.length===0)return e;function r(t,n){e.call(this,t,n)}o(r,`CustomEvent`),r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let i=0;i<n.length;++i){let a=n[i];if(!(a in e.prototype)){let e=typeof Object.getOwnPropertyDescriptor(t,a).value==`function`;Object.defineProperty(r.prototype,a,e?jt(a):At(a))}}return r}o(Mt,`defineWrapper`);function Nt(e){if(e==null||e===Object.prototype)return kt;let t=Dt.get(e);return t??(t=Mt(Nt(Object.getPrototypeOf(e)),e),Dt.set(e,t)),t}o(Nt,`getWrapper`);function Pt(e,t){return new(Nt(Object.getPrototypeOf(t)))(e,t)}o(Pt,`wrapEvent`);function Ft(e){return K(e).immediateStopped}o(Ft,`isStopped`);function It(e,t){K(e).eventPhase=t}o(It,`setEventPhase`);function Lt(e,t){K(e).currentTarget=t}o(Lt,`setCurrentTarget`);function Rt(e,t){K(e).passiveListener=t}o(Rt,`setPassiveListener`);let zt=new WeakMap;function Bt(e){return typeof e==`object`&&!!e}o(Bt,`isObject`);function Vt(e){let t=zt.get(e);if(t==null)throw TypeError(`'this' is expected an EventTarget object, but got another value.`);return t}o(Vt,`getListeners`);function q(e){return{get(){let t=Vt(this).get(e);for(;t!=null;){if(t.listenerType===3)return t.listener;t=t.next}return null},set(t){typeof t!=`function`&&!Bt(t)&&(t=null);let n=Vt(this),r=null,i=n.get(e);for(;i!=null;)i.listenerType===3?r===null?i.next===null?n.delete(e):n.set(e,i.next):r.next=i.next:r=i,i=i.next;if(t!==null){let i={listener:t,listenerType:3,passive:!1,once:!1,next:null};r===null?n.set(e,i):r.next=i}},configurable:!0,enumerable:!0}}o(q,`defineEventAttributeDescriptor`);function J(e,t){Object.defineProperty(e,`on${t}`,q(t))}o(J,`defineEventAttribute`);function Ht(e){function t(){Y.call(this)}o(t,`CustomEventTarget`),t.prototype=Object.create(Y.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)J(t.prototype,e[n]);return t}o(Ht,`defineCustomEventTarget`);function Y(){if(this instanceof Y){zt.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return Ht(arguments[0]);if(arguments.length>0){let e=Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return Ht(e)}throw TypeError(`Cannot call a class as a function`)}o(Y,`EventTarget`),Y.prototype={addEventListener(e,t,n){if(t==null)return;if(typeof t!=`function`&&!Bt(t))throw TypeError(`'listener' should be a function or an object.`);let r=Vt(this),i=Bt(n),a=(i?n.capture:n)?1:2,o={listener:t,listenerType:a,passive:i&&!!n.passive,once:i&&!!n.once,next:null},s=r.get(e);if(s===void 0){r.set(e,o);return}let c=null;for(;s!=null;){if(s.listener===t&&s.listenerType===a)return;c=s,s=s.next}c.next=o},removeEventListener(e,t,n){if(t==null)return;let r=Vt(this),i=(Bt(n)?n.capture:n)?1:2,a=null,o=r.get(e);for(;o!=null;){if(o.listener===t&&o.listenerType===i){a===null?o.next===null?r.delete(e):r.set(e,o.next):a.next=o.next;return}a=o,o=o.next}},dispatchEvent(e){if(e==null||typeof e.type!=`string`)throw TypeError(`"event.type" should be a string.`);let t=Vt(this),n=e.type,r=t.get(n);if(r==null)return!0;let i=Pt(this,e),a=null;for(;r!=null;){if(r.once?a===null?r.next===null?t.delete(n):t.set(n,r.next):a.next=r.next:a=r,Rt(i,r.passive?r.listener:null),typeof r.listener==`function`)try{r.listener.call(this,i)}catch(e){typeof console<`u`&&typeof console.error==`function`&&console.error(e)}else r.listenerType!==3&&typeof r.listener.handleEvent==`function`&&r.listener.handleEvent(i);if(Ft(i))break;r=r.next}return Rt(i,null),It(i,0),Lt(i,null),!i.defaultPrevented}},Object.defineProperty(Y.prototype,`constructor`,{value:Y,configurable:!0,writable:!0}),typeof window<`u`&&typeof window.EventTarget<`u`&&Object.setPrototypeOf(Y.prototype,window.EventTarget.prototype);let Ut=class extends Y{constructor(){throw super(),TypeError(`AbortSignal cannot be constructed directly`)}get aborted(){let e=qt.get(this);if(typeof e!=`boolean`)throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?`null`:typeof this}`);return e}};o(Ut,`AbortSignal`);let Wt=Ut;J(Wt.prototype,`abort`);function Gt(){let e=Object.create(Wt.prototype);return Y.call(e),qt.set(e,!1),e}o(Gt,`createAbortSignal`);function Kt(e){qt.get(e)===!1&&(qt.set(e,!0),e.dispatchEvent({type:`abort`}))}o(Kt,`abortSignal`);let qt=new WeakMap;Object.defineProperties(Wt.prototype,{aborted:{enumerable:!0}}),typeof Symbol==`function`&&typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Wt.prototype,Symbol.toStringTag,{configurable:!0,value:`AbortSignal`});let Jt=(C=class{constructor(){Yt.set(this,Gt())}get signal(){return Xt(this)}abort(){Kt(Xt(this))}},o(C,`AbortController`),C),Yt=new WeakMap;function Xt(e){let t=Yt.get(e);if(t==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${e===null?`null`:typeof e}`);return t}o(Xt,`getSignal`),Object.defineProperties(Jt.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==`function`&&typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Jt.prototype,Symbol.toStringTag,{configurable:!0,value:`AbortController`});var Zt=Object.defineProperty,Qt=o((e,t)=>Zt(e,`name`,{value:t,configurable:!0}),`e`);let $t=wt;en();function en(){!globalThis.process?.versions?.node&&!globalThis.process?.env?.DISABLE_NODE_FETCH_NATIVE_WARN&&console.warn("[node-fetch-native] Node.js compatible build of `node-fetch-native` is being used in a non-Node.js environment. Please make sure you are using proper export conditions or report this issue to https://github.com/unjs/node-fetch-native. You can set `process.env.DISABLE_NODE_FETCH_NATIVE_WARN` to disable this warning.")}o(en,`s`),Qt(en,`checkNodeEnvironment`),t.AbortController=Jt,t.AbortError=lt,t.Blob=ye,t.FetchError=P,t.File=be,t.FormData=N,t.Headers=R,t.Request=ot,t.Response=V,t.blobFrom=_t,t.blobFromSync=gt,t.default=$t,t.fetch=$t,t.fileFrom=vt,t.fileFromSync=yt,t.isRedirect=Xe}));export{r as n,i as t};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@barbapapazes/video-toolkit",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.3.0",
5
5
  "author": "Estéban Soubiran <esteban@soubiran.dev>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/Barbapapazes",
@@ -12,6 +12,14 @@
12
12
  "directory": "packages/@barbapapazes/video-toolkit"
13
13
  },
14
14
  "bugs": "https://github.com/Barbapapazes/platform/issues",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.mts",
18
+ "import": "./dist/index.mjs"
19
+ }
20
+ },
21
+ "main": ".dist/index.mjs",
22
+ "types": "./dist/index.d.mts",
15
23
  "bin": {
16
24
  "video-toolkit": "./dist/cli.mjs"
17
25
  },
File without changes
File without changes
File without changes
File without changes
File without changes