conformtools 0.6.27 → 0.6.29
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-RSL4PTDB.js → account-F4ODJBD2.js} +1 -1
- package/dist/{agent-hook-setup-IACTYSVL.js → agent-hook-setup-KBCGZNEE.js} +1 -1
- package/dist/{analysis-engine-BBOSGAB2.js → analysis-engine-LGB4OXG7.js} +1 -1
- package/dist/{bridge-42OMO43V.js → bridge-GLW34YZF.js} +1 -1
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/{chunk-2DMNGWC2.js → chunk-7DH6DFYL.js} +1 -1
- package/dist/{chunk-XLRQNFJU.js → chunk-BZE7IP6U.js} +91 -91
- package/dist/{chunk-TGLH2JDW.js → chunk-FHCRWOI7.js} +1 -1
- package/dist/{chunk-NRURUPLU.js → chunk-GDPYFRSV.js} +1 -1
- package/dist/chunk-H3FD5KA2.js +7 -0
- package/dist/{chunk-BIX5ETBY.js → chunk-HHOFGYZ7.js} +1 -1
- package/dist/{chunk-YMRK5D3X.js → chunk-HZBGG7HI.js} +1 -1
- package/dist/{chunk-AR5BTVBM.js → chunk-KD7UGCLT.js} +1 -1
- package/dist/{chunk-2X2SFPWD.js → chunk-NTPDZOPF.js} +1 -1
- package/dist/chunk-QDL3XYOE.js +545 -0
- package/dist/chunk-QQBDHVUU.js +3 -0
- package/dist/chunk-RKJML7MH.js +10 -0
- package/dist/{chunk-T4B4Y5WQ.js → chunk-RVKNGIE3.js} +2 -2
- package/dist/{chunk-3KS3547B.js → chunk-SSFG7FNI.js} +1 -1
- package/dist/{chunk-UXEL636C.js → chunk-UXVABU6B.js} +1 -1
- package/dist/{chunk-6BL5HE4S.js → chunk-WJS6NM7T.js} +1 -1
- package/dist/{chunk-RL5XRG6O.js → chunk-WWE2FXAQ.js} +1 -1
- package/dist/{chunk-HNEKQMQG.js → chunk-YJREJ2MH.js} +1 -1
- package/dist/{chunk-JZCADV5C.js → chunk-ZE7BP4AE.js} +1 -1
- package/dist/{claude-setup-6RMV3QZM.js → claude-setup-FYWGYBTH.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/demo-engine-5HWLXPDJ.js +3 -0
- package/dist/{engine-I2NXY2OK.js → engine-LFB243Q6.js} +2 -2
- package/dist/{framing-PHFTZ4GL.js → framing-KHUFARKE.js} +1 -1
- package/dist/gfx-worker.js +1 -1
- package/dist/h264-QGSP23K2.js +3 -0
- package/dist/{h264-mxf-PKSTGNGH.js → h264-mxf-I4YANT5F.js} +1 -1
- package/dist/{host-relink-FHOEDE76.js → host-relink-L7I75SUH.js} +1 -1
- package/dist/{hosted-26GUD7IU.js → hosted-5Y5VX6X6.js} +1 -1
- package/dist/hosts-QMGBN2E6.js +3 -0
- package/dist/http.js +2 -2
- package/dist/{inspect-RT36GEVU.js → inspect-GP6B6UPD.js} +2 -2
- package/dist/{isobmff-65LRNCQH.js → isobmff-LAXAYC7P.js} +1 -1
- package/dist/{mc-video-2PCAX65A.js → mc-video-KQ7TP4DG.js} +1 -1
- package/dist/mcp.js +7 -7
- package/dist/{media-OXHZ3PGZ.js → media-SUPBJX64.js} +1 -1
- package/dist/{mxf-WFJNAX7D.js → mxf-2TQO552L.js} +1 -1
- package/dist/{ops-SH3IUU2Z.js → ops-CVKPID5Z.js} +1 -1
- package/dist/{probe-VB6JH6ZJ.js → probe-HUPB4H4G.js} +1 -1
- package/dist/{r3d-X2O5LUAB.js → r3d-EPSGIBPT.js} +1 -1
- package/dist/resolve-bridge.py +4 -1
- package/dist/{sequence-patch-OHYBBKKZ.js → sequence-patch-GXM3QSJC.js} +1 -1
- package/dist/{store-F2CTSR6E.js → store-K4W2LVRN.js} +1 -1
- package/dist/{timeline-AK6DUMWB.js → timeline-HTG23FEH.js} +1 -1
- package/package.json +5 -5
- package/dist/chunk-E4KQR4M3.js +0 -10
- package/dist/chunk-IDADYIY6.js +0 -7
- package/dist/chunk-M6SVZJAX.js +0 -537
- package/dist/chunk-ZPIY5DOU.js +0 -3
- package/dist/demo-engine-ITZ7VG6Q.js +0 -3
- package/dist/h264-TVMYQ7EB.js +0 -3
- package/dist/hosts-DXH4SQPZ.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{A as l,B as m,C as n,D as o,E as p,F as q,G as r,H as s,I as t,p as a,q as b,r as c,s as d,t as e,u as f,v as g,w as h,x as i,y as j,z as k}from"./chunk-
|
|
3
|
+
import{A as l,B as m,C as n,D as o,E as p,F as q,G as r,H as s,I as t,p as a,q as b,r as c,s as d,t as e,u as f,v as g,w as h,x as i,y as j,z as k}from"./chunk-KD7UGCLT.js";import"./chunk-VZ3XYHK4.js";import"./chunk-YJREJ2MH.js";import"./chunk-E75BCWXY.js";import"./chunk-QQBDHVUU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";export{c as NET_TIMEOUT_MS,d as _forgetOffline,f as accessToken,h as accountStatus,a as config,o as devNow,j as includesOf,p as isDev,b as legacyKvStorePath,s as login,t as logout,e as modelKey,n as requireApp,q as requireDevTool,l as requireEntitled,m as requireMcp,r as requireStudioTool,k as setAccountGate,i as statusText,g as tokenOrWhy};
|
|
@@ -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{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m}from"./chunk-
|
|
3
|
+
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m}from"./chunk-H3FD5KA2.js";import"./chunk-QQBDHVUU.js";import"./chunk-PSANHDZM.js";export{a as CLIENTS,j as WHAT_IT_RECORDS,f as clientsHere,b as hookFiles,i as hookInstalled,l as hooksRemovedText,m as hooksStatusText,k as hooksText,d as installAgentHook,g as installAllAgentHooks,c as installHookScript,e as removeAgentHook,h as removeAllAgentHooks};
|
|
@@ -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}from"./chunk-
|
|
3
|
+
import{a,b,c,d}from"./chunk-YJREJ2MH.js";import"./chunk-E75BCWXY.js";import"./chunk-QQBDHVUU.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{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h}from"./chunk-
|
|
3
|
+
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h}from"./chunk-HZBGG7HI.js";import"./chunk-WJS6NM7T.js";import"./chunk-QQBDHVUU.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};
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{Mb as F,Nb as N,Qb as D}from"./chunk-XLRQNFJU.js";import{i as j}from"./chunk-YMRK5D3X.js";import{B as E,C as M,G as C,I as R,J as T,N as q,O as L,R as w,aa as b,ca as k,da as _,fa as I,h as y,o as O,t as S,u as A,v as x,w as P,z as H}from"./chunk-ZPIY5DOU.js";var W=16e3,h=class extends Error{constructor(t,s){super(s);this.code=t}},$=class p{constructor(e,t=j,s=W){this.spec=e;this.bridge=t;this.waitMs=s;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={},s){return await this.peer(),await(await this.bridge()).request(this.host,e,t,s)}static{this.announced=(e,t)=>e.optional_verbs.includes(t)}async support(){let e;try{e=await(await this.bridge()).waitFor(this.host,Math.min(3e3,this.waitMs))}catch(n){let o={ok:!1,reason:n instanceof Error?n.message:String(n)};return{export:o,open:o,render:o,markers:o}}if(!e){let n={ok:!1,reason:`the conform.tools plugin in ${this.spec.label} is not connected`,setup:this.spec.setup};return{export:n,open:n,render:n,markers:n}}let t=(n,o)=>n?{ok:!0}:{ok:!1,reason:`this plugin version has no ${o}`},s=e.capabilities;return{export:t(s.includes("timeline_read")||s.includes("timeline_write"),"timeline_read"),open:t(p.announced(e,"timeline_write.import_file"),"timeline_write.import_file"),render:t(s.includes("render"),"render"),markers:t(s.includes("markers"),"markers")}}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}),s=[];for(let o=1;o<=t;o++){let l=await this.ask("session.timeline_by_index",{project:e,index:o});l&&s.push(await this.ask("session.name",{handle:l}))}let n=await this.ask("session.current_timeline",{project:e});return{project:await this.ask("session.name",{handle:e}),timelines:s,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 o=await this.ask("session.current_timeline",{project:t});if(!o)throw new h("no_timeline",`${this.host}: no timeline is active`);return{project:t,seq:o,name:await this.ask("session.name",{handle:o})}}let s=await this.ask("session.timeline_count",{project:t}),n=[];for(let o=1;o<=s;o++){let l=await this.ask("session.timeline_by_index",{project:t,index:o});if(!l)continue;let d=await this.ask("session.name",{handle:l});if(d===e)return{project:t,seq:l,name:d};n.push(d)}throw new h("not_found",`${this.host}: no timeline named "${e}" (have: ${n.join(", ")})`)}async model(e){let{project:t,seq:s}=await this.sequence(e);return await this.ask("timeline_read.model",{timeline:s,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:s,seq:n,name:o}=await this.sequence(e.timeline),l=await this.ask("session.name",{handle:s}),d=r=>p.announced(t,r),m=e.out_path,c,a=[];if(d("timeline_write.export_otio")||d("timeline_write.export_xml")){let r=d("timeline_write.export_otio"),i=await this.ask(r?"timeline_write.export_otio":"timeline_write.export_xml",{project:s,timeline:n,path:e.out_path},12e4);if(c=i.format??(r?"otio":"xmeml"),i.ok===!1)throw new h("export_failed",`${this.host}: ${this.spec.label} did not write ${e.out_path}${i.errors?.length?` (${i.errors.join("; ")})`:""}`);i.path&&i.path!==e.out_path&&(m=await this.adopt(i.path,e.out_path)),a=i.warnings??[]}else if(d("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:s},12e4),i=J(r);await E(e.out_path,JSON.stringify(i.otio)),c="otio",a=i.notes}if(!F.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:l,timeline:o,...a.length?{notes:a}:{}}}async adopt(e,t){let s=k(e)&&k(e)!==k(t)?t.slice(0,t.length-k(t).length)+k(e):t;if(await C(e,s),!N(s))throw new h("export_failed",`${this.host}: ${this.spec.label} exported ${b(e)}, which the engine does not read`);return s}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(!p.announced(t,"timeline_write.import_file"))throw new h("unsupported",`${this.host}: this conform.tools plugin cannot import timelines (${this.spec.setup})`);let s=await this.ask("session.current_project");if(!s)throw new h("no_project",`${this.host}: no project is open`);let n=await this.ask("timeline_write.import_file",{project:s,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 o=[...n.issues??[]];return n.imported.length>1&&o.push(`imported ${n.imported.length} timelines: ${n.imported.map(l=>l.name).join(", ")}`),e.name&&o.push(`${this.spec.label} names imported timelines after the file's own; name was not applied`),e.media_dirs?.length&&o.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:s}),timeline:n.imported[0]?.name??b(e.path),notes:o,restored:!e.stay,...n.bin?{folder:n.bin}:{}}}async modelItems(e){let t=await this.model(e.timeline),s=[...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:s,color_groups:[],layers:1}}async apply(e){let t=e.ops.length>0&&e.ops.every(a=>a.op==="timeline_rename"&&(a.timeline||a.guid)),{project:s,seq:n,name:o}=await this.sequence(t?void 0:e.timeline),l=[],d=[],m=a=>a.op.startsWith("marker_")&&!a.item;for(let a=0;a<e.ops.length;){let r=a;for(;r<e.ops.length&&m(e.ops[r])===m(e.ops[a]);)r++;let i=e.ops.slice(a,r),u=m(i[0])?await this.markerOps(n,i):await this.clipOps(n,i,e.timeline);l.push(...u.results),d.unshift(...u.undo),a=r}let c=l.filter(a=>a.ok).length;return{project:await this.ask("session.name",{handle:s}),timeline:o,results:l,undo:d,applied:c,failed:l.length-c}}async clipOps(e,t,s){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 o=(a,r)=>({op:a.op,ok:!1,detail:r});if(!n.capabilities.includes("item_meta"))return{results:t.map(a=>o(a,`${this.host}: clip edits are not reachable over this plugin`)),undo:[]};let l=await this.model(s),d=a=>a?"id"in a?{$h:a.id}:(a.kind??"video")!=="video"?null:l.items.find(r=>r.track===a.track&&r.start-l.start_frame===a.start)?.handle??null:null,m=[],c=[];for(let a of t){let r=d(a.item);try{if(!r)m.push(o(a,`no video item at ${JSON.stringify(a.item??null)}`));else if(a.op==="clip_color"){let i=await this.ask("item_meta.color",{handle:r}),u=a.color?await this.ask("item_meta.set_color",{handle:r,color:a.color}):await this.ask("item_meta.clear_color",{handle:r});m.push({op:a.op,ok:u}),u&&c.unshift({op:"clip_color",item:a.item,color:i})}else if(a.op==="enabled"&&p.announced(n,"item_meta.set_enabled")){let i=l.items.find(f=>f.handle?.$h===r.$h)?.enabled??!0,u=await this.ask("item_meta.set_enabled",{item:r,enabled:!!a.on});m.push({op:a.op,ok:u}),u&&c.unshift({op:"enabled",item:a.item,on:i})}else m.push(o(a,`${this.host}: '${a.op}' is not reachable over this plugin`))}catch(i){m.push(o(a,i instanceof Error?i.message:String(i)))}}return{results:m,undo:c}}async markerOps(e,t){let s=await this.peer(),n=r=>p.announced(s,r),o=new Map((await this.ask("markers.list",{target:e})).map(r=>[r.frame,r])),l=[],d=[],m=async r=>{let i=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 i&&o.set(r.frame,{color:"",name:"",note:"",duration:1,...r}),i},c=async r=>{let i=await this.ask("markers.delete_at",{target:e,frame:r});return i&&o.delete(r),i},a=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 i=Number(r.frame);try{if(r.op==="marker_add"){let u=o.get(i);u&&await c(i);let f=await m({frame:i,color:r.color,name:r.name,note:r.note,duration:Number(r.duration??1),custom_data:r.data});l.push({op:r.op,ok:f}),f&&d.unshift(...u?[a(u)]:[],{op:"marker_delete",frame:i})}else if(r.op==="marker_update"){let u=o.get(i);if(!u){l.push({op:r.op,ok:!1,detail:`no marker at frame ${i}`});continue}let f=r.to_frame!==void 0?Number(r.to_frame):i,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:i,color:r.color})&&g),(r.name!==void 0||r.note!==void 0)&&(g=await this.ask("markers.set_text",{target:e,frame:i,name:r.name,note:r.note})&&g),f!==i&&(g=await this.ask("markers.move",{target:e,frame:i,to_frame:f})&&g),o.delete(i),o.set(f,v)):g=await c(i)&&await m(v),l.push({op:r.op,ok:g}),d.unshift({op:"marker_update",frame:f,color:u.color,name:u.name,note:u.note,...f!==i?{to_frame:i}:{}})}else if(r.op==="marker_delete"){let u=o.get(i),f=!!u&&await c(i);l.push({op:r.op,ok:f,...u?{}:{detail:`no marker at frame ${i}`}}),f&&u&&d.unshift(a(u))}else l.push({op:r.op,ok:!1,detail:`${this.host}: '${r.op}' is not reachable over this plugin`})}catch(u){l.push({op:r.op,ok:!1,detail:u instanceof Error?u.message:String(u)})}}return{results:l,undo:d}}async renderStart(e){if(await this.needs("render"),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:s}=await this.sequence(e.timeline),n=e.name??s,o={purpose:"deliver",format:"preset",preset:e.preset,target_dir:e.target_dir,name:n,...e.range?{range:[e.range.in,e.range.out]}:{}},l=await this.ask("render.submit",{timeline:t,job:o});if(!l?.id)throw new h("render_refused",`${this.host}: ${l?.error??`${this.spec.label} refused the render`}`);if(!await this.ask("render.start",{job_ids:[l.id]}))throw new h("render_refused",`${this.host}: ${this.spec.label} did not start job ${l.id}`);return this.renders.set(l.id,{dir:e.target_dir,name:n}),{job_id:l.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 s={done:"complete",rendering:"rendering",queued:"queued",failed:"failed",cancelled:"cancelled"}[t.state]??"rendering",n={job_id:e,state:s,percent:Math.round(t.progress??(s==="complete"?100:0)),...t.error?{error:t.error}:{}};if(s==="complete"||s==="failed"||s==="cancelled"){let o=this.renders.get(e);s==="complete"&&o&&(n.outputs=await V(o.dir,o.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 V(p,e){let t=[];try{for await(let s of L(p))s.isFile&&s.name.startsWith(`${e}.`)&&t.push(_(p,s.name))}catch{}return t.sort()}function J(p){let e=(c,a)=>({OTIO_SCHEMA:"RationalTime.1",value:c,rate:a}),t=(c,a,r,i=r)=>({OTIO_SCHEMA:"TimeRange.1",start_time:e(c,r),duration:e(a,i)}),s=p.fps,n=p.tracks?.length?p.tracks:[...new Set(p.items.map(c=>c.track))].sort((c,a)=>c-a).map(c=>({index:c,enabled:!0,name:"",items:p.items.filter(a=>a.track===c)})),o=c=>(c.reversed?-1:1)*(c.speed||1)/(c.fps_factor||1),l=new Map;for(let c of p.items)if(c.file_path&&c.start_tc!=null&&c.src_abs_in!=null){let a=c.src_abs_in-c.start_tc+Math.ceil((c.end-c.start)*Math.abs(o(c))*(c.fps_factor||1));l.set(c.file_path,Math.max(l.get(c.file_path)??0,a))}let d=n.map(c=>{let a=p.start_frame,r=[];for(let i of[...c.items].sort((u,f)=>u.start-f.start)){if(i.start<a)continue;i.start>a&&r.push({OTIO_SCHEMA:"Gap.1",name:"",source_range:t(0,i.start-a,s)});let u=i.src_fps||s,f=i.start_tc!=null&&l.has(i.file_path)?i.start_tc:null,v=f!=null?i.src_abs_in:i.src_in??i.src_abs_in??0,g=o(i);r.push({OTIO_SCHEMA:"Clip.2",name:i.name??b(i.file_path||""),enabled:i.enabled!==!1,source_range:t(v,i.end-i.start,u,s),media_references:{DEFAULT_MEDIA:{OTIO_SCHEMA:"ExternalReference.1",name:b(i.file_path||""),target_url:i.file_path?`file://${i.file_path}`:"",...f!=null?{available_range:t(f,l.get(i.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:i.reel?{cmx_3600:{reel:i.reel}}:{}}),a=i.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 p.audio_items?.length&&m.push(`${p.audio_items.length} audio clip(s) not carried: the host's plugin reports no audio source times`),p.transitions?.length&&m.push(`${p.transitions.length} transition(s) not carried (cuts in their place)`),{otio:{OTIO_SCHEMA:"Timeline.1",name:p.timeline,global_start_time:e(p.start_frame,s),metadata:{},tracks:{OTIO_SCHEMA:"Stack.1",name:"tracks",children:d,effects:[],markers:[],metadata:{}}},notes:m}}var X=16e3,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,s=X){super({host:"premiere",label:"Premiere Pro",setup:G},t,s);this.items=async(t={})=>{await this.needs("edit");let{seq:s}=await this.sequence(t.timeline),n=await this.ask("edit.items",{timeline:s,kind:t.kind,track:t.track},12e4),o=n.project_path?await K(n.project_path,n.timeline).catch(d=>({error:d instanceof Error?d.message:String(d)})):{error:"the project has never been saved"},l=0;if(!("error"in o))for(let d of n.items){let m=o.get(`${d.kind}:${d.track}:${d.start}:${Number(d.end)-Number(d.start)}`);m?Object.assign(d,m,{saved:!0}):(d.saved=!1,l++)}return{...n,color_groups:[],layers:1,..."error"in o?{saved_note:`saved project not read: ${o.error}`}:{unsaved_items:l}}};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:s}=await this.sequence(t);return await this.ask("edit.markers",{timeline:s},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,s){await this.needs("edit");let{seq:n}=await this.sequence(t);return await this.ask("edit.cut_in",{timeline:n,cuts:s},12e4+s.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:s,name:n}=await this.sequence(t.timeline);await M(t.target_dir);let o=_(t.target_dir,`${t.name??n}.mov`),l=await this.ask("render.export_sequence",{timeline:s,output_path:o,preset_path:t.preset,queue:!1},6e4);if(!l.ok)throw new h("render_refused","premiere: Premiere refused the export");let d=l.job||`ppro-${Date.now()}`;return this.premiereRenders.set(d,o),{job_id:d,state:"rendering",percent:0}}async renderStatus(t){let s=await this.ask("render.progress"),n=s[t]??s.last,o=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"||o&&await x(o)&&!n?{job_id:t,state:"complete",percent:100,...o?{outputs:[o]}:{}}:{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(p,e){let{session:t}=await D(p,"prproj"),s=t.timelines.find(o=>o.name===e),n=new Map;if(!s)throw new Error(`the saved project has no sequence "${e}" (saved before it was made?)`);for(let o of s.tracks)if(!(o.kind!=="Video"&&o.kind!=="Audio"))for(let l of o.items){if(l.kind==="gap"||l.kind==="transition")continue;let d=l;n.set(`${o.kind==="Video"?"video":"audio"}:${o.track_index}:${l.timeline_range.start.value}:${l.timeline_range.duration.value}`,{saved_id:l.id,...d.speed_factor!=null&&d.speed_factor!==1?{retime:d.speed_factor}:{},...d.speed_ramped?{ramped:!0}:{},...d.speed_reverse?{reversed:!0}:{},...l.kind==="nested"?{nested:!0}:{},...d.is_multicam?{multicam:!0}:{},...d.effects?.some(m=>/stabiliz/i.test(m.kind??""))?{stabilized:!0}:{},...d.effects?.length?{saved_effects:d.effects.map(m=>m.name??m.kind??"")}:{}})}return n}function z(p=y()){return p==="darwin"?"/Library/Application Support/Adobe/Adobe Desktop Common/RemoteComponents/UPI/UnifiedPluginInstallerAgent/UnifiedPluginInstallerAgent.app/Contents/MacOS/UnifiedPluginInstallerAgent":p==="win32"?"C:\\Program Files\\Common Files\\Adobe\\Adobe Desktop Common\\RemoteComponents\\UPI\\UnifiedPluginInstallerAgent\\UnifiedPluginInstallerAgent.exe":null}async function B(){for(let p of["./uxp-plugin/","./premiere-uxp/"]){let e=S(new URL(p,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 B(),"manifest.json"))).version}async function oe(p=y()){let e=z(p);if(!e||!await x(e))return{installed:!1,listing:"Creative Cloud's plugin installer is not on this machine"};let t=await w(e,p==="win32"?["/list","all"]:["--list","all"],{timeoutMs:6e4}),s=t.stdout.split(`
|
|
3
|
+
import{Mb as F,Nb as N,Qb as D}from"./chunk-BZE7IP6U.js";import{i as j}from"./chunk-HZBGG7HI.js";import{C as E,D as M,H as C,J as R,K as T,O as q,P as L,S as w,ba as b,da as k,ea as _,ga as I,h as y,o as O,t as S,u as A,v as x,w as P,z as H}from"./chunk-QQBDHVUU.js";var W=16e3,h=class extends Error{constructor(t,s){super(s);this.code=t}},$=class p{constructor(e,t=j,s=W){this.spec=e;this.bridge=t;this.waitMs=s;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={},s){return await this.peer(),await(await this.bridge()).request(this.host,e,t,s)}static{this.announced=(e,t)=>e.optional_verbs.includes(t)}async support(){let e;try{e=await(await this.bridge()).waitFor(this.host,Math.min(3e3,this.waitMs))}catch(n){let o={ok:!1,reason:n instanceof Error?n.message:String(n)};return{export:o,open:o,render:o,markers:o}}if(!e){let n={ok:!1,reason:`the conform.tools plugin in ${this.spec.label} is not connected`,setup:this.spec.setup};return{export:n,open:n,render:n,markers:n}}let t=(n,o)=>n?{ok:!0}:{ok:!1,reason:`this plugin version has no ${o}`},s=e.capabilities;return{export:t(s.includes("timeline_read")||s.includes("timeline_write"),"timeline_read"),open:t(p.announced(e,"timeline_write.import_file"),"timeline_write.import_file"),render:t(s.includes("render"),"render"),markers:t(s.includes("markers"),"markers")}}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}),s=[];for(let o=1;o<=t;o++){let l=await this.ask("session.timeline_by_index",{project:e,index:o});l&&s.push(await this.ask("session.name",{handle:l}))}let n=await this.ask("session.current_timeline",{project:e});return{project:await this.ask("session.name",{handle:e}),timelines:s,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 o=await this.ask("session.current_timeline",{project:t});if(!o)throw new h("no_timeline",`${this.host}: no timeline is active`);return{project:t,seq:o,name:await this.ask("session.name",{handle:o})}}let s=await this.ask("session.timeline_count",{project:t}),n=[];for(let o=1;o<=s;o++){let l=await this.ask("session.timeline_by_index",{project:t,index:o});if(!l)continue;let d=await this.ask("session.name",{handle:l});if(d===e)return{project:t,seq:l,name:d};n.push(d)}throw new h("not_found",`${this.host}: no timeline named "${e}" (have: ${n.join(", ")})`)}async model(e){let{project:t,seq:s}=await this.sequence(e);return await this.ask("timeline_read.model",{timeline:s,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:s,seq:n,name:o}=await this.sequence(e.timeline),l=await this.ask("session.name",{handle:s}),d=r=>p.announced(t,r),m=e.out_path,c,a=[];if(d("timeline_write.export_otio")||d("timeline_write.export_xml")){let r=d("timeline_write.export_otio"),i=await this.ask(r?"timeline_write.export_otio":"timeline_write.export_xml",{project:s,timeline:n,path:e.out_path},12e4);if(c=i.format??(r?"otio":"xmeml"),i.ok===!1)throw new h("export_failed",`${this.host}: ${this.spec.label} did not write ${e.out_path}${i.errors?.length?` (${i.errors.join("; ")})`:""}`);i.path&&i.path!==e.out_path&&(m=await this.adopt(i.path,e.out_path)),a=i.warnings??[]}else if(d("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:s},12e4),i=J(r);await E(e.out_path,JSON.stringify(i.otio)),c="otio",a=i.notes}if(!F.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:l,timeline:o,...a.length?{notes:a}:{}}}async adopt(e,t){let s=k(e)&&k(e)!==k(t)?t.slice(0,t.length-k(t).length)+k(e):t;if(await C(e,s),!N(s))throw new h("export_failed",`${this.host}: ${this.spec.label} exported ${b(e)}, which the engine does not read`);return s}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(!p.announced(t,"timeline_write.import_file"))throw new h("unsupported",`${this.host}: this conform.tools plugin cannot import timelines (${this.spec.setup})`);let s=await this.ask("session.current_project");if(!s)throw new h("no_project",`${this.host}: no project is open`);let n=await this.ask("timeline_write.import_file",{project:s,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 o=[...n.issues??[]];return n.imported.length>1&&o.push(`imported ${n.imported.length} timelines: ${n.imported.map(l=>l.name).join(", ")}`),e.name&&o.push(`${this.spec.label} names imported timelines after the file's own; name was not applied`),e.media_dirs?.length&&o.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:s}),timeline:n.imported[0]?.name??b(e.path),notes:o,restored:!e.stay,...n.bin?{folder:n.bin}:{}}}async modelItems(e){let t=await this.model(e.timeline),s=[...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:s,color_groups:[],layers:1}}async apply(e){let t=e.ops.length>0&&e.ops.every(a=>a.op==="timeline_rename"&&(a.timeline||a.guid)),{project:s,seq:n,name:o}=await this.sequence(t?void 0:e.timeline),l=[],d=[],m=a=>a.op.startsWith("marker_")&&!a.item;for(let a=0;a<e.ops.length;){let r=a;for(;r<e.ops.length&&m(e.ops[r])===m(e.ops[a]);)r++;let i=e.ops.slice(a,r),u=m(i[0])?await this.markerOps(n,i):await this.clipOps(n,i,e.timeline);l.push(...u.results),d.unshift(...u.undo),a=r}let c=l.filter(a=>a.ok).length;return{project:await this.ask("session.name",{handle:s}),timeline:o,results:l,undo:d,applied:c,failed:l.length-c}}async clipOps(e,t,s){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 o=(a,r)=>({op:a.op,ok:!1,detail:r});if(!n.capabilities.includes("item_meta"))return{results:t.map(a=>o(a,`${this.host}: clip edits are not reachable over this plugin`)),undo:[]};let l=await this.model(s),d=a=>a?"id"in a?{$h:a.id}:(a.kind??"video")!=="video"?null:l.items.find(r=>r.track===a.track&&r.start-l.start_frame===a.start)?.handle??null:null,m=[],c=[];for(let a of t){let r=d(a.item);try{if(!r)m.push(o(a,`no video item at ${JSON.stringify(a.item??null)}`));else if(a.op==="clip_color"){let i=await this.ask("item_meta.color",{handle:r}),u=a.color?await this.ask("item_meta.set_color",{handle:r,color:a.color}):await this.ask("item_meta.clear_color",{handle:r});m.push({op:a.op,ok:u}),u&&c.unshift({op:"clip_color",item:a.item,color:i})}else if(a.op==="enabled"&&p.announced(n,"item_meta.set_enabled")){let i=l.items.find(f=>f.handle?.$h===r.$h)?.enabled??!0,u=await this.ask("item_meta.set_enabled",{item:r,enabled:!!a.on});m.push({op:a.op,ok:u}),u&&c.unshift({op:"enabled",item:a.item,on:i})}else m.push(o(a,`${this.host}: '${a.op}' is not reachable over this plugin`))}catch(i){m.push(o(a,i instanceof Error?i.message:String(i)))}}return{results:m,undo:c}}async markerOps(e,t){let s=await this.peer(),n=r=>p.announced(s,r),o=new Map((await this.ask("markers.list",{target:e})).map(r=>[r.frame,r])),l=[],d=[],m=async r=>{let i=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 i&&o.set(r.frame,{color:"",name:"",note:"",duration:1,...r}),i},c=async r=>{let i=await this.ask("markers.delete_at",{target:e,frame:r});return i&&o.delete(r),i},a=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 i=Number(r.frame);try{if(r.op==="marker_add"){let u=o.get(i);u&&await c(i);let f=await m({frame:i,color:r.color,name:r.name,note:r.note,duration:Number(r.duration??1),custom_data:r.data});l.push({op:r.op,ok:f}),f&&d.unshift(...u?[a(u)]:[],{op:"marker_delete",frame:i})}else if(r.op==="marker_update"){let u=o.get(i);if(!u){l.push({op:r.op,ok:!1,detail:`no marker at frame ${i}`});continue}let f=r.to_frame!==void 0?Number(r.to_frame):i,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:i,color:r.color})&&g),(r.name!==void 0||r.note!==void 0)&&(g=await this.ask("markers.set_text",{target:e,frame:i,name:r.name,note:r.note})&&g),f!==i&&(g=await this.ask("markers.move",{target:e,frame:i,to_frame:f})&&g),o.delete(i),o.set(f,v)):g=await c(i)&&await m(v),l.push({op:r.op,ok:g}),d.unshift({op:"marker_update",frame:f,color:u.color,name:u.name,note:u.note,...f!==i?{to_frame:i}:{}})}else if(r.op==="marker_delete"){let u=o.get(i),f=!!u&&await c(i);l.push({op:r.op,ok:f,...u?{}:{detail:`no marker at frame ${i}`}}),f&&u&&d.unshift(a(u))}else l.push({op:r.op,ok:!1,detail:`${this.host}: '${r.op}' is not reachable over this plugin`})}catch(u){l.push({op:r.op,ok:!1,detail:u instanceof Error?u.message:String(u)})}}return{results:l,undo:d}}async renderStart(e){if(await this.needs("render"),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:s}=await this.sequence(e.timeline),n=e.name??s,o={purpose:"deliver",format:"preset",preset:e.preset,target_dir:e.target_dir,name:n,...e.range?{range:[e.range.in,e.range.out]}:{}},l=await this.ask("render.submit",{timeline:t,job:o});if(!l?.id)throw new h("render_refused",`${this.host}: ${l?.error??`${this.spec.label} refused the render`}`);if(!await this.ask("render.start",{job_ids:[l.id]}))throw new h("render_refused",`${this.host}: ${this.spec.label} did not start job ${l.id}`);return this.renders.set(l.id,{dir:e.target_dir,name:n}),{job_id:l.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 s={done:"complete",rendering:"rendering",queued:"queued",failed:"failed",cancelled:"cancelled"}[t.state]??"rendering",n={job_id:e,state:s,percent:Math.round(t.progress??(s==="complete"?100:0)),...t.error?{error:t.error}:{}};if(s==="complete"||s==="failed"||s==="cancelled"){let o=this.renders.get(e);s==="complete"&&o&&(n.outputs=await V(o.dir,o.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 V(p,e){let t=[];try{for await(let s of L(p))s.isFile&&s.name.startsWith(`${e}.`)&&t.push(_(p,s.name))}catch{}return t.sort()}function J(p){let e=(c,a)=>({OTIO_SCHEMA:"RationalTime.1",value:c,rate:a}),t=(c,a,r,i=r)=>({OTIO_SCHEMA:"TimeRange.1",start_time:e(c,r),duration:e(a,i)}),s=p.fps,n=p.tracks?.length?p.tracks:[...new Set(p.items.map(c=>c.track))].sort((c,a)=>c-a).map(c=>({index:c,enabled:!0,name:"",items:p.items.filter(a=>a.track===c)})),o=c=>(c.reversed?-1:1)*(c.speed||1)/(c.fps_factor||1),l=new Map;for(let c of p.items)if(c.file_path&&c.start_tc!=null&&c.src_abs_in!=null){let a=c.src_abs_in-c.start_tc+Math.ceil((c.end-c.start)*Math.abs(o(c))*(c.fps_factor||1));l.set(c.file_path,Math.max(l.get(c.file_path)??0,a))}let d=n.map(c=>{let a=p.start_frame,r=[];for(let i of[...c.items].sort((u,f)=>u.start-f.start)){if(i.start<a)continue;i.start>a&&r.push({OTIO_SCHEMA:"Gap.1",name:"",source_range:t(0,i.start-a,s)});let u=i.src_fps||s,f=i.start_tc!=null&&l.has(i.file_path)?i.start_tc:null,v=f!=null?i.src_abs_in:i.src_in??i.src_abs_in??0,g=o(i);r.push({OTIO_SCHEMA:"Clip.2",name:i.name??b(i.file_path||""),enabled:i.enabled!==!1,source_range:t(v,i.end-i.start,u,s),media_references:{DEFAULT_MEDIA:{OTIO_SCHEMA:"ExternalReference.1",name:b(i.file_path||""),target_url:i.file_path?`file://${i.file_path}`:"",...f!=null?{available_range:t(f,l.get(i.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:i.reel?{cmx_3600:{reel:i.reel}}:{}}),a=i.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 p.audio_items?.length&&m.push(`${p.audio_items.length} audio clip(s) not carried: the host's plugin reports no audio source times`),p.transitions?.length&&m.push(`${p.transitions.length} transition(s) not carried (cuts in their place)`),{otio:{OTIO_SCHEMA:"Timeline.1",name:p.timeline,global_start_time:e(p.start_frame,s),metadata:{},tracks:{OTIO_SCHEMA:"Stack.1",name:"tracks",children:d,effects:[],markers:[],metadata:{}}},notes:m}}var X=16e3,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,s=X){super({host:"premiere",label:"Premiere Pro",setup:G},t,s);this.items=async(t={})=>{await this.needs("edit");let{seq:s}=await this.sequence(t.timeline),n=await this.ask("edit.items",{timeline:s,kind:t.kind,track:t.track},12e4),o=n.project_path?await K(n.project_path,n.timeline).catch(d=>({error:d instanceof Error?d.message:String(d)})):{error:"the project has never been saved"},l=0;if(!("error"in o))for(let d of n.items){let m=o.get(`${d.kind}:${d.track}:${d.start}:${Number(d.end)-Number(d.start)}`);m?Object.assign(d,m,{saved:!0}):(d.saved=!1,l++)}return{...n,color_groups:[],layers:1,..."error"in o?{saved_note:`saved project not read: ${o.error}`}:{unsaved_items:l}}};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:s}=await this.sequence(t);return await this.ask("edit.markers",{timeline:s},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,s){await this.needs("edit");let{seq:n}=await this.sequence(t);return await this.ask("edit.cut_in",{timeline:n,cuts:s},12e4+s.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:s,name:n}=await this.sequence(t.timeline);await M(t.target_dir);let o=_(t.target_dir,`${t.name??n}.mov`),l=await this.ask("render.export_sequence",{timeline:s,output_path:o,preset_path:t.preset,queue:!1},6e4);if(!l.ok)throw new h("render_refused","premiere: Premiere refused the export");let d=l.job||`ppro-${Date.now()}`;return this.premiereRenders.set(d,o),{job_id:d,state:"rendering",percent:0}}async renderStatus(t){let s=await this.ask("render.progress"),n=s[t]??s.last,o=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"||o&&await x(o)&&!n?{job_id:t,state:"complete",percent:100,...o?{outputs:[o]}:{}}:{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(p,e){let{session:t}=await D(p,"prproj"),s=t.timelines.find(o=>o.name===e),n=new Map;if(!s)throw new Error(`the saved project has no sequence "${e}" (saved before it was made?)`);for(let o of s.tracks)if(!(o.kind!=="Video"&&o.kind!=="Audio"))for(let l of o.items){if(l.kind==="gap"||l.kind==="transition")continue;let d=l;n.set(`${o.kind==="Video"?"video":"audio"}:${o.track_index}:${l.timeline_range.start.value}:${l.timeline_range.duration.value}`,{saved_id:l.id,...d.speed_factor!=null&&d.speed_factor!==1?{retime:d.speed_factor}:{},...d.speed_ramped?{ramped:!0}:{},...d.speed_reverse?{reversed:!0}:{},...l.kind==="nested"?{nested:!0}:{},...d.is_multicam?{multicam:!0}:{},...d.effects?.some(m=>/stabiliz/i.test(m.kind??""))?{stabilized:!0}:{},...d.effects?.length?{saved_effects:d.effects.map(m=>m.name??m.kind??"")}:{}})}return n}function z(p=y()){return p==="darwin"?"/Library/Application Support/Adobe/Adobe Desktop Common/RemoteComponents/UPI/UnifiedPluginInstallerAgent/UnifiedPluginInstallerAgent.app/Contents/MacOS/UnifiedPluginInstallerAgent":p==="win32"?"C:\\Program Files\\Common Files\\Adobe\\Adobe Desktop Common\\RemoteComponents\\UPI\\UnifiedPluginInstallerAgent\\UnifiedPluginInstallerAgent.exe":null}async function B(){for(let p of["./uxp-plugin/","./premiere-uxp/"]){let e=S(new URL(p,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 B(),"manifest.json"))).version}async function oe(p=y()){let e=z(p);if(!e||!await x(e))return{installed:!1,listing:"Creative Cloud's plugin installer is not on this machine"};let t=await w(e,p==="win32"?["/list","all"]:["--list","all"],{timeoutMs:6e4}),s=t.stdout.split(`
|
|
4
4
|
`).find(n=>/CONFORM\.TOOLS|conformtools/i.test(n));return{installed:!!s&&/enabled|installed/i.test(s),version:s?.match(/(\d+\.\d+\.\d+)\s*$/)?.[1],listing:t.stdout.trim()}}async function ae(p=y()){let e=z(p);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 B(),s=await Q(),n=await q("conform-ccx-");for(let a of["manifest.json","index.html","index.js","lib","icons"])await T(_(t,a),_(n,a));let o=_(O(),"premiere");await M(o);let l=I(_(o,`conformtools-premiere-${s}.ccx`));await R(l);let d=p==="darwin"?await w("sh",["-c",`cd '${n.replace(/'/g,"'\\''")}' && zip -r -q -X '${l.replace(/'/g,"'\\''")}' manifest.json index.html index.js lib icons`]):await w("powershell",["-NoProfile","-Command",`Compress-Archive -Path '${n}\\*' -DestinationPath '${l.replace(/\.ccx$/,".zip")}' -Force; Move-Item -Force '${l.replace(/\.ccx$/,".zip")}' '${l}'`]);if(await R(n),!d.success)throw new Error(`premiere: could not package the panel: ${d.stderr.trim()}`);await w(e,p==="win32"?["/remove","conform.tools"]:["--remove","conform.tools"],{timeoutMs:12e4});let m=await w(e,p==="win32"?["/install",l]:["--install",l],{timeoutMs:18e4}),c=`${m.stdout}
|
|
5
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
6
|
`).pop()}`);return{version:s,ccx:l,output:c}}export{$ as a,U as b,K as c,Q as d,oe as e,ae as f};
|