conformtools 0.6.15 → 0.6.17

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 (102) hide show
  1. package/README.md +1 -1
  2. package/dist/{account-W7Z2MYZU.js → account-VXAKXGY6.js} +1 -1
  3. package/dist/{agent-hook-setup-JCIZG3Q3.js → agent-hook-setup-HBT2LTVR.js} +1 -1
  4. package/dist/{analysis-engine-DCHJHZ7W.js → analysis-engine-BZUEBW55.js} +1 -1
  5. package/dist/{arriraw-YIJ3BYNN.js → arriraw-GZ63YMLZ.js} +7 -7
  6. package/dist/bridge-DRC6BQFR.js +3 -0
  7. package/dist/browser/timeline_core_bg.wasm +0 -0
  8. package/dist/{chunk-7NGS2BN7.js → chunk-2SDAOYP5.js} +3 -3
  9. package/dist/{chunk-XVZ7KJRI.js → chunk-2VH2Z6RD.js} +1 -1
  10. package/dist/chunk-3PVQ5QP4.js +3 -0
  11. package/dist/chunk-73RFYAVG.js +3 -0
  12. package/dist/{chunk-RGMTLNMF.js → chunk-BBCQMZQN.js} +1 -1
  13. package/dist/{chunk-VERTA23P.js → chunk-CRMGV32N.js} +2 -2
  14. package/dist/chunk-CZ6OZKR6.js +516 -0
  15. package/dist/chunk-GRJLKGBG.js +3 -0
  16. package/dist/chunk-GTPTZRO6.js +3 -0
  17. package/dist/{chunk-4RA57LTJ.js → chunk-IG2X534U.js} +1 -1
  18. package/dist/{chunk-IBIAW6IW.js → chunk-JT3HI632.js} +2 -2
  19. package/dist/chunk-JTRM2JCE.js +7 -0
  20. package/dist/{chunk-UAURERD3.js → chunk-M5CEBOLK.js} +1 -1
  21. package/dist/{chunk-XDI6CPPV.js → chunk-MTAXVOHK.js} +1 -1
  22. package/dist/{chunk-WJ5EWXP2.js → chunk-MVQ5RGZB.js} +1 -1
  23. package/dist/{chunk-VETHR2O7.js → chunk-NN444GPH.js} +1 -1
  24. package/dist/chunk-OSUIS4JU.js +3 -0
  25. package/dist/chunk-P4PCSGEH.js +10 -0
  26. package/dist/{chunk-DPA26AOI.js → chunk-QNF4NMIW.js} +1 -1
  27. package/dist/{chunk-B2KCENY6.js → chunk-R2WEXCVQ.js} +1 -1
  28. package/dist/chunk-RITYQNOO.js +3 -0
  29. package/dist/{chunk-G7CVRPVA.js → chunk-S2WAFMRV.js} +2 -2
  30. package/dist/chunk-S5AOIOTT.js +3 -0
  31. package/dist/chunk-STGGRRYM.js +3 -0
  32. package/dist/{chunk-FLLB6UZJ.js → chunk-T7S2UBNN.js} +1 -1
  33. package/dist/chunk-TWHNQFKI.js +3 -0
  34. package/dist/chunk-UBWUED67.js +3 -0
  35. package/dist/{chunk-63WQRYTJ.js → chunk-VCBLWNQR.js} +102 -101
  36. package/dist/{chunk-6V4OEOOX.js → chunk-VFXMP7IF.js} +1 -1
  37. package/dist/{chunk-6KEFHHS6.js → chunk-WKNX742H.js} +2 -2
  38. package/dist/{chunk-UKXSKFL3.js → chunk-YGAAGTLE.js} +1 -1
  39. package/dist/{claude-setup-CM7G2YSG.js → claude-setup-W27DLJIO.js} +1 -1
  40. package/dist/cli.js +2 -2
  41. package/dist/{cr3-wasm-NYCB34ND.js → cr3-wasm-VUEEZYKQ.js} +1 -1
  42. package/dist/{demo-engine-WXNT4Y7S.js → demo-engine-5TCNOTTH.js} +1 -1
  43. package/dist/dng-wasm-5RQBGYAK.js +3 -0
  44. package/dist/dpx-wasm-OQVTNGOB.js +3 -0
  45. package/dist/{engine-HXZCA42S.js → engine-4X6TDWWA.js} +2 -2
  46. package/dist/exr-wasm-72YZFOME.js +3 -0
  47. package/dist/framing-HGW5RCUA.js +3 -0
  48. package/dist/gfx-worker.js +1 -1
  49. package/dist/{h264-MAUVJTR4.js → h264-QCYEI6RF.js} +1 -1
  50. package/dist/{h264-mxf-2O4SAUTA.js → h264-mxf-2BYKXDGT.js} +1 -1
  51. package/dist/hook.js +2 -2
  52. package/dist/{host-relink-RI3JEY4M.js → host-relink-37DCSN47.js} +1 -1
  53. package/dist/hosted-M2OZSONX.js +3 -0
  54. package/dist/hosts-IAJTORJD.js +3 -0
  55. package/dist/http.js +3 -3
  56. package/dist/{inspect-NUS3XAJH.js → inspect-R4RWCK3X.js} +2 -2
  57. package/dist/isobmff-RH4JKUUB.js +3 -0
  58. package/dist/{mc-video-HRZC7HGH.js → mc-video-MMKWEKFZ.js} +1 -1
  59. package/dist/mcp.js +8 -8
  60. package/dist/media-6MB7EKA7.js +3 -0
  61. package/dist/mxf-7HFFEBNW.js +3 -0
  62. package/dist/{ops-XIUVNJE2.js → ops-EM345H7F.js} +1 -1
  63. package/dist/{probe-GIAKRPFV.js → probe-YDOFGCGD.js} +1 -1
  64. package/dist/{r3d-I6EYEYX7.js → r3d-DDOTSYZH.js} +5 -5
  65. package/dist/r3d-G34YLXXA.js +3 -0
  66. package/dist/sequence-patch-2S7IPE52.js +3 -0
  67. package/dist/{source-QGWWLMME.js → source-L2JNTYS6.js} +1 -1
  68. package/dist/{still-4UR35GZH.js → still-AGBF3OOY.js} +1 -1
  69. package/dist/{still-wasm-RTPOMH7S.js → still-wasm-6YLI6NQQ.js} +1 -1
  70. package/dist/{store-WZHNO43A.js → store-LWUDJD76.js} +1 -1
  71. package/dist/tiff-wasm-6APT7FYP.js +3 -0
  72. package/dist/timeline-EZ6WUHCB.js +3 -0
  73. package/dist/wasm/udf_bg.wasm +0 -0
  74. package/dist/{wav-HSCUCY4U.js → wav-CV43ZAJI.js} +1 -1
  75. package/package.json +5 -5
  76. package/dist/bridge-RH3JRSBN.js +0 -3
  77. package/dist/chunk-DKGGJM6Z.js +0 -3
  78. package/dist/chunk-DLF5AKXT.js +0 -10
  79. package/dist/chunk-EEDLRRKU.js +0 -3
  80. package/dist/chunk-HTRW5GX4.js +0 -510
  81. package/dist/chunk-IDJIOKXA.js +0 -3
  82. package/dist/chunk-ISKNIQVO.js +0 -3
  83. package/dist/chunk-JKOB3U54.js +0 -3
  84. package/dist/chunk-OWWXUNJF.js +0 -7
  85. package/dist/chunk-PFZVET7S.js +0 -3
  86. package/dist/chunk-QH5DTYSE.js +0 -3
  87. package/dist/chunk-TBU2XWFD.js +0 -3
  88. package/dist/chunk-X527E5VI.js +0 -3
  89. package/dist/chunk-YUO3UWPH.js +0 -3
  90. package/dist/dng-wasm-XCPPBXPZ.js +0 -3
  91. package/dist/dpx-wasm-XACWNFPB.js +0 -3
  92. package/dist/exr-wasm-FQBUR6QT.js +0 -3
  93. package/dist/framing-HVUDKTZG.js +0 -3
  94. package/dist/hosted-2XACQY7J.js +0 -3
  95. package/dist/hosts-QW64CIJU.js +0 -3
  96. package/dist/isobmff-MTMGQKLK.js +0 -3
  97. package/dist/media-WC4ZVKIL.js +0 -3
  98. package/dist/mxf-J5QHA3VY.js +0 -3
  99. package/dist/r3d-2PCOFR2Z.js +0 -3
  100. package/dist/sequence-patch-DFGEAJGB.js +0 -3
  101. package/dist/tiff-wasm-N2S267IA.js +0 -3
  102. package/dist/timeline-NOTHRTAT.js +0 -3
@@ -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,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}from"./chunk-P4PCSGEH.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-BBCQMZQN.js";import"./chunk-MTAXVOHK.js";import"./chunk-YGAAGTLE.js";import"./chunk-IG2X534U.js";import"./chunk-NU3X7P4N.js";import"./chunk-QNF4NMIW.js";import"./chunk-ROGMKTND.js";import"./chunk-GTPTZRO6.js";import"./chunk-PSANHDZM.js";export{a as MEDIA_EXTS,f as bwfAt,p as coverage,d as decodeFrameRgba,n as factsLine,g as factsText,m as findMedia,o as findText,h as islandsFor,l as nameMatch,k as normName,c as openSource,e as probeMedia,b as siblingParts,j as trimMedia,i as trimSource};
@@ -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 N}from"./chunk-AACY2V3L.js";import{b as $}from"./chunk-YGAAGTLE.js";import{b as J}from"./chunk-IG2X534U.js";import{Ha as l,M,R as P,b as U,ca as D,da as T,e as B,ea as C,fa as E,g as S,ga as L,ia as O,ra as V,ua as W,w as k,wa as G}from"./chunk-QNF4NMIW.js";import"./chunk-PSANHDZM.js";var z=new Uint8Array([6,14,43,52,2,5,1,1,13,1,2,1,1,17,1,0]);function oe(t){e:for(let r=t.length-z.length;r>=0;r--){for(let e=0;e<z.length;e++)if(t[r+e]!==z[e])continue e;return r}return-1}function j(t,r){if(r>=t.byteLength)return[null,0];let e=t.getUint8(r);if(e<128)return[e,1];let n=e&127;if(n===0||n>8||r+1+n>t.byteLength)return[null,1];let a=0;for(let i=0;i<n;i++)a=a*256+t.getUint8(r+1+i);return[a,1+n]}function b(t,r){let e=t.getUint32(r,!1),n=t.getUint32(r+4,!1);return e*4294967296+n}async function Z(t){let r=t.fileSize,e=[];if(r<1024)return e;let a=Math.max(0,r-65536),i=r-a,o=await t.read(a,i);e.push({offset:a,length:i});let s=oe(o);if(s<0)return e;let c=new DataView(o.buffer,o.byteOffset,o.byteLength),[f,re]=j(c,s+16);if(f===null||f<16||f>65536)return e;let F=s+16+re;if(F+f>o.length)return e;let A=[],te=new DataView(o.buffer,o.byteOffset+F,f),g=Math.floor((f-4)/12);if(g<1||g>4096)return e;for(let u=0;u<g;u++){let d=b(te,u*12+4);d>=0&&d<r&&A.push(d)}for(let u of A){let d=Math.min(256,r-u),p=await t.read(u,d);if(p.length<80)continue;let _=new DataView(p.buffer,p.byteOffset,p.byteLength),[R,v]=j(_,16);if(R===null)continue;let m=16+v,y,x;if(p.length<m+64){let ie=Math.min(m+64,r-u),h=await t.read(u,ie);if(h.length<m+64)continue;let I=new DataView(h.buffer,h.byteOffset,h.byteLength);y=b(I,m+32),x=b(I,m+40)}else y=b(_,m+32),x=b(_,m+40);let ne=u+16+v+R+y+x,ae=Math.min(ne+65536,r)-u;e.push({offset:u,length:ae})}return e}function H(t,r){let e=[];for(let n of t){if(n.kind!=="clip"||!n.source_range)continue;let a=n.source_range.start.value,i=n.source_range.duration.value,o=Math.max(0,Math.floor(a)-r),s=Math.floor(a+i-1)+r;s>=o&&e.push({first_frame:o,last_frame:s})}return e}function se(t,r){let e=[...t].sort((i,o)=>i.offset-o.offset),n=[],a=0;for(let i of e)i.offset>a&&n.push({offset:a,length:i.offset-a}),a=Math.max(a,i.offset+i.length);return a<r&&n.push({offset:a,length:r-a}),n}async function q(t,r,e){let n=H(r,0);if(n.length===0)throw new Error("planMxfTrimsFromItems: no usable trim ranges in items");await l();let a=(o,s)=>t.read(o,s),i=await $(n,e,(o,s)=>V(a,t.fileSize,o,s));return i.map((o,s)=>{let c=JSON.parse(o);return i.length>1&&(c.output_clip_number=s+1,c.output_clip_count=i.length,c.output_part_number=1),c})}async function K(t,r,e){await l();let n=H(r,e),i=await W((s,c)=>t.read(s,c),t.fileSize,JSON.stringify(n));if(i!=="null")return JSON.parse(i);console.warn(`[mxf] no parseable index \u2014 shipping the WHOLE file (${t.fileSize} bytes). The cut's ${n.length} range(s) cannot be addressed; nothing is trimmed.`);let o=(await Z(t)).map(s=>({offset:s.offset,length:s.length}));return{fileSize:t.fileSize,structuralRanges:o,essenceRanges:se(o,t.fileSize),trimInputs:n,wholeFileFallback:!0}}async function Q(t){await l();let e=await G((n,a)=>t.read(n,a),t.fileSize);return JSON.parse(e)}function w(t){return(r,e)=>t.read(r,e)}var Me={async inspect(t){let r=t.parts[0],e=await Q(r);if(!e)return null;let n=e.timecode??null,a=n&&n.fps_denominator>0?n.fps_numerator/n.fps_denominator:null,i=e.width??null,o=e.height??null,s=e.inner_codec==="mpeg2"||e.inner_codec==="dv"?e.inner_codec:null;return{id:r.filename,kind:"external",target_url:r.filename,available_range:a&&e.frame_count?{start:{value:0,rate:a},duration:{value:e.frame_count,rate:a}}:null,reel_name:null,source_timecode:n?.display??null,source_fps:a,source_resolution_w:i,source_resolution_h:o,container:"mxf",codec:s,size_bytes:r.fileSize,streams:[...i||o||a?[{kind:"video",codec:s,width:i??void 0,height:o??void 0,rate:a??void 0,codec_specific:null}]:[],...e.audio?[{kind:"audio",codec:e.audio.codec_fourcc,channels:e.audio.channels??void 0,rate:e.audio.sample_rate??void 0,bit_depth:e.audio.bit_depth??void 0,codec_specific:{fourcc:e.audio.codec_fourcc}}]:[]],decode_provenance:e.decode_provenance??null,vendor_metadata:{frame_count:e.frame_count,...n?{drop_frame:n.drop_frame}:{},...e.inner_codec?{inner_codec:e.inner_codec}:{},...e.truncated?{truncated:!0}:{}},binding_state:"unbound",raw_extraction:{mxf_probe:e},metadata:{}}},async extract(t){await l();let r=t.parts[0],e=JSON.parse(await O(w(r),r.fileSize));return e.length===0?null:{v:1,container:"mxf",codec:"mxf",frame_count:N(e),granularity:"frame",segments:e}},async sparsify(t,r){let e=t.parts[0],n=await K(e,r.items,r.handles);return[{filename:e.filename,fileSize:n.fileSize,structuralRanges:n.structuralRanges,essenceRanges:n.essenceRanges,trimInputs:n.trimInputs,wholeFileFallback:n.wholeFileFallback}]},async trim(t,r){let e=t.parts[0];return q(e,r.items,r.handles)},async decode(t,r,e){await l();let n=t.parts[0],a=w(n),i=await ee(t),o=e.detail==="coarse",s;if(i==="arriraw")s=await S(a,n.fileSize,r,o?"preview:4":"full");else if(i==="arriraw-alev3")s=await B(a,n.fileSize,r,o?"preview:4":"full");else if(i==="dnxhr")s=await M(a,n.fileSize,r,o?"preview":"full");else if(i==="xocn")s=await P(a,n.fileSize,r,o?"preview":"full");else if(i==="prores")s=await k(a,n.fileSize,r,o?"preview":"full");else throw new Error(`mxf decode: no decoder for inner codec '${i}'`);let c=new DataView(s.buffer,s.byteOffset,8);return{width:c.getUint32(0,!0),height:c.getUint32(4,!0),rgba:s.slice(8)}},async decode16(t,r){await l();let e=t.parts[0],n=w(e),a=await ee(t),i;try{if(a==="arriraw"){let o=await ue(t,r);if(o)return o;i=await S(n,e.fileSize,r,"rgb16")}else if(a==="dnxhr")i=await M(n,e.fileSize,r,"rgb16");else if(a==="xocn")i=await P(n,e.fileSize,r,"rgb16");else throw new Error(`mxf decode16: no decoder for inner codec '${a}'`)}catch(o){throw fe(o,a)}return J(i)}};function fe(t,r){let e=typeof t=="string"?t:t instanceof Error?t.message:"";return/has no 16-bit decoder|no rgb16 tier/.test(e)?new Error(`mxf ${r}: has no 16-bit decoder \u2014 ${e}`):t}var X=new WeakMap;async function ue(t,r){if(!!0)return null;try{let e=await import("./arriraw-GZ63YMLZ.js");if(!await e.arrirawGpuAvailable())return null;let{parseArrirawGpuPayload:n,arrirawFrameToRgb16:a}=await import("./clip-state-B6JOX3JE.js"),i=t.parts[0],o=X.get(t)??null,s=await U(w(i),i.fileSize,r,o?.key),c=n(s,o);if(!c)return null;X.set(t,{key:c.key,state:c.state});let f=await e.decodeArrirawFrameGpu(c.essence,c.state);return f?{width:f.width,height:f.height,rgb16:a(f)}:null}catch{return null}}var Y=new WeakMap;async function ee(t){let r=Y.get(t);if(r)return r;await l();let e=t.parts[0],n=w(e),a="mxf";return await T(n,e.fileSize)?a="arriraw":await D(n,e.fileSize)?a="arriraw-alev3":await E(n,e.fileSize)?a="dnxhr":await L(n,e.fileSize)?a="xocn":await C(n,e.fileSize)&&(a="prores"),Y.set(t,a),a}export{Me as mxfFormat};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a,b,c,d,e,f,g,h,i}from"./chunk-4RA57LTJ.js";import"./chunk-PSANHDZM.js";export{c as CoverageMissError,e as DeliveryCoverageMissError,a as INTENTS,f as asDeliveryCoverageMiss,h as extract,i as mediaOp,d as parseDeliveryCoverageMiss,g as resolveFormat,b as unpackFrame16};
3
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-IG2X534U.js";import"./chunk-PSANHDZM.js";export{c as CoverageMissError,e as DeliveryCoverageMissError,a as INTENTS,f as asDeliveryCoverageMiss,h as extract,i as mediaOp,d as parseDeliveryCoverageMiss,g as resolveFormat,b as unpackFrame16};
@@ -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{H as b,P as $,b as m,ba as o,g as c,j as p,o as f,u as d}from"./chunk-X527E5VI.js";import"./chunk-PSANHDZM.js";import{dirname as g}from"node:path";import{fileURLToPath as P}from"node:url";import x from"node:process";var a="ColorMatchProbe.ofx.bundle",R="http://127.0.0.1:9876",u="/Library/OFX/Plugins";async function v(){let r=x.execPath;for(let t of[m("CONFORM_RESOLVE_PROBE"),o(g(r),"..","Resources","resolve-probe",a),o(g(P(import.meta.url)),"..","..","..","resolve_hook","build",a)])if(t&&await d(o(t,"Contents","MacOS","ColorMatchProbe.ofx")))return t;return null}async function k(){let r=c()==="darwin"&&p()==="arm64",t=await d(o(u,a)),n=await fetch(R+"/",{signal:AbortSignal.timeout(500)}).then(i=>i.ok).catch(()=>!1),s=!!await v();return{installed:t,loaded:n,shipped:s,supported:r,next:r?n?"running: the Color page selection and the selected node are read live":t?"installed; restart Resolve to load it":s?"host_setup host=resolve action=install_probe (asks for an administrator), then restart Resolve":"not in this build":"the probe runs on Apple silicon Macs only"}}async function C(){if(c()!=="darwin"||p()!=="arm64")throw new Error("the probe runs on Apple silicon Macs only");let r=await v();if(!r)throw new Error("this build does not carry the probe (resolve_hook/build.sh makes it)");return await O(r,u,a),await b(o(f(),"Library","Application Support","Blackmagic Design","DaVinci Resolve","OFXPluginCacheV2.xml")).catch(()=>{}),{path:o(u,a),restart_required:!0}}var e=r=>`'${r.replace(/'/g,"'\\''")}'`;async function O(r,t,n){let s=o(t,n),l=o(t,`.${n}.staging`),i=o(t,`.${n}.previous`),w=[`mkdir -p ${e(t)}`,`rm -rf ${e(l)} ${e(i)}`,`cp -R ${e(r)} ${e(l)}`,`if [ -e ${e(s)} ]; then mv ${e(s)} ${e(i)}; fi`,`mv ${e(l)} ${e(s)} || { [ -e ${e(i)} ] && mv ${e(i)} ${e(s)}; exit 1; }`,`rm -rf ${e(i)}`].join(" && "),h=await $("osascript",["-e",`do shell script ${JSON.stringify(w)} with administrator privileges`]);if(!h.success)throw new Error(`installing into ${t} needs an administrator, and that was refused or failed: ${h.stderr.trim()}`)}export{a as PROBE_BUNDLE,R as PROBE_URL,C as installProbe,k as probeStatus};
3
+ import{H as b,P as $,b as m,ba as o,g as c,j as p,o as f,u as d}from"./chunk-GTPTZRO6.js";import"./chunk-PSANHDZM.js";import{dirname as g}from"node:path";import{fileURLToPath as P}from"node:url";import x from"node:process";var a="ColorMatchProbe.ofx.bundle",R="http://127.0.0.1:9876",u="/Library/OFX/Plugins";async function v(){let r=x.execPath;for(let t of[m("CONFORM_RESOLVE_PROBE"),o(g(r),"..","Resources","resolve-probe",a),o(g(P(import.meta.url)),"..","..","..","resolve_hook","build",a)])if(t&&await d(o(t,"Contents","MacOS","ColorMatchProbe.ofx")))return t;return null}async function k(){let r=c()==="darwin"&&p()==="arm64",t=await d(o(u,a)),n=await fetch(R+"/",{signal:AbortSignal.timeout(500)}).then(i=>i.ok).catch(()=>!1),s=!!await v();return{installed:t,loaded:n,shipped:s,supported:r,next:r?n?"running: the Color page selection and the selected node are read live":t?"installed; restart Resolve to load it":s?"host_setup host=resolve action=install_probe (asks for an administrator), then restart Resolve":"not in this build":"the probe runs on Apple silicon Macs only"}}async function C(){if(c()!=="darwin"||p()!=="arm64")throw new Error("the probe runs on Apple silicon Macs only");let r=await v();if(!r)throw new Error("this build does not carry the probe (resolve_hook/build.sh makes it)");return await O(r,u,a),await b(o(f(),"Library","Application Support","Blackmagic Design","DaVinci Resolve","OFXPluginCacheV2.xml")).catch(()=>{}),{path:o(u,a),restart_required:!0}}var e=r=>`'${r.replace(/'/g,"'\\''")}'`;async function O(r,t,n){let s=o(t,n),l=o(t,`.${n}.staging`),i=o(t,`.${n}.previous`),w=[`mkdir -p ${e(t)}`,`rm -rf ${e(l)} ${e(i)}`,`cp -R ${e(r)} ${e(l)}`,`if [ -e ${e(s)} ]; then mv ${e(s)} ${e(i)}; fi`,`mv ${e(l)} ${e(s)} || { [ -e ${e(i)} ] && mv ${e(i)} ${e(s)}; exit 1; }`,`rm -rf ${e(i)}`].join(" && "),h=await $("osascript",["-e",`do shell script ${JSON.stringify(w)} with administrator privileges`]);if(!h.success)throw new Error(`installing into ${t} needs an administrator, and that was refused or failed: ${h.stderr.trim()}`)}export{a as PROBE_BUNDLE,R as PROBE_URL,C as installProbe,k as probeStatus};
@@ -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 e1}from"./chunk-7D7H6VFW.js";import{Ia as r1,ya as n1}from"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";var t1=new Uint32Array([327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,458759,458759,458759,458759,458759,458759,458759,458759,524296,524296,524296,524296,589839,589839,655376,655377,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,458764,458764,458764,458764,458764,458764,458764,458764,458766,458766,458766,458766,458766,458766,458766,458766,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154]),a1=new Uint32Array([393223,393224,327686,327686,262149,262149,262149,262149,196609,196609,196609,196609,196609,196609,196609,196609,262146,262146,262146,262146,262147,262147,262147,262147,196612,196612,196612,196612,196612,196612,196612,196612,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536]),i1=new Uint32Array([131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,196610,196610,196610,196610,196610,196610,196610,196610,196611,196611,196611,196611,196611,196611,196611,196611,196612,196612,196612,196612,196612,196612,196612,196612,262149,262149,262149,262149,262150,262150,262150,262150,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073]),u1=new Uint32Array([0,1,5,6,14,15,27,28,44,45,65,66,90,91,119,120,2,4,7,13,16,26,29,43,46,64,67,89,92,118,121,150,3,8,12,17,25,30,42,47,63,68,88,93,117,122,149,151,9,11,18,24,31,41,48,62,69,87,94,116,123,148,152,177,10,19,23,32,40,49,61,70,86,95,115,124,147,153,176,178,20,22,33,39,50,60,71,85,96,114,125,146,154,175,179,200,21,34,38,51,59,72,84,97,113,126,145,155,174,180,199,201,35,37,52,58,73,83,98,112,127,144,156,173,181,198,202,219,36,53,57,74,82,99,111,128,143,157,172,182,197,203,218,220,54,56,75,81,100,110,129,142,158,171,183,196,204,217,221,234,55,76,80,101,109,130,141,159,170,184,195,205,216,222,233,235,77,79,102,108,131,140,160,169,185,194,206,215,223,232,236,245,78,103,107,132,139,161,168,186,193,207,214,224,231,237,244,246,104,106,133,138,162,167,187,192,208,213,225,230,238,243,247,252,105,134,137,163,166,188,191,209,212,226,229,239,242,248,251,253,135,136,164,165,189,190,210,211,227,228,240,241,249,250,254,255]),z=new Int32Array([2048,2882,2841,2772,2676,2554,2408,2239,2048,1837,1609,1365,1108,841,565,284,2048,2772,2408,1837,1108,284,-565,-1365,-2048,-2554,-2841,-2882,-2676,-2239,-1609,-841,2048,2554,1609,284,-1108,-2239,-2841,-2772,-2048,-841,565,1837,2676,2882,2408,1365,2048,2239,565,-1365,-2676,-2772,-1609,284,2048,2882,2408,841,-1108,-2554,-2841,-1837,2048,1837,-565,-2554,-2676,-841,1609,2882,2048,-284,-2408,-2772,-1108,1365,2841,2239,2048,1365,-1609,-2882,-1108,1837,2841,841,-2048,-2772,-565,2239,2676,284,-2408,-2554,2048,841,-2408,-2239,1108,2882,565,-2554,-2048,1365,2841,284,-2676,-1837,1609,2772,2048,284,-2841,-841,2676,1365,-2408,-1837,2048,2239,-1609,-2554,1108,2772,-565,-2882,2048,-284,-2841,841,2676,-1365,-2408,1837,2048,-2239,-1609,2554,1108,-2772,-565,2882,2048,-841,-2408,2239,1108,-2882,565,2554,-2048,-1365,2841,-284,-2676,1837,1609,-2772,2048,-1365,-1609,2882,-1108,-1837,2841,-841,-2048,2772,-565,-2239,2676,-284,-2408,2554,2048,-1837,-565,2554,-2676,841,1609,-2882,2048,284,-2408,2772,-1108,-1365,2841,-2239,2048,-2239,565,1365,-2676,2772,-1609,-284,2048,-2882,2408,-841,-1108,2554,-2841,1837,2048,-2554,1609,-284,-1108,2239,-2841,2772,-2048,841,565,-1837,2676,-2882,2408,-1365,2048,-2772,2408,-1837,1108,-284,-565,1365,-2048,2554,-2841,2882,-2676,2239,-1609,841,2048,-2882,2841,-2772,2676,-2554,2408,-2239,2048,-1837,1609,-1365,1108,-841,565,-284]),s1={m16:931135616,lg_a:1098061119,lg_b:1125906863,lg_c:1046850094,lg_pa:1008981770,gc_k:1064554302,gc_p:1101529087,gc_t:1028443341,sd_eps:953267991,inv273:997199617,rr_c13:956301440,rr_c16:931135616,rr_c18:914358400,bil_sg:973078528,bil_srb:975874731,sobel_sc:931135616,bil_t7_0:1032826803,bil_t7_1:1040595071,bil_t7_2:1044597305,bil_t7_3:1046301409,bil_t7_4:1044597305,bil_t7_5:1040595071,bil_t7_6:1032826803,bil_t9_0:1031861895,bil_t9_1:1035879338,bil_t9_2:1039871874,bil_t9_3:1041522383,bil_t9_4:1042077871,bil_t9_5:1041522383,bil_t9_6:1039871874,bil_t9_7:1035879338,bil_t9_8:1031861895,gauss55_00:1065353216,gauss55_01:1082130432,gauss55_02:1088421888,gauss55_03:1082130432,gauss55_04:1065353216,gauss55_10:1082130432,gauss55_11:1098907648,gauss55_12:1104150528,gauss55_13:1098907648,gauss55_14:1082130432,gauss55_20:1088421888,gauss55_21:1104150528,gauss55_22:1109655552,gauss55_23:1104150528,gauss55_24:1088421888,gauss55_30:1082130432,gauss55_31:1098907648,gauss55_32:1104150528,gauss55_33:1098907648,gauss55_34:1082130432,gauss55_40:1065353216,gauss55_41:1082130432,gauss55_42:1088421888,gauss55_43:1082130432,gauss55_44:1065353216};function E(n,r){return(n[r]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3])>>>0}function w(n,r){return n[r]<<8|n[r+1]}function q(n){let r=Math.min(n.length,65536),e=-1;for(let u=16;u+6<=r;u+=2){if(w(n,u)!==259)continue;let g=w(n,u+2),p=w(n,u+4);if(g<256||g>8192||p<128||p>8192)continue;let y=u-16;if(E(n,y+4)!==0||E(n,y+8)!==0)continue;let P=E(n,y);if(!(P<65536||y+P>n.length+8192)){e=y;break}}if(e<0)throw new Error("RED codestream container not found");let i=e,t=i+12,a=[];for(let u=0;u<8;u++)a.push(w(n,t+4+2*u));let o=i+28;if(o+512>n.length)throw new Error("R3D container table truncated");let b=a[1],m=a[2],f=i+540,v=v1(n,f,a[4],b);if(b%2!==0)throw new Error(`odd R3D canvas width ${b}`);return{canvasW:b,canvasH:m,rawFields:a,table512:n.subarray(o,o+512),streamOff:f,segments:v}}function v1(n,r,e,i){let t=Math.ceil(i/128),a=r;for(;(w(n,a)&4095)<256;)if(a+=2,a+2>n.length)throw new Error("R3D segment stream truncated");a+=1;let o=a,b=n[a-1],m=[];for(let f=0;f<e;f++){if(o+8>n.length)throw new Error("R3D segment header past essence end");let v=[w(n,o),w(n,o+2),w(n,o+4),w(n,o+6)],u=v.map(h=>h+7>>3),g=o+8,p=u[0]+u[1]+u[2]+u[3];if(g+p>n.length)throw new Error("R3D segment body past essence end");let y=g,P=v.map((h,x)=>{let C={off:y,bitLength:h,byteLength:u[x]};return y+=u[x],C});m.push({x:f%t*128,y:Math.floor(f/t)*16,quant:b,subbands:P}),b=n[g+p]??0,o=g+p+1}return m}function o1(n){let r=new Uint32Array(n.segments.length*4*8),e=0;for(let i of n.segments)for(let t=0;t<4;t++){let a=i.subbands[t];r[e]=a.off,r[e+1]=a.bitLength,r[e+2]=a.byteLength,r[e+3]=i.x,r[e+4]=i.y,r[e+5]=i.quant,r[e+6]=t,r[e+7]=0,e+=8}return r}function k(n){return x1[0]=n>>>0,h1[0]}var c1=new ArrayBuffer(4),x1=new Uint32Array(c1),h1=new Float32Array(c1),w1=1112556626;function B1(n){if(n.length<140)return null;let r=new DataView(n.buffer,n.byteOffset,n.byteLength);if(r.getUint32(0,!0)!==w1||r.getUint32(4,!0)!==1)return null;let e=r.getUint32(8,!0),i=12,t=[];for(let f=0;f<4;f++,i+=4)t.push(r.getUint32(i,!0));let a=[];for(let f=0;f<26;f++,i+=4)a.push(r.getUint32(i,!0));let o=r.getUint32(i,!0);i+=4;let b=r.getUint32(i,!0);if(i+=4,i+b>n.length)return null;let m=new TextDecoder().decode(n.subarray(i,i+b));return{wbBits:t,smatrixBits:a,exposureBits:o,fixFlashers:(e&2)!==0,model:m}}async function M(n){try{return await r1(),B1(n1(n??new Uint8Array(0)))}catch{return null}}var l1=`// R3D KOMODO entropy decode (kernel 1 of 2). One invocation per (segment, subband) job.
3
+ import{a as n1}from"./chunk-7D7H6VFW.js";import{Ha as Z,ya as Q}from"./chunk-QNF4NMIW.js";import"./chunk-PSANHDZM.js";var r1=new Uint32Array([327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,458759,458759,458759,458759,458759,458759,458759,458759,524296,524296,524296,524296,589839,589839,655376,655377,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,458764,458764,458764,458764,458764,458764,458764,458764,458766,458766,458766,458766,458766,458766,458766,458766,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154]),e1=new Uint32Array([393223,393224,327686,327686,262149,262149,262149,262149,196609,196609,196609,196609,196609,196609,196609,196609,262146,262146,262146,262146,262147,262147,262147,262147,196612,196612,196612,196612,196612,196612,196612,196612,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536]),t1=new Uint32Array([131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,196610,196610,196610,196610,196610,196610,196610,196610,196611,196611,196611,196611,196611,196611,196611,196611,196612,196612,196612,196612,196612,196612,196612,196612,262149,262149,262149,262149,262150,262150,262150,262150,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073]),a1=new Uint32Array([0,1,5,6,14,15,27,28,44,45,65,66,90,91,119,120,2,4,7,13,16,26,29,43,46,64,67,89,92,118,121,150,3,8,12,17,25,30,42,47,63,68,88,93,117,122,149,151,9,11,18,24,31,41,48,62,69,87,94,116,123,148,152,177,10,19,23,32,40,49,61,70,86,95,115,124,147,153,176,178,20,22,33,39,50,60,71,85,96,114,125,146,154,175,179,200,21,34,38,51,59,72,84,97,113,126,145,155,174,180,199,201,35,37,52,58,73,83,98,112,127,144,156,173,181,198,202,219,36,53,57,74,82,99,111,128,143,157,172,182,197,203,218,220,54,56,75,81,100,110,129,142,158,171,183,196,204,217,221,234,55,76,80,101,109,130,141,159,170,184,195,205,216,222,233,235,77,79,102,108,131,140,160,169,185,194,206,215,223,232,236,245,78,103,107,132,139,161,168,186,193,207,214,224,231,237,244,246,104,106,133,138,162,167,187,192,208,213,225,230,238,243,247,252,105,134,137,163,166,188,191,209,212,226,229,239,242,248,251,253,135,136,164,165,189,190,210,211,227,228,240,241,249,250,254,255]),j=new Int32Array([2048,2882,2841,2772,2676,2554,2408,2239,2048,1837,1609,1365,1108,841,565,284,2048,2772,2408,1837,1108,284,-565,-1365,-2048,-2554,-2841,-2882,-2676,-2239,-1609,-841,2048,2554,1609,284,-1108,-2239,-2841,-2772,-2048,-841,565,1837,2676,2882,2408,1365,2048,2239,565,-1365,-2676,-2772,-1609,284,2048,2882,2408,841,-1108,-2554,-2841,-1837,2048,1837,-565,-2554,-2676,-841,1609,2882,2048,-284,-2408,-2772,-1108,1365,2841,2239,2048,1365,-1609,-2882,-1108,1837,2841,841,-2048,-2772,-565,2239,2676,284,-2408,-2554,2048,841,-2408,-2239,1108,2882,565,-2554,-2048,1365,2841,284,-2676,-1837,1609,2772,2048,284,-2841,-841,2676,1365,-2408,-1837,2048,2239,-1609,-2554,1108,2772,-565,-2882,2048,-284,-2841,841,2676,-1365,-2408,1837,2048,-2239,-1609,2554,1108,-2772,-565,2882,2048,-841,-2408,2239,1108,-2882,565,2554,-2048,-1365,2841,-284,-2676,1837,1609,-2772,2048,-1365,-1609,2882,-1108,-1837,2841,-841,-2048,2772,-565,-2239,2676,-284,-2408,2554,2048,-1837,-565,2554,-2676,841,1609,-2882,2048,284,-2408,2772,-1108,-1365,2841,-2239,2048,-2239,565,1365,-2676,2772,-1609,-284,2048,-2882,2408,-841,-1108,2554,-2841,1837,2048,-2554,1609,-284,-1108,2239,-2841,2772,-2048,841,565,-1837,2676,-2882,2408,-1365,2048,-2772,2408,-1837,1108,-284,-565,1365,-2048,2554,-2841,2882,-2676,2239,-1609,841,2048,-2882,2841,-2772,2676,-2554,2408,-2239,2048,-1837,1609,-1365,1108,-841,565,-284]),i1={m16:931135616,lg_a:1098061119,lg_b:1125906863,lg_c:1046850094,lg_pa:1008981770,gc_k:1064554302,gc_p:1101529087,gc_t:1028443341,sd_eps:953267991,inv273:997199617,rr_c13:956301440,rr_c16:931135616,rr_c18:914358400,bil_sg:973078528,bil_srb:975874731,sobel_sc:931135616,bil_t7_0:1032826803,bil_t7_1:1040595071,bil_t7_2:1044597305,bil_t7_3:1046301409,bil_t7_4:1044597305,bil_t7_5:1040595071,bil_t7_6:1032826803,bil_t9_0:1031861895,bil_t9_1:1035879338,bil_t9_2:1039871874,bil_t9_3:1041522383,bil_t9_4:1042077871,bil_t9_5:1041522383,bil_t9_6:1039871874,bil_t9_7:1035879338,bil_t9_8:1031861895,gauss55_00:1065353216,gauss55_01:1082130432,gauss55_02:1088421888,gauss55_03:1082130432,gauss55_04:1065353216,gauss55_10:1082130432,gauss55_11:1098907648,gauss55_12:1104150528,gauss55_13:1098907648,gauss55_14:1082130432,gauss55_20:1088421888,gauss55_21:1104150528,gauss55_22:1109655552,gauss55_23:1104150528,gauss55_24:1088421888,gauss55_30:1082130432,gauss55_31:1098907648,gauss55_32:1104150528,gauss55_33:1098907648,gauss55_34:1082130432,gauss55_40:1065353216,gauss55_41:1082130432,gauss55_42:1088421888,gauss55_43:1082130432,gauss55_44:1065353216};function T(n,r){return(n[r]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3])>>>0}function w(n,r){return n[r]<<8|n[r+1]}function z(n){let r=Math.min(n.length,65536),e=-1;for(let u=16;u+6<=r;u+=2){if(w(n,u)!==259)continue;let g=w(n,u+2),p=w(n,u+4);if(g<256||g>8192||p<128||p>8192)continue;let y=u-16;if(T(n,y+4)!==0||T(n,y+8)!==0)continue;let P=T(n,y);if(!(P<65536||y+P>n.length+8192)){e=y;break}}if(e<0)throw new Error("RED codestream container not found");let i=e,t=i+12,a=[];for(let u=0;u<8;u++)a.push(w(n,t+4+2*u));let o=i+28;if(o+512>n.length)throw new Error("R3D container table truncated");let b=a[1],m=a[2],f=i+540,v=v1(n,f,a[4],b);if(b%2!==0)throw new Error(`odd R3D canvas width ${b}`);return{canvasW:b,canvasH:m,rawFields:a,table512:n.subarray(o,o+512),streamOff:f,segments:v}}function v1(n,r,e,i){let t=Math.ceil(i/128),a=r;for(;(w(n,a)&4095)<256;)if(a+=2,a+2>n.length)throw new Error("R3D segment stream truncated");a+=1;let o=a,b=n[a-1],m=[];for(let f=0;f<e;f++){if(o+8>n.length)throw new Error("R3D segment header past essence end");let v=[w(n,o),w(n,o+2),w(n,o+4),w(n,o+6)],u=v.map(h=>h+7>>3),g=o+8,p=u[0]+u[1]+u[2]+u[3];if(g+p>n.length)throw new Error("R3D segment body past essence end");let y=g,P=v.map((h,x)=>{let C={off:y,bitLength:h,byteLength:u[x]};return y+=u[x],C});m.push({x:f%t*128,y:Math.floor(f/t)*16,quant:b,subbands:P}),b=n[g+p]??0,o=g+p+1}return m}function u1(n){let r=new Uint32Array(n.segments.length*4*8),e=0;for(let i of n.segments)for(let t=0;t<4;t++){let a=i.subbands[t];r[e]=a.off,r[e+1]=a.bitLength,r[e+2]=a.byteLength,r[e+3]=i.x,r[e+4]=i.y,r[e+5]=i.quant,r[e+6]=t,r[e+7]=0,e+=8}return r}function k(n){return x1[0]=n>>>0,h1[0]}var s1=new ArrayBuffer(4),x1=new Uint32Array(s1),h1=new Float32Array(s1),w1=1112556626;function B1(n){if(n.length<140)return null;let r=new DataView(n.buffer,n.byteOffset,n.byteLength);if(r.getUint32(0,!0)!==w1||r.getUint32(4,!0)!==1)return null;let e=r.getUint32(8,!0),i=12,t=[];for(let f=0;f<4;f++,i+=4)t.push(r.getUint32(i,!0));let a=[];for(let f=0;f<26;f++,i+=4)a.push(r.getUint32(i,!0));let o=r.getUint32(i,!0);i+=4;let b=r.getUint32(i,!0);if(i+=4,i+b>n.length)return null;let m=new TextDecoder().decode(n.subarray(i,i+b));return{wbBits:t,smatrixBits:a,exposureBits:o,fixFlashers:(e&2)!==0,model:m}}async function E(n){try{return await Z(),B1(Q(n??new Uint8Array(0)))}catch{return null}}var o1=`// R3D KOMODO entropy decode (kernel 1 of 2). One invocation per (segment, subband) job.
4
4
  // Faithful port of decode_subband_raw in rust/media-core/src/r3d/entropy.rs.
5
5
  // Writes RAW coefficients (scan order) straight into coeff[job*2048 ..] \u2014 the buffer must be
6
6
  // zero-initialized; only nonzero decoded positions are written (deterministic across reruns).
@@ -333,7 +333,7 @@ fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
333
333
  if (!(rbc + rbyc * 8 < bitLen)) { break; }
334
334
  }
335
335
  }
336
- `;var f1=`// R3D KOMODO descan + dequant + 16x16 integer basis transform + scatter (kernel 2 of 2).
336
+ `;var c1=`// R3D KOMODO descan + dequant + 16x16 integer basis transform + scatter (kernel 2 of 2).
337
337
  // Cooperative: ONE WORKGROUP (256 threads) per (job, subblock); deq/tmp live in shared memory,
338
338
  // each thread computes one element of each pass. Mirrors decode_subband + scatter_subband.
339
339
  // Dispatch is 2D; block index = wid.x + wid.y * num_workgroups.x.
@@ -407,7 +407,7 @@ fn main(@builtin(workgroup_id) wid: vec3<u32>,
407
407
  }
408
408
  }
409
409
  }
410
- `;var d1=`// R3D IPP2 develop chain (stages 1-15 of rust/media-core/src/r3d/develop.rs) on WebGPU.
410
+ `;var l1=`// R3D IPP2 develop chain (stages 1-15 of rust/media-core/src/r3d/develop.rs) on WebGPU.
411
411
  // Production port of experiments/prores-wgsl-spike/r3d-develop/r3d-develop.wgsl with two
412
412
  // changes: _d0 compands the entropy-lane channel planes directly (the spike read a
413
413
  // pre-built u16 raw_pre buffer that shipping code no longer constructs \u2014 see
@@ -1009,7 +1009,7 @@ fn _d16(@builtin(global_invocation_id) g: vec3<u32>) {
1009
1009
  let b = out16(3u * i + 2u) >> 8u;
1010
1010
  outR[i] = r | (gg << 8u) | (b << 16u) | 0xFF000000u;
1011
1011
  }
1012
- `;var A1=1,P1=4,B=8,N=64,S=128,k1=1,b1=!1;function O(n,r){return b1||(b1=!0,console.warn(`[media/gpu/r3d] GPU lane disabled after failure at ${n}; falling back to CPU:`,r)),null}var _=Math.fround;function V(n){let r=Number(n).toString();return/[.e]/.test(r)||(r+=".0"),r}function A(n){let r=_(n),e=_(n-r);return`vec2<f32>(${V(r)}, ${V(e)})`}function V1(){let n={};for(let[i,t]of Object.entries(s1))n[i]=k(t);let r="",e=(i,t)=>{r+=`const ${i}: f32 = ${V(t)};
1012
+ `;var A1=1,P1=4,B=8,q=64,S=128,k1=1,f1=!1;function W(n,r){return f1||(f1=!0,console.warn(`[media/gpu/r3d] GPU lane disabled after failure at ${n}; falling back to CPU:`,r)),null}var _=Math.fround;function V(n){let r=Number(n).toString();return/[.e]/.test(r)||(r+=".0"),r}function A(n){let r=_(n),e=_(n-r);return`vec2<f32>(${V(r)}, ${V(e)})`}function V1(){let n={};for(let[i,t]of Object.entries(i1))n[i]=k(t);let r="",e=(i,t)=>{r+=`const ${i}: f32 = ${V(t)};
1013
1013
  `};e("M16",n.m16),e("LG_A",n.lg_a),e("LG_B",n.lg_b),e("LG_C",n.lg_c),e("LG_PA",n.lg_pa),e("GC_K",n.gc_k),e("GC_P",n.gc_p),e("GC_T",n.gc_t),e("SD_EPS",n.sd_eps),e("INV273",n.inv273),e("RR_C13",n.rr_c13),e("RR_C16",n.rr_c16),e("RR_C18",n.rr_c18),e("BIL_SG",n.bil_sg),e("BIL_SRB",n.bil_srb),e("SOBEL_SC",n.sobel_sc),e("RC_P",_(.1)),e("SD_STRENGTH",_(.1)),e("SD_OMS",_(1-_(.1))),e("C_1_9",_(1/9)),e("C_1_11",_(1/11)),e("C_1_13",_(1/13)),e("C_1_15",_(1/15)),e("C_1_17",_(1/17)),e("C_1_19",_(1/19)),e("C_1_21",_(1/21)),e("C_1_24",_(1/24)),e("C_1_120",_(1/120)),e("C_1_720",_(1/720)),r+=`const T7 = array<f32,7>(${Array.from({length:7},(i,t)=>V(n[`bil_t7_${t}`])).join(", ")});
1014
1014
  `,r+=`const T9 = array<f32,9>(${Array.from({length:9},(i,t)=>V(n[`bil_t9_${t}`])).join(", ")});
1015
1015
  `;{let i=[];for(let t=0;t<5;t++)for(let a=0;a<5;a++)i.push(V(n[`gauss55_${t}${a}`]));r+=`const GAUSS = array<f32,25>(${i.join(", ")});
@@ -1022,4 +1022,4 @@ const DD_INVLN10 = ${A(1/Math.log(10))};
1022
1022
  `,r+=`const DD_INVLN2 = ${A(1/Math.log(2))};
1023
1023
  const DD_LN2 = ${A(Math.log(2))};
1024
1024
  `,r+=`const EXP2TAB = array<vec2<f32>,16>(${Array.from({length:16},(i,t)=>A(Math.pow(2,t/16))).join(", ")});
1025
- `,d1.replace("//__CONSTS__",r)}var F=[{entry:"_d0",binds:{1:"PL",4:"B0"},checkpoint:null},{entry:"_d1",binds:{1:"B0",4:"B1"},checkpoint:{name:"s0",buf:"B1",words:n=>4*n}},{entry:"_d2",binds:{1:"B1",4:"B0"},checkpoint:{name:"s1",buf:"B0",words:n=>4*n}},{entry:"_d3",binds:{1:"B0",4:"SOB"},checkpoint:{name:"s2",buf:"SOB",words:n=>2*n}},{entry:"_d4",binds:{1:"B0",2:"SOB",4:"B1"},checkpoint:{name:"s3",buf:"B1",words:n=>4*n}},{entry:"_d5",binds:{1:"B1",4:"B2"},checkpoint:{name:"s4",buf:"B2",words:n=>4*n}},{entry:"_d6",binds:{1:"B2",4:"B0"},checkpoint:{name:"s5",buf:"B0",words:n=>4*n}},{entry:"_d7",binds:{1:"B0",5:"B2"},checkpoint:{name:"s6",buf:"B2",words:n=>2*n}},{entry:"_d8",binds:{1:"B1",2:"SOB",3:"B2",4:"B0"},checkpoint:{name:"s7",buf:"B0",words:n=>4*n}},{entry:"_d9",binds:{1:"B0",4:"B1"},checkpoint:{name:"s8",buf:"B1",words:n=>4*n}},{entry:"_d10",binds:{1:"B1",4:"B0"},checkpoint:{name:"s9",buf:"B0",words:n=>3*n}},{entry:"_d11",binds:{1:"B0",5:"B2"},checkpoint:null},{entry:"_d12",binds:{3:"B2",5:"SOB"},checkpoint:{name:"s10",buf:"SOB",words:n=>n}},{entry:"_d13",binds:{1:"B0",3:"SOB",4:"B1"},checkpoint:null},{entry:"_d14",binds:{1:"B1",4:"B0"},checkpoint:null},{entry:"_d15",binds:{1:"B0",7:"OUT"},checkpoint:{name:"s11",buf:"OUT",words:n=>3*n>>1},halfW:!0},{entry:"_d16",binds:{7:"OUT",8:"RGBA"},checkpoint:{name:"s12",buf:"RGBA",words:n=>n}}],$=class n{constructor(r,e,i,t,a){this.essenceBuf=null;this.essenceCap=0;this.jobsBuf=null;this.jobsCap=0;this.coeffBuf=null;this.coeffCap=0;this.frames=new Map;this.queueTail=Promise.resolve();this.device=r,this.vldPipe=e,this.xfPipe=i,this.developPipes=t,this.tabBuf=a}static async create(r){let e=async(g,p)=>{let y=r.createShaderModule({code:g}),h=(await y.getCompilationInfo()).messages.filter(x=>x.type==="error");if(h.length)throw new Error(`${p}: ${h.map(x=>`${x.lineNum}:${x.linePos} ${x.message}`).join(" | ")}`);return y},i=await e(l1,"r3d-vld"),t=await e(f1,"r3d-xform"),a=await e(V1(),"r3d-develop"),o=(g,p)=>r.createComputePipelineAsync({layout:"auto",compute:{module:g,entryPoint:p}}),[b,m,...f]=await Promise.all([o(i,"main"),o(t,"main"),...F.map(g=>o(a,g.entry))]),v=r.createBuffer({size:1920*4,usage:S|B}),u=new Uint32Array(1920);return u.set(t1,0),u.set(a1,1024),u.set(i1,1088),u.set(u1,1152),u.set(new Uint32Array(z.buffer,z.byteOffset,256),1408),r.queue.writeBuffer(v,0,u),new n(r,b,m,f,v)}run(r,e){let i=this.queueTail.then(()=>this.decodeInner(r,e),()=>this.decodeInner(r,e));return this.queueTail=i.catch(()=>{}),i}frameBuffers(r){let e=`${r.canvasW}x${r.canvasH}`,i=this.frames.get(e);if(i)return i;let t=this.device,a=r.canvasW*r.canvasH,o=(m,f=0)=>t.createBuffer({size:m,usage:S|P1|B|f}),b={w:r.canvasW,h:r.canvasH,n:a,PL:o(4*a*4),B0:o(4*a*4),B1:o(4*a*4),B2:o(4*a*4),SOB:o(2*a*4),OUT:o(3*a*2),RGBA:o(a*4),uni:t.createBuffer({size:112,usage:N|B}),params1:t.createBuffer({size:16,usage:N|B}),params2:t.createBuffer({size:16,usage:N|B}),developBinds:[],flashCopy:{src:null,dst:null,bytes:4*a*4}};return b.flashCopy.src=b.B1,b.flashCopy.dst=b.B0,b.developBinds=F.map((m,f)=>{let v=[{binding:0,resource:{buffer:b.uni}}];for(let[u,g]of Object.entries(m.binds))v.push({binding:Number(u),resource:{buffer:b[g]}});return t.createBindGroup({layout:this.developPipes[f].getBindGroupLayout(0),entries:v})}),this.frames.set(e,b),b}growEssence(r){return(!this.essenceBuf||this.essenceCap<r)&&(this.essenceBuf?.destroy?.(),this.essenceCap=Math.max(r,this.essenceCap*2),this.essenceBuf=this.device.createBuffer({size:this.essenceCap,usage:S|B})),this.essenceBuf}growJobs(r){return(!this.jobsBuf||this.jobsCap<r)&&(this.jobsBuf?.destroy?.(),this.jobsCap=Math.max(r,this.jobsCap*2),this.jobsBuf=this.device.createBuffer({size:this.jobsCap,usage:S|B})),this.jobsBuf}growCoeff(r){return(!this.coeffBuf||this.coeffCap<r)&&(this.coeffBuf?.destroy?.(),this.coeffCap=Math.max(r,this.coeffCap*2),this.coeffBuf=this.device.createBuffer({size:this.coeffCap,usage:S|B})),this.coeffBuf}async decodeInner(r,e){let i=performance.now(),t=this.device,a=q(r),o=a.canvasW*a.canvasH,m=(t.limits??{}).maxStorageBufferBindingSize??128*1024*1024,f=a.segments.length*4,v=f*2048*4;if(4*o*4>m||v>m||r.length+16>m)throw new Error(`frame exceeds storage binding limit (${a.canvasW}x${a.canvasH}, ${f} jobs)`);let u=this.frameBuffers(a),g=new Uint32Array(256);for(let s=0;s<256;s++)g[s]=a.table512[s];t.queue.writeBuffer(this.tabBuf,1664*4,g);let p=new Uint8Array(r.length+8+3&-4);p.set(r);let y=this.growEssence(p.length);t.queue.writeBuffer(y,0,p.buffer,0,p.length),p.length<this.essenceCap&&t.queue.writeBuffer(y,p.length,new Uint8Array(Math.min(this.essenceCap-p.length,16)));let P=o1(a),h=this.growJobs(P.byteLength);t.queue.writeBuffer(h,0,P);let x=this.growCoeff(v),C=f*8;t.queue.writeBuffer(u.params1,0,new Uint32Array([f,a.canvasW,a.canvasH,o])),t.queue.writeBuffer(u.params2,0,new Uint32Array([C,a.canvasW,a.canvasH,o]));let R=e.paramsBits;{let s=new ArrayBuffer(112),c=new Uint32Array(s),l=new Float32Array(s);c[0]=a.canvasW,c[1]=a.canvasH,c[2]=o,c[3]=0,l[4]=0,l[5]=1,l[6]=k(R.exposureBits),l[7]=0;for(let d=0;d<4;d++)l[8+d]=k(R.wbBits[d]);for(let d=0;d<3;d++)l[12+d]=k(R.smatrixBits[12+d]);l[15]=0;for(let d=0;d<12;d++)l[16+d]=k(R.smatrixBits[d]);t.queue.writeBuffer(u.uni,0,s)}let g1=t.createBindGroup({layout:this.vldPipe.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:u.params1}},{binding:1,resource:{buffer:y}},{binding:2,resource:{buffer:h}},{binding:3,resource:{buffer:this.tabBuf}},{binding:4,resource:{buffer:x}}]}),p1=t.createBindGroup({layout:this.xfPipe.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:u.params2}},{binding:1,resource:{buffer:h}},{binding:2,resource:{buffer:this.tabBuf}},{binding:3,resource:{buffer:x}},{binding:4,resource:{buffer:u.PL}}]});t.pushErrorScope("out-of-memory"),t.pushErrorScope("validation");{let s=t.createCommandEncoder();s.clearBuffer(x,0,v);let c=s.beginComputePass();c.setPipeline(this.vldPipe),c.setBindGroup(0,g1),c.dispatchWorkgroups(Math.ceil(f/64)),c.end();let l=s.beginComputePass();l.setPipeline(this.xfPipe),l.setBindGroup(0,p1),l.dispatchWorkgroups(Math.ceil(C/16),16),l.end(),t.queue.submit([s.finish()])}let m1=Math.ceil(a.canvasW/16),_1=Math.ceil(a.canvasH/16),y1=Math.ceil(a.canvasW/2/16),L={},U=[],G=(s,c,l,d)=>{let Z=t.createBuffer({size:l,usage:B|A1});d.copyBufferToBuffer(c,0,Z,0,l),U.push({name:s,buf:c,bytes:l,stage:Z})},K=e.captureOnly?new Set(e.captureOnly):null,I=s=>e.captureStages===!0&&(K===null||K.has(s));{let s=t.createCommandEncoder();I("planes")&&G("planes",u.PL,4*o*4,s);for(let c=0;c<F.length;c++){let l=F[c];if(!(l.entry==="_d16"&&!e.wantRgba&&!I("s12"))){if(l.entry==="_d2"&&!R.fixFlashers)s.copyBufferToBuffer(u.flashCopy.src,0,u.flashCopy.dst,0,u.flashCopy.bytes);else{let d=s.beginComputePass();d.setPipeline(this.developPipes[c]),d.setBindGroup(0,u.developBinds[c]),d.dispatchWorkgroups(l.halfW?y1:m1,_1),d.end()}l.checkpoint&&I(l.checkpoint.name)&&G(l.checkpoint.name,u[l.checkpoint.buf],l.checkpoint.words(o)*4,s)}}e.wantLog16&&G("out_log16",u.OUT,3*o*2,s),e.wantRgba&&G("out_rgba",u.RGBA,o*4,s),t.queue.submit([s.finish()])}let J=await t.popErrorScope(),X=await t.popErrorScope();if(J||X){for(let s of U)s.stage.destroy?.();throw new Error(`GPU error: ${(J??X).message}`)}let j=null,T=null,Y=null;for(let s of U){await s.stage.mapAsync(k1);let c=s.stage.getMappedRange().slice(0);s.stage.unmap(),s.stage.destroy?.(),s.name==="out_log16"?j=new Uint16Array(c):s.name==="out_rgba"?T=new Uint8Array(c):s.name==="planes"?(Y=new Int32Array(c),L.planes=c):L[s.name]=c}let Q=s=>{if(!s)return!1;let c=new Uint32Array(s),l=Math.max(1,Math.floor(c.length/4096));for(let d=0;d<c.length;d+=l)if(c[d]!==0)return!1;return!0};if(Q(j?.buffer??null)||Q(T?.buffer??null))throw new Error("GPU output came back unwritten (dispatch killed?)");return{width:a.canvasW,height:a.canvasH,log16:j,rgba:T,stages:L,planes:Y,wallMs:performance.now()-i}}},W=null;function D(){return W||(W=(async()=>{try{let n=await e1();return n?await $.create(n):null}catch(n){return O("engine init",n),null}})()),W}async function M1(){return await D()!==null}function H(n){return M(n)}async function N1(n,r){let e=await D();if(!e)return null;let i=await H(r);if(!i)return null;try{let t=await e.run(n,{paramsBits:i,wantLog16:!1,wantRgba:!0});return t?.rgba?{width:t.width,height:t.height,rgba:t.rgba}:null}catch(t){return O("rgba decode",t)}}async function W1(n,r){let e=await D();if(!e)return null;let i=await H(r);if(!i)return null;try{let t=await e.run(n,{paramsBits:i,wantLog16:!0,wantRgba:!1});return t?.log16?{width:t.width,height:t.height,rgb16:t.log16.subarray(0,t.width*t.height*3)}:null}catch(t){return O("rgb16 decode",t)}}async function $1(n,r){let e=await D();if(!e)return null;let i=r?.captureOnly,t=r?.paramsBits??await H(void 0);if(!t)return null;try{return await e.run(n,{paramsBits:t,wantLog16:!i||i.includes("out_log16"),wantRgba:!i||i.includes("out_rgba"),captureStages:r?.captureStages??!1,captureOnly:i})}catch(a){return O("debug decode",a)}}export{$1 as decodeR3dGpuDebug,W1 as decodeR3dRgb16Gpu,N1 as decodeR3dRgbaGpu,M as developParamsBits,q as parseR3dFrame,M1 as r3dGpuAvailable};
1025
+ `,l1.replace("//__CONSTS__",r)}var F=[{entry:"_d0",binds:{1:"PL",4:"B0"},checkpoint:null},{entry:"_d1",binds:{1:"B0",4:"B1"},checkpoint:{name:"s0",buf:"B1",words:n=>4*n}},{entry:"_d2",binds:{1:"B1",4:"B0"},checkpoint:{name:"s1",buf:"B0",words:n=>4*n}},{entry:"_d3",binds:{1:"B0",4:"SOB"},checkpoint:{name:"s2",buf:"SOB",words:n=>2*n}},{entry:"_d4",binds:{1:"B0",2:"SOB",4:"B1"},checkpoint:{name:"s3",buf:"B1",words:n=>4*n}},{entry:"_d5",binds:{1:"B1",4:"B2"},checkpoint:{name:"s4",buf:"B2",words:n=>4*n}},{entry:"_d6",binds:{1:"B2",4:"B0"},checkpoint:{name:"s5",buf:"B0",words:n=>4*n}},{entry:"_d7",binds:{1:"B0",5:"B2"},checkpoint:{name:"s6",buf:"B2",words:n=>2*n}},{entry:"_d8",binds:{1:"B1",2:"SOB",3:"B2",4:"B0"},checkpoint:{name:"s7",buf:"B0",words:n=>4*n}},{entry:"_d9",binds:{1:"B0",4:"B1"},checkpoint:{name:"s8",buf:"B1",words:n=>4*n}},{entry:"_d10",binds:{1:"B1",4:"B0"},checkpoint:{name:"s9",buf:"B0",words:n=>3*n}},{entry:"_d11",binds:{1:"B0",5:"B2"},checkpoint:null},{entry:"_d12",binds:{3:"B2",5:"SOB"},checkpoint:{name:"s10",buf:"SOB",words:n=>n}},{entry:"_d13",binds:{1:"B0",3:"SOB",4:"B1"},checkpoint:null},{entry:"_d14",binds:{1:"B1",4:"B0"},checkpoint:null},{entry:"_d15",binds:{1:"B0",7:"OUT"},checkpoint:{name:"s11",buf:"OUT",words:n=>3*n>>1},halfW:!0},{entry:"_d16",binds:{7:"OUT",8:"RGBA"},checkpoint:{name:"s12",buf:"RGBA",words:n=>n}}],N=class n{constructor(r,e,i,t,a){this.essenceBuf=null;this.essenceCap=0;this.jobsBuf=null;this.jobsCap=0;this.coeffBuf=null;this.coeffCap=0;this.frames=new Map;this.queueTail=Promise.resolve();this.device=r,this.vldPipe=e,this.xfPipe=i,this.developPipes=t,this.tabBuf=a}static async create(r){let e=async(g,p)=>{let y=r.createShaderModule({code:g}),h=(await y.getCompilationInfo()).messages.filter(x=>x.type==="error");if(h.length)throw new Error(`${p}: ${h.map(x=>`${x.lineNum}:${x.linePos} ${x.message}`).join(" | ")}`);return y},i=await e(o1,"r3d-vld"),t=await e(c1,"r3d-xform"),a=await e(V1(),"r3d-develop"),o=(g,p)=>r.createComputePipelineAsync({layout:"auto",compute:{module:g,entryPoint:p}}),[b,m,...f]=await Promise.all([o(i,"main"),o(t,"main"),...F.map(g=>o(a,g.entry))]),v=r.createBuffer({size:1920*4,usage:S|B}),u=new Uint32Array(1920);return u.set(r1,0),u.set(e1,1024),u.set(t1,1088),u.set(a1,1152),u.set(new Uint32Array(j.buffer,j.byteOffset,256),1408),r.queue.writeBuffer(v,0,u),new n(r,b,m,f,v)}run(r,e){let i=this.queueTail.then(()=>this.decodeInner(r,e),()=>this.decodeInner(r,e));return this.queueTail=i.catch(()=>{}),i}frameBuffers(r){let e=`${r.canvasW}x${r.canvasH}`,i=this.frames.get(e);if(i)return i;let t=this.device,a=r.canvasW*r.canvasH,o=(m,f=0)=>t.createBuffer({size:m,usage:S|P1|B|f}),b={w:r.canvasW,h:r.canvasH,n:a,PL:o(4*a*4),B0:o(4*a*4),B1:o(4*a*4),B2:o(4*a*4),SOB:o(2*a*4),OUT:o(3*a*2),RGBA:o(a*4),uni:t.createBuffer({size:112,usage:q|B}),params1:t.createBuffer({size:16,usage:q|B}),params2:t.createBuffer({size:16,usage:q|B}),developBinds:[],flashCopy:{src:null,dst:null,bytes:4*a*4}};return b.flashCopy.src=b.B1,b.flashCopy.dst=b.B0,b.developBinds=F.map((m,f)=>{let v=[{binding:0,resource:{buffer:b.uni}}];for(let[u,g]of Object.entries(m.binds))v.push({binding:Number(u),resource:{buffer:b[g]}});return t.createBindGroup({layout:this.developPipes[f].getBindGroupLayout(0),entries:v})}),this.frames.set(e,b),b}growEssence(r){return(!this.essenceBuf||this.essenceCap<r)&&(this.essenceBuf?.destroy?.(),this.essenceCap=Math.max(r,this.essenceCap*2),this.essenceBuf=this.device.createBuffer({size:this.essenceCap,usage:S|B})),this.essenceBuf}growJobs(r){return(!this.jobsBuf||this.jobsCap<r)&&(this.jobsBuf?.destroy?.(),this.jobsCap=Math.max(r,this.jobsCap*2),this.jobsBuf=this.device.createBuffer({size:this.jobsCap,usage:S|B})),this.jobsBuf}growCoeff(r){return(!this.coeffBuf||this.coeffCap<r)&&(this.coeffBuf?.destroy?.(),this.coeffCap=Math.max(r,this.coeffCap*2),this.coeffBuf=this.device.createBuffer({size:this.coeffCap,usage:S|B})),this.coeffBuf}async decodeInner(r,e){let i=performance.now(),t=this.device,a=z(r),o=a.canvasW*a.canvasH,m=(t.limits??{}).maxStorageBufferBindingSize??128*1024*1024,f=a.segments.length*4,v=f*2048*4;if(4*o*4>m||v>m||r.length+16>m)throw new Error(`frame exceeds storage binding limit (${a.canvasW}x${a.canvasH}, ${f} jobs)`);let u=this.frameBuffers(a),g=new Uint32Array(256);for(let s=0;s<256;s++)g[s]=a.table512[s];t.queue.writeBuffer(this.tabBuf,1664*4,g);let p=new Uint8Array(r.length+8+3&-4);p.set(r);let y=this.growEssence(p.length);t.queue.writeBuffer(y,0,p.buffer,0,p.length),p.length<this.essenceCap&&t.queue.writeBuffer(y,p.length,new Uint8Array(Math.min(this.essenceCap-p.length,16)));let P=u1(a),h=this.growJobs(P.byteLength);t.queue.writeBuffer(h,0,P);let x=this.growCoeff(v),C=f*8;t.queue.writeBuffer(u.params1,0,new Uint32Array([f,a.canvasW,a.canvasH,o])),t.queue.writeBuffer(u.params2,0,new Uint32Array([C,a.canvasW,a.canvasH,o]));let R=e.paramsBits;{let s=new ArrayBuffer(112),c=new Uint32Array(s),l=new Float32Array(s);c[0]=a.canvasW,c[1]=a.canvasH,c[2]=o,c[3]=0,l[4]=0,l[5]=1,l[6]=k(R.exposureBits),l[7]=0;for(let d=0;d<4;d++)l[8+d]=k(R.wbBits[d]);for(let d=0;d<3;d++)l[12+d]=k(R.smatrixBits[12+d]);l[15]=0;for(let d=0;d<12;d++)l[16+d]=k(R.smatrixBits[d]);t.queue.writeBuffer(u.uni,0,s)}let g1=t.createBindGroup({layout:this.vldPipe.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:u.params1}},{binding:1,resource:{buffer:y}},{binding:2,resource:{buffer:h}},{binding:3,resource:{buffer:this.tabBuf}},{binding:4,resource:{buffer:x}}]}),p1=t.createBindGroup({layout:this.xfPipe.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:u.params2}},{binding:1,resource:{buffer:h}},{binding:2,resource:{buffer:this.tabBuf}},{binding:3,resource:{buffer:x}},{binding:4,resource:{buffer:u.PL}}]});t.pushErrorScope("out-of-memory"),t.pushErrorScope("validation");{let s=t.createCommandEncoder();s.clearBuffer(x,0,v);let c=s.beginComputePass();c.setPipeline(this.vldPipe),c.setBindGroup(0,g1),c.dispatchWorkgroups(Math.ceil(f/64)),c.end();let l=s.beginComputePass();l.setPipeline(this.xfPipe),l.setBindGroup(0,p1),l.dispatchWorkgroups(Math.ceil(C/16),16),l.end(),t.queue.submit([s.finish()])}let m1=Math.ceil(a.canvasW/16),_1=Math.ceil(a.canvasH/16),y1=Math.ceil(a.canvasW/2/16),O={},D=[],G=(s,c,l,d)=>{let Y=t.createBuffer({size:l,usage:B|A1});d.copyBufferToBuffer(c,0,Y,0,l),D.push({name:s,buf:c,bytes:l,stage:Y})},$=e.captureOnly?new Set(e.captureOnly):null,L=s=>e.captureStages===!0&&($===null||$.has(s));{let s=t.createCommandEncoder();L("planes")&&G("planes",u.PL,4*o*4,s);for(let c=0;c<F.length;c++){let l=F[c];if(!(l.entry==="_d16"&&!e.wantRgba&&!L("s12"))){if(l.entry==="_d2"&&!R.fixFlashers)s.copyBufferToBuffer(u.flashCopy.src,0,u.flashCopy.dst,0,u.flashCopy.bytes);else{let d=s.beginComputePass();d.setPipeline(this.developPipes[c]),d.setBindGroup(0,u.developBinds[c]),d.dispatchWorkgroups(l.halfW?y1:m1,_1),d.end()}l.checkpoint&&L(l.checkpoint.name)&&G(l.checkpoint.name,u[l.checkpoint.buf],l.checkpoint.words(o)*4,s)}}e.wantLog16&&G("out_log16",u.OUT,3*o*2,s),e.wantRgba&&G("out_rgba",u.RGBA,o*4,s),t.queue.submit([s.finish()])}let H=await t.popErrorScope(),K=await t.popErrorScope();if(H||K){for(let s of D)s.stage.destroy?.();throw new Error(`GPU error: ${(H??K).message}`)}let U=null,I=null,J=null;for(let s of D){await s.stage.mapAsync(k1);let c=s.stage.getMappedRange().slice(0);s.stage.unmap(),s.stage.destroy?.(),s.name==="out_log16"?U=new Uint16Array(c):s.name==="out_rgba"?I=new Uint8Array(c):s.name==="planes"?(J=new Int32Array(c),O.planes=c):O[s.name]=c}let X=s=>{if(!s)return!1;let c=new Uint32Array(s),l=Math.max(1,Math.floor(c.length/4096));for(let d=0;d<c.length;d+=l)if(c[d]!==0)return!1;return!0};if(X(U?.buffer??null)||X(I?.buffer??null))throw new Error("GPU output came back unwritten (dispatch killed?)");return{width:a.canvasW,height:a.canvasH,log16:U,rgba:I,stages:O,planes:J,wallMs:performance.now()-i}}},M=null;function d1(){return M||(M=(async()=>{try{let n=await n1();return n?await N.create(n):null}catch(n){return W("engine init",n),null}})()),M}function b1(n){return E(n)}async function M1(n,r){let e=await d1();if(!e)return null;let i=await b1(r);if(!i)return null;try{let t=await e.run(n,{paramsBits:i,wantLog16:!1,wantRgba:!0});return t?.rgba?{width:t.width,height:t.height,rgba:t.rgba}:null}catch(t){return W("rgba decode",t)}}async function N1(n,r){let e=await d1();if(!e)return null;let i=await b1(r);if(!i)return null;try{let t=await e.run(n,{paramsBits:i,wantLog16:!0,wantRgba:!1});return t?.log16?{width:t.width,height:t.height,rgb16:t.log16.subarray(0,t.width*t.height*3)}:null}catch(t){return W("rgb16 decode",t)}}export{N1 as decodeR3dRgb16Gpu,M1 as decodeR3dRgbaGpu,E as developParamsBits,z as parseR3dFrame};
@@ -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{c as l}from"./chunk-IG2X534U.js";import{Aa as v,Ba as F,H as _,Ha as f,I as S,J as P,ja as b,ka as R,xa as w}from"./chunk-QNF4NMIW.js";import"./chunk-PSANHDZM.js";var g=class{constructor(e=[]){this.ranges=[];for(let[r,n]of e)this.add(r,n)}add(e,r){if(r<=e)return;let n=[],[s,o]=[e,r];for(let[i,a]of this.ranges)a<s||i>o?n.push([i,a]):(s=Math.min(s,i),o=Math.max(o,a));n.push([s,o]),n.sort((i,a)=>i[0]-a[0]),this.ranges=n}has(e,r){return r<=e?!0:this.ranges.some(([n,s])=>n<=e&&s>=r)}missing(e,r){if(r<=e)return[];let n=[],s=e;for(let[o,i]of this.ranges)if(!(i<=s)&&(o>=r||(o>s&&n.push([s,Math.min(o,r)]),s=Math.max(s,i),s>=r)))break;return s<r&&n.push([s,r]),n}count(){return this.ranges.reduce((e,[r,n])=>e+(n-r),0)}toJSON(){return this.ranges.map(([e,r])=>[e,r])}};function N(t,e){let r=new g;for(let n of t){if(n.kind!=="clip"||!n.source_range)continue;let s=n.source_range.start.value,o=n.source_range.duration.value,i=Math.max(0,Math.max(0,Math.floor(s))-e),a=Math.floor(s+o)+e;a>i&&r.add(i,a)}return r.toJSON()}function O(t,e,r){let n=N(e,r),s=a=>n.some(([c,u])=>a>=c&&a<u),o=new Map,i=a=>{let c=o.get(a);return c||(c={part:a,structuralRanges:[],essenceRanges:[]},o.set(a,c)),c};for(let a of t.segments){let c=a.part??0;a.kind==="structural"?i(c).structuralRanges.push({offset:a.offset,length:a.length}):(a.kind==="frame"||a.kind==="gop")&&a.frame_in!=null&&s(a.frame_in)&&i(c).essenceRanges.push({offset:a.offset,length:a.length})}return[...o.values()].sort((a,c)=>a.part-c.part)}async function A(t,e){if(!!0)return null;try{let n=await(await import("./r3d-DDOTSYZH.js")).decodeR3dRgbaGpu(t,e);return n?{width:n.width,height:n.height,rgba:n.rgba}:null}catch{return null}}function p(t){return(e,r,n)=>t.parts[e].read(r,n)}function d(t){return JSON.stringify(t.parts.map(e=>({name:e.filename,size:e.fileSize})))}function L(t,e){let r=[];for(let n of t){if(n.kind!=="clip"||!n.source_range)continue;let s=n.source_range.start.value,o=n.source_range.duration.value;r.push({frame_in:Math.max(0,Math.floor(s)),frame_out:Math.floor(s+o),handles:e})}return JSON.stringify(r)}var k=16,h=new WeakMap,J=new WeakMap;function x(t){let e=J.get(t);return e||(e=t.parts[0].read(0,Math.min(16*1024,t.parts[0].fileSize)),J.set(t,e)),e}async function D(t){let e=h.get(t);return e||(await f(),e=JSON.parse(await b(p(t),d(t))),h.set(t,e)),e}async function G(t){await f();let e=await b(p(t),d(t));return h.set(t,JSON.parse(e)),e}function B(t,e){h.set(t,JSON.parse(e))}async function C(t,e){let r=JSON.parse(await R(p(t),d(t)));return{v:1,container:"r3d",codec:"redcode",frame_count:e.frame_count,granularity:"frame",...t.parts.length>1?{part_names:t.parts.map(n=>n.filename.split(/[/\\]/).pop()??n.filename)}:{},segments:r}}var V={async inspect(t){await f();let e=await w(p(t),d(t)),r=JSON.parse(e);if(!r||r.frame_count===0)return null;let n=t.parts[0],s=r.timecode??null,o=s&&s.fps_denominator>0?s.fps_numerator/s.fps_denominator:null,i=r.width??null,a=r.height??null;return{id:n.filename,kind:"external",target_url:n.filename,available_range:o&&r.frame_count?{start:{value:0,rate:o},duration:{value:r.frame_count,rate:o}}:null,reel_name:r.reel??null,source_timecode:s?.display??null,source_fps:o,source_resolution_w:i,source_resolution_h:a,container:"r3d",codec:"redcode",size_bytes:r.file_size,streams:[{kind:"video",codec:"redcode",width:i??void 0,height:a??void 0,rate:o??void 0,bit_depth:k,codec_specific:{fourcc:r.codec_fourcc??"REDCODE"}}],decode_provenance:r.decode_provenance??null,vendor_metadata:{frame_count:r.frame_count,...s?{drop_frame:s.drop_frame}:{}},binding_state:"unbound",raw_extraction:{r3d_probe:r},metadata:{}}},async extract(t){await f();let e=JSON.parse(await w(p(t),d(t)));return!e||e.frame_count===0?null:C(t,e)},async sparsify(t,e){await f();let r=JSON.parse(await R(p(t),d(t))),n={v:1,container:"r3d",codec:"redcode",frame_count:r.filter(o=>o.kind==="frame").length,granularity:"frame",segments:r},s=new Map;for(let o of r)o.kind==="frame"&&s.set(o.part??0,(s.get(o.part??0)??0)+1);return O(n,e.items,e.handles).map(o=>({filename:t.parts[o.part].filename,fileSize:t.parts[o.part].fileSize,structuralRanges:o.structuralRanges,essenceRanges:o.essenceRanges,frameCount:s.get(o.part)??0,keptFrames:o.essenceRanges.length}))},async trim(t,e){await f();let r=t.parts.some(a=>a.dataRanges!==void 0),n=r?JSON.stringify(t.parts.map(a=>a.dataRanges??[])):"[]",s=r?"[]":L(e.items,e.handles),o=await F(p(t),d(t),s,n);return JSON.parse(o).parts.map(a=>a.trim_plan)},async decode(t,e,r){await f();let n=await D(t);if(e<0||e>=n.length)throw new l(e,n.length);let s=n[e],o=s.part??0,i=t.parts[o];if(!i)throw new l(e,n.length);let a=await i.read(s.essenceOffset,s.essenceLength),c=2,u=await x(t),m;if(r.detail==="coarse")m=_(a,u,0);else if(v(a))m=_(a,u,c);else{let y=await A(a,u);if(y)return y;m=P(a,u)}let M=new DataView(m.buffer,m.byteOffset,8);return{width:M.getUint32(0,!0),height:M.getUint32(4,!0),rgba:m.slice(8)}},async decode16(t,e){await f();let r=await D(t);if(e<0||e>=r.length)throw new l(e,r.length);let n=r[e],s=t.parts[n.part??0];if(!s)throw new l(e,r.length);let o=await s.read(n.essenceOffset,n.essenceLength),i=S(o),a=new DataView(i.buffer,i.byteOffset,8),c=a.getUint32(0,!0),u=a.getUint32(4,!0),m=i.slice(8);return{width:c,height:u,rgb16:new Uint16Array(m.buffer,m.byteOffset,c*u*3)}}};export{G as listR3dFramesJson,V as r3dFormat,B as seedR3dFramesJson};
@@ -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,b,c,d,e,f}from"./chunk-S5AOIOTT.js";import"./chunk-ROGMKTND.js";import"./chunk-GTPTZRO6.js";import"./chunk-PSANHDZM.js";export{b as APPLIED,a as BACKUP_SUFFIX,e as applyPatch,c as patchFolders,d as planPatch,f as undoPatch};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a,b,c,d,e,f}from"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-PSANHDZM.js";export{c as formatForFile,b as partFromByteSource,a as partFromFile,d as sourceFromFile,e as sourceFromFiles,f as sourceFromParts};
3
+ import{a,b,c,d,e,f}from"./chunk-VFXMP7IF.js";import"./chunk-BBCQMZQN.js";import"./chunk-PSANHDZM.js";export{c as formatForFile,b as partFromByteSource,a as partFromFile,d as sourceFromFile,e as sourceFromFiles,f as sourceFromParts};
@@ -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 l,f as o,g as m}from"./chunk-JV7TZDKJ.js";import{a as s}from"./chunk-RGMTLNMF.js";import"./chunk-PSANHDZM.js";var h=e=>{let t=e.split(/[/\\]/).pop()??"",i=t.lastIndexOf(".");return i>0?t.slice(i+1).toLowerCase():""};async function f(e,t){try{if(e==="dpx"){let r=await(await import("./dpx-wasm-XACWNFPB.js")).inspectDpxWasm(t);return r?{width:r.width,height:r.height}:null}if(e==="exr"){let r=await(await import("./exr-wasm-FQBUR6QT.js")).inspectExrWasm(t);return r?{width:r.width,height:r.height}:null}if(e==="dng"){let r=await(await import("./dng-wasm-XCPPBXPZ.js")).inspectDngWasm(t);return r?{width:r.width,height:r.height}:null}if(e==="cr3"){let r=await(await import("./cr3-wasm-NYCB34ND.js")).inspectCr3Wasm(t);return r?{width:r.width,height:r.height}:null}if(e==="tif"||e==="tiff"){let r=await(await import("./tiff-wasm-N2S267IA.js")).inspectTiffWasm(t);return r?{width:r.width,height:r.height}:null}let i=await import("./still-wasm-RTPOMH7S.js"),n=await i.inspectPhotoRawWasm(e,t);if(n)return{width:n.width,height:n.height};let a=await i.decodeStillWasm(e,t);return a?{width:a.width,height:a.height}:null}catch{}return null}async function p(e){if(typeof createImageBitmap!="function"||typeof Blob>"u")return null;try{let t=await createImageBitmap(new Blob([e])),i={width:t.width,height:t.height};return t.close?.(),i.width>0&&i.height>0?i:null}catch{return null}}async function c(e){let t=h(e.filename),i=await m(t,o(e));if(i)return i;let n=s(t);if(n===null||n==="none")return null;let a;try{a=await e.read(0,e.fileSize)}catch{return null}return n==="wasm-decoder"?await f(t,a):await p(a)}function u(e){let t=l(e);return t==="jpg"?"jpeg":t==="tif"?"tiff":t||"still"}var R={async inspect(e){let t=e.parts[0],i=await c(t);return{id:t.filename,kind:"external",content_kind:"still",target_url:t.filename,available_range:null,reel_name:null,source_timecode:null,container:l(t.filename)||"still",codec:u(t.filename),size_bytes:t.fileSize,bitrate_bps:null,source_resolution_w:i?.width??null,source_resolution_h:i?.height??null,source_pixel_aspect:i?1:null,streams:[],vendor_metadata:{},binding_state:"unbound",raw_extraction:{},metadata:{}}},async extract(e){let t=e.parts.map((i,n)=>({kind:"frame",part:n,offset:0,length:i.fileSize,frame_in:n,frame_out:n}));return t.length===0?null:{v:1,container:l(e.parts[0].filename)||"still",codec:u(e.parts[0].filename),frame_count:t.length,granularity:"frame",segments:t,...e.parts.length>1?{part_names:e.parts.map(i=>i.filename)}:{}}},async sparsify(){throw new Error("stillFormat.sparsify: stills ship whole \u2014 no sparse plan exists")},async trim(){throw new Error("stillFormat.trim: stills ship whole \u2014 no trim plan exists")}};export{R as stillFormat};
3
+ import{a as l,f as o,g as m}from"./chunk-JV7TZDKJ.js";import{a as s}from"./chunk-BBCQMZQN.js";import"./chunk-PSANHDZM.js";var h=e=>{let t=e.split(/[/\\]/).pop()??"",i=t.lastIndexOf(".");return i>0?t.slice(i+1).toLowerCase():""};async function f(e,t){try{if(e==="dpx"){let r=await(await import("./dpx-wasm-OQVTNGOB.js")).inspectDpxWasm(t);return r?{width:r.width,height:r.height}:null}if(e==="exr"){let r=await(await import("./exr-wasm-72YZFOME.js")).inspectExrWasm(t);return r?{width:r.width,height:r.height}:null}if(e==="dng"){let r=await(await import("./dng-wasm-5RQBGYAK.js")).inspectDngWasm(t);return r?{width:r.width,height:r.height}:null}if(e==="cr3"){let r=await(await import("./cr3-wasm-VUEEZYKQ.js")).inspectCr3Wasm(t);return r?{width:r.width,height:r.height}:null}if(e==="tif"||e==="tiff"){let r=await(await import("./tiff-wasm-6APT7FYP.js")).inspectTiffWasm(t);return r?{width:r.width,height:r.height}:null}let i=await import("./still-wasm-6YLI6NQQ.js"),n=await i.inspectPhotoRawWasm(e,t);if(n)return{width:n.width,height:n.height};let a=await i.decodeStillWasm(e,t);return a?{width:a.width,height:a.height}:null}catch{}return null}async function p(e){if(typeof createImageBitmap!="function"||typeof Blob>"u")return null;try{let t=await createImageBitmap(new Blob([e])),i={width:t.width,height:t.height};return t.close?.(),i.width>0&&i.height>0?i:null}catch{return null}}async function c(e){let t=h(e.filename),i=await m(t,o(e));if(i)return i;let n=s(t);if(n===null||n==="none")return null;let a;try{a=await e.read(0,e.fileSize)}catch{return null}return n==="wasm-decoder"?await f(t,a):await p(a)}function u(e){let t=l(e);return t==="jpg"?"jpeg":t==="tif"?"tiff":t||"still"}var R={async inspect(e){let t=e.parts[0],i=await c(t);return{id:t.filename,kind:"external",content_kind:"still",target_url:t.filename,available_range:null,reel_name:null,source_timecode:null,container:l(t.filename)||"still",codec:u(t.filename),size_bytes:t.fileSize,bitrate_bps:null,source_resolution_w:i?.width??null,source_resolution_h:i?.height??null,source_pixel_aspect:i?1:null,streams:[],vendor_metadata:{},binding_state:"unbound",raw_extraction:{},metadata:{}}},async extract(e){let t=e.parts.map((i,n)=>({kind:"frame",part:n,offset:0,length:i.fileSize,frame_in:n,frame_out:n}));return t.length===0?null:{v:1,container:l(e.parts[0].filename)||"still",codec:u(e.parts[0].filename),frame_count:t.length,granularity:"frame",segments:t,...e.parts.length>1?{part_names:e.parts.map(i=>i.filename)}:{}}},async sparsify(){throw new Error("stillFormat.sparsify: stills ship whole \u2014 no sparse plan exists")},async trim(){throw new Error("stillFormat.trim: stills ship whole \u2014 no trim plan exists")}};export{R as stillFormat};
@@ -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 s}from"./chunk-DKGGJM6Z.js";import{Ga as i,Ia as a}from"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";var u={dpx:"dpx",tif:"tiff",tiff:"tiff",exr:"exr",j2c:"j2k",j2k:"j2k",jp2:"j2k",jph:"j2k",dng:"dng",cr3:"cr3",cr2:"cr2",arw:"arw",psd:"psd",tga:"tga",heic:"heic",heif:"heic",png:"png",jpg:"jpeg",jpeg:"jpeg",gif:"gif",bmp:"bmp",webp:"webp"};function l(e){return Object.prototype.hasOwnProperty.call(u,(e??"").toLowerCase())}var d=e=>{let n=i[e];return typeof n=="function"?n:void 0};async function g(e,n){let r=e.toLowerCase();if(r!=="arw"&&r!=="cr2")return null;await a();let t=i[`inspect_${r}`];if(typeof t!="function")return null;let o=t(n);return o==="null"?null:JSON.parse(o)}async function m(e,n,r=1){let t=u[e.toLowerCase()];if(!t)return null;await a();try{let o=r>1?d(`decode_${t}_preview`):void 0;if(o)return s(o(n,r));let c=d(`decode_${t}_rgba`);return c?s(c(n)):null}catch{return null}}export{u as STILL_WASM_BASE,m as decodeStillWasm,l as hasStillWasm,g as inspectPhotoRawWasm};
3
+ import{a as s}from"./chunk-OSUIS4JU.js";import{Ga as i,Ha as a}from"./chunk-QNF4NMIW.js";import"./chunk-PSANHDZM.js";var u={dpx:"dpx",tif:"tiff",tiff:"tiff",exr:"exr",j2c:"j2k",j2k:"j2k",jp2:"j2k",jph:"j2k",dng:"dng",cr3:"cr3",cr2:"cr2",arw:"arw",psd:"psd",tga:"tga",heic:"heic",heif:"heic",png:"png",jpg:"jpeg",jpeg:"jpeg",gif:"gif",bmp:"bmp",webp:"webp"};function l(e){return Object.prototype.hasOwnProperty.call(u,(e??"").toLowerCase())}var d=e=>{let n=i[e];return typeof n=="function"?n:void 0};async function g(e,n){let r=e.toLowerCase();if(r!=="arw"&&r!=="cr2")return null;await a();let t=i[`inspect_${r}`];if(typeof t!="function")return null;let o=t(n);return o==="null"?null:JSON.parse(o)}async function m(e,n,r=1){let t=u[e.toLowerCase()];if(!t)return null;await a();try{let o=r>1?d(`decode_${t}_preview`):void 0;if(o)return s(o(n,r));let c=d(`decode_${t}_rgba`);return c?s(c(n)):null}catch{return null}}export{u as STILL_WASM_BASE,m as decodeStillWasm,l as hasStillWasm,g as inspectPhotoRawWasm};
@@ -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 a,B as b,C as c,D as d,E as e,F as f,G as g}from"./chunk-VERTA23P.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import"./chunk-ROGMKTND.js";import"./chunk-X527E5VI.js";import"./chunk-PSANHDZM.js";export{a as createSession,g as getExtra,c as getSession,b as lastSessionId,e as listSessions,f as saveExtra,d as updateSession};
3
+ import{A as a,B as b,C as c,D as d,E as e,F as f,G as g}from"./chunk-CRMGV32N.js";import"./chunk-JTRM2JCE.js";import"./chunk-NN444GPH.js";import"./chunk-ROGMKTND.js";import"./chunk-GTPTZRO6.js";import"./chunk-PSANHDZM.js";export{a as createSession,g as getExtra,c as getSession,b as lastSessionId,e as listSessions,f as saveExtra,d as updateSession};
@@ -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,b}from"./chunk-RITYQNOO.js";import"./chunk-QNF4NMIW.js";import"./chunk-PSANHDZM.js";export{b as decodeTiffWasm,a as inspectTiffWasm};
@@ -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{$b as l,Qb as a,Rb as b,Sb as c,Tb as d,Ub as e,Vb as f,Wb as g,Xb as h,Yb as i,Zb as j,_b as k,ac as m,bc as n,cc as o,dc as p,ec as q,fc as r,gc as s,hc as t}from"./chunk-VCBLWNQR.js";import"./chunk-IN6XVTUS.js";import"./chunk-P4PCSGEH.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-TWHNQFKI.js";import"./chunk-UBWUED67.js";import"./chunk-73RFYAVG.js";import"./chunk-STGGRRYM.js";import"./chunk-MVQ5RGZB.js";import"./chunk-RITYQNOO.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-MTAXVOHK.js";import"./chunk-YGAAGTLE.js";import"./chunk-IG2X534U.js";import"./chunk-T7S2UBNN.js";import"./chunk-M5CEBOLK.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-QNF4NMIW.js";import"./chunk-CRMGV32N.js";import"./chunk-JTRM2JCE.js";import"./chunk-NN444GPH.js";import"./chunk-ROGMKTND.js";import"./chunk-GTPTZRO6.js";import"./chunk-PSANHDZM.js";export{j as OPERATION_KINDS,a as READ_FORMATS,k as applyOperation,m as applyOperationWithSources,s as consolidate,b as detectFormat,d as detectTimelineFormat,t as judge,r as linkText,g as listClips,i as listFlags,h as listMedia,e as readTimeline,n as resolveTarget,q as routesText,c as sniffFormat,f as summarize,l as trackIndex,p as writeDestination,o as writeTimeline};
Binary file
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as b}from"./chunk-AACY2V3L.js";import{Ia as u,ba as _,la as f,sa as d,va as g}from"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";function p(s){return(r,t)=>s.read(r,t)}function S(s){let r=[];for(let t of s)t.kind!=="clip"||!t.source_range||r.push({start_frame:t.source_range.start.value,dur_frames:t.source_range.duration.value,fps:t.source_range.start.rate??1});return r}var w={async inspect(s){await u();let r=s.parts[0],t=await _(p(r),r.fileSize),e=JSON.parse(t);if(!e||!e.sample_rate)return null;let a=e.byte_rate>0?e.data_length/e.byte_rate:null,m=a?Math.round(a*e.sample_rate):0,n=[{kind:"audio",codec:"pcm",rate:e.sample_rate,channels:e.channels,bit_depth:e.bits_per_sample,codec_specific:{bits_per_sample:e.bits_per_sample}}];return{id:r.filename,kind:"external",content_kind:"audio",target_url:r.filename,available_range:a?{start:{value:0,rate:e.sample_rate},duration:{value:m,rate:e.sample_rate}}:null,reel_name:null,source_timecode:e.source_timecode??null,container:"wav",codec:"pcm",size_bytes:r.fileSize,bitrate_bps:e.byte_rate*8,streams:n,vendor_metadata:e.bext?{bext:e.bext}:{},binding_state:"unbound",raw_extraction:{wav_meta:e},metadata:{}}},async extract(s){await u();let r=s.parts[0],t=JSON.parse(await f(p(r),r.fileSize));return t.length===0?null:{v:1,container:"wav",codec:"pcm",frame_count:b(t),granularity:"second",segments:t}},async sparsify(s,r){await u();let t=s.parts[0],e=await g(p(t),t.fileSize,JSON.stringify(S(r.items)),r.handles),a=JSON.parse(e);return[{filename:t.filename,fileSize:a.fileSize,structuralRanges:a.structuralRanges,essenceRanges:a.essenceRanges,trimInputs:a.trimInputs}]},async trim(s,r){await u();let t=s.parts[0],e=[];for(let n of r.items){if(n.kind!=="clip"||!n.source_range)continue;let i=n.source_range.start.rate??1,o=Math.max(0,(n.source_range.start.value-r.handles)/i),c=(n.source_range.start.value+n.source_range.duration.value+r.handles)/i;c>o&&e.push([o,c])}if(e.length===0)throw new Error("wav trim: no usable trim ranges in items");e.sort((n,i)=>n[0]-i[0]);let a=[];for(let[n,i]of e){let o=a[a.length-1];o&&n<=o[1]?o[1]=Math.max(o[1],i):a.push([n,i])}let m=[];for(let[n,[i,o]]of a.entries()){let c=await d(p(t),t.fileSize,i,o,1),l=JSON.parse(c);a.length>1&&(l.output_clip_number=n+1,l.output_clip_count=a.length,l.output_part_number=1),m.push(l)}return m}};export{w as wavFormat};
3
+ import{a as b}from"./chunk-AACY2V3L.js";import{Ha as u,ba as _,la as f,sa as d,va as g}from"./chunk-QNF4NMIW.js";import"./chunk-PSANHDZM.js";function p(s){return(r,t)=>s.read(r,t)}function S(s){let r=[];for(let t of s)t.kind!=="clip"||!t.source_range||r.push({start_frame:t.source_range.start.value,dur_frames:t.source_range.duration.value,fps:t.source_range.start.rate??1});return r}var w={async inspect(s){await u();let r=s.parts[0],t=await _(p(r),r.fileSize),e=JSON.parse(t);if(!e||!e.sample_rate)return null;let a=e.byte_rate>0?e.data_length/e.byte_rate:null,m=a?Math.round(a*e.sample_rate):0,n=[{kind:"audio",codec:"pcm",rate:e.sample_rate,channels:e.channels,bit_depth:e.bits_per_sample,codec_specific:{bits_per_sample:e.bits_per_sample}}];return{id:r.filename,kind:"external",content_kind:"audio",target_url:r.filename,available_range:a?{start:{value:0,rate:e.sample_rate},duration:{value:m,rate:e.sample_rate}}:null,reel_name:null,source_timecode:e.source_timecode??null,container:"wav",codec:"pcm",size_bytes:r.fileSize,bitrate_bps:e.byte_rate*8,streams:n,vendor_metadata:e.bext?{bext:e.bext}:{},binding_state:"unbound",raw_extraction:{wav_meta:e},metadata:{}}},async extract(s){await u();let r=s.parts[0],t=JSON.parse(await f(p(r),r.fileSize));return t.length===0?null:{v:1,container:"wav",codec:"pcm",frame_count:b(t),granularity:"second",segments:t}},async sparsify(s,r){await u();let t=s.parts[0],e=await g(p(t),t.fileSize,JSON.stringify(S(r.items)),r.handles),a=JSON.parse(e);return[{filename:t.filename,fileSize:a.fileSize,structuralRanges:a.structuralRanges,essenceRanges:a.essenceRanges,trimInputs:a.trimInputs}]},async trim(s,r){await u();let t=s.parts[0],e=[];for(let n of r.items){if(n.kind!=="clip"||!n.source_range)continue;let i=n.source_range.start.rate??1,o=Math.max(0,(n.source_range.start.value-r.handles)/i),c=(n.source_range.start.value+n.source_range.duration.value+r.handles)/i;c>o&&e.push([o,c])}if(e.length===0)throw new Error("wav trim: no usable trim ranges in items");e.sort((n,i)=>n[0]-i[0]);let a=[];for(let[n,i]of e){let o=a[a.length-1];o&&n<=o[1]?o[1]=Math.max(o[1],i):a.push([n,i])}let m=[];for(let[n,[i,o]]of a.entries()){let c=await d(p(t),t.fileSize,i,o,1),l=JSON.parse(c);a.length>1&&(l.output_clip_number=n+1,l.output_clip_count=a.length,l.output_part_number=1),m.push(l)}return m}};export{w as wavFormat};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conformtools",
3
- "version": "0.6.15",
3
+ "version": "0.6.17",
4
4
  "description": "conform.tools on your machine: timeline exchange, relink, media trim, delivery and auto conform, as MCP tools for Claude and other AI apps, a CLI and a local HTTP API",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -44,9 +44,9 @@
44
44
  "access": "public"
45
45
  },
46
46
  "optionalDependencies": {
47
- "conformtools-darwin-arm64": "0.6.15",
48
- "conformtools-darwin-x64": "0.6.15",
49
- "conformtools-linux-x64": "0.6.15",
50
- "conformtools-windows-x64": "0.6.15"
47
+ "conformtools-darwin-arm64": "0.6.17",
48
+ "conformtools-darwin-x64": "0.6.17",
49
+ "conformtools-linux-x64": "0.6.17",
50
+ "conformtools-windows-x64": "0.6.17"
51
51
  }
52
52
  }
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i}from"./chunk-7NGS2BN7.js";import"./chunk-TBU2XWFD.js";import"./chunk-X527E5VI.js";import"./chunk-PSANHDZM.js";export{c as BridgeError,g as HostBridge,e as PANEL_PREFIX,b as PORTS,a as PROTOCOL,h as hostBridge,d as pairingPath,f as panelOrigins,i as resetHostBridge};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- function a(e){if(e.length<8)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint32(0,!0),r=t.getUint32(4,!0),u=n*r*4;return e.length<8+u?null:{width:n,height:r,rgba:new Uint8ClampedArray(e.subarray(8,8+u))}}function i(e,t){let n=e[t];return typeof n=="function"?n:void 0}export{a,i as b};
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as R}from"./chunk-PFZVET7S.js";import{b as he,c as be,f as ge}from"./chunk-6V4OEOOX.js";import{f as K,h as fe}from"./chunk-XDI6CPPV.js";import{a as pe}from"./chunk-UKXSKFL3.js";import{i as D}from"./chunk-4RA57LTJ.js";import{b as M,d as z,f as F}from"./chunk-NU3X7P4N.js";import{Ia as de,ea as se,fa as ae,ja as ce,oa as le,wa as ue,xa as me}from"./chunk-DPA26AOI.js";import{a as ie}from"./chunk-ROGMKTND.js";import{$ as y,B as W,G as L,M as v,N as C,O as ne,R as oe,_ as b,aa as J,b as O,ba as _,c as Z,d as Q,g as q,k as ee,l as re,s as H,t as B,v as te,w as A,z as j}from"./chunk-X527E5VI.js";var V=!1;var P=8,Pe=0,Ee=3,N=2;async function Oe(e){let t=new Uint8Array(await e.slice(0,16).arrayBuffer()),o=s=>String.fromCharCode(t[s],t[s+1],t[s+2],t[s+3]);if(t[0]===6&&t[1]===14&&t[2]===43&&t[3]===52)return"mxf";if(o(4)==="RED1"||o(4)==="RED2")return"r3d";let r=t[0]<<24|t[1]<<16|t[2]<<8|t[3],i=o(4);return/^[A-Za-z0-9 ]{4}$/.test(i)&&(r>=8||r===1)&&r<=e.size?"isobmff":null}function Ae(e){let t=e.toLowerCase();return t.endsWith(".braw")?"braw":t.endsWith(".crm")?"crm":"mov"}function Ce(e){return async(t,o)=>new Uint8Array(await e.slice(t,Math.min(t+o,e.size)).arrayBuffer())}function we(e){let t=e.timecode;return!t||!t.fps_denominator?null:t.fps_numerator/t.fps_denominator}async function ir(e){return await de(),_e?_e.clip(e,V?"rec709":"",()=>ye(e)):ye(e)}var _e=null;async function ye(e){let t=await Oe(e),o=[];if(t==="r3d"){let r=e,i=r.parts&&r.bases?r.parts:[{name:e.name,size:e.size}],n=r.bases??[0],s=async(m,u,d)=>{let f=n[m]+u;return new Uint8Array(await e.slice(f,Math.min(f+d,n[m]+i[m].size)).arrayBuffer())},a=JSON.stringify(i.map(m=>({name:m.name,size:m.size}))),c=JSON.parse(await me(s,a)),l=JSON.parse(await ce(s,a));return i.length===1&&/_\d{3}\.r3d$/i.test(e.name)&&!/_001\.r3d$/i.test(e.name)&&o.push("spanned R3D part \u2014 only this part's frames are indexed"),{frames:l.map(m=>({offset:n[m.part??0]+m.essenceOffset,size:m.essenceLength})),w:c.width??0,h:c.height??0,fps:we(c),startFrame:c.timecode?.start_frame??0,dropFrame:c.timecode?.drop_frame??!1,label:"R3D",spec:{codec:"r3d",subbands:Pe},geometrySpec:{codec:"r3d",subbands:Ee},index:null,warnings:o}}if(t==="mxf"){let r=Ce(e),i=JSON.parse(await ue(r,e.size));if(!i)throw new Error(`${e.name}: MXF index unreadable`);let n=JSON.parse(await le(r,e.size)),s=[];for(let f=0;f<n.frame_count;f++)s.push({offset:n.frames[f*2],size:n.frames[f*2+1]});let a=s.filter(f=>f.size===0).length;a&&o.push(`${a} frame(s) had no locatable picture KLV`);let c=i.width??0,l=i.height??0,m=(i.inner_codec??"").toLowerCase(),u=null,d="MXF";return m==="arriraw"?(u={codec:"arriraw",w:c,h:l,scale:P},d="ARRIRAW"):m==="xocn"?(u={codec:"xocn",scale:P,...V?{display:"rec709"}:{}},d="X-OCN"):await ae(r,e.size)?(u={codec:"vc3",scale:P},d="DNxHR"):await se(r,e.size)?(u={codec:"prores"},d="ProRes"):o.push(`MXF inner codec ${m||"unknown"} not wired to the fingerprint pool`),{frames:u?s:[],w:c,h:l,fps:we(i),startFrame:i.timecode?.start_frame??0,dropFrame:i.timecode?.drop_frame??!1,label:d,spec:u,geometrySpec:u&&u.codec==="arriraw"?{...u,scale:N}:u&&u.codec==="xocn"?{codec:"xocn",scale:N,...V?{display:"rec709"}:{}}:u&&u.codec==="vc3"?{codec:"vc3",scale:N}:null,index:null,warnings:o}}if(t==="isobmff"){let r=await fe(e),i=Ae(e.name);if(r.kind==="prores")return{frames:r.offs,w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:K(r.kind),spec:{codec:"prores"},geometrySpec:null,index:r,warnings:o};if(r.kind==="h264"||r.kind==="hevc")return{frames:r.offs,w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:K(r.kind),spec:null,geometrySpec:null,index:r,warnings:o};let n=i==="braw"?{codec:"braw",scale:P}:r.codec==="aprh"||r.codec==="aprn"?{codec:"proresraw",scale:P}:null;return n||o.push(`codec ${r.codec} not wired to the fingerprint pool`),{frames:n?r.offs:[],w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:n?i==="braw"?"BRAW":"ProRes RAW":`unsupported (${r.codec})`,spec:n,geometrySpec:n?{...n,scale:N}:null,index:r,warnings:o}}throw new Error(`${e.name}: unrecognised container`)}var De=Number(O("CONFORM_DECODERS")??0)||Math.max(2,Math.min(Math.floor(Q()/2),Math.floor(Z()/2**31))),X=0,xe=[],ze=async(...e)=>{X>=De?await new Promise(t=>xe.push(t)):X++;try{return await oe(...e)}finally{let t=xe.shift();t?t():X--}};async function Ne(){let e=q()==="win32"?"conformtools-decode.exe":"conformtools-decode",t=[O("CONFORM_NATIVE_DECODE"),ee(e),H(new URL(`./${e}`,import.meta.url)),H(new URL(`../../rust/target/release/${e}`,import.meta.url))].filter(Boolean);for(let o of t)if(await te(o))return o;return null}var $=class extends Error{constructor(o,r){super(r);this.why=o}};function Pr(e){let t=null;try{t=JSON.parse(e.trim().split(`
4
- `).pop())}catch{}if(t?.why==="not_entitled")throw new ie("not_entitled",t.detail??"this machine is not licensed");return t?.detail??e.trim()}function Te(e,t){try{let o=JSON.parse(e.trim().split(`
5
- `).pop()??"");return new $(o.why,o.detail)}catch{return new $("decoder",`the native decoder exited ${t}: ${e.trim().slice(-300)}`)}}function Ue(e){let t=e.reduce((i,n)=>i+n.length,0),o=new Uint8Array(t),r=0;for(let i of e)o.set(i,r),r+=i.length;return o}async function $e(e,t,o,r,i){let n=await Ne();if(!n)throw new $("missing",re("the native decoder (conformtools-decode)"));let s=null,a=[],c=0,l=d=>{let f=new Uint8Array(d),h=0;for(;h<d;){let p=a[0],g=Math.min(p.length,d-h);f.set(p.subarray(0,g),h),h+=g,g===p.length?a.shift():a[0]=p.subarray(g)}return c-=d,f},m=[e,t,"--width",String(i.width??32768)];i.from!=null&&m.push("--from",String(i.from)),i.count!=null&&m.push("--count",String(i.count)),i.range&&m.push("--range",i.range);let u=await ze(n,m,d=>{if(a.push(d),c+=d.length,!s){let h=Ue(a.splice(0));a.push(h);let p=h.indexOf(10);if(p<0)return;s=JSON.parse(new TextDecoder().decode(h.subarray(0,p))),l(p+1),o(s)}let f=4+s.w*s.h*(s.bpp??(e==="rgb16"?6:4));for(;c>=f;){let h=l(f);r(new DataView(h.buffer).getUint32(0,!0),h.subarray(4))}},{signal:i.signal});if(u.code!==0||!s)throw Te(u.stderr,u.code)}function ve(e,t,o,r={}){return $e("bgra",e,t,o,r)}function Se(e,t,o,r={}){return $e("rgb16",e,t,(i,n)=>o(i,new Uint16Array(n.buffer,n.byteOffset,n.length>>1)),r)}var ke=["none","rle","zips","zip","piz","pxr24","b44","b44a","dwaa","dwab","htj2k"],T=e=>(e>>4)*10+(e&15);function Ie(e){let t=T(e&63),o=T(e>>>8&127),r=T(e>>>16&127),i=T(e>>>24&63),n=s=>String(s).padStart(2,"0");return`${n(i)}:${n(r)}:${n(o)}${e&64?";":":"}${n(t)}`}function He(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.length<8||t.getUint32(0,!0)!==20000630)return null;let o={fps:null,timecode:null,width:0,height:0,display:null,compression:null,attributes:[]},r=8,i=()=>{let s=r;for(;r<e.length&&e[r]!==0;)r++;let a=new TextDecoder().decode(e.subarray(s,r));return r++,a},n=s=>({width:t.getInt32(s+8,!0)-t.getInt32(s,!0)+1,height:t.getInt32(s+12,!0)-t.getInt32(s+4,!0)+1});for(;r<e.length;){let s=i();if(!s)break;let a=i();if(r+4>e.length)return null;let c=t.getInt32(r,!0);if(r+=4,c<0||r+c>e.length)return null;if(o.attributes.push(`${s}:${a}`),s==="framesPerSecond"&&a==="rational"&&c>=8){let l=t.getInt32(r,!0),m=t.getUint32(r+4,!0);o.fps=m?l/m:null}else s==="timeCode"&&a==="timecode"&&c>=8?o.timecode=Ie(t.getUint32(r,!0)):s==="dataWindow"&&a==="box2i"&&c>=16?{width:o.width,height:o.height}=n(r):s==="displayWindow"&&a==="box2i"&&c>=16?o.display=n(r):s==="compression"&&c>=1&&(o.compression=ke[e[r]]??`type ${e[r]}`);r+=c}return o}async function Be(e){let t=e,o=null,r=/^(.*?)\[(\d+)-(\d+)\](.*)$/.exec(b(e));if(await A(e))o=/^(.*?)(\d+)(\.exr)$/i;else{t=y(e);let n=r?[null,r[1],r[2],r[4]]:/^(.*?)(\d+)(\.exr)$/i.exec(b(e));if(!n)return{frames:[e],numbers:[]};let s=a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");o=new RegExp(`^${s(n[1])}(\\d{${n[2].length}})${s(n[3])}$`,"i")}let i=[];for await(let n of v(t)){let s=n.isFile?o.exec(n.name):null;s&&i.push({n:Number(s[s.length===4?2:1]),f:_(t,n.name)})}return i.sort((n,s)=>n.n-s.n),{frames:i.map(n=>n.f),numbers:i.map(n=>n.n)}}async function Re(e){let t=await Be(e),o=t.frames[0];if(!o)throw new Error(`no .exr frames for '${b(e)}'`);let r=await C(o),i;try{i=He(await r.readAt(0,Math.min(r.size,1<<20)))}finally{await r.close()}if(!i)throw new Error(`'${b(o)}' is not an OpenEXR file`);let n=Math.max(1,t.frames.length),s=t.numbers.length>1?t.numbers[t.numbers.length-1]-t.numbers[0]+1-t.numbers.length:0,a=i.fps??0;return{id:b(o),kind:"external",target_url:o,local_path:o,content_kind:n>1?"video":"still",source_fps:i.fps??void 0,source_timecode:i.timecode??void 0,source_resolution_w:i.width,source_resolution_h:i.height,available_range:{start:{value:0,rate:a},duration:{value:n,rate:a}},streams:[{kind:"video",codec:"exr",width:i.width,height:i.height,rate:i.fps??void 0,codec_specific:{compression:i.compression}}],vendor_metadata:{exr:{frames:n,first_frame:t.numbers[0]??null,last_frame:t.numbers[t.numbers.length-1]??null,missing_frames:s,display_window:i.display,attributes:i.attributes,fps_source:i.fps!=null?"header framesPerSecond":"not in the header",timecode_source:i.timecode?"header timeCode (first frame)":"not in the header"}}}}var G=new Set([".mov",".mp4",".m4v",".mxf",".wav",".braw",".crm",".r3d",".aif",".aiff"]);async function je(e){let t=await C(e);return{path:e,file:t,size:t.size}}function We(e){return(t,o)=>e.file.readAt(t,o)}async function Le(e){let t=R(b(e));if(!t)return[e];let o=y(e),r=[];for await(let i of v(o)){if(!i.isFile)continue;let n=R(i.name);n&&n.clipBase===t.clipBase&&r.push({n:n.partNumber,p:_(o,i.name)})}return r.sort((i,n)=>i.n-n.n).map(i=>i.p)}async function Y(e){if(await A(e)){let n=[];for await(let s of v(e))s.isFile&&R(s.name)&&n.push(_(e,s.name));if(!n.length)throw new Error(`'${b(e)}' is a folder with no .R3D parts`);e=n.sort()[0]}let t=be(b(e));if(!t)throw new Error(`unsupported media file '${b(e)}' (supported: ${[...G].join(" ")})`);let o=await Le(e),r=await Promise.all(o.map(je));return{source:ge(t,r.map(n=>he(b(n.path),{fileSize:n.size,read:We(n)}))),parts:r,format:t,anchor:o[0],close:()=>r.forEach(n=>n.file.close())}}async function Je(e,t,o,r){if(!/h264|avc|hevc|h265/.test(o)){let i=null,n=await Y(e);try{return await D(n.source,{verb:"decode",index:t,intent:"park"})}catch(s){i=s}finally{n.close()}try{return await Me(e,t,r)}catch(s){throw/no decoder/.test(String(i))?s:i instanceof Error?i:new Error(String(i))}}return Me(e,t,r)}async function Hr(e,t,o,r={}){if(/\.mxf$/i.test(e)&&(!o||/h264|avc|mxf/.test(o))){let a=null,c=null;try{await Se(e,l=>{a=l},(l,m)=>{l===t&&(c=m.slice())},{from:t,count:1,range:r.range})}catch(l){if(!(l instanceof $)||!/unsupported|missing/.test(l.why))throw l}if(c&&a){let l=a;return{rgb:c,width:l.w,height:l.h,bits:l.bit_depth??16,decoder:"media-core",full_range:l.full_range??null}}}let i=await Je(e,t,o),n=i.width*i.height,s=new Uint16Array(n*3);for(let a=0;a<n;a++)s[a*3]=i.rgba[a*4]*257,s[a*3+1]=i.rgba[a*4+1]*257,s[a*3+2]=i.rgba[a*4+2]*257;return{rgb:s,width:i.width,height:i.height,bits:8,decoder:"8-bit",full_range:null}}async function Me(e,t,o){t=Math.round(t);let r=0,i=0,n=null;if(await ve(e,a=>{r=a.w,i=a.h},(a,c)=>{a===t&&(n=c)},{from:t,count:1,width:o}),!n)throw new Error(`the OS decoder returned no frame ${t} of ${b(e)}`);let s=n;for(let a=0;a<s.length;a+=4){let c=s[a];s[a]=s[a+2],s[a+2]=c}return{rgba:s,width:r,height:i}}async function E(e){if(/\.exr$/i.test(e))return Re(e);let t=await Y(e);try{let o=await D(t.source,{verb:"inspect"});if(!o)throw new Error(`could not read '${b(e)}' as ${t.format}`);return o.target_url=t.anchor,o.local_path=t.anchor,o.id=o.id||b(t.anchor),t.parts.length>1&&((o.vendor_metadata??={}).spanned_parts=t.parts.map(r=>b(r.path))),o.size_bytes=t.parts.reduce((r,i)=>r+i.size,0),o}finally{t.close()}}function Ke(e,t,o,r){let i=Math.abs(r*1001-Math.round(r*1001/1e3)*1e3)<1?Math.round(r)*1e3/1001:r,n=Math.floor(e*i/t+1e-6);return{tc:M(n,r),frames:Math.round(o*i/t)}}var Ve=e=>String(Math.round(e*1e3)/1e3);function Br(e,t){let o=e.streams?.find(u=>u.kind==="video"),r=e.streams?.filter(u=>u.kind==="audio")??[],i=e.vendor_metadata?.bext;if(!o&&e.available_range&&r[0]?.rate){let u=r[0].rate,d=e.available_range.duration.value,h=(t?[t]:[24e3/1001,24]).map(p=>{let g=Ke(i?.time_reference??0,i?.sample_rate||u,d,p);return`${i?`start TC ${g.tc}, `:""}${g.frames} frames @ ${Ve(p)} fps`});return[e.target_url??"",`audio only; ${d} samples (${(d/u).toFixed(3)} s)${i?`; BWF time_reference ${i.time_reference}`:"; no BWF timecode"}`,...h,...t?[]:["(pass fps for the project's rate)"],...r.map((p,g)=>`audio ${r.length>1?`${g+1}: `:""}${p.codec??"pcm"} ${p.channels??"?"}ch ${p.rate} Hz ${p.bit_depth??"?"}-bit`)].join(`
6
- `)}let n=e.available_range?.duration?.value??e.declared_duration?.value??null,s=e.source_fps??o?.rate??null,a=e.size_bytes,c=e.vendor_metadata?.spanned_parts,l=o?.codec_specific??{},m=[l.profile?`${l.profile} (${l.fourcc})`:l.fourcc,l.pixel_format,o?.bit_depth?`${o.bit_depth}-bit`:null,l.colr?`color ${l.colr.primaries}/${l.colr.transfer}/${l.colr.matrix} (primaries/transfer/matrix)`:null].filter(Boolean).join(", ");return[e.target_url??"",o?`${o.codec??"?"} ${o.width??"?"}x${o.height??"?"}${s?` @ ${Math.round(s*1e3)/1e3} fps`:""}${m?`; ${m}`:""}`:"no video track",`start TC ${e.source_timecode??"none"}; ${n!=null?`${n} frames`:"length unknown"}${n!=null&&s?` (${(n/s).toFixed(2)} s)`:""}`,r.length?r.map((u,d)=>{let f=u.codec_specific?.channel_layout;return`audio ${r.length>1?`${d+1}: `:""}${u.codec??"pcm"} ${u.channels??"?"}ch${f?` (${f})`:""} ${u.rate??"?"} Hz ${u.bit_depth??"?"}-bit`}).join(`
7
- `):"no audio",`${e.reel_name?`reel ${e.reel_name}; `:""}${a!=null?`${(a/1e6).toFixed(1)} MB`:""}${c?`; spanned ${c.length} parts`:""}`].join(`
8
- `)}var Xe=8*1024*1024,U=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0));async function Ge(e,t,o){if(e.executable_locally===!1)throw new Error("this trim plan is server-side only");let r=new Map(t.parts.map(n=>[b(n.path),n]));await W(y(o));let i=await ne(o);try{await i.truncate(e.total_size),await i.writeAt(0,U(e.dest_header_bytes_base64));for(let n of e.src_byte_ranges){let s=n.src_file_name?r.get(b(n.src_file_name)):t.parts[0];if(!s)throw new Error(`plan references unknown source part '${n.src_file_name}'`);let a=0;for(;a<n.length;){let c=Math.min(Xe,n.length-a),l=await s.file.readAt(n.offset+a,c);if(l.length<c)throw new Error(`short read in ${b(s.path)} at ${n.offset+a}`);await i.writeAt(n.write_to_dest_offset+a,l),a+=c}}e.dest_footer_bytes_base64&&e.dest_footer_offset!=null&&await i.writeAt(e.dest_footer_offset,U(e.dest_footer_bytes_base64));for(let n of e.dest_patches??[])await i.writeAt(n.offset,U(n.bytes_base64))}finally{await i.close()}for(let n of e.dest_sidecar_writes??[])await j(_(y(o),n.name),U(n.bytes_base64))}function Ye(e,t){let o=[];for(let r of e){if(r.kind!=="clip"||!r.source_range)continue;let i=r.source_range.start.value,n=r.source_range.duration.value,s=Math.max(0,Math.floor(i)-t),a=Math.floor(i+n-1)+t;a>=s&&o.push({first_frame:s,last_frame:a})}return pe(o)}async function Ze(e,t,o,r,i){let n=await Y(e);try{let s=Ye(t,o);if(!s.length)throw new Error("no usable frame ranges (items need kind=clip with source_range)");let a=await D(n.source,{verb:"trim",selection:{items:t,handles:o}}),c=J(n.anchor),l=n.format==="r3d",m=l?R(b(n.anchor))?.clipBase??b(n.anchor,c):b(n.anchor,c),u=[];for(let[d,f]of a.entries()){let h=f.output_clip_number??(s.length>1?d+1:void 0),p=s[(h??1)-1]??s[0],g=h&&(f.output_clip_count??s.length)>1?`_S${String(h).padStart(3,"0")}`:"",w;if(l){let x=f.output_part_number??d+1;w=_(r,`${m}${g}.RDC`,`${m}_${String(x).padStart(3,"0")}.R3D`),u.push({path:w,bytes:f.total_size,island:p,part:x,clip:h})}else{let x=i&&a.length===1?i:`${m}${g||`_trim_${p.first_frame}-${p.last_frame}`}${c}`;w=_(r,x),u.push({path:w,bytes:f.total_size,island:p,clip:h})}await Ge(f,n,w)}return l||await Qe(e,u,!!i&&a.length===1),{outputs:u,islands:s,format:n.format}}finally{n.close()}}async function Qe(e,t,o){let r=await E(e).catch(()=>null),i=r?.source_fps??r?.streams?.find(n=>n.kind==="video")?.rate??null;if(!(!r?.source_timecode||!i))for(let n of t){if(!n.island)continue;let s=await E(n.path).catch(()=>null),a=s?.available_range?.duration?.value??s?.declared_duration?.value;if(!s?.source_timecode||!a)continue;let c=F(s.source_timecode,i,r.source_timecode);if(c===n.island.first_frame&&c+a-1===n.island.last_frame||(n.island={first_frame:c,last_frame:c+a-1},o))continue;let l=n.path.replace(/_trim_\d+-\d+(\.[^./\\]+)$/,`_trim_${c}-${c+a-1}$1`);l!==n.path&&(await L(n.path,l),n.path=l)}}async function jr(e){let t=await E(e.path),o=t.source_fps??t.streams?.find(g=>g.kind==="video")?.rate??null,r=t.available_range?.duration?.value??t.declared_duration?.value??null;if(!o)throw new Error("cannot trim: no frame rate / timecode track on this file");let i=F(e.in,o,t.source_timecode??null),n=F(e.out,o,t.source_timecode??null);e.out_exclusive&&(n-=1);let s=t.source_timecode??"00:00:00:00",a=r!=null?M((z(s,o)??0)+r-1,o,!!t.vendor_metadata?.drop_frame):null;if(n<i)throw new Error(`out ${e.out} is before in ${e.in}`);if(i<0)throw new Error(`in ${e.in} is before the file starts (${s}, frame 0)`);if(r!=null&&n>r-1)throw new Error(`out ${e.out} is past the end of the file (last frame ${a}, frame ${r-1})`);let c={id:"trim",kind:"clip",source_range:{start:{value:i,rate:o},duration:{value:n-i+1,rate:o}}},l=y(e.path),m;if(e.out_path)try{(await B(e.out_path)).isDirectory?l=e.out_path:(l=y(e.out_path),m=b(e.out_path))}catch{l=y(e.out_path),m=b(e.out_path)}let u=await Ze(e.path,[c],Math.max(0,Math.floor(e.handles??0)),l,m),d=u.islands[0],f=u.outputs.length===1&&u.outputs[0].island?u.outputs[0].island:d,h=f.first_frame,p=f.last_frame;return{outputs:u.outputs,first_frame:h,last_frame:p,frames:p-h+1,fps:o,facts:t,...h!==d.first_frame||p!==d.last_frame?{asked:{first_frame:d.first_frame,last_frame:d.last_frame}}:{}}}function Fe(e){let t=[...G].map(o=>o.slice(1)).join("|");return e.toLowerCase().replace(new RegExp(`\\.(${t})(?=[._\\s-]|$)`,"g"),"").replace(/[^a-z0-9]/g,"")}function qe(e,t){let o=Fe(e),r=Fe(t);if(r&&o.includes(r))return"name";let i=t.toLowerCase().split(/[^a-z0-9]+/).filter(n=>/\d/.test(n)&&n.length>=3);return i.length&&i.every(n=>o.includes(n))?"id":null}async function Wr(e,t,o){let r=[],i=0,n=null,s=Date.now()+o.time_limit_s*1e3,a=async(c,l)=>{try{for await(let m of v(c)){if(n&&!n.startsWith("folders"))return;if(++i>o.max_entries){n=`stopped after ${o.max_entries} entries (max_entries)`;return}if(Date.now()>s){n=`stopped after ${o.time_limit_s} s (time_limit_s)`;return}if(m.name.startsWith("."))continue;let u=_(c,m.name);if(m.isDirectory)l<o.max_depth?await a(u,l+1):n??=`folders deeper than max_depth=${o.max_depth} not searched (e.g. ${u})`;else if(m.isFile&&G.has(J(m.name).toLowerCase())){let d=qe(m.name,t);d&&r.push({path:u,match:d,size:(await B(u).catch(()=>({size:0}))).size})}}}catch{}};if(await a(e,0),o.probe)for(let c=0;c<r.length;c+=8)await Promise.all(r.slice(c,c+8).map(async l=>{try{l.facts=await E(l.path)}catch(m){l.error=m.message}}));return r.sort((c,l)=>c.path.localeCompare(l.path)),{hits:r,scanned:i,truncated:n}}function er(e){let t=e.streams?.find(a=>a.kind==="video"),o=e.source_fps??t?.rate??null,r=e.available_range?.duration?.value??e.declared_duration?.value??null,i=t?.codec_specific??{},n=e.source_timecode&&o?z(e.source_timecode,o):null,s=n!=null&&r!=null&&o?M((n+r)%(Math.round(o)*86400),o,e.source_timecode.includes(";")):null;return`${t?`${t.codec??"?"}${i.profile?` ${i.profile}`:""} ${t.width??"?"}x${t.height??"?"}`:"no video"}${o?` @ ${Math.round(o*1e3)/1e3} fps`:""}; TC ${e.source_timecode??"none"}${s?`\u2013${s}`:""}; ${r??"?"} fr${r!=null&&o?` (${(r/o).toFixed(2)} s)`:""}`}function Lr(e,t,o,r){let i=e.hits.slice(0,r),n=[];e.truncated&&n.push(`TRUNCATED: ${e.truncated} \u2014 the search did NOT cover all of ${t}; the matches below may be incomplete.`),e.hits.length>i.length&&n.push(`TRUNCATED: showing ${i.length} of ${e.hits.length} matches. Pass limit=${e.hits.length} or narrow the query.`),n.push(`${e.hits.length} file${e.hits.length===1?"":"s"} match "${o}" under ${t} (${e.scanned} entries scanned)`);let s=new Map;for(let c of e.hits)s.set(b(c.path).toLowerCase(),(s.get(b(c.path).toLowerCase())??0)+1);let a=[...s].filter(([,c])=>c>1);a.length&&n.push(`same name in several folders: ${a.map(([c,l])=>`${c} \xD7${l}`).join(", ")} \u2014 they can be DIFFERENT clips; match by TC + duration, never by name alone`);for(let c of i)n.push(`- ${c.path}${c.match==="id"?" (id match)":""}
9
- ${c.facts?er(c.facts):c.error?`probe failed: ${c.error}`:`${(c.size/1e6).toFixed(1)} MB`}`);return n.join(`
10
- `)}async function Jr(e,t,o=0){let r=await E(e),i=r.source_fps??r.streams?.find(d=>d.kind==="video")?.rate??null,n=r.available_range?.duration?.value??r.declared_duration?.value??null;if(!i||n==null)throw new Error(`cannot check coverage: ${b(e)} has no frame rate or length`);let s=Math.round(i)*86400,a=r.source_timecode?z(r.source_timecode,i)??0:0,c=!!r.source_timecode?.includes(";"),l=d=>{let f=F(d,i,r.source_timecode??null);return typeof d=="number"||/^\d+$/.test(d.trim())?f:f<-s/2?f+s:f>s/2?f-s:f},m=d=>M(((a+d)%s+s)%s,i,c),u=t.map((d,f)=>{let h=l(d.in),p=l(d.out),g=h,w=n-p,x=g>=0&&w>=0&&p>h,k=Math.max(0,-g),I=Math.max(0,-w),S=[];return p<=h?S.push("out is not after in"):x?S.push(`covered; handles head ${g} / tail ${w} fr`):S.push(`NOT covered: short ${[k?`${k} fr at head`:"",I?`${I} fr at tail`:""].filter(Boolean).join(", ")}`),x&&o&&(g<o||w<o)&&S.push(`handles short of ${o}: ${[g<o?`head by ${o-g}`:"",w<o?`tail by ${o-w}`:""].filter(Boolean).join(", ")}`),{label:d.label??`range ${f+1}`,in_tc:m(h),out_tc:m(p),frames:p-h,covered:x,head:g,tail:w,short_head:k,short_tail:I,note:S.join("; ")}});return{facts:r,rows:u}}export{ir as a,Ne as b,Pr as c,ve as d,Be as e,G as f,Le as g,Y as h,Je as i,Hr as j,E as k,Ke as l,Br as m,Ye as n,Ze as o,jr as p,Fe as q,qe as r,Wr as s,er as t,Lr as u,Jr as v};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as c,b as m}from"./chunk-DKGGJM6Z.js";import{Ga as u,Ia as t,Y as s,q as d}from"./chunk-DPA26AOI.js";async function h(r){await t();let e=s(r);return e==="null"?null:JSON.parse(e)}async function g(r){await t();let e;try{e=d(r)}catch{return null}if(e.length<8)return null;let n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=n.getUint32(0,!0),a=n.getUint32(4,!0),o=i*a*4;return e.length<8+o?null:{width:i,height:a,rgba:new Uint8ClampedArray(e.subarray(8,8+o))}}async function y(r,e=8){await t();let n=m(u,"decode_dng_preview");if(!n)return g(r);try{return c(n(r,e))}catch{return null}}export{h as a,g as b,y as c};