conformtools 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/{chunk-R7P7WVNI.js → chunk-42QQI3WX.js} +1 -1
- package/dist/{chunk-WE4S4PEA.js → chunk-BW2NQ54J.js} +1 -1
- package/dist/{chunk-JBSH4AK3.js → chunk-CL26XMDO.js} +1 -1
- package/dist/{chunk-FMYTLXWN.js → chunk-EO5NIBOV.js} +1 -1
- package/dist/{chunk-5K56Q5EX.js → chunk-EPZ6NWE4.js} +1 -1
- package/dist/{chunk-D2RXAX5C.js → chunk-HKP4P6JN.js} +1 -1
- package/dist/{chunk-LO4K2ZF3.js → chunk-JB7PR2TQ.js} +1 -1
- package/dist/chunk-QTKRMXL5.js +363 -0
- package/dist/{chunk-BK62N3ID.js → chunk-QTPCU2TF.js} +1 -1
- package/dist/chunk-TEZP6VEQ.js +3 -0
- package/dist/{chunk-CETBLAWM.js → chunk-WT6NIJCB.js} +1 -1
- package/dist/{claude-setup-XSNTKEU7.js → claude-setup-BM3AAUKR.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/conformtools-decode +0 -0
- package/dist/{cr3-wasm-HTRSUBJK.js → cr3-wasm-WKWMEK3V.js} +1 -1
- package/dist/{dng-wasm-2I7S2SN4.js → dng-wasm-Z5OVO4UI.js} +1 -1
- package/dist/{dpx-wasm-AHH7D56L.js → dpx-wasm-QNYXAOAJ.js} +1 -1
- package/dist/{exr-wasm-3TAN64WQ.js → exr-wasm-BHSBJLQH.js} +1 -1
- package/dist/{h264-2LU2X635.js → h264-LIZVHN2W.js} +1 -1
- package/dist/{h264-mxf-5HJUSZLL.js → h264-mxf-MWS7DDV7.js} +1 -1
- package/dist/http.js +1 -1
- package/dist/i2o-transfer +0 -0
- package/dist/{inspect-NY36WVMH.js → inspect-DZF537QL.js} +1 -1
- package/dist/{isobmff-HSF7B3Y7.js → isobmff-HM3UPWPZ.js} +1 -1
- package/dist/mcp.js +8 -8
- package/dist/{media_core_bg-MEORQOCQ.js → media_core_bg-FGAR5KA5.js} +1 -1
- package/dist/{mxf-IQBPP3JA.js → mxf-K465SWBN.js} +1 -1
- package/dist/{ops-PFEKOSET.js → ops-73NR3X6R.js} +1 -1
- package/dist/{r3d-QLV4J6YF.js → r3d-RR3FUM6H.js} +1 -1
- package/dist/{r3d-YZH6X2D7.js → r3d-VUOYU2KQ.js} +1 -1
- package/dist/resolve-bridge.py +66 -8
- package/dist/{still-LORP3E5C.js → still-4G25EYN5.js} +1 -1
- package/dist/{tiff-wasm-6XFTTCL4.js → tiff-wasm-QJPCR7JT.js} +1 -1
- package/dist/{wav-PMVKVYNP.js → wav-63QF6SCT.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-D5DEQ467.js +0 -3
- package/dist/chunk-EV52G33S.js +0 -354
- /package/dist/{arriraw-GUQEZ7CH.js → arriraw-3GKCR6K2.js} +0 -0
- /package/dist/{chunk-GIZIR52D.js → chunk-WHY3DVXS.js} +0 -0
- /package/dist/{media_core_bg-5QHIWEZB.js → media_core_bg-YK63OUDM.js} +0 -0
- /package/dist/{prores-BR2YURFP.js → prores-L4JZZWGH.js} +0 -0
- /package/dist/{timeline_core_bg-DFKQ7XOU.js → timeline_core_bg-2TYWZ35G.js} +0 -0
- /package/dist/{udf_bg-ZIB3GK52.js → udf_bg-A4WEMSAX.js} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
var s={scrub:{output:"rgba8",detail:"coarse"},thumbnail:{output:"rgba8",detail:"coarse"},park:{output:"rgba8",detail:"exact"},render:{output:"rgba8",detail:"exact"},transcode:{output:"rgb16",detail:"exact"}};function p(e){let t=new DataView(e.buffer,e.byteOffset,8),r=t.getUint32(0,!0),n=t.getUint32(4,!0),o=e.slice(8);return{width:r,height:n,rgb16:new Uint16Array(o.buffer,o.byteOffset,r*n*3)}}var a=class extends Error{constructor(r,n){super(`COVERAGE_MISS: frame ${r} not in linked media (${n} frames)`);this.index=r;this.frameCount=n;this.name="CoverageMissError"}},m=/(?:[A-Z0-9]+_)?COVERAGE_MISS\s+(\{[\s\S]*\})/;function u(e){let r=(e instanceof Error?e.message:String(e??"")).match(m);if(!r)return null;try{return JSON.parse(r[1])}catch{return{reason:"coverage_miss"}}}var i=class extends Error{constructor(r){super(`DELIVERY_COVERAGE_MISS: ${r.reason}`+(r.cut_in!=null?` cut [${r.cut_in}..${r.cut_out}] file_frames ${r.file_frames}`:""));this.detail=r;this.name="DeliveryCoverageMissError"}};function l(e){return e instanceof i?e.detail:u(e)}var d={mov:()=>import("./isobmff-
|
|
3
|
+
var s={scrub:{output:"rgba8",detail:"coarse"},thumbnail:{output:"rgba8",detail:"coarse"},park:{output:"rgba8",detail:"exact"},render:{output:"rgba8",detail:"exact"},transcode:{output:"rgb16",detail:"exact"}};function p(e){let t=new DataView(e.buffer,e.byteOffset,8),r=t.getUint32(0,!0),n=t.getUint32(4,!0),o=e.slice(8);return{width:r,height:n,rgb16:new Uint16Array(o.buffer,o.byteOffset,r*n*3)}}var a=class extends Error{constructor(r,n){super(`COVERAGE_MISS: frame ${r} not in linked media (${n} frames)`);this.index=r;this.frameCount=n;this.name="CoverageMissError"}},m=/(?:[A-Z0-9]+_)?COVERAGE_MISS\s+(\{[\s\S]*\})/;function u(e){let r=(e instanceof Error?e.message:String(e??"")).match(m);if(!r)return null;try{return JSON.parse(r[1])}catch{return{reason:"coverage_miss"}}}var i=class extends Error{constructor(r){super(`DELIVERY_COVERAGE_MISS: ${r.reason}`+(r.cut_in!=null?` cut [${r.cut_in}..${r.cut_out}] file_frames ${r.file_frames}`:""));this.detail=r;this.name="DeliveryCoverageMissError"}};function l(e){return e instanceof i?e.detail:u(e)}var d={mov:()=>import("./isobmff-HM3UPWPZ.js").then(e=>e.isobmffFormat),crm:()=>import("./isobmff-HM3UPWPZ.js").then(e=>e.isobmffFormat),braw:()=>import("./isobmff-HM3UPWPZ.js").then(e=>e.isobmffFormat),wav:()=>import("./wav-63QF6SCT.js").then(e=>e.wavFormat),mxf:()=>import("./mxf-K465SWBN.js").then(e=>e.mxfFormat),r3d:()=>import("./r3d-RR3FUM6H.js").then(e=>e.r3dFormat),still:()=>import("./still-4G25EYN5.js").then(e=>e.stillFormat),avc1:()=>import("./h264-LIZVHN2W.js").then(e=>e.h264Format),avc3:()=>import("./h264-LIZVHN2W.js").then(e=>e.h264Format),h264:()=>import("./h264-LIZVHN2W.js").then(e=>e.h264Format),hvc1:()=>import("./h264-LIZVHN2W.js").then(e=>e.h264Format),hev1:()=>import("./h264-LIZVHN2W.js").then(e=>e.h264Format),hevc:()=>import("./h264-LIZVHN2W.js").then(e=>e.h264Format),h264_mxf:()=>import("./h264-mxf-MWS7DDV7.js").then(e=>e.h264MxfFormat)};async function c(e){let t=d[e];return t?await t():null}async function f(e){let t=await c(e.format);if(!t)throw new Error(`extract: no handler for format '${e.format}'`);return t.extract(e)}async function b(e,t){let r=await c(e.format);if(!r){if(t.verb==="inspect")return null;throw new Error(`mediaOp: no handler for format '${e.format}' (verb ${t.verb})`)}switch(t.verb){case"inspect":{let n=await r.inspect(e);return n&&(n.source_facts_origin="probed"),n}case"sparsify":return r.sparsify(e,t.selection);case"trim":return r.trim(e,t.selection);case"decode":{let{output:n,detail:o}=s[t.intent];if(n==="rgb16"){if(!r.decode16)throw new Error(`mediaOp: format '${e.format}' has no 16-bit decoder (intent '${t.intent}')`);return r.decode16(e,t.index)}if(!r.decode)throw new Error(`mediaOp: format '${e.format}' has no decoder (no viewer)`);return r.decode(e,t.index,{detail:o})}}}export{s as a,p as b,a as c,u as d,i as e,l as f,c as g,f as h,b as i};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{readFile as y,writeFile as P,appendFile as k,stat as f,readdir as U,mkdir as D,open as h,copyFile as O,mkdtemp as T,rm as R,chmod as $,rename as A,cp as M,statfs as S}from"node:fs/promises";import{execFile as W,spawn as F}from"node:child_process";import{createHash as E}from"node:crypto";import{createReadStream as B}from"node:fs";import{homedir as H,tmpdir as N,platform as C,release as z,arch as L,totalmem as I,availableParallelism as _}from"node:os";import{fileURLToPath as b}from"node:url";import j from"node:http";import m from"node:process";import{Buffer as x}from"node:buffer";import{join as w,resolve as v,sep as G}from"node:path";import{basename as Le,dirname as Ie,extname as _e,join as je,relative as Ge,resolve as Je}from"node:path";{let e=globalThis.fetch,t=typeof globalThis.Deno<"u";e&&!t&&(globalThis.fetch=(async(n,o)=>{let r=typeof n=="string"?n:n instanceof URL?n.href:n.url;if(r.startsWith("file:")){let i=await y(b(r)),s=r.endsWith(".wasm")?"application/wasm":"application/octet-stream";return new Response(i,{status:200,headers:{"content-type":s}})}return e(n,o)}))}var p=e=>m.env[e],ne=()=>Number(p("CONFORM_MEMORY_GB")??0)*2**30||I(),oe=()=>_(),se=()=>m.argv.slice(2),ie=e=>m.exit(e),ae=()=>m.platform,ce=()=>m.arch;function le(){let e=m.versions.deno;return{platform:`${C()} ${z()} ${L()}`,runtime:e?`deno ${e}`:`node ${m.version}`}}var me=()=>p("CONFORM_MCP_HOME")??w(g(),".conform-mcp"),g=()=>p("HOME")??H();function ue(e){let t=e.trim();if(t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1)),/^file:\/\//i.test(t))try{t=b(t)}catch{}return t==="~"?t=g():(t.startsWith("~/")||t.startsWith("~\\"))&&(t=w(g(),t.slice(2))),t&&v(t)+(/[\\/]$/.test(t)&&!/[\\/]$/.test(v(t))?G:"")}var de=e=>b(e);async function fe(e){let t=await f(e);return{isFile:t.isFile(),isDirectory:t.isDirectory(),size:t.size,mtimeMs:t.mtimeMs}}async function pe(e){try{return await f(e),!0}catch{return!1}}async function ge(e){try{return(await f(e)).isFile()}catch{return!1}}async function ye(e){try{return(await f(e)).isDirectory()}catch{return!1}}async function he(e){let t=await y(e);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}var be=e=>y(e,"utf8"),we=(e,t)=>P(e,t),xe=(e,t,n)=>n?.append?k(e,t):P(e,t);async function ve(e){await D(e,{recursive:!0})}var Pe=e=>R(e,{force:!0}),Re=(e,t)=>$(e,t).catch(()=>{}),Ae=(e,t)=>O(e,t),Fe=(e,t)=>A(e,t),ke=e=>R(e,{recursive:!0,force:!0}),Ue=(e,t)=>M(e,t,{recursive:!0,verbatimSymlinks:!0});async function De(e){try{let t=await S(e);return Number(t.bavail)*Number(t.bsize)}catch{return null}}var Oe=(e="conform-")=>T(w(N(),e));async function*Te(e){for(let t of await U(e,{withFileTypes:!0}))yield{name:t.name,isFile:t.isFile(),isDirectory:t.isDirectory()}}async function $e(e){let t=await h(e,"r"),n=(await t.stat()).size;return{path:e,size:n,async readAt(o,r){let i=new Uint8Array(r),s=0;for(;s<r;){let{bytesRead:c}=await t.read(i,s,r-s,o+s);if(!c)break;s+=c}return s===r?i:i.subarray(0,s)},close:()=>t.close()}}async function Me(e){let t=await h(e,"w");return{async writeAt(n,o){let r=0;for(;r<o.length;){let{bytesWritten:i}=await t.write(o,r,o.length-r,n+r);r+=i}},truncate:n=>t.truncate(n),close:()=>t.close()}}function J(e,t,n={}){return new Promise(o=>{W(e,t,{maxBuffer:1<<30,env:n.env?{...m.env,...n.env}:void 0,timeout:n.timeoutMs},(r,i,s)=>{let c=r?.code??0;o({success:!r,code:c,stdout:String(i),stderr:String(s)})})})}function Se(e,t,n,o={}){return new Promise((r,i)=>{let s=F(e,t,{env:o.env?{...m.env,...o.env}:void 0,stdio:["ignore","pipe","pipe"]}),c="";s.stdout.on("data",a=>n(a)),s.stderr.on("data",a=>{c+=new TextDecoder().decode(a)}),s.on("error",i),s.on("close",a=>r({code:a,stderr:c})),o.signal?.addEventListener("abort",()=>s.kill(),{once:!0})})}function We(e,t,n,o){let r=F(e,t,{stdio:["pipe","pipe","pipe"]});r.stdout.on("data",a=>n(a)),r.stderr.on("data",a=>o?.(new TextDecoder().decode(a)));let i=new Promise(a=>{r.on("close",l=>a(l)),r.on("error",()=>a(null))}),s=[r,r.stdout,r.stderr,r.stdin],c=a=>{for(let l of s)(a?l.ref:l.unref)?.call(l)};return c(!1),{write:a=>new Promise((l,u)=>{r.stdin.write(a,d=>d?u(d):l())}),hold:c,close:()=>{try{r.stdin.end(),r.kill()}catch{}},exited:i}}async function Ee(e){if(p("CONFORM_NO_BROWSER"))return!1;let[t,n]=m.platform==="darwin"?["open",[e]]:m.platform==="win32"?["cmd",["/c","start","",e.replace(/&/g,"^&")]]:["xdg-open",[e]];return(await J(t,n)).success}function Be(e,t){let n=j.createServer(async(o,r)=>{try{let i=[];if(o.method!=="GET"&&o.method!=="HEAD")for await(let u of o)i.push(u);let s=i.length>0,c=new Headers;for(let[u,d]of Object.entries(o.headers))d!=null&&c.set(u,Array.isArray(d)?d.join(", "):d);let a=`http://${o.headers.host??`${e.hostname}:${e.port}`}${o.url??"/"}`,l=await t(new Request(a,{method:o.method,headers:c,body:s?x.concat(i):void 0}));r.statusCode=l.status,l.headers.forEach((u,d)=>r.setHeader(d,u)),r.end(x.from(await l.arrayBuffer()))}catch(i){r.statusCode=500,r.end(JSON.stringify({ok:!1,code:"internal",message:i instanceof Error?i.message:String(i)}))}});return n.listen(e.port,e.hostname,()=>{let o=n.address();e.onListen?.(typeof o=="object"&&o?o.port:e.port)}),{close:()=>n.close()}}async function He(e){let t=E("sha256");for await(let n of B(e))t.update(n);return t.digest("hex")}async function Ne(e,t,n){let o=`${t}.part`;for(let r=0;;r++){let i=0;try{i=(await f(o)).size}catch{}try{let s=await fetch(e,{headers:i?{Range:`bytes=${i}-`}:{}});if(s.status===416)break;if(!s.ok||!s.body)throw new Error(`${e} answered ${s.status}`);i&&s.status!==206&&(i=0);let c=i+Number(s.headers.get("content-length")??0),a=await h(o,i?"a":"w");try{let l=i;for await(let u of s.body)await a.write(u),l+=u.length,n?.(l,c)}finally{await a.close()}break}catch(s){if(r>=4)throw s;await new Promise(c=>setTimeout(c,2e3*(r+1)))}}await A(o,t)}export{b as a,p as b,ne as c,oe as d,se as e,ie as f,ae as g,ce as h,le as i,me as j,g as k,ue as l,de as m,fe as n,pe as o,ge as p,ye as q,he as r,be as s,we as t,xe as u,ve as v,Pe as w,Re as x,Ae as y,Fe as z,ke as A,Ue as B,De as C,Oe as D,Te as E,$e as F,Me as G,J as H,Se as I,We as J,Ee as K,Be as L,He as M,Ne as N,Le as O,Ie as P,_e as Q,je as R,Ge as S,Je as T};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as m,b as l}from"./chunk-DKGGJM6Z.js";import{Aa as u,Ca as n,V as c,p as s}from"./chunk-
|
|
3
|
+
import{a as m,b as l}from"./chunk-DKGGJM6Z.js";import{Aa as u,Ca as n,V as c,p as s}from"./chunk-CL26XMDO.js";async function g(r){await n();let e=c(r);return e==="null"?null:JSON.parse(e)}async function d(r){await n();let e;try{e=s(r)}catch{return null}if(e.length<8)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=t.getUint32(0,!0),i=t.getUint32(4,!0),o=a*i*4;return e.length<8+o?null:{width:a,height:i,rgba:new Uint8ClampedArray(e.subarray(8,8+o))}}async function y(r,e=8){await n();let t=l(u,"decode_exr_preview");if(!t)return d(r);try{return m(t(r,e))}catch{return null}}export{g as a,d as b,y as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{H as h,R as c,a as m,j as w,k as $,o as i,s as b,u as v,v as R,y as k}from"./chunk-
|
|
3
|
+
import{H as h,R as c,a as m,j as w,k as $,o as i,s as b,u as v,v as R,y as k}from"./chunk-TEZP6VEQ.js";import"./chunk-PSANHDZM.js";var y="conformtools-statusline";function x(e,n){let s=e.statusLine;return s&&!String(s.command??"").includes(y)?{settings:e,result:"kept"}:s?.command===n?{settings:e,result:"updated"}:{settings:{...e,statusLine:{type:"command",command:n,padding:0}},result:s?"updated":"installed"}}async function P(){let e=new URL(import.meta.url),n=m(new URL("./statusline.js",e));if(await i(n)){await R(w());let t=c(w(),`${y}.js`);return await k(n,t),`node "${t}"`}let s=m(new URL("../adapters/statusline.ts",e));return await i(s)?`deno run --allow-read --allow-env --no-check "${s}" ${y}`:null}function L(e,n){let s=e.permissions&&typeof e.permissions=="object"?e.permissions:{},t=Array.isArray(s.allow)?s.allow.filter(o=>typeof o=="string"):[];return t.includes(n)?{settings:e,added:!1}:{settings:{...e,permissions:{...s,allow:[...t,n]}},added:!0}}async function U(e={}){let n=e.server??"conformtools",s=`mcp__${n}`,t=e.settingsPath??c($(),".claude","settings.json"),o={};if(await i(t)){let a=await b(t);try{o=a.trim()?JSON.parse(a):{}}catch(r){throw new Error(`${t} is not valid JSON (${r instanceof Error?r.message:r}); fix it first, nothing was changed`)}}let p=L(o,s),d=p.settings,l="skipped",C=p.added,S=e.statusline===!1?null:await P();if(S){let a=x(d,S);d=a.settings,l=a.result}let f;(C||l==="installed"||l==="updated"&&d!==p.settings)&&(await i(t)?(f=`${t}.conformtools-backup`,await k(t,f)):await Deno.mkdir(c(t,".."),{recursive:!0}),await v(t,JSON.stringify(d,null,2)+`
|
|
4
4
|
`));let u="skipped",g;if(e.register!==!1)try{if((await h("claude",["mcp","get",n])).code===0)u="already";else{let r=await h("claude",["mcp","add","-s","user",n,"--","npx","-y","conformtools@latest","mcp"]);u=r.code===0?"added":"failed",r.code!==0&&(g=r.stderr.trim().slice(-300))}}catch(a){u="failed",g=`claude CLI not found (${a instanceof Error?a.message:a}); add the server with: claude mcp add -s user ${n} -- npx -y conformtools@latest mcp`}return{settings:t,rule:s,added:C,backup:f,registered:u,detail:g,statusline:l}}function M(e){return[e.added?`Claude Code: allowed every conform.tools tool (${e.rule}) in ${e.settings}${e.backup?` (backup: ${e.backup})`:""}`:`Claude Code: ${e.rule} was already allowed in ${e.settings}`,{already:"MCP server: already registered",added:"MCP server: registered (claude mcp add -s user)",skipped:"MCP server: not checked",failed:`MCP server: not registered: ${e.detail??"claude mcp add failed"}`}[e.registered],{installed:"Status line: conform.tools (the running job and its progress) at the bottom of Claude Code",updated:"Status line: conform.tools, refreshed",kept:"Status line: you already have one, so it was left as it is (conformtools statusline prints ours)",skipped:"Status line: not installed"}[e.statusline],"Restart Claude Code (or /mcp) to load it. Remove the rule from permissions.allow to be asked again."].join(`
|
|
5
5
|
`)}export{U as setupClaude,M as setupText,L as withAllowRule,x as withStatusLine};
|
package/dist/cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{
|
|
3
|
+
import{$ as L,P as W,ba as J,c as A,ca as H,d as D,ea as F,f as I,fa as G}from"./chunk-QTKRMXL5.js";import{b as S,e as c,f as s}from"./chunk-TEZP6VEQ.js";import"./chunk-DRHOPOC7.js";import"./chunk-GXEVALBL.js";import"./chunk-Y2BEEOPB.js";import"./chunk-JB7PR2TQ.js";import"./chunk-C2ESM27Z.js";import"./chunk-HKP4P6JN.js";import"./chunk-EPZ6NWE4.js";import"./chunk-42QQI3WX.js";import"./chunk-6FVGUJ6L.js";import"./chunk-QDWB7QU7.js";import"./chunk-P7OVDUA5.js";import"./chunk-UCMNH6Q6.js";import"./chunk-BW2NQ54J.js";import"./chunk-WT6NIJCB.js";import"./chunk-DKGGJM6Z.js";import"./chunk-WHY3DVXS.js";import"./chunk-BUEIRRNY.js";import"./chunk-TK55FA56.js";import"./chunk-EO5NIBOV.js";import"./chunk-QTPCU2TF.js";import"./chunk-CL26XMDO.js";import"./chunk-PSANHDZM.js";var i=process.stdout,M=22,j=20,R=j/2,V=(t,n)=>Math.abs(n)<=Math.min(1-.417*Math.abs(t),2.393*(1-Math.abs(t))),ot=(t,n)=>t*t+n*n<=1;function nt(t){let n=.62**-t,l=[];for(let r=0;r<j;r++){let p=[];for(let g=0;g<M;g++){let w=(g+.5)/M*2-1,u=(r+.5)/j*2-1,d=!1;if(V(w,u))for(let $=0;$<6;$++)for(let y of[!1,!0]){let m=.62**$*(y?.77:1)*n,x=.5*Math.max(0,1-m)**2;(y?ot:V)(w/m,(u-x)/m)&&(d=!y)}p.push(d)}l.push(p)}return l}var C={C:["\u25E2\u2588\u25E3","\u2588 ","\u2588 ","\u25E5\u2588\u25E4"],O:["\u25E2\u2588\u25E3","\u2588 \u2588","\u2588 \u2588","\u25E5\u2588\u25E4"],N:["\u2588\u25E3 \u2588","\u2588\u2588\u25E3\u2588","\u2588\u25E5\u2588\u2588","\u2588 \u25E5\u2588"],F:["\u2588\u2588\u2588","\u2588\u2584\u2584","\u2588 ","\u2588 "],R:["\u2588\u2588\u25E3","\u2588 \u2588","\u2588\u2588\u25E4","\u2588 \u2588"],M:["\u2588\u25E3\u25E2\u2588","\u2588\u25E5\u25E4\u2588","\u2588 \u2588","\u2588 \u2588"],T:["\u2588\u2588\u2588"," \u2588 "," \u2588 "," \u2588 "],L:["\u2588 ","\u2588 ","\u2588 ","\u2588\u2588\u2588"],S:["\u25E2\u2588\u25E3","\u25E5\u25E3 "," \u25E5\u25E3","\u25E5\u2588\u25E4"],".":[" "," "," ","\u25CF"]},Y="CONFORM.TOOLS",et=[...Y].reduce((t,n)=>t+C[n][0].length+1,-1);async function B(t){if(!i.isTTY)return!1;let n=!!S("NO_COLOR"),l=/truecolor|24bit/i.test(S("COLORTERM")??""),r=o=>e=>n?e:`\x1B[${o}m${e}\x1B[0m`,p=r(l?"38;2;255;60;0":"38;5;202"),g=r(l?"38;2;255;222;0":"38;5;220"),w=r("1"),u=r("2"),d=(i.columns??80)>=M+4+et,$=o=>[...Y].map(e=>e==="."?p(C[e][o]):w(C[e][o])).join(" "),y=(o,e)=>d&&o>=2&&o<=5?$(o-2):!d&&o===3?`${w("conform")}${p(".")}${w("tools")}`:o===7?e:"",m=(o,e,O=[])=>{let v=nt(o),_=[];for(let f=0;f<R;f++){let X=v[2*f].map((N,tt)=>{let k=v[2*f+1][tt];return N&&k?"\u2588":N?"\u2580":k?"\u2584":" "}).join(""),Z=f>=8?O[f-8]??"":"";_.push(` ${p(X)} ${Z||y(f,e)}\x1B[K`)}return _.join(`
|
|
4
4
|
`)+`
|
|
5
5
|
`},x=null;t.account.then(o=>{x=o});let P=o=>[o/86400,o/1440%60,o/24%60,o%24].map(e=>String(Math.floor(e)).padStart(2,"0")).join(":"),Q=!S("CI")&&S("TERM")!=="dumb";if(i.write(`
|
|
6
6
|
`),Q){let o=()=>i.write("\x1B[?25h");process.once("SIGINT",()=>{o(),process.exit(130)}),i.write("\x1B[?25l"+m(0,g(`\u25B6 ${P(0)}`)));let e=Date.now(),O=0;for(;x===null||Date.now()-e<900;)await new Promise(v=>setTimeout(v,1e3/24)),O=Math.round((Date.now()-e)*24/1e3),i.write(`\x1B[${R}A\r`+m(O/22%1,`${g(`\u25B6 ${P(O)}`)} ${u("checking your account\u2026")}`));i.write(`\x1B[${R}A\r`),o()}let U=(x??await t.account).split(`
|
|
7
7
|
`);return i.write(m(0,`${u("v")}${t.version} ${u("\xB7 built by post pros")}`,U.map(o=>u(o)))),i.write(`
|
|
8
|
-
`),!0}var q=()=>B({version:I,account:Promise.race([A().catch(()=>null),new Promise(t=>setTimeout(t,1500,null))]).then(t=>t?D(t):"account: no answer (offline?)")}),rt={login:"account_login",logout:"account_logout",whoami:"account_status",status:"account_status",telemetry:"account_telemetry"};c()[0]==="mcp"&&(await import("./mcp.js"),await new Promise(()=>{}));c()[0]==="http"&&(await import("./http.js"),await new Promise(()=>{}));c()[0]==="statusline"&&((await import("./statusline-GMMCFMOA.js")).main(),s(0));if(c()[0]==="setup"){let t=c()[1];t!=="claude"&&(console.error(`conformtools setup <client>: supported: claude${t?` (not ${t} yet)`:""}`),s(2));let{setupClaude:n,setupText:l}=await import("./claude-setup-
|
|
8
|
+
`),!0}var q=()=>B({version:I,account:Promise.race([A().catch(()=>null),new Promise(t=>setTimeout(t,1500,null))]).then(t=>t?D(t):"account: no answer (offline?)")}),rt={login:"account_login",logout:"account_logout",whoami:"account_status",status:"account_status",telemetry:"account_telemetry"};c()[0]==="mcp"&&(await import("./mcp.js"),await new Promise(()=>{}));c()[0]==="http"&&(await import("./http.js"),await new Promise(()=>{}));c()[0]==="statusline"&&((await import("./statusline-GMMCFMOA.js")).main(),s(0));if(c()[0]==="setup"){let t=c()[1];t!=="claude"&&(console.error(`conformtools setup <client>: supported: claude${t?` (not ${t} yet)`:""}`),s(2));let{setupClaude:n,setupText:l}=await import("./claude-setup-BM3AAUKR.js");try{console.log(l(await n())),s(0)}catch(r){console.error(r instanceof Error?r.message:String(r)),s(1)}}var K=c().includes("--json"),[a,T]=c().filter(t=>t!=="--json");if(!a||a==="--list"||a==="help"||a==="--help"){await q(),console.log(`conformtools <verb> '<json args>' [--json]
|
|
9
9
|
|
|
10
10
|
login / whoami / logout sign in with your conform.tools Google account
|
|
11
11
|
telemetry on|off|status optional outcome telemetry (off by default; see the README, Feedback and privacy)
|
package/dist/conformtools-decode
CHANGED
|
Binary file
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a,b}from"./chunk-
|
|
3
|
+
import{a,b}from"./chunk-EPZ6NWE4.js";import"./chunk-CL26XMDO.js";import"./chunk-PSANHDZM.js";export{b as decodeCr3Wasm,a as inspectCr3Wasm};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a,b,c}from"./chunk-
|
|
3
|
+
import{a,b,c}from"./chunk-HKP4P6JN.js";import"./chunk-DKGGJM6Z.js";import"./chunk-CL26XMDO.js";import"./chunk-PSANHDZM.js";export{c as decodeDngPreviewWasm,b as decodeDngWasm,a as inspectDngWasm};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a,b,c}from"./chunk-
|
|
3
|
+
import{a,b,c}from"./chunk-BW2NQ54J.js";import"./chunk-DKGGJM6Z.js";import"./chunk-CL26XMDO.js";import"./chunk-PSANHDZM.js";export{c as decodeDpxPreviewWasm,b as decodeDpxWasm,a as inspectDpxWasm};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a,b,c}from"./chunk-
|
|
3
|
+
import{a,b,c}from"./chunk-WT6NIJCB.js";import"./chunk-DKGGJM6Z.js";import"./chunk-CL26XMDO.js";import"./chunk-PSANHDZM.js";export{c as decodeExrPreviewWasm,b as decodeExrWasm,a as inspectExrWasm};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as M}from"./chunk-QDWB7QU7.js";import{a as v,b as S}from"./chunk-SP5RGDAM.js";import{a as F}from"./chunk-TK55FA56.js";import"./chunk-PSANHDZM.js";var V=8,H=1500,P=new WeakMap;async function C(t){let o=P.get(t);return o||(o=k(t),P.set(t,o)),o}async function k(t){if(typeof VideoDecoder>"u")throw new Error("h264: WebCodecs (VideoDecoder) not available in this context");let o=t.parts[0],e=await F({fileSize:o.fileSize,read:o.read}),a=S(v(e)),r=M(e);if(!r)throw new Error("h264: no H.264/HEVC config in container");let s=r.decodeToPres.length||a.length,f=new Int32Array(s);for(let n=0;n<r.decodeToPres.length;n++)f[r.decodeToPres[n]]=n;let u=[];for(let n=0;n<r.keyframes.length;n++){let l=r.keyframes[n],m=n+1<r.keyframes.length?r.keyframes[n+1]:a.length;u.push([l,m])}let c={offs:a,cfg:r,gops:u,presToDecode:f,count:s,dec:null,wanted:-1,got:null,gotResolve:null,fedThrough:-1,queue:Promise.resolve()};return c.dec=new VideoDecoder({output:n=>{Number(n.timestamp)===c.wanted&&!c.got?(c.got=n,c.gotResolve?.()):n.close()},error:()=>{c.fedThrough=-1}}),c.dec.configure({codec:r.codec,description:r.description,optimizeForLatency:!0,hardwareAcceleration:"prefer-hardware"}),c}function R(t,o){let e=0,a=t.length-1,r=0;for(;e<=a;){let s=e+a>>1;t[s][0]<=o?(r=s,e=s+1):a=s-1}return r}async function I(t){let o=t.codedWidth,e=t.codedHeight;try{let a=o*e*4,r=new Uint8Array(a);return await t.copyTo(r,{format:"RGBA",colorSpace:"srgb"}),{width:o,height:e,rgba:r}}catch{let r=new OffscreenCanvas(o,e).getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("h264: no 2d context for frame readback");r.drawImage(t,0,0);let s=r.getImageData(0,0,o,e);return{width:o,height:e,rgba:new Uint8Array(s.data.buffer)}}}async function O(t,o){let e=await C(t);if(e.count===0)throw new Error("h264: empty clip");if(o<0||o>=e.count)throw new Error(`COVERAGE_MISS: frame ${o} outside 0..${e.count-1}`);let a,r=new Promise(f=>{a=f}),s=e.queue;e.queue=e.queue.then(()=>r),await s;try{let f=t.parts[0],u=e.presToDecode[o],c=R(e.gops,u),[n,l]=e.gops[c];for(let m=0;m<2;m++){let T=m===0&&e.fedThrough>n&&e.fedThrough<=l&&u>=e.fedThrough,w=T?e.fedThrough:n;if(!T&&e.fedThrough!==-1){try{await e.dec.flush()}catch{}e.fedThrough=-1}let h=Math.min(l,u+1+V);e.wanted=o,e.got=null;let D=new Promise(d=>{e.gotResolve=d});if(h>w){let d=1/0,y=0;for(let i=w;i<h;i++)d=Math.min(d,e.offs[i].offset),y=Math.max(y,e.offs[i].offset+e.offs[i].size);let E=await f.read(d,y-d);for(let i=w;i<h;i++){let b=e.offs[i];e.dec.decode(new EncodedVideoChunk({type:i===n?"key":"delta",timestamp:e.cfg.decodeToPres[i],data:E.subarray(b.offset-d,b.offset-d+b.size)}))}e.fedThrough=h}let A=new Promise(d=>setTimeout(d,H));if(await Promise.race([D,A]),!e.got){try{await e.dec.flush()}catch{}e.fedThrough=-1}let p=e.got;if(e.wanted=-1,e.gotResolve=null,e.got=null,!!p)try{return await I(p)}finally{p.close()}}throw new Error(`h264: frame ${o} did not decode`)}finally{a()}}async function g(){return(await import("./isobmff-
|
|
3
|
+
import{a as M}from"./chunk-QDWB7QU7.js";import{a as v,b as S}from"./chunk-SP5RGDAM.js";import{a as F}from"./chunk-TK55FA56.js";import"./chunk-PSANHDZM.js";var V=8,H=1500,P=new WeakMap;async function C(t){let o=P.get(t);return o||(o=k(t),P.set(t,o)),o}async function k(t){if(typeof VideoDecoder>"u")throw new Error("h264: WebCodecs (VideoDecoder) not available in this context");let o=t.parts[0],e=await F({fileSize:o.fileSize,read:o.read}),a=S(v(e)),r=M(e);if(!r)throw new Error("h264: no H.264/HEVC config in container");let s=r.decodeToPres.length||a.length,f=new Int32Array(s);for(let n=0;n<r.decodeToPres.length;n++)f[r.decodeToPres[n]]=n;let u=[];for(let n=0;n<r.keyframes.length;n++){let l=r.keyframes[n],m=n+1<r.keyframes.length?r.keyframes[n+1]:a.length;u.push([l,m])}let c={offs:a,cfg:r,gops:u,presToDecode:f,count:s,dec:null,wanted:-1,got:null,gotResolve:null,fedThrough:-1,queue:Promise.resolve()};return c.dec=new VideoDecoder({output:n=>{Number(n.timestamp)===c.wanted&&!c.got?(c.got=n,c.gotResolve?.()):n.close()},error:()=>{c.fedThrough=-1}}),c.dec.configure({codec:r.codec,description:r.description,optimizeForLatency:!0,hardwareAcceleration:"prefer-hardware"}),c}function R(t,o){let e=0,a=t.length-1,r=0;for(;e<=a;){let s=e+a>>1;t[s][0]<=o?(r=s,e=s+1):a=s-1}return r}async function I(t){let o=t.codedWidth,e=t.codedHeight;try{let a=o*e*4,r=new Uint8Array(a);return await t.copyTo(r,{format:"RGBA",colorSpace:"srgb"}),{width:o,height:e,rgba:r}}catch{let r=new OffscreenCanvas(o,e).getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("h264: no 2d context for frame readback");r.drawImage(t,0,0);let s=r.getImageData(0,0,o,e);return{width:o,height:e,rgba:new Uint8Array(s.data.buffer)}}}async function O(t,o){let e=await C(t);if(e.count===0)throw new Error("h264: empty clip");if(o<0||o>=e.count)throw new Error(`COVERAGE_MISS: frame ${o} outside 0..${e.count-1}`);let a,r=new Promise(f=>{a=f}),s=e.queue;e.queue=e.queue.then(()=>r),await s;try{let f=t.parts[0],u=e.presToDecode[o],c=R(e.gops,u),[n,l]=e.gops[c];for(let m=0;m<2;m++){let T=m===0&&e.fedThrough>n&&e.fedThrough<=l&&u>=e.fedThrough,w=T?e.fedThrough:n;if(!T&&e.fedThrough!==-1){try{await e.dec.flush()}catch{}e.fedThrough=-1}let h=Math.min(l,u+1+V);e.wanted=o,e.got=null;let D=new Promise(d=>{e.gotResolve=d});if(h>w){let d=1/0,y=0;for(let i=w;i<h;i++)d=Math.min(d,e.offs[i].offset),y=Math.max(y,e.offs[i].offset+e.offs[i].size);let E=await f.read(d,y-d);for(let i=w;i<h;i++){let b=e.offs[i];e.dec.decode(new EncodedVideoChunk({type:i===n?"key":"delta",timestamp:e.cfg.decodeToPres[i],data:E.subarray(b.offset-d,b.offset-d+b.size)}))}e.fedThrough=h}let A=new Promise(d=>setTimeout(d,H));if(await Promise.race([D,A]),!e.got){try{await e.dec.flush()}catch{}e.fedThrough=-1}let p=e.got;if(e.wanted=-1,e.gotResolve=null,e.got=null,!!p)try{return await I(p)}finally{p.close()}}throw new Error(`h264: frame ${o} did not decode`)}finally{a()}}async function g(){return(await import("./isobmff-HM3UPWPZ.js")).isobmffFormat}var U={async inspect(t){return(await g()).inspect(t)},async extract(t){return(await g()).extract(t)},async sparsify(t,o){return(await g()).sparsify(t,o)},async trim(t,o){return(await g()).trim(t,o)},async decode(t,o){return O(t,o)}};export{U as h264Format};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{Ca as v,ha as g,ja as b}from"./chunk-
|
|
3
|
+
import{Ca as v,ha as g,ja as b}from"./chunk-CL26XMDO.js";import"./chunk-PSANHDZM.js";var G=8,P=1500,M=new WeakMap,S=o=>(t,e)=>o.read(t,e);function F(o){let t=new DataView(o.buffer,o.byteOffset,o.byteLength),e=t.getUint32(0,!0),n=[];for(let a=0;a<e;a++)n.push(t.getUint32(4+a*4,!0));let i=[],r=4+e*4;for(let a of n)i.push(o.subarray(r,r+a)),r+=a;return i}function V(o){for(let t=0;t+5<o.length;t++){let e=o[t]===0&&o[t+1]===0&&o[t+2]===0&&o[t+3]===1,n=o[t]===0&&o[t+1]===0&&o[t+2]===1;if(e||n){let i=t+(e?4:3);if((o[i]&31)===7){let r=a=>a.toString(16).padStart(2,"0");return`avc1.${r(o[i+1])}${r(o[i+2])}${r(o[i+3])}`}t=i-1}}return"avc1.640028"}async function A(o){if(typeof VideoDecoder>"u")throw new Error("h264-mxf: WebCodecs (VideoDecoder) not available in this context");await v();let t=o.parts[0],e=S(t),n=JSON.parse(await b(e,t.fileSize));if(!n.raps.length)throw new Error("h264-mxf: no random-access points in MXF index");let i=V(F(await g(e,t.fileSize,0,0))[0]),r={map:n,codec:i,dec:null,wanted:-1,emitted:0,got:null,gotResolve:null,fedGop:-1,fedThrough:-1,queue:Promise.resolve()};return r.dec=new VideoDecoder({output:a=>{r.emitted++===r.wanted&&!r.got?(r.got=a,r.gotResolve?.()):a.close()},error:()=>{r.fedGop=-1,r.fedThrough=-1}}),r.dec.configure({codec:i,codedWidth:n.coded_width||1920,codedHeight:n.coded_height||1088,optimizeForLatency:!0}),r}async function E(o){let t=M.get(o);return t||(t=A(o),M.set(o,t)),t}function D(o,t){let e=o.raps,n=0,i=e.length-1,r=0;for(;n<=i;){let a=n+i>>1;e[a]<=t?(r=a,n=a+1):i=a-1}return{start:e[r],end:r+1<e.length?e[r+1]:o.total_frames}}async function R(o){let t=o.visibleRect,e=t?t.width:o.codedWidth,n=t?t.height:o.codedHeight;try{let i=new Uint8Array(e*n*4);return await o.copyTo(i,{format:"RGBA",colorSpace:"srgb",rect:t??void 0}),{width:e,height:n,rgba:i}}catch{let r=new OffscreenCanvas(e,n).getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("h264-mxf: no 2d context for frame readback");r.drawImage(o,t?t.x:0,t?t.y:0,e,n,0,0,e,n);let a=r.getImageData(0,0,e,n);return{width:e,height:n,rgba:new Uint8Array(a.data.buffer)}}}async function U(o,t){let e=await E(o);if(e.map.total_frames===0)throw new Error("h264-mxf: empty clip");if(t<0||t>=e.map.total_frames)throw new Error(`COVERAGE_MISS: frame ${t} outside 0..${e.map.total_frames-1}`);let n,i=new Promise(a=>{n=a}),r=e.queue;e.queue=e.queue.then(()=>i),await r;try{let a=o.parts[0],w=S(a),{start:c,end:_}=D(e.map,t);for(let u=0;u<2;u++){let f=u===0&&e.fedGop===c&&e.fedThrough>c&&t>=e.fedThrough;if(!f&&e.fedGop!==-1){try{await e.dec.flush()}catch{}e.fedGop=-1,e.fedThrough=-1}let l=f?e.fedThrough:c,h=Math.min(_,t+1+G);f||(e.emitted=0),e.wanted=t-c,e.got=null;let T=new Promise(s=>{e.gotResolve=s});if(h>l){let s=F(await g(w,a.fileSize,l,h-1));for(let d=0;d<s.length;d++){let y=l+d;e.dec.decode(new EncodedVideoChunk({type:y===c?"key":"delta",timestamp:y*1e3,data:s[d]}))}e.fedGop=c,e.fedThrough=h}let x=new Promise(s=>setTimeout(s,P));if(await Promise.race([T,x]),!e.got){try{await e.dec.flush()}catch{}e.fedGop=-1,e.fedThrough=-1}let p=e.got;if(e.wanted=-1,e.gotResolve=null,e.got=null,!!p)try{return await R(p)}finally{p.close()}}throw new Error(`h264-mxf: frame ${t} did not decode`)}finally{n()}}async function m(){return(await import("./mxf-K465SWBN.js")).mxfFormat}var O={async inspect(o){return(await m()).inspect(o)},async extract(o){return(await m()).extract(o)},async sparsify(o,t){return(await m()).sparsify(o,t)},async trim(o,t){return(await m()).trim(o,t)},async decode(o,t){return U(o,t)}};export{O as h264MxfFormat};
|
package/dist/http.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{b as h}from"./chunk-6TM32YIJ.js";import{
|
|
3
|
+
import{b as h}from"./chunk-6TM32YIJ.js";import{O as d,P as u,X as f,Y as g,Z as T,ba as O,ca as w,ea as r,f as p}from"./chunk-QTKRMXL5.js";import{L as m,b as c}from"./chunk-TEZP6VEQ.js";import"./chunk-DRHOPOC7.js";import"./chunk-GXEVALBL.js";import"./chunk-Y2BEEOPB.js";import"./chunk-JB7PR2TQ.js";import"./chunk-C2ESM27Z.js";import"./chunk-HKP4P6JN.js";import"./chunk-EPZ6NWE4.js";import"./chunk-42QQI3WX.js";import"./chunk-6FVGUJ6L.js";import"./chunk-QDWB7QU7.js";import"./chunk-P7OVDUA5.js";import"./chunk-UCMNH6Q6.js";import"./chunk-BW2NQ54J.js";import"./chunk-WT6NIJCB.js";import"./chunk-DKGGJM6Z.js";import"./chunk-WHY3DVXS.js";import"./chunk-BUEIRRNY.js";import"./chunk-TK55FA56.js";import"./chunk-EO5NIBOV.js";import"./chunk-QTPCU2TF.js";import"./chunk-CL26XMDO.js";import"./chunk-PSANHDZM.js";var S=Number(c("CONFORM_HTTP_PORT")??7791),E=c("CONFORM_HTTP_TOKEN")??"",k=(c("CONFORM_HTTP_ORIGINS")??"https://conform.tools,https://app.conform.tools,http://localhost:5173,http://localhost:3000").split(","),R=(t,n=new Headers)=>{let e=t.headers.get("origin")??"";return k.includes(e)&&n.set("access-control-allow-origin",e),n.set("access-control-allow-headers","authorization, content-type"),n.set("access-control-allow-methods","GET, POST, DELETE, OPTIONS"),n.set("access-control-allow-private-network","true"),n.set("vary","origin"),n},s=(t,n,e=200)=>new Response(JSON.stringify(n),{status:e,headers:R(t,new Headers({"content-type":"application/json"}))});m({hostname:"127.0.0.1",port:S,onListen:t=>console.error(`conformtools HTTP API on http://127.0.0.1:${t} (${r.length} verbs)`)},async t=>{let n=new URL(t.url);if(t.method==="OPTIONS")return new Response(null,{status:204,headers:R(t)});if(E&&t.headers.get("authorization")!==`Bearer ${E}`&&n.pathname!=="/health")return s(t,{ok:!1,code:"unauthorized"},401);let e=n.pathname.split("/").filter(Boolean);try{if(n.pathname==="/health")return s(t,{ok:!0,verbs:r.length,version:p,engine:u()});if(e[0]==="verbs"&&e.length===1&&t.method==="GET")return s(t,r.map(o=>({name:o.name,title:o.title,description:o.description,long:!!o.long,input_schema:h(d.object(o.inputSchema)),protected_stages:o.protectedStages??[],engine:u()})));if(e[0]==="verbs"&&e.length===2&&t.method==="POST"){let o=r.find(l=>l.name===e[1]);if(!o)return s(t,{ok:!1,code:"not_found",message:`unknown verb ${e[1]}`},404);let b=t.headers.get("content-type")?.includes("json")?await t.json():{},a=w(o.name,b);if(!a.ok)return s(t,{...a.result.structuredContent,text:a.result.content[0].text},400);let i=await O(o.name,a.data);return s(t,{...i.structuredContent??{ok:!i.isError},text:i.content.map(l=>l.text).join(`
|
|
4
4
|
`)},i.isError?422:200)}if(e[0]==="jobs"&&e.length===1)return s(t,await T());if(e[0]==="jobs"&&e.length===2){if(t.method==="DELETE")return s(t,{ok:g(e[1])});let o=await f(e[1]);return o?s(t,o):s(t,{ok:!1,code:"not_found"},404)}return s(t,{ok:!1,code:"not_found"},404)}catch(o){return s(t,{ok:!1,code:"internal",message:o instanceof Error?o.message:String(o)},500)}});
|
package/dist/i2o-transfer
CHANGED
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{e as kt,f as qr,h as Br,k as Fr}from"./chunk-LO4K2ZF3.js";import"./chunk-C2ESM27Z.js";import"./chunk-P7OVDUA5.js";import"./chunk-UCMNH6Q6.js";import"./chunk-BK62N3ID.js";import{b as Cn,c as P,d as Dr,e as E,f as Ie,g as re}from"./chunk-PSANHDZM.js";var Y={};Dr(Y,{__addDisposableResource:()=>ps,__assign:()=>ze,__asyncDelegator:()=>os,__asyncGenerator:()=>is,__asyncValues:()=>as,__await:()=>ve,__awaiter:()=>Zr,__classPrivateFieldGet:()=>hs,__classPrivateFieldIn:()=>fs,__classPrivateFieldSet:()=>ds,__createBinding:()=>Ye,__decorate:()=>Kr,__disposeResources:()=>ms,__esDecorate:()=>zr,__exportStar:()=>ts,__extends:()=>Wr,__generator:()=>es,__importDefault:()=>us,__importStar:()=>cs,__makeTemplateObject:()=>ls,__metadata:()=>Qr,__param:()=>Gr,__propKey:()=>Yr,__read:()=>It,__rest:()=>Hr,__rewriteRelativeImportExtension:()=>_s,__runInitializers:()=>Jr,__setFunctionName:()=>Xr,__spread:()=>rs,__spreadArray:()=>ns,__spreadArrays:()=>ss,__values:()=>Je,default:()=>Ln});function Wr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ot(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Hr(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]]);return r}function Kr(t,e,r,s){var n=arguments.length,i=n<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(n<3?o(i):n>3?o(e,r,i):o(e,r))||i);return n>3&&i&&Object.defineProperty(e,r,i),i}function Gr(t,e){return function(r,s){e(r,s,t)}}function zr(t,e,r,s,n,i){function o(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}for(var a=s.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?s.static?t:t.prototype:null,u=e||(c?Object.getOwnPropertyDescriptor(c,s.name):{}),d,f=!1,h=r.length-1;h>=0;h--){var p={};for(var m in s)p[m]=m==="access"?{}:s[m];for(var m in s.access)p.access[m]=s.access[m];p.addInitializer=function(y){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(y||null))};var _=(0,r[h])(a==="accessor"?{get:u.get,set:u.set}:u[l],p);if(a==="accessor"){if(_===void 0)continue;if(_===null||typeof _!="object")throw new TypeError("Object expected");(d=o(_.get))&&(u.get=d),(d=o(_.set))&&(u.set=d),(d=o(_.init))&&n.unshift(d)}else(d=o(_))&&(a==="field"?n.unshift(d):u[l]=d)}c&&Object.defineProperty(c,s.name,u),f=!0}function Jr(t,e,r){for(var s=arguments.length>2,n=0;n<e.length;n++)r=s?e[n].call(t,r):e[n].call(t);return s?r:void 0}function Yr(t){return typeof t=="symbol"?t:"".concat(t)}function Xr(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function Qr(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Zr(t,e,r,s){function n(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(s.next(u))}catch(d){o(d)}}function l(u){try{c(s.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):n(u.value).then(a,l)}c((s=s.apply(t,e||[])).next())})}function es(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},s,n,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(s=1,n&&(i=c[0]&2?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(u){c=[6,u],n=0}finally{s=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function ts(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ye(e,t,r)}function Je(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function It(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),n,i=[],o;try{for(;(e===void 0||e-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function rs(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(It(arguments[e]));return t}function ss(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var s=Array(t),n=0,e=0;e<r;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,n++)s[n]=i[o];return s}function ns(t,e,r){if(r||arguments.length===2)for(var s=0,n=e.length,i;s<n;s++)(i||!(s in e))&&(i||(i=Array.prototype.slice.call(e,0,s)),i[s]=e[s]);return t.concat(i||Array.prototype.slice.call(e))}function ve(t){return this instanceof ve?(this.v=t,this):new ve(t)}function is(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(t,e||[]),n,i=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),n[Symbol.asyncIterator]=function(){return this},n;function o(h){return function(p){return Promise.resolve(p).then(h,d)}}function a(h,p){s[h]&&(n[h]=function(m){return new Promise(function(_,y){i.push([h,m,_,y])>1||l(h,m)})},p&&(n[h]=p(n[h])))}function l(h,p){try{c(s[h](p))}catch(m){f(i[0][3],m)}}function c(h){h.value instanceof ve?Promise.resolve(h.value.v).then(u,d):f(i[0][2],h)}function u(h){l("next",h)}function d(h){l("throw",h)}function f(h,p){h(p),i.shift(),i.length&&l(i[0][0],i[0][1])}}function os(t){var e,r;return e={},s("next"),s("throw",function(n){throw n}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(n,i){e[n]=t[n]?function(o){return(r=!r)?{value:ve(t[n](o)),done:!1}:i?i(o):o}:i}}function as(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Je=="function"?Je(t):t[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(i){r[i]=t[i]&&function(o){return new Promise(function(a,l){o=t[i](o),n(a,l,o.done,o.value)})}}function n(i,o,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},o)}}function ls(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function cs(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Pt(t),s=0;s<r.length;s++)r[s]!=="default"&&Ye(e,t,r[s]);return jn(e,t),e}function us(t){return t&&t.__esModule?t:{default:t}}function hs(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}function ds(t,e,r,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function fs(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function ps(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var s,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=e[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=e[Symbol.dispose],r&&(n=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");n&&(s=function(){try{n.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:s,async:r})}else r&&t.stack.push({async:!0});return e}function ms(t){function e(i){t.error=t.hasError?new Un(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,s=0;function n(){for(;r=t.stack.pop();)try{if(!r.async&&s===1)return s=0,t.stack.push(r),Promise.resolve().then(n);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(i).then(n,function(o){return e(o),n()})}else s|=1}catch(o){e(o)}if(s===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return n()}function _s(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,n,i,o){return s?e?".jsx":".js":n&&(!i||!o)?r:n+i+"."+o.toLowerCase()+"js"}):t}var Ot,ze,Ye,jn,Pt,Un,Ln,X=Cn(()=>{Ot=function(t,e){return Ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(r[n]=s[n])},Ot(t,e)};ze=function(){return ze=Object.assign||function(e){for(var r,s=1,n=arguments.length;s<n;s++){r=arguments[s];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},ze.apply(this,arguments)};Ye=Object.create?(function(t,e,r,s){s===void 0&&(s=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,n)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]});jn=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Pt=function(t){return Pt=Object.getOwnPropertyNames||function(e){var r=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[r.length]=s);return r},Pt(t)};Un=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var s=new Error(r);return s.name="SuppressedError",s.error=t,s.suppressed=e,s};Ln={__extends:Wr,__assign:ze,__rest:Hr,__decorate:Kr,__param:Gr,__esDecorate:zr,__runInitializers:Jr,__propKey:Yr,__setFunctionName:Xr,__metadata:Qr,__awaiter:Zr,__generator:es,__createBinding:Ye,__exportStar:ts,__values:Je,__read:It,__spread:rs,__spreadArrays:ss,__spreadArray:ns,__await:ve,__asyncGenerator:is,__asyncDelegator:os,__asyncValues:as,__makeTemplateObject:ls,__importStar:cs,__importDefault:us,__classPrivateFieldGet:hs,__classPrivateFieldSet:ds,__classPrivateFieldIn:fs,__addDisposableResource:ps,__disposeResources:ms,__rewriteRelativeImportExtension:_s}});var gs=P(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.resolveFetch=void 0;var $n=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Xe.resolveFetch=$n});var jt=P(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.FunctionRegion=Q.FunctionsHttpError=Q.FunctionsRelayError=Q.FunctionsFetchError=Q.FunctionsError=void 0;var we=class extends Error{constructor(e,r="FunctionsError",s){super(e),this.name=r,this.context=s}};Q.FunctionsError=we;var Ct=class extends we{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Q.FunctionsFetchError=Ct;var xt=class extends we{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Q.FunctionsRelayError=xt;var Nt=class extends we{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Q.FunctionsHttpError=Nt;var ys;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(ys||(Q.FunctionRegion=ys={}))});var vs=P(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.FunctionsClient=void 0;var Dn=(X(),re(Y)),qn=gs(),be=jt(),Ut=class{constructor(e,{headers:r={},customFetch:s,region:n=be.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=n,this.fetch=(0,qn.resolveFetch)(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Dn.__awaiter(this,arguments,void 0,function*(r,s={}){var n;let i,o;try{let{headers:a,method:l,body:c,signal:u,timeout:d}=s,f={},{region:h}=s;h||(h=this.region);let p=new URL(`${this.url}/${r}`);h&&h!=="any"&&(f["x-region"]=h,p.searchParams.set("forceFunctionRegion",h));let m;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",m=c):typeof c=="string"?(f["Content-Type"]="text/plain",m=c):typeof FormData<"u"&&c instanceof FormData?m=c:(f["Content-Type"]="application/json",m=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?m=JSON.stringify(c):m=c;let _=u;d&&(o=new AbortController,i=setTimeout(()=>o.abort(),d),u?(_=o.signal,u.addEventListener("abort",()=>o.abort())):_=o.signal);let y=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),a),body:m,signal:_}).catch(H=>{throw new be.FunctionsFetchError(H)}),S=y.headers.get("x-relay-error");if(S&&S==="true")throw new be.FunctionsRelayError(y);if(!y.ok)throw new be.FunctionsHttpError(y);let w=((n=y.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),k;return w==="application/json"?k=yield y.json():w==="application/octet-stream"||w==="application/pdf"?k=yield y.blob():w==="text/event-stream"?k=y:w==="multipart/form-data"?k=yield y.formData():k=yield y.text(),{data:k,error:null,response:y}}catch(a){return{data:null,error:a,response:a instanceof be.FunctionsHttpError||a instanceof be.FunctionsRelayError?a.context:void 0}}finally{i&&clearTimeout(i)}})}};Qe.FunctionsClient=Ut});var ws=P(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.FunctionRegion=G.FunctionsRelayError=G.FunctionsHttpError=G.FunctionsFetchError=G.FunctionsError=G.FunctionsClient=void 0;var Bn=vs();Object.defineProperty(G,"FunctionsClient",{enumerable:!0,get:function(){return Bn.FunctionsClient}});var Ce=jt();Object.defineProperty(G,"FunctionsError",{enumerable:!0,get:function(){return Ce.FunctionsError}});Object.defineProperty(G,"FunctionsFetchError",{enumerable:!0,get:function(){return Ce.FunctionsFetchError}});Object.defineProperty(G,"FunctionsHttpError",{enumerable:!0,get:function(){return Ce.FunctionsHttpError}});Object.defineProperty(G,"FunctionsRelayError",{enumerable:!0,get:function(){return Ce.FunctionsRelayError}});Object.defineProperty(G,"FunctionRegion",{enumerable:!0,get:function(){return Ce.FunctionRegion}})});var $t=P(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.WebSocketFactory=void 0;var et=class{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};let r=globalThis.process;if(r){let s=r.versions;if(s&&s.node){let n=s.node,i=parseInt(n.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
3
|
+
import{e as kt,f as qr,h as Br,k as Fr}from"./chunk-JB7PR2TQ.js";import"./chunk-C2ESM27Z.js";import"./chunk-P7OVDUA5.js";import"./chunk-UCMNH6Q6.js";import"./chunk-QTPCU2TF.js";import{b as Cn,c as P,d as Dr,e as E,f as Ie,g as re}from"./chunk-PSANHDZM.js";var Y={};Dr(Y,{__addDisposableResource:()=>ps,__assign:()=>ze,__asyncDelegator:()=>os,__asyncGenerator:()=>is,__asyncValues:()=>as,__await:()=>ve,__awaiter:()=>Zr,__classPrivateFieldGet:()=>hs,__classPrivateFieldIn:()=>fs,__classPrivateFieldSet:()=>ds,__createBinding:()=>Ye,__decorate:()=>Kr,__disposeResources:()=>ms,__esDecorate:()=>zr,__exportStar:()=>ts,__extends:()=>Wr,__generator:()=>es,__importDefault:()=>us,__importStar:()=>cs,__makeTemplateObject:()=>ls,__metadata:()=>Qr,__param:()=>Gr,__propKey:()=>Yr,__read:()=>It,__rest:()=>Hr,__rewriteRelativeImportExtension:()=>_s,__runInitializers:()=>Jr,__setFunctionName:()=>Xr,__spread:()=>rs,__spreadArray:()=>ns,__spreadArrays:()=>ss,__values:()=>Je,default:()=>Ln});function Wr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ot(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Hr(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]]);return r}function Kr(t,e,r,s){var n=arguments.length,i=n<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(n<3?o(i):n>3?o(e,r,i):o(e,r))||i);return n>3&&i&&Object.defineProperty(e,r,i),i}function Gr(t,e){return function(r,s){e(r,s,t)}}function zr(t,e,r,s,n,i){function o(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}for(var a=s.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?s.static?t:t.prototype:null,u=e||(c?Object.getOwnPropertyDescriptor(c,s.name):{}),d,f=!1,h=r.length-1;h>=0;h--){var p={};for(var m in s)p[m]=m==="access"?{}:s[m];for(var m in s.access)p.access[m]=s.access[m];p.addInitializer=function(y){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(y||null))};var _=(0,r[h])(a==="accessor"?{get:u.get,set:u.set}:u[l],p);if(a==="accessor"){if(_===void 0)continue;if(_===null||typeof _!="object")throw new TypeError("Object expected");(d=o(_.get))&&(u.get=d),(d=o(_.set))&&(u.set=d),(d=o(_.init))&&n.unshift(d)}else(d=o(_))&&(a==="field"?n.unshift(d):u[l]=d)}c&&Object.defineProperty(c,s.name,u),f=!0}function Jr(t,e,r){for(var s=arguments.length>2,n=0;n<e.length;n++)r=s?e[n].call(t,r):e[n].call(t);return s?r:void 0}function Yr(t){return typeof t=="symbol"?t:"".concat(t)}function Xr(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function Qr(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Zr(t,e,r,s){function n(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(s.next(u))}catch(d){o(d)}}function l(u){try{c(s.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):n(u.value).then(a,l)}c((s=s.apply(t,e||[])).next())})}function es(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},s,n,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(s=1,n&&(i=c[0]&2?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(u){c=[6,u],n=0}finally{s=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function ts(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ye(e,t,r)}function Je(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function It(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),n,i=[],o;try{for(;(e===void 0||e-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function rs(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(It(arguments[e]));return t}function ss(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var s=Array(t),n=0,e=0;e<r;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,n++)s[n]=i[o];return s}function ns(t,e,r){if(r||arguments.length===2)for(var s=0,n=e.length,i;s<n;s++)(i||!(s in e))&&(i||(i=Array.prototype.slice.call(e,0,s)),i[s]=e[s]);return t.concat(i||Array.prototype.slice.call(e))}function ve(t){return this instanceof ve?(this.v=t,this):new ve(t)}function is(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(t,e||[]),n,i=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),n[Symbol.asyncIterator]=function(){return this},n;function o(h){return function(p){return Promise.resolve(p).then(h,d)}}function a(h,p){s[h]&&(n[h]=function(m){return new Promise(function(_,y){i.push([h,m,_,y])>1||l(h,m)})},p&&(n[h]=p(n[h])))}function l(h,p){try{c(s[h](p))}catch(m){f(i[0][3],m)}}function c(h){h.value instanceof ve?Promise.resolve(h.value.v).then(u,d):f(i[0][2],h)}function u(h){l("next",h)}function d(h){l("throw",h)}function f(h,p){h(p),i.shift(),i.length&&l(i[0][0],i[0][1])}}function os(t){var e,r;return e={},s("next"),s("throw",function(n){throw n}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(n,i){e[n]=t[n]?function(o){return(r=!r)?{value:ve(t[n](o)),done:!1}:i?i(o):o}:i}}function as(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Je=="function"?Je(t):t[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(i){r[i]=t[i]&&function(o){return new Promise(function(a,l){o=t[i](o),n(a,l,o.done,o.value)})}}function n(i,o,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},o)}}function ls(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function cs(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Pt(t),s=0;s<r.length;s++)r[s]!=="default"&&Ye(e,t,r[s]);return jn(e,t),e}function us(t){return t&&t.__esModule?t:{default:t}}function hs(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}function ds(t,e,r,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function fs(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function ps(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var s,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=e[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=e[Symbol.dispose],r&&(n=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");n&&(s=function(){try{n.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:s,async:r})}else r&&t.stack.push({async:!0});return e}function ms(t){function e(i){t.error=t.hasError?new Un(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,s=0;function n(){for(;r=t.stack.pop();)try{if(!r.async&&s===1)return s=0,t.stack.push(r),Promise.resolve().then(n);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(i).then(n,function(o){return e(o),n()})}else s|=1}catch(o){e(o)}if(s===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return n()}function _s(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,n,i,o){return s?e?".jsx":".js":n&&(!i||!o)?r:n+i+"."+o.toLowerCase()+"js"}):t}var Ot,ze,Ye,jn,Pt,Un,Ln,X=Cn(()=>{Ot=function(t,e){return Ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(r[n]=s[n])},Ot(t,e)};ze=function(){return ze=Object.assign||function(e){for(var r,s=1,n=arguments.length;s<n;s++){r=arguments[s];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},ze.apply(this,arguments)};Ye=Object.create?(function(t,e,r,s){s===void 0&&(s=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,n)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]});jn=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Pt=function(t){return Pt=Object.getOwnPropertyNames||function(e){var r=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[r.length]=s);return r},Pt(t)};Un=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var s=new Error(r);return s.name="SuppressedError",s.error=t,s.suppressed=e,s};Ln={__extends:Wr,__assign:ze,__rest:Hr,__decorate:Kr,__param:Gr,__esDecorate:zr,__runInitializers:Jr,__propKey:Yr,__setFunctionName:Xr,__metadata:Qr,__awaiter:Zr,__generator:es,__createBinding:Ye,__exportStar:ts,__values:Je,__read:It,__spread:rs,__spreadArrays:ss,__spreadArray:ns,__await:ve,__asyncGenerator:is,__asyncDelegator:os,__asyncValues:as,__makeTemplateObject:ls,__importStar:cs,__importDefault:us,__classPrivateFieldGet:hs,__classPrivateFieldSet:ds,__classPrivateFieldIn:fs,__addDisposableResource:ps,__disposeResources:ms,__rewriteRelativeImportExtension:_s}});var gs=P(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.resolveFetch=void 0;var $n=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Xe.resolveFetch=$n});var jt=P(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.FunctionRegion=Q.FunctionsHttpError=Q.FunctionsRelayError=Q.FunctionsFetchError=Q.FunctionsError=void 0;var we=class extends Error{constructor(e,r="FunctionsError",s){super(e),this.name=r,this.context=s}};Q.FunctionsError=we;var Ct=class extends we{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Q.FunctionsFetchError=Ct;var xt=class extends we{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Q.FunctionsRelayError=xt;var Nt=class extends we{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Q.FunctionsHttpError=Nt;var ys;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(ys||(Q.FunctionRegion=ys={}))});var vs=P(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.FunctionsClient=void 0;var Dn=(X(),re(Y)),qn=gs(),be=jt(),Ut=class{constructor(e,{headers:r={},customFetch:s,region:n=be.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=n,this.fetch=(0,qn.resolveFetch)(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Dn.__awaiter(this,arguments,void 0,function*(r,s={}){var n;let i,o;try{let{headers:a,method:l,body:c,signal:u,timeout:d}=s,f={},{region:h}=s;h||(h=this.region);let p=new URL(`${this.url}/${r}`);h&&h!=="any"&&(f["x-region"]=h,p.searchParams.set("forceFunctionRegion",h));let m;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",m=c):typeof c=="string"?(f["Content-Type"]="text/plain",m=c):typeof FormData<"u"&&c instanceof FormData?m=c:(f["Content-Type"]="application/json",m=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?m=JSON.stringify(c):m=c;let _=u;d&&(o=new AbortController,i=setTimeout(()=>o.abort(),d),u?(_=o.signal,u.addEventListener("abort",()=>o.abort())):_=o.signal);let y=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),a),body:m,signal:_}).catch(H=>{throw new be.FunctionsFetchError(H)}),S=y.headers.get("x-relay-error");if(S&&S==="true")throw new be.FunctionsRelayError(y);if(!y.ok)throw new be.FunctionsHttpError(y);let w=((n=y.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),k;return w==="application/json"?k=yield y.json():w==="application/octet-stream"||w==="application/pdf"?k=yield y.blob():w==="text/event-stream"?k=y:w==="multipart/form-data"?k=yield y.formData():k=yield y.text(),{data:k,error:null,response:y}}catch(a){return{data:null,error:a,response:a instanceof be.FunctionsHttpError||a instanceof be.FunctionsRelayError?a.context:void 0}}finally{i&&clearTimeout(i)}})}};Qe.FunctionsClient=Ut});var ws=P(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.FunctionRegion=G.FunctionsRelayError=G.FunctionsHttpError=G.FunctionsFetchError=G.FunctionsError=G.FunctionsClient=void 0;var Bn=vs();Object.defineProperty(G,"FunctionsClient",{enumerable:!0,get:function(){return Bn.FunctionsClient}});var Ce=jt();Object.defineProperty(G,"FunctionsError",{enumerable:!0,get:function(){return Ce.FunctionsError}});Object.defineProperty(G,"FunctionsFetchError",{enumerable:!0,get:function(){return Ce.FunctionsFetchError}});Object.defineProperty(G,"FunctionsHttpError",{enumerable:!0,get:function(){return Ce.FunctionsHttpError}});Object.defineProperty(G,"FunctionsRelayError",{enumerable:!0,get:function(){return Ce.FunctionsRelayError}});Object.defineProperty(G,"FunctionRegion",{enumerable:!0,get:function(){return Ce.FunctionRegion}})});var $t=P(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.WebSocketFactory=void 0;var et=class{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};let r=globalThis.process;if(r){let s=r.versions;if(s&&s.node){let n=s.node,i=parseInt(n.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
4
4
|
import ws from "ws"
|
|
5
5
|
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.constructor)return e.constructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
|
|
6
6
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as H,b as I}from"./chunk-SP5RGDAM.js";import{a as k,b as O}from"./chunk-AACY2V3L.js";import{b as l,c as E}from"./chunk-BUEIRRNY.js";import{a as N}from"./chunk-TK55FA56.js";import{b as C}from"./chunk-
|
|
3
|
+
import{a as H,b as I}from"./chunk-SP5RGDAM.js";import{a as k,b as O}from"./chunk-AACY2V3L.js";import{b as l,c as E}from"./chunk-BUEIRRNY.js";import{a as N}from"./chunk-TK55FA56.js";import{b as C}from"./chunk-EO5NIBOV.js";import{b as T,c as f}from"./chunk-QTPCU2TF.js";import{A as P,Ca as s,K as x,L as F,W as m,ca as D,h as b,j as h,k as g,ka as A,m as v,na as z,u as w,v as S,x as R,y,z as M}from"./chunk-CL26XMDO.js";import"./chunk-PSANHDZM.js";function u(e){return(t,n)=>e.read(t,n)}function J(e){let t=e.toLowerCase().trim();return t==="aprn"||t==="aprh"?"prores_raw":t==="apch"||t==="apcn"||t==="apcs"||t==="apco"||t==="ap4h"||t==="ap4x"?"prores":t==="avdn"?"dnxhd":t==="dnxh"?"dnxhr":t==="avc1"||t==="avc3"?"h264":t==="hev1"||t==="hvc1"?"h265":t==="braw"?"braw":e}var p={apco:"Proxy",apcs:"LT",apcn:"422",apch:"HQ",ap4h:"4444",ap4x:"4444 XQ"},X={1:"bt709",2:"unknown",5:"bt470bg",6:"smpte170m",9:"bt2020",11:"smpte431",12:"smpte432"},q={1:"bt709",2:"unknown",6:"smpte170m",8:"linear",13:"iec61966-2-1",14:"bt2020-10",15:"bt2020-12",16:"smpte2084",18:"arib-std-b67"},K={0:"gbr",1:"bt709",2:"unknown",5:"bt470bg",6:"smpte170m",9:"bt2020nc",10:"bt2020c"};function Y(e,t){return e==="ap4h"||e==="ap4x"?t===32?"yuva444p12le":"yuv444p12le":e in p?"yuv422p10le":void 0}var L={66:"Baseline",77:"Main",88:"Extended",100:"High",110:"High 10",122:"High 4:2:2",244:"High 4:4:4"},U={1:"Main",2:"Main 10",3:"Main Still",4:"Rext"},Z={1270:"DNxHR 444",1271:"DNxHR HQX",1272:"DNxHR HQ",1273:"DNxHR SQ",1274:"DNxHR LB"};function ee(e,t){if(p[e.codec_fourcc])return`ProRes ${p[e.codec_fourcc]}`;if(e.vc3_cid)return Z[e.vc3_cid]??`DNxHD ${e.vc3_cid}`;if(e.video_profile!=null){if(t==="h264"&&L[e.video_profile])return`H.264 ${L[e.video_profile]}`;if(t==="h265"&&U[e.video_profile])return`HEVC ${U[e.video_profile]}`}}function re(e,t){let n=e.video_chroma,r=e.video_bit_depth;if(n==null&&t==="h264"&&[66,77,88].includes(e.video_profile??-1)&&([n,r]=[1,8]),n==null&&e.vc3_cid&&(n=e.vc3_cid===1270||e.vc3_cid===1256?3:2),n==null||r==null)return;let o=["gray","yuv420p","yuv422p","yuv444p"][n];return r>8?`${o}${r}le`:o}function V(e,t){let n=[];for(let r of e){if(r.kind!=="clip"||!r.source_range)continue;let o=r.source_range.start.value,i=r.source_range.duration.value,c=Math.max(0,Math.floor(o)-t),a=Math.floor(o+i-1)+t;a>=c&&n.push({first_frame:c,last_frame:a})}return n}var le={async inspect(e){await s();let t=e.parts[0],n=await m(u(t),t.fileSize,e.format),r=JSON.parse(n);if(!r)return null;let o=r.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:null,i=J(r.codec_fourcc),c=[{kind:"video",codec:i,width:r.width??void 0,height:r.height??void 0,rate:o??void 0,bit_depth:l(r.codec_fourcc)??l(i)??E(i,r.video_profile)??r.video_bit_depth??void 0,codec_specific:{fourcc:r.codec_fourcc,profile:ee(r,i),pixel_format:Y(r.codec_fourcc,r.video_depth)??re(r,i),colr:r.colr?{primaries:X[r.colr.primaries]??r.colr.primaries,transfer:q[r.colr.transfer]??r.colr.transfer,matrix:K[r.colr.matrix]??r.colr.matrix}:void 0}}];for(let a of r.audio_tracks??(r.audio?[r.audio]:[]))c.push({kind:"audio",codec:a.codec_fourcc,channels:a.channels??void 0,rate:a.sample_rate??void 0,bit_depth:a.bit_depth??void 0,codec_specific:{fourcc:a.codec_fourcc,channel_layout:a.channel_layout??void 0}});return{id:t.filename,kind:"external",target_url:t.filename,available_range:o&&r.duration_seconds?{start:{value:0,rate:o},duration:{value:Math.round(r.duration_seconds*o),rate:o}}:null,reel_name:null,source_timecode:r.timecode?.display??null,container:e.format==="mov"?"mov":e.format,codec:i,size_bytes:t.fileSize,source_fps:o,source_resolution_w:r.width??null,source_resolution_h:r.height??null,streams:c,decode_provenance:r.decode_provenance??null,vendor_metadata:r.timecode?{drop_frame:r.timecode.drop_frame}:{},binding_state:"unbound",raw_extraction:{mov_probe:r},metadata:{}}},async extract(e){await s();let t=e.parts[0],n=JSON.parse(await D(u(t),t.fileSize,e.format));if(n.length===0)return null;let r=JSON.parse(await m(u(t),t.fileSize,e.format)),o=r?J(r.codec_fourcc):e.format,i=r?.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:void 0;return{v:1,container:e.format==="mov"?"mov":e.format,codec:o,width:r?.width??void 0,height:r?.height??void 0,fps:i,frame_count:k(n),timecode:r?.timecode?.display??void 0,granularity:O(n),segments:n}},async sparsify(e,t){await s();let n=e.parts[0],r=V(t.items,t.handles),o=await z(u(n),n.fileSize,JSON.stringify(r),e.format),i=JSON.parse(o);return[{filename:n.filename,fileSize:i.fileSize,structuralRanges:i.structuralRanges,essenceRanges:i.essenceRanges,trimInputs:i.trimInputs}]},async trim(e,t){await s();let n=e.parts[0],r=V(t.items,0);if(r.length===0)throw new Error("isobmff trim: no usable trim ranges in items");let o=await C(r,t.handles,(i,c)=>A(u(n),n.fileSize,i,c,e.format));return o.map((i,c)=>{let a=JSON.parse(i);return o.length>1&&(a.output_clip_number=c+1,a.output_clip_count=o.length,a.output_part_number=1),a})},async decode(e,t,n){await s();let r=n.detail==="coarse",o=e.parts[0];if(e.format==="crm"){let j=await v(u(o),o.fileSize,t,r?"preview":"full");return d(j)}let i=await G(e);if(t<0||t>=i.length)throw new f(t,i.length);let c=i[t],a=await o.read(c.offset,c.size);if(e.format==="braw")return d(r?h(a,0):g(a));if(B(a))return d(r?R(a,0):y(a));if($(a))return d(r?x(a,0):F(a));if(r)return d(w(a,0));let _=await te(a);return _||d(P(a))},async decode16(e,t){await s();let n=e.parts[0];if(e.format==="crm")throw new Error("crm: no 16-bit decoder");let r=await G(e);if(t<0||t>=r.length)throw new f(t,r.length);let o=r[t],i=await n.read(o.offset,o.size),c=e.format==="braw"?b(i):B(i)?S(i):$(i)?(()=>{throw new Error("vc3: no 16-bit decoder")})():M(i);return T(c)}};async function te(e){if(!!0)return null;try{let t=await import("./prores-L4JZZWGH.js");if(!await t.proresGpuAvailable())return null;let n=await t.decodeProResRgbaGpu(e);return n?{width:n.width,height:n.height,rgba:n.rgba}:null}catch{return null}}function $(e){return e.length>=4&&e[0]===0&&e[1]===0&&e[2]===2&&e[3]===128}function B(e){return e.length>=8&&e[4]===112&&e[5]===114&&e[6]===114&&e[7]===102}function d(e){let t=new DataView(e.buffer,e.byteOffset,8);return{width:t.getUint32(0,!0),height:t.getUint32(4,!0),rgba:e.slice(8)}}var Q=new WeakMap;async function G(e){let t=Q.get(e);if(!t){let n=e.parts[0];t=I(H(await N({fileSize:n.fileSize,read:n.read}))),Q.set(e,t)}return t}export{le as isobmffFormat};
|