conformtools 0.6.25 → 0.6.26

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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as T}from"./chunk-WWZDRERB.js";import{c as D}from"./chunk-4B4STXSA.js";import{Qb as P,Wb as N,_b as q}from"./chunk-E5TEETTE.js";import"./chunk-IN6XVTUS.js";import{l as A}from"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-Q2QOAQJV.js";import"./chunk-QOAPJ5Y2.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-N34DQ6MH.js";import{b as F}from"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import{n as M}from"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import{N as x,O as E,aa as U,ba as R,da as k,q as O,u as S}from"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";var y=s=>{let i=s?.target_url??s?.local_path??"";return i.startsWith("file://")?O(i):i};async function H(s,i){let o=await V(s,i);return await I(s,o.session,i),o}async function I(s,i,o){let r=await s.liveMarkers(o).catch(()=>null);if(!r)return;let l=i.timelines,e=l.find(m=>m.kind!=="compound")??l[0];if(!e)return;let t=(m,f,a,p)=>({id:`live-${p??"tl"}-${m}`,time:{value:m},duration:{value:Math.max(1,f)},color:a.color,name:a.name,note:a.note,...p?{item_id:p}:{}}),n=r.timeline.map(m=>t(m.frame,m.duration,m)),c=e.tracks.filter(m=>m.kind==="Video");for(let m of r.clips){let f=c[m.track-1]?.items.find(a=>a.timeline_range?.start?.value===m.start);if(f)for(let a of m.markers)n.push(t(a.frame,a.duration,a,f.id))}e.markers=n}async function V(s,i){let o=await s.items({timeline:i,kind:"video"}),r=o.items.map(f=>`${f.kind}:${f.track}:${f.start}:${f.end-f.start}`),l=async f=>{let a=await D(f,o.timeline).catch(()=>null);if(!a||!r.every(d=>a.has(d)))return null;let{session:p}=await P(f,"prproj"),u=p.timelines.find(d=>d.name===o.timeline);return u?z(p,u):null};if(o.project_path){let f=await l(o.project_path);if(f)return await C(f),{session:f,from:"the saved project (matches the live sequence)",path:o.project_path};let a=k(R(o.project_path),"Adobe Premiere Pro Auto-Save"),p=U(o.project_path).replace(/\.prproj$/i,""),u=[];try{for await(let d of E(a))d.isFile&&d.name.startsWith(`${p}--`)&&d.name.endsWith(".prproj")&&u.push({path:k(a,d.name),mtime:(await S(k(a,d.name))).mtime?.getTime()??0})}catch{}for(let d of u.sort((g,_)=>_.mtime-g.mtime).slice(0,3)){let g=await l(d.path);if(g&&await C(g),g)return{session:g,from:`Premiere's auto-save of ${new Date(d.mtime).toLocaleTimeString()} (matches the live sequence; the project itself is not saved)`,path:d.path}}}let e=k(await x("conform-ppro-"),"live.otio"),t=await s.export({timeline:i,out_path:e}),{session:n}=await P(t.path,t.format);if(await W(s,n),await Z(n),typeof o.drop_frame=="boolean")for(let f of n.timelines)f.is_drop_frame=o.drop_frame;await C(n);for(let f of n.timelines)for(let a of f.tracks)for(let p of a.items){let u=p;u.scale=null,u.position_x=null,u.position_y=null,u.rotation=null}let c=await s.model(i).then(f=>f.items.filter(a=>Object.keys(a.sizing??{}).length).map(a=>`${a.name??a.file_path.split("/").pop()} (V${a.track} @${a.start-f.start_frame})`)).catch(()=>[]),m=`Premiere's OTIO export carries the cut, not the clips' Motion / Opacity / effects / retimes${c.length?` \u2014 ${c.length} clip(s) here have Motion that will not carry: ${c.slice(0,6).join(", ")}${c.length>6?"\u2026":""}`:""}; save the project (or wait for its auto-save) and run it again for every one of them`;return{session:n,from:"Premiere's OTIO export of the live sequence (no saved or auto-saved copy matches it yet)",path:t.path,lossy:m}}async function C(s){let i=new Set;for(let r of s.media_references??[]){if(r.binding_state==="linked")continue;let l=y(r);l&&await S(l).then(e=>e.isFile,()=>!1)&&i.add(R(l))}let o=s;for(let r of i){let l=await T(o,{media_root:r,gather:"path",criteria:{file_name:!0,file_name_mode:"tight"},lane:"both",reset:!1,dry_run:!1,compare:!1,cap:2e3,remember:!1}).catch(()=>null);l?.changed&&(o=l.session)}return o!==s&&Object.assign(s,o),(s.media_references??[]).filter(r=>r.binding_state==="linked").length}async function Z(s){let i=0;for(let o of s.media_references??[]){if(o.source_resolution_w)continue;let r=y(o),l=r?await A(r).catch(()=>null):null;if(!l)continue;let e=l;for(let t of["source_resolution_w","source_resolution_h","source_pixel_aspect","codec","container","streams"])e[t]!=null&&o[t]==null&&(o[t]=e[t]);o.source_fps??=e.source_fps??null,o.source_timecode??=e.source_timecode??null,!o.available_range&&e.available_range&&(o.available_range=e.available_range),i++}return i}async function re(s,i){let o=i.timelines.filter(t=>t.offline_reference?.clip_id);if(!o.length)return 0;let r=t=>[...t?.clip_list??[],...(t?.folders??[]).flatMap(r)],l=new Map(r((await s.project({clips:!0})).pool).map(t=>[t.id,t])),e=0;for(let t of o){let n=l.get(t.offline_reference.clip_id);if(n?.file){let c=i.media_references.find(m=>y(m)===n.file);c||(c={id:`offline-ref-${t.id??e}`,kind:"external",name:n.name,target_url:`file://${n.file}`,local_path:n.file},i.media_references.push(c)),t.offline_reference.media_reference_id=c.id,e++}else if(n&&n.name!==t.name&&(n.type==="Timeline"||/compound/i.test(n.type??""))){let{createSession:c}=await import("./store-F2CTSR6E.js"),m=k(await x("conform-offline-ref-"),`${n.name.replace(/[^\w.-]+/g,"_")}.drt`),f=await s.export(n.type==="Timeline"?{timeline:n.name,out_path:m}:{clip_id:n.id,out_path:m}),{session:a}=await P(f.path,"drt");a=(await M(a))?.session??a,t.offline_reference.session_id=(await c(a,f.path,"drt")).id,e++}else t.offline_reference=null}return e}async function W(s,i){let o=(await s.projectClips()).clips,r=new Map(o.filter(e=>e.start_frame!=null&&e.fps).map(e=>[e.file,e])),l=0;for(let e of i.media_references??[]){if(e.source_timecode)continue;let t=r.get(y(e));if(t){e.source_timecode=F(t.start_frame,t.fps),e.source_fps??=t.fps,l++;continue}let n=y(e),c=n?await A(n).catch(()=>null):null;c?.source_timecode&&(e.source_timecode=c.source_timecode,e.source_fps??=c.source_fps??null,l++)}return l}function z(s,i){let o=new Map(s.timelines.map(l=>[l.id,l])),r=[i];for(let l=0;l<r.length;l++)for(let e of r[l].tracks)for(let t of e.items){let n=t.nested_timeline_id,c=n?o.get(n):void 0;c&&!r.includes(c)&&r.push(c)}return{...s,timelines:r}}function X(s,i){let o=new Map((s.media_references??[]).map(n=>[n.id,y(n)])),r=[];for(let n of i.media_references??[]){let c=o.get(n.id),m=y(n);c!==void 0&&m&&m!==c&&r.push({ref_id:n.id,old:c,new:m})}let l=new Map(r.map(n=>[n.ref_id,n])),e=[],t=i.timelines.find(n=>n.kind==="primary")??i.timelines[0];for(let n of t?.tracks??[])if(n.kind==="Video")for(let c of n.items){let m=c.media_reference_id?l.get(c.media_reference_id):void 0;!m||c.kind!=="clip"||!c.source_range||e.push({track:n.track_index,start:c.timeline_range.start.value,duration:c.timeline_range.duration.value,src_in:c.source_range.start.value,path:m.new,name:c.name??""})}return{media:r,cuts:e}}async function oe(s,i){let{session:o,from:r,lossy:l}=await H(s,i.timeline),e=await T(structuredClone(o),{media_root:i.media_root,gather:"walk",reset:!0,lane:"video",dry_run:!1,cap:2e3,criteria:i.criteria??(i.mode==="cut_in"?{file_name:!1,reel_name:!0}:{file_name:!0,file_name_mode:"loose"}),tolerances:i.tolerances}),{media:t,cuts:n}=X(o,e.session),c=[`read from ${r}`,...l&&i.mode==="new_version"?[`\u26A0 ${l}`]:[],`matched ${t.length} medi${t.length===1?"um":"a"} under ${i.media_root} (${n.length} clip use${n.length===1?"":"s"} in the sequence)`],m=t.map(u=>` ${u.old.split("/").pop()} \u2192 ${u.new}`);if(i.dry_run||!t.length)return{text:[...c,...m,i.dry_run?"(dry run \u2014 nothing changed in Premiere)":"",e.text.split(`
3
+ import{a as T}from"./chunk-IUW3BFGE.js";import{c as D}from"./chunk-SW6SUAP3.js";import{Qb as P,Wb as N,_b as q}from"./chunk-FDUFUJXI.js";import"./chunk-IN6XVTUS.js";import{l as A}from"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-SMYDU75N.js";import"./chunk-JFEOLU4H.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-N34DQ6MH.js";import{b as F}from"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import{n as M}from"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import{N as x,O as E,aa as U,ba as R,da as k,q as O,u as S}from"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";var y=s=>{let i=s?.target_url??s?.local_path??"";return i.startsWith("file://")?O(i):i};async function H(s,i){let o=await V(s,i);return await I(s,o.session,i),o}async function I(s,i,o){let r=await s.liveMarkers(o).catch(()=>null);if(!r)return;let l=i.timelines,e=l.find(m=>m.kind!=="compound")??l[0];if(!e)return;let t=(m,f,a,p)=>({id:`live-${p??"tl"}-${m}`,time:{value:m},duration:{value:Math.max(1,f)},color:a.color,name:a.name,note:a.note,...p?{item_id:p}:{}}),n=r.timeline.map(m=>t(m.frame,m.duration,m)),c=e.tracks.filter(m=>m.kind==="Video");for(let m of r.clips){let f=c[m.track-1]?.items.find(a=>a.timeline_range?.start?.value===m.start);if(f)for(let a of m.markers)n.push(t(a.frame,a.duration,a,f.id))}e.markers=n}async function V(s,i){let o=await s.items({timeline:i,kind:"video"}),r=o.items.map(f=>`${f.kind}:${f.track}:${f.start}:${f.end-f.start}`),l=async f=>{let a=await D(f,o.timeline).catch(()=>null);if(!a||!r.every(d=>a.has(d)))return null;let{session:p}=await P(f,"prproj"),u=p.timelines.find(d=>d.name===o.timeline);return u?z(p,u):null};if(o.project_path){let f=await l(o.project_path);if(f)return await C(f),{session:f,from:"the saved project (matches the live sequence)",path:o.project_path};let a=k(R(o.project_path),"Adobe Premiere Pro Auto-Save"),p=U(o.project_path).replace(/\.prproj$/i,""),u=[];try{for await(let d of E(a))d.isFile&&d.name.startsWith(`${p}--`)&&d.name.endsWith(".prproj")&&u.push({path:k(a,d.name),mtime:(await S(k(a,d.name))).mtime?.getTime()??0})}catch{}for(let d of u.sort((g,_)=>_.mtime-g.mtime).slice(0,3)){let g=await l(d.path);if(g&&await C(g),g)return{session:g,from:`Premiere's auto-save of ${new Date(d.mtime).toLocaleTimeString()} (matches the live sequence; the project itself is not saved)`,path:d.path}}}let e=k(await x("conform-ppro-"),"live.otio"),t=await s.export({timeline:i,out_path:e}),{session:n}=await P(t.path,t.format);if(await W(s,n),await Z(n),typeof o.drop_frame=="boolean")for(let f of n.timelines)f.is_drop_frame=o.drop_frame;await C(n);for(let f of n.timelines)for(let a of f.tracks)for(let p of a.items){let u=p;u.scale=null,u.position_x=null,u.position_y=null,u.rotation=null}let c=await s.model(i).then(f=>f.items.filter(a=>Object.keys(a.sizing??{}).length).map(a=>`${a.name??a.file_path.split("/").pop()} (V${a.track} @${a.start-f.start_frame})`)).catch(()=>[]),m=`Premiere's OTIO export carries the cut, not the clips' Motion / Opacity / effects / retimes${c.length?` \u2014 ${c.length} clip(s) here have Motion that will not carry: ${c.slice(0,6).join(", ")}${c.length>6?"\u2026":""}`:""}; save the project (or wait for its auto-save) and run it again for every one of them`;return{session:n,from:"Premiere's OTIO export of the live sequence (no saved or auto-saved copy matches it yet)",path:t.path,lossy:m}}async function C(s){let i=new Set;for(let r of s.media_references??[]){if(r.binding_state==="linked")continue;let l=y(r);l&&await S(l).then(e=>e.isFile,()=>!1)&&i.add(R(l))}let o=s;for(let r of i){let l=await T(o,{media_root:r,gather:"path",criteria:{file_name:!0,file_name_mode:"tight"},lane:"both",reset:!1,dry_run:!1,compare:!1,cap:2e3,remember:!1}).catch(()=>null);l?.changed&&(o=l.session)}return o!==s&&Object.assign(s,o),(s.media_references??[]).filter(r=>r.binding_state==="linked").length}async function Z(s){let i=0;for(let o of s.media_references??[]){if(o.source_resolution_w)continue;let r=y(o),l=r?await A(r).catch(()=>null):null;if(!l)continue;let e=l;for(let t of["source_resolution_w","source_resolution_h","source_pixel_aspect","codec","container","streams"])e[t]!=null&&o[t]==null&&(o[t]=e[t]);o.source_fps??=e.source_fps??null,o.source_timecode??=e.source_timecode??null,!o.available_range&&e.available_range&&(o.available_range=e.available_range),i++}return i}async function re(s,i){let o=i.timelines.filter(t=>t.offline_reference?.clip_id);if(!o.length)return 0;let r=t=>[...t?.clip_list??[],...(t?.folders??[]).flatMap(r)],l=new Map(r((await s.project({clips:!0})).pool).map(t=>[t.id,t])),e=0;for(let t of o){let n=l.get(t.offline_reference.clip_id);if(n?.file){let c=i.media_references.find(m=>y(m)===n.file);c||(c={id:`offline-ref-${t.id??e}`,kind:"external",name:n.name,target_url:`file://${n.file}`,local_path:n.file},i.media_references.push(c)),t.offline_reference.media_reference_id=c.id,e++}else if(n&&n.name!==t.name&&(n.type==="Timeline"||/compound/i.test(n.type??""))){let{createSession:c}=await import("./store-F2CTSR6E.js"),m=k(await x("conform-offline-ref-"),`${n.name.replace(/[^\w.-]+/g,"_")}.drt`),f=await s.export(n.type==="Timeline"?{timeline:n.name,out_path:m}:{clip_id:n.id,out_path:m}),{session:a}=await P(f.path,"drt");a=(await M(a))?.session??a,t.offline_reference.session_id=(await c(a,f.path,"drt")).id,e++}else t.offline_reference=null}return e}async function W(s,i){let o=(await s.projectClips()).clips,r=new Map(o.filter(e=>e.start_frame!=null&&e.fps).map(e=>[e.file,e])),l=0;for(let e of i.media_references??[]){if(e.source_timecode)continue;let t=r.get(y(e));if(t){e.source_timecode=F(t.start_frame,t.fps),e.source_fps??=t.fps,l++;continue}let n=y(e),c=n?await A(n).catch(()=>null):null;c?.source_timecode&&(e.source_timecode=c.source_timecode,e.source_fps??=c.source_fps??null,l++)}return l}function z(s,i){let o=new Map(s.timelines.map(l=>[l.id,l])),r=[i];for(let l=0;l<r.length;l++)for(let e of r[l].tracks)for(let t of e.items){let n=t.nested_timeline_id,c=n?o.get(n):void 0;c&&!r.includes(c)&&r.push(c)}return{...s,timelines:r}}function X(s,i){let o=new Map((s.media_references??[]).map(n=>[n.id,y(n)])),r=[];for(let n of i.media_references??[]){let c=o.get(n.id),m=y(n);c!==void 0&&m&&m!==c&&r.push({ref_id:n.id,old:c,new:m})}let l=new Map(r.map(n=>[n.ref_id,n])),e=[],t=i.timelines.find(n=>n.kind==="primary")??i.timelines[0];for(let n of t?.tracks??[])if(n.kind==="Video")for(let c of n.items){let m=c.media_reference_id?l.get(c.media_reference_id):void 0;!m||c.kind!=="clip"||!c.source_range||e.push({track:n.track_index,start:c.timeline_range.start.value,duration:c.timeline_range.duration.value,src_in:c.source_range.start.value,path:m.new,name:c.name??""})}return{media:r,cuts:e}}async function oe(s,i){let{session:o,from:r,lossy:l}=await H(s,i.timeline),e=await T(structuredClone(o),{media_root:i.media_root,gather:"walk",reset:!0,lane:"video",dry_run:!1,cap:2e3,criteria:i.criteria??(i.mode==="cut_in"?{file_name:!1,reel_name:!0}:{file_name:!0,file_name_mode:"loose"}),tolerances:i.tolerances}),{media:t,cuts:n}=X(o,e.session),c=[`read from ${r}`,...l&&i.mode==="new_version"?[`\u26A0 ${l}`]:[],`matched ${t.length} medi${t.length===1?"um":"a"} under ${i.media_root} (${n.length} clip use${n.length===1?"":"s"} in the sequence)`],m=t.map(u=>` ${u.old.split("/").pop()} \u2192 ${u.new}`);if(i.dry_run||!t.length)return{text:[...c,...m,i.dry_run?"(dry run \u2014 nothing changed in Premiere)":"",e.text.split(`
4
4
  `).slice(-6).join(`
5
5
  `)].filter(Boolean).join(`
6
6
  `),data:{media:t,cuts:n,from:r}};if(i.mode==="replace"||i.mode==="hires"||i.mode==="proxy"){let d=(await s.projectClips()).clips.flatMap(w=>t.filter(j=>j.old===w.file).map(j=>({clip:w.id,path:j.new,mode:i.mode}))),g=i.mode==="replace"?L(o,e.session,t):new Map,_=g.size?await Y(s,new Set(g.keys())):[],b=await s.relinkClips(d),h=b.results.filter(w=>w.ok).length,$=[...c,`${i.mode==="hires"?"attached full-res behind":i.mode==="proxy"?"attached as proxies to":"repointed"} ${h}/${d.length} project clip(s)${i.mode==="proxy"?" (Toggle Proxies in Premiere switches)":""}`,...m,...b.results.filter(w=>!w.ok).map(w=>` refused: ${w.detail??"Premiere refused"}`)],v=_.length?await B(s,_,g):null;return v&&$.push(...v.lines),{text:$.join(`
@@ -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}from"./chunk-KNUHQP6W.js";import"./chunk-4B4STXSA.js";import"./chunk-E5TEETTE.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-Q2QOAQJV.js";import"./chunk-QOAPJ5Y2.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";export{a as AVID_SETUP,b as FLAME_SETUP,d as adapter,c as setAdapter};
3
+ import{g as a,h as b,i as c,j as d}from"./chunk-L6ERTJHZ.js";import"./chunk-SW6SUAP3.js";import"./chunk-FDUFUJXI.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-SMYDU75N.js";import"./chunk-JFEOLU4H.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";export{a as AVID_SETUP,b as FLAME_SETUP,d as adapter,c as setAdapter};
package/dist/http.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as jt}from"./chunk-T4HZ6ASN.js";import{a as Tt,b as vt,c as Rt,d as Et,f as Pt,g as Ct,h as $t,i as At,l as O,m as Nt,p as $,q as Mt}from"./chunk-H6XXKUWJ.js";import"./chunk-3AR7KSPH.js";import"./chunk-WWZDRERB.js";import"./chunk-KNUHQP6W.js";import"./chunk-4B4STXSA.js";import"./chunk-3KS3547B.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{Ab as _t,G as it,H as ct,J as ht,Qc as yt,Uc as bt,Vc as D,Wc as T,bd as xt,dd as St,fd as Ot,tc as kt,zb as wt}from"./chunk-E5TEETTE.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-Q2QOAQJV.js";import{a as at}from"./chunk-QOAPJ5Y2.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import{C,E as gt,t as W,u as ut,v as dt,x as pt,y as mt,z as ft}from"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-LMRPCWHV.js";import"./chunk-ZNUIZEPF.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import{C as V,k as G,y as lt}from"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import{a as H}from"./chunk-E75BCWXY.js";import{A as F,B as et,C as j,E as nt,I as L,N as J,O as ot,P as st,W as rt,aa as U,b as v,ba as I,da as S,o as P,u as B,v as Q,y as q,z as tt}from"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";import N from"node:process";var Lt=new Map;function Ut(t,i,r,b){let a=`${t}:${r}:${b}`,o=Lt.get(a);return o||(o=(async()=>{let n=S(P(),"cache","grade-luts",t);await j(n);let d=S(n,`V${r}_${b}.cube`);if(!await Q(d)){let{adapter:_}=await import("./hosts-4JZDHI6N.js");if((await _("resolve").clipLut({timeline:i,track:r,start:b,out_path:d})).ok===!1)return null}return d})().catch(()=>null),Lt.set(a,o)),o}var Vt=new Set(["/app/convert","/app/canonicalize"]);function zt(t,i){let r=(i??"").split(";")[0].trim().toLowerCase();return r==="application/json"||r==="application/octet-stream"&&Vt.has(t)}function Wt(t){let i=t.replace(/[\\/:*?"<>|\x00-\x1f]+/g,"_").replace(/[. ]+$/,"")||"timeline";return/^(con|prn|aux|nul|com\d|lpt\d)(\..*)?$/i.test(i)?`_${i}`:i}var K={id:"local",name:"Local",client_name:null,handles:24,local:!0};async function Bt(){try{return JSON.parse(await tt(S(P(),"projects","projects.json")))}catch{return[]}}async function Dt(){let t=await O("project",{action:"list"});if(!t.isError){let i=t.structuredContent?.projects??[];return await j(S(P(),"projects")),await et(S(P(),"projects","projects.json"),JSON.stringify(i)),{projects:[K,...i],offline:!1}}return{projects:[K,...await Bt()],offline:!0,code:String(t.structuredContent?.code??"offline"),reason:String(t.structuredContent?.message??t.content[0]?.text??"")}}async function Kt(t){return t==="local"?K:(await Bt()).find(i=>i.id===t)??{id:t,name:t}}async function Ft(t,i,r,b,a=(o,n)=>new Response(o,{headers:{"content-type":n}})){if(i[0]!=="app")return null;let[,o,n,d]=i,_=async()=>t.headers.get("content-type")?.includes("json")?await t.json():{};try{if(o==="policy"&&t.method==="GET"){let{config:e}=await import("./account-RSL4PTDB.js"),s=await fetch(`${e().supabaseUrl}/functions/v1/v1-billing/v1/billing/app-policy`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null);return r(s?.ok?await s.json():{offline:!0})}if(o==="account"&&t.method==="GET"){let e=await O("account_status",{}),s=await V().then(c=>({app:!0,studio_tools:c.source==="licence"||lt(c)?.studio_tools!==!1}),c=>({app:!1,app_reason:c.message,code:c.code,...c.data?.in_use_by?{in_use_by:c.data.in_use_by}:{}}));return r({...e.structuredContent,...e.structuredContent?.account??{},...s,text:e.content[0]?.text})}{let e=await V().then(()=>null,s=>s);if(e)return r({ok:!1,code:e.code,message:e.message,needs:"app"},e.code==="not_signed_in"?401:402)}if(o==="events"&&t.method==="GET")return b(Et());if(o==="front"&&t.method==="POST"){let e=await t.json();return vt({project:String(e.project??""),view:String(e.view??""),...e.tool?{tool:String(e.tool)}:{}}),r({ok:!0})}if(o==="problem"&&t.method==="POST"){let e=await t.json().catch(()=>({})),s=/\bnot signed in\b/i.test(String(e.what??""))?"not_signed_in":"window_error";return await D("app_window",{isError:!0,content:[],structuredContent:{code:s,message:`${String(e.what??"").slice(0,200)}${e.detail?`
3
+ import{a as jt}from"./chunk-DVPU4AYU.js";import{a as Tt,b as vt,c as Rt,d as Et,f as Pt,g as Ct,h as $t,i as At,l as O,m as Nt,p as $,q as Mt}from"./chunk-3K2XVUJZ.js";import"./chunk-3AR7KSPH.js";import"./chunk-IUW3BFGE.js";import"./chunk-L6ERTJHZ.js";import"./chunk-SW6SUAP3.js";import"./chunk-3KS3547B.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{Ab as _t,G as it,H as ct,J as ht,Qc as yt,Uc as bt,Vc as D,Wc as T,bd as xt,dd as St,fd as Ot,tc as kt,zb as wt}from"./chunk-FDUFUJXI.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-SMYDU75N.js";import{a as at}from"./chunk-JFEOLU4H.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import{C,E as gt,t as W,u as ut,v as dt,x as pt,y as mt,z as ft}from"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-LMRPCWHV.js";import"./chunk-ZNUIZEPF.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import{C as V,k as G,y as lt}from"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import{a as H}from"./chunk-E75BCWXY.js";import{A as F,B as et,C as j,E as nt,I as L,N as J,O as ot,P as st,W as rt,aa as U,b as v,ba as I,da as S,o as P,u as B,v as Q,y as q,z as tt}from"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";import N from"node:process";var Lt=new Map;function Ut(t,i,r,b){let a=`${t}:${r}:${b}`,o=Lt.get(a);return o||(o=(async()=>{let n=S(P(),"cache","grade-luts",t);await j(n);let d=S(n,`V${r}_${b}.cube`);if(!await Q(d)){let{adapter:_}=await import("./hosts-3YODY7SA.js");if((await _("resolve").clipLut({timeline:i,track:r,start:b,out_path:d})).ok===!1)return null}return d})().catch(()=>null),Lt.set(a,o)),o}var Vt=new Set(["/app/convert","/app/canonicalize"]);function zt(t,i){let r=(i??"").split(";")[0].trim().toLowerCase();return r==="application/json"||r==="application/octet-stream"&&Vt.has(t)}function Wt(t){let i=t.replace(/[\\/:*?"<>|\x00-\x1f]+/g,"_").replace(/[. ]+$/,"")||"timeline";return/^(con|prn|aux|nul|com\d|lpt\d)(\..*)?$/i.test(i)?`_${i}`:i}var K={id:"local",name:"Local",client_name:null,handles:24,local:!0};async function Bt(){try{return JSON.parse(await tt(S(P(),"projects","projects.json")))}catch{return[]}}async function Dt(){let t=await O("project",{action:"list"});if(!t.isError){let i=t.structuredContent?.projects??[];return await j(S(P(),"projects")),await et(S(P(),"projects","projects.json"),JSON.stringify(i)),{projects:[K,...i],offline:!1}}return{projects:[K,...await Bt()],offline:!0,code:String(t.structuredContent?.code??"offline"),reason:String(t.structuredContent?.message??t.content[0]?.text??"")}}async function Kt(t){return t==="local"?K:(await Bt()).find(i=>i.id===t)??{id:t,name:t}}async function Ft(t,i,r,b,a=(o,n)=>new Response(o,{headers:{"content-type":n}})){if(i[0]!=="app")return null;let[,o,n,d]=i,_=async()=>t.headers.get("content-type")?.includes("json")?await t.json():{};try{if(o==="policy"&&t.method==="GET"){let{config:e}=await import("./account-RSL4PTDB.js"),s=await fetch(`${e().supabaseUrl}/functions/v1/v1-billing/v1/billing/app-policy`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null);return r(s?.ok?await s.json():{offline:!0})}if(o==="account"&&t.method==="GET"){let e=await O("account_status",{}),s=await V().then(c=>({app:!0,studio_tools:c.source==="licence"||lt(c)?.studio_tools!==!1}),c=>({app:!1,app_reason:c.message,code:c.code,...c.data?.in_use_by?{in_use_by:c.data.in_use_by}:{}}));return r({...e.structuredContent,...e.structuredContent?.account??{},...s,text:e.content[0]?.text})}{let e=await V().then(()=>null,s=>s);if(e)return r({ok:!1,code:e.code,message:e.message,needs:"app"},e.code==="not_signed_in"?401:402)}if(o==="events"&&t.method==="GET")return b(Et());if(o==="front"&&t.method==="POST"){let e=await t.json();return vt({project:String(e.project??""),view:String(e.view??""),...e.tool?{tool:String(e.tool)}:{}}),r({ok:!0})}if(o==="problem"&&t.method==="POST"){let e=await t.json().catch(()=>({})),s=/\bnot signed in\b/i.test(String(e.what??""))?"not_signed_in":"window_error";return await D("app_window",{isError:!0,content:[],structuredContent:{code:s,message:`${String(e.what??"").slice(0,200)}${e.detail?`
4
4
  ${String(e.detail).slice(0,100)}`:""}`}},0),r({ok:!0})}if(o==="convert"&&t.method==="POST"){let e=new URL(t.url).searchParams,s=U(e.get("name")||"timeline"),c=e.get("out")||"",p=JSON.parse(e.get("targets")||"[]"),l=JSON.parse(e.get("sequences")||"[]");if(!c||!p.length)return r({ok:!1,error:"a folder and at least one format are needed"},400);let u=await J("conform-te-"),f=S(u,s);await F(f,new Uint8Array(await t.arrayBuffer()));let h=await O("timeline_read",{path:f}),y=h.structuredContent?.session_id??h.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(h.isError||!y)return r({ok:!1,error:h.content[0]?.text??"could not read the timeline"});let w=(await C(y)).session.timelines.filter(x=>x.kind!=="compound"),k=l.length?w.filter(x=>l.includes(x.name??"")):w,m=[],R=0;for(let x of k)for(let E of p){let M=S(c,`${Wt(x.name??"timeline")}.${E.ext}`),Z=await O("timeline_write",{session_id:y,target:E.target,out_path:M,...k.length>1||w.length>1?{timeline_id:x.id}:{}});Z.isError?m.push(`${x.name} \u2192 ${E.target}: ${Z.content[0]?.text}`):R++}return await L(u).catch(()=>{}),r({ok:R>0,savedCount:R,...m.length?{error:m.join(`
5
5
  `)}:{}})}if(o==="fs"&&t.method==="POST"){let{op:e,path:s,offset:c=0,length:p=0}=await _();if(e==="statPath"){let l=await B(s).catch(()=>null);return r({ok:!0,result:l?{kind:l.isDirectory?"directory":"file",size:l.size,lastModified:Math.round(l.mtimeMs)}:null})}if(e==="readDir"){let l=[];for await(let u of ot(s))(u.isFile||u.isDirectory)&&l.push({name:u.name,kind:u.isDirectory?"directory":"file"});return r({ok:!0,result:l})}if(e==="readFile"){let l=p>0?p:Math.max(0,(await B(s)).size-Math.max(0,c)),u=512<<20;if(l>u)return r({ok:!1,code:"too_large",message:`${s} is ${Math.round(l/(1<<20))} MB: read it in parts (offset, length \u2264 ${u>>20} MB)`},413);let f=await st(s);try{return a(await f.readAt(Math.max(0,c),l),"application/octet-stream")}finally{await f.close()}}return r({ok:!1,code:"bad_request",message:`no fs op ${e}`},400)}if(o==="canonicalize"&&t.method==="POST"){let e=new URL(t.url).searchParams,s=JSON.parse(e.get("sequences")||"[]"),c=JSON.parse(e.get("previous")||"[]"),p=await J("conform-te-");try{let l=S(p,U(e.get("name")||"timeline"));await F(l,new Uint8Array(await t.arrayBuffer()));let u=await O("timeline_read",{path:l}),f=u.structuredContent?.session_id??u.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(u.isError||!f)return r({ok:!1,error:u.content[0]?.text??"could not read the timeline"},422);let h=(await C(f)).session,y=h.timelines;if(s.length){let w=new Map;for(let m of c)w.set(m,(w.get(m)??0)+1);let k=new Set;for(let m of s){let R=h.timelines.filter(M=>M.kind!=="compound"&&(M.name??"")===m),x=w.get(m)??0;w.set(m,x+1);let E=R[Math.min(x,R.length-1)];E&&k.add(E)}y=h.timelines.filter(m=>m.kind==="compound"||k.has(m))}return r({ok:!0,session_id:f,session:{...h,timelines:y}})}finally{await L(p).catch(()=>{})}}if(o==="sessions"&&n&&d==="frame"){let e=new URL(t.url).searchParams,s=Math.max(0,Math.round(Number(e.get("f")??0))),c=Math.min(3840,Math.max(64,Number(e.get("w")??1280)|0));try{let f=(await C(n)).session,h=e.get("track")==="offline"?"offline":Number(e.get("track"))||void 0,y;if(e.get("grade")==="resolve"&&h!=="offline"){let k=(()=>{try{return wt(f,{record:s,timeline:e.get("timeline")??void 0,track:h})}catch{return null}})();k&&(y=await Ut(n,e.get("host_timeline")??void 0,k.video_track,k.record_start)??void 0)}let w=await _t(f,s,c,e.get("timeline")??void 0,h,y);if(w){let k=new Uint8Array(12+w.px.length),m=new DataView(k.buffer);return m.setUint32(0,w.w,!0),m.setUint32(4,w.h,!0),m.setUint32(8,w.order==="bgra"?1:0,!0),k.set(w.px,12),a(k,"application/x-conform-pixels")}}catch(f){return r({ok:!1,code:"no_frame",message:f.message},404)}let p=await O("timeline_frame",{session_id:n,record:s,width:c,...e.get("timeline")?{timeline:e.get("timeline")}:{}},{poll:!0}),l=p.structuredContent?.out_path;if(p.isError||!l)return r({ok:!1,code:String(p.structuredContent?.code??"no_frame"),message:p.content[0]?.text??"no picture here"},404);let u=await q(l);return await(U(I(l)).startsWith("conform-frame-")?L(I(l)):nt(l)).catch(()=>{}),a(u,"image/png")}if(o==="sessions"&&n&&t.method==="GET"){let e=await C(n).catch(()=>null);return e?r(e):r({ok:!1,code:"not_found"},404)}if(o==="sessions"&&!n)return r(await gt());if(o!=="projects")return r({ok:!1,code:"not_found"},404);if(!n){if(t.method==="POST"){let e=await _(),s=await O("project",{action:"create",name:e.name,client_name:e.client_name,handles:e.handles});return s.isError?r({...s.structuredContent,text:s.content[0]?.text},422):(await Dt(),r(s.structuredContent))}return r(await Dt())}if(!d){let[e,s,c,p,l,u]=await Promise.all([Kt(n),ut(n).catch(()=>null),ft(n),ht(n),xt(n).then(y=>y.facts).catch(()=>[]),n===W?null:St().catch(()=>null)]);await pt(n===W?null:{id:n,name:e.name??n});let{text:f="",...h}=s??{};return r({project:e,context:f,context_meta:h,sessions:c,activity:p.slice(-100).reverse(),known:Ot(l),facility:u?.text??""})}if(d==="sessions"&&t.method==="PUT")return await mt(n,String((await _()).session_id??"")),r({ok:!0});if(d==="context"&&t.method==="PUT"){let e=await _();try{let{text:s,...c}=await dt(n,String(e.text??""),e.base===void 0?void 0:e.base);return r({ok:!0,context:s,context_meta:c})}catch(s){if(s instanceof H&&s.code==="context_conflict"){let c=s.data?.current;return r({ok:!1,code:s.code,message:s.message,context:c.context,context_meta:{updated_at:c.context_updated_at,updated_by:c.context_updated_by_name??null}},409)}throw s}}return r({ok:!1,code:"not_found"},404)}catch(e){let s=e instanceof H?e:null;return r({ok:!1,code:s?.code??"internal",message:e.message},s?.code==="not_found"?404:s?.code==="invalid_args"?400:500)}}var Jt=t=>t==="1"?"app":"http",X=(t,i)=>t&&i.has(t)?t:"custom",A=new Map,Xt=500;function It(t){let i=null,r=Tt(a=>{switch(a.type){case"open":T(`app:open:${X(a.tool,t)}`);break;case"home":T("app:home");break;case"workspace":{let o=a.workspace;T("app:workspace",{counts:{open:Array.isArray(o?.open)?o.open.length:0}});break}case"settings":{let o=a.settings&&typeof a.settings=="object"?Object.keys(a.settings).filter(n=>/^[A-Za-z0-9_.]{1,64}$/.test(n)).slice(0,16):[];T("app:settings",{fields:o});break}case"run":{let o=a.run;if(!o?.id||!o.status||!/^[a-z]+$/.test(o.status)||A.get(o.id)===o.status)break;A.size>=Xt&&A.delete(A.keys().next().value),A.set(o.id,o.status),T(`app:run_${o.status}:${X(o.tool,t)}`,{fields:[o.by==="app"?"app":"assistant"],ok:o.status!=="failed"});break}}}),b=Rt(a=>{let o=/^[a-z]+$/.test(a.view)?a.view:"other",n=`${a.project}|${o}|${a.tool??""}`;n!==i&&(i=n,T(o==="tool"?`app:view:tool:${X(a.tool,t)}`:`app:view:${o}`))});return()=>{r(),b()}}bt();var Yt=Number(v("CONFORM_HTTP_PORT")??7791);v("CONFORM_EXIT_WITH_PARENT")==="1"&&(N.stdin.on("end",()=>N.exit(0)),N.stdin.on("close",()=>N.exit(0)),N.stdin.resume());yt(Jt(v("CONFORM_EXIT_WITH_PARENT")));It(new Set([...kt.map(t=>t.id),...$.map(t=>t.name),"context","source"]));var Y=v("CONFORM_HTTP_TOKEN")??"",Gt=(v("CONFORM_HTTP_ORIGINS")??"https://conform.tools,https://app.conform.tools,http://localhost:5173,http://localhost:3000").split(","),z=(t,i=new Headers)=>{let r=t.headers.get("origin")??"";return Gt.includes(r)&&i.set("access-control-allow-origin",r),i.set("access-control-allow-headers","authorization, content-type, x-conform-client, x-conform-poll"),i.set("access-control-allow-methods","GET, POST, PUT, DELETE, OPTIONS"),i.set("access-control-allow-private-network","true"),i.set("vary","origin"),i},Ht=new Set,g=(t,i,r=200)=>new Response(JSON.stringify(i),{status:r,headers:z(t,new Headers({"content-type":"application/json"}))});rt({hostname:"127.0.0.1",port:Yt,onListen:t=>{Ht=new Set([`127.0.0.1:${t}`,`localhost:${t}`,`[::1]:${t}`]),console.error(`conformtools HTTP API on http://127.0.0.1:${t} (${$.length} verbs)`),jt(t,Y)}},async t=>{let i=new URL(t.url),r=(t.headers.get("host")??"").toLowerCase();if(!Ht.has(r))return new Response("forbidden host",{status:403});let b=t.headers.get("origin");if(b&&!Gt.includes(b))return new Response("forbidden origin",{status:403});if(t.method==="OPTIONS")return new Response(null,{status:204,headers:z(t)});if((t.method==="POST"||t.method==="PUT")&&t.headers.get("content-length")!=="0"&&!zt(i.pathname,t.headers.get("content-type")))return g(t,{ok:!1,code:"unsupported_media_type",message:"send the body as application/json"},415);if(Y&&t.headers.get("authorization")!==`Bearer ${Y}`&&i.pathname!=="/health")return g(t,{ok:!1,code:"unauthorized"},401);let a=i.pathname.split("/").filter(Boolean);try{if(i.pathname==="/health")return g(t,{ok:!0,verbs:$.length,version:at,engine:G()});if(a[0]==="verbs"&&a.length===1&&t.method==="GET")return g(t,$.map(n=>({name:n.name,title:n.title,description:n.description,long:!!n.long,input_schema:ct(it.object(n.inputSchema)),protected_stages:n.protectedStages??[],engine:G()})));if(a[0]==="verbs"&&a.length===2&&t.method==="POST"){let n=Mt(a[1]);if(!n)return g(t,{ok:!1,code:"not_found",message:`unknown verb ${a[1]}`},404);let d=t.headers.get("content-type")?.includes("json")?await t.json():{},_=Nt(n.name,d);if(!_.ok)return g(t,{..._.result.structuredContent,text:_.result.content[0].text},400);let e=t.headers.get("x-conform-client"),s=e?null:Pt(n.name,_.data,()=>void T("finish_missing"));s&&D(n.name,s,0,Object.keys(_.data));let c=s??await O(n.name,_.data,{client:e??"http",poll:t.headers.get("x-conform-poll")==="1"});return g(t,{...c.structuredContent??{ok:!c.isError},text:c.content.map(p=>p.text).join(`
6
- `)},c.isError?422:200)}if(a[0]==="debug"&&a.length===3&&t.method==="POST"&&v("CONFORM_DEBUG_BRIDGE")==="1"){let{hostBridge:n}=await import("./bridge-KLZD2ITG.js"),d=await n();return await d.waitFor(a[1],5e3)?g(t,{ok:!0,result:await d.request(a[1],a[2],t.headers.get("content-type")?.includes("json")?await t.json():{},12e4)}):g(t,{ok:!1,code:"not_connected"},409)}let o=await Ft(t,a,(n,d)=>g(t,n,d),n=>new Response(n,{headers:z(t,new Headers({"content-type":"text/event-stream","cache-control":"no-cache"}))}),(n,d)=>new Response(n,{headers:z(t,new Headers({"content-type":d,"cache-control":"no-store"}))}));if(o)return o;if(a[0]==="jobs"&&a.length===1)return g(t,await At());if(a[0]==="jobs"&&a.length===2){if(t.method==="DELETE")return g(t,{ok:$t(a[1])});let n=await Ct(a[1]);return n?g(t,n):g(t,{ok:!1,code:"not_found"},404)}return g(t,{ok:!1,code:"not_found"},404)}catch(o){return g(t,{ok:!1,code:"internal",message:o instanceof Error?o.message:String(o)},500)}});
6
+ `)},c.isError?422:200)}if(a[0]==="debug"&&a.length===3&&t.method==="POST"&&v("CONFORM_DEBUG_BRIDGE")==="1"){let{hostBridge:n}=await import("./bridge-GMBZ2C5T.js"),d=await n();return await d.waitFor(a[1],5e3)?g(t,{ok:!0,result:await d.request(a[1],a[2],t.headers.get("content-type")?.includes("json")?await t.json():{},12e4)}):g(t,{ok:!1,code:"not_connected"},409)}let o=await Ft(t,a,(n,d)=>g(t,n,d),n=>new Response(n,{headers:z(t,new Headers({"content-type":"text/event-stream","cache-control":"no-cache"}))}),(n,d)=>new Response(n,{headers:z(t,new Headers({"content-type":d,"cache-control":"no-store"}))}));if(o)return o;if(a[0]==="jobs"&&a.length===1)return g(t,await At());if(a[0]==="jobs"&&a.length===2){if(t.method==="DELETE")return g(t,{ok:$t(a[1])});let n=await Ct(a[1]);return n?g(t,n):g(t,{ok:!1,code:"not_found"},404)}return g(t,{ok:!1,code:"not_found"},404)}catch(o){return g(t,{ok:!1,code:"internal",message:o instanceof Error?o.message:String(o)},500)}});
package/dist/mcp.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{b as ha}from"./chunk-T4HZ6ASN.js";import{e as la,f as ua,j as da,k as fa,l as rn,n as pa,o as ma,p as on}from"./chunk-H6XXKUWJ.js";import"./chunk-3AR7KSPH.js";import"./chunk-WWZDRERB.js";import"./chunk-KNUHQP6W.js";import"./chunk-4B4STXSA.js";import"./chunk-3KS3547B.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{A as S,Ac as ra,B as Hi,C as K,D as Ui,E as en,F as Vi,G as dt,Gc as oa,H as Ki,Hc as tn,Qc as na,Uc as sa,Vc as ia,Wc as aa,Zc as ca,a as ji,b as Go,c as Oi,d as Ai,e as Di,f as Bo,g as Jo,h as Wo,i as Ot,j as At,k as Zi,l as Li,m as Xo,n as f,o as D,p as W,q as Fi,r as G,s as q,t as v,u as se,v as V,vc as Qi,w as Qo,wc as Dt,x as Yo,xc as Yi,y as F,yc as ea,z as pe,zc as ta}from"./chunk-E5TEETTE.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-Q2QOAQJV.js";import{a as zr,b as Mi,d as qi,e as Ni}from"./chunk-QOAPJ5Y2.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-RL5XRG6O.js";import{a as Ji,e as Wi,k as Xi}from"./chunk-IDADYIY6.js";import"./chunk-LMRPCWHV.js";import"./chunk-ZNUIZEPF.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import{e as Gi,f as Bi}from"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import{c as $,f as Ci}from"./chunk-PSANHDZM.js";var Qt=$(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.regexpCode=A.getEsmExportName=A.getProperty=A.safeStringify=A.stringify=A.strConcat=A.addCodeArg=A.str=A._=A.nil=A._Code=A.Name=A.IDENTIFIER=A._CodeOrName=void 0;var Wt=class{};A._CodeOrName=Wt;A.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ye=class extends Wt{constructor(e){if(super(),!A.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};A.Name=Ye;var _e=class extends Wt{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof Ye&&(r[o.str]=(r[o.str]||0)+1),r),{})}};A._Code=_e;A.nil=new _e("");function Aa(t,...e){let r=[t[0]],o=0;for(;o<e.length;)zn(r,e[o]),r.push(t[++o]);return new _e(r)}A._=Aa;var kn=new _e("+");function Da(t,...e){let r=[Xt(t[0])],o=0;for(;o<e.length;)r.push(kn),zn(r,e[o]),r.push(kn,Xt(t[++o]));return jf(r),new _e(r)}A.str=Da;function zn(t,e){e instanceof _e?t.push(...e._items):e instanceof Ye?t.push(e):t.push(Df(e))}A.addCodeArg=zn;function jf(t){let e=1;for(;e<t.length-1;){if(t[e]===kn){let r=Of(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Of(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ye||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ye))return`"${t}${e.slice(1)}`}function Af(t,e){return e.emptyStr()?t:t.emptyStr()?e:Da`${t}${e}`}A.strConcat=Af;function Df(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xt(Array.isArray(t)?t.join(","):t)}function Zf(t){return new _e(Xt(t))}A.stringify=Zf;function Xt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Xt;function Lf(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new _e(`.${t}`):Aa`[${t}]`}A.getProperty=Lf;function Ff(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new _e(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=Ff;function Hf(t){return new _e(t.toString())}A.regexpCode=Hf});var Rn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Qt(),Pn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qr||(le.UsedValueState=Qr={}));le.varKinds={const:new ce.Name("const"),let:new ce.Name("let"),var:new ce.Name("var")};var Yr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ce.Name?e:this.name(e)}name(e){return new ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};le.Scope=Yr;var eo=class extends ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ce._)`.${new ce.Name(r)}[${o}]`}};le.ValueScopeName=eo;var Uf=(0,ce._)`\n`,Tn=class extends Yr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Uf:ce.nil}}get(){return this._scope}name(e){return new eo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ce._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qr.Started);let l=r(u);if(l){let d=this.opts.es5?le.varKinds.var:le.varKinds.const;s=(0,ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ce._)`${s}${l}${this.opts._n}`;else throw new Pn(u);c.set(u,Qr.Completed)})}return s}};le.ValueScope=Tn});var R=$(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var M=Qt(),be=Rn(),He=Qt();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return He._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return He.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return He.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return He.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return He.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return He.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return He.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return He.Name}});var no=Rn();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return no.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return no.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return no.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return no.varKinds}});I.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var Ne=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},In=class extends Ne{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?be.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},to=class extends Ne{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return oo(e,this.rhs)}},Cn=class extends to{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Mn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Nn=class extends Ne{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},jn=class extends Ne{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=vt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Yt=class extends Ne{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Vf(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rt(e,r.names),{})}},je=class extends Yt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},On=class extends Yt{},$t=class extends je{};$t.kind="else";var et=class t extends je{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new $t(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Za(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=vt(this.condition,e,r),this}get names(){let e=super.names;return oo(e,this.condition),this.else&&rt(e,this.else.names),e}};et.kind="if";var tt=class extends je{};tt.kind="for";var An=class extends tt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=vt(this.iteration,e,r),this}get names(){return rt(super.names,this.iteration.names)}},Dn=class extends tt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?be.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=oo(super.names,this.from);return oo(e,this.to)}},ro=class extends tt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=vt(this.iterable,e,r),this}get names(){return rt(super.names,this.iterable.names)}},er=class extends je{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};er.kind="func";var tr=class extends Yt{render(e){return"return "+super.render(e)}};tr.kind="return";var Zn=class extends je{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rt(e,this.catch.names),this.finally&&rt(e,this.finally.names),e}},rr=class extends je{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};rr.kind="catch";var or=class extends je{render(e){return"finally"+super.render(e)}};or.kind="finally";var Ln=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ import{b as ha}from"./chunk-DVPU4AYU.js";import{e as la,f as ua,j as da,k as fa,l as rn,n as pa,o as ma,p as on}from"./chunk-3K2XVUJZ.js";import"./chunk-3AR7KSPH.js";import"./chunk-IUW3BFGE.js";import"./chunk-L6ERTJHZ.js";import"./chunk-SW6SUAP3.js";import"./chunk-3KS3547B.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{A as S,Ac as ra,B as Hi,C as K,D as Ui,E as en,F as Vi,G as dt,Gc as oa,H as Ki,Hc as tn,Qc as na,Uc as sa,Vc as ia,Wc as aa,Zc as ca,a as ji,b as Go,c as Oi,d as Ai,e as Di,f as Bo,g as Jo,h as Wo,i as Ot,j as At,k as Zi,l as Li,m as Xo,n as f,o as D,p as W,q as Fi,r as G,s as q,t as v,u as se,v as V,vc as Qi,w as Qo,wc as Dt,x as Yo,xc as Yi,y as F,yc as ea,z as pe,zc as ta}from"./chunk-FDUFUJXI.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-SMYDU75N.js";import{a as zr,b as Mi,d as qi,e as Ni}from"./chunk-JFEOLU4H.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-RL5XRG6O.js";import{a as Ji,e as Wi,k as Xi}from"./chunk-IDADYIY6.js";import"./chunk-LMRPCWHV.js";import"./chunk-ZNUIZEPF.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import{e as Gi,f as Bi}from"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import{c as $,f as Ci}from"./chunk-PSANHDZM.js";var Qt=$(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.regexpCode=A.getEsmExportName=A.getProperty=A.safeStringify=A.stringify=A.strConcat=A.addCodeArg=A.str=A._=A.nil=A._Code=A.Name=A.IDENTIFIER=A._CodeOrName=void 0;var Wt=class{};A._CodeOrName=Wt;A.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ye=class extends Wt{constructor(e){if(super(),!A.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};A.Name=Ye;var _e=class extends Wt{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof Ye&&(r[o.str]=(r[o.str]||0)+1),r),{})}};A._Code=_e;A.nil=new _e("");function Aa(t,...e){let r=[t[0]],o=0;for(;o<e.length;)zn(r,e[o]),r.push(t[++o]);return new _e(r)}A._=Aa;var kn=new _e("+");function Da(t,...e){let r=[Xt(t[0])],o=0;for(;o<e.length;)r.push(kn),zn(r,e[o]),r.push(kn,Xt(t[++o]));return jf(r),new _e(r)}A.str=Da;function zn(t,e){e instanceof _e?t.push(...e._items):e instanceof Ye?t.push(e):t.push(Df(e))}A.addCodeArg=zn;function jf(t){let e=1;for(;e<t.length-1;){if(t[e]===kn){let r=Of(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Of(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ye||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ye))return`"${t}${e.slice(1)}`}function Af(t,e){return e.emptyStr()?t:t.emptyStr()?e:Da`${t}${e}`}A.strConcat=Af;function Df(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xt(Array.isArray(t)?t.join(","):t)}function Zf(t){return new _e(Xt(t))}A.stringify=Zf;function Xt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Xt;function Lf(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new _e(`.${t}`):Aa`[${t}]`}A.getProperty=Lf;function Ff(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new _e(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=Ff;function Hf(t){return new _e(t.toString())}A.regexpCode=Hf});var Rn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Qt(),Pn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qr||(le.UsedValueState=Qr={}));le.varKinds={const:new ce.Name("const"),let:new ce.Name("let"),var:new ce.Name("var")};var Yr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ce.Name?e:this.name(e)}name(e){return new ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};le.Scope=Yr;var eo=class extends ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ce._)`.${new ce.Name(r)}[${o}]`}};le.ValueScopeName=eo;var Uf=(0,ce._)`\n`,Tn=class extends Yr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Uf:ce.nil}}get(){return this._scope}name(e){return new eo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ce._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qr.Started);let l=r(u);if(l){let d=this.opts.es5?le.varKinds.var:le.varKinds.const;s=(0,ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ce._)`${s}${l}${this.opts._n}`;else throw new Pn(u);c.set(u,Qr.Completed)})}return s}};le.ValueScope=Tn});var R=$(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var M=Qt(),be=Rn(),He=Qt();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return He._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return He.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return He.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return He.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return He.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return He.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return He.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return He.Name}});var no=Rn();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return no.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return no.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return no.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return no.varKinds}});I.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var Ne=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},In=class extends Ne{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?be.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},to=class extends Ne{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return oo(e,this.rhs)}},Cn=class extends to{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Mn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Nn=class extends Ne{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},jn=class extends Ne{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=vt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Yt=class extends Ne{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Vf(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rt(e,r.names),{})}},je=class extends Yt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},On=class extends Yt{},$t=class extends je{};$t.kind="else";var et=class t extends je{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new $t(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Za(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=vt(this.condition,e,r),this}get names(){let e=super.names;return oo(e,this.condition),this.else&&rt(e,this.else.names),e}};et.kind="if";var tt=class extends je{};tt.kind="for";var An=class extends tt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=vt(this.iteration,e,r),this}get names(){return rt(super.names,this.iteration.names)}},Dn=class extends tt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?be.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=oo(super.names,this.from);return oo(e,this.to)}},ro=class extends tt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=vt(this.iterable,e,r),this}get names(){return rt(super.names,this.iterable.names)}},er=class extends je{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};er.kind="func";var tr=class extends Yt{render(e){return"return "+super.render(e)}};tr.kind="return";var Zn=class extends je{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rt(e,this.catch.names),this.finally&&rt(e,this.finally.names),e}},rr=class extends je{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};rr.kind="catch";var or=class extends je{render(e){return"finally"+super.render(e)}};or.kind="finally";var Ln=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
4
4
  `:""},this._extScope=e,this._scope=new be.Scope({parent:e}),this._nodes=[new On]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new In(e,s,o)),s}const(e,r,o){return this._def(be.varKinds.const,e,r,o)}let(e,r,o){return this._def(be.varKinds.let,e,r,o)}var(e,r,o){return this._def(be.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new to(e,r,o))}add(e,r){return this._leafNode(new Cn(e,I.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==M.nil&&this._leafNode(new jn(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,M.addCodeArg)(r,n));return r.push("}"),new M._Code(r)}if(e,r,o){if(this._blockNode(new et(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new et(e))}else(){return this._elseNode(new $t)}endIf(){return this._endBlockNode(et,$t)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new An(e),r)}forRange(e,r,o,n,s=this.opts.es5?be.varKinds.var:be.varKinds.let){let i=this._scope.toName(e);return this._for(new Dn(s,i,r,o),()=>n(i))}forOf(e,r,o,n=be.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof M.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,M._)`${i}.length`,a=>{this.var(s,(0,M._)`${i}[${a}]`),o(s)})}return this._for(new ro("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?be.varKinds.var:be.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,M._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new ro("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(tt)}label(e){return this._leafNode(new Mn(e))}break(e){return this._leafNode(new qn(e))}return(e){let r=new tr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(tr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new Zn;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new rr(s),r(s)}return o&&(this._currNode=n.finally=new or,this.code(o)),this._endBlockNode(rr,or)}throw(e){return this._leafNode(new Nn(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=M.nil,o,n){return this._blockNode(new er(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(er)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof et))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};I.CodeGen=Ln;function rt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function oo(t,e){return e instanceof M._CodeOrName?rt(t,e.names):t}function vt(t,e,r){if(t instanceof M.Name)return o(t);if(!n(t))return t;return new M._Code(t._items.reduce((s,i)=>(i instanceof M.Name&&(i=o(i)),i instanceof M._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof M._Code&&s._items.some(i=>i instanceof M.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Vf(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Za(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,M._)`!${Fn(t)}`}I.not=Za;var Kf=La(I.operators.AND);function Gf(...t){return t.reduce(Kf)}I.and=Gf;var Bf=La(I.operators.OR);function Jf(...t){return t.reduce(Bf)}I.or=Jf;function La(t){return(e,r)=>e===M.nil?r:r===M.nil?e:(0,M._)`${Fn(e)} ${t} ${Fn(r)}`}function Fn(t){return t instanceof M.Name?t:(0,M._)`(${t})`}});var N=$(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.checkStrictMode=C.getErrorPath=C.Type=C.useFunc=C.setEvaluated=C.evaluatedPropsToName=C.mergeEvaluated=C.eachItem=C.unescapeJsonPointer=C.escapeJsonPointer=C.escapeFragment=C.unescapeFragment=C.schemaRefOrVal=C.schemaHasRulesButRef=C.schemaHasRules=C.checkUnknownRules=C.alwaysValidSchema=C.toHash=void 0;var L=R(),Wf=Qt();function Xf(t){let e={};for(let r of t)e[r]=!0;return e}C.toHash=Xf;function Qf(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Ua(t,e),!Va(e,t.self.RULES.all))}C.alwaysValidSchema=Qf;function Ua(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||Ba(t,`unknown keyword: "${s}"`)}C.checkUnknownRules=Ua;function Va(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}C.schemaHasRules=Va;function Yf(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}C.schemaHasRulesButRef=Yf;function ep({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,L._)`${r}`}return(0,L._)`${t}${e}${(0,L.getProperty)(o)}`}C.schemaRefOrVal=ep;function tp(t){return Ka(decodeURIComponent(t))}C.unescapeFragment=tp;function rp(t){return encodeURIComponent(Un(t))}C.escapeFragment=rp;function Un(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}C.escapeJsonPointer=Un;function Ka(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}C.unescapeJsonPointer=Ka;function op(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}C.eachItem=op;function Fa({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof L.Name?(s instanceof L.Name?t(n,s,i):e(n,s,i),i):s instanceof L.Name?(e(n,i,s),s):r(s,i);return a===L.Name&&!(c instanceof L.Name)?o(n,c):c}}C.mergeEvaluated={props:Fa({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,L._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,L._)`${r} || {}`).code((0,L._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,L._)`${r} || {}`),Vn(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Ga}),items:Fa({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,L._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,L._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Ga(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,L._)`{}`);return e!==void 0&&Vn(t,r,e),r}C.evaluatedPropsToName=Ga;function Vn(t,e,r){Object.keys(r).forEach(o=>t.assign((0,L._)`${e}${(0,L.getProperty)(o)}`,!0))}C.setEvaluated=Vn;var Ha={};function np(t,e){return t.scopeValue("func",{ref:e,code:Ha[e.code]||(Ha[e.code]=new Wf._Code(e.code))})}C.useFunc=np;var Hn;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Hn||(C.Type=Hn={}));function sp(t,e,r){if(t instanceof L.Name){let o=e===Hn.Num;return r?o?(0,L._)`"[" + ${t} + "]"`:(0,L._)`"['" + ${t} + "']"`:o?(0,L._)`"/" + ${t}`:(0,L._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,L.getProperty)(t).toString():"/"+Un(t)}C.getErrorPath=sp;function Ba(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}C.checkStrictMode=Ba});var Oe=$(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});var te=R(),ip={data:new te.Name("data"),valCxt:new te.Name("valCxt"),instancePath:new te.Name("instancePath"),parentData:new te.Name("parentData"),parentDataProperty:new te.Name("parentDataProperty"),rootData:new te.Name("rootData"),dynamicAnchors:new te.Name("dynamicAnchors"),vErrors:new te.Name("vErrors"),errors:new te.Name("errors"),this:new te.Name("this"),self:new te.Name("self"),scope:new te.Name("scope"),json:new te.Name("json"),jsonPos:new te.Name("jsonPos"),jsonLen:new te.Name("jsonLen"),jsonPart:new te.Name("jsonPart")};Kn.default=ip});var nr=$(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.extendErrors=re.resetErrorsCount=re.reportExtraError=re.reportError=re.keyword$DataError=re.keywordError=void 0;var j=R(),so=N(),ie=Oe();re.keywordError={message:({keyword:t})=>(0,j.str)`must pass "${t}" keyword validation`};re.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,j.str)`"${t}" keyword must be ${e} ($data)`:(0,j.str)`"${t}" keyword is invalid ($data)`};function ap(t,e=re.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=Xa(t,e,r);o??(i||a)?Ja(s,c):Wa(n,(0,j._)`[${c}]`)}re.reportError=ap;function cp(t,e=re.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=Xa(t,e,r);Ja(n,a),s||i||Wa(o,ie.default.vErrors)}re.reportExtraError=cp;function lp(t,e){t.assign(ie.default.errors,e),t.if((0,j._)`${ie.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,j._)`${ie.default.vErrors}.length`,e),()=>t.assign(ie.default.vErrors,null)))}re.resetErrorsCount=lp;function up({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ie.default.errors,a=>{t.const(i,(0,j._)`${ie.default.vErrors}[${a}]`),t.if((0,j._)`${i}.instancePath === undefined`,()=>t.assign((0,j._)`${i}.instancePath`,(0,j.strConcat)(ie.default.instancePath,s.errorPath))),t.assign((0,j._)`${i}.schemaPath`,(0,j.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,j._)`${i}.schema`,r),t.assign((0,j._)`${i}.data`,o))})}re.extendErrors=up;function Ja(t,e){let r=t.const("err",e);t.if((0,j._)`${ie.default.vErrors} === null`,()=>t.assign(ie.default.vErrors,(0,j._)`[${r}]`),(0,j._)`${ie.default.vErrors}.push(${r})`),t.code((0,j._)`${ie.default.errors}++`)}function Wa(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,j._)`new ${t.ValidationError}(${e})`):(r.assign((0,j._)`${o}.errors`,e),r.return(!1))}var ot={keyword:new j.Name("keyword"),schemaPath:new j.Name("schemaPath"),params:new j.Name("params"),propertyName:new j.Name("propertyName"),message:new j.Name("message"),schema:new j.Name("schema"),parentSchema:new j.Name("parentSchema")};function Xa(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,j._)`{}`:dp(t,e,r)}function dp(t,e,r={}){let{gen:o,it:n}=t,s=[fp(n,r),pp(t,r)];return mp(t,e,s),o.object(...s)}function fp({errorPath:t},{instancePath:e}){let r=e?(0,j.str)`${t}${(0,so.getErrorPath)(e,so.Type.Str)}`:t;return[ie.default.instancePath,(0,j.strConcat)(ie.default.instancePath,r)]}function pp({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,j.str)`${e}/${t}`;return r&&(n=(0,j.str)`${n}${(0,so.getErrorPath)(r,so.Type.Str)}`),[ot.schemaPath,n]}function mp(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([ot.keyword,n],[ot.params,typeof e=="function"?e(t):e||(0,j._)`{}`]),c.messages&&o.push([ot.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([ot.schema,i],[ot.parentSchema,(0,j._)`${l}${d}`],[ie.default.data,s]),u&&o.push([ot.propertyName,u])}});var Ya=$(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.boolOrEmptySchema=wt.topBoolOrEmptySchema=void 0;var hp=nr(),gp=R(),yp=Oe(),_p={message:"boolean schema is false"};function $p(t){let{gen:e,schema:r,validateName:o}=t;r===!1?Qa(t,!1):typeof r=="object"&&r.$async===!0?e.return(yp.default.data):(e.assign((0,gp._)`${o}.errors`,null),e.return(!0))}wt.topBoolOrEmptySchema=$p;function vp(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),Qa(t)):r.var(e,!0)}wt.boolOrEmptySchema=vp;function Qa(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,hp.reportError)(n,_p,void 0,e)}});var Gn=$(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.getRules=bt.isJSONType=void 0;var wp=["string","number","integer","boolean","null","object","array"],bp=new Set(wp);function Sp(t){return typeof t=="string"&&bp.has(t)}bt.isJSONType=Sp;function xp(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}bt.getRules=xp});var Bn=$(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.shouldUseRule=Ue.shouldUseGroup=Ue.schemaHasRulesForType=void 0;function Ep({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&ec(t,o)}Ue.schemaHasRulesForType=Ep;function ec(t,e){return e.rules.some(r=>tc(t,r))}Ue.shouldUseGroup=ec;function tc(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}Ue.shouldUseRule=tc});var sr=$(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.reportTypeError=oe.checkDataTypes=oe.checkDataType=oe.coerceAndCheckDataType=oe.getJSONTypes=oe.getSchemaTypes=oe.DataType=void 0;var kp=Gn(),zp=Bn(),Pp=nr(),T=R(),rc=N(),St;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(St||(oe.DataType=St={}));function Tp(t){let e=oc(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}oe.getSchemaTypes=Tp;function oc(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(kp.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}oe.getJSONTypes=oc;function Rp(t,e){let{gen:r,data:o,opts:n}=t,s=Ip(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,zp.schemaHasRulesForType)(t,e[0]));if(i){let a=Wn(e,o,n.strictNumbers,St.Wrong);r.if(a,()=>{s.length?Cp(t,e,s):Xn(t)})}return i}oe.coerceAndCheckDataType=Rp;var nc=new Set(["string","number","integer","boolean","null"]);function Ip(t,e){return e?t.filter(r=>nc.has(r)||e==="array"&&r==="array"):[]}function Cp(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,T._)`typeof ${n}`),a=o.let("coerced",(0,T._)`undefined`);s.coerceTypes==="array"&&o.if((0,T._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,T._)`${n}[0]`).assign(i,(0,T._)`typeof ${n}`).if(Wn(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,T._)`${a} !== undefined`);for(let u of r)(nc.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Xn(t),o.endIf(),o.if((0,T._)`${a} !== undefined`,()=>{o.assign(n,a),Mp(t,a)});function c(u){switch(u){case"string":o.elseIf((0,T._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,T._)`"" + ${n}`).elseIf((0,T._)`${n} === null`).assign(a,(0,T._)`""`);return;case"number":o.elseIf((0,T._)`${i} == "boolean" || ${n} === null
5
5
  || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,T._)`+${n}`);return;case"integer":o.elseIf((0,T._)`${i} === "boolean" || ${n} === null
6
6
  || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,T._)`+${n}`);return;case"boolean":o.elseIf((0,T._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,T._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,T._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,T._)`${i} === "string" || ${i} === "number"
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{$b as p,Mb as a,Nb as b,Ob as c,Pb as d,Qb as e,Rb as f,Sb as g,Tb as h,Ub as i,Vb as j,Wb as k,Xb as l,Yb as m,Zb as n,_b as o,ac as q,bc as r,cc as s,dc as t}from"./chunk-E5TEETTE.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-QOAPJ5Y2.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";export{j as OPERATION_KINDS,a as READ_FORMATS,k as applyOperation,m as applyOperationWithSources,s as consolidate,b as detectFormat,d as detectTimelineFormat,t as judge,r as linkText,g as listClips,i as listFlags,h as listMedia,e as readTimeline,n as resolveTarget,q as routesText,c as sniffFormat,f as summarize,l as trackIndex,p as writeDestination,o as writeTimeline};
3
+ import{$b as p,Mb as a,Nb as b,Ob as c,Pb as d,Qb as e,Rb as f,Sb as g,Tb as h,Ub as i,Vb as j,Wb as k,Xb as l,Yb as m,Zb as n,_b as o,ac as q,bc as r,cc as s,dc as t}from"./chunk-FDUFUJXI.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-JFEOLU4H.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-RL5XRG6O.js";import"./chunk-IDADYIY6.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import"./chunk-AR5BTVBM.js";import"./chunk-VZ3XYHK4.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";export{j as OPERATION_KINDS,a as READ_FORMATS,k as applyOperation,m as applyOperationWithSources,s as consolidate,b as detectFormat,d as detectTimelineFormat,t as judge,r as linkText,g as listClips,i as listFlags,h as listMedia,e as readTimeline,n as resolveTarget,q as routesText,c as sniffFormat,f as summarize,l as trackIndex,p as writeDestination,o as writeTimeline};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conformtools",
3
- "version": "0.6.25",
3
+ "version": "0.6.26",
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.25",
48
- "conformtools-darwin-x64": "0.6.25",
49
- "conformtools-linux-x64": "0.6.25",
50
- "conformtools-windows-x64": "0.6.25"
47
+ "conformtools-darwin-arm64": "0.6.26",
48
+ "conformtools-darwin-x64": "0.6.26",
49
+ "conformtools-linux-x64": "0.6.26",
50
+ "conformtools-windows-x64": "0.6.26"
51
51
  }
52
52
  }