conformtools 0.6.25 → 0.6.27

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.
Files changed (57) hide show
  1. package/dist/{bridge-KLZD2ITG.js → bridge-42OMO43V.js} +1 -1
  2. package/dist/{chunk-4B4STXSA.js → chunk-2DMNGWC2.js} +1 -1
  3. package/dist/{chunk-WWZDRERB.js → chunk-2X2SFPWD.js} +1 -1
  4. package/dist/{chunk-V6MI7VE3.js → chunk-5JIFRR7U.js} +1 -1
  5. package/dist/{chunk-QOAPJ5Y2.js → chunk-6BL5HE4S.js} +1 -1
  6. package/dist/{chunk-LBROV5JN.js → chunk-6QB4DV22.js} +1 -1
  7. package/dist/chunk-7Z65WW4I.js +3 -0
  8. package/dist/{chunk-NQDVV2PX.js → chunk-ASFUV3PB.js} +1 -1
  9. package/dist/{chunk-ZNUIZEPF.js → chunk-BIX5ETBY.js} +1 -1
  10. package/dist/{chunk-BHBBS26Z.js → chunk-E4KQR4M3.js} +1 -1
  11. package/dist/{chunk-T4HZ6ASN.js → chunk-JZCADV5C.js} +1 -1
  12. package/dist/{chunk-H6XXKUWJ.js → chunk-M6SVZJAX.js} +5 -5
  13. package/dist/{chunk-XX7QQIBI.js → chunk-NRURUPLU.js} +1 -1
  14. package/dist/{chunk-KDNIWB5V.js → chunk-PGJMKUUP.js} +1 -1
  15. package/dist/{chunk-KNUHQP6W.js → chunk-T4B4Y5WQ.js} +2 -2
  16. package/dist/{chunk-5JDF2IUF.js → chunk-TGLH2JDW.js} +1 -1
  17. package/dist/{chunk-XIFURVIB.js → chunk-TNCXZIOX.js} +1 -1
  18. package/dist/{chunk-3AR7KSPH.js → chunk-UXEL636C.js} +1 -1
  19. package/dist/{chunk-EZYCCYY7.js → chunk-WRDA44QF.js} +1 -1
  20. package/dist/{chunk-E5TEETTE.js → chunk-XLRQNFJU.js} +89 -89
  21. package/dist/{chunk-Q2QOAQJV.js → chunk-YMRK5D3X.js} +1 -1
  22. package/dist/cli.js +1 -1
  23. package/dist/{cr3-wasm-CQ5YEFUF.js → cr3-wasm-I3MVBOT3.js} +1 -1
  24. package/dist/{dng-wasm-K6PWOV4P.js → dng-wasm-JX2PZ5CY.js} +1 -1
  25. package/dist/{dpx-wasm-RJZANW6N.js → dpx-wasm-SIM6VRGD.js} +1 -1
  26. package/dist/{exr-wasm-EZY3GZ2L.js → exr-wasm-EEY5CU2U.js} +1 -1
  27. package/dist/{framing-SKQSTCRA.js → framing-PHFTZ4GL.js} +1 -1
  28. package/dist/gfx-worker.js +1 -1
  29. package/dist/{h264-KMDAFD3Q.js → h264-TVMYQ7EB.js} +1 -1
  30. package/dist/{h264-mxf-IJYHBYKB.js → h264-mxf-PKSTGNGH.js} +1 -1
  31. package/dist/{host-relink-JQ7SEGIG.js → host-relink-FHOEDE76.js} +1 -1
  32. package/dist/hosts-DXH4SQPZ.js +3 -0
  33. package/dist/http.js +2 -2
  34. package/dist/{inspect-6PAE2CSO.js → inspect-RT36GEVU.js} +1 -1
  35. package/dist/isobmff-65LRNCQH.js +3 -0
  36. package/dist/{mc-video-DTMHUECT.js → mc-video-2PCAX65A.js} +1 -1
  37. package/dist/mcp.js +1 -1
  38. package/dist/{media-3XXQBZNW.js → media-OXHZ3PGZ.js} +1 -1
  39. package/dist/media_core-YNYOS4L3.js +9 -0
  40. package/dist/mxf-WFJNAX7D.js +3 -0
  41. package/dist/{ops-QAML7C35.js → ops-SH3IUU2Z.js} +1 -1
  42. package/dist/{r3d-AWQQHTQC.js → r3d-AKUA77ZG.js} +1 -1
  43. package/dist/{r3d-OL6DVR3C.js → r3d-X2O5LUAB.js} +1 -1
  44. package/dist/{still-CDF26BQZ.js → still-LQOFV74F.js} +1 -1
  45. package/dist/{still-wasm-3EBYMLVL.js → still-wasm-PQJ4OARF.js} +1 -1
  46. package/dist/{tiff-wasm-JIBA5AI4.js → tiff-wasm-JH6DUOML.js} +1 -1
  47. package/dist/{timeline-4VT5YMD7.js → timeline-AK6DUMWB.js} +1 -1
  48. package/dist/wasm/media_core_bg.wasm +0 -0
  49. package/dist/wasm-threads/media_core_bg.wasm +0 -0
  50. package/dist/wav-GTQMRIR3.js +3 -0
  51. package/package.json +5 -5
  52. package/dist/chunk-DCO5D65W.js +0 -3
  53. package/dist/hosts-4JZDHI6N.js +0 -3
  54. package/dist/isobmff-4FUKPUL3.js +0 -3
  55. package/dist/media_core-KHSB6EFN.js +0 -9
  56. package/dist/mxf-LGRSWF7S.js +0 -3
  57. package/dist/wav-N6EWJR2P.js +0 -3
@@ -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{a as L}from"./chunk-QOAPJ5Y2.js";import{B as O,C as R,E as W,F as I,da as P,o as _,t as H,z as N}from"./chunk-ZPIY5DOU.js";import X from"node:http";import{connect as Y}from"node:net";import{createHash as M,randomBytes as U}from"node:crypto";import{Buffer as d}from"node:buffer";var j="258EAFA5-E914-47DA-95CA-C5AB0DC85B11";function A(a,e,c=!1){let n=e.length,r=c?128:0,s=n<126?d.from([128|a,r|n]):n<65536?d.from([128|a,r|126,n>>8,n&255]):(()=>{let o=d.alloc(10);return o[0]=128|a,o[1]=r|127,o.writeBigUInt64BE(BigInt(n),2),o})();if(!c)return d.concat([s,d.from(e)]);let t=U(4),i=d.from(e);for(let o=0;o<i.length;o++)i[o]^=t[o&3];return d.concat([s,t,i])}function D(a,e,c,n=!1){let r=d.alloc(0),s=[],t=0,i=!1,o=[],p=[],u=()=>{i||(i=!0,p.forEach(l=>l()))},f=(l=1e3,m="")=>{if(i)return;let h=d.from(m),g=d.alloc(2+h.length);g.writeUInt16BE(l,0),h.copy(g,2);try{a.write(A(8,g,n))}catch{}a.end(),u()};return a.on("data",l=>{for(r=d.concat([r,l]);r.length>=2;){let m=(r[0]&128)!==0,h=r[0]&15,g=(r[1]&128)!==0,v=r[1]&127,w=2;if(v===126){if(r.length<4)return;v=r.readUInt16BE(2),w=4}else if(v===127){if(r.length<10)return;let b=r.readBigUInt64BE(2);if(b>BigInt(c))return f(1009,"too big");v=Number(b),w=10}if(g===n)return f(1002,n?"server frames must not be masked":"client frames must be masked");if(v>c||t+v>c)return f(1009,"message too big");let E=g?4:0;if(r.length<w+E+v)return;let S=d.from(r.subarray(w+E,w+E+v));if(g){let b=r.subarray(w,w+4);for(let x=0;x<S.length;x++)S[x]^=b[x&3]}if(r=r.subarray(w+E+v),h===8)return f(1e3);if(h===9){a.write(A(10,S,n));continue}if(h!==10){if(h===1||h===0){if(s.push(S),t+=S.length,m){let b=d.concat(s).toString("utf8");s=[],t=0,o.forEach(x=>x(b))}continue}return f(1003,"text frames only")}}}),a.on("close",u),a.on("error",u),{origin:e,send:l=>{i||a.write(A(1,d.from(l,"utf8"),n))},close:f,onMessage:l=>{o.push(l)},onClose:l=>{p.push(l)}}}function J(a,e){let c=new Set,n=X.createServer((r,s)=>{let t=n.address();a.onHttp?.(r,s,typeof t=="object"&&t?t.port:a.port)||(s.writeHead(426,{"content-type":"text/plain"}),s.end("websocket only"))});return n.on("upgrade",(r,s)=>{let t=r.headers["sec-websocket-key"];if(r.url?.split("?")[0]!==a.path||typeof t!="string"||String(r.headers.upgrade).toLowerCase()!=="websocket"){s.end(`HTTP/1.1 400 Bad Request\r
3
+ import{a as L}from"./chunk-6BL5HE4S.js";import{B as O,C as R,E as W,F as I,da as P,o as _,t as H,z as N}from"./chunk-ZPIY5DOU.js";import X from"node:http";import{connect as Y}from"node:net";import{createHash as M,randomBytes as U}from"node:crypto";import{Buffer as d}from"node:buffer";var j="258EAFA5-E914-47DA-95CA-C5AB0DC85B11";function A(a,e,c=!1){let n=e.length,r=c?128:0,s=n<126?d.from([128|a,r|n]):n<65536?d.from([128|a,r|126,n>>8,n&255]):(()=>{let o=d.alloc(10);return o[0]=128|a,o[1]=r|127,o.writeBigUInt64BE(BigInt(n),2),o})();if(!c)return d.concat([s,d.from(e)]);let t=U(4),i=d.from(e);for(let o=0;o<i.length;o++)i[o]^=t[o&3];return d.concat([s,t,i])}function D(a,e,c,n=!1){let r=d.alloc(0),s=[],t=0,i=!1,o=[],p=[],u=()=>{i||(i=!0,p.forEach(l=>l()))},f=(l=1e3,m="")=>{if(i)return;let h=d.from(m),g=d.alloc(2+h.length);g.writeUInt16BE(l,0),h.copy(g,2);try{a.write(A(8,g,n))}catch{}a.end(),u()};return a.on("data",l=>{for(r=d.concat([r,l]);r.length>=2;){let m=(r[0]&128)!==0,h=r[0]&15,g=(r[1]&128)!==0,v=r[1]&127,w=2;if(v===126){if(r.length<4)return;v=r.readUInt16BE(2),w=4}else if(v===127){if(r.length<10)return;let b=r.readBigUInt64BE(2);if(b>BigInt(c))return f(1009,"too big");v=Number(b),w=10}if(g===n)return f(1002,n?"server frames must not be masked":"client frames must be masked");if(v>c||t+v>c)return f(1009,"message too big");let E=g?4:0;if(r.length<w+E+v)return;let S=d.from(r.subarray(w+E,w+E+v));if(g){let b=r.subarray(w,w+4);for(let x=0;x<S.length;x++)S[x]^=b[x&3]}if(r=r.subarray(w+E+v),h===8)return f(1e3);if(h===9){a.write(A(10,S,n));continue}if(h!==10){if(h===1||h===0){if(s.push(S),t+=S.length,m){let b=d.concat(s).toString("utf8");s=[],t=0,o.forEach(x=>x(b))}continue}return f(1003,"text frames only")}}}),a.on("close",u),a.on("error",u),{origin:e,send:l=>{i||a.write(A(1,d.from(l,"utf8"),n))},close:f,onMessage:l=>{o.push(l)},onClose:l=>{p.push(l)}}}function J(a,e){let c=new Set,n=X.createServer((r,s)=>{let t=n.address();a.onHttp?.(r,s,typeof t=="object"&&t?t.port:a.port)||(s.writeHead(426,{"content-type":"text/plain"}),s.end("websocket only"))});return n.on("upgrade",(r,s)=>{let t=r.headers["sec-websocket-key"];if(r.url?.split("?")[0]!==a.path||typeof t!="string"||String(r.headers.upgrade).toLowerCase()!=="websocket"){s.end(`HTTP/1.1 400 Bad Request\r
4
4
  \r
5
5
  `);return}let i=M("sha1").update(t+j).digest("base64");s.write(`HTTP/1.1 101 Switching Protocols\r
6
6
  Upgrade: websocket\r
package/dist/cli.js CHANGED
@@ -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{l as G,m as V,p as Y,q as B}from"./chunk-H6XXKUWJ.js";import"./chunk-3AR7KSPH.js";import"./chunk-WWZDRERB.js";import"./chunk-KNUHQP6W.js";import"./chunk-4B4STXSA.js";import"./chunk-3KS3547B.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{Hc as S,Pc as J,Qc as F}from"./chunk-E5TEETTE.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-Q2QOAQJV.js";import{a as D}from"./chunk-QOAPJ5Y2.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-LMRPCWHV.js";import"./chunk-ZNUIZEPF.js";import"./chunk-N34DQ6MH.js";import{b as L}from"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import{k as H,w as I,x as W}from"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import{b as O,f as l,g as c}from"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";var m=process.stdout,C=22,E=20,R=E/2,K=(o,n)=>Math.abs(n)<=Math.min(1-.417*Math.abs(o),2.393*(1-Math.abs(o))),so=(o,n)=>o*o+n*n<=1;function ro(o){let n=.62**-o,u=[];for(let s=0;s<E;s++){let a=[];for(let r=0;r<C;r++){let f=(r+.5)/C*2-1,i=(s+.5)/E*2-1,d=!1;if(K(f,i))for(let x=0;x<6;x++)for(let y of[!1,!0]){let p=.62**x*(y?.77:1)*n,$=.5*Math.max(0,1-p)**2;(y?so:K)(f/p,(i-$)/p)&&(d=!y)}a.push(d)}u.push(a)}return u}var A={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"]},q="CONFORM.TOOLS",io=[...q].reduce((o,n)=>o+A[n][0].length+1,-1);async function z(o){if(!m.isTTY)return!1;let n=!!O("NO_COLOR"),u=/truecolor|24bit/i.test(O("COLORTERM")??""),s=t=>e=>n?e:`\x1B[${t}m${e}\x1B[0m`,a=s(u?"38;2;255;60;0":"38;5;202"),r=s(u?"38;2;255;222;0":"38;5;220"),f=s("1"),i=s("2"),d=(m.columns??80)>=C+4+io,x=t=>[...q].map(e=>e==="."?a(A[e][t]):f(A[e][t])).join(" "),y=(t,e)=>d&&t>=2&&t<=5?x(t-2):!d&&t===3?`${f("conform")}${a(".")}${f("tools")}`:t===7?e:"",p=(t,e,T=[])=>{let k=ro(t),P=[];for(let w=0;w<R;w++){let to=k[2*w].map((_,eo)=>{let N=k[2*w+1][eo];return _&&N?"\u2588":_?"\u2580":N?"\u2584":" "}).join(""),no=w>=8?T[w-8]??"":"";P.push(` ${a(to)} ${no||y(w,e)}\x1B[K`)}return P.join(`
3
+ import{l as G,m as V,p as Y,q as B}from"./chunk-M6SVZJAX.js";import"./chunk-UXEL636C.js";import"./chunk-2X2SFPWD.js";import"./chunk-T4B4Y5WQ.js";import"./chunk-2DMNGWC2.js";import"./chunk-3KS3547B.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{Hc as S,Pc as J,Qc as F}from"./chunk-XLRQNFJU.js";import"./chunk-IN6XVTUS.js";import"./chunk-E4KQR4M3.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-YMRK5D3X.js";import{a as D}from"./chunk-6BL5HE4S.js";import"./chunk-TNCXZIOX.js";import"./chunk-5JIFRR7U.js";import"./chunk-WRDA44QF.js";import"./chunk-PGJMKUUP.js";import"./chunk-6QB4DV22.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-ASFUV3PB.js";import"./chunk-NRURUPLU.js";import"./chunk-TGLH2JDW.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-LMRPCWHV.js";import"./chunk-BIX5ETBY.js";import"./chunk-N34DQ6MH.js";import{b as L}from"./chunk-NU3X7P4N.js";import"./chunk-7Z65WW4I.js";import{k as H,w as I,x as W}from"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import{b as O,f as l,g as c}from"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";var m=process.stdout,C=22,E=20,R=E/2,K=(o,n)=>Math.abs(n)<=Math.min(1-.417*Math.abs(o),2.393*(1-Math.abs(o))),so=(o,n)=>o*o+n*n<=1;function ro(o){let n=.62**-o,u=[];for(let s=0;s<E;s++){let a=[];for(let r=0;r<C;r++){let f=(r+.5)/C*2-1,i=(s+.5)/E*2-1,d=!1;if(K(f,i))for(let x=0;x<6;x++)for(let y of[!1,!0]){let p=.62**x*(y?.77:1)*n,$=.5*Math.max(0,1-p)**2;(y?so:K)(f/p,(i-$)/p)&&(d=!y)}a.push(d)}u.push(a)}return u}var A={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"]},q="CONFORM.TOOLS",io=[...q].reduce((o,n)=>o+A[n][0].length+1,-1);async function z(o){if(!m.isTTY)return!1;let n=!!O("NO_COLOR"),u=/truecolor|24bit/i.test(O("COLORTERM")??""),s=t=>e=>n?e:`\x1B[${t}m${e}\x1B[0m`,a=s(u?"38;2;255;60;0":"38;5;202"),r=s(u?"38;2;255;222;0":"38;5;220"),f=s("1"),i=s("2"),d=(m.columns??80)>=C+4+io,x=t=>[...q].map(e=>e==="."?a(A[e][t]):f(A[e][t])).join(" "),y=(t,e)=>d&&t>=2&&t<=5?x(t-2):!d&&t===3?`${f("conform")}${a(".")}${f("tools")}`:t===7?e:"",p=(t,e,T=[])=>{let k=ro(t),P=[];for(let w=0;w<R;w++){let to=k[2*w].map((_,eo)=>{let N=k[2*w+1][eo];return _&&N?"\u2588":_?"\u2580":N?"\u2584":" "}).join(""),no=w>=8?T[w-8]??"":"";P.push(` ${a(to)} ${no||y(w,e)}\x1B[K`)}return P.join(`
4
4
  `)+`
5
5
  `},$=null;o.account.then(t=>{$=t});let j=t=>L(t,24),Z=!O("CI")&&O("TERM")!=="dumb";if(m.write(`
6
6
  `),Z){let t=()=>m.write("\x1B[?25h");process.once("SIGINT",()=>{t(),process.exit(130)}),m.write("\x1B[?25l"+p(0,r(`\u25B6 ${j(0)}`)));let e=Date.now(),T=0;for(;$===null||Date.now()-e<900;)await new Promise(k=>setTimeout(k,1e3/24)),T=Math.round((Date.now()-e)*24/1e3),m.write(`\x1B[${R}A\r`+p(T/22%1,`${r(`\u25B6 ${j(T)}`)} ${i("checking your account\u2026")}`));m.write(`\x1B[${R}A\r`),t()}let oo=($??await o.account).split(`
@@ -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-KDNIWB5V.js";import"./chunk-DCO5D65W.js";import"./chunk-PSANHDZM.js";export{b as decodeCr3Wasm,a as inspectCr3Wasm};
3
+ import{a,b}from"./chunk-PGJMKUUP.js";import"./chunk-7Z65WW4I.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}from"./chunk-EZYCCYY7.js";import"./chunk-DCO5D65W.js";import"./chunk-PSANHDZM.js";export{b as decodeDngWasm,a as inspectDngWasm};
3
+ import{a,b}from"./chunk-WRDA44QF.js";import"./chunk-7Z65WW4I.js";import"./chunk-PSANHDZM.js";export{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}from"./chunk-XIFURVIB.js";import"./chunk-DCO5D65W.js";import"./chunk-PSANHDZM.js";export{b as decodeDpxWasm,a as inspectDpxWasm};
3
+ import{a,b}from"./chunk-TNCXZIOX.js";import"./chunk-7Z65WW4I.js";import"./chunk-PSANHDZM.js";export{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}from"./chunk-V6MI7VE3.js";import"./chunk-DCO5D65W.js";import"./chunk-PSANHDZM.js";export{b as decodeExrWasm,a as inspectExrWasm};
3
+ import{a,b}from"./chunk-5JIFRR7U.js";import"./chunk-7Z65WW4I.js";import"./chunk-PSANHDZM.js";export{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{ec as a,fc as b,gc as c,hc as d,ic as e,jc as f,kc as g,lc as h,mc as i,nc as j,oc as k,pc as l,qc as m,rc as n,sc as o}from"./chunk-E5TEETTE.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-QOAPJ5Y2.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";export{k as ASPECTS,a as INPUT_SCALING,g as SIZING_TARGETS,j as alignText,i as alignTimeline,l as aspectOf,m as blankingForAspect,n as blankingQc,o as blankingText,f as cropUnderRef,c as inputFitRatio,h as offlineLane,d as resolveProps,b as scalingOf,e as underRef};
3
+ import{ec as a,fc as b,gc as c,hc as d,ic as e,jc as f,kc as g,lc as h,mc as i,nc as j,oc as k,pc as l,qc as m,rc as n,sc as o}from"./chunk-XLRQNFJU.js";import"./chunk-IN6XVTUS.js";import"./chunk-E4KQR4M3.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-6BL5HE4S.js";import"./chunk-TNCXZIOX.js";import"./chunk-5JIFRR7U.js";import"./chunk-WRDA44QF.js";import"./chunk-PGJMKUUP.js";import"./chunk-6QB4DV22.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-ASFUV3PB.js";import"./chunk-NRURUPLU.js";import"./chunk-TGLH2JDW.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-7Z65WW4I.js";import"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";export{k as ASPECTS,a as INPUT_SCALING,g as SIZING_TARGETS,j as alignText,i as alignTimeline,l as aspectOf,m as blankingForAspect,n as blankingQc,o as blankingText,f as cropUnderRef,c as inputFitRatio,h as offlineLane,d as resolveProps,b as scalingOf,e as underRef};
@@ -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 d,j as w,l as _}from"./chunk-ZNUIZEPF.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import{Ha as u,U as l,W as g}from"./chunk-DCO5D65W.js";import"./chunk-E75BCWXY.js";import{y}from"./chunk-ZPIY5DOU.js";import"./chunk-PSANHDZM.js";import{parentPort as p,workerData as C}from"node:worker_threads";import{createCanvas as M,loadImage as A}from"@napi-rs/canvas";var S=(async()=>{await w(C),await u()})(),o=new Map,c=new Map;p.on("message",async t=>{try{await S;let s={};for(let[e,a]of Object.entries(t.images))c.has(a)||c.set(a,await A(await y(a))),s[e]=c.get(a);let m=`${t.fmt.w}x${t.fmt.h}`;o.has(m)||o.set(m,M(t.fmt.w,t.fmt.h));let i=o.get(m).getContext("2d"),v=h(i),r=[],f=null;for(let e=t.from;e<t.to;e++){d(i,t.scene,e/t.fps,t.fmt,v,s);let a=i.getImageData(0,0,t.fmt.w,t.fmt.h).data,n=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);if(f&&_(f,n)){r.push(null);continue}r.push(t.alpha?l(n,t.fmt.w,t.fmt.h,4):g(n,t.fmt.w,t.fmt.h,4)),f=n.slice()}p.postMessage({id:t.id,samples:r},r.filter(e=>!!e).map(e=>e.buffer))}catch(s){p.postMessage({id:t.id,error:s.message??String(s)})}});
3
+ import{a as h,b as d,j as w,l as _}from"./chunk-BIX5ETBY.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import{Ja as u,U as l,W as g}from"./chunk-7Z65WW4I.js";import"./chunk-E75BCWXY.js";import{y}from"./chunk-ZPIY5DOU.js";import"./chunk-PSANHDZM.js";import{parentPort as p,workerData as C}from"node:worker_threads";import{createCanvas as M,loadImage as A}from"@napi-rs/canvas";var S=(async()=>{await w(C),await u()})(),o=new Map,c=new Map;p.on("message",async t=>{try{await S;let s={};for(let[e,a]of Object.entries(t.images))c.has(a)||c.set(a,await A(await y(a))),s[e]=c.get(a);let m=`${t.fmt.w}x${t.fmt.h}`;o.has(m)||o.set(m,M(t.fmt.w,t.fmt.h));let i=o.get(m).getContext("2d"),v=h(i),r=[],f=null;for(let e=t.from;e<t.to;e++){d(i,t.scene,e/t.fps,t.fmt,v,s);let a=i.getImageData(0,0,t.fmt.w,t.fmt.h).data,n=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);if(f&&_(f,n)){r.push(null);continue}r.push(t.alpha?l(n,t.fmt.w,t.fmt.h,4):g(n,t.fmt.w,t.fmt.h,4)),f=n.slice()}p.postMessage({id:t.id,samples:r},r.filter(e=>!!e).map(e=>e.buffer))}catch(s){p.postMessage({id:t.id,error:s.message??String(s)})}});
@@ -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 O}from"./chunk-TK55FA56.js";import"./chunk-PSANHDZM.js";function v(e,n,t,f){let s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=n;for(;r+8<=t;){let o=s.getUint32(r),a=String.fromCharCode(e[r+4],e[r+5],e[r+6],e[r+7]),c=8;if(o===1){let l=s.getUint32(r+8),g=s.getUint32(r+12);o=l*2**32+g,c=16}else o===0&&(o=t-r);if(o<c||r+o>t)break;f(a,r+c,r+o),r+=o}}var E=new Set(["moov","trak","mdia","minf","stbl"]);function D(e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),t=null,f=(r,o)=>{let a={},c=!1,l=(g,w)=>{v(e,g,w,(y,i,p)=>{if(E.has(y)){l(i,p);return}if(!(!c&&y!=="hdlr"&&y!=="stsd"))switch(y){case"hdlr":{String.fromCharCode(e[i+8],e[i+9],e[i+10],e[i+11])==="vide"&&(c=!0);break}case"stsd":{let u=i+8;a.codec=String.fromCharCode(e[u+4],e[u+5],e[u+6],e[u+7]),a.width=n.getUint16(u+32),a.height=n.getUint16(u+34);break}case"stsz":{let u=n.getUint32(i+4),m=n.getUint32(i+8),d=[];if(u===0)for(let h=0;h<m;h++)d.push(n.getUint32(i+12+h*4));else for(let h=0;h<m;h++)d.push(u);a.sampleSizes=d;break}case"stco":{let u=n.getUint32(i+4),m=[];for(let d=0;d<u;d++)m.push(n.getUint32(i+8+d*4));a.chunkOffsets=m;break}case"co64":{let u=n.getUint32(i+4),m=[];for(let d=0;d<u;d++){let h=n.getUint32(i+8+d*8),k=n.getUint32(i+12+d*8);m.push(h*2**32+k)}a.chunkOffsets=m;break}case"stsc":{let u=n.getUint32(i+4),m=[];for(let d=0;d<u;d++)m.push({firstChunk:n.getUint32(i+8+d*12),samplesPerChunk:n.getUint32(i+8+d*12+4),descIdx:n.getUint32(i+8+d*12+8)});a.sampleToChunk=m;break}}})};l(r,o),c&&a.chunkOffsets&&a.sampleSizes&&a.sampleToChunk&&(t=a)};if(((r,o)=>{v(e,r,o,(a,c,l)=>{a==="moov"&&v(e,c,l,(g,w,y)=>{g==="trak"&&f(w,y)})})})(0,e.length),!t)throw new Error("could not find a video sample table");return t}function V(e){let n=[],t=0;for(let f=0;f<e.chunkOffsets.length;f++){let s=1;for(let o=0;o<e.sampleToChunk.length;o++)f+1>=e.sampleToChunk[o].firstChunk&&(s=e.sampleToChunk[o].samplesPerChunk);let r=e.chunkOffsets[f];for(let o=0;o<s&&t<e.sampleSizes.length;o++){let a=e.sampleSizes[t];n.push({offset:r,size:a}),r+=a,t++}}return n}var P=(e,n)=>String.fromCharCode(e[n],e[n+1],e[n+2],e[n+3]),z=e=>e.toString(16).padStart(2,"0");function S(e,n,t,f){let s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=n;for(;r+8<=t;){let o=s.getUint32(r),a=8;if(o===1?(o=Number(s.getBigUint64(r+8)),a=16):o===0&&(o=t-r),P(e,r+4)===f)return[r+a,r+o];if(o<a)break;r+=o}return null}function H(e,n,t,f){let s=[n,t];for(let r of f){if(!s)return null;s=S(e,s[0],s[1],r)}return s}function M(e,n,t){let f=S(e,n[0],n[1],"stts");if(!f)return new Int32Array(0);let s=t.getUint32(f[0]+4),r=[],o=0,a=f[0]+8;for(let i=0;i<s;i++){let p=t.getUint32(a),u=t.getInt32(a+4);for(let m=0;m<p;m++)r.push(o),o+=u;a+=8}let c=r.length,l=S(e,n[0],n[1],"ctts"),g=new Float64Array(c);for(let i=0;i<c;i++)g[i]=r[i];if(l){let i=t.getUint32(l[0]+4),p=l[0]+8,u=0;for(let m=0;m<i&&u<c;m++){let d=t.getUint32(p),h=t.getInt32(p+4);for(let k=0;k<d&&u<c;k++)g[u++]+=h;p+=8}}let w=Array.from({length:c},(i,p)=>p).sort((i,p)=>g[i]-g[p]||i-p),y=new Int32Array(c);for(let i=0;i<c;i++)y[w[i]]=i;return y}function I(e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),t=S(e,0,e.length,"moov"),[f,s]=t??[0,e.length],r=f;for(;r+8<=s;){let o=n.getUint32(r),a=8;if(o===1?(o=Number(n.getBigUint64(r+8)),a=16):o===0&&(o=s-r),P(e,r+4)==="trak"){let c=H(e,r+a,r+o,["mdia","minf","stbl"]);if(c){let l=S(e,c[0],c[1],"stsd");if(l){let g=l[0]+8,w=P(e,g+4);if(w==="avc1"||w==="avc3"||w==="hvc1"||w==="hev1"){let y=n.getUint32(g),i=g+8+78,p=w.startsWith("hv")||w.startsWith("he"),u=S(e,i,g+y,p?"hvcC":"avcC");if(!u)return null;let m=e.subarray(u[0],u[1]),d=p?"hvc1.1.6.L93.B0":`avc1.${z(m[1])}${z(m[2])}${z(m[3])}`,h=M(e,c,n),k=h.length,C=S(e,c[0],c[1],"stss"),b=[];if(C){let T=n.getUint32(C[0]+4);for(let U=0;U<T;U++)b.push(n.getUint32(C[0]+8+U*4)-1)}else for(let T=0;T<k;T++)b.push(T);return(b.length===0||b[0]!==0)&&b.unshift(0),b.sort((T,U)=>T-U),{codec:d,description:m,keyframes:b,decodeToPres:h}}}}}if(o<a)break;r+=o}return null}var x=8,R=1500,F=new WeakMap;async function L(e){let n=F.get(e);return n||(n=q(e),F.set(e,n)),n}async function q(e){if(typeof VideoDecoder>"u")throw new Error("h264: WebCodecs (VideoDecoder) not available in this context");let n=e.parts[0],t=await O({fileSize:n.fileSize,read:n.read}),f=V(D(t)),s=I(t);if(!s)throw new Error("h264: no H.264/HEVC config in container");let r=s.decodeToPres.length||f.length,o=new Int32Array(r);for(let l=0;l<s.decodeToPres.length;l++)o[s.decodeToPres[l]]=l;let a=[];for(let l=0;l<s.keyframes.length;l++){let g=s.keyframes[l],w=l+1<s.keyframes.length?s.keyframes[l+1]:f.length;a.push([g,w])}let c={offs:f,cfg:s,gops:a,presToDecode:o,count:r,dec:null,wanted:-1,got:null,gotResolve:null,fedThrough:-1,queue:Promise.resolve()};return c.dec=new VideoDecoder({output:l=>{Number(l.timestamp)===c.wanted&&!c.got?(c.got=l,c.gotResolve?.()):l.close()},error:()=>{c.fedThrough=-1}}),c.dec.configure({codec:s.codec,description:s.description,optimizeForLatency:!0,hardwareAcceleration:"prefer-hardware"}),c}function B(e,n){let t=0,f=e.length-1,s=0;for(;t<=f;){let r=t+f>>1;e[r][0]<=n?(s=r,t=r+1):f=r-1}return s}async function $(e){let n=e.codedWidth,t=e.codedHeight;try{let f=n*t*4,s=new Uint8Array(f);return await e.copyTo(s,{format:"RGBA",colorSpace:"srgb"}),{width:n,height:t,rgba:s}}catch{let s=new OffscreenCanvas(n,t).getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("h264: no 2d context for frame readback");s.drawImage(e,0,0);let r=s.getImageData(0,0,n,t);return{width:n,height:t,rgba:new Uint8Array(r.data.buffer)}}}async function N(e,n){let t=await L(e);if(t.count===0)throw new Error("h264: empty clip");if(n<0||n>=t.count)throw new Error(`COVERAGE_MISS: frame ${n} outside 0..${t.count-1}`);let f,s=new Promise(o=>{f=o}),r=t.queue;t.queue=t.queue.then(()=>s),await r;try{let o=e.parts[0],a=t.presToDecode[n],c=B(t.gops,a),[l,g]=t.gops[c];for(let w=0;w<2;w++){let y=w===0&&t.fedThrough>l&&t.fedThrough<=g&&a>=t.fedThrough,i=y?t.fedThrough:l;if(!y&&t.fedThrough!==-1){try{await t.dec.flush()}catch{}t.fedThrough=-1}let p=Math.min(g,a+1+x);t.wanted=n,t.got=null;let u=new Promise(h=>{t.gotResolve=h});if(p>i){let h=1/0,k=0;for(let b=i;b<p;b++)h=Math.min(h,t.offs[b].offset),k=Math.max(k,t.offs[b].offset+t.offs[b].size);let C=await o.read(h,k-h);for(let b=i;b<p;b++){let T=t.offs[b];t.dec.decode(new EncodedVideoChunk({type:b===l?"key":"delta",timestamp:t.cfg.decodeToPres[b],data:C.subarray(T.offset-h,T.offset-h+T.size)}))}t.fedThrough=p}let m=new Promise(h=>setTimeout(h,R));if(await Promise.race([u,m]),!t.got){try{await t.dec.flush()}catch{}t.fedThrough=-1}let d=t.got;if(t.wanted=-1,t.gotResolve=null,t.got=null,!!d)try{return await $(d)}finally{d.close()}}throw new Error(`h264: frame ${n} did not decode`)}finally{f()}}async function A(){return(await import("./isobmff-4FUKPUL3.js")).isobmffFormat}var J={async inspect(e){return(await A()).inspect(e)},async extract(e){return(await A()).extract(e)},async sparsify(e,n){return(await A()).sparsify(e,n)},async trim(e,n){return(await A()).trim(e,n)},async decode(e,n){return N(e,n)}};export{J as h264Format};
3
+ import{a as O}from"./chunk-TK55FA56.js";import"./chunk-PSANHDZM.js";function v(e,n,t,f){let s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=n;for(;r+8<=t;){let o=s.getUint32(r),a=String.fromCharCode(e[r+4],e[r+5],e[r+6],e[r+7]),c=8;if(o===1){let l=s.getUint32(r+8),g=s.getUint32(r+12);o=l*2**32+g,c=16}else o===0&&(o=t-r);if(o<c||r+o>t)break;f(a,r+c,r+o),r+=o}}var E=new Set(["moov","trak","mdia","minf","stbl"]);function D(e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),t=null,f=(r,o)=>{let a={},c=!1,l=(g,w)=>{v(e,g,w,(y,i,p)=>{if(E.has(y)){l(i,p);return}if(!(!c&&y!=="hdlr"&&y!=="stsd"))switch(y){case"hdlr":{String.fromCharCode(e[i+8],e[i+9],e[i+10],e[i+11])==="vide"&&(c=!0);break}case"stsd":{let u=i+8;a.codec=String.fromCharCode(e[u+4],e[u+5],e[u+6],e[u+7]),a.width=n.getUint16(u+32),a.height=n.getUint16(u+34);break}case"stsz":{let u=n.getUint32(i+4),m=n.getUint32(i+8),d=[];if(u===0)for(let h=0;h<m;h++)d.push(n.getUint32(i+12+h*4));else for(let h=0;h<m;h++)d.push(u);a.sampleSizes=d;break}case"stco":{let u=n.getUint32(i+4),m=[];for(let d=0;d<u;d++)m.push(n.getUint32(i+8+d*4));a.chunkOffsets=m;break}case"co64":{let u=n.getUint32(i+4),m=[];for(let d=0;d<u;d++){let h=n.getUint32(i+8+d*8),k=n.getUint32(i+12+d*8);m.push(h*2**32+k)}a.chunkOffsets=m;break}case"stsc":{let u=n.getUint32(i+4),m=[];for(let d=0;d<u;d++)m.push({firstChunk:n.getUint32(i+8+d*12),samplesPerChunk:n.getUint32(i+8+d*12+4),descIdx:n.getUint32(i+8+d*12+8)});a.sampleToChunk=m;break}}})};l(r,o),c&&a.chunkOffsets&&a.sampleSizes&&a.sampleToChunk&&(t=a)};if(((r,o)=>{v(e,r,o,(a,c,l)=>{a==="moov"&&v(e,c,l,(g,w,y)=>{g==="trak"&&f(w,y)})})})(0,e.length),!t)throw new Error("could not find a video sample table");return t}function V(e){let n=[],t=0;for(let f=0;f<e.chunkOffsets.length;f++){let s=1;for(let o=0;o<e.sampleToChunk.length;o++)f+1>=e.sampleToChunk[o].firstChunk&&(s=e.sampleToChunk[o].samplesPerChunk);let r=e.chunkOffsets[f];for(let o=0;o<s&&t<e.sampleSizes.length;o++){let a=e.sampleSizes[t];n.push({offset:r,size:a}),r+=a,t++}}return n}var P=(e,n)=>String.fromCharCode(e[n],e[n+1],e[n+2],e[n+3]),z=e=>e.toString(16).padStart(2,"0");function S(e,n,t,f){let s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=n;for(;r+8<=t;){let o=s.getUint32(r),a=8;if(o===1?(o=Number(s.getBigUint64(r+8)),a=16):o===0&&(o=t-r),P(e,r+4)===f)return[r+a,r+o];if(o<a)break;r+=o}return null}function H(e,n,t,f){let s=[n,t];for(let r of f){if(!s)return null;s=S(e,s[0],s[1],r)}return s}function M(e,n,t){let f=S(e,n[0],n[1],"stts");if(!f)return new Int32Array(0);let s=t.getUint32(f[0]+4),r=[],o=0,a=f[0]+8;for(let i=0;i<s;i++){let p=t.getUint32(a),u=t.getInt32(a+4);for(let m=0;m<p;m++)r.push(o),o+=u;a+=8}let c=r.length,l=S(e,n[0],n[1],"ctts"),g=new Float64Array(c);for(let i=0;i<c;i++)g[i]=r[i];if(l){let i=t.getUint32(l[0]+4),p=l[0]+8,u=0;for(let m=0;m<i&&u<c;m++){let d=t.getUint32(p),h=t.getInt32(p+4);for(let k=0;k<d&&u<c;k++)g[u++]+=h;p+=8}}let w=Array.from({length:c},(i,p)=>p).sort((i,p)=>g[i]-g[p]||i-p),y=new Int32Array(c);for(let i=0;i<c;i++)y[w[i]]=i;return y}function I(e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),t=S(e,0,e.length,"moov"),[f,s]=t??[0,e.length],r=f;for(;r+8<=s;){let o=n.getUint32(r),a=8;if(o===1?(o=Number(n.getBigUint64(r+8)),a=16):o===0&&(o=s-r),P(e,r+4)==="trak"){let c=H(e,r+a,r+o,["mdia","minf","stbl"]);if(c){let l=S(e,c[0],c[1],"stsd");if(l){let g=l[0]+8,w=P(e,g+4);if(w==="avc1"||w==="avc3"||w==="hvc1"||w==="hev1"){let y=n.getUint32(g),i=g+8+78,p=w.startsWith("hv")||w.startsWith("he"),u=S(e,i,g+y,p?"hvcC":"avcC");if(!u)return null;let m=e.subarray(u[0],u[1]),d=p?"hvc1.1.6.L93.B0":`avc1.${z(m[1])}${z(m[2])}${z(m[3])}`,h=M(e,c,n),k=h.length,C=S(e,c[0],c[1],"stss"),b=[];if(C){let T=n.getUint32(C[0]+4);for(let U=0;U<T;U++)b.push(n.getUint32(C[0]+8+U*4)-1)}else for(let T=0;T<k;T++)b.push(T);return(b.length===0||b[0]!==0)&&b.unshift(0),b.sort((T,U)=>T-U),{codec:d,description:m,keyframes:b,decodeToPres:h}}}}}if(o<a)break;r+=o}return null}var x=8,R=1500,F=new WeakMap;async function L(e){let n=F.get(e);return n||(n=q(e),F.set(e,n)),n}async function q(e){if(typeof VideoDecoder>"u")throw new Error("h264: WebCodecs (VideoDecoder) not available in this context");let n=e.parts[0],t=await O({fileSize:n.fileSize,read:n.read}),f=V(D(t)),s=I(t);if(!s)throw new Error("h264: no H.264/HEVC config in container");let r=s.decodeToPres.length||f.length,o=new Int32Array(r);for(let l=0;l<s.decodeToPres.length;l++)o[s.decodeToPres[l]]=l;let a=[];for(let l=0;l<s.keyframes.length;l++){let g=s.keyframes[l],w=l+1<s.keyframes.length?s.keyframes[l+1]:f.length;a.push([g,w])}let c={offs:f,cfg:s,gops:a,presToDecode:o,count:r,dec:null,wanted:-1,got:null,gotResolve:null,fedThrough:-1,queue:Promise.resolve()};return c.dec=new VideoDecoder({output:l=>{Number(l.timestamp)===c.wanted&&!c.got?(c.got=l,c.gotResolve?.()):l.close()},error:()=>{c.fedThrough=-1}}),c.dec.configure({codec:s.codec,description:s.description,optimizeForLatency:!0,hardwareAcceleration:"prefer-hardware"}),c}function B(e,n){let t=0,f=e.length-1,s=0;for(;t<=f;){let r=t+f>>1;e[r][0]<=n?(s=r,t=r+1):f=r-1}return s}async function $(e){let n=e.codedWidth,t=e.codedHeight;try{let f=n*t*4,s=new Uint8Array(f);return await e.copyTo(s,{format:"RGBA",colorSpace:"srgb"}),{width:n,height:t,rgba:s}}catch{let s=new OffscreenCanvas(n,t).getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("h264: no 2d context for frame readback");s.drawImage(e,0,0);let r=s.getImageData(0,0,n,t);return{width:n,height:t,rgba:new Uint8Array(r.data.buffer)}}}async function N(e,n){let t=await L(e);if(t.count===0)throw new Error("h264: empty clip");if(n<0||n>=t.count)throw new Error(`COVERAGE_MISS: frame ${n} outside 0..${t.count-1}`);let f,s=new Promise(o=>{f=o}),r=t.queue;t.queue=t.queue.then(()=>s),await r;try{let o=e.parts[0],a=t.presToDecode[n],c=B(t.gops,a),[l,g]=t.gops[c];for(let w=0;w<2;w++){let y=w===0&&t.fedThrough>l&&t.fedThrough<=g&&a>=t.fedThrough,i=y?t.fedThrough:l;if(!y&&t.fedThrough!==-1){try{await t.dec.flush()}catch{}t.fedThrough=-1}let p=Math.min(g,a+1+x);t.wanted=n,t.got=null;let u=new Promise(h=>{t.gotResolve=h});if(p>i){let h=1/0,k=0;for(let b=i;b<p;b++)h=Math.min(h,t.offs[b].offset),k=Math.max(k,t.offs[b].offset+t.offs[b].size);let C=await o.read(h,k-h);for(let b=i;b<p;b++){let T=t.offs[b];t.dec.decode(new EncodedVideoChunk({type:b===l?"key":"delta",timestamp:t.cfg.decodeToPres[b],data:C.subarray(T.offset-h,T.offset-h+T.size)}))}t.fedThrough=p}let m=new Promise(h=>setTimeout(h,R));if(await Promise.race([u,m]),!t.got){try{await t.dec.flush()}catch{}t.fedThrough=-1}let d=t.got;if(t.wanted=-1,t.gotResolve=null,t.got=null,!!d)try{return await $(d)}finally{d.close()}}throw new Error(`h264: frame ${n} did not decode`)}finally{f()}}async function A(){return(await import("./isobmff-65LRNCQH.js")).isobmffFormat}var J={async inspect(e){return(await A()).inspect(e)},async extract(e){return(await A()).extract(e)},async sparsify(e,n){return(await A()).sparsify(e,n)},async trim(e,n){return(await A()).trim(e,n)},async decode(e,n){return N(e,n)}};export{J 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{Ha as v,na as g,pa as b}from"./chunk-DCO5D65W.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-LGRSWF7S.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};
3
+ import{Ja as v,oa as g,qa as b}from"./chunk-7Z65WW4I.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-WFJNAX7D.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};
@@ -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{a as T}from"./chunk-WWZDRERB.js";import{c as D}from"./chunk-4B4STXSA.js";import{Qb as P,Wb as N,_b as q}from"./chunk-E5TEETTE.js";import"./chunk-IN6XVTUS.js";import{l as A}from"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-Q2QOAQJV.js";import"./chunk-QOAPJ5Y2.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-N34DQ6MH.js";import{b as F}from"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import{n as M}from"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import{N as x,O as E,aa as U,ba as R,da as k,q as O,u as S}from"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";var y=s=>{let i=s?.target_url??s?.local_path??"";return i.startsWith("file://")?O(i):i};async function H(s,i){let o=await V(s,i);return await I(s,o.session,i),o}async function I(s,i,o){let r=await s.liveMarkers(o).catch(()=>null);if(!r)return;let l=i.timelines,e=l.find(m=>m.kind!=="compound")??l[0];if(!e)return;let t=(m,f,a,p)=>({id:`live-${p??"tl"}-${m}`,time:{value:m},duration:{value:Math.max(1,f)},color:a.color,name:a.name,note:a.note,...p?{item_id:p}:{}}),n=r.timeline.map(m=>t(m.frame,m.duration,m)),c=e.tracks.filter(m=>m.kind==="Video");for(let m of r.clips){let f=c[m.track-1]?.items.find(a=>a.timeline_range?.start?.value===m.start);if(f)for(let a of m.markers)n.push(t(a.frame,a.duration,a,f.id))}e.markers=n}async function V(s,i){let o=await s.items({timeline:i,kind:"video"}),r=o.items.map(f=>`${f.kind}:${f.track}:${f.start}:${f.end-f.start}`),l=async f=>{let a=await D(f,o.timeline).catch(()=>null);if(!a||!r.every(d=>a.has(d)))return null;let{session:p}=await P(f,"prproj"),u=p.timelines.find(d=>d.name===o.timeline);return u?z(p,u):null};if(o.project_path){let f=await l(o.project_path);if(f)return await C(f),{session:f,from:"the saved project (matches the live sequence)",path:o.project_path};let a=k(R(o.project_path),"Adobe Premiere Pro Auto-Save"),p=U(o.project_path).replace(/\.prproj$/i,""),u=[];try{for await(let d of E(a))d.isFile&&d.name.startsWith(`${p}--`)&&d.name.endsWith(".prproj")&&u.push({path:k(a,d.name),mtime:(await S(k(a,d.name))).mtime?.getTime()??0})}catch{}for(let d of u.sort((g,_)=>_.mtime-g.mtime).slice(0,3)){let g=await l(d.path);if(g&&await C(g),g)return{session:g,from:`Premiere's auto-save of ${new Date(d.mtime).toLocaleTimeString()} (matches the live sequence; the project itself is not saved)`,path:d.path}}}let e=k(await x("conform-ppro-"),"live.otio"),t=await s.export({timeline:i,out_path:e}),{session:n}=await P(t.path,t.format);if(await W(s,n),await Z(n),typeof o.drop_frame=="boolean")for(let f of n.timelines)f.is_drop_frame=o.drop_frame;await C(n);for(let f of n.timelines)for(let a of f.tracks)for(let p of a.items){let u=p;u.scale=null,u.position_x=null,u.position_y=null,u.rotation=null}let c=await s.model(i).then(f=>f.items.filter(a=>Object.keys(a.sizing??{}).length).map(a=>`${a.name??a.file_path.split("/").pop()} (V${a.track} @${a.start-f.start_frame})`)).catch(()=>[]),m=`Premiere's OTIO export carries the cut, not the clips' Motion / Opacity / effects / retimes${c.length?` \u2014 ${c.length} clip(s) here have Motion that will not carry: ${c.slice(0,6).join(", ")}${c.length>6?"\u2026":""}`:""}; save the project (or wait for its auto-save) and run it again for every one of them`;return{session:n,from:"Premiere's OTIO export of the live sequence (no saved or auto-saved copy matches it yet)",path:t.path,lossy:m}}async function C(s){let i=new Set;for(let r of s.media_references??[]){if(r.binding_state==="linked")continue;let l=y(r);l&&await S(l).then(e=>e.isFile,()=>!1)&&i.add(R(l))}let o=s;for(let r of i){let l=await T(o,{media_root:r,gather:"path",criteria:{file_name:!0,file_name_mode:"tight"},lane:"both",reset:!1,dry_run:!1,compare:!1,cap:2e3,remember:!1}).catch(()=>null);l?.changed&&(o=l.session)}return o!==s&&Object.assign(s,o),(s.media_references??[]).filter(r=>r.binding_state==="linked").length}async function Z(s){let i=0;for(let o of s.media_references??[]){if(o.source_resolution_w)continue;let r=y(o),l=r?await A(r).catch(()=>null):null;if(!l)continue;let e=l;for(let t of["source_resolution_w","source_resolution_h","source_pixel_aspect","codec","container","streams"])e[t]!=null&&o[t]==null&&(o[t]=e[t]);o.source_fps??=e.source_fps??null,o.source_timecode??=e.source_timecode??null,!o.available_range&&e.available_range&&(o.available_range=e.available_range),i++}return i}async function re(s,i){let o=i.timelines.filter(t=>t.offline_reference?.clip_id);if(!o.length)return 0;let r=t=>[...t?.clip_list??[],...(t?.folders??[]).flatMap(r)],l=new Map(r((await s.project({clips:!0})).pool).map(t=>[t.id,t])),e=0;for(let t of o){let n=l.get(t.offline_reference.clip_id);if(n?.file){let c=i.media_references.find(m=>y(m)===n.file);c||(c={id:`offline-ref-${t.id??e}`,kind:"external",name:n.name,target_url:`file://${n.file}`,local_path:n.file},i.media_references.push(c)),t.offline_reference.media_reference_id=c.id,e++}else if(n&&n.name!==t.name&&(n.type==="Timeline"||/compound/i.test(n.type??""))){let{createSession:c}=await import("./store-F2CTSR6E.js"),m=k(await x("conform-offline-ref-"),`${n.name.replace(/[^\w.-]+/g,"_")}.drt`),f=await s.export(n.type==="Timeline"?{timeline:n.name,out_path:m}:{clip_id:n.id,out_path:m}),{session:a}=await P(f.path,"drt");a=(await M(a))?.session??a,t.offline_reference.session_id=(await c(a,f.path,"drt")).id,e++}else t.offline_reference=null}return e}async function W(s,i){let o=(await s.projectClips()).clips,r=new Map(o.filter(e=>e.start_frame!=null&&e.fps).map(e=>[e.file,e])),l=0;for(let e of i.media_references??[]){if(e.source_timecode)continue;let t=r.get(y(e));if(t){e.source_timecode=F(t.start_frame,t.fps),e.source_fps??=t.fps,l++;continue}let n=y(e),c=n?await A(n).catch(()=>null):null;c?.source_timecode&&(e.source_timecode=c.source_timecode,e.source_fps??=c.source_fps??null,l++)}return l}function z(s,i){let o=new Map(s.timelines.map(l=>[l.id,l])),r=[i];for(let l=0;l<r.length;l++)for(let e of r[l].tracks)for(let t of e.items){let n=t.nested_timeline_id,c=n?o.get(n):void 0;c&&!r.includes(c)&&r.push(c)}return{...s,timelines:r}}function X(s,i){let o=new Map((s.media_references??[]).map(n=>[n.id,y(n)])),r=[];for(let n of i.media_references??[]){let c=o.get(n.id),m=y(n);c!==void 0&&m&&m!==c&&r.push({ref_id:n.id,old:c,new:m})}let l=new Map(r.map(n=>[n.ref_id,n])),e=[],t=i.timelines.find(n=>n.kind==="primary")??i.timelines[0];for(let n of t?.tracks??[])if(n.kind==="Video")for(let c of n.items){let m=c.media_reference_id?l.get(c.media_reference_id):void 0;!m||c.kind!=="clip"||!c.source_range||e.push({track:n.track_index,start:c.timeline_range.start.value,duration:c.timeline_range.duration.value,src_in:c.source_range.start.value,path:m.new,name:c.name??""})}return{media:r,cuts:e}}async function oe(s,i){let{session:o,from:r,lossy:l}=await H(s,i.timeline),e=await T(structuredClone(o),{media_root:i.media_root,gather:"walk",reset:!0,lane:"video",dry_run:!1,cap:2e3,criteria:i.criteria??(i.mode==="cut_in"?{file_name:!1,reel_name:!0}:{file_name:!0,file_name_mode:"loose"}),tolerances:i.tolerances}),{media:t,cuts:n}=X(o,e.session),c=[`read from ${r}`,...l&&i.mode==="new_version"?[`\u26A0 ${l}`]:[],`matched ${t.length} medi${t.length===1?"um":"a"} under ${i.media_root} (${n.length} clip use${n.length===1?"":"s"} in the sequence)`],m=t.map(u=>` ${u.old.split("/").pop()} \u2192 ${u.new}`);if(i.dry_run||!t.length)return{text:[...c,...m,i.dry_run?"(dry run \u2014 nothing changed in Premiere)":"",e.text.split(`
3
+ import{a as T}from"./chunk-2X2SFPWD.js";import{c as D}from"./chunk-2DMNGWC2.js";import{Qb as P,Wb as N,_b as q}from"./chunk-XLRQNFJU.js";import"./chunk-IN6XVTUS.js";import{l as A}from"./chunk-E4KQR4M3.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-YMRK5D3X.js";import"./chunk-6BL5HE4S.js";import"./chunk-TNCXZIOX.js";import"./chunk-5JIFRR7U.js";import"./chunk-WRDA44QF.js";import"./chunk-PGJMKUUP.js";import"./chunk-6QB4DV22.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-ASFUV3PB.js";import"./chunk-NRURUPLU.js";import"./chunk-TGLH2JDW.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-N34DQ6MH.js";import{b as F}from"./chunk-NU3X7P4N.js";import"./chunk-7Z65WW4I.js";import{n as M}from"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import{N as x,O as E,aa as U,ba as R,da as k,q as O,u as S}from"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";var y=s=>{let i=s?.target_url??s?.local_path??"";return i.startsWith("file://")?O(i):i};async function H(s,i){let o=await V(s,i);return await I(s,o.session,i),o}async function I(s,i,o){let r=await s.liveMarkers(o).catch(()=>null);if(!r)return;let l=i.timelines,e=l.find(m=>m.kind!=="compound")??l[0];if(!e)return;let t=(m,f,a,p)=>({id:`live-${p??"tl"}-${m}`,time:{value:m},duration:{value:Math.max(1,f)},color:a.color,name:a.name,note:a.note,...p?{item_id:p}:{}}),n=r.timeline.map(m=>t(m.frame,m.duration,m)),c=e.tracks.filter(m=>m.kind==="Video");for(let m of r.clips){let f=c[m.track-1]?.items.find(a=>a.timeline_range?.start?.value===m.start);if(f)for(let a of m.markers)n.push(t(a.frame,a.duration,a,f.id))}e.markers=n}async function V(s,i){let o=await s.items({timeline:i,kind:"video"}),r=o.items.map(f=>`${f.kind}:${f.track}:${f.start}:${f.end-f.start}`),l=async f=>{let a=await D(f,o.timeline).catch(()=>null);if(!a||!r.every(d=>a.has(d)))return null;let{session:p}=await P(f,"prproj"),u=p.timelines.find(d=>d.name===o.timeline);return u?z(p,u):null};if(o.project_path){let f=await l(o.project_path);if(f)return await C(f),{session:f,from:"the saved project (matches the live sequence)",path:o.project_path};let a=k(R(o.project_path),"Adobe Premiere Pro Auto-Save"),p=U(o.project_path).replace(/\.prproj$/i,""),u=[];try{for await(let d of E(a))d.isFile&&d.name.startsWith(`${p}--`)&&d.name.endsWith(".prproj")&&u.push({path:k(a,d.name),mtime:(await S(k(a,d.name))).mtime?.getTime()??0})}catch{}for(let d of u.sort((g,_)=>_.mtime-g.mtime).slice(0,3)){let g=await l(d.path);if(g&&await C(g),g)return{session:g,from:`Premiere's auto-save of ${new Date(d.mtime).toLocaleTimeString()} (matches the live sequence; the project itself is not saved)`,path:d.path}}}let e=k(await x("conform-ppro-"),"live.otio"),t=await s.export({timeline:i,out_path:e}),{session:n}=await P(t.path,t.format);if(await W(s,n),await Z(n),typeof o.drop_frame=="boolean")for(let f of n.timelines)f.is_drop_frame=o.drop_frame;await C(n);for(let f of n.timelines)for(let a of f.tracks)for(let p of a.items){let u=p;u.scale=null,u.position_x=null,u.position_y=null,u.rotation=null}let c=await s.model(i).then(f=>f.items.filter(a=>Object.keys(a.sizing??{}).length).map(a=>`${a.name??a.file_path.split("/").pop()} (V${a.track} @${a.start-f.start_frame})`)).catch(()=>[]),m=`Premiere's OTIO export carries the cut, not the clips' Motion / Opacity / effects / retimes${c.length?` \u2014 ${c.length} clip(s) here have Motion that will not carry: ${c.slice(0,6).join(", ")}${c.length>6?"\u2026":""}`:""}; save the project (or wait for its auto-save) and run it again for every one of them`;return{session:n,from:"Premiere's OTIO export of the live sequence (no saved or auto-saved copy matches it yet)",path:t.path,lossy:m}}async function C(s){let i=new Set;for(let r of s.media_references??[]){if(r.binding_state==="linked")continue;let l=y(r);l&&await S(l).then(e=>e.isFile,()=>!1)&&i.add(R(l))}let o=s;for(let r of i){let l=await T(o,{media_root:r,gather:"path",criteria:{file_name:!0,file_name_mode:"tight"},lane:"both",reset:!1,dry_run:!1,compare:!1,cap:2e3,remember:!1}).catch(()=>null);l?.changed&&(o=l.session)}return o!==s&&Object.assign(s,o),(s.media_references??[]).filter(r=>r.binding_state==="linked").length}async function Z(s){let i=0;for(let o of s.media_references??[]){if(o.source_resolution_w)continue;let r=y(o),l=r?await A(r).catch(()=>null):null;if(!l)continue;let e=l;for(let t of["source_resolution_w","source_resolution_h","source_pixel_aspect","codec","container","streams"])e[t]!=null&&o[t]==null&&(o[t]=e[t]);o.source_fps??=e.source_fps??null,o.source_timecode??=e.source_timecode??null,!o.available_range&&e.available_range&&(o.available_range=e.available_range),i++}return i}async function re(s,i){let o=i.timelines.filter(t=>t.offline_reference?.clip_id);if(!o.length)return 0;let r=t=>[...t?.clip_list??[],...(t?.folders??[]).flatMap(r)],l=new Map(r((await s.project({clips:!0})).pool).map(t=>[t.id,t])),e=0;for(let t of o){let n=l.get(t.offline_reference.clip_id);if(n?.file){let c=i.media_references.find(m=>y(m)===n.file);c||(c={id:`offline-ref-${t.id??e}`,kind:"external",name:n.name,target_url:`file://${n.file}`,local_path:n.file},i.media_references.push(c)),t.offline_reference.media_reference_id=c.id,e++}else if(n&&n.name!==t.name&&(n.type==="Timeline"||/compound/i.test(n.type??""))){let{createSession:c}=await import("./store-F2CTSR6E.js"),m=k(await x("conform-offline-ref-"),`${n.name.replace(/[^\w.-]+/g,"_")}.drt`),f=await s.export(n.type==="Timeline"?{timeline:n.name,out_path:m}:{clip_id:n.id,out_path:m}),{session:a}=await P(f.path,"drt");a=(await M(a))?.session??a,t.offline_reference.session_id=(await c(a,f.path,"drt")).id,e++}else t.offline_reference=null}return e}async function W(s,i){let o=(await s.projectClips()).clips,r=new Map(o.filter(e=>e.start_frame!=null&&e.fps).map(e=>[e.file,e])),l=0;for(let e of i.media_references??[]){if(e.source_timecode)continue;let t=r.get(y(e));if(t){e.source_timecode=F(t.start_frame,t.fps),e.source_fps??=t.fps,l++;continue}let n=y(e),c=n?await A(n).catch(()=>null):null;c?.source_timecode&&(e.source_timecode=c.source_timecode,e.source_fps??=c.source_fps??null,l++)}return l}function z(s,i){let o=new Map(s.timelines.map(l=>[l.id,l])),r=[i];for(let l=0;l<r.length;l++)for(let e of r[l].tracks)for(let t of e.items){let n=t.nested_timeline_id,c=n?o.get(n):void 0;c&&!r.includes(c)&&r.push(c)}return{...s,timelines:r}}function X(s,i){let o=new Map((s.media_references??[]).map(n=>[n.id,y(n)])),r=[];for(let n of i.media_references??[]){let c=o.get(n.id),m=y(n);c!==void 0&&m&&m!==c&&r.push({ref_id:n.id,old:c,new:m})}let l=new Map(r.map(n=>[n.ref_id,n])),e=[],t=i.timelines.find(n=>n.kind==="primary")??i.timelines[0];for(let n of t?.tracks??[])if(n.kind==="Video")for(let c of n.items){let m=c.media_reference_id?l.get(c.media_reference_id):void 0;!m||c.kind!=="clip"||!c.source_range||e.push({track:n.track_index,start:c.timeline_range.start.value,duration:c.timeline_range.duration.value,src_in:c.source_range.start.value,path:m.new,name:c.name??""})}return{media:r,cuts:e}}async function oe(s,i){let{session:o,from:r,lossy:l}=await H(s,i.timeline),e=await T(structuredClone(o),{media_root:i.media_root,gather:"walk",reset:!0,lane:"video",dry_run:!1,cap:2e3,criteria:i.criteria??(i.mode==="cut_in"?{file_name:!1,reel_name:!0}:{file_name:!0,file_name_mode:"loose"}),tolerances:i.tolerances}),{media:t,cuts:n}=X(o,e.session),c=[`read from ${r}`,...l&&i.mode==="new_version"?[`\u26A0 ${l}`]:[],`matched ${t.length} medi${t.length===1?"um":"a"} under ${i.media_root} (${n.length} clip use${n.length===1?"":"s"} in the sequence)`],m=t.map(u=>` ${u.old.split("/").pop()} \u2192 ${u.new}`);if(i.dry_run||!t.length)return{text:[...c,...m,i.dry_run?"(dry run \u2014 nothing changed in Premiere)":"",e.text.split(`
4
4
  `).slice(-6).join(`
5
5
  `)].filter(Boolean).join(`
6
6
  `),data:{media:t,cuts:n,from:r}};if(i.mode==="replace"||i.mode==="hires"||i.mode==="proxy"){let d=(await s.projectClips()).clips.flatMap(w=>t.filter(j=>j.old===w.file).map(j=>({clip:w.id,path:j.new,mode:i.mode}))),g=i.mode==="replace"?L(o,e.session,t):new Map,_=g.size?await Y(s,new Set(g.keys())):[],b=await s.relinkClips(d),h=b.results.filter(w=>w.ok).length,$=[...c,`${i.mode==="hires"?"attached full-res behind":i.mode==="proxy"?"attached as proxies to":"repointed"} ${h}/${d.length} project clip(s)${i.mode==="proxy"?" (Toggle Proxies in Premiere switches)":""}`,...m,...b.results.filter(w=>!w.ok).map(w=>` refused: ${w.detail??"Premiere refused"}`)],v=_.length?await B(s,_,g):null;return v&&$.push(...v.lines),{text:$.join(`
@@ -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{g as a,h as b,i as c,j as d}from"./chunk-T4B4Y5WQ.js";import"./chunk-2DMNGWC2.js";import"./chunk-XLRQNFJU.js";import"./chunk-IN6XVTUS.js";import"./chunk-E4KQR4M3.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-YMRK5D3X.js";import"./chunk-6BL5HE4S.js";import"./chunk-TNCXZIOX.js";import"./chunk-5JIFRR7U.js";import"./chunk-WRDA44QF.js";import"./chunk-PGJMKUUP.js";import"./chunk-6QB4DV22.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-ASFUV3PB.js";import"./chunk-NRURUPLU.js";import"./chunk-TGLH2JDW.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-7Z65WW4I.js";import"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";export{a as AVID_SETUP,b as FLAME_SETUP,d as adapter,c as setAdapter};
package/dist/http.js CHANGED
@@ -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{a as jt}from"./chunk-T4HZ6ASN.js";import{a as Tt,b as vt,c as Rt,d as Et,f as Pt,g as Ct,h as $t,i as At,l as O,m as Nt,p as $,q as Mt}from"./chunk-H6XXKUWJ.js";import"./chunk-3AR7KSPH.js";import"./chunk-WWZDRERB.js";import"./chunk-KNUHQP6W.js";import"./chunk-4B4STXSA.js";import"./chunk-3KS3547B.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{Ab as _t,G as it,H as ct,J as ht,Qc as yt,Uc as bt,Vc as D,Wc as T,bd as xt,dd as St,fd as Ot,tc as kt,zb as wt}from"./chunk-E5TEETTE.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-Q2QOAQJV.js";import{a as at}from"./chunk-QOAPJ5Y2.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import{C,E as gt,t as W,u as ut,v as dt,x as pt,y as mt,z as ft}from"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-LMRPCWHV.js";import"./chunk-ZNUIZEPF.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import{C as V,k as G,y as lt}from"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import{a as H}from"./chunk-E75BCWXY.js";import{A as F,B as et,C as j,E as nt,I as L,N as J,O as ot,P as st,W as rt,aa as U,b as v,ba as I,da as S,o as P,u as B,v as Q,y as q,z as tt}from"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";import N from"node:process";var Lt=new Map;function Ut(t,i,r,b){let a=`${t}:${r}:${b}`,o=Lt.get(a);return o||(o=(async()=>{let n=S(P(),"cache","grade-luts",t);await j(n);let d=S(n,`V${r}_${b}.cube`);if(!await Q(d)){let{adapter:_}=await import("./hosts-4JZDHI6N.js");if((await _("resolve").clipLut({timeline:i,track:r,start:b,out_path:d})).ok===!1)return null}return d})().catch(()=>null),Lt.set(a,o)),o}var Vt=new Set(["/app/convert","/app/canonicalize"]);function zt(t,i){let r=(i??"").split(";")[0].trim().toLowerCase();return r==="application/json"||r==="application/octet-stream"&&Vt.has(t)}function Wt(t){let i=t.replace(/[\\/:*?"<>|\x00-\x1f]+/g,"_").replace(/[. ]+$/,"")||"timeline";return/^(con|prn|aux|nul|com\d|lpt\d)(\..*)?$/i.test(i)?`_${i}`:i}var K={id:"local",name:"Local",client_name:null,handles:24,local:!0};async function Bt(){try{return JSON.parse(await tt(S(P(),"projects","projects.json")))}catch{return[]}}async function Dt(){let t=await O("project",{action:"list"});if(!t.isError){let i=t.structuredContent?.projects??[];return await j(S(P(),"projects")),await et(S(P(),"projects","projects.json"),JSON.stringify(i)),{projects:[K,...i],offline:!1}}return{projects:[K,...await Bt()],offline:!0,code:String(t.structuredContent?.code??"offline"),reason:String(t.structuredContent?.message??t.content[0]?.text??"")}}async function Kt(t){return t==="local"?K:(await Bt()).find(i=>i.id===t)??{id:t,name:t}}async function Ft(t,i,r,b,a=(o,n)=>new Response(o,{headers:{"content-type":n}})){if(i[0]!=="app")return null;let[,o,n,d]=i,_=async()=>t.headers.get("content-type")?.includes("json")?await t.json():{};try{if(o==="policy"&&t.method==="GET"){let{config:e}=await import("./account-RSL4PTDB.js"),s=await fetch(`${e().supabaseUrl}/functions/v1/v1-billing/v1/billing/app-policy`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null);return r(s?.ok?await s.json():{offline:!0})}if(o==="account"&&t.method==="GET"){let e=await O("account_status",{}),s=await V().then(c=>({app:!0,studio_tools:c.source==="licence"||lt(c)?.studio_tools!==!1}),c=>({app:!1,app_reason:c.message,code:c.code,...c.data?.in_use_by?{in_use_by:c.data.in_use_by}:{}}));return r({...e.structuredContent,...e.structuredContent?.account??{},...s,text:e.content[0]?.text})}{let e=await V().then(()=>null,s=>s);if(e)return r({ok:!1,code:e.code,message:e.message,needs:"app"},e.code==="not_signed_in"?401:402)}if(o==="events"&&t.method==="GET")return b(Et());if(o==="front"&&t.method==="POST"){let e=await t.json();return vt({project:String(e.project??""),view:String(e.view??""),...e.tool?{tool:String(e.tool)}:{}}),r({ok:!0})}if(o==="problem"&&t.method==="POST"){let e=await t.json().catch(()=>({})),s=/\bnot signed in\b/i.test(String(e.what??""))?"not_signed_in":"window_error";return await D("app_window",{isError:!0,content:[],structuredContent:{code:s,message:`${String(e.what??"").slice(0,200)}${e.detail?`
3
+ import{a as jt}from"./chunk-JZCADV5C.js";import{a as Tt,b as vt,c as Rt,d as Et,f as Pt,g as Ct,h as $t,i as At,l as O,m as Nt,p as $,q as Mt}from"./chunk-M6SVZJAX.js";import"./chunk-UXEL636C.js";import"./chunk-2X2SFPWD.js";import"./chunk-T4B4Y5WQ.js";import"./chunk-2DMNGWC2.js";import"./chunk-3KS3547B.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{Ab as _t,G as it,H as ct,J as ht,Qc as yt,Uc as bt,Vc as D,Wc as T,bd as xt,dd as St,fd as Ot,tc as kt,zb as wt}from"./chunk-XLRQNFJU.js";import"./chunk-IN6XVTUS.js";import"./chunk-E4KQR4M3.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-YMRK5D3X.js";import{a as at}from"./chunk-6BL5HE4S.js";import"./chunk-TNCXZIOX.js";import"./chunk-5JIFRR7U.js";import"./chunk-WRDA44QF.js";import"./chunk-PGJMKUUP.js";import"./chunk-6QB4DV22.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-ASFUV3PB.js";import"./chunk-NRURUPLU.js";import"./chunk-TGLH2JDW.js";import{C,E as gt,t as W,u as ut,v as dt,x as pt,y as mt,z as ft}from"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-LMRPCWHV.js";import"./chunk-BIX5ETBY.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-7Z65WW4I.js";import{C as V,k as G,y as lt}from"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import{a as H}from"./chunk-E75BCWXY.js";import{A as F,B as et,C as j,E as nt,I as L,N as J,O as ot,P as st,W as rt,aa as U,b as v,ba as I,da as S,o as P,u as B,v as Q,y as q,z as tt}from"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";import N from"node:process";var Lt=new Map;function Ut(t,i,r,b){let a=`${t}:${r}:${b}`,o=Lt.get(a);return o||(o=(async()=>{let n=S(P(),"cache","grade-luts",t);await j(n);let d=S(n,`V${r}_${b}.cube`);if(!await Q(d)){let{adapter:_}=await import("./hosts-DXH4SQPZ.js");if((await _("resolve").clipLut({timeline:i,track:r,start:b,out_path:d})).ok===!1)return null}return d})().catch(()=>null),Lt.set(a,o)),o}var Vt=new Set(["/app/convert","/app/canonicalize"]);function zt(t,i){let r=(i??"").split(";")[0].trim().toLowerCase();return r==="application/json"||r==="application/octet-stream"&&Vt.has(t)}function Wt(t){let i=t.replace(/[\\/:*?"<>|\x00-\x1f]+/g,"_").replace(/[. ]+$/,"")||"timeline";return/^(con|prn|aux|nul|com\d|lpt\d)(\..*)?$/i.test(i)?`_${i}`:i}var K={id:"local",name:"Local",client_name:null,handles:24,local:!0};async function Bt(){try{return JSON.parse(await tt(S(P(),"projects","projects.json")))}catch{return[]}}async function Dt(){let t=await O("project",{action:"list"});if(!t.isError){let i=t.structuredContent?.projects??[];return await j(S(P(),"projects")),await et(S(P(),"projects","projects.json"),JSON.stringify(i)),{projects:[K,...i],offline:!1}}return{projects:[K,...await Bt()],offline:!0,code:String(t.structuredContent?.code??"offline"),reason:String(t.structuredContent?.message??t.content[0]?.text??"")}}async function Kt(t){return t==="local"?K:(await Bt()).find(i=>i.id===t)??{id:t,name:t}}async function Ft(t,i,r,b,a=(o,n)=>new Response(o,{headers:{"content-type":n}})){if(i[0]!=="app")return null;let[,o,n,d]=i,_=async()=>t.headers.get("content-type")?.includes("json")?await t.json():{};try{if(o==="policy"&&t.method==="GET"){let{config:e}=await import("./account-RSL4PTDB.js"),s=await fetch(`${e().supabaseUrl}/functions/v1/v1-billing/v1/billing/app-policy`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null);return r(s?.ok?await s.json():{offline:!0})}if(o==="account"&&t.method==="GET"){let e=await O("account_status",{}),s=await V().then(c=>({app:!0,studio_tools:c.source==="licence"||lt(c)?.studio_tools!==!1}),c=>({app:!1,app_reason:c.message,code:c.code,...c.data?.in_use_by?{in_use_by:c.data.in_use_by}:{}}));return r({...e.structuredContent,...e.structuredContent?.account??{},...s,text:e.content[0]?.text})}{let e=await V().then(()=>null,s=>s);if(e)return r({ok:!1,code:e.code,message:e.message,needs:"app"},e.code==="not_signed_in"?401:402)}if(o==="events"&&t.method==="GET")return b(Et());if(o==="front"&&t.method==="POST"){let e=await t.json();return vt({project:String(e.project??""),view:String(e.view??""),...e.tool?{tool:String(e.tool)}:{}}),r({ok:!0})}if(o==="problem"&&t.method==="POST"){let e=await t.json().catch(()=>({})),s=/\bnot signed in\b/i.test(String(e.what??""))?"not_signed_in":"window_error";return await D("app_window",{isError:!0,content:[],structuredContent:{code:s,message:`${String(e.what??"").slice(0,200)}${e.detail?`
4
4
  ${String(e.detail).slice(0,100)}`:""}`}},0),r({ok:!0})}if(o==="convert"&&t.method==="POST"){let e=new URL(t.url).searchParams,s=U(e.get("name")||"timeline"),c=e.get("out")||"",p=JSON.parse(e.get("targets")||"[]"),l=JSON.parse(e.get("sequences")||"[]");if(!c||!p.length)return r({ok:!1,error:"a folder and at least one format are needed"},400);let u=await J("conform-te-"),f=S(u,s);await F(f,new Uint8Array(await t.arrayBuffer()));let h=await O("timeline_read",{path:f}),y=h.structuredContent?.session_id??h.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(h.isError||!y)return r({ok:!1,error:h.content[0]?.text??"could not read the timeline"});let w=(await C(y)).session.timelines.filter(x=>x.kind!=="compound"),k=l.length?w.filter(x=>l.includes(x.name??"")):w,m=[],R=0;for(let x of k)for(let E of p){let M=S(c,`${Wt(x.name??"timeline")}.${E.ext}`),Z=await O("timeline_write",{session_id:y,target:E.target,out_path:M,...k.length>1||w.length>1?{timeline_id:x.id}:{}});Z.isError?m.push(`${x.name} \u2192 ${E.target}: ${Z.content[0]?.text}`):R++}return await L(u).catch(()=>{}),r({ok:R>0,savedCount:R,...m.length?{error:m.join(`
5
5
  `)}:{}})}if(o==="fs"&&t.method==="POST"){let{op:e,path:s,offset:c=0,length:p=0}=await _();if(e==="statPath"){let l=await B(s).catch(()=>null);return r({ok:!0,result:l?{kind:l.isDirectory?"directory":"file",size:l.size,lastModified:Math.round(l.mtimeMs)}:null})}if(e==="readDir"){let l=[];for await(let u of ot(s))(u.isFile||u.isDirectory)&&l.push({name:u.name,kind:u.isDirectory?"directory":"file"});return r({ok:!0,result:l})}if(e==="readFile"){let l=p>0?p:Math.max(0,(await B(s)).size-Math.max(0,c)),u=512<<20;if(l>u)return r({ok:!1,code:"too_large",message:`${s} is ${Math.round(l/(1<<20))} MB: read it in parts (offset, length \u2264 ${u>>20} MB)`},413);let f=await st(s);try{return a(await f.readAt(Math.max(0,c),l),"application/octet-stream")}finally{await f.close()}}return r({ok:!1,code:"bad_request",message:`no fs op ${e}`},400)}if(o==="canonicalize"&&t.method==="POST"){let e=new URL(t.url).searchParams,s=JSON.parse(e.get("sequences")||"[]"),c=JSON.parse(e.get("previous")||"[]"),p=await J("conform-te-");try{let l=S(p,U(e.get("name")||"timeline"));await F(l,new Uint8Array(await t.arrayBuffer()));let u=await O("timeline_read",{path:l}),f=u.structuredContent?.session_id??u.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(u.isError||!f)return r({ok:!1,error:u.content[0]?.text??"could not read the timeline"},422);let h=(await C(f)).session,y=h.timelines;if(s.length){let w=new Map;for(let m of c)w.set(m,(w.get(m)??0)+1);let k=new Set;for(let m of s){let R=h.timelines.filter(M=>M.kind!=="compound"&&(M.name??"")===m),x=w.get(m)??0;w.set(m,x+1);let E=R[Math.min(x,R.length-1)];E&&k.add(E)}y=h.timelines.filter(m=>m.kind==="compound"||k.has(m))}return r({ok:!0,session_id:f,session:{...h,timelines:y}})}finally{await L(p).catch(()=>{})}}if(o==="sessions"&&n&&d==="frame"){let e=new URL(t.url).searchParams,s=Math.max(0,Math.round(Number(e.get("f")??0))),c=Math.min(3840,Math.max(64,Number(e.get("w")??1280)|0));try{let f=(await C(n)).session,h=e.get("track")==="offline"?"offline":Number(e.get("track"))||void 0,y;if(e.get("grade")==="resolve"&&h!=="offline"){let k=(()=>{try{return wt(f,{record:s,timeline:e.get("timeline")??void 0,track:h})}catch{return null}})();k&&(y=await Ut(n,e.get("host_timeline")??void 0,k.video_track,k.record_start)??void 0)}let w=await _t(f,s,c,e.get("timeline")??void 0,h,y);if(w){let k=new Uint8Array(12+w.px.length),m=new DataView(k.buffer);return m.setUint32(0,w.w,!0),m.setUint32(4,w.h,!0),m.setUint32(8,w.order==="bgra"?1:0,!0),k.set(w.px,12),a(k,"application/x-conform-pixels")}}catch(f){return r({ok:!1,code:"no_frame",message:f.message},404)}let p=await O("timeline_frame",{session_id:n,record:s,width:c,...e.get("timeline")?{timeline:e.get("timeline")}:{}},{poll:!0}),l=p.structuredContent?.out_path;if(p.isError||!l)return r({ok:!1,code:String(p.structuredContent?.code??"no_frame"),message:p.content[0]?.text??"no picture here"},404);let u=await q(l);return await(U(I(l)).startsWith("conform-frame-")?L(I(l)):nt(l)).catch(()=>{}),a(u,"image/png")}if(o==="sessions"&&n&&t.method==="GET"){let e=await C(n).catch(()=>null);return e?r(e):r({ok:!1,code:"not_found"},404)}if(o==="sessions"&&!n)return r(await gt());if(o!=="projects")return r({ok:!1,code:"not_found"},404);if(!n){if(t.method==="POST"){let e=await _(),s=await O("project",{action:"create",name:e.name,client_name:e.client_name,handles:e.handles});return s.isError?r({...s.structuredContent,text:s.content[0]?.text},422):(await Dt(),r(s.structuredContent))}return r(await Dt())}if(!d){let[e,s,c,p,l,u]=await Promise.all([Kt(n),ut(n).catch(()=>null),ft(n),ht(n),xt(n).then(y=>y.facts).catch(()=>[]),n===W?null:St().catch(()=>null)]);await pt(n===W?null:{id:n,name:e.name??n});let{text:f="",...h}=s??{};return r({project:e,context:f,context_meta:h,sessions:c,activity:p.slice(-100).reverse(),known:Ot(l),facility:u?.text??""})}if(d==="sessions"&&t.method==="PUT")return await mt(n,String((await _()).session_id??"")),r({ok:!0});if(d==="context"&&t.method==="PUT"){let e=await _();try{let{text:s,...c}=await dt(n,String(e.text??""),e.base===void 0?void 0:e.base);return r({ok:!0,context:s,context_meta:c})}catch(s){if(s instanceof H&&s.code==="context_conflict"){let c=s.data?.current;return r({ok:!1,code:s.code,message:s.message,context:c.context,context_meta:{updated_at:c.context_updated_at,updated_by:c.context_updated_by_name??null}},409)}throw s}}return r({ok:!1,code:"not_found"},404)}catch(e){let s=e instanceof H?e:null;return r({ok:!1,code:s?.code??"internal",message:e.message},s?.code==="not_found"?404:s?.code==="invalid_args"?400:500)}}var Jt=t=>t==="1"?"app":"http",X=(t,i)=>t&&i.has(t)?t:"custom",A=new Map,Xt=500;function It(t){let i=null,r=Tt(a=>{switch(a.type){case"open":T(`app:open:${X(a.tool,t)}`);break;case"home":T("app:home");break;case"workspace":{let o=a.workspace;T("app:workspace",{counts:{open:Array.isArray(o?.open)?o.open.length:0}});break}case"settings":{let o=a.settings&&typeof a.settings=="object"?Object.keys(a.settings).filter(n=>/^[A-Za-z0-9_.]{1,64}$/.test(n)).slice(0,16):[];T("app:settings",{fields:o});break}case"run":{let o=a.run;if(!o?.id||!o.status||!/^[a-z]+$/.test(o.status)||A.get(o.id)===o.status)break;A.size>=Xt&&A.delete(A.keys().next().value),A.set(o.id,o.status),T(`app:run_${o.status}:${X(o.tool,t)}`,{fields:[o.by==="app"?"app":"assistant"],ok:o.status!=="failed"});break}}}),b=Rt(a=>{let o=/^[a-z]+$/.test(a.view)?a.view:"other",n=`${a.project}|${o}|${a.tool??""}`;n!==i&&(i=n,T(o==="tool"?`app:view:tool:${X(a.tool,t)}`:`app:view:${o}`))});return()=>{r(),b()}}bt();var Yt=Number(v("CONFORM_HTTP_PORT")??7791);v("CONFORM_EXIT_WITH_PARENT")==="1"&&(N.stdin.on("end",()=>N.exit(0)),N.stdin.on("close",()=>N.exit(0)),N.stdin.resume());yt(Jt(v("CONFORM_EXIT_WITH_PARENT")));It(new Set([...kt.map(t=>t.id),...$.map(t=>t.name),"context","source"]));var Y=v("CONFORM_HTTP_TOKEN")??"",Gt=(v("CONFORM_HTTP_ORIGINS")??"https://conform.tools,https://app.conform.tools,http://localhost:5173,http://localhost:3000").split(","),z=(t,i=new Headers)=>{let r=t.headers.get("origin")??"";return Gt.includes(r)&&i.set("access-control-allow-origin",r),i.set("access-control-allow-headers","authorization, content-type, x-conform-client, x-conform-poll"),i.set("access-control-allow-methods","GET, POST, PUT, DELETE, OPTIONS"),i.set("access-control-allow-private-network","true"),i.set("vary","origin"),i},Ht=new Set,g=(t,i,r=200)=>new Response(JSON.stringify(i),{status:r,headers:z(t,new Headers({"content-type":"application/json"}))});rt({hostname:"127.0.0.1",port:Yt,onListen:t=>{Ht=new Set([`127.0.0.1:${t}`,`localhost:${t}`,`[::1]:${t}`]),console.error(`conformtools HTTP API on http://127.0.0.1:${t} (${$.length} verbs)`),jt(t,Y)}},async t=>{let i=new URL(t.url),r=(t.headers.get("host")??"").toLowerCase();if(!Ht.has(r))return new Response("forbidden host",{status:403});let b=t.headers.get("origin");if(b&&!Gt.includes(b))return new Response("forbidden origin",{status:403});if(t.method==="OPTIONS")return new Response(null,{status:204,headers:z(t)});if((t.method==="POST"||t.method==="PUT")&&t.headers.get("content-length")!=="0"&&!zt(i.pathname,t.headers.get("content-type")))return g(t,{ok:!1,code:"unsupported_media_type",message:"send the body as application/json"},415);if(Y&&t.headers.get("authorization")!==`Bearer ${Y}`&&i.pathname!=="/health")return g(t,{ok:!1,code:"unauthorized"},401);let a=i.pathname.split("/").filter(Boolean);try{if(i.pathname==="/health")return g(t,{ok:!0,verbs:$.length,version:at,engine:G()});if(a[0]==="verbs"&&a.length===1&&t.method==="GET")return g(t,$.map(n=>({name:n.name,title:n.title,description:n.description,long:!!n.long,input_schema:ct(it.object(n.inputSchema)),protected_stages:n.protectedStages??[],engine:G()})));if(a[0]==="verbs"&&a.length===2&&t.method==="POST"){let n=Mt(a[1]);if(!n)return g(t,{ok:!1,code:"not_found",message:`unknown verb ${a[1]}`},404);let d=t.headers.get("content-type")?.includes("json")?await t.json():{},_=Nt(n.name,d);if(!_.ok)return g(t,{..._.result.structuredContent,text:_.result.content[0].text},400);let e=t.headers.get("x-conform-client"),s=e?null:Pt(n.name,_.data,()=>void T("finish_missing"));s&&D(n.name,s,0,Object.keys(_.data));let c=s??await O(n.name,_.data,{client:e??"http",poll:t.headers.get("x-conform-poll")==="1"});return g(t,{...c.structuredContent??{ok:!c.isError},text:c.content.map(p=>p.text).join(`
6
- `)},c.isError?422:200)}if(a[0]==="debug"&&a.length===3&&t.method==="POST"&&v("CONFORM_DEBUG_BRIDGE")==="1"){let{hostBridge:n}=await import("./bridge-KLZD2ITG.js"),d=await n();return await d.waitFor(a[1],5e3)?g(t,{ok:!0,result:await d.request(a[1],a[2],t.headers.get("content-type")?.includes("json")?await t.json():{},12e4)}):g(t,{ok:!1,code:"not_connected"},409)}let o=await Ft(t,a,(n,d)=>g(t,n,d),n=>new Response(n,{headers:z(t,new Headers({"content-type":"text/event-stream","cache-control":"no-cache"}))}),(n,d)=>new Response(n,{headers:z(t,new Headers({"content-type":d,"cache-control":"no-store"}))}));if(o)return o;if(a[0]==="jobs"&&a.length===1)return g(t,await At());if(a[0]==="jobs"&&a.length===2){if(t.method==="DELETE")return g(t,{ok:$t(a[1])});let n=await Ct(a[1]);return n?g(t,n):g(t,{ok:!1,code:"not_found"},404)}return g(t,{ok:!1,code:"not_found"},404)}catch(o){return g(t,{ok:!1,code:"internal",message:o instanceof Error?o.message:String(o)},500)}});
6
+ `)},c.isError?422:200)}if(a[0]==="debug"&&a.length===3&&t.method==="POST"&&v("CONFORM_DEBUG_BRIDGE")==="1"){let{hostBridge:n}=await import("./bridge-42OMO43V.js"),d=await n();return await d.waitFor(a[1],5e3)?g(t,{ok:!0,result:await d.request(a[1],a[2],t.headers.get("content-type")?.includes("json")?await t.json():{},12e4)}):g(t,{ok:!1,code:"not_connected"},409)}let o=await Ft(t,a,(n,d)=>g(t,n,d),n=>new Response(n,{headers:z(t,new Headers({"content-type":"text/event-stream","cache-control":"no-cache"}))}),(n,d)=>new Response(n,{headers:z(t,new Headers({"content-type":d,"cache-control":"no-store"}))}));if(o)return o;if(a[0]==="jobs"&&a.length===1)return g(t,await At());if(a[0]==="jobs"&&a.length===2){if(t.method==="DELETE")return g(t,{ok:$t(a[1])});let n=await Ct(a[1]);return n?g(t,n):g(t,{ok:!1,code:"not_found"},404)}return g(t,{ok:!1,code:"not_found"},404)}catch(o){return g(t,{ok:!1,code:"internal",message:o instanceof Error?o.message:String(o)},500)}});
@@ -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{a as ri}from"./chunk-3AR7KSPH.js";import"./chunk-IN6XVTUS.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-BBCQMZQN.js";import"./chunk-5JDF2IUF.js";import{a as Vr,b as Zs,d as ei,g as ti}from"./chunk-VZ3XYHK4.js";import"./chunk-C2ESM27Z.js";import{b as Ou,c as $,d as Qs,e as k,f as ze,g as Se}from"./chunk-PSANHDZM.js";var _e={};Qs(_e,{__addDisposableResource:()=>Pi,__assign:()=>Bt,__asyncDelegator:()=>bi,__asyncGenerator:()=>wi,__asyncValues:()=>Ei,__await:()=>Ge,__awaiter:()=>pi,__classPrivateFieldGet:()=>Ri,__classPrivateFieldIn:()=>Oi,__classPrivateFieldSet:()=>ki,__createBinding:()=>Mt,__decorate:()=>ai,__disposeResources:()=>Ci,__esDecorate:()=>li,__exportStar:()=>_i,__extends:()=>ii,__generator:()=>mi,__importDefault:()=>Ai,__importStar:()=>Ti,__makeTemplateObject:()=>Si,__metadata:()=>fi,__param:()=>ui,__propKey:()=>di,__read:()=>Gr,__rest:()=>oi,__rewriteRelativeImportExtension:()=>Ii,__runInitializers:()=>ci,__setFunctionName:()=>hi,__spread:()=>gi,__spreadArray:()=>vi,__spreadArrays:()=>yi,__values:()=>qt,default:()=>Nu});function ii(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Kr(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function oi(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function ai(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i}function ui(t,e){return function(r,n){e(r,n,t)}}function li(t,e,r,n,s,i){function o(T){if(T!==void 0&&typeof T!="function")throw new TypeError("Function expected");return T}for(var a=n.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,h=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),m,_=!1,f=r.length-1;f>=0;f--){var y={};for(var v in n)y[v]=v==="access"?{}:n[v];for(var v in n.access)y.access[v]=n.access[v];y.addInitializer=function(T){if(_)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(T||null))};var w=(0,r[f])(a==="accessor"?{get:h.get,set:h.set}:h[l],y);if(a==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(m=o(w.get))&&(h.get=m),(m=o(w.set))&&(h.set=m),(m=o(w.init))&&s.unshift(m)}else(m=o(w))&&(a==="field"?s.unshift(m):h[l]=m)}c&&Object.defineProperty(c,n.name,h),_=!0}function ci(t,e,r){for(var n=arguments.length>2,s=0;s<e.length;s++)r=n?e[s].call(t,r):e[s].call(t);return n?r:void 0}function di(t){return typeof t=="symbol"?t:"".concat(t)}function hi(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 fi(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function pi(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(h){try{c(n.next(h))}catch(m){o(m)}}function l(h){try{c(n.throw(h))}catch(m){o(m)}}function c(h){h.done?i(h.value):s(h.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}function mi(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,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(h){return l([c,h])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,s&&(i=c[0]&2?s.return:c[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;switch(s=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++,s=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(h){c=[6,h],s=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function _i(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Mt(e,t,r)}function qt(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gr(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function gi(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Gr(arguments[e]));return t}function yi(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,s++)n[s]=i[o];return n}function vi(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Ge(t){return this instanceof Ge?(this.v=t,this):new Ge(t)}function wi(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(f){return function(y){return Promise.resolve(y).then(f,m)}}function a(f,y){n[f]&&(s[f]=function(v){return new Promise(function(w,T){i.push([f,v,w,T])>1||l(f,v)})},y&&(s[f]=y(s[f])))}function l(f,y){try{c(n[f](y))}catch(v){_(i[0][3],v)}}function c(f){f.value instanceof Ge?Promise.resolve(f.value.v).then(h,m):_(i[0][2],f)}function h(f){l("next",f)}function m(f){l("throw",f)}function _(f,y){f(y),i.shift(),i.length&&l(i[0][0],i[0][1])}}function bi(t){var e,r;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,i){e[s]=t[s]?function(o){return(r=!r)?{value:Ge(t[s](o)),done:!1}:i?i(o):o}:i}}function Ei(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 qt=="function"?qt(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(a,l){o=t[i](o),s(a,l,o.done,o.value)})}}function s(i,o,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},o)}}function Si(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Ti(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=zr(t),n=0;n<r.length;n++)r[n]!=="default"&&Mt(e,t,r[n]);return Iu(e,t),e}function Ai(t){return t&&t.__esModule?t:{default:t}}function Ri(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function ki(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r}function Oi(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 Pi(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,s;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(s=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");s&&(n=function(){try{s.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function Ci(t){function e(i){t.error=t.hasError?new xu(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function s(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(s);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(s,function(o){return e(o),s()})}else n|=1}catch(o){e(o)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return s()}function Ii(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,s,i,o){return n?e?".jsx":".js":s&&(!i||!o)?r:s+i+"."+o.toLowerCase()+"js"}):t}var Kr,Bt,Mt,Iu,zr,xu,Nu,ge=Ou(()=>{Kr=function(t,e){return Kr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},Kr(t,e)};Bt=function(){return Bt=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Bt.apply(this,arguments)};Mt=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});Iu=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},zr=function(t){return zr=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},zr(t)};xu=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};Nu={__extends:ii,__assign:Bt,__rest:oi,__decorate:ai,__param:ui,__esDecorate:li,__runInitializers:ci,__propKey:di,__setFunctionName:hi,__metadata:fi,__awaiter:pi,__generator:mi,__createBinding:Mt,__exportStar:_i,__values:qt,__read:Gr,__spread:gi,__spreadArrays:yi,__spreadArray:vi,__await:Ge,__asyncGenerator:wi,__asyncDelegator:bi,__asyncValues:Ei,__makeTemplateObject:Si,__importStar:Ti,__importDefault:Ai,__classPrivateFieldGet:Ri,__classPrivateFieldSet:ki,__classPrivateFieldIn:Oi,__addDisposableResource:Pi,__disposeResources:Ci,__rewriteRelativeImportExtension:Ii}});var xi=$(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.resolveFetch=void 0;var ju=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Wt.resolveFetch=ju});var Qr=$(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.FunctionRegion=ye.FunctionsHttpError=ye.FunctionsRelayError=ye.FunctionsFetchError=ye.FunctionsError=void 0;var Je=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};ye.FunctionsError=Je;var Jr=class extends Je{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};ye.FunctionsFetchError=Jr;var Yr=class extends Je{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};ye.FunctionsRelayError=Yr;var Xr=class extends Je{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};ye.FunctionsHttpError=Xr;var Ni;(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"})(Ni||(ye.FunctionRegion=Ni={}))});var ji=$(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.FunctionsClient=void 0;var Lu=(ge(),Se(_e)),Uu=xi(),Ye=Qr(),Zr=class{constructor(e,{headers:r={},customFetch:n,region:s=Ye.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=(0,Uu.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Lu.__awaiter(this,arguments,void 0,function*(r,n={}){var s;let i,o;try{let{headers:a,method:l,body:c,signal:h,timeout:m}=n,_={},{region:f}=n;f||(f=this.region);let y=new URL(`${this.url}/${r}`);f&&f!=="any"&&(_["x-region"]=f,y.searchParams.set("forceFunctionRegion",f));let v;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",v=c):typeof c=="string"?(_["Content-Type"]="text/plain",v=c):typeof FormData<"u"&&c instanceof FormData?v=c:(_["Content-Type"]="application/json",v=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?v=JSON.stringify(c):v=c;let w=h;m&&(o=new AbortController,i=setTimeout(()=>o.abort(),m),h?(w=o.signal,h.addEventListener("abort",()=>o.abort())):w=o.signal);let T=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},_),this.headers),a),body:v,signal:w}).catch(Z=>{throw new Ye.FunctionsFetchError(Z)}),O=T.headers.get("x-relay-error");if(O&&O==="true")throw new Ye.FunctionsRelayError(T);if(!T.ok)throw new Ye.FunctionsHttpError(T);let E=((s=T.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return E==="application/json"?x=yield T.json():E==="application/octet-stream"||E==="application/pdf"?x=yield T.blob():E==="text/event-stream"?x=T:E==="multipart/form-data"?x=yield T.formData():x=yield T.text(),{data:x,error:null,response:T}}catch(a){return{data:null,error:a,response:a instanceof Ye.FunctionsHttpError||a instanceof Ye.FunctionsRelayError?a.context:void 0}}finally{i&&clearTimeout(i)}})}};Vt.FunctionsClient=Zr});var Li=$(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.FunctionRegion=fe.FunctionsRelayError=fe.FunctionsHttpError=fe.FunctionsFetchError=fe.FunctionsError=fe.FunctionsClient=void 0;var $u=ji();Object.defineProperty(fe,"FunctionsClient",{enumerable:!0,get:function(){return $u.FunctionsClient}});var lt=Qr();Object.defineProperty(fe,"FunctionsError",{enumerable:!0,get:function(){return lt.FunctionsError}});Object.defineProperty(fe,"FunctionsFetchError",{enumerable:!0,get:function(){return lt.FunctionsFetchError}});Object.defineProperty(fe,"FunctionsHttpError",{enumerable:!0,get:function(){return lt.FunctionsHttpError}});Object.defineProperty(fe,"FunctionsRelayError",{enumerable:!0,get:function(){return lt.FunctionsRelayError}});Object.defineProperty(fe,"FunctionRegion",{enumerable:!0,get:function(){return lt.FunctionRegion}})});var tn=$(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.WebSocketFactory=void 0;var Kt=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 n=r.versions;if(n&&n.node){let s=n.node,i=parseInt(s.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{a as ri}from"./chunk-UXEL636C.js";import"./chunk-IN6XVTUS.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-BBCQMZQN.js";import"./chunk-TGLH2JDW.js";import{a as Vr,b as Zs,d as ei,g as ti}from"./chunk-VZ3XYHK4.js";import"./chunk-C2ESM27Z.js";import{b as Ou,c as $,d as Qs,e as k,f as ze,g as Se}from"./chunk-PSANHDZM.js";var _e={};Qs(_e,{__addDisposableResource:()=>Pi,__assign:()=>Bt,__asyncDelegator:()=>bi,__asyncGenerator:()=>wi,__asyncValues:()=>Ei,__await:()=>Ge,__awaiter:()=>pi,__classPrivateFieldGet:()=>Ri,__classPrivateFieldIn:()=>Oi,__classPrivateFieldSet:()=>ki,__createBinding:()=>Mt,__decorate:()=>ai,__disposeResources:()=>Ci,__esDecorate:()=>li,__exportStar:()=>_i,__extends:()=>ii,__generator:()=>mi,__importDefault:()=>Ai,__importStar:()=>Ti,__makeTemplateObject:()=>Si,__metadata:()=>fi,__param:()=>ui,__propKey:()=>di,__read:()=>Gr,__rest:()=>oi,__rewriteRelativeImportExtension:()=>Ii,__runInitializers:()=>ci,__setFunctionName:()=>hi,__spread:()=>gi,__spreadArray:()=>vi,__spreadArrays:()=>yi,__values:()=>qt,default:()=>Nu});function ii(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Kr(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function oi(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function ai(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i}function ui(t,e){return function(r,n){e(r,n,t)}}function li(t,e,r,n,s,i){function o(T){if(T!==void 0&&typeof T!="function")throw new TypeError("Function expected");return T}for(var a=n.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,h=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),m,_=!1,f=r.length-1;f>=0;f--){var y={};for(var v in n)y[v]=v==="access"?{}:n[v];for(var v in n.access)y.access[v]=n.access[v];y.addInitializer=function(T){if(_)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(T||null))};var w=(0,r[f])(a==="accessor"?{get:h.get,set:h.set}:h[l],y);if(a==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(m=o(w.get))&&(h.get=m),(m=o(w.set))&&(h.set=m),(m=o(w.init))&&s.unshift(m)}else(m=o(w))&&(a==="field"?s.unshift(m):h[l]=m)}c&&Object.defineProperty(c,n.name,h),_=!0}function ci(t,e,r){for(var n=arguments.length>2,s=0;s<e.length;s++)r=n?e[s].call(t,r):e[s].call(t);return n?r:void 0}function di(t){return typeof t=="symbol"?t:"".concat(t)}function hi(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 fi(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function pi(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(h){try{c(n.next(h))}catch(m){o(m)}}function l(h){try{c(n.throw(h))}catch(m){o(m)}}function c(h){h.done?i(h.value):s(h.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}function mi(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,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(h){return l([c,h])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,s&&(i=c[0]&2?s.return:c[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;switch(s=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++,s=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(h){c=[6,h],s=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function _i(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Mt(e,t,r)}function qt(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gr(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function gi(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Gr(arguments[e]));return t}function yi(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,s++)n[s]=i[o];return n}function vi(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Ge(t){return this instanceof Ge?(this.v=t,this):new Ge(t)}function wi(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(f){return function(y){return Promise.resolve(y).then(f,m)}}function a(f,y){n[f]&&(s[f]=function(v){return new Promise(function(w,T){i.push([f,v,w,T])>1||l(f,v)})},y&&(s[f]=y(s[f])))}function l(f,y){try{c(n[f](y))}catch(v){_(i[0][3],v)}}function c(f){f.value instanceof Ge?Promise.resolve(f.value.v).then(h,m):_(i[0][2],f)}function h(f){l("next",f)}function m(f){l("throw",f)}function _(f,y){f(y),i.shift(),i.length&&l(i[0][0],i[0][1])}}function bi(t){var e,r;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,i){e[s]=t[s]?function(o){return(r=!r)?{value:Ge(t[s](o)),done:!1}:i?i(o):o}:i}}function Ei(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 qt=="function"?qt(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(a,l){o=t[i](o),s(a,l,o.done,o.value)})}}function s(i,o,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},o)}}function Si(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Ti(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=zr(t),n=0;n<r.length;n++)r[n]!=="default"&&Mt(e,t,r[n]);return Iu(e,t),e}function Ai(t){return t&&t.__esModule?t:{default:t}}function Ri(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function ki(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r}function Oi(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 Pi(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,s;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(s=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");s&&(n=function(){try{s.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function Ci(t){function e(i){t.error=t.hasError?new xu(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function s(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(s);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(s,function(o){return e(o),s()})}else n|=1}catch(o){e(o)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return s()}function Ii(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,s,i,o){return n?e?".jsx":".js":s&&(!i||!o)?r:s+i+"."+o.toLowerCase()+"js"}):t}var Kr,Bt,Mt,Iu,zr,xu,Nu,ge=Ou(()=>{Kr=function(t,e){return Kr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},Kr(t,e)};Bt=function(){return Bt=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Bt.apply(this,arguments)};Mt=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});Iu=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},zr=function(t){return zr=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},zr(t)};xu=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};Nu={__extends:ii,__assign:Bt,__rest:oi,__decorate:ai,__param:ui,__esDecorate:li,__runInitializers:ci,__propKey:di,__setFunctionName:hi,__metadata:fi,__awaiter:pi,__generator:mi,__createBinding:Mt,__exportStar:_i,__values:qt,__read:Gr,__spread:gi,__spreadArrays:yi,__spreadArray:vi,__await:Ge,__asyncGenerator:wi,__asyncDelegator:bi,__asyncValues:Ei,__makeTemplateObject:Si,__importStar:Ti,__importDefault:Ai,__classPrivateFieldGet:Ri,__classPrivateFieldSet:ki,__classPrivateFieldIn:Oi,__addDisposableResource:Pi,__disposeResources:Ci,__rewriteRelativeImportExtension:Ii}});var xi=$(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.resolveFetch=void 0;var ju=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Wt.resolveFetch=ju});var Qr=$(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.FunctionRegion=ye.FunctionsHttpError=ye.FunctionsRelayError=ye.FunctionsFetchError=ye.FunctionsError=void 0;var Je=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};ye.FunctionsError=Je;var Jr=class extends Je{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};ye.FunctionsFetchError=Jr;var Yr=class extends Je{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};ye.FunctionsRelayError=Yr;var Xr=class extends Je{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};ye.FunctionsHttpError=Xr;var Ni;(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"})(Ni||(ye.FunctionRegion=Ni={}))});var ji=$(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.FunctionsClient=void 0;var Lu=(ge(),Se(_e)),Uu=xi(),Ye=Qr(),Zr=class{constructor(e,{headers:r={},customFetch:n,region:s=Ye.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=(0,Uu.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Lu.__awaiter(this,arguments,void 0,function*(r,n={}){var s;let i,o;try{let{headers:a,method:l,body:c,signal:h,timeout:m}=n,_={},{region:f}=n;f||(f=this.region);let y=new URL(`${this.url}/${r}`);f&&f!=="any"&&(_["x-region"]=f,y.searchParams.set("forceFunctionRegion",f));let v;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",v=c):typeof c=="string"?(_["Content-Type"]="text/plain",v=c):typeof FormData<"u"&&c instanceof FormData?v=c:(_["Content-Type"]="application/json",v=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?v=JSON.stringify(c):v=c;let w=h;m&&(o=new AbortController,i=setTimeout(()=>o.abort(),m),h?(w=o.signal,h.addEventListener("abort",()=>o.abort())):w=o.signal);let T=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},_),this.headers),a),body:v,signal:w}).catch(Z=>{throw new Ye.FunctionsFetchError(Z)}),O=T.headers.get("x-relay-error");if(O&&O==="true")throw new Ye.FunctionsRelayError(T);if(!T.ok)throw new Ye.FunctionsHttpError(T);let E=((s=T.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return E==="application/json"?x=yield T.json():E==="application/octet-stream"||E==="application/pdf"?x=yield T.blob():E==="text/event-stream"?x=T:E==="multipart/form-data"?x=yield T.formData():x=yield T.text(),{data:x,error:null,response:T}}catch(a){return{data:null,error:a,response:a instanceof Ye.FunctionsHttpError||a instanceof Ye.FunctionsRelayError?a.context:void 0}}finally{i&&clearTimeout(i)}})}};Vt.FunctionsClient=Zr});var Li=$(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.FunctionRegion=fe.FunctionsRelayError=fe.FunctionsHttpError=fe.FunctionsFetchError=fe.FunctionsError=fe.FunctionsClient=void 0;var $u=ji();Object.defineProperty(fe,"FunctionsClient",{enumerable:!0,get:function(){return $u.FunctionsClient}});var lt=Qr();Object.defineProperty(fe,"FunctionsError",{enumerable:!0,get:function(){return lt.FunctionsError}});Object.defineProperty(fe,"FunctionsFetchError",{enumerable:!0,get:function(){return lt.FunctionsFetchError}});Object.defineProperty(fe,"FunctionsHttpError",{enumerable:!0,get:function(){return lt.FunctionsHttpError}});Object.defineProperty(fe,"FunctionsRelayError",{enumerable:!0,get:function(){return lt.FunctionsRelayError}});Object.defineProperty(fe,"FunctionRegion",{enumerable:!0,get:function(){return lt.FunctionRegion}})});var tn=$(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.WebSocketFactory=void 0;var Kt=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 n=r.versions;if(n&&n.node){let s=n.node,i=parseInt(s.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
 
@@ -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{a as U}from"./chunk-TK55FA56.js";import{a as T,b as L}from"./chunk-AACY2V3L.js";import{b as _,c as O,g as J}from"./chunk-ASFUV3PB.js";import{b as V}from"./chunk-NRURUPLU.js";import{b as $,c as b}from"./chunk-TGLH2JDW.js";import{$ as p,A as P,B as x,C as A,D as F,Fa as N,Ia as C,Ja as u,N as D,O as z,ha as E,ia as k,k as w,m as v,n as y,p as R,sa as H,va as I,x as S,y as M}from"./chunk-7Z65WW4I.js";import"./chunk-PSANHDZM.js";function d(e){return(n,t)=>e.read(n,t)}function B(e){let n=e.toLowerCase().trim();return n==="aprn"||n==="aprh"?"prores_raw":n==="apch"||n==="apcn"||n==="apcs"||n==="apco"||n==="ap4h"||n==="ap4x"?"prores":n==="avdn"?"dnxhd":n==="dnxh"?"dnxhr":n==="avc1"||n==="avc3"?"h264":n==="hev1"||n==="hvc1"?"h265":n==="braw"?"braw":e}var h={apco:"Proxy",apcs:"LT",apcn:"422",apch:"HQ",ap4h:"4444",ap4x:"4444 XQ"},ee={1:"bt709",2:"unknown",4:"bt470m",5:"bt470bg",6:"smpte170m",7:"smpte240m",8:"film",9:"bt2020",10:"smpte428",11:"smpte431",12:"smpte432",22:"jedec-p22"},re={1:"bt709",2:"unknown",4:"gamma22",5:"gamma28",6:"smpte170m",7:"smpte240m",8:"linear",9:"log100",10:"log316",11:"iec61966-2-4",12:"bt1361e",13:"iec61966-2-1",14:"bt2020-10",15:"bt2020-12",16:"smpte2084",17:"smpte428",18:"arib-std-b67"},ne={0:"gbr",1:"bt709",2:"unknown",4:"fcc",5:"bt470bg",6:"smpte170m",7:"smpte240m",8:"ycgco",9:"bt2020nc",10:"bt2020c",14:"ictcp"};function te(e,n){return e==="ap4h"||e==="ap4x"?n===32?"yuva444p12le":"yuv444p12le":e in h?"yuv422p10le":void 0}var Q={66:"Baseline",77:"Main",88:"Extended",100:"High",110:"High 10",122:"High 4:2:2",244:"High 4:4:4"},j={1:"Main",2:"Main 10",3:"Main Still",4:"Rext"},oe={1270:"DNxHR 444",1271:"DNxHR HQX",1272:"DNxHR HQ",1273:"DNxHR SQ",1274:"DNxHR LB"};function ae(e,n){if(h[e.codec_fourcc])return`ProRes ${h[e.codec_fourcc]}`;if(e.vc3_cid)return oe[e.vc3_cid]??`DNxHD ${e.vc3_cid}`;if(e.video_profile!=null){if(n==="h264"&&Q[e.video_profile])return`H.264 ${Q[e.video_profile]}`;if(n==="h265"&&j[e.video_profile])return`HEVC ${j[e.video_profile]}`}}function ie(e,n){let t=e.video_chroma,r=e.video_bit_depth;if(t==null&&n==="h264"&&[66,77,88].includes(e.video_profile??-1)&&([t,r]=[1,8]),t==null&&e.vc3_cid&&(t=e.vc3_cid===1270||e.vc3_cid===1256?3:2),t==null||r==null)return;let i=["gray","yuv420p","yuv422p","yuv444p"][t];return r>8?`${i}${r}le`:i}function G(e,n){let t=[];for(let r of e){if(r.kind!=="clip"||!r.source_range)continue;let i=r.source_range.start.value,a=r.source_range.duration.value,s=Math.max(0,Math.floor(i)-n),o=Math.floor(i+a-1)+n;o>=s&&t.push({first_frame:s,last_frame:o})}return t}function se(e,n){return e&&n&&Math.abs(n/e-1)<.001?n:e??n}var he={async inspect(e){await u();let n=e.parts[0],t=await p(d(n),n.fileSize,e.format),r=JSON.parse(t);if(!r)return null;let i=r.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:null,a=r.video_fps_numerator&&r.video_fps_denominator?r.video_fps_numerator/r.video_fps_denominator:null,s=se(i,a),o=B(r.codec_fourcc),l=[{kind:"video",codec:o,width:r.width??void 0,height:r.height??void 0,rate:s??void 0,bit_depth:_(r.codec_fourcc)??_(o)??O(o,r.video_profile)??r.video_bit_depth??void 0,codec_specific:{fourcc:r.codec_fourcc,profile:ae(r,o),pixel_format:te(r.codec_fourcc,r.video_depth)??ie(r,o),colr:r.colr?{primaries:ee[r.colr.primaries]??r.colr.primaries,transfer:re[r.colr.transfer]??r.colr.transfer,matrix:ne[r.colr.matrix]??r.colr.matrix}:void 0}}];for(let c of r.audio_tracks??(r.audio?[r.audio]:[]))l.push({kind:"audio",codec:c.codec_fourcc,channels:c.channels??void 0,rate:c.sample_rate??void 0,bit_depth:c.bit_depth??void 0,codec_specific:{fourcc:c.codec_fourcc,channel_layout:c.channel_layout??void 0}});return{id:n.filename,kind:"external",target_url:n.filename,available_range:s&&r.duration_seconds?{start:{value:0,rate:s},duration:{value:Math.round(r.duration_seconds*s),rate:s}}:null,reel_name:null,source_timecode:r.timecode?.display??null,container:e.format==="mov"?"mov":e.format,codec:o,size_bytes:n.fileSize,source_fps:s,source_resolution_w:r.width??null,source_resolution_h:r.height??null,source_pixel_aspect:r.par?r.par[0]/r.par[1]:null,streams:l,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 u();let n=e.parts[0],t=JSON.parse(await k(d(n),n.fileSize,e.format));if(t.length===0)return null;let r=JSON.parse(await p(d(n),n.fileSize,e.format)),i=r?B(r.codec_fourcc):e.format,a=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:i,width:r?.width??void 0,height:r?.height??void 0,fps:a,frame_count:T(t),timecode:r?.timecode?.display??void 0,granularity:L(t),segments:t}},async sparsify(e,n){await u();let t=e.parts[0],r=G(n.items,n.handles),i=await I(d(t),t.fileSize,JSON.stringify(r),e.format),a=JSON.parse(i);return[{filename:t.filename,fileSize:a.fileSize,structuralRanges:a.structuralRanges,essenceRanges:a.essenceRanges,trimInputs:a.trimInputs}]},async trim(e,n){await u();let t=e.parts[0],r=t.dataRanges?JSON.parse(await E(d(t),t.fileSize,e.format,JSON.stringify(t.dataRanges))).map(([a,s])=>({first_frame:a,last_frame:s})):G(n.items,0);if(r.length===0)throw new Error(t.dataRanges?"isobmff trim: no whole frames present in this sparse file":"isobmff trim: no usable trim ranges in items");let i=await V(r,t.dataRanges?0:n.handles,(a,s)=>H(d(t),t.fileSize,a,s,e.format));return i.map((a,s)=>{let o=JSON.parse(a);return i.length>1&&(o.output_clip_number=s+1,o.output_clip_count=i.length,o.output_part_number=1),o})},async decode(e,n,t){await u();let r=t.detail==="coarse",i=e.parts[0];if(e.format==="crm"){let c=await R(d(i),i.fileSize,n,r?"preview":"full");return m(c)}let a=await Y(e);if(n<0||n>=a.length)throw new b(n,a.length);let s=a[n],o=await i.read(s.offset,s.size);if(e.format==="braw")return m(r?v(o,0):y(o));if(g(o)){let c=await q(e);return m(c?f.decode_prores_raw_tier(o,r?"preview":"full",c):r?P(o,0):x(o))}if(W(o))return m(r?D(o,0):z(o));if(r)return m(S(o,0));let l=await ce(o);return l||m(F(o))},async decode16(e,n){await u();let t=e.parts[0];if(e.format==="crm")throw new Error("crm: no 16-bit decoder");let r=await Y(e);if(n<0||n>=r.length)throw new b(n,r.length);let i=r[n],a=await t.read(i.offset,i.size),s=g(a)?await q(e):null,o=e.format==="braw"?w(a):g(a)?s?f.decode_prores_raw_tier(a,"rgb16",s):M(a):W(a)?(()=>{throw new Error("vc3: no 16-bit decoder")})():A(a);return $(o)}};async function ce(e){if(!!0)return null;try{let n=await import("./prores-CFX64NME.js");if(!await n.proresGpuAvailable())return null;let t=await n.decodeProResRgbaGpu(e);return t?{width:t.width,height:t.height,rgba:t.rgba}:null}catch{return null}}function W(e){return e.length>=4&&e[0]===0&&e[1]===0&&e[2]===2&&e[3]===128}function g(e){return e.length>=8&&e[4]===112&&e[5]===114&&e[6]===114&&e[7]===102}function m(e){let n=new DataView(e.buffer,e.byteOffset,8);return{width:n.getUint32(0,!0),height:n.getUint32(4,!0),rgba:e.slice(8)}}var f=C,X=new WeakMap;function q(e){let n=X.get(e);if(!n){let t=e.parts[0];n=f.prores_raw_container_color&&f.decode_prores_raw_tier?U({fileSize:t.fileSize,read:t.read}).then(r=>{let i=f.prores_raw_container_color(r);return i.length?i:null}):Promise.resolve(null),X.set(e,n)}return n}var K=new WeakMap;async function Y(e){let n=K.get(e);if(!n){let t=e.parts[0],r=J(await N(d(t),t.fileSize,e.format));if(!r.w||!r.h)throw new Error("could not find a video sample table");n=r.offs,K.set(e,n)}return n}export{he as isobmffFormat,se as movFrameRate};
@@ -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{c as b}from"./chunk-VFXMP7IF.js";import"./chunk-BBCQMZQN.js";import{c as w,g as y}from"./chunk-5JDF2IUF.js";import{Ca as l,Ga as p,Ha as h}from"./chunk-DCO5D65W.js";import"./chunk-PSANHDZM.js";var F=72*1024*1024,S=16,m=p;function L(){return typeof m.video_open=="function"&&typeof m.video_decode=="function"}async function P(r,e){if(await h(),!L())return null;try{return JSON.parse(await m.video_open(r,e))}catch{return null}}function k(r){l?.(r)}var u=new WeakMap;function v(r){let e=u.get(r);if(!e){let t=r.parts[0];e=P((n,a)=>t.read(n,a),t.fileSize).then(n=>{if(!n)throw new Error(`mcvideo: media-core has no video decoder for ${t.filename}`);return{info:n,cache:new Map,cacheCoarse:!1,frameBytes:0,queue:Promise.resolve()}}),e.catch(()=>u.delete(r)),u.set(r,e)}return e}async function B(r){try{return(await v(r)).info.frames}catch{return 0}}function _(r){let e=new DataView(r.buffer,r.byteOffset,r.byteLength),t=new Map,n=4;for(let a=e.getUint32(0,!0);a>0&&n+12<=r.length;a--){let s=e.getUint32(n,!0),c=e.getUint32(n+4,!0),i=e.getUint32(n+8,!0),o=c*i*4;if(n+=12,n+o>r.length)break;t.set(s,{width:c,height:i,rgba:r.slice(n,n+o)}),n+=o}return t}async function C(r,e,t){let n=await v(r),{info:a}=n;if(e<0||e>=a.frames)throw new w(e,a.frames);let s=async()=>{let i=t&&a.codec==="dv";n.cacheCoarse!==i&&(n.cache.clear(),n.cacheCoarse=i);let o=n.cache.get(e);if(!o){let g=a.inter?Math.max(1,Math.min(S,n.frameBytes?Math.floor(F/n.frameBytes):4)):1,d=_(await m.video_decode(a.handle,e,Math.min(a.frames,e+g),i));n.cache=d,o=d.get(e),o&&(n.frameBytes=o.rgba.length)}if(!o)throw new Error(`mcvideo: ${a.codec} frame ${e} did not decode`);return n.cache.delete(e),o},c=n.queue.then(s,s);return n.queue=c.catch(()=>{}),c}async function f(r){let e=b(r.parts[0]?.filename??""),t=e?await y(e):null;return t&&e?[t,{...r,format:e}]:null}async function M(r){let e=await f(r);if(!e)throw new Error(`mcvideo: no container module for ${r.parts[0]?.filename} \u2014 ships whole`);return e}var I={async inspect(r){let e=await f(r);return e?e[0].inspect(e[1]):null},async extract(r){let e=await f(r);return e?e[0].extract(e[1]):null},async sparsify(r,e){let[t,n]=await M(r);return t.sparsify(n,e)},async trim(r,e){let[t,n]=await M(r);return t.trim(n,e)},async decode(r,e,{detail:t}){return C(r,e,t==="coarse")}};export{k as closeVideoLane,L as hasVideoLane,I as mcVideoFormat,P as openVideoLane,_ as unpackWindow,B as videoLaneFrames};
3
+ import{c as b}from"./chunk-VFXMP7IF.js";import"./chunk-BBCQMZQN.js";import{c as w,g as y}from"./chunk-TGLH2JDW.js";import{Ea as l,Ia as p,Ja as h}from"./chunk-7Z65WW4I.js";import"./chunk-PSANHDZM.js";var F=72*1024*1024,S=16,m=p;function L(){return typeof m.video_open=="function"&&typeof m.video_decode=="function"}async function P(r,e){if(await h(),!L())return null;try{return JSON.parse(await m.video_open(r,e))}catch{return null}}function k(r){l?.(r)}var u=new WeakMap;function v(r){let e=u.get(r);if(!e){let t=r.parts[0];e=P((n,a)=>t.read(n,a),t.fileSize).then(n=>{if(!n)throw new Error(`mcvideo: media-core has no video decoder for ${t.filename}`);return{info:n,cache:new Map,cacheCoarse:!1,frameBytes:0,queue:Promise.resolve()}}),e.catch(()=>u.delete(r)),u.set(r,e)}return e}async function B(r){try{return(await v(r)).info.frames}catch{return 0}}function _(r){let e=new DataView(r.buffer,r.byteOffset,r.byteLength),t=new Map,n=4;for(let a=e.getUint32(0,!0);a>0&&n+12<=r.length;a--){let s=e.getUint32(n,!0),c=e.getUint32(n+4,!0),i=e.getUint32(n+8,!0),o=c*i*4;if(n+=12,n+o>r.length)break;t.set(s,{width:c,height:i,rgba:r.slice(n,n+o)}),n+=o}return t}async function C(r,e,t){let n=await v(r),{info:a}=n;if(e<0||e>=a.frames)throw new w(e,a.frames);let s=async()=>{let i=t&&a.codec==="dv";n.cacheCoarse!==i&&(n.cache.clear(),n.cacheCoarse=i);let o=n.cache.get(e);if(!o){let g=a.inter?Math.max(1,Math.min(S,n.frameBytes?Math.floor(F/n.frameBytes):4)):1,d=_(await m.video_decode(a.handle,e,Math.min(a.frames,e+g),i));n.cache=d,o=d.get(e),o&&(n.frameBytes=o.rgba.length)}if(!o)throw new Error(`mcvideo: ${a.codec} frame ${e} did not decode`);return n.cache.delete(e),o},c=n.queue.then(s,s);return n.queue=c.catch(()=>{}),c}async function f(r){let e=b(r.parts[0]?.filename??""),t=e?await y(e):null;return t&&e?[t,{...r,format:e}]:null}async function M(r){let e=await f(r);if(!e)throw new Error(`mcvideo: no container module for ${r.parts[0]?.filename} \u2014 ships whole`);return e}var I={async inspect(r){let e=await f(r);return e?e[0].inspect(e[1]):null},async extract(r){let e=await f(r);return e?e[0].extract(e[1]):null},async sparsify(r,e){let[t,n]=await M(r);return t.sparsify(n,e)},async trim(r,e){let[t,n]=await M(r);return t.trim(n,e)},async decode(r,e,{detail:t}){return C(r,e,t==="coarse")}};export{k as closeVideoLane,L as hasVideoLane,I as mcVideoFormat,P as openVideoLane,_ as unpackWindow,B as videoLaneFrames};
package/dist/mcp.js CHANGED
@@ -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{b as ha}from"./chunk-T4HZ6ASN.js";import{e as la,f as ua,j as da,k as fa,l as rn,n as pa,o as ma,p as on}from"./chunk-H6XXKUWJ.js";import"./chunk-3AR7KSPH.js";import"./chunk-WWZDRERB.js";import"./chunk-KNUHQP6W.js";import"./chunk-4B4STXSA.js";import"./chunk-3KS3547B.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{A as S,Ac as ra,B as Hi,C as K,D as Ui,E as en,F as Vi,G as dt,Gc as oa,H as Ki,Hc as tn,Qc as na,Uc as sa,Vc as ia,Wc as aa,Zc as ca,a as ji,b as Go,c as Oi,d as Ai,e as Di,f as Bo,g as Jo,h as Wo,i as Ot,j as At,k as Zi,l as Li,m as Xo,n as f,o as D,p as W,q as Fi,r as G,s as q,t as v,u as se,v as V,vc as Qi,w as Qo,wc as Dt,x as Yo,xc as Yi,y as F,yc as ea,z as pe,zc as ta}from"./chunk-E5TEETTE.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-Q2QOAQJV.js";import{a as zr,b as Mi,d as qi,e as Ni}from"./chunk-QOAPJ5Y2.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-RL5XRG6O.js";import{a as Ji,e as Wi,k as Xi}from"./chunk-IDADYIY6.js";import"./chunk-LMRPCWHV.js";import"./chunk-ZNUIZEPF.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import{e as Gi,f as Bi}from"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import{c as $,f as Ci}from"./chunk-PSANHDZM.js";var Qt=$(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.regexpCode=A.getEsmExportName=A.getProperty=A.safeStringify=A.stringify=A.strConcat=A.addCodeArg=A.str=A._=A.nil=A._Code=A.Name=A.IDENTIFIER=A._CodeOrName=void 0;var Wt=class{};A._CodeOrName=Wt;A.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ye=class extends Wt{constructor(e){if(super(),!A.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};A.Name=Ye;var _e=class extends Wt{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof Ye&&(r[o.str]=(r[o.str]||0)+1),r),{})}};A._Code=_e;A.nil=new _e("");function Aa(t,...e){let r=[t[0]],o=0;for(;o<e.length;)zn(r,e[o]),r.push(t[++o]);return new _e(r)}A._=Aa;var kn=new _e("+");function Da(t,...e){let r=[Xt(t[0])],o=0;for(;o<e.length;)r.push(kn),zn(r,e[o]),r.push(kn,Xt(t[++o]));return jf(r),new _e(r)}A.str=Da;function zn(t,e){e instanceof _e?t.push(...e._items):e instanceof Ye?t.push(e):t.push(Df(e))}A.addCodeArg=zn;function jf(t){let e=1;for(;e<t.length-1;){if(t[e]===kn){let r=Of(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Of(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ye||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ye))return`"${t}${e.slice(1)}`}function Af(t,e){return e.emptyStr()?t:t.emptyStr()?e:Da`${t}${e}`}A.strConcat=Af;function Df(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xt(Array.isArray(t)?t.join(","):t)}function Zf(t){return new _e(Xt(t))}A.stringify=Zf;function Xt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Xt;function Lf(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new _e(`.${t}`):Aa`[${t}]`}A.getProperty=Lf;function Ff(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new _e(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=Ff;function Hf(t){return new _e(t.toString())}A.regexpCode=Hf});var Rn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Qt(),Pn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qr||(le.UsedValueState=Qr={}));le.varKinds={const:new ce.Name("const"),let:new ce.Name("let"),var:new ce.Name("var")};var Yr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ce.Name?e:this.name(e)}name(e){return new ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};le.Scope=Yr;var eo=class extends ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ce._)`.${new ce.Name(r)}[${o}]`}};le.ValueScopeName=eo;var Uf=(0,ce._)`\n`,Tn=class extends Yr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Uf:ce.nil}}get(){return this._scope}name(e){return new eo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ce._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qr.Started);let l=r(u);if(l){let d=this.opts.es5?le.varKinds.var:le.varKinds.const;s=(0,ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ce._)`${s}${l}${this.opts._n}`;else throw new Pn(u);c.set(u,Qr.Completed)})}return s}};le.ValueScope=Tn});var R=$(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var M=Qt(),be=Rn(),He=Qt();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return He._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return He.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return He.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return He.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return He.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return He.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return He.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return He.Name}});var no=Rn();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return no.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return no.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return no.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return no.varKinds}});I.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var Ne=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},In=class extends Ne{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?be.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},to=class extends Ne{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return oo(e,this.rhs)}},Cn=class extends to{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Mn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Nn=class extends Ne{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},jn=class extends Ne{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=vt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Yt=class extends Ne{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Vf(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rt(e,r.names),{})}},je=class extends Yt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},On=class extends Yt{},$t=class extends je{};$t.kind="else";var et=class t extends je{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new $t(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Za(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=vt(this.condition,e,r),this}get names(){let e=super.names;return oo(e,this.condition),this.else&&rt(e,this.else.names),e}};et.kind="if";var tt=class extends je{};tt.kind="for";var An=class extends tt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=vt(this.iteration,e,r),this}get names(){return rt(super.names,this.iteration.names)}},Dn=class extends tt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?be.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=oo(super.names,this.from);return oo(e,this.to)}},ro=class extends tt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=vt(this.iterable,e,r),this}get names(){return rt(super.names,this.iterable.names)}},er=class extends je{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};er.kind="func";var tr=class extends Yt{render(e){return"return "+super.render(e)}};tr.kind="return";var Zn=class extends je{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rt(e,this.catch.names),this.finally&&rt(e,this.finally.names),e}},rr=class extends je{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};rr.kind="catch";var or=class extends je{render(e){return"finally"+super.render(e)}};or.kind="finally";var Ln=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ import{b as ha}from"./chunk-JZCADV5C.js";import{e as la,f as ua,j as da,k as fa,l as rn,n as pa,o as ma,p as on}from"./chunk-M6SVZJAX.js";import"./chunk-UXEL636C.js";import"./chunk-2X2SFPWD.js";import"./chunk-T4B4Y5WQ.js";import"./chunk-2DMNGWC2.js";import"./chunk-3KS3547B.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{A as S,Ac as ra,B as Hi,C as K,D as Ui,E as en,F as Vi,G as dt,Gc as oa,H as Ki,Hc as tn,Qc as na,Uc as sa,Vc as ia,Wc as aa,Zc as ca,a as ji,b as Go,c as Oi,d as Ai,e as Di,f as Bo,g as Jo,h as Wo,i as Ot,j as At,k as Zi,l as Li,m as Xo,n as f,o as D,p as W,q as Fi,r as G,s as q,t as v,u as se,v as V,vc as Qi,w as Qo,wc as Dt,x as Yo,xc as Yi,y as F,yc as ea,z as pe,zc as ta}from"./chunk-XLRQNFJU.js";import"./chunk-IN6XVTUS.js";import"./chunk-E4KQR4M3.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-YMRK5D3X.js";import{a as zr,b as Mi,d as qi,e as Ni}from"./chunk-6BL5HE4S.js";import"./chunk-TNCXZIOX.js";import"./chunk-5JIFRR7U.js";import"./chunk-WRDA44QF.js";import"./chunk-PGJMKUUP.js";import"./chunk-6QB4DV22.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-ASFUV3PB.js";import"./chunk-NRURUPLU.js";import"./chunk-TGLH2JDW.js";import"./chunk-RL5XRG6O.js";import{a as Ji,e as Wi,k as Xi}from"./chunk-IDADYIY6.js";import"./chunk-LMRPCWHV.js";import"./chunk-BIX5ETBY.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-7Z65WW4I.js";import"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import{e as Gi,f as Bi}from"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import{c as $,f as Ci}from"./chunk-PSANHDZM.js";var Qt=$(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.regexpCode=A.getEsmExportName=A.getProperty=A.safeStringify=A.stringify=A.strConcat=A.addCodeArg=A.str=A._=A.nil=A._Code=A.Name=A.IDENTIFIER=A._CodeOrName=void 0;var Wt=class{};A._CodeOrName=Wt;A.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ye=class extends Wt{constructor(e){if(super(),!A.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};A.Name=Ye;var _e=class extends Wt{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof Ye&&(r[o.str]=(r[o.str]||0)+1),r),{})}};A._Code=_e;A.nil=new _e("");function Aa(t,...e){let r=[t[0]],o=0;for(;o<e.length;)zn(r,e[o]),r.push(t[++o]);return new _e(r)}A._=Aa;var kn=new _e("+");function Da(t,...e){let r=[Xt(t[0])],o=0;for(;o<e.length;)r.push(kn),zn(r,e[o]),r.push(kn,Xt(t[++o]));return jf(r),new _e(r)}A.str=Da;function zn(t,e){e instanceof _e?t.push(...e._items):e instanceof Ye?t.push(e):t.push(Df(e))}A.addCodeArg=zn;function jf(t){let e=1;for(;e<t.length-1;){if(t[e]===kn){let r=Of(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Of(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ye||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ye))return`"${t}${e.slice(1)}`}function Af(t,e){return e.emptyStr()?t:t.emptyStr()?e:Da`${t}${e}`}A.strConcat=Af;function Df(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xt(Array.isArray(t)?t.join(","):t)}function Zf(t){return new _e(Xt(t))}A.stringify=Zf;function Xt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Xt;function Lf(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new _e(`.${t}`):Aa`[${t}]`}A.getProperty=Lf;function Ff(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new _e(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=Ff;function Hf(t){return new _e(t.toString())}A.regexpCode=Hf});var Rn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Qt(),Pn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qr||(le.UsedValueState=Qr={}));le.varKinds={const:new ce.Name("const"),let:new ce.Name("let"),var:new ce.Name("var")};var Yr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ce.Name?e:this.name(e)}name(e){return new ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};le.Scope=Yr;var eo=class extends ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ce._)`.${new ce.Name(r)}[${o}]`}};le.ValueScopeName=eo;var Uf=(0,ce._)`\n`,Tn=class extends Yr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Uf:ce.nil}}get(){return this._scope}name(e){return new eo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ce._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qr.Started);let l=r(u);if(l){let d=this.opts.es5?le.varKinds.var:le.varKinds.const;s=(0,ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ce._)`${s}${l}${this.opts._n}`;else throw new Pn(u);c.set(u,Qr.Completed)})}return s}};le.ValueScope=Tn});var R=$(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var M=Qt(),be=Rn(),He=Qt();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return He._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return He.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return He.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return He.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return He.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return He.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return He.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return He.Name}});var no=Rn();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return no.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return no.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return no.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return no.varKinds}});I.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var Ne=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},In=class extends Ne{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?be.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},to=class extends Ne{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return oo(e,this.rhs)}},Cn=class extends to{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Mn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Nn=class extends Ne{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},jn=class extends Ne{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=vt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Yt=class extends Ne{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Vf(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rt(e,r.names),{})}},je=class extends Yt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},On=class extends Yt{},$t=class extends je{};$t.kind="else";var et=class t extends je{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new $t(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Za(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=vt(this.condition,e,r),this}get names(){let e=super.names;return oo(e,this.condition),this.else&&rt(e,this.else.names),e}};et.kind="if";var tt=class extends je{};tt.kind="for";var An=class extends tt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=vt(this.iteration,e,r),this}get names(){return rt(super.names,this.iteration.names)}},Dn=class extends tt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?be.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=oo(super.names,this.from);return oo(e,this.to)}},ro=class extends tt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=vt(this.iterable,e,r),this}get names(){return rt(super.names,this.iterable.names)}},er=class extends je{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};er.kind="func";var tr=class extends Yt{render(e){return"return "+super.render(e)}};tr.kind="return";var Zn=class extends je{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rt(e,this.catch.names),this.finally&&rt(e,this.finally.names),e}},rr=class extends je{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};rr.kind="catch";var or=class extends je{render(e){return"finally"+super.render(e)}};or.kind="finally";var Ln=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
4
4
  `:""},this._extScope=e,this._scope=new be.Scope({parent:e}),this._nodes=[new On]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new In(e,s,o)),s}const(e,r,o){return this._def(be.varKinds.const,e,r,o)}let(e,r,o){return this._def(be.varKinds.let,e,r,o)}var(e,r,o){return this._def(be.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new to(e,r,o))}add(e,r){return this._leafNode(new Cn(e,I.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==M.nil&&this._leafNode(new jn(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,M.addCodeArg)(r,n));return r.push("}"),new M._Code(r)}if(e,r,o){if(this._blockNode(new et(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new et(e))}else(){return this._elseNode(new $t)}endIf(){return this._endBlockNode(et,$t)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new An(e),r)}forRange(e,r,o,n,s=this.opts.es5?be.varKinds.var:be.varKinds.let){let i=this._scope.toName(e);return this._for(new Dn(s,i,r,o),()=>n(i))}forOf(e,r,o,n=be.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof M.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,M._)`${i}.length`,a=>{this.var(s,(0,M._)`${i}[${a}]`),o(s)})}return this._for(new ro("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?be.varKinds.var:be.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,M._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new ro("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(tt)}label(e){return this._leafNode(new Mn(e))}break(e){return this._leafNode(new qn(e))}return(e){let r=new tr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(tr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new Zn;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new rr(s),r(s)}return o&&(this._currNode=n.finally=new or,this.code(o)),this._endBlockNode(rr,or)}throw(e){return this._leafNode(new Nn(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=M.nil,o,n){return this._blockNode(new er(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(er)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof et))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};I.CodeGen=Ln;function rt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function oo(t,e){return e instanceof M._CodeOrName?rt(t,e.names):t}function vt(t,e,r){if(t instanceof M.Name)return o(t);if(!n(t))return t;return new M._Code(t._items.reduce((s,i)=>(i instanceof M.Name&&(i=o(i)),i instanceof M._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof M._Code&&s._items.some(i=>i instanceof M.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Vf(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Za(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,M._)`!${Fn(t)}`}I.not=Za;var Kf=La(I.operators.AND);function Gf(...t){return t.reduce(Kf)}I.and=Gf;var Bf=La(I.operators.OR);function Jf(...t){return t.reduce(Bf)}I.or=Jf;function La(t){return(e,r)=>e===M.nil?r:r===M.nil?e:(0,M._)`${Fn(e)} ${t} ${Fn(r)}`}function Fn(t){return t instanceof M.Name?t:(0,M._)`(${t})`}});var N=$(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.checkStrictMode=C.getErrorPath=C.Type=C.useFunc=C.setEvaluated=C.evaluatedPropsToName=C.mergeEvaluated=C.eachItem=C.unescapeJsonPointer=C.escapeJsonPointer=C.escapeFragment=C.unescapeFragment=C.schemaRefOrVal=C.schemaHasRulesButRef=C.schemaHasRules=C.checkUnknownRules=C.alwaysValidSchema=C.toHash=void 0;var L=R(),Wf=Qt();function Xf(t){let e={};for(let r of t)e[r]=!0;return e}C.toHash=Xf;function Qf(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Ua(t,e),!Va(e,t.self.RULES.all))}C.alwaysValidSchema=Qf;function Ua(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||Ba(t,`unknown keyword: "${s}"`)}C.checkUnknownRules=Ua;function Va(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}C.schemaHasRules=Va;function Yf(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}C.schemaHasRulesButRef=Yf;function ep({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,L._)`${r}`}return(0,L._)`${t}${e}${(0,L.getProperty)(o)}`}C.schemaRefOrVal=ep;function tp(t){return Ka(decodeURIComponent(t))}C.unescapeFragment=tp;function rp(t){return encodeURIComponent(Un(t))}C.escapeFragment=rp;function Un(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}C.escapeJsonPointer=Un;function Ka(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}C.unescapeJsonPointer=Ka;function op(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}C.eachItem=op;function Fa({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof L.Name?(s instanceof L.Name?t(n,s,i):e(n,s,i),i):s instanceof L.Name?(e(n,i,s),s):r(s,i);return a===L.Name&&!(c instanceof L.Name)?o(n,c):c}}C.mergeEvaluated={props:Fa({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,L._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,L._)`${r} || {}`).code((0,L._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,L._)`${r} || {}`),Vn(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Ga}),items:Fa({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,L._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,L._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Ga(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,L._)`{}`);return e!==void 0&&Vn(t,r,e),r}C.evaluatedPropsToName=Ga;function Vn(t,e,r){Object.keys(r).forEach(o=>t.assign((0,L._)`${e}${(0,L.getProperty)(o)}`,!0))}C.setEvaluated=Vn;var Ha={};function np(t,e){return t.scopeValue("func",{ref:e,code:Ha[e.code]||(Ha[e.code]=new Wf._Code(e.code))})}C.useFunc=np;var Hn;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Hn||(C.Type=Hn={}));function sp(t,e,r){if(t instanceof L.Name){let o=e===Hn.Num;return r?o?(0,L._)`"[" + ${t} + "]"`:(0,L._)`"['" + ${t} + "']"`:o?(0,L._)`"/" + ${t}`:(0,L._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,L.getProperty)(t).toString():"/"+Un(t)}C.getErrorPath=sp;function Ba(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}C.checkStrictMode=Ba});var Oe=$(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});var te=R(),ip={data:new te.Name("data"),valCxt:new te.Name("valCxt"),instancePath:new te.Name("instancePath"),parentData:new te.Name("parentData"),parentDataProperty:new te.Name("parentDataProperty"),rootData:new te.Name("rootData"),dynamicAnchors:new te.Name("dynamicAnchors"),vErrors:new te.Name("vErrors"),errors:new te.Name("errors"),this:new te.Name("this"),self:new te.Name("self"),scope:new te.Name("scope"),json:new te.Name("json"),jsonPos:new te.Name("jsonPos"),jsonLen:new te.Name("jsonLen"),jsonPart:new te.Name("jsonPart")};Kn.default=ip});var nr=$(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.extendErrors=re.resetErrorsCount=re.reportExtraError=re.reportError=re.keyword$DataError=re.keywordError=void 0;var j=R(),so=N(),ie=Oe();re.keywordError={message:({keyword:t})=>(0,j.str)`must pass "${t}" keyword validation`};re.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,j.str)`"${t}" keyword must be ${e} ($data)`:(0,j.str)`"${t}" keyword is invalid ($data)`};function ap(t,e=re.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=Xa(t,e,r);o??(i||a)?Ja(s,c):Wa(n,(0,j._)`[${c}]`)}re.reportError=ap;function cp(t,e=re.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=Xa(t,e,r);Ja(n,a),s||i||Wa(o,ie.default.vErrors)}re.reportExtraError=cp;function lp(t,e){t.assign(ie.default.errors,e),t.if((0,j._)`${ie.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,j._)`${ie.default.vErrors}.length`,e),()=>t.assign(ie.default.vErrors,null)))}re.resetErrorsCount=lp;function up({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ie.default.errors,a=>{t.const(i,(0,j._)`${ie.default.vErrors}[${a}]`),t.if((0,j._)`${i}.instancePath === undefined`,()=>t.assign((0,j._)`${i}.instancePath`,(0,j.strConcat)(ie.default.instancePath,s.errorPath))),t.assign((0,j._)`${i}.schemaPath`,(0,j.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,j._)`${i}.schema`,r),t.assign((0,j._)`${i}.data`,o))})}re.extendErrors=up;function Ja(t,e){let r=t.const("err",e);t.if((0,j._)`${ie.default.vErrors} === null`,()=>t.assign(ie.default.vErrors,(0,j._)`[${r}]`),(0,j._)`${ie.default.vErrors}.push(${r})`),t.code((0,j._)`${ie.default.errors}++`)}function Wa(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,j._)`new ${t.ValidationError}(${e})`):(r.assign((0,j._)`${o}.errors`,e),r.return(!1))}var ot={keyword:new j.Name("keyword"),schemaPath:new j.Name("schemaPath"),params:new j.Name("params"),propertyName:new j.Name("propertyName"),message:new j.Name("message"),schema:new j.Name("schema"),parentSchema:new j.Name("parentSchema")};function Xa(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,j._)`{}`:dp(t,e,r)}function dp(t,e,r={}){let{gen:o,it:n}=t,s=[fp(n,r),pp(t,r)];return mp(t,e,s),o.object(...s)}function fp({errorPath:t},{instancePath:e}){let r=e?(0,j.str)`${t}${(0,so.getErrorPath)(e,so.Type.Str)}`:t;return[ie.default.instancePath,(0,j.strConcat)(ie.default.instancePath,r)]}function pp({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,j.str)`${e}/${t}`;return r&&(n=(0,j.str)`${n}${(0,so.getErrorPath)(r,so.Type.Str)}`),[ot.schemaPath,n]}function mp(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([ot.keyword,n],[ot.params,typeof e=="function"?e(t):e||(0,j._)`{}`]),c.messages&&o.push([ot.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([ot.schema,i],[ot.parentSchema,(0,j._)`${l}${d}`],[ie.default.data,s]),u&&o.push([ot.propertyName,u])}});var Ya=$(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.boolOrEmptySchema=wt.topBoolOrEmptySchema=void 0;var hp=nr(),gp=R(),yp=Oe(),_p={message:"boolean schema is false"};function $p(t){let{gen:e,schema:r,validateName:o}=t;r===!1?Qa(t,!1):typeof r=="object"&&r.$async===!0?e.return(yp.default.data):(e.assign((0,gp._)`${o}.errors`,null),e.return(!0))}wt.topBoolOrEmptySchema=$p;function vp(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),Qa(t)):r.var(e,!0)}wt.boolOrEmptySchema=vp;function Qa(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,hp.reportError)(n,_p,void 0,e)}});var Gn=$(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.getRules=bt.isJSONType=void 0;var wp=["string","number","integer","boolean","null","object","array"],bp=new Set(wp);function Sp(t){return typeof t=="string"&&bp.has(t)}bt.isJSONType=Sp;function xp(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}bt.getRules=xp});var Bn=$(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.shouldUseRule=Ue.shouldUseGroup=Ue.schemaHasRulesForType=void 0;function Ep({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&ec(t,o)}Ue.schemaHasRulesForType=Ep;function ec(t,e){return e.rules.some(r=>tc(t,r))}Ue.shouldUseGroup=ec;function tc(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}Ue.shouldUseRule=tc});var sr=$(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.reportTypeError=oe.checkDataTypes=oe.checkDataType=oe.coerceAndCheckDataType=oe.getJSONTypes=oe.getSchemaTypes=oe.DataType=void 0;var kp=Gn(),zp=Bn(),Pp=nr(),T=R(),rc=N(),St;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(St||(oe.DataType=St={}));function Tp(t){let e=oc(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}oe.getSchemaTypes=Tp;function oc(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(kp.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}oe.getJSONTypes=oc;function Rp(t,e){let{gen:r,data:o,opts:n}=t,s=Ip(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,zp.schemaHasRulesForType)(t,e[0]));if(i){let a=Wn(e,o,n.strictNumbers,St.Wrong);r.if(a,()=>{s.length?Cp(t,e,s):Xn(t)})}return i}oe.coerceAndCheckDataType=Rp;var nc=new Set(["string","number","integer","boolean","null"]);function Ip(t,e){return e?t.filter(r=>nc.has(r)||e==="array"&&r==="array"):[]}function Cp(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,T._)`typeof ${n}`),a=o.let("coerced",(0,T._)`undefined`);s.coerceTypes==="array"&&o.if((0,T._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,T._)`${n}[0]`).assign(i,(0,T._)`typeof ${n}`).if(Wn(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,T._)`${a} !== undefined`);for(let u of r)(nc.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Xn(t),o.endIf(),o.if((0,T._)`${a} !== undefined`,()=>{o.assign(n,a),Mp(t,a)});function c(u){switch(u){case"string":o.elseIf((0,T._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,T._)`"" + ${n}`).elseIf((0,T._)`${n} === null`).assign(a,(0,T._)`""`);return;case"number":o.elseIf((0,T._)`${i} == "boolean" || ${n} === null
5
5
  || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,T._)`+${n}`);return;case"integer":o.elseIf((0,T._)`${i} === "boolean" || ${n} === null
6
6
  || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,T._)`+${n}`);return;case"boolean":o.elseIf((0,T._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,T._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,T._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,T._)`${i} === "string" || ${i} === "number"
@@ -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{g as a,h as b,i as c,j as d,k as e,l as f,m as g,n as h,o as i,p as j,q as k,r as l,s as m,t as n,u as o,v as p,w as q}from"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-PSANHDZM.js";export{a as MEDIA_EXTS,g as bwfAt,q as coverage,e as decodeFrameRgba,o as factsLine,h as factsText,n as findMedia,p as findText,c as folderClip,i as islandsFor,m as nameMatch,l as normName,d as openSource,f as probeMedia,b as siblingParts,k as trimMedia,j as trimSource};
3
+ import{g as a,h as b,i as c,j as d,k as e,l as f,m as g,n as h,o as i,p as j,q as k,r as l,s as m,t as n,u as o,v as p,w as q}from"./chunk-E4KQR4M3.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-BBCQMZQN.js";import"./chunk-ASFUV3PB.js";import"./chunk-NRURUPLU.js";import"./chunk-TGLH2JDW.js";import"./chunk-NU3X7P4N.js";import"./chunk-7Z65WW4I.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-PSANHDZM.js";export{a as MEDIA_EXTS,g as bwfAt,q as coverage,e as decodeFrameRgba,o as factsLine,h as factsText,n as findMedia,p as findText,c as folderClip,i as islandsFor,m as nameMatch,l as normName,d as openSource,f as probeMedia,b as siblingParts,k as trimMedia,j as trimSource};