conformtools 0.6.9 → 0.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-GFIQC77T.js +3 -0
- package/dist/analysis-engine-4K5K6L53.js +3 -0
- package/dist/{bridge-SX5TW4LC.js → bridge-73XMEZLH.js} +1 -1
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/chunk-2MJAQROY.js +5 -0
- package/dist/{chunk-TXQR2HI2.js → chunk-56EEBHP2.js} +1 -1
- package/dist/{chunk-GM6QKY7W.js → chunk-6HZP2OJA.js} +1 -1
- package/dist/{chunk-VIBEEWPC.js → chunk-7QUSVHO2.js} +2 -2
- package/dist/chunk-CJYLQ3UM.js +5 -0
- package/dist/chunk-DFDXSIMI.js +39 -0
- package/dist/{chunk-3D3Z4TBR.js → chunk-DGXZB7MO.js} +1 -1
- package/dist/{chunk-PLRB2YXJ.js → chunk-DNS4ZYIO.js} +1 -1
- package/dist/chunk-DPA26AOI.js +3 -0
- package/dist/chunk-E5ENIKNR.js +7 -0
- package/dist/{chunk-A7FNR3T5.js → chunk-EEDLRRKU.js} +1 -1
- package/dist/{chunk-GTJ3EM6H.js → chunk-GM262EDM.js} +1 -1
- package/dist/{chunk-D4WPRRBT.js → chunk-ISKNIQVO.js} +1 -1
- package/dist/chunk-JHTMYXJM.js +20 -0
- package/dist/chunk-JKOB3U54.js +3 -0
- package/dist/{chunk-2BPR6LK6.js → chunk-JXTRQ3UG.js} +1 -1
- package/dist/chunk-NQNS4Y2B.js +3 -0
- package/dist/chunk-QHXX5GDD.js +440 -0
- package/dist/{chunk-NFJHWZJX.js → chunk-TDIY4NRQ.js} +1 -1
- package/dist/chunk-UGVGRL5M.js +3 -0
- package/dist/chunk-WJ5EWXP2.js +3 -0
- package/dist/chunk-XDI6CPPV.js +3 -0
- package/dist/chunk-XJNWAQON.js +7 -0
- package/dist/chunk-Y2QHZUGL.js +5 -0
- package/dist/{chunk-GK4YYKJ6.js → chunk-YC7QDS5U.js} +2 -2
- package/dist/chunk-YUO3UWPH.js +3 -0
- package/dist/chunk-ZVUKOFUX.js +6 -0
- package/dist/{claude-setup-IIWUB4CE.js → claude-setup-OKOPPDMB.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/conformtools-analyze +0 -0
- package/dist/conformtools-decode +0 -0
- package/dist/{cr3-wasm-HLJWEV2S.js → cr3-wasm-NYCB34ND.js} +1 -1
- package/dist/{dng-wasm-CQDLPM5V.js → dng-wasm-XCPPBXPZ.js} +1 -1
- package/dist/{dpx-wasm-TLGMM7BO.js → dpx-wasm-XACWNFPB.js} +1 -1
- package/dist/engine-274GQLUB.js +5 -0
- package/dist/{exr-wasm-2NPKPTVB.js → exr-wasm-FQBUR6QT.js} +1 -1
- package/dist/flame/hook/conformtools_flame/verbs.py +9 -9
- package/dist/framing-BKTUEUZO.js +3 -0
- package/dist/gfx-worker.js +1 -1
- package/dist/{h264-JJMZSUWW.js → h264-B2TLLEMI.js} +1 -1
- package/dist/{h264-mxf-DCUOGLDU.js → h264-mxf-3GED5PBT.js} +1 -1
- package/dist/host-relink-PTV44KXF.js +10 -0
- package/dist/hosts-D3TR2QEV.js +3 -0
- package/dist/http.js +2 -2
- package/dist/{inspect-FJKYPEXL.js → inspect-D3WEYL2W.js} +3 -3
- package/dist/{isobmff-VJOWP4MH.js → isobmff-C5A2EFKH.js} +1 -1
- package/dist/{mc-video-5MGGOQN4.js → mc-video-ARKIHPA7.js} +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{media-NZYVREUF.js → media-3YMIZSSF.js} +1 -1
- package/dist/media_core-XOKN7UUF.js +9 -0
- package/dist/mxf-CQSI6H5T.js +3 -0
- package/dist/nuke/panel/python/conformtools_nuke/verbs.py +5 -5
- package/dist/{ops-X7NAREC4.js → ops-BCTGDBXT.js} +1 -1
- package/dist/peer-kit/ctpeer/__init__.py +1 -1
- package/dist/peer-kit/ctpeer/neutral.py +10 -10
- package/dist/premiere-uxp/lib/edit.js +94 -9
- package/dist/premiere-uxp/lib/markers.js +12 -11
- package/dist/premiere-uxp/lib/probe.js +6 -3
- package/dist/premiere-uxp/lib/verbs.js +1 -1
- package/dist/premiere-uxp/manifest.json +1 -1
- package/dist/{probe-F7WQHMIA.js → probe-COWUTQGN.js} +1 -1
- package/dist/{r3d-T5O6IIZZ.js → r3d-FX7V4BIE.js} +1 -1
- package/dist/{r3d-CXUNG6VS.js → r3d-I6EYEYX7.js} +1 -1
- package/dist/resolve-bridge.py +725 -88
- package/dist/sequence-patch-JVEZW24V.js +3 -0
- package/dist/{still-P4JJNTEO.js → still-WUCFH2WX.js} +1 -1
- package/dist/{still-wasm-DN5LPASS.js → still-wasm-RTPOMH7S.js} +1 -1
- package/dist/store-SZKXADGI.js +3 -0
- package/dist/{tiff-wasm-BPRDR6EB.js → tiff-wasm-N2S267IA.js} +1 -1
- package/dist/timeline-PEUC3G7K.js +3 -0
- package/dist/timeline_core-ZKQQHUA2.js +3 -0
- package/dist/wasm/media_core_bg.wasm +0 -0
- package/dist/wasm-threads/media_core_bg.wasm +0 -0
- package/dist/{wav-64SC6P7U.js → wav-HSCUCY4U.js} +1 -1
- package/package.json +1 -1
- package/dist/account-M53GEV7P.js +0 -3
- package/dist/chunk-5BSXYKLN.js +0 -20
- package/dist/chunk-623EA3TK.js +0 -6
- package/dist/chunk-AMRJXYL4.js +0 -3
- package/dist/chunk-DQGINJDV.js +0 -5
- package/dist/chunk-GRQJGEGV.js +0 -378
- package/dist/chunk-HNBA43BF.js +0 -5
- package/dist/chunk-J2JXLEAI.js +0 -3
- package/dist/chunk-MWDF2R26.js +0 -7
- package/dist/chunk-PFISREY4.js +0 -3
- package/dist/chunk-QVH44I66.js +0 -39
- package/dist/chunk-RJ6JA2LZ.js +0 -3
- package/dist/chunk-SGLQY53R.js +0 -3
- package/dist/chunk-WN53ARHJ.js +0 -3
- package/dist/chunk-XCKQHL4G.js +0 -9
- package/dist/engine-P6H5P6HP.js +0 -5
- package/dist/framing-3XIVHSUZ.js +0 -3
- package/dist/host-relink-UWML4C7W.js +0 -10
- package/dist/hosts-SRS5TEM6.js +0 -3
- package/dist/media_core-YZ3PABEG.js +0 -9
- package/dist/mxf-FJSRFLJC.js +0 -3
- package/dist/store-53BBZBND.js +0 -3
- package/dist/timeline-C3OZJBCZ.js +0 -3
- package/dist/timeline_core-IOENXK4Z.js +0 -3
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m}from"./chunk-XJNWAQON.js";import"./chunk-CJYLQ3UM.js";import"./chunk-PHAMF4JF.js";import"./chunk-DNS4ZYIO.js";import"./chunk-PSANHDZM.js";export{b as NET_TIMEOUT_MS,c as _forgetOffline,d as accessToken,e as accountStatus,a as config,g as includesOf,l as login,m as logout,k as requireApp,i as requireEntitled,j as requireMcp,h as setAccountGate,f as statusText};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{a,b,c,d}from"./chunk-CJYLQ3UM.js";import"./chunk-PHAMF4JF.js";import"./chunk-DNS4ZYIO.js";import"./chunk-PSANHDZM.js";export{a as analysisEnginePath,c as analysisOp,d as startAnalysisEngine,b as startAnalysisJob};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{g as a,h as b,i as c,j as d,k as e,l as f,m as g,n as h,o as i}from"./chunk-
|
|
3
|
+
import{g as a,h as b,i as c,j as d,k as e,l as f,m as g,n as h,o as i}from"./chunk-JHTMYXJM.js";import"./chunk-DNS4ZYIO.js";import"./chunk-PSANHDZM.js";export{c as BridgeError,g as HostBridge,e as PANEL_PREFIX,b as PORTS,a as PROTOCOL,h as hostBridge,d as pairingPath,f as panelOrigins,i as resetHostBridge};
|
|
Binary file
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{A,B as P,C as T,D as M,E as D,F as N,G as z,j as C,w as R,x as S,y as E,z as L}from"./chunk-DFDXSIMI.js";import{W as l,q as j}from"./chunk-DNS4ZYIO.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,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{C as A,D as R,E as q,H as F,I as N,L as f,
|
|
3
|
+
import{C as A,D as R,E as q,H as F,I as N,L as f,Z as r,b as _,g as m,i as L,l as x,p as T,q as U,r as $,s as P,t as E,v as k,w as V,y as O}from"./chunk-DNS4ZYIO.js";var H="7145B29C33684D8AA1C7E5126F9B405D",w="conform.tools.dvcp.bundle",J="https://raw.githubusercontent.com/tbdpost/conformtools-public/main/plugin/manifest.json";function z(t=m()){return t==="win32"?{system:`${_("PROGRAMDATA")??"C:\\ProgramData"}\\Blackmagic Design\\DaVinci Resolve\\Support\\IOPlugins`,user:`${_("APPDATA")??""}\\Blackmagic Design\\DaVinci Resolve\\Support\\IOPlugins`}:t==="linux"?{system:"/opt/resolve/IOPlugins",user:r(x(),".local/share/DaVinciResolve/IOPlugins")}:{system:"/Library/Application Support/Blackmagic Design/DaVinci Resolve/IOPlugins",user:r(x(),"Library/Application Support/Blackmagic Design/DaVinci Resolve/IOPlugins")}}function W(t=m()){return t==="win32"?`${_("APPDATA")??""}\\Blackmagic Design\\DaVinci Resolve\\Support\\logs\\ResolveDebug.txt`:t==="linux"?r(x(),".local/share/DaVinciResolve/logs/ResolveDebug.txt"):r(x(),"Library/Application Support/Blackmagic Design/DaVinci Resolve/logs/ResolveDebug.txt")}function j(t=m(),e=L()){return t==="darwin"?{key:"darwin-universal",binary:"Contents/MacOS/conform.tools.dvcp"}:t==="linux"&&/x86_64|x64/.test(e)?{key:"linux-x86_64",binary:"Contents/Linux-x86-64/conform.tools.dvcp"}:t==="win32"?{key:"windows-x86_64",binary:"Contents/Win64/conform.tools.dvcp"}:null}async function M(t){let e=r(t,"Contents/Resources/VERSION");if(await P(e))return(await k(e)).trim()||null;let n=r(t,"Contents/Info.plist");return await P(n)?/<key>CFBundleShortVersionString<\/key>\s*<string>([^<]+)</.exec(await k(n))?.[1]??null:null}function K(t,e){let n=t.split(`
|
|
4
4
|
`),s=n.find(l=>l.includes("Running DaVinci Resolve"));if(!s)return null;let i=/(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2}),(\d{3})/.exec(s);if(!i)return null;let u=new Date(`${i[1]}T${i[2]}.${i[3]}`),a=n.some(l=>/plugin repository/i.test(l)&&l.toUpperCase().includes(`LOADED PLUGIN [${H}]`));return{launched_at:u.toISOString(),loaded:a,installed_after_launch:e!==void 0&&e>u.getTime()}}async function tt(t=m()){let e=j(t),n=z(t),s=r(n.system,w),i=e?await E(s)&&await $(r(s,e.binary)):!1,u=i?await M(s):null,a=r(n.user,w),l=await E(a)?{path:a,version:await M(a)}:void 0,c=null;try{let D=i&&e?(await U(r(s,e.binary))).mtimeMs:void 0;c=K(await k(W(t)),D)}catch{}let p=e?i?c?c.loaded&&!c.installed_after_launch?"ready":"needs-restart":"unknown":"plugin-missing":"unsupported-platform",g={ready:"The plugin is installed and loaded.","plugin-missing":l?`Only a per-user copy exists (${a}); Resolve loads I/O plugins only from ${n.system}. Install it with host_setup action=install_renderplugin.`:"Install it with host_setup action=install_renderplugin, then restart Resolve.","needs-restart":"Restart Resolve: it loads I/O plugins only at launch.","unsupported-platform":"There is no build of the plugin for this platform.",unknown:"Start Resolve once so its log says whether it loaded the plugin."}[p];return{platform:e?.key??null,installed:i,path:s,version:u,...l?{shadowed:l}:{},resolve:c,readiness:p,next:g}}async function et(){for(let t of["./presets/conform.tools.xml","./resolve-presets/conform.tools.xml"]){let e=T(new URL(t,import.meta.url));if(await P(e))return e}throw new Error("resolve: the conform.tools render preset is missing from this install")}async function X(t){let e=new Uint8Array(await crypto.subtle.digest("SHA-256",t));return Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}async function G(t,e=3){for await(let n of N(t)){if(!n.isDirectory)continue;let s=r(t,n.name);if(n.name===w)return s;if(e>0&&!n.name.startsWith("__MACOSX")){let i=await G(s,e-1);if(i)return i}}return null}var Q=async t=>{let e=await fetch(t,{signal:AbortSignal.timeout(12e4)});if(!e.ok)throw new Error(`download failed: ${t} answered ${e.status}`);return new Uint8Array(await e.arrayBuffer())};async function nt(t={}){let e=t.os??m(),n=j(e);if(!n)throw new Error("there is no build of the plugin for this platform");let s=t.fetcher??Q,i=JSON.parse(new TextDecoder().decode(await s(t.manifest_url??J))),u=i.platforms?.[n.key]??(e==="darwin"&&i.bundle_url?{bundle_url:i.bundle_url,sha256:i.sha256??""}:void 0);if(!u)throw new Error(`plugin ${i.version} has no ${n.key} build`);let a=await s(u.bundle_url),l=await X(a);if(l!==u.sha256.toLowerCase())throw new Error(`the downloaded plugin failed its checksum (got ${l}, the manifest says ${u.sha256}); nothing was installed`);let c=await F("conform-plugin-"),p=r(c,"plugin.zip");await V(p,a);let g=r(c,"x");await O(g);let D=e==="darwin"?await f("ditto",["-x","-k",p,g]):e==="win32"?await f("powershell",["-NoProfile","-Command",`Expand-Archive -LiteralPath '${p}' -DestinationPath '${g}' -Force`]):await f("unzip",["-q",p,"-d",g]);if(!D.success)throw new Error(`could not unpack the plugin: ${D.stderr.trim()}`);let b=await G(g);if(!b||!await $(r(b,n.binary)))throw new Error(`the ${n.key} download does not contain ${n.binary}`);let h=t.targetDir??z(e).system,d=r(h,w),I=r(h,`.${w}.staging`),y=r(h,`.${w}.previous`),C=[],S=!1;try{await O(h),await R(I),await q(b,I),await R(y),await $(d)&&await A(d,y);try{await A(I,d)}catch(v){throw await $(y)&&await A(y,d),v}await R(y)}catch(v){let B=v.code;if(B!=="EACCES"&&B!=="EPERM")throw v;S=!0,await Y(e,b,h)}return e==="darwin"&&((await f(S?"osascript":"xattr",S?["-e",`do shell script "xattr -dr com.apple.quarantine ${o(d)}" with administrator privileges`]:["-dr","com.apple.quarantine",d])).success||C.push("could not clear the quarantine flag; if Resolve refuses the plugin, run: xattr -dr com.apple.quarantine "+d)),await R(c),{version:i.version,path:d,elevated:S,restart_required:!0,notes:C}}var o=t=>`'${t.replace(/'/g,"'\\''")}'`;async function Y(t,e,n,s=w){let i=r(n,s),u=r(n,`.${s}.staging`),a=r(n,`.${s}.previous`),l=[`mkdir -p ${o(n)}`,`rm -rf ${o(u)} ${o(a)}`,`cp -R ${o(e)} ${o(u)}`,`if [ -e ${o(i)} ]; then mv ${o(i)} ${o(a)}; fi`,`mv ${o(u)} ${o(i)} || { [ -e ${o(a)} ] && mv ${o(a)} ${o(i)}; exit 1; }`,`rm -rf ${o(a)}`].join(" && "),c=t==="darwin"?await f("osascript",["-e",`do shell script ${JSON.stringify(l)} with administrator privileges`]):t==="linux"?await f("pkexec",["sh","-c",l]):{success:!1,stderr:"run this from an administrator prompt",stdout:"",code:1};if(!c.success)throw new Error(`installing into ${n} needs an administrator, and that was refused or failed: ${c.stderr.trim()}`)}export{tt as a,et as b,nt as c,Y as d};
|
|
@@ -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 r,d as t}from"./chunk-6V4OEOOX.js";import{i as n}from"./chunk-
|
|
3
|
+
import{c as r,d as t}from"./chunk-6V4OEOOX.js";import{i as n}from"./chunk-JXTRQ3UG.js";async function d(e){if(!r(e.name))return null;try{return await n(t(e),{verb:"inspect"})}catch(i){return console.warn(`[probeMedia] ${e.name} probe failed:`,i),null}}export{d as a};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as M}from"./chunk-PFZVET7S.js";import{b as fe,c as pe,f as he}from"./chunk-6V4OEOOX.js";import{f as K,h as me}from"./chunk-
|
|
3
|
+
import{a as M}from"./chunk-PFZVET7S.js";import{b as fe,c as pe,f as he}from"./chunk-6V4OEOOX.js";import{f as K,h as me}from"./chunk-XDI6CPPV.js";import{a as de}from"./chunk-DGXZB7MO.js";import{i as D}from"./chunk-JXTRQ3UG.js";import{b as C,d as J,f as R}from"./chunk-NU3X7P4N.js";import{Ia as ue,ea as oe,fa as ie,ja as se,oa as ae,wa as ce,xa as le}from"./chunk-DPA26AOI.js";import{a as ne}from"./chunk-PHAMF4JF.js";import{C as W,I as v,J as A,K as re,N as te,W as b,X as y,Y as L,Z as _,b as E,c as Z,d as Q,g as q,p as I,q as B,s as ee,t as O,w as H,y as j}from"./chunk-DNS4ZYIO.js";var V=!1;var F=8,Me=0,Fe=3,z=2;async function Pe(e){let t=new Uint8Array(await e.slice(0,16).arrayBuffer()),o=s=>String.fromCharCode(t[s],t[s+1],t[s+2],t[s+3]);if(t[0]===6&&t[1]===14&&t[2]===43&&t[3]===52)return"mxf";if(o(4)==="RED1"||o(4)==="RED2")return"r3d";let r=t[0]<<24|t[1]<<16|t[2]<<8|t[3],i=o(4);return/^[A-Za-z0-9 ]{4}$/.test(i)&&(r>=8||r===1)&&r<=e.size?"isobmff":null}function Ee(e){let t=e.toLowerCase();return t.endsWith(".braw")?"braw":t.endsWith(".crm")?"crm":"mov"}function Oe(e){return async(t,o)=>new Uint8Array(await e.slice(t,Math.min(t+o,e.size)).arrayBuffer())}function be(e){let t=e.timecode;return!t||!t.fps_denominator?null:t.fps_numerator/t.fps_denominator}async function nr(e){return await ue(),ge?ge.clip(e,V?"rec709":"",()=>we(e)):we(e)}var ge=null;async function we(e){let t=await Pe(e),o=[];if(t==="r3d"){let r=e,i=r.parts&&r.bases?r.parts:[{name:e.name,size:e.size}],n=r.bases??[0],s=async(u,m,d)=>{let f=n[u]+m;return new Uint8Array(await e.slice(f,Math.min(f+d,n[u]+i[u].size)).arrayBuffer())},a=JSON.stringify(i.map(u=>({name:u.name,size:u.size}))),c=JSON.parse(await le(s,a)),l=JSON.parse(await se(s,a));return i.length===1&&/_\d{3}\.r3d$/i.test(e.name)&&!/_001\.r3d$/i.test(e.name)&&o.push("spanned R3D part \u2014 only this part's frames are indexed"),{frames:l.map(u=>({offset:n[u.part??0]+u.essenceOffset,size:u.essenceLength})),w:c.width??0,h:c.height??0,fps:be(c),startFrame:c.timecode?.start_frame??0,dropFrame:c.timecode?.drop_frame??!1,label:"R3D",spec:{codec:"r3d",subbands:Me},geometrySpec:{codec:"r3d",subbands:Fe},index:null,warnings:o}}if(t==="mxf"){let r=Oe(e),i=JSON.parse(await ce(r,e.size));if(!i)throw new Error(`${e.name}: MXF index unreadable`);let n=JSON.parse(await ae(r,e.size)),s=[];for(let f=0;f<n.frame_count;f++)s.push({offset:n.frames[f*2],size:n.frames[f*2+1]});let a=s.filter(f=>f.size===0).length;a&&o.push(`${a} frame(s) had no locatable picture KLV`);let c=i.width??0,l=i.height??0,u=(i.inner_codec??"").toLowerCase(),m=null,d="MXF";return u==="arriraw"?(m={codec:"arriraw",w:c,h:l,scale:F},d="ARRIRAW"):u==="xocn"?(m={codec:"xocn",scale:F,...V?{display:"rec709"}:{}},d="X-OCN"):await ie(r,e.size)?(m={codec:"vc3",scale:F},d="DNxHR"):await oe(r,e.size)?(m={codec:"prores"},d="ProRes"):o.push(`MXF inner codec ${u||"unknown"} not wired to the fingerprint pool`),{frames:m?s:[],w:c,h:l,fps:be(i),startFrame:i.timecode?.start_frame??0,dropFrame:i.timecode?.drop_frame??!1,label:d,spec:m,geometrySpec:m&&m.codec==="arriraw"?{...m,scale:z}:m&&m.codec==="xocn"?{codec:"xocn",scale:z,...V?{display:"rec709"}:{}}:m&&m.codec==="vc3"?{codec:"vc3",scale:z}:null,index:null,warnings:o}}if(t==="isobmff"){let r=await me(e),i=Ee(e.name);if(r.kind==="prores")return{frames:r.offs,w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:K(r.kind),spec:{codec:"prores"},geometrySpec:null,index:r,warnings:o};if(r.kind==="h264"||r.kind==="hevc")return{frames:r.offs,w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:K(r.kind),spec:null,geometrySpec:null,index:r,warnings:o};let n=i==="braw"?{codec:"braw",scale:F}:r.codec==="aprh"||r.codec==="aprn"?{codec:"proresraw",scale:F}:null;return n||o.push(`codec ${r.codec} not wired to the fingerprint pool`),{frames:n?r.offs:[],w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:n?i==="braw"?"BRAW":"ProRes RAW":`unsupported (${r.codec})`,spec:n,geometrySpec:n?{...n,scale:z}:null,index:r,warnings:o}}throw new Error(`${e.name}: unrecognised container`)}var Ae=Number(E("CONFORM_DECODERS")??0)||Math.max(2,Math.min(Math.floor(Q()/2),Math.floor(Z()/2**31))),X=0,_e=[],Ce=async(...e)=>{X>=Ae?await new Promise(t=>_e.push(t)):X++;try{return await te(...e)}finally{let t=_e.shift();t?t():X--}};async function De(){let e=q()==="win32"?"conformtools-decode.exe":"conformtools-decode",t=[E("CONFORM_NATIVE_DECODE"),I(new URL(`./${e}`,import.meta.url)),I(new URL(`../../rust/target/release/${e}`,import.meta.url))].filter(Boolean);for(let o of t)if(await ee(o))return o;return null}var $=class extends Error{constructor(o,r){super(r);this.why=o}};function Mr(e){let t=null;try{t=JSON.parse(e.trim().split(`
|
|
4
4
|
`).pop())}catch{}if(t?.why==="not_entitled")throw new ne("not_entitled",t.detail??"this machine is not licensed");return t?.detail??e.trim()}function ze(e,t){try{let o=JSON.parse(e.trim().split(`
|
|
5
5
|
`).pop()??"");return new $(o.why,o.detail)}catch{return new $("decoder",`the native decoder exited ${t}: ${e.trim().slice(-300)}`)}}function Ne(e){let t=e.reduce((i,n)=>i+n.length,0),o=new Uint8Array(t),r=0;for(let i of e)o.set(i,r),r+=i.length;return o}async function ye(e,t,o,r,i){let n=await De();if(!n)throw new $("missing","the native decoder (conformtools-decode) is not installed");let s=null,a=[],c=0,l=d=>{let f=new Uint8Array(d),p=0;for(;p<d;){let h=a[0],g=Math.min(h.length,d-p);f.set(h.subarray(0,g),p),p+=g,g===h.length?a.shift():a[0]=h.subarray(g)}return c-=d,f},u=[e,t,"--width",String(i.width??32768)];i.from!=null&&u.push("--from",String(i.from)),i.count!=null&&u.push("--count",String(i.count)),i.range&&u.push("--range",i.range);let m=await Ce(n,u,d=>{if(a.push(d),c+=d.length,!s){let p=Ne(a.splice(0));a.push(p);let h=p.indexOf(10);if(h<0)return;s=JSON.parse(new TextDecoder().decode(p.subarray(0,h))),l(h+1),o(s)}let f=4+s.w*s.h*(s.bpp??(e==="rgb16"?6:4));for(;c>=f;){let p=l(f);r(new DataView(p.buffer).getUint32(0,!0),p.subarray(4))}},{signal:i.signal});if(m.code!==0||!s)throw ze(m.stderr,m.code)}function xe(e,t,o,r={}){return ye("bgra",e,t,o,r)}function $e(e,t,o,r={}){return ye("rgb16",e,t,(i,n)=>o(i,new Uint16Array(n.buffer,n.byteOffset,n.length>>1)),r)}var Te=["none","rle","zips","zip","piz","pxr24","b44","b44a","dwaa","dwab","htj2k"],N=e=>(e>>4)*10+(e&15);function Ue(e){let t=N(e&63),o=N(e>>>8&127),r=N(e>>>16&127),i=N(e>>>24&63),n=s=>String(s).padStart(2,"0");return`${n(i)}:${n(r)}:${n(o)}${e&64?";":":"}${n(t)}`}function ke(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.length<8||t.getUint32(0,!0)!==20000630)return null;let o={fps:null,timecode:null,width:0,height:0,display:null,compression:null,attributes:[]},r=8,i=()=>{let s=r;for(;r<e.length&&e[r]!==0;)r++;let a=new TextDecoder().decode(e.subarray(s,r));return r++,a},n=s=>({width:t.getInt32(s+8,!0)-t.getInt32(s,!0)+1,height:t.getInt32(s+12,!0)-t.getInt32(s+4,!0)+1});for(;r<e.length;){let s=i();if(!s)break;let a=i();if(r+4>e.length)return null;let c=t.getInt32(r,!0);if(r+=4,c<0||r+c>e.length)return null;if(o.attributes.push(`${s}:${a}`),s==="framesPerSecond"&&a==="rational"&&c>=8){let l=t.getInt32(r,!0),u=t.getUint32(r+4,!0);o.fps=u?l/u:null}else s==="timeCode"&&a==="timecode"&&c>=8?o.timecode=Ue(t.getUint32(r,!0)):s==="dataWindow"&&a==="box2i"&&c>=16?{width:o.width,height:o.height}=n(r):s==="displayWindow"&&a==="box2i"&&c>=16?o.display=n(r):s==="compression"&&c>=1&&(o.compression=Te[e[r]]??`type ${e[r]}`);r+=c}return o}async function Ie(e){let t=e,o=null,r=/^(.*?)\[(\d+)-(\d+)\](.*)$/.exec(b(e));if(await O(e))o=/^(.*?)(\d+)(\.exr)$/i;else{t=y(e);let n=r?[null,r[1],r[2],r[4]]:/^(.*?)(\d+)(\.exr)$/i.exec(b(e));if(!n)return{frames:[e],numbers:[]};let s=a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");o=new RegExp(`^${s(n[1])}(\\d{${n[2].length}})${s(n[3])}$`,"i")}let i=[];for await(let n of v(t)){let s=n.isFile?o.exec(n.name):null;s&&i.push({n:Number(s[s.length===4?2:1]),f:_(t,n.name)})}return i.sort((n,s)=>n.n-s.n),{frames:i.map(n=>n.f),numbers:i.map(n=>n.n)}}async function ve(e){let t=await Ie(e),o=t.frames[0];if(!o)throw new Error(`no .exr frames for '${b(e)}'`);let r=await A(o),i;try{i=ke(await r.readAt(0,Math.min(r.size,1<<20)))}finally{await r.close()}if(!i)throw new Error(`'${b(o)}' is not an OpenEXR file`);let n=Math.max(1,t.frames.length),s=t.numbers.length>1?t.numbers[t.numbers.length-1]-t.numbers[0]+1-t.numbers.length:0,a=i.fps??0;return{id:b(o),kind:"external",target_url:o,local_path:o,content_kind:n>1?"video":"still",source_fps:i.fps??void 0,source_timecode:i.timecode??void 0,source_resolution_w:i.width,source_resolution_h:i.height,available_range:{start:{value:0,rate:a},duration:{value:n,rate:a}},streams:[{kind:"video",codec:"exr",width:i.width,height:i.height,rate:i.fps??void 0,codec_specific:{compression:i.compression}}],vendor_metadata:{exr:{frames:n,first_frame:t.numbers[0]??null,last_frame:t.numbers[t.numbers.length-1]??null,missing_frames:s,display_window:i.display,attributes:i.attributes,fps_source:i.fps!=null?"header framesPerSecond":"not in the header",timecode_source:i.timecode?"header timeCode (first frame)":"not in the header"}}}}var G=new Set([".mov",".mp4",".m4v",".mxf",".wav",".braw",".crm",".r3d",".aif",".aiff"]);async function Be(e){let t=await A(e);return{path:e,file:t,size:t.size}}function He(e){return(t,o)=>e.file.readAt(t,o)}async function je(e){let t=M(b(e));if(!t)return[e];let o=y(e),r=[];for await(let i of v(o)){if(!i.isFile)continue;let n=M(i.name);n&&n.clipBase===t.clipBase&&r.push({n:n.partNumber,p:_(o,i.name)})}return r.sort((i,n)=>i.n-n.n).map(i=>i.p)}async function Y(e){if(await O(e)){let n=[];for await(let s of v(e))s.isFile&&M(s.name)&&n.push(_(e,s.name));if(!n.length)throw new Error(`'${b(e)}' is a folder with no .R3D parts`);e=n.sort()[0]}let t=pe(b(e));if(!t)throw new Error(`unsupported media file '${b(e)}' (supported: ${[...G].join(" ")})`);let o=await je(e),r=await Promise.all(o.map(Be));return{source:he(t,r.map(n=>fe(b(n.path),{fileSize:n.size,read:He(n)}))),parts:r,format:t,anchor:o[0],close:()=>r.forEach(n=>n.file.close())}}async function We(e,t,o,r){if(!/h264|avc|hevc|h265/.test(o)){let i=null,n=await Y(e);try{return await D(n.source,{verb:"decode",index:t,intent:"park"})}catch(s){i=s}finally{n.close()}try{return await Se(e,t,r)}catch(s){throw/no decoder/.test(String(i))?s:i instanceof Error?i:new Error(String(i))}}return Se(e,t,r)}async function kr(e,t,o,r={}){if(/\.mxf$/i.test(e)&&(!o||/h264|avc|mxf/.test(o))){let a=null,c=null;try{await $e(e,l=>{a=l},(l,u)=>{l===t&&(c=u.slice())},{from:t,count:1,range:r.range})}catch(l){if(!(l instanceof $)||!/unsupported|missing/.test(l.why))throw l}if(c&&a){let l=a;return{rgb:c,width:l.w,height:l.h,bits:l.bit_depth??16,decoder:"media-core",full_range:l.full_range??null}}}let i=await We(e,t,o),n=i.width*i.height,s=new Uint16Array(n*3);for(let a=0;a<n;a++)s[a*3]=i.rgba[a*4]*257,s[a*3+1]=i.rgba[a*4+1]*257,s[a*3+2]=i.rgba[a*4+2]*257;return{rgb:s,width:i.width,height:i.height,bits:8,decoder:"8-bit",full_range:null}}async function Se(e,t,o){t=Math.round(t);let r=0,i=0,n=null;if(await xe(e,a=>{r=a.w,i=a.h},(a,c)=>{a===t&&(n=c)},{from:t,count:1,width:o}),!n)throw new Error(`the OS decoder returned no frame ${t} of ${b(e)}`);let s=n;for(let a=0;a<s.length;a+=4){let c=s[a];s[a]=s[a+2],s[a+2]=c}return{rgba:s,width:r,height:i}}async function P(e){if(/\.exr$/i.test(e))return ve(e);let t=await Y(e);try{let o=await D(t.source,{verb:"inspect"});if(!o)throw new Error(`could not read '${b(e)}' as ${t.format}`);return o.target_url=t.anchor,o.local_path=t.anchor,o.id=o.id||b(t.anchor),t.parts.length>1&&((o.vendor_metadata??={}).spanned_parts=t.parts.map(r=>b(r.path))),o.size_bytes=t.parts.reduce((r,i)=>r+i.size,0),o}finally{t.close()}}function Le(e,t,o,r){let i=Math.abs(r*1001-Math.round(r*1001/1e3)*1e3)<1?Math.round(r)*1e3/1001:r,n=Math.floor(e*i/t+1e-6);return{tc:C(n,r),frames:Math.round(o*i/t)}}var Je=e=>String(Math.round(e*1e3)/1e3);function Ir(e,t){let o=e.streams?.find(m=>m.kind==="video"),r=e.streams?.filter(m=>m.kind==="audio")??[],i=e.vendor_metadata?.bext;if(!o&&e.available_range&&r[0]?.rate){let m=r[0].rate,d=e.available_range.duration.value,p=(t?[t]:[24e3/1001,24]).map(h=>{let g=Le(i?.time_reference??0,i?.sample_rate||m,d,h);return`${i?`start TC ${g.tc}, `:""}${g.frames} frames @ ${Je(h)} fps`});return[e.target_url??"",`audio only; ${d} samples (${(d/m).toFixed(3)} s)${i?`; BWF time_reference ${i.time_reference}`:"; no BWF timecode"}`,...p,...t?[]:["(pass fps for the project's rate)"],...r.map((h,g)=>`audio ${r.length>1?`${g+1}: `:""}${h.codec??"pcm"} ${h.channels??"?"}ch ${h.rate} Hz ${h.bit_depth??"?"}-bit`)].join(`
|
|
6
|
-
`)}let n=e.available_range?.duration?.value??e.declared_duration?.value??null,s=e.source_fps??o?.rate??null,a=e.size_bytes,c=e.vendor_metadata?.spanned_parts,l=o?.codec_specific??{},u=[l.profile?`${l.profile} (${l.fourcc})`:l.fourcc,l.pixel_format,o?.bit_depth?`${o.bit_depth}-bit`:null,l.colr?`
|
|
6
|
+
`)}let n=e.available_range?.duration?.value??e.declared_duration?.value??null,s=e.source_fps??o?.rate??null,a=e.size_bytes,c=e.vendor_metadata?.spanned_parts,l=o?.codec_specific??{},u=[l.profile?`${l.profile} (${l.fourcc})`:l.fourcc,l.pixel_format,o?.bit_depth?`${o.bit_depth}-bit`:null,l.colr?`color ${l.colr.primaries}/${l.colr.transfer}/${l.colr.matrix} (primaries/transfer/matrix)`:null].filter(Boolean).join(", ");return[e.target_url??"",o?`${o.codec??"?"} ${o.width??"?"}x${o.height??"?"}${s?` @ ${Math.round(s*1e3)/1e3} fps`:""}${u?`; ${u}`:""}`:"no video track",`start TC ${e.source_timecode??"none"}; ${n!=null?`${n} frames`:"length unknown"}${n!=null&&s?` (${(n/s).toFixed(2)} s)`:""}`,r.length?r.map((m,d)=>{let f=m.codec_specific?.channel_layout;return`audio ${r.length>1?`${d+1}: `:""}${m.codec??"pcm"} ${m.channels??"?"}ch${f?` (${f})`:""} ${m.rate??"?"} Hz ${m.bit_depth??"?"}-bit`}).join(`
|
|
7
7
|
`):"no audio",`${e.reel_name?`reel ${e.reel_name}; `:""}${a!=null?`${(a/1e6).toFixed(1)} MB`:""}${c?`; spanned ${c.length} parts`:""}`].join(`
|
|
8
8
|
`)}var Ke=8*1024*1024,T=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0));async function Ve(e,t,o){if(e.executable_locally===!1)throw new Error("this trim plan is server-side only");let r=new Map(t.parts.map(n=>[b(n.path),n]));await j(y(o));let i=await re(o);try{await i.truncate(e.total_size),await i.writeAt(0,T(e.dest_header_bytes_base64));for(let n of e.src_byte_ranges){let s=n.src_file_name?r.get(b(n.src_file_name)):t.parts[0];if(!s)throw new Error(`plan references unknown source part '${n.src_file_name}'`);let a=0;for(;a<n.length;){let c=Math.min(Ke,n.length-a),l=await s.file.readAt(n.offset+a,c);if(l.length<c)throw new Error(`short read in ${b(s.path)} at ${n.offset+a}`);await i.writeAt(n.write_to_dest_offset+a,l),a+=c}}e.dest_footer_bytes_base64&&e.dest_footer_offset!=null&&await i.writeAt(e.dest_footer_offset,T(e.dest_footer_bytes_base64));for(let n of e.dest_patches??[])await i.writeAt(n.offset,T(n.bytes_base64))}finally{await i.close()}for(let n of e.dest_sidecar_writes??[])await H(_(y(o),n.name),T(n.bytes_base64))}function Xe(e,t){let o=[];for(let r of e){if(r.kind!=="clip"||!r.source_range)continue;let i=r.source_range.start.value,n=r.source_range.duration.value,s=Math.max(0,Math.floor(i)-t),a=Math.floor(i+n-1)+t;a>=s&&o.push({first_frame:s,last_frame:a})}return de(o)}async function Ge(e,t,o,r,i){let n=await Y(e);try{let s=Xe(t,o);if(!s.length)throw new Error("no usable frame ranges (items need kind=clip with source_range)");let a=await D(n.source,{verb:"trim",selection:{items:t,handles:o}}),c=L(n.anchor),l=n.format==="r3d",u=l?M(b(n.anchor))?.clipBase??b(n.anchor,c):b(n.anchor,c),m=[];for(let[d,f]of a.entries()){let p=f.output_clip_number??(s.length>1?d+1:void 0),h=s[(p??1)-1]??s[0],g=p&&(f.output_clip_count??s.length)>1?`_S${String(p).padStart(3,"0")}`:"",w;if(l){let x=f.output_part_number??d+1;w=_(r,`${u}${g}.RDC`,`${u}_${String(x).padStart(3,"0")}.R3D`),m.push({path:w,bytes:f.total_size,island:h,part:x,clip:p})}else{let x=i&&a.length===1?i:`${u}${g||`_trim_${h.first_frame}-${h.last_frame}`}${c}`;w=_(r,x),m.push({path:w,bytes:f.total_size,island:h,clip:p})}await Ve(f,n,w)}return l||await Ye(e,m,!!i&&a.length===1),{outputs:m,islands:s,format:n.format}}finally{n.close()}}async function Ye(e,t,o){let r=await P(e).catch(()=>null),i=r?.source_fps??r?.streams?.find(n=>n.kind==="video")?.rate??null;if(!(!r?.source_timecode||!i))for(let n of t){if(!n.island)continue;let s=await P(n.path).catch(()=>null),a=s?.available_range?.duration?.value??s?.declared_duration?.value;if(!s?.source_timecode||!a)continue;let c=R(s.source_timecode,i,r.source_timecode);if(c===n.island.first_frame&&c+a-1===n.island.last_frame||(n.island={first_frame:c,last_frame:c+a-1},o))continue;let l=n.path.replace(/_trim_\d+-\d+(\.[^./\\]+)$/,`_trim_${c}-${c+a-1}$1`);l!==n.path&&(await W(n.path,l),n.path=l)}}async function Br(e){let t=await P(e.path),o=t.source_fps??t.streams?.find(p=>p.kind==="video")?.rate??null,r=t.available_range?.duration?.value??t.declared_duration?.value??null;if(!o)throw new Error("cannot trim: no frame rate / timecode track on this file");let i=R(e.in,o,t.source_timecode??null),n=R(e.out,o,t.source_timecode??null);if(e.out_exclusive&&(n-=1),n<i)throw new Error(`out (${n}) is before in (${i})`);if(i<0)throw new Error(`in (${i}) is before the file start (TC ${t.source_timecode})`);if(r!=null&&n>r-1)throw new Error(`out (${n}) is past the last frame (${r-1})`);let s={id:"trim",kind:"clip",source_range:{start:{value:i,rate:o},duration:{value:n-i+1,rate:o}}},a=y(e.path),c;if(e.out_path)try{(await B(e.out_path)).isDirectory?a=e.out_path:(a=y(e.out_path),c=b(e.out_path))}catch{a=y(e.out_path),c=b(e.out_path)}let l=await Ge(e.path,[s],Math.max(0,Math.floor(e.handles??0)),a,c),u=l.islands[0],m=l.outputs.length===1&&l.outputs[0].island?l.outputs[0].island:u,d=m.first_frame,f=m.last_frame;return{outputs:l.outputs,first_frame:d,last_frame:f,frames:f-d+1,fps:o,facts:t,...d!==u.first_frame||f!==u.last_frame?{asked:{first_frame:u.first_frame,last_frame:u.last_frame}}:{}}}function Re(e){let t=[...G].map(o=>o.slice(1)).join("|");return e.toLowerCase().replace(new RegExp(`\\.(${t})(?=[._\\s-]|$)`,"g"),"").replace(/[^a-z0-9]/g,"")}function Ze(e,t){let o=Re(e),r=Re(t);if(r&&o.includes(r))return"name";let i=t.toLowerCase().split(/[^a-z0-9]+/).filter(n=>/\d/.test(n)&&n.length>=3);return i.length&&i.every(n=>o.includes(n))?"id":null}async function Hr(e,t,o){let r=[],i=0,n=null,s=Date.now()+o.time_limit_s*1e3,a=async(c,l)=>{try{for await(let u of v(c)){if(n&&!n.startsWith("folders"))return;if(++i>o.max_entries){n=`stopped after ${o.max_entries} entries (max_entries)`;return}if(Date.now()>s){n=`stopped after ${o.time_limit_s} s (time_limit_s)`;return}if(u.name.startsWith("."))continue;let m=_(c,u.name);if(u.isDirectory)l<o.max_depth?await a(m,l+1):n??=`folders deeper than max_depth=${o.max_depth} not searched (e.g. ${m})`;else if(u.isFile&&G.has(L(u.name).toLowerCase())){let d=Ze(u.name,t);d&&r.push({path:m,match:d,size:(await B(m).catch(()=>({size:0}))).size})}}}catch{}};if(await a(e,0),o.probe)for(let c=0;c<r.length;c+=8)await Promise.all(r.slice(c,c+8).map(async l=>{try{l.facts=await P(l.path)}catch(u){l.error=u.message}}));return r.sort((c,l)=>c.path.localeCompare(l.path)),{hits:r,scanned:i,truncated:n}}function Qe(e){let t=e.streams?.find(a=>a.kind==="video"),o=e.source_fps??t?.rate??null,r=e.available_range?.duration?.value??e.declared_duration?.value??null,i=t?.codec_specific??{},n=e.source_timecode&&o?J(e.source_timecode,o):null,s=n!=null&&r!=null&&o?C((n+r)%(Math.round(o)*86400),o,e.source_timecode.includes(";")):null;return`${t?`${t.codec??"?"}${i.profile?` ${i.profile}`:""} ${t.width??"?"}x${t.height??"?"}`:"no video"}${o?` @ ${Math.round(o*1e3)/1e3} fps`:""}; TC ${e.source_timecode??"none"}${s?`\u2013${s}`:""}; ${r??"?"} fr${r!=null&&o?` (${(r/o).toFixed(2)} s)`:""}`}function jr(e,t,o,r){let i=e.hits.slice(0,r),n=[];e.truncated&&n.push(`TRUNCATED: ${e.truncated} \u2014 the search did NOT cover all of ${t}; the matches below may be incomplete.`),e.hits.length>i.length&&n.push(`TRUNCATED: showing ${i.length} of ${e.hits.length} matches. Pass limit=${e.hits.length} or narrow the query.`),n.push(`${e.hits.length} file${e.hits.length===1?"":"s"} match "${o}" under ${t} (${e.scanned} entries scanned)`);let s=new Map;for(let c of e.hits)s.set(b(c.path).toLowerCase(),(s.get(b(c.path).toLowerCase())??0)+1);let a=[...s].filter(([,c])=>c>1);a.length&&n.push(`same name in several folders: ${a.map(([c,l])=>`${c} \xD7${l}`).join(", ")} \u2014 they can be DIFFERENT clips; match by TC + duration, never by name alone`);for(let c of i)n.push(`- ${c.path}${c.match==="id"?" (id match)":""}
|
|
9
9
|
${c.facts?Qe(c.facts):c.error?`probe failed: ${c.error}`:`${(c.size/1e6).toFixed(1)} MB`}`);return n.join(`
|
|
@@ -0,0 +1,5 @@
|
|
|
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{O as w,b as m,f as d,g as y,p,s as g}from"./chunk-DNS4ZYIO.js";async function E(){let e=y()==="win32"?"conformtools-analyze.exe":"conformtools-analyze",r=[m("CONFORM_ANALYZE"),p(new URL(`./${e}`,import.meta.url)),p(new URL(`../../rust/target/release/${e}`,import.meta.url))].filter(Boolean);for(let n of r)if(await g(n))return n;return null}var b=e=>e.code==="not_entitled"?new f("not_entitled",String(e.why)):void 0;async function v(e){let r=await h(),n=await r.ask({op:"job",reference:e.reference,clips:e.clips,lite:e.lite??!0,display:!!e.display});if(!n.ok)throw r.close(),b(n)??new Error(`analysis engine: ${n.why}`);return r}async function k(e,r,n){let s=await h(),i=()=>s.close();n?.addEventListener("abort",i);let t;try{t=await s.ask(e,r)}finally{n?.removeEventListener("abort",i),s.close()}if(n?.aborted)throw new Error("cancelled");if(!t.ok)throw b(t)??new Error(t.why??`the analysis engine could not run ${e.op}`);return t}async function h(){let e=await E();if(!e)throw new Error("the analysis engine (conformtools-analyze) is not installed");let r="",n=null,s=w(e,["serve"],l=>{r+=new TextDecoder().decode(l);let a;for(;(a=r.indexOf(`
|
|
4
|
+
`))>=0;){let u=r.slice(0,a);r=r.slice(a+1);let o=JSON.parse(u);if(o.progress){n?.progress?.(o.progress[0],o.progress[1],o.phase??"");continue}let c=n;n=null,c?.done(o)}},l=>console.error(l.trimEnd()));s.exited.then(()=>n?.done({ok:!1,why:"the analysis engine exited"}));let i=Promise.resolve();return{ask:(l,a)=>{let u=i.then(async()=>{s.hold(!0);try{let o=new Promise(x=>{n={done:x,progress:a}});await s.write(new TextEncoder().encode(JSON.stringify(l)+`
|
|
5
|
+
`));let c=await o;return c.miss&&(console.error(`[mirror] MISS \u2014 ${c.miss} is not in the mirror. Replay never reads the source drive; record this case again with the drive mounted (CONFORM_MIRROR_MODE=record).`),d(75)),c}finally{s.hold(!1)}});return i=u.catch(()=>{}),u},close:()=>s.close()}}export{E as a,v as b,k as c,h as d};
|