conformtools 0.6.12 → 0.6.14

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 (68) hide show
  1. package/README.md +13 -0
  2. package/dist/{account-IUWNSDG5.js → account-F54SG45Q.js} +1 -1
  3. package/dist/agent-hook-setup-RTQT5JEN.js +3 -0
  4. package/dist/{analysis-engine-M7W32RRC.js → analysis-engine-UWIK7AYB.js} +1 -1
  5. package/dist/{bridge-6NCHJWE6.js → bridge-46P34WCD.js} +1 -1
  6. package/dist/{chunk-UUXHJNQA.js → chunk-4BTTR6U3.js} +1 -1
  7. package/dist/{chunk-LYM757KG.js → chunk-5PTQAFU5.js} +66 -66
  8. package/dist/{chunk-THVX57I3.js → chunk-6WLSIH2N.js} +1 -1
  9. package/dist/{chunk-B77ADB26.js → chunk-764P7TUD.js} +1 -1
  10. package/dist/chunk-BO462NEL.js +3 -0
  11. package/dist/chunk-BTS3DFPD.js +7 -0
  12. package/dist/{chunk-F4PHKOAS.js → chunk-CQSNVQQE.js} +1 -1
  13. package/dist/{chunk-QTA36RVO.js → chunk-DP4KJ3KL.js} +232 -220
  14. package/dist/chunk-EKTETRKB.js +6 -0
  15. package/dist/{chunk-64X5DLH5.js → chunk-EP4L2BWV.js} +1 -1
  16. package/dist/{chunk-NXJZXXC2.js → chunk-FXK53VEO.js} +1 -1
  17. package/dist/{chunk-2CY2OOOJ.js → chunk-J43UCJ6G.js} +1 -1
  18. package/dist/chunk-L3HRAIDR.js +8 -0
  19. package/dist/chunk-MJBJI6DV.js +3 -0
  20. package/dist/{chunk-P3XI63Q2.js → chunk-MOSLNNO5.js} +1 -1
  21. package/dist/chunk-NZLL44HU.js +3 -0
  22. package/dist/{chunk-SJ56EEFP.js → chunk-O372NT7V.js} +2 -2
  23. package/dist/chunk-OD445COC.js +7 -0
  24. package/dist/{chunk-DFQWQ3EA.js → chunk-P3EOFAZR.js} +1 -1
  25. package/dist/chunk-XI6XF7FQ.js +3 -0
  26. package/dist/{chunk-OMPYIH6F.js → chunk-YKKB27VF.js} +1 -1
  27. package/dist/chunk-YYR3FM6A.js +5 -0
  28. package/dist/{claude-setup-REU4AOKX.js → claude-setup-NGZ5NDYH.js} +1 -1
  29. package/dist/cli.js +9 -9
  30. package/dist/framing-4HAHAG4I.js +3 -0
  31. package/dist/gfx-worker.js +1 -1
  32. package/dist/{h264-5OGRVYUF.js → h264-MAUQSLPY.js} +1 -1
  33. package/dist/{h264-mxf-FTHNCK4B.js → h264-mxf-2SZ66MPB.js} +1 -1
  34. package/dist/hook.js +3 -0
  35. package/dist/host-relink-664IB3BC.js +10 -0
  36. package/dist/hosted-L26AGRIY.js +3 -0
  37. package/dist/hosts-BGWD7BKM.js +3 -0
  38. package/dist/http.js +2 -2
  39. package/dist/{inspect-BJYIDVDN.js → inspect-ZM7IW23B.js} +1 -1
  40. package/dist/{isobmff-DN6MCHEK.js → isobmff-6ZPEXUF4.js} +1 -1
  41. package/dist/{mc-video-TF3MD7LN.js → mc-video-KMWTRVES.js} +1 -1
  42. package/dist/mcp.js +8 -8
  43. package/dist/{media-MJKEKCPN.js → media-MSMXMA6E.js} +1 -1
  44. package/dist/mxf-GOWHEH4A.js +3 -0
  45. package/dist/{ops-B2OA7VXN.js → ops-FI2NBTYK.js} +1 -1
  46. package/dist/probe-ZDX6XNRF.js +3 -0
  47. package/dist/{r3d-7OOZMPWH.js → r3d-LO5Z6DEX.js} +1 -1
  48. package/dist/resolve-bridge.py +31 -2
  49. package/dist/{sequence-patch-CN4VC5W3.js → sequence-patch-C2QRIT5V.js} +1 -1
  50. package/dist/{still-SX6RJ7O6.js → still-6FU7ALUV.js} +1 -1
  51. package/dist/{store-4WZQF6YD.js → store-JNWELX35.js} +1 -1
  52. package/dist/timeline-WVETLJZN.js +3 -0
  53. package/package.json +5 -5
  54. package/dist/chunk-3XQI5SIV.js +0 -3
  55. package/dist/chunk-6NLB5TZ2.js +0 -7
  56. package/dist/chunk-G3SZDPDS.js +0 -3
  57. package/dist/chunk-JV7TZDKJ.js +0 -3
  58. package/dist/chunk-NMH62JSC.js +0 -5
  59. package/dist/chunk-VJN4UXFJ.js +0 -8
  60. package/dist/chunk-XF3YMBI7.js +0 -3
  61. package/dist/chunk-XVRTAKDK.js +0 -6
  62. package/dist/framing-CVJM5TT3.js +0 -3
  63. package/dist/host-relink-ZP33BK53.js +0 -10
  64. package/dist/hosted-BWAYLJXR.js +0 -3
  65. package/dist/hosts-H3IKRZF2.js +0 -3
  66. package/dist/mxf-Q5723GPD.js +0 -3
  67. package/dist/probe-72QZKMCC.js +0 -3
  68. package/dist/timeline-ZP5H4YDQ.js +0 -3
@@ -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{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q}from"./chunk-DFQWQ3EA.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-P3XI63Q2.js";import"./chunk-F4PHKOAS.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-PHAMF4JF.js";import"./chunk-G3SZDPDS.js";import"./chunk-PSANHDZM.js";export{a as MEDIA_EXTS,g as bwfAt,q as coverage,e as decodeFrameRgb16,d as decodeFrameRgba,o as factsLine,h as factsText,n as findMedia,p as findText,i as islandsFor,m as nameMatch,l as normName,c as openSource,f as probeMedia,b as siblingParts,k as trimMedia,j as trimSource};
3
+ import{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q}from"./chunk-P3EOFAZR.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-MOSLNNO5.js";import"./chunk-CQSNVQQE.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-PHAMF4JF.js";import"./chunk-XI6XF7FQ.js";import"./chunk-PSANHDZM.js";export{a as MEDIA_EXTS,g as bwfAt,q as coverage,e as decodeFrameRgb16,d as decodeFrameRgba,o as factsLine,h as factsText,n as findMedia,p as findText,i as islandsFor,m as nameMatch,l as normName,c as openSource,f as probeMedia,b as siblingParts,k as trimMedia,j 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 $}from"./chunk-AACY2V3L.js";import{b as J}from"./chunk-MOSLNNO5.js";import{b as j}from"./chunk-CQSNVQQE.js";import{Ha as N,Ia as l,M,R as P,b as B,ca as D,da as T,e as I,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-DPA26AOI.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 se(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 Z(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 H(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=se(o);if(s<0)return e;let c=new DataView(o.buffer,o.byteOffset,o.byteLength),[f,te]=Z(c,s+16);if(f===null||f<16||f>65536)return e;let F=s+16+te;if(F+f>o.length)return e;let A=[],ne=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(ne,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 y=new DataView(p.buffer,p.byteOffset,p.byteLength),[R,v]=Z(y,16);if(R===null)continue;let m=16+v,_,x;if(p.length<m+64){let oe=Math.min(m+64,r-u),h=await t.read(u,oe);if(h.length<m+64)continue;let U=new DataView(h.buffer,h.byteOffset,h.byteLength);_=b(U,m+32),x=b(U,m+40)}else _=b(y,m+32),x=b(y,m+40);let ae=u+16+v+R+_+x,ie=Math.min(ae+65536,r)-u;e.push({offset:u,length:ie})}return e}function q(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 ce(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 K(t,r,e){let n=q(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 J(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 Q(t,r,e){await l();let n=q(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 H(t)).map(s=>({offset:s.offset,length:s.length}));return{fileSize:t.fileSize,structuralRanges:o,essenceRanges:ce(o,t.fileSize),trimInputs:n,wholeFileFallback:!0}}async function X(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 X(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:$(e),granularity:"frame",segments:e}},async sparsify(t,r){let e=t.parts[0],n=await Q(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 K(e,r.items,r.handles)},async decode(t,r,e){await l();let n=t.parts[0],a=w(n),i=await re(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 I(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 re(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 Y=new WeakMap;async function ue(t,r){if(!N)return null;try{let e=await import("./arriraw-YIJ3BYNN.js");if(!await e.arrirawGpuAvailable())return null;let{parseArrirawGpuPayload:n,arrirawFrameToRgb16:a}=await import("./clip-state-B6JOX3JE.js"),i=t.parts[0],o=Y.get(t)??null,s=await B(w(i),i.fileSize,r,o?.key),c=n(s,o);if(!c)return null;Y.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 ee=new WeakMap;async function re(t){let r=ee.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"),ee.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-F4PHKOAS.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-CQSNVQQE.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};
@@ -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{d as h}from"./chunk-J43UCJ6G.js";import{G as d,aa as o,b as p,g as n,i as a,n as u,t as s}from"./chunk-XI6XF7FQ.js";import"./chunk-PSANHDZM.js";import{dirname as m}from"node:path";import{fileURLToPath as P}from"node:url";import w from"node:process";var r="ColorMatchProbe.ofx.bundle",x="http://127.0.0.1:9876",i="/Library/OFX/Plugins";async function b(){let e=w.execPath;for(let t of[p("CONFORM_RESOLVE_PROBE"),o(m(e),"..","Resources","resolve-probe",r),o(m(P(import.meta.url)),"..","..","..","resolve_hook","build",r)])if(t&&await s(o(t,"Contents","MacOS","ColorMatchProbe.ofx")))return t;return null}async function E(){let e=n()==="darwin"&&a()==="arm64",t=await s(o(i,r)),l=await fetch(x+"/",{signal:AbortSignal.timeout(500)}).then(f=>f.ok).catch(()=>!1),c=!!await b();return{installed:t,loaded:l,shipped:c,supported:e,next:e?l?"running: the Color page selection and the selected node are read live":t?"installed; restart Resolve to load it":c?"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 S(){if(n()!=="darwin"||a()!=="arm64")throw new Error("the probe runs on Apple silicon Macs only");let e=await b();if(!e)throw new Error("this build does not carry the probe (resolve_hook/build.sh makes it)");return await h("darwin",e,i,r),await d(o(u(),"Library","Application Support","Blackmagic Design","DaVinci Resolve","OFXPluginCacheV2.xml")).catch(()=>{}),{path:o(i,r),restart_required:!0}}export{r as PROBE_BUNDLE,x as PROBE_URL,S as installProbe,E as probeStatus};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{c as l}from"./chunk-F4PHKOAS.js";import{Aa as v,Ba as F,H as _,Ha as O,I as S,Ia as f,J as P,ja as b,ka as R,xa as w}from"./chunk-DPA26AOI.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 U(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 J(t,e,r){let n=U(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(!O)return null;try{let n=await(await import("./r3d-I6EYEYX7.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,D=new WeakMap;function x(t){let e=D.get(t);return e||(e=t.parts[0].read(0,Math.min(16*1024,t.parts[0].fileSize)),D.set(t,e)),e}async function N(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 J(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 N(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 N(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};
3
+ import{c as l}from"./chunk-CQSNVQQE.js";import{Aa as v,Ba as F,H as _,Ha as O,I as S,Ia as f,J as P,ja as b,ka as R,xa as w}from"./chunk-DPA26AOI.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 U(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 J(t,e,r){let n=U(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(!O)return null;try{let n=await(await import("./r3d-I6EYEYX7.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,D=new WeakMap;function x(t){let e=D.get(t);return e||(e=t.parts[0].read(0,Math.min(16*1024,t.parts[0].fileSize)),D.set(t,e)),e}async function N(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 J(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 N(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 N(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};
@@ -544,13 +544,28 @@ def a_open(resolve, args):
544
544
  # in the pool it takes that one. So the named files go in first, and the result is checked.
545
545
  before = pool_ids(mp.GetRootFolder()) if named else set()
546
546
  on_disk = [m for m in named if os.path.isfile(m)]
547
+ missing = [m for m in named if m not in on_disk]
547
548
  if on_disk:
548
549
  mp.ImportMedia(on_disk)
549
550
  tl = mp.ImportTimelineFromFile(path, opts)
551
+ retried_linking = False
552
+ if not tl and not link and missing:
553
+ # the media the file names is not on this machine (offline, another SAN): Resolve refuses the import when told
554
+ # to import source clips it cannot find. Linking to the pool by name imports the timeline with those clips
555
+ # offline, which is what the artist wants to see (a tester's FCP7 XML with 319 offline clips, 2026-11-02).
556
+ tl = mp.ImportTimelineFromFile(path, {"timelineName": name, "importSourceClips": False})
557
+ retried_linking = bool(tl)
550
558
  if not tl:
551
559
  restored = restore()
552
- fail("import_failed", "Resolve refused to import %s%s" % (path, "" if link else " (link_existing links to clips already in the pool by name)"), restored=restored)
553
- wrong = mislinked(tl, named, before)
560
+ if missing:
561
+ why = "%d of %d media files it names are not on this machine (e.g. %s); linking to clips already in the pool by name was refused too" % (len(missing), len(named), os.path.basename(missing[0]))
562
+ elif link:
563
+ why = "linking to clips already in the pool by name (link_existing)"
564
+ else:
565
+ why = "the media it names is on this machine" if named else "it names no media"
566
+ fail("import_failed", "Resolve refused to import %s: %s. Check that the file opens in Resolve by hand (File > Import > Timeline)" % (os.path.basename(path), why), restored=restored, missing=len(missing))
567
+ # linked by name on the retry: items link to pool clips of the same name by design, not a mislink
568
+ wrong = [] if retried_linking else mislinked(tl, named, before)
554
569
  if wrong:
555
570
  mp.DeleteTimelines([tl])
556
571
  restored = restore()
@@ -573,6 +588,8 @@ def a_open(resolve, args):
573
588
  fail("import_mislinked", "the copy did not link every clip to the original's pool clip (%d off: %s); deleted, nothing changed" % (
574
589
  len(off), ", ".join(off[:10])), restored=restored)
575
590
  notes = []
591
+ if retried_linking:
592
+ notes.append("%d of %d media files the timeline names are not on this machine; imported linking to clips already in the pool by name, the rest offline (relink them with host_relink / timeline_relink once the media is here)" % (len(missing), len(named)))
576
593
  if tl.GetName() != name: # Resolve may name it after the file
577
594
  tl.SetName(name)
578
595
  settings = None
@@ -1558,6 +1575,18 @@ def _op(p, t, op, find):
1558
1575
  n, f = int(round(fps)), int(tl.GetStartFrame()) + int(op.get("frame", 0))
1559
1576
  tc = "%02d:%02d:%02d:%02d" % (f // (3600 * n), f // (60 * n) % 60, f // n % 60, f % n)
1560
1577
  return {"ok": bool(tl.SetCurrentTimecode(tc)), "timeline": tl.GetName(), "tc": tc, "undo": []}
1578
+ if kind == "pool_folder":
1579
+ # a media pool folder path (A/B/C), each missing level made; an empty folder is harmless, so nothing to undo
1580
+ # (a tester's suggestion, 2026-11-02: build the job's folder tree before importing into it)
1581
+ mp = p.GetMediaPool()
1582
+ cur = mp.GetCurrentFolder() # Resolve makes a new bin current: the artist's place is put back
1583
+ try:
1584
+ folder, missing = pool_folder(mp, op.get("folder", ""), create=True)
1585
+ finally:
1586
+ mp.SetCurrentFolder(cur)
1587
+ if folder is None:
1588
+ return {"ok": False, "undo": [], "detail": "could not make the folder %s" % missing}
1589
+ return {"ok": True, "undo": [], "folder": op.get("folder", "")}
1561
1590
  if kind == "pool_import":
1562
1591
  # files into a pool folder (made if missing); undo takes back exactly the clips this added
1563
1592
  mp = p.GetMediaPool()
@@ -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}from"./chunk-XF3YMBI7.js";import"./chunk-PHAMF4JF.js";import"./chunk-G3SZDPDS.js";import"./chunk-PSANHDZM.js";export{b as APPLIED,a as BACKUP_SUFFIX,e as applyPatch,c as patchFolders,g as patchName,d as planPatch,h as readRecord,f as undoPatch};
3
+ import{a,b,c,d,e,f,g,h}from"./chunk-NZLL44HU.js";import"./chunk-PHAMF4JF.js";import"./chunk-XI6XF7FQ.js";import"./chunk-PSANHDZM.js";export{b as APPLIED,a as BACKUP_SUFFIX,e as applyPatch,c as patchFolders,g as patchName,d as planPatch,h as readRecord,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 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-MJBJI6DV.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};
@@ -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-VJN4UXFJ.js";import"./chunk-6NLB5TZ2.js";import"./chunk-64X5DLH5.js";import"./chunk-PHAMF4JF.js";import"./chunk-G3SZDPDS.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-L3HRAIDR.js";import"./chunk-OD445COC.js";import"./chunk-EP4L2BWV.js";import"./chunk-PHAMF4JF.js";import"./chunk-XI6XF7FQ.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{$b as h,Ub as a,Vb as b,Wb as c,Xb as d,Yb as e,Zb as f,_b as g,ac as i,bc as j,cc as k,dc as l,ec as m,fc as n,gc as o,hc as p,ic as q,jc as r,kc as s}from"./chunk-5PTQAFU5.js";import"./chunk-IN6XVTUS.js";import"./chunk-P3EOFAZR.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-764P7TUD.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-MJBJI6DV.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-MOSLNNO5.js";import"./chunk-CQSNVQQE.js";import"./chunk-BTS3DFPD.js";import"./chunk-6WLSIH2N.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-L3HRAIDR.js";import"./chunk-OD445COC.js";import"./chunk-EP4L2BWV.js";import"./chunk-PHAMF4JF.js";import"./chunk-XI6XF7FQ.js";import"./chunk-PSANHDZM.js";export{i as OPERATION_KINDS,a as READ_FORMATS,j as applyOperation,l as applyOperationWithSources,r as consolidate,g as countFlags,b as detectFormat,s as judge,q as linkText,e as listClips,h as listFlags,f as listMedia,c as readTimeline,m as resolveTarget,p as routesText,d as summarize,k as trackIndex,o as writeDestination,n as writeTimeline};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conformtools",
3
- "version": "0.6.12",
3
+ "version": "0.6.14",
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.12",
48
- "conformtools-darwin-x64": "0.6.12",
49
- "conformtools-linux-x64": "0.6.12",
50
- "conformtools-windows-x64": "0.6.12"
47
+ "conformtools-darwin-arm64": "0.6.14",
48
+ "conformtools-darwin-x64": "0.6.14",
49
+ "conformtools-linux-x64": "0.6.14",
50
+ "conformtools-windows-x64": "0.6.14"
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{Vc as d}from"./chunk-LYM757KG.js";import{$ as f,A as p,C as m,m as c,x as u,z as l}from"./chunk-G3SZDPDS.js";import o from"node:process";import{readFileSync as g,rmSync as h}from"node:fs";import{createConnection as w}from"node:net";var x=new Set(["tool_run","app","tool"]),s=()=>f(c(),"engine.json");async function I(e,r){await p(c()),await l(s(),JSON.stringify({port:e,token:r||void 0,pid:o.pid})),await m(s(),384);for(let t of["SIGINT","SIGTERM"])o.on(t,()=>o.exit(0));o.on("exit",()=>{try{JSON.parse(g(s(),"utf8")).pid===o.pid&&h(s())}catch{}})}function S(e,r=1500){return new Promise(t=>{let n=w({host:"127.0.0.1",port:e}),i=y=>{clearTimeout(a),n.destroy(),t(y)},a=setTimeout(()=>i(!1),r);n.once("connect",()=>i(!0)).once("error",()=>i(!1))})}async function O(e,r){if(!x.has(e))return null;let t;try{t=JSON.parse(await u(s()))}catch{return null}if(t.pid===o.pid||!await S(t.port))return null;let n;try{n=await fetch(`http://127.0.0.1:${t.port}/verbs/${e}`,{method:"POST",body:JSON.stringify(r),headers:{"content-type":"application/json","x-conform-client":d()??"mcp",...t.token?{authorization:`Bearer ${t.token}`}:{}}})}catch{return null}if(n.status===401||n.status===404)return null;let{text:i,...a}=await n.json();return{content:[{type:"text",text:i??""}],structuredContent:a,isError:!n.ok}}export{I as a,O as b};
@@ -1,7 +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 z}from"./chunk-64X5DLH5.js";import{a as w}from"./chunk-PHAMF4JF.js";import{$ as o,A as C,B as y,C as G,K as F,N as J,R as K,S as X,b as s,g as E,m as u,n as B,t as j,x as d,z as N}from"./chunk-G3SZDPDS.js";var Y={transferGB:2e3},f={payg:{id:"payg",name:"Pay As You Go",monthly:0,yearly:0,stripe:{},includes:{web:!0,mcp:!1,app:!1}},web:{id:"web",name:"Web",monthly:10,yearly:100,stripe:{},includes:{web:!0,mcp:!1,app:!1},allowance:{transferGB:50}},indie:{id:"indie",name:"MCP",monthly:49,yearly:490,stripe:{monthly:"price_1T5XDXJ5lnla0aaLasKq49tm",yearly:"price_1T5XDXJ5lnla0aaL2MdMSuI9"},includes:{web:!0,mcp:!0,app:!1},allowance:{transferGB:250}},pro:{id:"pro",name:"App",monthly:199,yearly:1990,stripe:{monthly:"price_1T5X8oJ5lnla0aaLyNJa93H0",yearly:"price_1T5X8oJ5lnla0aaL3dh7b1el"},includes:{web:!0,mcp:!0,app:!0},allowance:Y},studio:{id:"studio",name:"Studio",monthly:"custom",yearly:"custom",stripe:{monthly:"price_1T5X7xJ5lnla0aaLoeE1aBlL",yearly:"price_1T5X7xJ5lnla0aaLeBiYo3Di"},includes:{web:!0,mcp:!0,app:!0},allowance:Y}};var H={web:!0,mcp:!1,app:!1};var Ie=Object.fromEntries(Object.values(f).flatMap(e=>Object.values(e.stripe).map(t=>[t,e.id])));import{createPrivateKey as Oe,createPublicKey as le,sign as Ee,verify as ue}from"node:crypto";import{Buffer as m}from"node:buffer";var pe="CONFORMTOOLS_LICENSE_V1",q=/^[0-9A-F]{8}(-[0-9A-F]{8}){3}$/,V=e=>JSON.stringify({dev_mode:e.dev_mode??!1,email:e.email,expires_at:e.expires_at,features:e.features,issued_at:e.issued_at,machine_fingerprint:e.machine_fingerprint,tier:e.tier});function Z(e){let t=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")&&!r.startsWith("-----")).join(""),n=JSON.parse(m.from(t,"base64").toString("utf8"));if(n?.magic!==pe||!n.payload?.data)throw new Error("not a conform.tools licence");return n.payload}function W(e,t){let n=m.from(e.signature,"base64"),r=m.from(V(e.data));return n.length!==64?!1:t.some(i=>ue(null,r,le({key:m.concat([m.from("302a300506032b6570032100","hex"),m.from(i)]),format:"der",type:"spki"}),n))}var de=["cMwVBrEYKMzlG6pC7FF2lNKIoEqGz2xB5yph6clNnTg=","qnheqkkDU09l1oI6h2CFh4uQ97bY/hkTA5niGKH0+X8="],fe=de.map(e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)));function L(){let e=s("CONFORM_RECORDS_DIR");if(e)return e;let t=B(),n=E()==="darwin"?o(t,"Library/Application Support"):E()==="win32"?s("LOCALAPPDATA")??o(t,"AppData/Local"):s("XDG_DATA_HOME")??o(t,".local/share");return o(n,"conform.tools")}var me=()=>s("CONFORM_LICENSE_PATH")??o(L(),"license.lic"),I=()=>o(L(),"grant.lic"),ge=null;function T(){return ge??=(async()=>{let e=await z();if(!e)return[];let t=await J(e,["machine"],{timeoutMs:15e3}).catch(()=>null);try{return JSON.parse(t?.stdout??"").machines.filter(n=>q.test(n))}catch{return[]}})()}function he(e,t,n=Date.now()){if(!W(e,fe))return{ok:!1,reason:"invalid licence signature"};let r=Date.parse(e.data.expires_at);return!Number.isFinite(r)||r<n?{ok:!1,reason:`licence expired ${e.data.expires_at}`}:[t??[]].flat().includes(e.data.machine_fingerprint)?{ok:!0,data:e.data}:{ok:!1,reason:"licence is for another machine"}}async function Q(){let e;try{e=await d(me())}catch{return null}try{return he(Z(e),await T())}catch(t){return{ok:!1,reason:t.message}}}var _e={production:{supabaseUrl:"https://sttpwvjbpsetzbhrkohl.supabase.co",anonKey:"sb_publishable_cyuIPsrQa5Ye7lqFxjnknQ_ozDuwwzp",appBase:"https://conform.tools"},staging:{supabaseUrl:"https://slxggvbvgzkiwojcgykx.supabase.co",anonKey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNseGdndmJ2Z3praXdvamNneWt4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzEyODUzMTksImV4cCI6MjA4Njg2MTMxOX0.b18iDsWftny0k9VmOCcbN6kLlyZsZ7GULn_jRH9CE9I",appBase:"https://beta.conform.tools"}};function a(){let e=s("CONFORM_ENV")==="staging"?"staging":"production",t=_e[e];return{env:e,supabaseUrl:s("CONFORM_SUPABASE_URL")??t.supabaseUrl,anonKey:s("CONFORM_SUPABASE_ANON_KEY")??t.anonKey,appBase:s("CONFORM_APP_BASE")??t.appBase}}var ye=600*1e3,ee=72*3600*1e3,we=300*1e3,x=()=>o(u(),a().env==="production"?"auth.json":`auth-${a().env}.json`);async function $(){for(let e of new Set([x(),o(u(),"auth.json")]))try{let t=JSON.parse(await d(e));if(t.env===a().env&&t.access_token)return t}catch{}return null}async function be(){try{for await(let e of F(u())){if(!/^auth(?:-(\w+))?\.json$/.exec(e.name))continue;let n=JSON.parse(await d(o(u(),e.name)));if(n.access_token&&n.env&&n.env!==a().env)return{other_env:n.env}}}catch{}return{}}async function D(e){await C(u()),await N(x(),JSON.stringify(e)),await G(x(),384)}var ne=6e3,v=0,re=()=>Date.now()<v,ie=()=>{v=Date.now()+6e4};function Fe(){v=0}async function ae(e){if(e.expires_at-60>Date.now()/1e3)return e.access_token;if(re())return null;let t=a();try{let n=await fetch(`${t.supabaseUrl}/auth/v1/token?grant_type=refresh_token`,{method:"POST",headers:{apikey:t.anonKey,"content-type":"application/json"},body:JSON.stringify({refresh_token:e.refresh_token}),signal:AbortSignal.timeout(ne)}).catch(i=>{throw ie(),i});if(!n.ok)return n.status===400||n.status===401?"":null;let r=await n.json();return e.access_token=r.access_token,r.refresh_token&&(e.refresh_token=r.refresh_token),e.expires_at=r.expires_at??Math.floor(Date.now()/1e3)+(r.expires_in??3600),await D(e),e.access_token}catch{return null}}async function Je(){let e=await $();return e&&await ae(e)||null}var g=null;function te(e,t){return{signed_in:!0,entitled:e.entitled,env:a().env,email:e.email,access:e.access,tier:e.tier,trial_days_remaining:e.trial_days_remaining,source:t,...e.entitled?{}:{reason:"not_entitled"},...e.invite_only?{invite_only:!0}:{}}}async function oe(e={}){let t=await Q();if(t?.ok)return{signed_in:!!await $().catch(()=>null),entitled:!0,env:a().env,email:t.data.email,access:"licence",tier:t.data.tier,source:"licence"};let n=await xe(e);return t&&!n.entitled?{...n,licence_error:t.reason}:n}async function xe(e){if(!e.force&&g&&Date.now()-g.at<ye)return{...g.status,source:"cache"};let t=a(),n=await $();if(!n)return{signed_in:!1,entitled:!1,env:t.env,reason:"not_signed_in",...await be()};let r=await ae(n);if(r==="")return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(r&&!re())try{let i=(await T())[0],c=await fetch(`${t.supabaseUrl}/functions/v1/v1-billing/v1/billing/entitlement${i?`?machine=${i}`:""}`,{headers:{authorization:`Bearer ${r}`,apikey:t.anonKey},signal:AbortSignal.timeout(ne)}).catch(l=>{throw ie(),l});if(c.status===401||c.status===403)return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(c.ok){let{grant:l,...S}=(await c.json()).data;i&&await ve(l),n.last_entitlement=S,n.last_entitlement_at=Date.now(),await D(n);let A=te(S,"live");return g={at:Date.now(),status:A},A}}catch{}if(n.last_entitlement&&n.last_entitlement_at&&Date.now()-n.last_entitlement_at<ee){let i=ee-(Date.now()-n.last_entitlement_at);return{...te(n.last_entitlement,"grace"),grace_remaining_h:Math.round(i/36e4)/10}}return{signed_in:!0,entitled:!1,env:t.env,reason:"offline_grace_expired"}}async function ve(e){try{if(!e)return await y(I());await C(L()),await N(I(),e)}catch{}}function Se(e){return e.source==="licence"?`${e.email} \xB7 machine licence (${e.tier}) \u2014 runs offline, no account check`:Ae(e)+(e.licence_error?`
4
- (the machine licence was not used: ${e.licence_error})`:"")}function Ae(e){let t=a();if(!e.signed_in)return`not signed in (${t.env})${e.other_env?`; you are signed in to ${e.other_env} only (each server keeps its own sign-in)`:""}. Run the account_login tool, or \`npx -y conformtools@latest login\` in a terminal.`;if(e.reason==="auth_rejected")return"signed-in session was rejected (expired or revoked) \u2014 sign in again with account_login.";if(e.reason==="offline_grace_expired")return"offline for more than 72 h since the last account check \u2014 reconnect and run account_status.";let n=`${e.email??"(unknown email)"} \xB7 ${t.env}`;if(!e.entitled&&e.invite_only)return`${n}
5
- the conform.tools engine (the MCP and the app) is invite-only for now, and ${e.email??"this account"} is not on the list. If that is the wrong Google account, run account_logout, then account_login with the invited one.`;if(!e.entitled)return`${n}
6
- no active plan on ${e.email??"this account"}: the trial has ended and there is no subscription. If that is the wrong Google account, run account_logout, then account_login and pick the account with the plan; otherwise choose a plan at ${t.appBase}/pricing, then run account_status.`;let r=e.access==="trial"?`trial, ${e.trial_days_remaining??"?"} day(s) left`:e.access==="allowlist"?"invited (early access)":`subscribed${e.tier?` (${e.tier})`:""}`,i=P(e),c=i?` \xB7 includes ${[i.web&&"the web tools",i.mcp&&"the MCP",i.app&&"the app"].filter(Boolean).join(", ")||"the web tools"}`:"";return`${n}
7
- ${r}${c}${e.source==="grace"?` \u2014 offline, using the last check (${e.grace_remaining_h} h of grace left)`:""}`}function P(e){if(e.access==="trial")return H;let t=(e.tier??"").toLowerCase();return(t==="enterprise"?f.studio:f[t])?.includes??null}var se=()=>oe();function Ke(e){se=e}async function ce(){let e=await se();if(e.entitled)return e;let t=e.signed_in&&e.reason==="not_entitled"?"not_entitled":"not_signed_in";throw new w(t,Se(e),{account:e})}async function Xe(){let e=await ce();if(e.source==="licence"||P(e)?.mcp!==!1)return e;throw new w("not_entitled",`The conform.tools MCP is in the MCP plan ($${f.indie.monthly}/mo) and up. ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${e.tier})`:""}`} includes Timeline Exchange and Conform Connect on ${a().appBase}, but not the engine on this machine. Upgrade at ${a().appBase}/pricing, then run account_status.`,{account:e,needs:"mcp"})}async function ze(){let e=await ce();if(e.source==="licence"||P(e)?.app)return e;throw new w("not_entitled",`The conform.tools app is in the App plan ($${f.pro.monthly}/mo). ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${e.tier})`:""}`} does not include the app${P(e)?.mcp?" \u2014 it includes the conform.tools MCP: use it from Claude, Claude Code or any MCP client":""}. Upgrade at ${a().appBase}/pricing, then reopen the app.`,{account:e,needs:"app"})}var b=null;function Ye(e={}){if(b)return b;let t=a(),n=crypto.randomUUID().replaceAll("-","");return b=new Promise((r,i)=>{let c=!1,l=h=>{c||(c=!0,clearTimeout(A),setTimeout(()=>S.close(),250),b=null,h())},S=X({hostname:"127.0.0.1",port:0,onListen:async h=>{let _=`${t.appBase}/plugin-auth?client=engine&port=${h}&state=${n}`,p=await K(_);e.onUrl?.(_,p)}},async h=>{let _=new URL(h.url);if(_.pathname!=="/callback")return new Response("not found",{status:404});let p=_.searchParams,M=p.get("access_token")??"",U=p.get("refresh_token")??"",k=!!M&&!!U&&p.get("state")===n;if(k){let R=Number(p.get("expires_at"));await D({env:t.env,access_token:M,refresh_token:U,expires_at:R>0?R:Math.floor(Date.now()/1e3)+3600}),g=null,v=0,oe({force:!0}).then(O=>l(()=>r(O)),O=>l(()=>i(O)))}return new Response(Le(k),{status:k?200:400,headers:{"content-type":"text/html; charset=utf-8"}})}),A=setTimeout(()=>l(()=>i(new w("not_signed_in","sign-in was not completed within 5 minutes"))),e.timeoutMs??we)}),b}async function He(){g=null,v=0,await j(x())&&await y(x()),await y(I()).catch(()=>{});let e=o(u(),"auth.json");try{JSON.parse(await d(e)).env===a().env&&await y(e)}catch{}}function Le(e){let[t,n]=e?["Connected","You're signed in \u2014 you can close this tab."]:["Sign-in failed","Please try again."];return`<!doctype html><meta charset=utf-8><title>conform.tools</title><body style='font:16px -apple-system,Helvetica,Arial,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#f5f5f7;color:#1d1d1f'><div style='text-align:center'><div style='font-size:22px;font-weight:700'>conform<span style='color:#ff3c00'>.tools</span></div><div style='margin-top:14px;font-size:20px;font-weight:600'>${t}</div><div style='margin-top:6px;color:#6e6e73'>${n}</div></div></body>`}export{a,ne as b,Fe as c,Je as d,oe as e,Se as f,P as g,Ke as h,ce as i,Xe as j,ze as k,Ye as l,He as m};
@@ -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{readFile as A,writeFile as N,appendFile as J,stat as W,readdir as q,mkdir as G,open as k,copyFile as Y,mkdtemp as K,rm as M,chmod as Q,rename as _,cp as V,statfs as X,realpath as Z}from"node:fs/promises";import{execFile as ee,spawn as B}from"node:child_process";import{createHash as te}from"node:crypto";import{createReadStream as re,chmodSync as ne,cpSync as oe,existsSync as D,statSync as E}from"node:fs";import{homedir as se,tmpdir as ie,platform as ae,release as ce,arch as le,totalmem as ue,availableParallelism as de}from"node:os";import{fileURLToPath as S}from"node:url";import me from"node:http";import fe from"node:http2";import f from"node:process";import{Buffer as P}from"node:buffer";import{basename as pe,dirname as ge,join as b,resolve as C,sep as v}from"node:path";import{createRequire as ye}from"node:module";import{basename as Rt,dirname as At,extname as kt,join as St,relative as Ut,resolve as Ft}from"node:path";{let e=globalThis.fetch,t=typeof globalThis.Deno<"u";e&&!t&&(globalThis.fetch=(async(n,o)=>{let r=typeof n=="string"?n:n instanceof URL?n.href:n.url;if(r.startsWith("file:")){let s=await A(S(r)),i=r.endsWith(".wasm")?"application/wasm":"application/octet-stream";return new Response(s,{status:200,headers:{"content-type":i}})}return e(n,o)}))}var h=e=>f.env[e],Ce=()=>Number(h("CONFORM_MEMORY_GB")??0)*2**30||ue(),He=()=>de(),Ie=()=>f.argv.slice(2),Ne=e=>f.exit(e),we=()=>f.platform,We=()=>h("CONFORM_PYTHON")??(we()==="win32"?"python":"python3"),Me=()=>f.arch,j=()=>`${f.platform}-${f.arch}`;function _e(e){try{return b(ge(ye(import.meta.url).resolve(`${be(j())}/package.json`)),e)}catch{return null}}var be=e=>`conformtools-${e==="win32-x64"?"windows-x64":e}`,Be=e=>`${e} is not in this package for ${j()} (conform.tools builds it for darwin-arm64, darwin-x64, linux-x64 and win32-x64)`;function je(){let e=f.versions.deno;return{platform:`${ae()} ${ce()} ${le()}`,runtime:e?`deno ${e}`:`node ${f.version}`}}var he=()=>h("CONFORM_MCP_HOME")??b(R(),".conform-mcp"),R=()=>h("HOME")??se();function ze(e){let t=e.trim();if(t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1)),/^file:\/\//i.test(t))try{t=S(t)}catch{}return t==="~"?t=R():(t.startsWith("~/")||t.startsWith("~\\"))&&(t=b(R(),t.slice(2))),t&&C(t)+(/[\\/]$/.test(t)&&!/[\\/]$/.test(C(t))?v:"")}async function Le(e,t){let n=await import("node:sqlite").catch(()=>null);if(n?.DatabaseSync){let r=new n.DatabaseSync(e,{readOnly:!0});try{let s=r.prepare(t);return s.setReadBigInts(!0),s.all().map(i=>Object.fromEntries(Object.entries(i).map(([c,a])=>[c,typeof a=="bigint"?Number(a):a])))}finally{r.close()}}let o=await F("sqlite3",["-readonly","-json",e,t]);if(!o.success)throw new Error(`sqlite3 ${pe(e)}: ${o.stderr.trim()||o.stdout.trim()}`);return o.stdout.trim()?JSON.parse(o.stdout):[]}var Je=(e,t)=>e?`${e.replace(/[\\/]+$/,"")}${e.includes("\\")&&!e.includes("/")?"\\":"/"}${t}`:t;function qe(e){let t=S(e),n=t.indexOf(`${v}deno-compile-`);if(n<0||!D(t))return t;let o=t.slice(n+1).split(v).slice(1).join(v),r=b(he(),"bin",o);try{let s=E(t),i=D(r)?E(r):null;return(!i||s.isFile()&&(i.size!==s.size||i.mtimeMs<s.mtimeMs))&&(oe(t,r,{recursive:!0,force:!0}),s.isFile()&&ne(r,493)),r}catch{return t}}var H=null;var x=e=>H?.owns(e)?H:null;async function I(e){let t=await W(e);return{isFile:t.isFile(),isDirectory:t.isDirectory(),size:t.size,mtimeMs:t.mtimeMs}}function U(e){return x(e)?.stat(e,()=>I(e))??I(e)}async function Ge(e){try{return await U(e),!0}catch{return!1}}async function Ye(e){try{return(await U(e)).isFile}catch{return!1}}async function Ke(e){try{return(await U(e)).isDirectory}catch{return!1}}async function Qe(e){x(e)?.guard(e,"read whole file");let t=await A(e);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}var Ve=e=>A(e,"utf8"),Xe=(e,t)=>N(e,t),Ze=(e,t,n)=>n?.append?J(e,t):N(e,t);async function et(e){await G(e,{recursive:!0})}var tt=e=>M(e,{force:!0}),rt=(e,t)=>Q(e,t).catch(()=>{}),nt=(e,t)=>Y(e,t),ot=(e,t)=>_(e,t),st=e=>M(e,{recursive:!0,force:!0}),it=(e,t)=>V(e,t,{recursive:!0,verbatimSymlinks:!0});async function at(e){try{let t=await X(e);return Number(t.bavail)*Number(t.bsize)}catch{return null}}async function ct(e){try{return await Z(e)}catch{return null}}var lt=(e="conform-")=>K(b(ie(),e));async function*ut(e){let t=async()=>(await q(e,{withFileTypes:!0})).map(n=>({name:n.name,isFile:n.isFile(),isDirectory:n.isDirectory()}));yield*await(x(e)?.readDir(e,t)??t())}async function dt(e){x(e)?.guard(e,"read bytes");let t=await k(e,"r"),n=(await t.stat()).size;return{path:e,size:n,async readAt(o,r){let s=new Uint8Array(r),i=0;for(;i<r;){let{bytesRead:c}=await t.read(s,i,r-i,o+i);if(!c)break;i+=c}return i===r?s:s.subarray(0,i)},close:()=>t.close()}}async function mt(e){let t=await k(e,"w");return{async writeAt(n,o){let r=0;for(;r<o.length;){let{bytesWritten:s}=await t.write(o,r,o.length-r,n+r);r+=s}},truncate:n=>t.truncate(n),close:()=>t.close()}}var z=(e,t)=>{for(let n of t)x(n)?.guard(n,`${e.split(/[\\/]/).pop()} ${t[0]}`)};function F(e,t,n={}){return z(e,t),new Promise(o=>{ee(e,t,{maxBuffer:1<<30,env:n.env?{...f.env,...n.env}:void 0,timeout:n.timeoutMs},(r,s,i)=>{let c=r?.code??0;o({success:!r,code:c,stdout:String(s),stderr:String(i)})})})}var xe="[Console]::OutputEncoding=[Text.Encoding]::UTF8;$t=@{};Get-Process|?{$_.MainWindowTitle}|%{$t[$_.Id]=$_.MainWindowTitle};ConvertTo-Json -Compress -InputObject @(Get-CimInstance Win32_Process|%{[pscustomobject]@{pid=[int]$_.ProcessId;exe=$_.ExecutablePath;cmd=$_.CommandLine;title=$t[[int]$_.ProcessId]}})";async function ft(){let e=await F("powershell.exe",["-NoProfile","-NonInteractive","-Command",xe],{timeoutMs:3e4});return ve(e.stdout)}function ve(e){let t;try{t=JSON.parse(e.replace(/^/,"").trim()||"[]")}catch{return[]}return(Array.isArray(t)?t:[t]).flatMap(n=>{let o=n??{},r=Number(o.pid);return!Number.isInteger(r)||r<=0?[]:[{pid:r,args:String(o.cmd||o.exe||""),title:typeof o.title=="string"?o.title:""}]})}function pt(e,t,n,o={}){return z(e,t),new Promise((r,s)=>{let i=B(e,t,{env:o.env?{...f.env,...o.env}:void 0,stdio:["ignore","pipe","pipe"]}),c="";i.stdout.on("data",a=>n(a)),i.stderr.on("data",a=>{c+=new TextDecoder().decode(a)}),i.on("error",s),i.on("close",a=>r({code:a,stderr:c})),o.signal?.addEventListener("abort",()=>i.kill(),{once:!0})})}function gt(e,t,n,o){let r=B(e,t,{stdio:["pipe","pipe","pipe"]});r.stdin.on("error",()=>{}),r.stdout.on("data",a=>n(a)),r.stderr.on("data",a=>o?.(new TextDecoder().decode(a)));let s=new Promise(a=>{r.on("close",l=>a(l)),r.on("error",()=>a(null))}),i=[r,r.stdout,r.stderr,r.stdin],c=a=>{for(let l of i)(a?l.ref:l.unref)?.call(l)};return c(!1),{write:a=>new Promise((l,d)=>{r.stdin.write(a,m=>m?d(m):l())}),hold:c,close:()=>{try{r.stdin.end(),r.kill()}catch{}},exited:s}}async function yt(e){if(h("CONFORM_NO_BROWSER"))return!1;let[t,n]=f.platform==="darwin"?["open",[e]]:f.platform==="win32"?["cmd",["/c","start","",e.replace(/&/g,"^&")]]:["xdg-open",[e]];return(await F(t,n)).success}function wt(e,t){let n=me.createServer(async(o,r)=>{try{let s=[];if(o.method!=="GET"&&o.method!=="HEAD")for await(let m of o)s.push(m);let i=s.length>0,c=new Headers;for(let[m,p]of Object.entries(o.headers))p!=null&&c.set(m,Array.isArray(p)?p.join(", "):p);let a=`http://${o.headers.host??`${e.hostname}:${e.port}`}${o.url??"/"}`,l=new AbortController;r.on("close",()=>{r.writableEnded||l.abort()});let d=await t(new Request(a,{method:o.method,headers:c,body:i?P.concat(s):void 0,signal:l.signal}));if(r.statusCode=d.status,d.headers.forEach((m,p)=>r.setHeader(p,m)),d.body&&d.headers.get("content-type")?.startsWith("text/event-stream")){r.flushHeaders();let m=d.body.getReader();for(l.signal.addEventListener("abort",()=>void m.cancel(),{once:!0});;){let{value:p,done:g}=await m.read();if(g)break;r.write(p)}r.end();return}r.end(P.from(await d.arrayBuffer()))}catch(s){r.statusCode=500,r.end(JSON.stringify({ok:!1,code:"internal",message:s instanceof Error?s.message:String(s)}))}});return n.listen(e.port,e.hostname,()=>{let o=n.address();e.onListen?.(typeof o=="object"&&o?o.port:e.port)}),{close:()=>n.close()}}var y=class extends Error{constructor(n,o,r){super(o);this.code=n;this.grpcStatus=r}};function bt(e,t,n,o,r){return new Promise((s,i)=>{let c=fe.connect(`http://${e}:${t}`),a=!1,l=(u,L)=>{a||(a=!0,clearTimeout(m),c.destroy(),u?i(u):s(L))},d=!1;c.on("connect",()=>{d=!0});let m=setTimeout(()=>l(d?new y("deadline",`no answer from ${e}:${t} in ${r} ms`):new y("unavailable",`${e}:${t}: no connection in ${r} ms`)),r);c.on("error",u=>l(new y("unavailable",`${e}:${t}: ${u.message}`)));let p=P.alloc(5+o.length);p.writeUInt32BE(o.length,1),p.set(o,5);let g=c.request({":method":"POST",":path":n,"content-type":"application/grpc",te:"trailers"}),O=[],w,$="",T=u=>{u["grpc-status"]!=null&&(w=String(u["grpc-status"]),$=decodeURIComponent(String(u["grpc-message"]??"")))};g.on("response",T),g.on("trailers",T),g.on("data",u=>O.push(u)),g.on("error",u=>l(new y("unavailable",`${e}:${t}: ${u.message}`))),g.on("end",()=>{if(w!=="0")return l(new y("grpc",`grpc-status ${w??"missing"}${$?`: ${$}`:""}`,w==null?void 0:Number(w)));let u=P.concat(O);if(u.length<5||u[0]!==0)return l(new y("grpc","reply is not one uncompressed gRPC message"));l(null,new Uint8Array(u.subarray(5,5+u.readUInt32BE(1))))}),g.end(p)})}async function ht(e){let t=te("sha256");for await(let n of re(e))t.update(n);return t.digest("hex")}async function xt(e,t,n){let o=`${t}.part`;for(let r=0;;r++){let s=0;try{s=(await W(o)).size}catch{}try{let i=await fetch(e,{headers:s?{Range:`bytes=${s}-`}:{}});if(i.status===416)break;if(!i.ok||!i.body)throw new Error(`${e} answered ${i.status}`);s&&i.status!==206&&(s=0);let c=s+Number(i.headers.get("content-length")??0),a=await k(o,s?"a":"w");try{let l=s;for await(let d of i.body)await a.write(d),l+=d.length,n?.(l,c)}finally{await a.close()}break}catch(i){if(r>=4)throw i;await new Promise(c=>setTimeout(c,2e3*(r+1)))}}await _(o,t)}function vt(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}export{S as a,h as b,Ce as c,He as d,Ie as e,Ne as f,we as g,We as h,Me as i,_e as j,Be as k,je as l,he as m,R as n,ze as o,Le as p,Je as q,qe as r,U as s,Ge as t,Ye as u,Ke as v,Qe as w,Ve as x,Xe as y,Ze as z,et as A,tt as B,rt as C,nt as D,ot as E,st as F,it as G,at as H,ct as I,lt as J,ut as K,dt as L,mt as M,F as N,ft as O,pt as P,gt as Q,yt as R,wt as S,y as T,bt as U,ht as V,xt as W,vt as X,Rt as Y,At as Z,kt as _,St as $,Ut as aa,Ft as ba};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- var F=new Set(["png","jpg","jpeg","tif","tiff","psd","tga","bmp","gif","webp","avif","heic","heif","exr","dpx","pict","pct"]);function B(t){let n=t.split(/[/\\]/).pop()??"",e=n.lastIndexOf(".");return e>0?n.slice(e+1).toLowerCase():""}function k(t){return!!t&&F.has(B(t))}function V(t){return t.content_kind==="still"?!0:t.content_kind!=null?!1:k(t.source_filename)||k(t.target_url)}var U=/\[\d+-\d+\]|%0?\d*d|#{3,}/;function q(t){return t.content_kind==="still"?!1:t.bundle?.kind==="image-sequence"?!0:U.test(t.target_url??"")||U.test(t.display_name??"")}function Y(t){return{size:t.length,async read(n,e){let r=Math.max(0,Math.min(n,t.length)),u=Math.max(r,Math.min(r+e,t.length));return t.subarray(r,u)}}}function J(t){return{size:t.fileSize,read:(n,e)=>t.read(n,e)}}var _=class{constructor(n){this.r=n;this.buf=new Uint8Array(0);this.base=0}async at(n,e){if(n<0||e<=0)return new Uint8Array(0);let r=n-this.base;return r>=0&&r+e<=this.buf.length?this.buf.subarray(r,r+e):(this.buf=await this.r.read(n,Math.max(e,65536)),this.base=n,this.buf.subarray(0,Math.min(e,this.buf.length)))}},A=(t,n)=>t[n]<<8|t[n+1],b=(t,n)=>t[n]|t[n+1]<<8,M=(t,n)=>t[n]|t[n+1]<<8|t[n+2]<<16,m=(t,n)=>(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3])>>>0,w=(t,n)=>(t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24)>>>0,P=(t,n)=>t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24,g=(t,n,e)=>String.fromCharCode(...t.subarray(n,n+e));function d(t,n){if(!Number.isFinite(t)||!Number.isFinite(n))return null;let e=Math.round(t),r=Math.round(n);return e<1||r<1||e>1e6||r>1e6?null:{width:e,height:r}}var E=t=>({width:t.height,height:t.width});async function L(t){let n=await t.at(0,24);return n.length<24||n[0]!==137||g(n,1,3)!=="PNG"||g(n,12,4)!=="IHDR"?null:d(m(n,16),m(n,20))}var z=new Set([192,193,194,195,197,198,199,201,202,203,205,206,207]);function O(t){if(t.length<8)return null;let n=t[0]===73&&t[1]===73,e=t[0]===77&&t[1]===77;if(!n&&!e)return null;let r=i=>n?b(t,i):A(t,i),u=i=>n?w(t,i):m(t,i);if(r(2)!==42)return null;let l=u(4);if(l+2>t.length)return null;let c=r(l);for(let i=0;i<c;i++){let s=l+2+i*12;if(s+12>t.length)break;if(r(s)===274)return r(s+8)}return null}async function W(t,n){let e=await t.at(0,2);if(e.length<2||e[0]!==255||e[1]!==216)return null;let r=1,u=null,l=2;for(;l+4<=n;){let c=await t.at(l,4);if(c.length<4)break;if(c[0]!==255){l++;continue}let i=c[1];if(i===255){l++;continue}if(i===1||i>=208&&i<=217){l+=2;continue}if(i===218)break;let s=A(c,2);if(s<2)break;if(z.has(i)){let o=await t.at(l+4,5);o.length>=5&&(u=d(A(o,3),A(o,1)));break}if(i===225){let o=await t.at(l+4,Math.min(s-2,65536));o.length>6&&g(o,0,4)==="Exif"&&(r=O(o.subarray(6))??1)}l+=2+s}return u?r>=5&&r<=8?E(u):u:null}async function C(t){let n=await t.at(0,10);return n.length<10||g(n,0,3)!=="GIF"?null:d(b(n,6),b(n,8))}async function I(t){let n=await t.at(0,26);return n.length<22||g(n,0,2)!=="BM"?null:w(n,14)===12?d(b(n,18),b(n,20)):n.length<26?null:d(P(n,18),Math.abs(P(n,22)))}async function j(t){let n=await t.at(0,30);if(n.length<16||g(n,0,4)!=="RIFF"||g(n,8,4)!=="WEBP")return null;let e=g(n,12,4);if(e==="VP8X")return n.length<30?null:d(M(n,24)+1,M(n,27)+1);if(e==="VP8 ")return n.length<30||n[23]!==157||n[24]!==1||n[25]!==42?null:d(b(n,26)&16383,b(n,28)&16383);if(e==="VP8L"){if(n.length<25||n[20]!==47)return null;let r=w(n,21);return d((r&16383)+1,(r>>>14&16383)+1)}return null}async function S(t,n){let e=[],r=0;async function u(i,s,o){let f=i;for(;f+8<=s&&o<8;){let x=await t.at(f,16);if(x.length<8)return;let a=m(x,0),h=g(x,4,4),y=8;if(a===1){if(x.length<16)return;a=m(x,8)*2**32+m(x,12),y=16}else a===0&&(a=s-f);if(a<y||f+a>s)return;if(h==="meta")await u(f+y+4,f+a,o+1);else if(h==="iprp"||h==="ipco")await u(f+y,f+a,o+1);else if(h==="ispe"){let p=await t.at(f+y+4,8);if(p.length===8){let R=d(m(p,0),m(p,4));R&&e.push(R)}}else if(h==="irot"){let p=await t.at(f+y,1);p.length===1&&(r=p[0]&3)}f+=a}}let l=await t.at(0,12);if(l.length<12||g(l,4,4)!=="ftyp"||(await u(0,n,0),e.length===0))return null;let c=e.reduce((i,s)=>i.width*i.height>=s.width*s.height?i:s);return r===1||r===3?E(c):c}async function N(t){let n=await t.at(0,22);return n.length<22||g(n,0,4)!=="8BPS"?null:d(m(n,18),m(n,14))}var T=new Set([0,1,2,3,9,10,11]);async function X(t){let n=await t.at(0,18);if(n.length<18||n[1]>1||!T.has(n[2]))return null;let e=n[16];return[8,15,16,24,32].includes(e)?d(b(n,12),b(n,14)):null}async function v(t){let n=await t.at(0,8);if(n.length<8)return null;let e=n[0]===73&&n[1]===73,r=n[0]===77&&n[1]===77;if(!e&&!r)return null;let u=(a,h)=>e?b(a,h):A(a,h),l=(a,h)=>e?w(a,h):m(a,h);if(u(n,2)!==42)return null;let c=l(n,4),i=await t.at(c,2);if(i.length<2)return null;let s=u(i,0);if(s<1||s>4096)return null;let o=await t.at(c+2,s*12),f=0,x=0;for(let a=0;a<s;a++){let h=a*12;if(h+12>o.length)break;let y=u(o,h),R=u(o,h+2)===3?u(o,h+8):l(o,h+8);y===256?f=R:y===257&&(x=R)}return d(f,x)}async function D(t,n){let e=await t.at(0,8);if(e.length<8||e[0]!==118||e[1]!==47||e[2]!==49||e[3]!==1)return null;let r=8,u=Math.min(n,1<<20);for(;r<u;){let l=await t.at(r,512);if(l.length===0)return null;let c=l.indexOf(0);if(c<=0)return null;let i=g(l,0,c),s=l.subarray(c+1).indexOf(0);if(s<0)return null;let o=c+1+s+1;if(o+4>l.length)return null;let f=w(l,o),x=r+o+4;if(i==="dataWindow"){if(f<16)return null;let a=await t.at(x,16);return a.length<16?null:d(P(a,8)-P(a,0)+1,P(a,12)-P(a,4)+1)}r=x+f}return null}async function G(t){let n=await t.at(0,4);if(n.length<4)return null;let e=g(n,0,4),r=e==="SDPX";if(!r&&e!=="XPDS")return null;let u=await t.at(772,8);return u.length<8?null:d(r?m(u,0):w(u,0),r?m(u,4):w(u,4))}var H={png:L,jpg:W,jpeg:W,gif:C,bmp:I,webp:j,avif:S,heic:S,heif:S,psd:N,tga:X,tif:v,tiff:v,exr:D,dpx:G};async function K(t,n){let e=H[(t??"").toLowerCase()];if(!e)return null;try{return await e(new _(n),n.size)}catch{return null}}export{B as a,k as b,V as c,q as d,Y as e,J as f,K as g};
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{Ib as R,Jb as S,Kb as E,Lb as L,Mb as A,Nb as P,Ob as T,Pb as M,Qb as D,Rb as N,Sb as z,vb as C}from"./chunk-LYM757KG.js";import{Y as l,s as j}from"./chunk-G3SZDPDS.js";async function H(r,t){let d=t.media_root?[t.media_root]:await D();if(!d.length)throw new Error("no media_root given and no remembered locations \u2014 pass the folder to link from");for(let e of d)try{if(!(await j(e)).isDirectory)throw 0}catch{throw new Error(`media_root is not a folder on this machine: ${e}`)}let i=S(r,{ref_ids:t.ref_ids,lane:t.lane,reset:t.reset});if(!i.length)return{session:r,changed:!1,note:"",text:"nothing in scope: every reference in scope is already linked (use reset=true to re-point) or the ids/lane matched nothing"};if(t.reset)for(let e of i)e.binding_state="unbound",delete e.coverage_reason;let g=[],w=!1,m=[];for(let e of d)if(t.gather==="path")for(let n of i){let c=n.local_path??n.target_url??"",o=c?await L(e,c):null;o?g.push(o):m.push(`${n.id} ${l(c)}: not at its recorded path under ${e}`)}else{let n=await E(e,i,t.cap);g.push(...n.paths),w||=n.capped}let{refs:_,failed:u}=await A([...new Set(g)]);t.remember&&t.media_root&&await N(t.media_root);let b=new Set(i.map(e=>e.id)),p=C(r,_,b);if(p.splits.length){r=p.session;let e=new Set([...b,...p.splits.flatMap(n=>n.into)]);i=(r.media_references??[]).filter(n=>e.has(n.id));for(let n of p.splits){let c=o=>l(i.find(q=>q.id===o)?.target_url??o);m.push(`split ${n.ref_id} across ${n.into.length} section file(s): ${n.into.map(c).join(", ")}`)}}let a=R(t.criteria),s=P(r,i,_,a,t.tolerances),I=t.criteria?.picture?await T(r,s):[],k=[`scope: ${i.length} reference(s)${t.lane!=="both"?` (${t.lane} lane)`:""}${t.ref_ids?` (zone of ${t.ref_ids.length})`:""}; gather=${t.gather} under ${d.join(", ")}: ${_.length} candidate clip(s)${w?` (CAPPED at ${t.cap} \u2014 narrow the folder)`:""}`,`criteria: ${[...Object.entries(a).filter(([,e])=>e===!0).map(([e])=>e),...t.criteria?.picture?["picture"]:[]].join(", ")}${a.fileName?` (${a.fileNameMode})`:""}${a.fileExtensions?`; ext ${a.fileExtensions}`:""}; timecode containment + fps always on`,...u.length?[`could not probe ${u.length}: ${u.slice(0,5).join("; ")}`]:[],...m.slice(0,20),...I.slice(0,40)];if(t.dry_run)return{session:r,changed:!1,note:"",text:[...k,z(r,s,{compare:t.compare}),"(dry run \u2014 nothing changed; pass accept=[{ref_id,candidate_id}] to commit chosen rows, or run again without dry_run to apply every matched row)"].join(`
4
- `)};let f,h=[];if(t.accept?.length){f=[];for(let e of t.accept){let n=s.rows.find(o=>o.ref_id===e.ref_id);n&&(n.candidate?.id===e.candidate_id||n.alternatives.some(o=>o.id===e.candidate_id))?f.push(e):h.push(`${e.ref_id} \u2192 ${e.candidate_id}: not a proposed match or alternative for that reference`)}}else f=s.rows.filter(e=>e.status==="matched"&&e.candidate).map(e=>({ref_id:e.ref_id,candidate_id:e.candidate.id}));let $=M(r,s,f),y=$.session.media_references??[],v=y.filter(e=>i.some(n=>n.id===e.id)&&e.binding_state==="linked").length,O=$.applied,x=y.filter(e=>i.some(n=>n.id===e.id)&&e.binding_state!=="linked").map(e=>` - ${e.id} ${l(e.target_url??"")}: ${e.coverage_reason??(s.rows.find(n=>n.ref_id===e.id)?.status==="ambiguous"?"ambiguous \u2014 pick one with accept":"no file matched")}`),U=[...k,`Linked ${v} of ${i.length}${h.length?`; ${h.length} pick(s) vetoed`:""}`,...O.map(e=>`- ${e.ref_id}: ${l(e.before.path??"?")} \u2192 ${e.after.path}${e.warning?` \u26A0 ${e.warning}`:""}`),...h.map(e=>` \u2717 ${e}`),...x.length?["unresolved:",...x]:[]].join(`
5
- `);return{session:$.session,changed:!0,note:`relink ${t.gather} ${d[0]} (${v}/${i.length})`,text:U}}export{H as a};
@@ -1,8 +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 Q,d as mt}from"./chunk-6NLB5TZ2.js";import{a as j}from"./chunk-PHAMF4JF.js";import{$ as y,A as P,K as pt,m as R,x as S,z as T}from"./chunk-G3SZDPDS.js";import{createHash as qt}from"node:crypto";import{open as Zt}from"node:fs/promises";var Mt=new Uint16Array(256);for(let e=0;e<256;e++){let t=0,n=e<<8;for(let r=0;r<8;r++)(t^n)&32768?t=t<<1^4129:t=t<<1,n=n<<1;Mt[e]=t&65535}var tt=0,wt=2;var ne=Date.UTC(2020,0,1,0,0,0);function ht(e,t,n,r,o,s,i,a,g,c,u,_,p,w,d,b){let F=z(o,l.__wbindgen_export3,l.__wbindgen_export4),A=x,v=rt(i,l.__wbindgen_export3),W=x,Dt=l.udf_add_file_stream(f(e),f(t),f(n),f(r),F,A,s,v,W,a,g,c,u,_,p,w,d,b);return M(Dt)}function oe(e,t,n,r){let o,s;try{let p=l.__wbindgen_add_to_stack_pointer(-16),w=z(e,l.__wbindgen_export3,l.__wbindgen_export4),d=x,b=z(t,l.__wbindgen_export3,l.__wbindgen_export4),F=x,A=z(n,l.__wbindgen_export3,l.__wbindgen_export4),v=x;l.udf_build_layout(p,w,d,b,F,A,v,r);var i=h().getInt32(p+0,!0),a=h().getInt32(p+4,!0),g=h().getInt32(p+8,!0),c=h().getInt32(p+12,!0),u=i,_=a;if(c)throw u=0,_=0,M(g);return o=u,s=_,C(u,_)}finally{l.__wbindgen_add_to_stack_pointer(16),l.__wbindgen_export5(o,s,1)}}function xt(e,t,n,r,o,s,i){let a=z(o,l.__wbindgen_export3,l.__wbindgen_export4),g=x,c=rt(i,l.__wbindgen_export3),u=x,_=l.udf_fill_sparse_stream(f(e),f(t),f(n),f(r),a,g,s,c,u);return M(_)}function ie(){let e,t;try{let o=l.__wbindgen_add_to_stack_pointer(-16);l.udf_last_panic(o);var n=h().getInt32(o+0,!0),r=h().getInt32(o+4,!0);return e=n,t=r,C(n,r)}finally{l.__wbindgen_add_to_stack_pointer(16),l.__wbindgen_export5(e,t,1)}}function St(e,t){let n=l.udf_parse_stream(f(e),f(t));return M(n)}function se(e){let t,n;try{let s=l.__wbindgen_add_to_stack_pointer(-16),i=rt(e,l.__wbindgen_export3),a=x;l.udf_read_conform_iuvd(s,i,a);var r=h().getInt32(s+0,!0),o=h().getInt32(s+4,!0);return t=r,n=o,C(r,o)}finally{l.__wbindgen_add_to_stack_pointer(16),l.__wbindgen_export5(t,n,1)}}function Lt(){return{__proto__:null,"./udf_bg.js":{__proto__:null,__wbg___wbindgen_is_function_acc5528be2b923f2:function(t){return typeof m(t)=="function"},__wbg___wbindgen_is_undefined_721f8decd50c87a3:function(t){return m(t)===void 0},__wbg___wbindgen_number_get_1cc01dd708740256:function(t,n){let r=m(n),o=typeof r=="number"?r:void 0;h().setFloat64(t+8,O(o)?0:o,!0),h().setInt32(t+0,!O(o),!0)},__wbg___wbindgen_throw_ea4887a5f8f9a9db:function(t,n){throw new Error(C(t,n))},__wbg__wbg_cb_unref_33c39e13d73b25f6:function(t){m(t)._wbg_cb_unref()},__wbg_call_0e855b388e315e17:function(){return et(function(t,n,r,o){let s=m(t).call(m(n),m(r),m(o));return f(s)},arguments)},__wbg_call_5575218572ead796:function(){return et(function(t,n,r){let o=m(t).call(m(n),m(r));return f(o)},arguments)},__wbg_call_8e98ed2f3c86c4b5:function(){return et(function(t,n){let r=m(t).call(m(n));return f(r)},arguments)},__wbg_error_2b5d73c4c4804cfd:function(t,n){console.error(C(t,n))},__wbg_length_589238bdcf171f0e:function(t){return m(t).length},__wbg_new_81880fb5002cb255:function(t){let n=new Uint8Array(m(t));return f(n)},__wbg_new_from_slice_543b875b27789a8f:function(t,n){let r=new Uint8Array(yt(t,n));return f(r)},__wbg_new_no_args_2d7333de60de5ac7:function(t,n){let r=new Function(C(t,n));return f(r)},__wbg_new_typed_00a409eb4ec4f2d9:function(t,n){try{var r={a:t,b:n},o=(i,a)=>{let g=r.a;r.a=0;try{return $t(g,r.b,i,a)}finally{r.a=g}};let s=new Promise(o);return f(s)}finally{r.a=0}},__wbg_prototypesetcall_d721637c7ca66eb8:function(t,n,r){Uint8Array.prototype.set.call(yt(t,n),m(r))},__wbg_queueMicrotask_1c9b3800e321a967:function(t){let n=m(t).queueMicrotask;return f(n)},__wbg_queueMicrotask_311744e534a929a3:function(t){queueMicrotask(m(t))},__wbg_resolve_d82363d90af6928a:function(t){let n=Promise.resolve(m(t));return f(n)},__wbg_static_accessor_GLOBAL_THIS_2fee5048bcca5938:function(){let t=typeof globalThis>"u"?null:globalThis;return O(t)?0:f(t)},__wbg_static_accessor_GLOBAL_ce44e66a4935da8c:function(){let t=typeof global>"u"?null:global;return O(t)?0:f(t)},__wbg_static_accessor_SELF_44f6e0cb5e67cdad:function(){let t=typeof self>"u"?null:self;return O(t)?0:f(t)},__wbg_static_accessor_WINDOW_168f178805d978fe:function(){let t=typeof window>"u"?null:window;return O(t)?0:f(t)},__wbg_then_05edfc8a4fea5106:function(t,n,r){let o=m(t).then(m(n),m(r));return f(o)},__wbg_then_591b6b3a75ee817a:function(t,n){let r=m(t).then(m(n));return f(r)},__wbindgen_cast_0000000000000001:function(t,n){let r=zt(t,n,jt);return f(r)},__wbindgen_cast_0000000000000002:function(t){return f(t)},__wbindgen_cast_0000000000000003:function(t,n){let r=C(t,n);return f(r)},__wbindgen_object_clone_ref:function(t){let n=m(t);return f(n)},__wbindgen_object_drop_ref:function(t){M(t)}}}}function jt(e,t,n){try{let s=l.__wbindgen_add_to_stack_pointer(-16);l.__wasm_bindgen_func_elem_252(s,e,t,f(n));var r=h().getInt32(s+0,!0),o=h().getInt32(s+4,!0);if(o)throw M(r)}finally{l.__wbindgen_add_to_stack_pointer(16)}}function $t(e,t,n,r){l.__wasm_bindgen_func_elem_266(e,t,f(n),f(r))}function f(e){N===E.length&&E.push(E.length+1);let t=N;return N=E[t],E[t]=e,t}var bt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>l.__wbindgen_export2(e.a,e.b));function Nt(e){e<1028||(E[e]=N,N=e)}function yt(e,t){return e=e>>>0,D().subarray(e/1,e/1+t)}var U=null;function h(){return(U===null||U.buffer.detached===!0||U.buffer.detached===void 0&&U.buffer!==l.memory.buffer)&&(U=new DataView(l.memory.buffer)),U}function C(e,t){return Wt(e>>>0,t)}var $=null;function D(){return($===null||$.byteLength===0)&&($=new Uint8Array(l.memory.buffer)),$}function m(e){return E[e]}function et(e,t){try{return e.apply(this,t)}catch(n){l.__wbindgen_export(f(n))}}var E=new Array(1024).fill(void 0);E.push(void 0,null,!0,!1);var N=E.length;function O(e){return e==null}function zt(e,t,n){let r={a:e,b:t,cnt:1},o=(...s)=>{r.cnt++;let i=r.a;r.a=0;try{return n(i,r.b,...s)}finally{r.a=i,o._wbg_cb_unref()}};return o._wbg_cb_unref=()=>{--r.cnt===0&&(l.__wbindgen_export2(r.a,r.b),r.a=0,bt.unregister(r))},bt.register(o,r,r),o}function rt(e,t){let n=t(e.length*1,1)>>>0;return D().set(e,n/1),x=e.length,n}function z(e,t,n){if(n===void 0){let a=B.encode(e),g=t(a.length,1)>>>0;return D().subarray(g,g+a.length).set(a),x=a.length,g}let r=e.length,o=t(r,1)>>>0,s=D(),i=0;for(;i<r;i++){let a=e.charCodeAt(i);if(a>127)break;s[o+i]=a}if(i!==r){i!==0&&(e=e.slice(i)),o=n(o,r,r=i+e.length*3,1)>>>0;let a=D().subarray(o+i,o+r),g=B.encodeInto(e,a);i+=g.written,o=n(o,r,i,1)>>>0}return x=i,o}function M(e){let t=m(e);return Nt(e),t}var H=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});H.decode();var Bt=2146435072,nt=0;function Wt(e,t){return nt+=t,nt>=Bt&&(H=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),H.decode(),nt=t),H.decode(D().subarray(e,e+t))}var B=new TextEncoder;"encodeInto"in B||(B.encodeInto=function(e,t){let n=B.encode(e);return t.set(n),{read:e.length,written:n.length}});var x=0,Ht,Gt,l;function Jt(e,t){return Gt=e,l=e.exports,Ht=t,U=null,$=null,l.__wbindgen_start(),l}async function Vt(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(o){if(e.ok&&n(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}async function G(e){if(l!==void 0)return l;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0&&(e=new URL("udf_bg.wasm",import.meta.url));let t=Lt();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Vt(await e,t);return Jt(n,r)}var ot=null;function Xt(e){return ot||(ot=(async()=>{if(e!==void 0)return G(e);if(typeof process<"u"&&process.versions?.node){let n="node:fs/promises",{readFile:r}=await import(n),o=await r(new URL("./wasm/udf_bg.wasm",import.meta.url));return G({module_or_path:o})}let{default:t}=await import("./udf_bg-B37GKRIH.js");return G({module_or_path:t})})()),ot}function J(){return Xt()}function V(e){return(t,n)=>e.read(t,n)}function it(e){return(t,n)=>e.write(t,n)}function X(e){return()=>e.getSize()}function st(e){return t=>e.setSize?e.setSize(t):Promise.resolve()}async function It(e){await J();let t=JSON.parse(await St(V(e),X(e)));if(t.error)throw new Error(t.error);let n=null;if(t.iuvdPayload)try{n=JSON.parse(t.iuvdPayload)}catch{}let r=null,o=t.files.find(s=>s.name===".i2o-manifest.json");if(o&&o.extents.length>0&&o.extents[0].type===tt){let s=o.extents[0].position,i=await e.read((t.partitionStartSector+s)*2048,o.totalSize);try{r=JSON.parse(new TextDecoder().decode(i))}catch{}}return{totalSectors:t.totalSectors,partitionStartSector:t.partitionStartSector,partitionLength:t.partitionLength,volumeName:t.volumeName,files:t.files,manifest:r,iuvdPayload:n,rootIcbSector:t.rootIcbSector,rootDataSector:t.rootDataSector,rootDataLength:t.rootDataLength,rootDataSectors:t.rootDataSectors,vdsStartSector:t.vdsStartSector,partitionDescVdsSector:t.partitionDescVdsSector}}function me(e){let t=[],n=0;for(let r of e.extents)r.type===wt&&t.push({offset:n,length:r.length}),n+=r.length;return t}function At(e){let t=[],n=0;for(let r of e.extents)r.type===tt&&t.push({offset:n,length:r.length,imageSector:r.position}),n+=r.length;return t}async function we(e,t,n,r,o){return await J(),await xt(V(e),it(e),X(e),st(e),n,r,o),It(e)}async function be(e,t,n,r,o,s=0){await J();let i=new Date,a=!!(o&&o.length>0);return await ht(V(e),it(e),X(e),st(e),n,r,a?o:new Uint8Array(0),a,s,i.getFullYear(),i.getMonth()+1,i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),-i.getTimezoneOffset()),It(e)}var Y=1<<20,k=5*Y,Et=5*1024*Y,at=1e4,ct=8*Y,Kt=2048;function Ae(e,t,n=Math.max(16*Y,Math.ceil(e/(at-500)))){let r=[...t].filter(c=>c.len>0).sort((c,u)=>c.at-u.at),o=[];for(let c of r){let u=o[o.length-1];u&&c.at<u.at+u.len||(u&&u.at+u.len===c.at&&u.key===c.key&&u.offset+u.len===c.offset?u.len+=c.len:o.push({...c}))}let s=[],i=0;for(let c of o.filter(u=>u.len>=k))c.at>i&&s.push({at:i,len:c.at-i}),s.push({at:c.at,len:c.len,copy:c}),i=c.at+c.len;i<e&&s.push({at:i,len:e-i});let a=c=>c.reduce((u,_)=>{let p=u[u.length-1];return p&&!p.copy&&!_.copy?p.len+=_.len:u.push({..._}),u},[]);for(let c=!0;c;){c=!1,s=a(s);for(let u=0;u<s.length-1;u++){let _=s[u];if(_.len>=k)continue;let p=k-_.len,w=s[u+1],d=s[u-1];if(_.copy){delete _.copy,c=!0;break}w?.copy&&w.len-p>=k?(_.len+=p,w.at+=p,w.len-=p,w.copy={...w.copy,at:w.at,len:w.len,offset:w.copy.offset+p}):d?.copy&&d.len-p>=k?(d.len-=p,d.copy={...d.copy,len:d.len},_.at-=p,_.len+=p):w?.copy?delete w.copy:d?.copy&&delete d.copy,c=!0;break}}let g=[];for(let c of s){let u=c.copy?Math.min(Et,Math.max(n,k)):n;for(let _=c.at,p=c.at+c.len;_<p;){let w=Math.min(u,p-_);p-(_+w)>0&&p-(_+w)<k&&(w=p-_<=Et?p-_:w-k),g.push(c.copy?{kind:"copy",at:_,len:w,key:c.copy.key,offset:c.copy.offset+(_-c.at)}:{kind:"upload",at:_,len:w}),_+=w}}if(g.length>at)throw new Error(`the image needs ${g.length} pieces (S3 allows ${at})`);return g}function Ee(e,t,n,r){let o=[...r].sort((a,g)=>a.offset-g.offset),s=[],i=0;for(let a of o){let g=Math.min(a.offset,t);g>i&&s.push({at:i,len:g-i,key:e,offset:i}),i=Math.max(i,a.offset+a.length)}return i<Math.min(t,n)&&s.push({at:i,len:Math.min(t,n)-i,key:e,offset:i}),s}async function ve(e,t,n,r,o){let s=[];for(let i of t.files)for(let a of At(i)){let g=(t.partitionStartSector+a.imageSector)*Kt;for(let c=a.offset;c<a.offset+a.length;){let u=Math.min(a.offset+a.length,(Math.floor(c/ct)+1)*ct),_=g+(c-a.offset);s.push(o?.(_,u-c)??[qt("sha256").update(await e.read(_,u-c)).digest("hex"),_,u-c]),r?.(u-c),c=u}}return{v:1,block:ct,size:n,blocks:s}}function Te(e,t){let n=new Map;for(let o of t)for(let[s,i,a]of o.index.blocks)n.set(`${s}:${a}`,{key:o.key,offset:i});let r=[];for(let[o,s,i]of e.blocks){let a=n.get(`${o}:${i}`);a&&r.push({at:s,len:i,key:a.key,offset:a.offset})}return r}var vt=(e,t)=>`${Q().supabaseUrl}/functions/v1/${e}${t}`;async function lt(e,t,n={}){let r=await mt();if(!r)throw new Error("not signed in to conform.tools \u2014 run account_login");let o=await fetch(vt(e,t),{method:n.method??(n.body?"POST":"GET"),headers:{authorization:`Bearer ${r}`,apikey:Q().anonKey,...n.body?{"content-type":"application/json"}:{}},...n.body?{body:JSON.stringify(n.body)}:{},signal:AbortSignal.timeout(2e4)}),s=await o.text();if(!o.ok){let i=s;try{let a=JSON.parse(s);i=a.error?.message??a.message??a.error??s}catch{}throw o.status===404&&/Requested function was not found/i.test(String(i))?new Error(`${e} isn't deployed on ${new URL(vt(e,t)).host}: this server doesn't have that feature yet (an older server, or a staging/production mismatch)`):new Error(`${n.method??"GET"} ${t}: ${o.status} ${i}`)}return s?JSON.parse(s):{}}function Pe(e,t="org"){let n=`/v1/sessions/${e}/storage/multipart`,r=(o,s,i)=>lt("v1-sessions",o,{body:s,method:i});return{start:async o=>String((await r(`${n}/start`,{key:o,content_type:"application/x-iso9660-image"})).upload_id),partUrls:async(o,s,i,a)=>(await r(`${n}/${s}/part-urls`,{key:o,first_part:i,count:a})).parts,copyPart:async(o,s,i,a)=>String((await r(`${n}/${s}/copy-part`,{key:o,part_number:i,source_ref:{scheme:t,bucket:"i2o",key:a.key},byte_range:{offset:a.offset,length:a.length}})).etag),complete:async(o,s,i)=>{await r(`${n}/${s}/complete`,{key:o,parts:i})},abort:async(o,s)=>{await r(`${n}/${encodeURIComponent(s)}?key=${encodeURIComponent(o)}`,void 0,"DELETE")},readUrl:async o=>String((await r(`/v1/sessions/${e}/download-url`,{storage_path:o})).download_url)}}async function ut(e,t,n=4){for(let r=1;;r++)try{return await t()}catch(o){if(r>=n)throw new Error(`${e} failed after ${n} tries: ${o instanceof Error?o.message:o}`);await new Promise(s=>setTimeout(s,500*2**r))}}async function ke(e,t,n,r,o={}){let s=o.fetchFn??fetch,i=await e.start(t),a=n.reduce((d,b)=>d+b.len,0),g=new Array(n.length),c=0,u=0,_=new Map,p=async d=>(_.has(d)||(await e.partUrls(t,i,d+1,Math.min(100,n.length-d))).forEach((F,A)=>_.set(d+A,F)),_.get(d)),w=async d=>{let b=n[d];if(b.kind==="copy")g[d]=await ut(`copy piece ${d+1}`,()=>e.copyPart(t,i,d+1,{key:b.key,offset:b.offset,length:b.len}));else{let F=await r(b.at,b.len);g[d]=await ut(`upload piece ${d+1}`,async()=>{let A=await p(d),v=await s(A.upload_url,{method:A.method,headers:A.headers,body:F,signal:o.signal});if(!v.ok)throw _.delete(d),new Error(`${v.status} ${(await v.text()).slice(0,200)}`);let W=v.headers.get("etag");if(!W)throw new Error("the bucket returned no ETag (expose it in the bucket's CORS / response headers)");return W})}c+=b.len,o.onProgress?.(c,a)};try{await Promise.all(Array.from({length:Math.min(6,n.length)},async()=>{for(;u<n.length;)o.signal?.throwIfAborted(),await w(u++)})),await ut("complete",()=>e.complete(t,i,g.map((d,b)=>({part_number:b+1,etag:d}))))}catch(d){throw await e.abort(t,i).catch(()=>{}),d}return{uploaded:n.filter(d=>d.kind==="upload").reduce((d,b)=>d+b.len,0),copied:n.filter(d=>d.kind==="copy").reduce((d,b)=>d+b.len,0),pieces:n.length}}function Fe(e){let t=Zt(e,"r");return{read:async(n,r)=>{let o=new Uint8Array(r);return await(await t).read(o,0,r,n),o},close:async()=>{await(await t).close()}}}var gt="local",Pt=/^[A-Za-z0-9_-]{1,64}$/,I=e=>{if(!Pt.test(e))throw new j("invalid_args",`bad project_id '${e}'`);return y(R(),"projects",e)},dt=(e,t={})=>lt("v1-projects",e,t),kt=e=>Number(/: (\d{3}) /.exec(String(e?.message))?.[1]??0);async function Ft(e){let t="",n={base:null,by:null};try{t=await S(y(I(e),"CONTEXT.md"))}catch{}try{n=JSON.parse(await S(y(I(e),"context.json")))}catch{}return{text:t,meta:n}}async function _t(e,t,n){await P(I(e)),await T(y(I(e),"CONTEXT.md"),t),await T(y(I(e),"context.json"),JSON.stringify(n))}var ft=async(e,t)=>(await _t(e,t.context,{base:t.context_updated_at,by:t.context_updated_by_name??null}),{text:t.context,updated_at:t.context_updated_at,updated_by:t.context_updated_by_name??null});async function Me(e){I(e);let t=await Ft(e);if(e===gt)return{text:t.text,updated_at:null,updated_by:null};if(t.meta.pending)try{return await Tt(e,t.text,t.meta.base)}catch(n){if(!(n instanceof j&&n.code==="context_conflict"))return{text:t.text,updated_at:t.meta.base,updated_by:t.meta.by,offline:!0,pending:!0};let r=n.data?.current??{context:"",context_updated_at:null},o=`${r.context.trimEnd()}
4
-
5
- ## Saved offline on this machine (merge into the notes above)
6
-
7
- ${t.text.trim()}
8
- `;return await Tt(e,o,r.context_updated_at).catch(()=>ft(e,r))}try{return await ft(e,(await dt(`/v1/projects/${e}`)).project)}catch(n){if(kt(n))throw n;return{text:t.text,updated_at:t.meta.base,updated_by:t.meta.by,offline:!0}}}async function Tt(e,t,n){if(I(e),e===gt)return await _t(e,t,{base:null,by:null}),{text:t,updated_at:null,updated_by:null};let r=await Ft(e),o=n===void 0?r.meta.base:n;try{return await ft(e,(await dt(`/v1/projects/${e}`,{method:"PATCH",body:{context:t,context_base:o}})).project)}catch(s){let i=kt(s);if(i===409){let a=(await dt(`/v1/projects/${e}`)).project;throw new j("context_conflict",`someone saved this project's context${a.context_updated_by_name?` (${a.context_updated_by_name})`:""} since it was read; read it again and save on top of theirs`,{current:a})}if(i)throw s;return await _t(e,t,{...r.meta,base:o,pending:!0}),{text:t,updated_at:o,updated_by:r.meta.by,offline:!0,pending:!0}}}var Ut=()=>y(R(),"current-project.json");async function Ct(){try{let e=JSON.parse(await S(Ut()));return e?.id?e:null}catch{return null}}async function Le(e){await P(R()),await T(Ut(),JSON.stringify(e&&e.id!==gt?e:{}))}async function je(e,t){if(!Pt.test(t))throw new j("invalid_args",`bad session_id '${t}'`);let n=y(I(e),"sessions.json"),r=[];try{r=JSON.parse(await S(n))}catch{}await P(I(e)),await T(n,JSON.stringify([...r.filter(o=>o!==t),t]))}async function $e(e){let t=new Set,n=[];try{n=JSON.parse(await S(y(I(e),"sessions.json")))}catch{}for(let r of n.toReversed())t.add(r);for(let r of await Rt().catch(()=>[]))r.project_id===e&&t.add(r.id);return[...t]}var Qt=R(),L=y(Qt,"sessions"),q=new Map,te=/^[0-9a-f]{8}$/;function K(e,t){if(!te.test(e))throw new Error(`not a session id: ${JSON.stringify(e).slice(0,40)}`);if(t!==void 0&&!/^[a-z0-9_-]{1,32}$/.test(t))throw new Error(`bad session extra kind: ${t}`);return y(L,t===void 0?`${e}.json`:`${e}.${t}.json`)}function ee(){let e=new Uint8Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}async function We(e,t,n){let r=new Date().toISOString(),o=await Ct(),s={id:ee(),source_path:t,source_format:n,created_at:r,updated_at:r,history:[],...o?{project_id:o.id}:{},session:e};return q.set(s.id,s),Z=s.id,await Ot(s),s}var Z,He=()=>Z;async function Ge(e){let t=q.get(e);if(t)return Z=e,t;try{let n=await S(K(e)),r=JSON.parse(n);return r.id=e,q.set(e,r),Z=e,r}catch{throw new Error(`unknown session_id '${e}' \u2014 call timeline_read first, or timeline_sessions to list`)}}async function Je(e,t){e.updated_at=new Date().toISOString(),e.history.push(t),q.set(e.id,e),await Ot(e)}async function Rt(){await P(L);let e=[];for await(let t of pt(L))if(!(!t.name.endsWith(".json")||t.name.split(".").length>2))try{let n=JSON.parse(await S(y(L,t.name))),{session:r,...o}=n;e.push(o)}catch{}return e.sort((t,n)=>n.updated_at.localeCompare(t.updated_at))}async function Ot(e){await P(L),await T(K(e.id),JSON.stringify(e))}async function Ve(e,t,n){await P(L),await T(K(e,t),JSON.stringify(n))}async function Xe(e,t){try{return JSON.parse(await S(K(e,t)))}catch{return null}}export{ne as a,oe as b,ie as c,se as d,J as e,It as f,me as g,At as h,we as i,be as j,ct as k,Ae as l,Ee as m,ve as n,Te as o,lt as p,Pe as q,ke as r,Fe as s,gt as t,Me as u,Tt as v,Ct as w,Le as x,je as y,$e as z,We as A,He as B,Ge as C,Je as D,Rt as E,Ve as F,Xe as G};
@@ -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 F}from"./chunk-PHAMF4JF.js";import{$ as i,A as m,B as v,D as R,E as g,F as D,K as $,Y as k,m as b,s as x,t as p,x as S,z as _}from"./chunk-G3SZDPDS.js";var A="_originalframes",y="zAPPLIED_PATCHES",u=t=>t.replace(/[\\/][^\\/]+[\\/]?$/,""),T=()=>i(b(),"move-undo");async function P(t){let n=[];for await(let a of $(t))a.isFile&&!a.name.startsWith(".")&&n.push(a.name);return n.sort()}async function O(t){let n=[];for await(let a of $(u(t)))a.isDirectory&&/patch/i.test(a.name)&&a.name!==y&&n.push(a.name);return n.sort()}async function C(t,n){let a=new Set(await P(t)),e=[];for(let r of n){let s=i(u(t),r);if(await p(s))for(let w of await P(s))e.push({file:w,folder:r,replaces:a.has(w)})}return e}async function j(t,n,a){if(!await p(t)||!(await x(t)).isDirectory)throw new F("invalid_args",`not a folder: ${t}`);let e=u(t),r=[],s=[];for(let o of await C(t,n)){if(a&&!a.has(`${o.folder}/${o.file}`))continue;if(!o.replaces){r.push(`${o.file}: not in the sequence`);continue}let f=i(t,o.file),c=i(e,o.folder,o.file),l=`${t}${A}`,d=i(l,o.file);for(let h=1;await p(d);h++)d=i(`${t}${A}${String(h).padStart(2,"0")}`,o.file);await m(u(d));try{await g(f,d)}catch(h){r.push(`${o.file}: ${h.message}`);continue}try{await R(c,f)}catch(h){await g(d,f).catch(()=>{}),r.push(`${o.file}: ${h.message}`);continue}s.push({file:o.file,backup:d,patch_src:c,applied:c,folder:o.folder}),l=""}let w=[];if(s.length){let o=i(e,y);await m(o);for(let f of new Set(s.map(c=>c.folder))){let c=i(o,f);for(let l=1;await p(c);l++)c=i(o,`${f}_${l}`);try{await g(i(e,f),c),w.push({from:i(e,f),to:c});for(let l of s)l.folder===f&&(l.applied=i(c,l.file))}catch(l){r.push(`${f}: not filed under ${y} (${l.message})`)}}}if(!s.length)return{patched:0,errors:r};let E=`files-${Date.now().toString(36)}`;return await m(T()),await _(i(T(),`${E}.json`),JSON.stringify({patch:!0,sequence:t,entries:s.map(({folder:o,...f})=>f),folders:w})),{patched:s.length,errors:r,undo_id:E}}async function J(t){let n=[];for(let e of t.folders)await p(e.to)&&!await p(e.from)&&await g(e.to,e.from).catch(r=>n.push({path:e.to,error:r.message}));let a=0;for(let e of t.entries){let r=i(t.sequence,e.file);if(await p(e.backup))try{await p(r)&&await v(r),await g(e.backup,r),a++}catch(s){n.push({path:r,error:s.message})}}for(let e of new Set([...t.entries.map(r=>u(r.backup)),...t.folders.map(r=>u(r.to))]))if(await p(e)&&!(await P(e)).length){let r=!0;for await(let s of $(e)){r=!1;break}r&&await D(e).catch(()=>{})}return{restored:a,failed:n}}var L=t=>k(t),U=async t=>JSON.parse(await S(t));export{A as a,y as b,O as c,C as d,j as e,J as f,L as g,U as h};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{Tb as D,Ub as F,Vb as N}from"./chunk-LYM757KG.js";import{i as j}from"./chunk-NXJZXXC2.js";import{$ as _,A as M,D as C,F as R,G as T,J as q,K as L,N as w,Y as b,_ as k,ba as I,g as y,m as O,r as S,s as A,t as x,u as P,x as H,z as E}from"./chunk-G3SZDPDS.js";var B=16e3,h=class extends Error{constructor(t,i){super(i);this.code=t}},$=class d{constructor(e,t=j,i=B){this.spec=e;this.bridge=t;this.waitMs=i;this.renders=new Map;this.host=e.host,e.items&&(this.items=n=>this.modelItems(n??{}))}async peer(){let e=await(await this.bridge()).waitFor(this.host,this.waitMs);if(!e)throw new h("not_connected",`${this.host}: the conform.tools plugin in ${this.spec.label} is not connected. ${this.spec.setup}`);return e}async needs(e){let t=await this.peer();if(!t.capabilities.includes(e))throw new h("panel_old",`${this.host}: the conform.tools plugin open in ${this.spec.label} ${t.version||""} has no ${e} (an older plugin); update it (${this.spec.setup})`);return t}async ask(e,t={},i){return await this.peer(),await(await this.bridge()).request(this.host,e,t,i)}static{this.announced=(e,t)=>e.optional_verbs.includes(t)}async support(){let e={ok:!1,reason:"the renderplugin is a DaVinci Resolve plugin"},t;try{t=await(await this.bridge()).waitFor(this.host,Math.min(3e3,this.waitMs))}catch(s){let a={ok:!1,reason:s instanceof Error?s.message:String(s)};return{export:a,open:a,render:a,markers:a,renderplugin:e}}if(!t){let s={ok:!1,reason:`the conform.tools plugin in ${this.spec.label} is not connected`,setup:this.spec.setup};return{export:s,open:s,render:s,markers:s,renderplugin:e}}let i=(s,a)=>s?{ok:!0}:{ok:!1,reason:`this plugin version has no ${a}`},n=t.capabilities;return{export:i(n.includes("timeline_read")||n.includes("timeline_write"),"timeline_read"),open:i(d.announced(t,"timeline_write.import_file"),"timeline_write.import_file"),render:i(n.includes("render"),"render"),markers:i(n.includes("markers"),"markers"),renderplugin:e}}async current(){let e=await this.ask("session.current_project");if(!e)return{project:"",timelines:[],timeline:""};let t=await this.ask("session.timeline_count",{project:e}),i=[];for(let s=1;s<=t;s++){let a=await this.ask("session.timeline_by_index",{project:e,index:s});a&&i.push(await this.ask("session.name",{handle:a}))}let n=await this.ask("session.current_timeline",{project:e});return{project:await this.ask("session.name",{handle:e}),timelines:i,timeline:n?await this.ask("session.name",{handle:n}):""}}async project(e={}){let t=await this.current();return{project:t.project,timeline:e.timeline??t.timeline,timelines:t.timelines,tracks:[],jobs:[],found:{},pool:{path:"",clips:0,folders:[]}}}async sequence(e){let t=await this.ask("session.current_project");if(!t)throw new h("no_project",`${this.host}: no project is open`);if(!e){let s=await this.ask("session.current_timeline",{project:t});if(!s)throw new h("no_timeline",`${this.host}: no timeline is active`);return{project:t,seq:s,name:await this.ask("session.name",{handle:s})}}let i=await this.ask("session.timeline_count",{project:t}),n=[];for(let s=1;s<=i;s++){let a=await this.ask("session.timeline_by_index",{project:t,index:s});if(!a)continue;let p=await this.ask("session.name",{handle:a});if(p===e)return{project:t,seq:a,name:p};n.push(p)}throw new h("not_found",`${this.host}: no timeline named "${e}" (have: ${n.join(", ")})`)}async model(e){let{project:t,seq:i}=await this.sequence(e);return await this.ask("timeline_read.model",{timeline:i,project:t},12e4)}async export(e){if(!e.out_path)throw new h("usage",`${this.host}: export needs out_path`);let t=await this.peer(),{project:i,seq:n,name:s}=await this.sequence(e.timeline),a=await this.ask("session.name",{handle:i}),p=r=>d.announced(t,r),m=e.out_path,c,l=[];if(p("timeline_write.export_otio")||p("timeline_write.export_xml")){let r=p("timeline_write.export_otio"),o=await this.ask(r?"timeline_write.export_otio":"timeline_write.export_xml",{project:i,timeline:n,path:e.out_path},12e4);if(c=o.format??(r?"otio":"xmeml"),o.ok===!1)throw new h("export_failed",`${this.host}: ${this.spec.label} did not write ${e.out_path}${o.errors?.length?` (${o.errors.join("; ")})`:""}`);o.path&&o.path!==e.out_path&&(m=await this.adopt(o.path,e.out_path)),l=o.warnings??[]}else if(p("timeline_read.export_file")){let r=await this.ask("timeline_read.export_file",{timeline:n,fmt:"otio",path:e.out_path},12e4);if(!r)throw new h("export_failed",`${this.host}: ${this.spec.label} exported no OTIO`);c="otio",r!==e.out_path&&(m=await this.adopt(r,e.out_path))}else{await this.needs("timeline_read");let r=await this.ask("timeline_read.model",{timeline:n,project:i},12e4),o=J(r);await E(e.out_path,JSON.stringify(o.otio)),c="otio",l=o.notes}if(!D.includes(c))throw new h("export_failed",`${this.host}: ${this.spec.label} exported ${c}, which the engine does not read (${m})`);if(!await P(m)||(await A(m)).size===0)throw new h("export_failed",`${this.host}: ${this.spec.label} did not write ${m}`);return{path:m,format:c,project:a,timeline:s,...l.length?{notes:l}:{}}}async adopt(e,t){let i=k(e)&&k(e)!==k(t)?t.slice(0,t.length-k(t).length)+k(e):t;if(await C(e,i),!F(i))throw new h("export_failed",`${this.host}: ${this.spec.label} exported ${b(e)}, which the engine does not read`);return i}async open(e){if(e.into==="scratch")throw new h("unsupported",`${this.host}: opening into a scratch project is not supported; the import lands in the open project`);let t=await this.peer();if(!d.announced(t,"timeline_write.import_file"))throw new h("unsupported",`${this.host}: this conform.tools plugin cannot import timelines (${this.spec.setup})`);let i=await this.ask("session.current_project");if(!i)throw new h("no_project",`${this.host}: no project is open`);let n=await this.ask("timeline_write.import_file",{project:i,path:e.path,sequences:null},3e5);if(!n.ok)throw new h("import_failed",`${this.host}: ${this.spec.label} did not import ${e.path}${n.issues?.length?` (${n.issues.join("; ")})`:""}`);let s=[...n.issues??[]];return n.imported.length>1&&s.push(`imported ${n.imported.length} timelines: ${n.imported.map(a=>a.name).join(", ")}`),e.name&&s.push(`${this.spec.label} names imported timelines after the file's own; name was not applied`),e.media_dirs?.length&&s.push(`${this.spec.label} links media from the paths in the file; media_dirs was not used (relink with timeline_relink before writing)`),{project:await this.ask("session.name",{handle:i}),timeline:n.imported[0]?.name??b(e.path),notes:s,restored:!e.stay,...n.bin?{folder:n.bin}:{}}}async modelItems(e){let t=await this.model(e.timeline),i=[...e.kind==="audio"?[]:t.items.map(n=>({kind:"video",track:n.track,start:n.start-t.start_frame,end:n.end-t.start_frame,id:n.handle?.$h??n.clip_id??"",name:n.name??"",color:n.color??"",flags:n.flags??[],enabled:n.enabled??!0,file:n.file_path})),...e.kind==="video"?[]:(t.audio_items??[]).map(n=>({kind:"audio",track:n.track,start:n.start-t.start_frame,end:n.end-t.start_frame,id:"",name:n.name??"",file:n.file_path??""}))].filter(n=>e.track===void 0||n.track===e.track);return{project:(await this.current()).project,timeline:t.timeline,start_frame:t.start_frame,fps:t.fps,items:i,color_groups:[],layers:1}}async apply(e){let t=e.ops.length>0&&e.ops.every(l=>l.op==="timeline_rename"&&(l.timeline||l.guid)),{project:i,seq:n,name:s}=await this.sequence(t?void 0:e.timeline),a=[],p=[],m=l=>l.op.startsWith("marker_")&&!l.item;for(let l=0;l<e.ops.length;){let r=l;for(;r<e.ops.length&&m(e.ops[r])===m(e.ops[l]);)r++;let o=e.ops.slice(l,r),u=m(o[0])?await this.markerOps(n,o):await this.clipOps(n,o,e.timeline);a.push(...u.results),p.unshift(...u.undo),l=r}let c=a.filter(l=>l.ok).length;return{project:await this.ask("session.name",{handle:i}),timeline:s,results:a,undo:p,applied:c,failed:a.length-c}}async clipOps(e,t,i){let n=await this.peer();if(n.capabilities.includes("edit"))return await this.ask("edit.apply",{timeline:e,ops:t},6e4+t.length*500);let s=(l,r)=>({op:l.op,ok:!1,detail:r});if(!n.capabilities.includes("item_meta"))return{results:t.map(l=>s(l,`${this.host}: clip edits are not reachable over this plugin`)),undo:[]};let a=await this.model(i),p=l=>l?"id"in l?{$h:l.id}:(l.kind??"video")!=="video"?null:a.items.find(r=>r.track===l.track&&r.start-a.start_frame===l.start)?.handle??null:null,m=[],c=[];for(let l of t){let r=p(l.item);try{if(!r)m.push(s(l,`no video item at ${JSON.stringify(l.item??null)}`));else if(l.op==="clip_color"){let o=await this.ask("item_meta.color",{handle:r}),u=l.color?await this.ask("item_meta.set_color",{handle:r,color:l.color}):await this.ask("item_meta.clear_color",{handle:r});m.push({op:l.op,ok:u}),u&&c.unshift({op:"clip_color",item:l.item,color:o})}else if(l.op==="enabled"&&d.announced(n,"item_meta.set_enabled")){let o=a.items.find(f=>f.handle?.$h===r.$h)?.enabled??!0,u=await this.ask("item_meta.set_enabled",{item:r,enabled:!!l.on});m.push({op:l.op,ok:u}),u&&c.unshift({op:"enabled",item:l.item,on:o})}else m.push(s(l,`${this.host}: '${l.op}' is not reachable over this plugin`))}catch(o){m.push(s(l,o instanceof Error?o.message:String(o)))}}return{results:m,undo:c}}async markerOps(e,t){let i=await this.peer(),n=r=>d.announced(i,r),s=new Map((await this.ask("markers.list",{target:e})).map(r=>[r.frame,r])),a=[],p=[],m=async r=>{let o=await this.ask("markers.add",{target:e,frame:r.frame,color:r.color??"",name:r.name??"",note:r.note??"",duration:r.duration??1,custom_data:r.custom_data??""});return o&&s.set(r.frame,{color:"",name:"",note:"",duration:1,...r}),o},c=async r=>{let o=await this.ask("markers.delete_at",{target:e,frame:r});return o&&s.delete(r),o},l=r=>({op:"marker_add",frame:r.frame,color:r.color,name:r.name,note:r.note,duration:r.duration,...r.custom_data?{data:r.custom_data}:{}});for(let r of t){let o=Number(r.frame);try{if(r.op==="marker_add"){let u=s.get(o);u&&await c(o);let f=await m({frame:o,color:r.color,name:r.name,note:r.note,duration:Number(r.duration??1),custom_data:r.data});a.push({op:r.op,ok:f}),f&&p.unshift(...u?[l(u)]:[],{op:"marker_delete",frame:o})}else if(r.op==="marker_update"){let u=s.get(o);if(!u){a.push({op:r.op,ok:!1,detail:`no marker at frame ${o}`});continue}let f=r.to_frame!==void 0?Number(r.to_frame):o,v={...u,frame:f,...r.color!==void 0?{color:String(r.color)}:{},...r.name!==void 0?{name:String(r.name)}:{},...r.note!==void 0?{note:String(r.note)}:{}},g=!0;n("markers.set_color")&&n("markers.set_text")&&n("markers.move")?(r.color!==void 0&&(g=await this.ask("markers.set_color",{target:e,frame:o,color:r.color})&&g),(r.name!==void 0||r.note!==void 0)&&(g=await this.ask("markers.set_text",{target:e,frame:o,name:r.name,note:r.note})&&g),f!==o&&(g=await this.ask("markers.move",{target:e,frame:o,to_frame:f})&&g),s.delete(o),s.set(f,v)):g=await c(o)&&await m(v),a.push({op:r.op,ok:g}),p.unshift({op:"marker_update",frame:f,color:u.color,name:u.name,note:u.note,...f!==o?{to_frame:o}:{}})}else if(r.op==="marker_delete"){let u=s.get(o),f=!!u&&await c(o);a.push({op:r.op,ok:f,...u?{}:{detail:`no marker at frame ${o}`}}),f&&u&&p.unshift(l(u))}else a.push({op:r.op,ok:!1,detail:`${this.host}: '${r.op}' is not reachable over this plugin`})}catch(u){a.push({op:r.op,ok:!1,detail:u instanceof Error?u.message:String(u)})}}return{results:a,undo:p}}async renderStart(e){if(await this.needs("render"),e.renderplugin)throw new h("unsupported","the renderplugin is a DaVinci Resolve plugin");if(e.disable_tracks?.length||e.audio_tracks?.length)throw new h("unsupported",`${this.host}: disable_tracks / audio_tracks are DaVinci Resolve's; pick a preset that renders what you need`);if(!e.preset)throw new h("usage",`${this.host}: preset is required: one of ${this.spec.label}'s export presets by name`);let{seq:t,name:i}=await this.sequence(e.timeline),n=e.name??i,s={purpose:"deliver",format:"preset",preset:e.preset,target_dir:e.target_dir,name:n,...e.range?{range:[e.range.in,e.range.out]}:{}},a=await this.ask("render.submit",{timeline:t,job:s});if(!a?.id)throw new h("render_refused",`${this.host}: ${a?.error??`${this.spec.label} refused the render`}`);if(!await this.ask("render.start",{job_ids:[a.id]}))throw new h("render_refused",`${this.host}: ${this.spec.label} did not start job ${a.id}`);return this.renders.set(a.id,{dir:e.target_dir,name:n}),{job_id:a.id,state:"queued",percent:0}}async renderStatus(e){let t=await this.ask("render.status",{job_id:e});if(!t)return{job_id:e,state:"failed",percent:0,error:`${this.host}: no render job ${e}`};let i={done:"complete",rendering:"rendering",queued:"queued",failed:"failed",cancelled:"cancelled"}[t.state]??"rendering",n={job_id:e,state:i,percent:Math.round(t.progress??(i==="complete"?100:0)),...t.error?{error:t.error}:{}};if(i==="complete"||i==="failed"||i==="cancelled"){let s=this.renders.get(e);i==="complete"&&s&&(n.outputs=await W(s.dir,s.name)),await this.ask("render.remove",{job_id:e}).catch(()=>!1),this.renders.delete(e)}return n}async renderCancel(e){return await this.ask("render.cancel",{job_id:e})?{job_id:e,state:"cancelled",percent:0}:{...await this.renderStatus(e),error:`${this.spec.label}'s running export cannot be cancelled from here; stop it in ${this.spec.label}`}}};async function W(d,e){let t=[];try{for await(let i of L(d))i.isFile&&i.name.startsWith(`${e}.`)&&t.push(_(d,i.name))}catch{}return t.sort()}function J(d){let e=(c,l)=>({OTIO_SCHEMA:"RationalTime.1",value:c,rate:l}),t=(c,l,r,o=r)=>({OTIO_SCHEMA:"TimeRange.1",start_time:e(c,r),duration:e(l,o)}),i=d.fps,n=d.tracks?.length?d.tracks:[...new Set(d.items.map(c=>c.track))].sort((c,l)=>c-l).map(c=>({index:c,enabled:!0,name:"",items:d.items.filter(l=>l.track===c)})),s=c=>(c.reversed?-1:1)*(c.speed||1)/(c.fps_factor||1),a=new Map;for(let c of d.items)if(c.file_path&&c.start_tc!=null&&c.src_abs_in!=null){let l=c.src_abs_in-c.start_tc+Math.ceil((c.end-c.start)*Math.abs(s(c))*(c.fps_factor||1));a.set(c.file_path,Math.max(a.get(c.file_path)??0,l))}let p=n.map(c=>{let l=d.start_frame,r=[];for(let o of[...c.items].sort((u,f)=>u.start-f.start)){if(o.start<l)continue;o.start>l&&r.push({OTIO_SCHEMA:"Gap.1",name:"",source_range:t(0,o.start-l,i)});let u=o.src_fps||i,f=o.start_tc!=null&&a.has(o.file_path)?o.start_tc:null,v=f!=null?o.src_abs_in:o.src_in??o.src_abs_in??0,g=s(o);r.push({OTIO_SCHEMA:"Clip.2",name:o.name??b(o.file_path||""),enabled:o.enabled!==!1,source_range:t(v,o.end-o.start,u,i),media_references:{DEFAULT_MEDIA:{OTIO_SCHEMA:"ExternalReference.1",name:b(o.file_path||""),target_url:o.file_path?`file://${o.file_path}`:"",...f!=null?{available_range:t(f,a.get(o.file_path),u)}:{},metadata:{}}},active_media_reference_key:"DEFAULT_MEDIA",effects:Math.abs(g-1)>1e-6?[{OTIO_SCHEMA:"LinearTimeWarp.1",name:"",effect_name:"LinearTimeWarp",time_scalar:g}]:[],markers:[],metadata:o.reel?{cmx_3600:{reel:o.reel}}:{}}),l=o.end}return{OTIO_SCHEMA:"Track.1",name:c.name||`V${c.index}`,kind:"Video",enabled:c.enabled!==!1,children:r,effects:[],markers:[],metadata:{}}}),m=[];return d.audio_items?.length&&m.push(`${d.audio_items.length} audio clip(s) not carried: the host's plugin reports no audio source times`),d.transitions?.length&&m.push(`${d.transitions.length} transition(s) not carried (cuts in their place)`),{otio:{OTIO_SCHEMA:"Timeline.1",name:d.timeline,global_start_time:e(d.start_frame,i),metadata:{},tracks:{OTIO_SCHEMA:"Stack.1",name:"tracks",children:p,effects:[],markers:[],metadata:{}}},notes:m}}var X=16e3;var G="Install the conform.tools panel (host_setup host=premiere action=install_panel), then in Premiere open Window > UXP Plugins > conform.tools. It connects by itself from then on.";var U=class extends ${constructor(t=j,i=X){super({host:"premiere",label:"Premiere Pro",setup:G},t,i);this.items=async(t={})=>{await this.needs("edit");let{seq:i}=await this.sequence(t.timeline),n=await this.ask("edit.items",{timeline:i,kind:t.kind,track:t.track},12e4),s=n.project_path?await K(n.project_path,n.timeline).catch(p=>({error:p instanceof Error?p.message:String(p)})):{error:"the project has never been saved"},a=0;if(!("error"in s))for(let p of n.items){let m=s.get(`${p.kind}:${p.track}:${p.start}:${Number(p.end)-Number(p.start)}`);m?Object.assign(p,m,{saved:!0}):(p.saved=!1,a++)}return{...n,color_groups:[],layers:1,..."error"in s?{saved_note:`saved project not read: ${s.error}`}:{unsaved_items:a}}};this.premiereRenders=new Map}async current(){let t=await this.ask("session.describe");return{project:t.project,timelines:t.timelines,timeline:t.current}}async liveMarkers(t){if(!$.announced(await this.peer(),"edit.markers"))return null;let{seq:i}=await this.sequence(t);return await this.ask("edit.markers",{timeline:i},12e4)}async model(t){return await super.model(t)}async projectClips(){return await this.needs("edit"),await this.ask("edit.project_clips",{},12e4)}async relinkClips(t){return await this.needs("edit"),await this.ask("edit.relink_clips",{items:t},6e4+t.length*2e3)}async cutIn(t,i){await this.needs("edit");let{seq:n}=await this.sequence(t);return await this.ask("edit.cut_in",{timeline:n,cuts:i},12e4+i.length*3e3)}async renderStart(t){if(t.range)throw new h("unsupported","premiere: a frame range is not supported yet; set in/out on the sequence in Premiere");if(!t.preset||!/\.epr$/i.test(t.preset))throw new h("usage","premiere: preset must be the path of a Media Encoder preset (.epr)");let{seq:i,name:n}=await this.sequence(t.timeline);await M(t.target_dir);let s=_(t.target_dir,`${t.name??n}.mov`),a=await this.ask("render.export_sequence",{timeline:i,output_path:s,preset_path:t.preset,queue:!1},6e4);if(!a.ok)throw new h("render_refused","premiere: Premiere refused the export");let p=a.job||`ppro-${Date.now()}`;return this.premiereRenders.set(p,s),{job_id:p,state:"rendering",percent:0}}async renderStatus(t){let i=await this.ask("render.progress"),n=i[t]??i.last,s=this.premiereRenders.get(t);return n?.event==="error"||n?.event==="onEncodeError"?{job_id:t,state:"failed",percent:0,error:String(n.data??"encode error")}:n?.event==="complete"||n?.event==="onEncodeComplete"||s&&await x(s)&&!n?{job_id:t,state:"complete",percent:100,...s?{outputs:[s]}:{}}:{job_id:t,state:"rendering",percent:typeof n?.data=="number"?Math.round(Number(n.data)*100):0}}async renderCancel(t){return{job_id:t,state:"cancelled",percent:0,error:"Premiere's export cannot be cancelled from here; cancel it in Premiere / Media Encoder"}}};async function K(d,e){let{session:t}=await N(d,"prproj"),i=t.timelines.find(s=>s.name===e),n=new Map;if(!i)throw new Error(`the saved project has no sequence "${e}" (saved before it was made?)`);for(let s of i.tracks)if(!(s.kind!=="Video"&&s.kind!=="Audio"))for(let a of s.items){if(a.kind==="gap"||a.kind==="transition")continue;let p=a;n.set(`${s.kind==="Video"?"video":"audio"}:${s.track_index}:${a.timeline_range.start.value}:${a.timeline_range.duration.value}`,{saved_id:a.id,...p.speed_factor!=null&&p.speed_factor!==1?{retime:p.speed_factor}:{},...p.speed_ramped?{ramped:!0}:{},...p.speed_reverse?{reversed:!0}:{},...a.kind==="nested"?{nested:!0}:{},...p.is_multicam?{multicam:!0}:{},...p.effects?.some(m=>/stabiliz/i.test(m.kind??""))?{stabilized:!0}:{},...p.effects?.length?{saved_effects:p.effects.map(m=>m.name??m.kind??"")}:{}})}return n}function z(d=y()){return d==="darwin"?"/Library/Application Support/Adobe/Adobe Desktop Common/RemoteComponents/UPI/UnifiedPluginInstallerAgent/UnifiedPluginInstallerAgent.app/Contents/MacOS/UnifiedPluginInstallerAgent":d==="win32"?"C:\\Program Files\\Common Files\\Adobe\\Adobe Desktop Common\\RemoteComponents\\UPI\\UnifiedPluginInstallerAgent\\UnifiedPluginInstallerAgent.exe":null}async function V(){for(let d of["./uxp-plugin/","./premiere-uxp/"]){let e=S(new URL(d,import.meta.url));if(await P(_(e,"manifest.json")))return e}throw new Error("premiere: the conform.tools panel is missing from this install")}async function Q(){return JSON.parse(await H(_(await V(),"manifest.json"))).version}async function oe(d=y()){let e=z(d);if(!e||!await x(e))return{installed:!1,listing:"Creative Cloud's plugin installer is not on this machine"};let t=await w(e,d==="win32"?["/list","all"]:["--list","all"],{timeoutMs:6e4}),i=t.stdout.split(`
4
- `).find(n=>/CONFORM\.TOOLS|conformtools/i.test(n));return{installed:!!i&&/enabled|installed/i.test(i),version:i?.match(/(\d+\.\d+\.\d+)\s*$/)?.[1],listing:t.stdout.trim()}}async function ae(d=y()){let e=z(d);if(!e||!await x(e))throw new Error("premiere: Creative Cloud's plugin installer (UnifiedPluginInstallerAgent) is not on this machine; install Creative Cloud");let t=await V(),i=await Q(),n=await q("conform-ccx-");for(let l of["manifest.json","index.html","index.js","lib","icons"])await T(_(t,l),_(n,l));let s=_(O(),"premiere");await M(s);let a=I(_(s,`conformtools-premiere-${i}.ccx`));await R(a);let p=d==="darwin"?await w("sh",["-c",`cd '${n.replace(/'/g,"'\\''")}' && zip -r -q -X '${a.replace(/'/g,"'\\''")}' manifest.json index.html index.js lib icons`]):await w("powershell",["-NoProfile","-Command",`Compress-Archive -Path '${n}\\*' -DestinationPath '${a.replace(/\.ccx$/,".zip")}' -Force; Move-Item -Force '${a.replace(/\.ccx$/,".zip")}' '${a}'`]);if(await R(n),!p.success)throw new Error(`premiere: could not package the panel: ${p.stderr.trim()}`);await w(e,d==="win32"?["/remove","conform.tools"]:["--remove","conform.tools"],{timeoutMs:12e4});let m=await w(e,d==="win32"?["/install",a]:["--install",a],{timeoutMs:18e4}),c=`${m.stdout}
5
- ${m.stderr}`.trim();if(!m.success||!/Installation Successful/i.test(c))throw new Error(`premiere: Adobe's installer refused the panel: ${c.split(`
6
- `).pop()}`);return{version:i,ccx:a,output:c}}export{$ as a,U as b,K as c,Q as d,oe as e,ae as f};
@@ -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{kc as a,lc as b,mc as c,nc as d,oc as e,pc as f,qc as g,rc as h,sc as i,tc as j,uc as k,vc as l,wc as m,xc as n}from"./chunk-LYM757KG.js";import"./chunk-IN6XVTUS.js";import"./chunk-DFQWQ3EA.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-B77ADB26.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-P3XI63Q2.js";import"./chunk-F4PHKOAS.js";import"./chunk-ISKNIQVO.js";import"./chunk-DKGGJM6Z.js";import"./chunk-THVX57I3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-VJN4UXFJ.js";import"./chunk-6NLB5TZ2.js";import"./chunk-64X5DLH5.js";import"./chunk-PHAMF4JF.js";import"./chunk-G3SZDPDS.js";import"./chunk-PSANHDZM.js";export{j as ASPECTS,a as INPUT_SCALING,f as SIZING_TARGETS,i as alignText,h as alignTimeline,k as aspectOf,l as blankingForAspect,m as blankingQc,n as blankingText,c as inputFitRatio,g as offlineLane,d as resolveProps,b as scalingOf,e as underRef};
@@ -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 T}from"./chunk-NMH62JSC.js";import{c as D}from"./chunk-XVRTAKDK.js";import{R as M,Vb as P,ac as N,ec as q}from"./chunk-LYM757KG.js";import"./chunk-IN6XVTUS.js";import{k as A}from"./chunk-DFQWQ3EA.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-NXJZXXC2.js";import"./chunk-B77ADB26.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-P3XI63Q2.js";import"./chunk-F4PHKOAS.js";import"./chunk-ISKNIQVO.js";import"./chunk-DKGGJM6Z.js";import"./chunk-THVX57I3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import{b as F}from"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-VJN4UXFJ.js";import"./chunk-6NLB5TZ2.js";import"./chunk-64X5DLH5.js";import"./chunk-PHAMF4JF.js";import{$ as k,J as x,K as E,Y as U,Z as R,o as O,s as S}from"./chunk-G3SZDPDS.js";import"./chunk-PSANHDZM.js";var y=s=>{let i=s?.target_url??s?.local_path??"";return i.startsWith("file://")?O(i):i};async function H(s,i){let o=await V(s,i);return await I(s,o.session,i),o}async function I(s,i,o){let r=await s.liveMarkers(o).catch(()=>null);if(!r)return;let l=i.timelines,e=l.find(m=>m.kind!=="compound")??l[0];if(!e)return;let t=(m,f,a,p)=>({id:`live-${p??"tl"}-${m}`,time:{value:m},duration:{value:Math.max(1,f)},color:a.color,name:a.name,note:a.note,...p?{item_id:p}:{}}),n=r.timeline.map(m=>t(m.frame,m.duration,m)),c=e.tracks.filter(m=>m.kind==="Video");for(let m of r.clips){let f=c[m.track-1]?.items.find(a=>a.timeline_range?.start?.value===m.start);if(f)for(let a of m.markers)n.push(t(a.frame,a.duration,a,f.id))}e.markers=n}async function V(s,i){let o=await s.items({timeline:i,kind:"video"}),r=o.items.map(f=>`${f.kind}:${f.track}:${f.start}:${f.end-f.start}`),l=async f=>{let a=await D(f,o.timeline).catch(()=>null);if(!a||!r.every(d=>a.has(d)))return null;let{session:p}=await P(f,"prproj"),u=p.timelines.find(d=>d.name===o.timeline);return u?z(p,u):null};if(o.project_path){let f=await l(o.project_path);if(f)return await C(f),{session:f,from:"the saved project (matches the live sequence)",path:o.project_path};let a=k(R(o.project_path),"Adobe Premiere Pro Auto-Save"),p=U(o.project_path).replace(/\.prproj$/i,""),u=[];try{for await(let d of E(a))d.isFile&&d.name.startsWith(`${p}--`)&&d.name.endsWith(".prproj")&&u.push({path:k(a,d.name),mtime:(await S(k(a,d.name))).mtime?.getTime()??0})}catch{}for(let d of u.sort((g,_)=>_.mtime-g.mtime).slice(0,3)){let g=await l(d.path);if(g&&await C(g),g)return{session:g,from:`Premiere's auto-save of ${new Date(d.mtime).toLocaleTimeString()} (matches the live sequence; the project itself is not saved)`,path:d.path}}}let e=k(await x("conform-ppro-"),"live.otio"),t=await s.export({timeline:i,out_path:e}),{session:n}=await P(t.path,t.format);if(await W(s,n),await Z(n),typeof o.drop_frame=="boolean")for(let f of n.timelines)f.is_drop_frame=o.drop_frame;await C(n);for(let f of n.timelines)for(let a of f.tracks)for(let p of a.items){let u=p;u.scale=null,u.position_x=null,u.position_y=null,u.rotation=null}let c=await s.model(i).then(f=>f.items.filter(a=>Object.keys(a.sizing??{}).length).map(a=>`${a.name??a.file_path.split("/").pop()} (V${a.track} @${a.start-f.start_frame})`)).catch(()=>[]),m=`Premiere's OTIO export carries the cut, not the clips' Motion / Opacity / effects / retimes${c.length?` \u2014 ${c.length} clip(s) here have Motion that will not carry: ${c.slice(0,6).join(", ")}${c.length>6?"\u2026":""}`:""}; save the project (or wait for its auto-save) and run it again for every one of them`;return{session:n,from:"Premiere's OTIO export of the live sequence (no saved or auto-saved copy matches it yet)",path:t.path,lossy:m}}async function C(s){let i=new Set;for(let r of s.media_references??[]){if(r.binding_state==="linked")continue;let l=y(r);l&&await S(l).then(e=>e.isFile,()=>!1)&&i.add(R(l))}let o=s;for(let r of i){let l=await T(o,{media_root:r,gather:"path",criteria:{file_name:!0,file_name_mode:"tight"},lane:"both",reset:!1,dry_run:!1,compare:!1,cap:2e3,remember:!1}).catch(()=>null);l?.changed&&(o=l.session)}return o!==s&&Object.assign(s,o),(s.media_references??[]).filter(r=>r.binding_state==="linked").length}async function Z(s){let i=0;for(let o of s.media_references??[]){if(o.source_resolution_w)continue;let r=y(o),l=r?await A(r).catch(()=>null):null;if(!l)continue;let e=l;for(let t of["source_resolution_w","source_resolution_h","source_pixel_aspect","codec","container","streams"])e[t]!=null&&o[t]==null&&(o[t]=e[t]);o.source_fps??=e.source_fps??null,o.source_timecode??=e.source_timecode??null,!o.available_range&&e.available_range&&(o.available_range=e.available_range),i++}return i}async function re(s,i){let o=i.timelines.filter(t=>t.offline_reference?.clip_id);if(!o.length)return 0;let r=t=>[...t?.clip_list??[],...(t?.folders??[]).flatMap(r)],l=new Map(r((await s.project({clips:!0})).pool).map(t=>[t.id,t])),e=0;for(let t of o){let n=l.get(t.offline_reference.clip_id);if(n?.file){let c=i.media_references.find(m=>y(m)===n.file);c||(c={id:`offline-ref-${t.id??e}`,kind:"external",name:n.name,target_url:`file://${n.file}`,local_path:n.file},i.media_references.push(c)),t.offline_reference.media_reference_id=c.id,e++}else if(n&&n.name!==t.name&&(n.type==="Timeline"||/compound/i.test(n.type??""))){let{createSession:c}=await import("./store-4WZQF6YD.js"),m=k(await x("conform-offline-ref-"),`${n.name.replace(/[^\w.-]+/g,"_")}.drt`),f=await s.export(n.type==="Timeline"?{timeline:n.name,out_path:m}:{clip_id:n.id,out_path:m}),{session:a}=await P(f.path,"drt");a=(await M(a))?.session??a,t.offline_reference.session_id=(await c(a,f.path,"drt")).id,e++}else t.offline_reference=null}return e}async function W(s,i){let o=(await s.projectClips()).clips,r=new Map(o.filter(e=>e.start_frame!=null&&e.fps).map(e=>[e.file,e])),l=0;for(let e of i.media_references??[]){if(e.source_timecode)continue;let t=r.get(y(e));if(t){e.source_timecode=F(t.start_frame,t.fps),e.source_fps??=t.fps,l++;continue}let n=y(e),c=n?await A(n).catch(()=>null):null;c?.source_timecode&&(e.source_timecode=c.source_timecode,e.source_fps??=c.source_fps??null,l++)}return l}function z(s,i){let o=new Map(s.timelines.map(l=>[l.id,l])),r=[i];for(let l=0;l<r.length;l++)for(let e of r[l].tracks)for(let t of e.items){let n=t.nested_timeline_id,c=n?o.get(n):void 0;c&&!r.includes(c)&&r.push(c)}return{...s,timelines:r}}function X(s,i){let o=new Map((s.media_references??[]).map(n=>[n.id,y(n)])),r=[];for(let n of i.media_references??[]){let c=o.get(n.id),m=y(n);c!==void 0&&m&&m!==c&&r.push({ref_id:n.id,old:c,new:m})}let l=new Map(r.map(n=>[n.ref_id,n])),e=[],t=i.timelines.find(n=>n.kind==="primary")??i.timelines[0];for(let n of t?.tracks??[])if(n.kind==="Video")for(let c of n.items){let m=c.media_reference_id?l.get(c.media_reference_id):void 0;!m||c.kind!=="clip"||!c.source_range||e.push({track:n.track_index,start:c.timeline_range.start.value,duration:c.timeline_range.duration.value,src_in:c.source_range.start.value,path:m.new,name:c.name??""})}return{media:r,cuts:e}}async function oe(s,i){let{session:o,from:r,lossy:l}=await H(s,i.timeline),e=await T(structuredClone(o),{media_root:i.media_root,gather:"walk",reset:!0,lane:"video",dry_run:!1,cap:2e3,criteria:i.criteria??(i.mode==="cut_in"?{file_name:!1,reel_name:!0}:{file_name:!0,file_name_mode:"loose"}),tolerances:i.tolerances}),{media:t,cuts:n}=X(o,e.session),c=[`read from ${r}`,...l&&i.mode==="new_version"?[`\u26A0 ${l}`]:[],`matched ${t.length} medi${t.length===1?"um":"a"} under ${i.media_root} (${n.length} clip use${n.length===1?"":"s"} in the sequence)`],m=t.map(u=>` ${u.old.split("/").pop()} \u2192 ${u.new}`);if(i.dry_run||!t.length)return{text:[...c,...m,i.dry_run?"(dry run \u2014 nothing changed in Premiere)":"",e.text.split(`
4
- `).slice(-6).join(`
5
- `)].filter(Boolean).join(`
6
- `),data:{media:t,cuts:n,from:r}};if(i.mode==="replace"||i.mode==="hires"||i.mode==="proxy"){let d=(await s.projectClips()).clips.flatMap(w=>t.filter(j=>j.old===w.file).map(j=>({clip:w.id,path:j.new,mode:i.mode}))),g=i.mode==="replace"?L(o,e.session,t):new Map,_=g.size?await Y(s,new Set(g.keys())):[],b=await s.relinkClips(d),h=b.results.filter(w=>w.ok).length,$=[...c,`${i.mode==="hires"?"attached full-res behind":i.mode==="proxy"?"attached as proxies to":"repointed"} ${h}/${d.length} project clip(s)${i.mode==="proxy"?" (Toggle Proxies in Premiere switches)":""}`,...m,...b.results.filter(w=>!w.ok).map(w=>` refused: ${w.detail??"Premiere refused"}`)],v=_.length?await B(s,_,g):null;return v&&$.push(...v.lines),{text:$.join(`
7
- `),data:{media:t,results:b.results,undo_relink:b.undo,...v?{refit:v.data}:{},from:r}}}if(i.mode==="cut_in"){let u=await s.items({timeline:i.timeline,kind:"video"}),d=Math.max(0,...u.items.map(h=>h.track)),g=i.track??d+1,_=await s.cutIn(i.timeline,n.map(h=>({path:h.path,track:g,start:h.start,src_in:h.src_in,duration:h.duration,copy_from:{track:h.track,start:h.start}}))),b=_.results.filter(h=>h.ok).length;return{text:[...c,`cut in ${b}/${n.length} on V${g} (video only, the originals untouched underneath; Edit > Undo ${_.undo_steps}\xD7 in Premiere takes the cuts${_.undo_steps>1?" and the carried sizing":""} back; each return clip keeps its in/out marks)`,...n.map((h,$)=>` V${h.track} @${h.start} ${h.name} \u2192 ${h.path.split("/").pop()} src ${h.src_in}${_.results[$]?.ok?"":` REFUSED: ${_.results[$]?.detail??""}`}`)].join(`
8
- `),data:{media:t,cuts:n,results:_.results,track:g,from:r}}}let f=e.session.timelines.find(u=>u.kind==="primary")??e.session.timelines[0];f&&(f.name=i.name??`${f.name}_CONFORMED`);let a=await q(e.session,"premiere-prproj",k(await x("conform-ppro-"),"/"),""),p=await s.open({path:a.path});return{text:[...c,`new sequence "${p.timeline}" in ${p.project} (the open sequence is untouched)`,...m,...p.notes,...a.issues.slice(0,10).map(u=>` note: ${u.message}`)].join(`
9
- `),data:{media:t,path:a.path,sequence:p.timeline,issues:a.issues,from:r}}}function L(s,i,o){let r=new Map,l=(e,t)=>(e.media_references??[]).find(n=>n.id===t);for(let e of o){let t=l(s,e.ref_id),n=l(i,e.ref_id),c=t?.source_resolution_w,m=t?.source_resolution_h,f=n?.source_resolution_w,a=n?.source_resolution_h;!c||!m||!f||!a||c===f||Math.abs(c/m-f/a)>.01||r.set(e.old,c/f)}return r}async function Y(s,i){let o=[];for(let r of(await s.current()).timelines){let l=await s.model(r).catch(()=>null);for(let e of l?.items??[])i.has(e.file_path)&&o.push({sequence:r,track:e.track,start:e.start-l.start_frame,file:e.file_path,zx:e.sizing.ZoomX??1,zy:e.sizing.ZoomY??e.sizing.ZoomX??1,keyframed:!!e.sizing_keyframed})}return o}async function B(s,i,o){let r=[],l={},e=new Map;for(let t of i)(e.get(t.sequence)??e.set(t.sequence,[]).get(t.sequence)).push(t);for(let[t,n]of e){let c=n.filter(a=>a.keyframed),m=n.filter(a=>!a.keyframed).map(a=>{let p=o.get(a.file);return{op:"properties",item:{kind:"video",track:a.track,start:a.start},set:{ZoomX:+(a.zx*p).toFixed(6),ZoomY:+(a.zy*p).toFixed(6)}}}),f=m.length?await s.apply({timeline:t,ops:m}):null;l[t]={rescaled:f?.applied??0,keyframed:c.length,undo:f?.undo??[]},r.push(` "${t}": ${f?.applied??0}/${m.length} use(s) rescaled to keep their framing on the new raster (one Edit > Undo)${c.length?`; ${c.length} with keyframed scale left as they are \u2014 check them`:""}`)}return{lines:["framing kept through the raster change (Premiere's Scale is a percent of the media's pixels):",...r],data:l}}async function G(s){let i=new Set;for(let e of s.timelines)for(let t of e.tracks)for(let n of t.items)n.is_adjustment&&(i.add(n.id),n.is_adjustment=!1);let o=s.timelines.flatMap(e=>e.tracks.flatMap(t=>t.items)).filter(e=>e.kind==="nested").length,r=await M(s);if(!r)throw new Error("un-nesting needs the conform.tools engine on this machine");for(let e of r.session.timelines)for(let t of e.tracks)for(let n of t.items)i.has(n.id)&&(n.is_adjustment=!0);let l=s.timelines[0]?.id;return Object.assign(s,r.session),s.timelines=s.timelines.filter(e=>e.id===l),{summary:`un-nested ${o} nest${o===1?"":"s"}`,issues:r.issues}}async function ae(s,i){let{session:o,from:r,lossy:l}=await H(s,i.timeline),e=await J(o,i.ops,i.name),t=await q(e.session,"premiere-prproj",k(await x("conform-ppro-"),"/"),""),n=await s.open({path:t.path}),c=[...e.issues,...t.issues.map(m=>m.message)];return{text:[`read from ${r}`,...l?[`\u26A0 ${l}`]:[],...e.lines,`new sequence "${n.timeline}" in ${n.project} (the open sequence is untouched)`,...c.slice(0,12).map(m=>` note: ${m}`),...c.length>12?[` \u2026and ${c.length-12} more notes`]:[]].join(`
10
- `),data:{sequence:n.timeline,path:t.path,notes:c,from:r}}}async function J(s,i,o){let r=[],l=[],e=()=>s.timelines[0];for(let n of i){if(n.kind==="unnest"){let a=await G(s);r.push(a.summary),l.push(...a.issues);continue}let c=new Set(s.timelines.map(a=>a.id)),m=N(s,n.kind,{timeline_id:e()?.id,...n.args??{}});r.push(m.summary);let f=s.timelines.find(a=>!c.has(a.id)&&a.kind!=="compound");f&&(s.timelines=z(s,f).timelines)}let t=e();if(!t)throw new Error("nothing to write: the operations left no timeline");return t.name=o??(i.length===1?`${t.name}_${i[0].kind.toUpperCase()}`:`${t.name}_EDIT`),{session:z(s,t),lines:r,issues:l}}export{C as bindAtRecordedPaths,X as changes,J as editSession,ae as hostEdit,oe as hostRelink,H as premiereSession,Z as probeRefs,L as rasterRatios,I as withLiveMarkers,z as withNests,re as withOfflineReference,W as withPremiereTimecodes};
@@ -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,b,c,d}from"./chunk-THVX57I3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-6NLB5TZ2.js";import"./chunk-64X5DLH5.js";import"./chunk-PHAMF4JF.js";import"./chunk-G3SZDPDS.js";import"./chunk-PSANHDZM.js";export{a as HOSTED_READ_KEYS,b as readHosted,d as shareOriginal,c as writeHosted};
@@ -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{f as a,g as b,h as c,i as d,j as e}from"./chunk-SJ56EEFP.js";import"./chunk-2CY2OOOJ.js";import"./chunk-XVRTAKDK.js";import"./chunk-LYM757KG.js";import"./chunk-IN6XVTUS.js";import"./chunk-DFQWQ3EA.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-NXJZXXC2.js";import"./chunk-B77ADB26.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-P3XI63Q2.js";import"./chunk-F4PHKOAS.js";import"./chunk-ISKNIQVO.js";import"./chunk-DKGGJM6Z.js";import"./chunk-THVX57I3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-VJN4UXFJ.js";import"./chunk-6NLB5TZ2.js";import"./chunk-64X5DLH5.js";import"./chunk-PHAMF4JF.js";import"./chunk-G3SZDPDS.js";import"./chunk-PSANHDZM.js";export{a as AVID_SETUP,b as FLAME_SETUP,c as NUKE_SETUP,e as adapter,d as setAdapter};
@@ -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 $}from"./chunk-AACY2V3L.js";import{b as J}from"./chunk-P3XI63Q2.js";import{b as j}from"./chunk-F4PHKOAS.js";import{Ha as N,Ia as l,M,R as P,b as B,ca as D,da as T,e as I,ea as E,fa as L,g as S,ga as C,ia as O,ra as V,ua as W,w as k,wa as G}from"./chunk-DPA26AOI.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 se(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 Z(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 H(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=se(o);if(s<0)return e;let c=new DataView(o.buffer,o.byteOffset,o.byteLength),[f,te]=Z(c,s+16);if(f===null||f<16||f>65536)return e;let F=s+16+te;if(F+f>o.length)return e;let A=[],ne=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(ne,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 y=new DataView(p.buffer,p.byteOffset,p.byteLength),[R,v]=Z(y,16);if(R===null)continue;let m=16+v,_,x;if(p.length<m+64){let oe=Math.min(m+64,r-u),h=await t.read(u,oe);if(h.length<m+64)continue;let U=new DataView(h.buffer,h.byteOffset,h.byteLength);_=b(U,m+32),x=b(U,m+40)}else _=b(y,m+32),x=b(y,m+40);let ae=u+16+v+R+_+x,ie=Math.min(ae+65536,r)-u;e.push({offset:u,length:ie})}return e}function q(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 ce(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 K(t,r,e){let n=q(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 J(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 Q(t,r,e){await l();let n=q(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 H(t)).map(s=>({offset:s.offset,length:s.length}));return{fileSize:t.fileSize,structuralRanges:o,essenceRanges:ce(o,t.fileSize),trimInputs:n,wholeFileFallback:!0}}async function X(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 X(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;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:null,size_bytes:r.fileSize,streams:[...i||o||a?[{kind:"video",codec:null,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:$(e),granularity:"frame",segments:e}},async sparsify(t,r){let e=t.parts[0],n=await Q(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 K(e,r.items,r.handles)},async decode(t,r,e){await l();let n=t.parts[0],a=w(n),i=await re(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 I(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 re(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 Y=new WeakMap;async function ue(t,r){if(!N)return null;try{let e=await import("./arriraw-YIJ3BYNN.js");if(!await e.arrirawGpuAvailable())return null;let{parseArrirawGpuPayload:n,arrirawFrameToRgb16:a}=await import("./clip-state-B6JOX3JE.js"),i=t.parts[0],o=Y.get(t)??null,s=await B(w(i),i.fileSize,r,o?.key),c=n(s,o);if(!c)return null;Y.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 ee=new WeakMap;async function re(t){let r=ee.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 L(n,e.fileSize)?a="dnxhr":await C(n,e.fileSize)?a="xocn":await E(n,e.fileSize)&&(a="prores"),ee.set(t,a),a}export{Me as mxfFormat};
@@ -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{d as h}from"./chunk-2CY2OOOJ.js";import{$ as o,F as d,b as p,g as n,i as a,n as u,t as s}from"./chunk-G3SZDPDS.js";import"./chunk-PSANHDZM.js";import{dirname as m}from"node:path";import{fileURLToPath as P}from"node:url";import w from"node:process";var r="ColorMatchProbe.ofx.bundle",x="http://127.0.0.1:9876",i="/Library/OFX/Plugins";async function b(){let e=w.execPath;for(let t of[p("CONFORM_RESOLVE_PROBE"),o(m(e),"..","Resources","resolve-probe",r),o(m(P(import.meta.url)),"..","..","..","resolve_hook","build",r)])if(t&&await s(o(t,"Contents","MacOS","ColorMatchProbe.ofx")))return t;return null}async function E(){let e=n()==="darwin"&&a()==="arm64",t=await s(o(i,r)),l=await fetch(x+"/",{signal:AbortSignal.timeout(500)}).then(f=>f.ok).catch(()=>!1),c=!!await b();return{installed:t,loaded:l,shipped:c,supported:e,next:e?l?"running: the Color page selection and the selected node are read live":t?"installed; restart Resolve to load it":c?"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 S(){if(n()!=="darwin"||a()!=="arm64")throw new Error("the probe runs on Apple silicon Macs only");let e=await b();if(!e)throw new Error("this build does not carry the probe (resolve_hook/build.sh makes it)");return await h("darwin",e,i,r),await d(o(u(),"Library","Application Support","Blackmagic Design","DaVinci Resolve","OFXPluginCacheV2.xml")).catch(()=>{}),{path:o(i,r),restart_required:!0}}export{r as PROBE_BUNDLE,x as PROBE_URL,S as installProbe,E as probeStatus};
@@ -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 i,Tb as a,Ub as b,Vb as c,Wb as d,Xb as e,Yb as f,Zb as g,_b as h,ac as j,bc as k,cc as l,dc as m,ec as n,fc as o,gc as p,hc as q,ic as r,jc as s}from"./chunk-LYM757KG.js";import"./chunk-IN6XVTUS.js";import"./chunk-DFQWQ3EA.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-B77ADB26.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-P3XI63Q2.js";import"./chunk-F4PHKOAS.js";import"./chunk-ISKNIQVO.js";import"./chunk-DKGGJM6Z.js";import"./chunk-THVX57I3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-VJN4UXFJ.js";import"./chunk-6NLB5TZ2.js";import"./chunk-64X5DLH5.js";import"./chunk-PHAMF4JF.js";import"./chunk-G3SZDPDS.js";import"./chunk-PSANHDZM.js";export{i as OPERATION_KINDS,a as READ_FORMATS,j as applyOperation,l as applyOperationWithSources,r as consolidate,g as countFlags,b as detectFormat,s as judge,q as linkText,e as listClips,h as listFlags,f as listMedia,c as readTimeline,m as resolveTarget,p as routesText,d as summarize,k as trackIndex,o as writeDestination,n as writeTimeline};