conformtools 0.6.15 → 0.6.16

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,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import"./chunk-PSANHDZM.js";function P(){let e=window.__CONFORM_ENGINE__;if(e?.base)return e;let t=new URLSearchParams(window.location.search),n=c=>{try{return sessionStorage.getItem(`conform.engine.${c}`)}catch{return null}},s=(c,g)=>{try{sessionStorage.setItem(`conform.engine.${c}`,g)}catch{}},i=t.get("engine"),o=t.get("token");return i?s("url",i):i=n("url"),o?s("token",o):o=n("token"),{base:i?/^\d+$/.test(i)?`http://127.0.0.1:${i}`:i.replace(/\/$/,""):"http://127.0.0.1:7791",token:o??""}}var d=typeof window>"u"?{base:"http://127.0.0.1:7791",token:""}:P(),w=(e=!0)=>({...e?{"content-type":"application/json"}:{},"x-conform-client":"app",...d.token?{authorization:`Bearer ${d.token}`}:{}}),f=typeof window<"u"&&new URLSearchParams(window.location.search).has("demo")?import("./demo-engine-WXNT4Y7S.js").then(e=>e.answer):null,j=f!==null,v=class extends Error{constructor(n,s){super(s);this.code=n}};async function r(e,t,n,s=[],i={},o=0){if(f)return(await f)(e,t,n);let a;try{a=await fetch(`${d.base}${t}`,{method:e,headers:{...w(),...i},body:n===void 0?void 0:JSON.stringify(n),...o?{signal:AbortSignal.timeout(o)}:{}})}catch{throw new v("engine_down",`the conform.tools engine is not running at ${d.base}`)}let c=await a.json().catch(()=>({}));if(!a.ok&&!("text"in c)&&!s.includes(a.status))throw new v(c.code??String(a.status),c.message??`HTTP ${a.status}`);return c}async function S(e,t,n,s,i=0){if(f)return new Promise(()=>{});let o;try{o=await fetch(`${d.base}${e}`,{...t,headers:w(),signal:s})}catch{s?.aborted||n({type:"error",code:"engine_down",message:`the conform.tools engine is not running at ${d.base}`});return}if(!o.ok||!o.body){let b=await o.json().catch(()=>({}));n({type:"error",code:b.code??String(o.status),message:b.message??`HTTP ${o.status}`});return}let a=o.body.getReader(),c=new TextDecoder,g="";for(;;){let b,m=i?new Promise(u=>{b=setTimeout(()=>u(null),i)}):null,h=await(m?Promise.race([a.read(),m]):a.read());if(clearTimeout(b),!h){a.cancel().catch(()=>{});break}let{value:y,done:R}=h;if(R)break;g+=c.decode(y,{stream:!0});let p;for(;(p=g.indexOf(`
3
+ import"./chunk-PSANHDZM.js";function P(){let e=window.__CONFORM_ENGINE__;if(e?.base)return e;let t=new URLSearchParams(window.location.search),n=c=>{try{return sessionStorage.getItem(`conform.engine.${c}`)}catch{return null}},s=(c,g)=>{try{sessionStorage.setItem(`conform.engine.${c}`,g)}catch{}},i=t.get("engine"),o=t.get("token");return i?s("url",i):i=n("url"),o?s("token",o):o=n("token"),{base:i?/^\d+$/.test(i)?`http://127.0.0.1:${i}`:i.replace(/\/$/,""):"http://127.0.0.1:7791",token:o??""}}var d=typeof window>"u"?{base:"http://127.0.0.1:7791",token:""}:P(),w=(e=!0)=>({...e?{"content-type":"application/json"}:{},"x-conform-client":"app",...d.token?{authorization:`Bearer ${d.token}`}:{}}),f=typeof window<"u"&&new URLSearchParams(window.location.search).has("demo")?import("./demo-engine-CBFAAPPO.js").then(e=>e.answer):null,j=f!==null,v=class extends Error{constructor(n,s){super(s);this.code=n}};async function r(e,t,n,s=[],i={},o=0){if(f)return(await f)(e,t,n);let a;try{a=await fetch(`${d.base}${t}`,{method:e,headers:{...w(),...i},body:n===void 0?void 0:JSON.stringify(n),...o?{signal:AbortSignal.timeout(o)}:{}})}catch{throw new v("engine_down",`the conform.tools engine is not running at ${d.base}`)}let c=await a.json().catch(()=>({}));if(!a.ok&&!("text"in c)&&!s.includes(a.status))throw new v(c.code??String(a.status),c.message??`HTTP ${a.status}`);return c}async function S(e,t,n,s,i=0){if(f)return new Promise(()=>{});let o;try{o=await fetch(`${d.base}${e}`,{...t,headers:w(),signal:s})}catch{s?.aborted||n({type:"error",code:"engine_down",message:`the conform.tools engine is not running at ${d.base}`});return}if(!o.ok||!o.body){let b=await o.json().catch(()=>({}));n({type:"error",code:b.code??String(o.status),message:b.message??`HTTP ${o.status}`});return}let a=o.body.getReader(),c=new TextDecoder,g="";for(;;){let b,m=i?new Promise(u=>{b=setTimeout(()=>u(null),i)}):null,h=await(m?Promise.race([a.read(),m]):a.read());if(clearTimeout(b),!h){a.cancel().catch(()=>{});break}let{value:y,done:R}=h;if(R)break;g+=c.decode(y,{stream:!0});let p;for(;(p=g.indexOf(`
4
4
 
5
- `))>=0;){let u=g.slice(0,p);g=g.slice(p+2),u.startsWith("data: ")&&n(JSON.parse(u.slice(6)))}}}var k=new Set,T=null;function x(){if(T)return;let e=T=new AbortController;(async()=>{for(;!e.signal.aborted;)await S("/app/events",{method:"GET"},t=>{for(let n of k)n(t)},e.signal,45e3).catch(()=>{}),e.signal.aborted||await new Promise(t=>setTimeout(t,2e3))})()}var O={base:d.base,health:()=>r("GET","/health"),verb:(e,t={})=>r("POST",`/verbs/${e}`,t),poll:(e,t={})=>r("POST",`/verbs/${e}`,t,[],{"x-conform-poll":"1"},2e4),job:e=>r("GET",`/jobs/${e}`),cancelJob:e=>r("DELETE",`/jobs/${e}`),front:e=>r("POST","/app/front",e),account:()=>r("GET","/app/account"),projects:()=>r("GET","/app/projects"),createProject:e=>r("POST","/app/projects",e),project:e=>r("GET",`/app/projects/${e}`),attachSession:(e,t)=>r("PUT",`/app/projects/${e}/sessions`,{session_id:t}),saveContext:(e,t,n)=>r("PUT",`/app/projects/${e}/context`,{text:t,base:n},[409]),frame:async(e,t,n,s,i,o,a)=>{let c=new URLSearchParams({f:String(t),w:String(n),...i?{timeline:i}:{},...o?{track:String(o)}:{},...a?{grade:"resolve",...a.host_timeline?{host_timeline:a.host_timeline}:{}}:{}});if(f)return null;let g=await fetch(`${d.base}/app/sessions/${e}/frame?${c}`,{headers:w(!1),signal:s}).catch(()=>null);if(!g?.ok)return null;if(g.headers.get("content-type")!=="application/x-conform-pixels")return createImageBitmap(await g.blob()).catch(()=>null);let b=new Uint8Array(await g.arrayBuffer()),m=new DataView(b.buffer),h=m.getUint32(0,!0),y=m.getUint32(4,!0),R=m.getUint32(8,!0)===1,p=new Uint8ClampedArray(b.buffer,12,h*y*4);for(let u=0;u<p.length;u+=4){if(R){let _=p[u];p[u]=p[u+2],p[u+2]=_}p[u+3]=255}return createImageBitmap(new ImageData(p,h,y)).catch(()=>null)},tools:()=>r("POST","/verbs/tool",{action:"list"}).then(e=>e.tools??[]),blocks:()=>r("POST","/verbs/tool",{action:"blocks"}).then(e=>e.blocks??[]),saveTool:e=>r("POST","/verbs/tool",{action:"save",spec:e},[422]),deleteTool:e=>r("POST","/verbs/tool",{action:"delete",id:e},[422]),toolLayout:()=>r("POST","/verbs/tool",{action:"layout"}).then(e=>e.layout),arrangeTools:e=>r("POST","/verbs/tool",{action:"arrange",layout:e}).then(t=>t.layout),hideTool:(e,t)=>r("POST","/verbs/tool",{action:t?"hide":"show_tool",id:e}).then(n=>n.layout),workspace:e=>r("POST","/verbs/tool",{action:"workspace",project_id:e}).then(t=>t.workspace),saveWorkspace:(e,t)=>r("POST","/verbs/tool",{action:"workspace_save",project_id:e,workspace:t},[422]),exportTools:(e,t)=>r("POST","/verbs/tool",{action:"export",ids:e,path:t},[422]),importTools:e=>r("POST","/verbs/tool",{action:"import",path:e},[422]),hostSetup:(e,t="status")=>r("POST","/verbs/host_setup",{host:e,action:t},[422]),convert:async(e,t)=>{let n=new URLSearchParams({name:e.fileName,out:t,targets:JSON.stringify(e.targets.map(({target:i,ext:o})=>({target:i,ext:o}))),sequences:JSON.stringify(e.sequences)});if(f)return{ok:!1,error:(await import("./demo-engine-WXNT4Y7S.js")).DEMO_TEXT};let s=await fetch(`${d.base}/app/convert?${n}`,{method:"POST",headers:{...w(!1),"content-type":"application/octet-stream"},body:e.bytes});return await s.json().catch(()=>({ok:!1,error:`the engine said ${s.status}`}))},canonicalize:async(e,t=[],n=[])=>{let s=new URLSearchParams({name:e.name,sequences:JSON.stringify(t),previous:JSON.stringify(n)});if(f)throw new Error((await import("./demo-engine-WXNT4Y7S.js")).DEMO_TEXT);let i=await fetch(`${d.base}/app/canonicalize?${s}`,{method:"POST",headers:{...w(!1),"content-type":"application/octet-stream"},body:await e.arrayBuffer()}),o=await i.json().catch(()=>({ok:!1,error:`the engine said ${i.status}`}));if(!o.ok)throw new Error(o.error??o.message??`the engine said ${i.status}`);return o},policy:()=>r("GET","/app/policy"),session:e=>r("GET",`/app/sessions/${e}`),onEvent:e=>(k.add(e),x(),()=>{k.delete(e),k.size||(T?.abort(),T=null)}),saveRunCsv:(e,t,n,s)=>r("POST","/verbs/tool_run",{action:"csv",project_id:e,path:t,id:n,table:s}),runs:(e,t)=>r("POST","/verbs/tool_run",{action:"list",project_id:e,...t?{id:t}:{}}).then(n=>n.runs??[])};async function $(e,t){if(f)throw Object.assign(new Error((await import("./demo-engine-WXNT4Y7S.js")).DEMO_TEXT),{name:"NotFoundError"});let n=await fetch(`${d.base}/app/fs`,{method:"POST",headers:w(),body:JSON.stringify({op:e,...t})});if(e==="readFile"){if(!n.ok)throw Object.assign(new Error(`could not read ${String(t.path)}`),{name:"NotReadableError"});let i=await n.arrayBuffer();return{result:{byteLength:i.byteLength},bytes:i}}let s=await n.json().catch(()=>({ok:!1}));if(!s.ok)throw Object.assign(new Error(s.message??`the engine said ${n.status}`),{name:"NotFoundError"});return{result:s.result}}var l=()=>typeof window<"u"?window.__TAURI__:void 0,E={available:()=>!!l()?.core?.invoke,licenseStatus:()=>l().core.invoke("license_status"),fingerprint:()=>l().core.invoke("machine_fingerprint"),version:()=>l().app.getVersion(),installUpdate:()=>l().core.invoke("install_update"),float:(e,t,n,s)=>l().core.invoke("open_float",{path:e,title:t,width:n,height:s}),importLicense:async()=>{let e=await l().dialog.open({multiple:!1,filters:[{name:"conform.tools licence",extensions:["lic","json"]}]});return typeof e=="string"?l().core.invoke("import_license",{path:e}):null},pickFolder:async()=>{let e=await l().dialog.open({directory:!0,multiple:!1});return typeof e=="string"?e:null},pickFiles:async()=>{let e=await l().dialog.open({directory:!1,multiple:!0});return Array.isArray(e)?e:typeof e=="string"?[e]:[]},pickFile:async()=>{let e=await l().dialog.open({directory:!1,multiple:!1});return typeof e=="string"?e:null},saveFile:async e=>{try{let t=e.split(".").pop()??"json",n=await l().dialog.save({defaultPath:e,filters:[{name:t==="csv"?"Table":"Recipe",extensions:[t]}]});return typeof n=="string"?n:null}catch{let t=await l().dialog.open({directory:!0,multiple:!1});return typeof t=="string"?`${t.replace(/[\\/]$/,"")}/${e}`:null}}};export{v as EngineError,O as engine,$ as engineFs,j as isDemo,E as shell};
5
+ `))>=0;){let u=g.slice(0,p);g=g.slice(p+2),u.startsWith("data: ")&&n(JSON.parse(u.slice(6)))}}}var k=new Set,T=null;function x(){if(T)return;let e=T=new AbortController;(async()=>{for(;!e.signal.aborted;)await S("/app/events",{method:"GET"},t=>{for(let n of k)n(t)},e.signal,45e3).catch(()=>{}),e.signal.aborted||await new Promise(t=>setTimeout(t,2e3))})()}var O={base:d.base,health:()=>r("GET","/health"),verb:(e,t={})=>r("POST",`/verbs/${e}`,t),poll:(e,t={})=>r("POST",`/verbs/${e}`,t,[],{"x-conform-poll":"1"},2e4),job:e=>r("GET",`/jobs/${e}`),cancelJob:e=>r("DELETE",`/jobs/${e}`),front:e=>r("POST","/app/front",e),account:()=>r("GET","/app/account"),projects:()=>r("GET","/app/projects"),createProject:e=>r("POST","/app/projects",e),project:e=>r("GET",`/app/projects/${e}`),attachSession:(e,t)=>r("PUT",`/app/projects/${e}/sessions`,{session_id:t}),saveContext:(e,t,n)=>r("PUT",`/app/projects/${e}/context`,{text:t,base:n},[409]),frame:async(e,t,n,s,i,o,a)=>{let c=new URLSearchParams({f:String(t),w:String(n),...i?{timeline:i}:{},...o?{track:String(o)}:{},...a?{grade:"resolve",...a.host_timeline?{host_timeline:a.host_timeline}:{}}:{}});if(f)return null;let g=await fetch(`${d.base}/app/sessions/${e}/frame?${c}`,{headers:w(!1),signal:s}).catch(()=>null);if(!g?.ok)return null;if(g.headers.get("content-type")!=="application/x-conform-pixels")return createImageBitmap(await g.blob()).catch(()=>null);let b=new Uint8Array(await g.arrayBuffer()),m=new DataView(b.buffer),h=m.getUint32(0,!0),y=m.getUint32(4,!0),R=m.getUint32(8,!0)===1,p=new Uint8ClampedArray(b.buffer,12,h*y*4);for(let u=0;u<p.length;u+=4){if(R){let _=p[u];p[u]=p[u+2],p[u+2]=_}p[u+3]=255}return createImageBitmap(new ImageData(p,h,y)).catch(()=>null)},tools:()=>r("POST","/verbs/tool",{action:"list"}).then(e=>e.tools??[]),blocks:()=>r("POST","/verbs/tool",{action:"blocks"}).then(e=>e.blocks??[]),saveTool:e=>r("POST","/verbs/tool",{action:"save",spec:e},[422]),deleteTool:e=>r("POST","/verbs/tool",{action:"delete",id:e},[422]),toolLayout:()=>r("POST","/verbs/tool",{action:"layout"}).then(e=>e.layout),arrangeTools:e=>r("POST","/verbs/tool",{action:"arrange",layout:e}).then(t=>t.layout),hideTool:(e,t)=>r("POST","/verbs/tool",{action:t?"hide":"show_tool",id:e}).then(n=>n.layout),workspace:e=>r("POST","/verbs/tool",{action:"workspace",project_id:e}).then(t=>t.workspace),saveWorkspace:(e,t)=>r("POST","/verbs/tool",{action:"workspace_save",project_id:e,workspace:t},[422]),exportTools:(e,t)=>r("POST","/verbs/tool",{action:"export",ids:e,path:t},[422]),importTools:e=>r("POST","/verbs/tool",{action:"import",path:e},[422]),hostSetup:(e,t="status")=>r("POST","/verbs/host_setup",{host:e,action:t},[422]),convert:async(e,t)=>{let n=new URLSearchParams({name:e.fileName,out:t,targets:JSON.stringify(e.targets.map(({target:i,ext:o})=>({target:i,ext:o}))),sequences:JSON.stringify(e.sequences)});if(f)return{ok:!1,error:(await import("./demo-engine-CBFAAPPO.js")).DEMO_TEXT};let s=await fetch(`${d.base}/app/convert?${n}`,{method:"POST",headers:{...w(!1),"content-type":"application/octet-stream"},body:e.bytes});return await s.json().catch(()=>({ok:!1,error:`the engine said ${s.status}`}))},canonicalize:async(e,t=[],n=[])=>{let s=new URLSearchParams({name:e.name,sequences:JSON.stringify(t),previous:JSON.stringify(n)});if(f)throw new Error((await import("./demo-engine-CBFAAPPO.js")).DEMO_TEXT);let i=await fetch(`${d.base}/app/canonicalize?${s}`,{method:"POST",headers:{...w(!1),"content-type":"application/octet-stream"},body:await e.arrayBuffer()}),o=await i.json().catch(()=>({ok:!1,error:`the engine said ${i.status}`}));if(!o.ok)throw new Error(o.error??o.message??`the engine said ${i.status}`);return o},policy:()=>r("GET","/app/policy"),session:e=>r("GET",`/app/sessions/${e}`),onEvent:e=>(k.add(e),x(),()=>{k.delete(e),k.size||(T?.abort(),T=null)}),saveRunCsv:(e,t,n,s)=>r("POST","/verbs/tool_run",{action:"csv",project_id:e,path:t,id:n,table:s}),runs:(e,t)=>r("POST","/verbs/tool_run",{action:"list",project_id:e,...t?{id:t}:{}}).then(n=>n.runs??[])};async function $(e,t){if(f)throw Object.assign(new Error((await import("./demo-engine-CBFAAPPO.js")).DEMO_TEXT),{name:"NotFoundError"});let n=await fetch(`${d.base}/app/fs`,{method:"POST",headers:w(),body:JSON.stringify({op:e,...t})});if(e==="readFile"){if(!n.ok)throw Object.assign(new Error(`could not read ${String(t.path)}`),{name:"NotReadableError"});let i=await n.arrayBuffer();return{result:{byteLength:i.byteLength},bytes:i}}let s=await n.json().catch(()=>({ok:!1}));if(!s.ok)throw Object.assign(new Error(s.message??`the engine said ${n.status}`),{name:"NotFoundError"});return{result:s.result}}var l=()=>typeof window<"u"?window.__TAURI__:void 0,E={available:()=>!!l()?.core?.invoke,licenseStatus:()=>l().core.invoke("license_status"),fingerprint:()=>l().core.invoke("machine_fingerprint"),version:()=>l().app.getVersion(),installUpdate:()=>l().core.invoke("install_update"),float:(e,t,n,s)=>l().core.invoke("open_float",{path:e,title:t,width:n,height:s}),importLicense:async()=>{let e=await l().dialog.open({multiple:!1,filters:[{name:"conform.tools licence",extensions:["lic","json"]}]});return typeof e=="string"?l().core.invoke("import_license",{path:e}):null},pickFolder:async()=>{let e=await l().dialog.open({directory:!0,multiple:!1});return typeof e=="string"?e:null},pickFiles:async()=>{let e=await l().dialog.open({directory:!1,multiple:!0});return Array.isArray(e)?e:typeof e=="string"?[e]:[]},pickFile:async()=>{let e=await l().dialog.open({directory:!1,multiple:!1});return typeof e=="string"?e:null},saveFile:async e=>{try{let t=e.split(".").pop()??"json",n=await l().dialog.save({defaultPath:e,filters:[{name:t==="csv"?"Table":"Recipe",extensions:[t]}]});return typeof n=="string"?n:null}catch{let t=await l().dialog.open({directory:!0,multiple:!1});return typeof t=="string"?`${t.replace(/[\\/]$/,"")}/${e}`:null}}};export{v as EngineError,O as engine,$ as engineFs,j as isDemo,E as shell};
@@ -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{jc as a,kc as b,lc as c,mc as d,nc as e,oc as f,pc as g,qc as h,rc as i,sc as j,tc as k,uc as l,vc as m,wc as n}from"./chunk-63WQRYTJ.js";import"./chunk-IN6XVTUS.js";import"./chunk-DLF5AKXT.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-TBU2XWFD.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-UKXSKFL3.js";import"./chunk-4RA57LTJ.js";import"./chunk-FLLB6UZJ.js";import"./chunk-UAURERD3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-VERTA23P.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import"./chunk-ROGMKTND.js";import"./chunk-X527E5VI.js";import"./chunk-PSANHDZM.js";export{j as ASPECTS,a as INPUT_SCALING,f as SIZING_TARGETS,i as alignText,h as alignTimeline,k as aspectOf,l as blankingForAspect,m as blankingQc,n as blankingText,c as inputFitRatio,g as offlineLane,d as resolveProps,b as scalingOf,e as underRef};
3
+ import{jc as a,kc as b,lc as c,mc as d,nc as e,oc as f,pc as g,qc as h,rc as i,sc as j,tc as k,uc as l,vc as m,wc as n}from"./chunk-VWFEMXYZ.js";import"./chunk-IN6XVTUS.js";import"./chunk-DLF5AKXT.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RVZQ3Y6N.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-UKXSKFL3.js";import"./chunk-4RA57LTJ.js";import"./chunk-FLLB6UZJ.js";import"./chunk-UAURERD3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-JL454FFL.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import"./chunk-ROGMKTND.js";import"./chunk-X527E5VI.js";import"./chunk-PSANHDZM.js";export{j as ASPECTS,a as INPUT_SCALING,f as SIZING_TARGETS,i as alignText,h as alignTimeline,k as aspectOf,l as blankingForAspect,m as blankingQc,n as blankingText,c as inputFitRatio,g as offlineLane,d as resolveProps,b as scalingOf,e as underRef};
@@ -1,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-G7CVRPVA.js";import{c as D}from"./chunk-IBIAW6IW.js";import{$b as N,R as M,Ub as P,dc as q}from"./chunk-63WQRYTJ.js";import"./chunk-IN6XVTUS.js";import{k as A}from"./chunk-DLF5AKXT.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-7NGS2BN7.js";import"./chunk-TBU2XWFD.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-UKXSKFL3.js";import"./chunk-4RA57LTJ.js";import"./chunk-FLLB6UZJ.js";import"./chunk-UAURERD3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import{b as F}from"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-VERTA23P.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import"./chunk-ROGMKTND.js";import{$ as R,L as x,M as E,_ as U,ba as k,p as O,t as S}from"./chunk-X527E5VI.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-WZHNO43A.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-RJD44NQU.js";import{c as D}from"./chunk-MGMDNGNX.js";import{$b as N,R as M,Ub as P,dc as q}from"./chunk-VWFEMXYZ.js";import"./chunk-IN6XVTUS.js";import{k as A}from"./chunk-DLF5AKXT.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-HOACOBAY.js";import"./chunk-RVZQ3Y6N.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-UKXSKFL3.js";import"./chunk-4RA57LTJ.js";import"./chunk-FLLB6UZJ.js";import"./chunk-UAURERD3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import{b as F}from"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-JL454FFL.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import"./chunk-ROGMKTND.js";import{$ as R,L as x,M as E,_ as U,ba as k,p as O,t as S}from"./chunk-X527E5VI.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-MWNX47IK.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-6KEFHHS6.js";import"./chunk-IBIAW6IW.js";import"./chunk-63WQRYTJ.js";import"./chunk-IN6XVTUS.js";import"./chunk-DLF5AKXT.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-7NGS2BN7.js";import"./chunk-TBU2XWFD.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-UKXSKFL3.js";import"./chunk-4RA57LTJ.js";import"./chunk-FLLB6UZJ.js";import"./chunk-UAURERD3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-VERTA23P.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import"./chunk-ROGMKTND.js";import"./chunk-X527E5VI.js";import"./chunk-PSANHDZM.js";export{a as 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-5W57ITT2.js";import"./chunk-MGMDNGNX.js";import"./chunk-VWFEMXYZ.js";import"./chunk-IN6XVTUS.js";import"./chunk-DLF5AKXT.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-HOACOBAY.js";import"./chunk-RVZQ3Y6N.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-UKXSKFL3.js";import"./chunk-4RA57LTJ.js";import"./chunk-FLLB6UZJ.js";import"./chunk-UAURERD3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-JL454FFL.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import"./chunk-ROGMKTND.js";import"./chunk-X527E5VI.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,5 +1,5 @@
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 At}from"./chunk-B2KCENY6.js";import{a as St,b as Tt,c as Ot,d as Rt,e as vt,f as Et,g as Pt,j as T,k as Ct,n as $,o as $t}from"./chunk-HTRW5GX4.js";import"./chunk-IDJIOKXA.js";import"./chunk-G7CVRPVA.js";import"./chunk-6KEFHHS6.js";import"./chunk-IBIAW6IW.js";import"./chunk-QH5DTYSE.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{Db as ht,Eb as wt,G as at,H as it,J as gt,P as V,Tc as kt,Xc as R,bd as yt,dd as xt,fd as bt,xc as _t}from"./chunk-63WQRYTJ.js";import"./chunk-IN6XVTUS.js";import"./chunk-DLF5AKXT.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-7NGS2BN7.js";import{a as rt}from"./chunk-TBU2XWFD.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-UKXSKFL3.js";import"./chunk-4RA57LTJ.js";import"./chunk-FLLB6UZJ.js";import"./chunk-UAURERD3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-XVZ7KJRI.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import{C,E as mt,t as G,u as lt,v as ut,x as dt,y as pt,z as ft}from"./chunk-VERTA23P.js";import{h as ct,l as H}from"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import{a as I}from"./chunk-ROGMKTND.js";import{$ as J,A as tt,B as j,D as et,H as L,L as F,M as nt,N as ot,U as st,_ as U,b as O,ba as S,n as P,t as z,u as Z,x as Q,y as q,z as B}from"./chunk-X527E5VI.js";import"./chunk-PSANHDZM.js";import N from"node:process";var Nt=new Map;function Mt(t,i,s,x){let a=`${t}:${s}:${x}`,o=Nt.get(a);return o||(o=(async()=>{let n=S(P(),"cache","grade-luts",t);await j(n);let d=S(n,`V${s}_${x}.cube`);if(!await Z(d)){let{adapter:k}=await import("./hosts-QW64CIJU.js");if((await k("resolve").clipLut({timeline:i,track:s,start:x,out_path:d})).ok===!1)return null}return d})().catch(()=>null),Nt.set(a,o)),o}var It=new Set(["/app/convert","/app/canonicalize"]);function Lt(t,i){let s=(i??"").split(";")[0].trim().toLowerCase();return s==="application/json"||s==="application/octet-stream"&&It.has(t)}function Ht(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 W={id:"local",name:"Local",client_name:null,handles:24,local:!0};async function Ut(){try{return JSON.parse(await q(S(P(),"projects","projects.json")))}catch{return[]}}async function jt(){let t=await T("project",{action:"list"});if(!t.isError){let i=t.structuredContent?.projects??[];return await j(S(P(),"projects")),await tt(S(P(),"projects","projects.json"),JSON.stringify(i)),{projects:[W,...i],offline:!1}}return{projects:[W,...await Ut()],offline:!0,code:String(t.structuredContent?.code??"offline"),reason:String(t.structuredContent?.message??t.content[0]?.text??"")}}async function Gt(t){return t==="local"?W:(await Ut()).find(i=>i.id===t)??{id:t,name:t}}async function Dt(t,i,s,x,a=(o,n)=>new Response(o,{headers:{"content-type":n}})){if(i[0]!=="app")return null;let[,o,n,d]=i,k=async()=>t.headers.get("content-type")?.includes("json")?await t.json():{};try{if(o==="policy"&&t.method==="GET"){let{config:e}=await import("./account-W7Z2MYZU.js"),r=await fetch(`${e().supabaseUrl}/functions/v1/v1-billing/v1/billing/app-policy`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null);return s(r?.ok?await r.json():{offline:!0})}if(o==="account"&&t.method==="GET"){let e=await T("account_status",{}),r=await H().then(c=>({app:!0,studio_tools:c.source==="licence"||ct(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 s({...e.structuredContent,...e.structuredContent?.account??{},...r,text:e.content[0]?.text})}{let e=await H().then(()=>null,r=>r);if(e)return s({ok:!1,code:e.code,message:e.message,needs:"app"},e.code==="not_signed_in"?401:402)}if(o==="events"&&t.method==="GET")return x(Rt());if(o==="front"&&t.method==="POST"){let e=await t.json();return Tt({project:String(e.project??""),view:String(e.view??""),...e.tool?{tool:String(e.tool)}:{}}),s({ok:!0})}if(o==="convert"&&t.method==="POST"){let e=new URL(t.url).searchParams,r=U(e.get("name")||"timeline"),c=e.get("out")||"",g=JSON.parse(e.get("targets")||"[]"),l=JSON.parse(e.get("sequences")||"[]");if(!c||!g.length)return s({ok:!1,error:"a folder and at least one format are needed"},400);let u=await F("conform-te-"),f=S(u,r);await B(f,new Uint8Array(await t.arrayBuffer()));let h=await T("timeline_read",{path:f}),y=h.structuredContent?.session_id??h.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(h.isError||!y)return s({ok:!1,error:h.content[0]?.text??"could not read the timeline"});let w=(await C(y)).session.timelines.filter(b=>b.kind!=="compound"),_=l.length?w.filter(b=>l.includes(b.name??"")):w,p=[],v=0;for(let b of _)for(let E of g){let M=S(c,`${Ht(b.name??"timeline")}.${E.ext}`),Y=await T("timeline_write",{session_id:y,target:E.target,out_path:M,..._.length>1||w.length>1?{timeline_id:b.id}:{}});Y.isError?p.push(`${b.name} \u2192 ${E.target}: ${Y.content[0]?.text}`):v++}return await L(u).catch(()=>{}),s({ok:v>0,savedCount:v,...p.length?{error:p.join(`
3
+ import{a as At}from"./chunk-QRZO5GOI.js";import{a as St,b as Tt,c as Ot,d as Rt,e as vt,f as Et,g as Pt,j as T,k as Ct,n as $,o as $t}from"./chunk-JM5LHKTU.js";import"./chunk-IDJIOKXA.js";import"./chunk-RJD44NQU.js";import"./chunk-5W57ITT2.js";import"./chunk-MGMDNGNX.js";import"./chunk-QH5DTYSE.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{Db as ht,Eb as wt,G as at,H as it,J as gt,P as V,Tc as kt,Xc as R,bd as yt,dd as xt,fd as bt,xc as _t}from"./chunk-VWFEMXYZ.js";import"./chunk-IN6XVTUS.js";import"./chunk-DLF5AKXT.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-HOACOBAY.js";import{a as rt}from"./chunk-RVZQ3Y6N.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-UKXSKFL3.js";import"./chunk-4RA57LTJ.js";import"./chunk-FLLB6UZJ.js";import"./chunk-UAURERD3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-XVZ7KJRI.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import{C,E as mt,t as G,u as lt,v as ut,x as dt,y as pt,z as ft}from"./chunk-JL454FFL.js";import{h as ct,l as H}from"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import{a as I}from"./chunk-ROGMKTND.js";import{$ as J,A as tt,B as j,D as et,H as L,L as F,M as nt,N as ot,U as st,_ as U,b as O,ba as S,n as P,t as z,u as Z,x as Q,y as q,z as B}from"./chunk-X527E5VI.js";import"./chunk-PSANHDZM.js";import N from"node:process";var Nt=new Map;function Mt(t,i,s,x){let a=`${t}:${s}:${x}`,o=Nt.get(a);return o||(o=(async()=>{let n=S(P(),"cache","grade-luts",t);await j(n);let d=S(n,`V${s}_${x}.cube`);if(!await Z(d)){let{adapter:k}=await import("./hosts-GEXAZFB3.js");if((await k("resolve").clipLut({timeline:i,track:s,start:x,out_path:d})).ok===!1)return null}return d})().catch(()=>null),Nt.set(a,o)),o}var It=new Set(["/app/convert","/app/canonicalize"]);function Lt(t,i){let s=(i??"").split(";")[0].trim().toLowerCase();return s==="application/json"||s==="application/octet-stream"&&It.has(t)}function Ht(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 W={id:"local",name:"Local",client_name:null,handles:24,local:!0};async function Ut(){try{return JSON.parse(await q(S(P(),"projects","projects.json")))}catch{return[]}}async function jt(){let t=await T("project",{action:"list"});if(!t.isError){let i=t.structuredContent?.projects??[];return await j(S(P(),"projects")),await tt(S(P(),"projects","projects.json"),JSON.stringify(i)),{projects:[W,...i],offline:!1}}return{projects:[W,...await Ut()],offline:!0,code:String(t.structuredContent?.code??"offline"),reason:String(t.structuredContent?.message??t.content[0]?.text??"")}}async function Gt(t){return t==="local"?W:(await Ut()).find(i=>i.id===t)??{id:t,name:t}}async function Dt(t,i,s,x,a=(o,n)=>new Response(o,{headers:{"content-type":n}})){if(i[0]!=="app")return null;let[,o,n,d]=i,k=async()=>t.headers.get("content-type")?.includes("json")?await t.json():{};try{if(o==="policy"&&t.method==="GET"){let{config:e}=await import("./account-W7Z2MYZU.js"),r=await fetch(`${e().supabaseUrl}/functions/v1/v1-billing/v1/billing/app-policy`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null);return s(r?.ok?await r.json():{offline:!0})}if(o==="account"&&t.method==="GET"){let e=await T("account_status",{}),r=await H().then(c=>({app:!0,studio_tools:c.source==="licence"||ct(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 s({...e.structuredContent,...e.structuredContent?.account??{},...r,text:e.content[0]?.text})}{let e=await H().then(()=>null,r=>r);if(e)return s({ok:!1,code:e.code,message:e.message,needs:"app"},e.code==="not_signed_in"?401:402)}if(o==="events"&&t.method==="GET")return x(Rt());if(o==="front"&&t.method==="POST"){let e=await t.json();return Tt({project:String(e.project??""),view:String(e.view??""),...e.tool?{tool:String(e.tool)}:{}}),s({ok:!0})}if(o==="convert"&&t.method==="POST"){let e=new URL(t.url).searchParams,r=U(e.get("name")||"timeline"),c=e.get("out")||"",g=JSON.parse(e.get("targets")||"[]"),l=JSON.parse(e.get("sequences")||"[]");if(!c||!g.length)return s({ok:!1,error:"a folder and at least one format are needed"},400);let u=await F("conform-te-"),f=S(u,r);await B(f,new Uint8Array(await t.arrayBuffer()));let h=await T("timeline_read",{path:f}),y=h.structuredContent?.session_id??h.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(h.isError||!y)return s({ok:!1,error:h.content[0]?.text??"could not read the timeline"});let w=(await C(y)).session.timelines.filter(b=>b.kind!=="compound"),_=l.length?w.filter(b=>l.includes(b.name??"")):w,p=[],v=0;for(let b of _)for(let E of g){let M=S(c,`${Ht(b.name??"timeline")}.${E.ext}`),Y=await T("timeline_write",{session_id:y,target:E.target,out_path:M,..._.length>1||w.length>1?{timeline_id:b.id}:{}});Y.isError?p.push(`${b.name} \u2192 ${E.target}: ${Y.content[0]?.text}`):v++}return await L(u).catch(()=>{}),s({ok:v>0,savedCount:v,...p.length?{error:p.join(`
4
4
  `)}:{}})}if(o==="fs"&&t.method==="POST"){let{op:e,path:r,offset:c=0,length:g=0}=await k();if(e==="statPath"){let l=await z(r).catch(()=>null);return s({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 nt(r))(u.isFile||u.isDirectory)&&l.push({name:u.name,kind:u.isDirectory?"directory":"file"});return s({ok:!0,result:l})}if(e==="readFile"){let l=g>0?g:Math.max(0,(await z(r)).size-Math.max(0,c)),u=512<<20;if(l>u)return s({ok:!1,code:"too_large",message:`${r} is ${Math.round(l/(1<<20))} MB: read it in parts (offset, length \u2264 ${u>>20} MB)`},413);let f=await ot(r);try{return a(await f.readAt(Math.max(0,c),l),"application/octet-stream")}finally{await f.close()}}return s({ok:!1,code:"bad_request",message:`no fs op ${e}`},400)}if(o==="canonicalize"&&t.method==="POST"){let e=new URL(t.url).searchParams,r=JSON.parse(e.get("sequences")||"[]"),c=JSON.parse(e.get("previous")||"[]"),g=await F("conform-te-");try{let l=S(g,U(e.get("name")||"timeline"));await B(l,new Uint8Array(await t.arrayBuffer()));let u=await T("timeline_read",{path:l}),f=u.structuredContent?.session_id??u.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(u.isError||!f)return s({ok:!1,error:u.content[0]?.text??"could not read the timeline"},422);let h=(await C(f)).session,y=h.timelines;if(r.length){let w=new Map;for(let p of c)w.set(p,(w.get(p)??0)+1);let _=new Set;for(let p of r){let v=h.timelines.filter(M=>M.kind!=="compound"&&(M.name??"")===p),b=w.get(p)??0;w.set(p,b+1);let E=v[Math.min(b,v.length-1)];E&&_.add(E)}y=h.timelines.filter(p=>p.kind==="compound"||_.has(p))}return s({ok:!0,session_id:f,session:{...h,timelines:y}})}finally{await L(g).catch(()=>{})}}if(o==="sessions"&&n&&d==="frame"){let e=new URL(t.url).searchParams,r=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 _=(()=>{try{return ht(f,{record:r,timeline:e.get("timeline")??void 0,track:h})}catch{return null}})();_&&(y=await Mt(n,e.get("host_timeline")??void 0,_.video_track,_.record_start)??void 0)}let w=await wt(f,r,c,e.get("timeline")??void 0,h,y);if(w){let _=new Uint8Array(12+w.px.length),p=new DataView(_.buffer);return p.setUint32(0,w.w,!0),p.setUint32(4,w.h,!0),p.setUint32(8,w.order==="bgra"?1:0,!0),_.set(w.px,12),a(_,"application/x-conform-pixels")}}catch(f){return s({ok:!1,code:"no_frame",message:f.message},404)}let g=await T("timeline_frame",{session_id:n,record:r,width:c,...e.get("timeline")?{timeline:e.get("timeline")}:{}},{poll:!0}),l=g.structuredContent?.out_path;if(g.isError||!l)return s({ok:!1,code:String(g.structuredContent?.code??"no_frame"),message:g.content[0]?.text??"no picture here"},404);let u=await Q(l);return await(U(J(l)).startsWith("conform-frame-")?L(J(l)):et(l)).catch(()=>{}),a(u,"image/png")}if(o==="sessions"&&n&&t.method==="GET"){let e=await C(n).catch(()=>null);return e?s(e):s({ok:!1,code:"not_found"},404)}if(o==="sessions"&&!n)return s(await mt());if(o!=="projects")return s({ok:!1,code:"not_found"},404);if(!n){if(t.method==="POST"){let e=await k(),r=await T("project",{action:"create",name:e.name,client_name:e.client_name,handles:e.handles});return r.isError?s({...r.structuredContent,text:r.content[0]?.text},422):(await jt(),s(r.structuredContent))}return s(await jt())}if(!d){let[e,r,c,g,l,u]=await Promise.all([Gt(n),lt(n).catch(()=>null),ft(n),gt(n),yt(n).then(y=>y.facts).catch(()=>[]),n===G?null:xt().catch(()=>null)]);await dt(n===G?null:{id:n,name:e.name??n});let{text:f="",...h}=r??{};return s({project:e,context:f,context_meta:h,sessions:c,activity:g.slice(-100).reverse(),known:bt(l),facility:u?.text??""})}if(d==="sessions"&&t.method==="PUT")return await pt(n,String((await k()).session_id??"")),s({ok:!0});if(d==="context"&&t.method==="PUT"){let e=await k();try{let{text:r,...c}=await ut(n,String(e.text??""),e.base===void 0?void 0:e.base);return s({ok:!0,context:r,context_meta:c})}catch(r){if(r instanceof I&&r.code==="context_conflict"){let c=r.data?.current;return s({ok:!1,code:r.code,message:r.message,context:c.context,context_meta:{updated_at:c.context_updated_at,updated_by:c.context_updated_by_name??null}},409)}throw r}}return s({ok:!1,code:"not_found"},404)}catch(e){let r=e instanceof I?e:null;return s({ok:!1,code:r?.code??"internal",message:e.message},r?.code==="not_found"?404:r?.code==="invalid_args"?400:500)}}var zt=t=>t==="1"?"app":"http",K=(t,i)=>t&&i.has(t)?t:"custom",A=new Map,Vt=500;function Bt(t){let i=null,s=St(a=>{switch(a.type){case"open":R(`app:open:${K(a.tool,t)}`);break;case"home":R("app:home");break;case"workspace":{let o=a.workspace;R("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):[];R("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>=Vt&&A.delete(A.keys().next().value),A.set(o.id,o.status),R(`app:run_${o.status}:${K(o.tool,t)}`,{fields:[o.by==="app"?"app":"assistant"],ok:o.status!=="failed"});break}}}),x=Ot(a=>{let o=/^[a-z]+$/.test(a.view)?a.view:"other",n=`${a.project}|${o}|${a.tool??""}`;n!==i&&(i=n,R(o==="tool"?`app:view:tool:${K(a.tool,t)}`:`app:view:${o}`))});return()=>{s(),x()}}var Wt=Number(O("CONFORM_HTTP_PORT")??7791);O("CONFORM_EXIT_WITH_PARENT")==="1"&&(N.stdin.on("end",()=>N.exit(0)),N.stdin.on("close",()=>N.exit(0)),N.stdin.resume());kt(zt(O("CONFORM_EXIT_WITH_PARENT")));Bt(new Set([..._t.map(t=>t.id),...$.map(t=>t.name),"context","source"]));var X=O("CONFORM_HTTP_TOKEN")??"",Jt=(O("CONFORM_HTTP_ORIGINS")??"https://conform.tools,https://app.conform.tools,http://localhost:5173,http://localhost:3000").split(","),D=(t,i=new Headers)=>{let s=t.headers.get("origin")??"";return Jt.includes(s)&&i.set("access-control-allow-origin",s),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},Ft=new Set,m=(t,i,s=200)=>new Response(JSON.stringify(i),{status:s,headers:D(t,new Headers({"content-type":"application/json"}))});st({hostname:"127.0.0.1",port:Wt,onListen:t=>{Ft=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)`),At(t,X)}},async t=>{let i=new URL(t.url),s=(t.headers.get("host")??"").toLowerCase();if(!Ft.has(s))return new Response("forbidden host",{status:403});let x=t.headers.get("origin");if(x&&!Jt.includes(x))return new Response("forbidden origin",{status:403});if(t.method==="OPTIONS")return new Response(null,{status:204,headers:D(t)});if((t.method==="POST"||t.method==="PUT")&&t.headers.get("content-length")!=="0"&&!Lt(i.pathname,t.headers.get("content-type")))return m(t,{ok:!1,code:"unsupported_media_type",message:"send the body as application/json"},415);if(X&&t.headers.get("authorization")!==`Bearer ${X}`&&i.pathname!=="/health")return m(t,{ok:!1,code:"unauthorized"},401);let a=i.pathname.split("/").filter(Boolean);try{if(i.pathname==="/health")return m(t,{ok:!0,verbs:$.length,version:rt,engine:V()});if(a[0]==="verbs"&&a.length===1&&t.method==="GET")return m(t,$.map(n=>({name:n.name,title:n.title,description:n.description,long:!!n.long,input_schema:it(at.object(n.inputSchema)),protected_stages:n.protectedStages??[],engine:V()})));if(a[0]==="verbs"&&a.length===2&&t.method==="POST"){let n=$t(a[1]);if(!n)return m(t,{ok:!1,code:"not_found",message:`unknown verb ${a[1]}`},404);let d=t.headers.get("content-type")?.includes("json")?await t.json():{},k=Ct(n.name,d);if(!k.ok)return m(t,{...k.result.structuredContent,text:k.result.content[0].text},400);let e=await T(n.name,k.data,{client:t.headers.get("x-conform-client")??"http",poll:t.headers.get("x-conform-poll")==="1"});return m(t,{...e.structuredContent??{ok:!e.isError},text:e.content.map(r=>r.text).join(`
5
- `)},e.isError?422:200)}if(a[0]==="debug"&&a.length===3&&t.method==="POST"&&O("CONFORM_DEBUG_BRIDGE")==="1"){let{hostBridge:n}=await import("./bridge-RH3JRSBN.js"),d=await n();return await d.waitFor(a[1],5e3)?m(t,{ok:!0,result:await d.request(a[1],a[2],t.headers.get("content-type")?.includes("json")?await t.json():{},12e4)}):m(t,{ok:!1,code:"not_connected"},409)}let o=await Dt(t,a,(n,d)=>m(t,n,d),n=>new Response(n,{headers:D(t,new Headers({"content-type":"text/event-stream","cache-control":"no-cache"}))}),(n,d)=>new Response(n,{headers:D(t,new Headers({"content-type":d,"cache-control":"no-store"}))}));if(o)return o;if(a[0]==="jobs"&&a.length===1)return m(t,await Pt());if(a[0]==="jobs"&&a.length===2){if(t.method==="DELETE")return m(t,{ok:Et(a[1])});let n=await vt(a[1]);return n?m(t,n):m(t,{ok:!1,code:"not_found"},404)}return m(t,{ok:!1,code:"not_found"},404)}catch(o){return m(t,{ok:!1,code:"internal",message:o instanceof Error?o.message:String(o)},500)}});
5
+ `)},e.isError?422:200)}if(a[0]==="debug"&&a.length===3&&t.method==="POST"&&O("CONFORM_DEBUG_BRIDGE")==="1"){let{hostBridge:n}=await import("./bridge-UPSJ7F3S.js"),d=await n();return await d.waitFor(a[1],5e3)?m(t,{ok:!0,result:await d.request(a[1],a[2],t.headers.get("content-type")?.includes("json")?await t.json():{},12e4)}):m(t,{ok:!1,code:"not_connected"},409)}let o=await Dt(t,a,(n,d)=>m(t,n,d),n=>new Response(n,{headers:D(t,new Headers({"content-type":"text/event-stream","cache-control":"no-cache"}))}),(n,d)=>new Response(n,{headers:D(t,new Headers({"content-type":d,"cache-control":"no-store"}))}));if(o)return o;if(a[0]==="jobs"&&a.length===1)return m(t,await Pt());if(a[0]==="jobs"&&a.length===2){if(t.method==="DELETE")return m(t,{ok:Et(a[1])});let n=await vt(a[1]);return n?m(t,n):m(t,{ok:!1,code:"not_found"},404)}return m(t,{ok:!1,code:"not_found"},404)}catch(o){return m(t,{ok:!1,code:"internal",message:o instanceof Error?o.message:String(o)},500)}});
@@ -65,4 +65,4 @@ Check the top-level render call using <`+p+">.")}return h}function Us(u,h){if(!(
65
65
 
66
66
  Caused by: ${(y=d?.name)!==null&&y!==void 0?y:"Error"}: ${T}`,O&&(a+=` (${O})`),d?.stack&&(a+=`
67
67
  ${d.stack}`)}else{var v;a=(v=i?.stack)!==null&&v!==void 0?v:""}let w=this.url.toString().length;return i?.name==="AbortError"||i?.code==="ABORT_ERR"?(c="",l="Request was aborted (timeout or manual cancellation)",w>this.urlLengthLimit&&(l+=`. Note: Your request URL is ${w} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(d?.name==="HeadersOverflowError"||d?.code==="UND_ERR_HEADERS_OVERFLOW")&&(c="",l="HTTP headers exceeded server limits (typically 16KB)",w>this.urlLengthLimit&&(l+=`. Your request URL is ${w} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{error:{message:`${(o=i?.name)!==null&&o!==void 0?o:"FetchError"}: ${i?.message}`,details:a,hint:l,code:c},data:null,count:null,status:0,statusText:""}})),s.then(t,e)}returns(){return this}overrideTypes(){return this}},Tu=class extends Su{select(t){let e=!1,r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){let i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){let n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){let s=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var o;let a=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}},Ci=new RegExp("[,()]"),Xe=class extends Tu{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){let r=Array.from(new Set(e)).map(n=>typeof n=="string"&&Ci.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){let r=Array.from(new Set(e)).map(n=>typeof n=="string"&&Ci.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");let i=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${s}fts${i}.${e}`),this}match(t){return Object.entries(t).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){let n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},Au=class{constructor(t,{headers:e={},schema:r,fetch:n,urlLengthLimit:s=8e3}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n,this.urlLengthLimit=s}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){let{head:r=!1,count:n}=e??{},s=r?"HEAD":"GET",i=!1,o=(t??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),n&&l.append("Prefer",`count=${n}`),new Xe({method:s,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;let s="POST",{url:i,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),r||o.append("Prefer","missing=default"),Array.isArray(t)){let a=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){let l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new Xe({method:s,url:i,headers:o,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;let o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&a.searchParams.set("on_conflict",e),n&&l.append("Prefer",`count=${n}`),s||l.append("Prefer","missing=default"),Array.isArray(t)){let c=t.reduce((d,m)=>d.concat(Object.keys(m)),[]);if(c.length>0){let d=[...new Set(c)].map(m=>`"${m}"`);a.searchParams.set("columns",d.join(","))}}return new Xe({method:o,url:a,headers:l,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit})}update(t,{count:e}={}){var r;let n="PATCH",{url:s,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new Xe({method:n,url:s,headers:i,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:t}={}){var e;let r="DELETE",{url:n,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new Xe({method:r,url:n,headers:s,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit})}};function ct(t){"@babel/helpers - typeof";return ct=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ct(t)}function Ru(t,e){if(ct(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ct(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ku(t){var e=Ru(t,"string");return ct(e)=="symbol"?e:e+""}function Ou(t,e,r){return(e=ku(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Vt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Pi(Object(r),!0).forEach(function(n){Ou(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Pi(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Ii=class xi{constructor(e,{headers:r={},schema:n,fetch:s,timeout:i,urlLengthLimit:o=8e3}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=o;let a=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(l,c)=>{let d=new AbortController,m=setTimeout(()=>d.abort(),i),_=c?.signal;if(_){if(_.aborted)return clearTimeout(m),a(l,c);let f=()=>{clearTimeout(m),d.abort()};return _.addEventListener("abort",f,{once:!0}),a(l,Vt(Vt({},c),{},{signal:d.signal})).finally(()=>{clearTimeout(m),_.removeEventListener("abort",f)})}return a(l,Vt(Vt({},c),{},{signal:d.signal})).finally(()=>clearTimeout(m))}:this.fetch=a}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Au(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(e){return new xi(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(e,r={},{head:n=!1,get:s=!1,count:i}={}){var o;let a,l=new URL(`${this.url}/rpc/${e}`),c,d=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(d)),m=n&&Object.values(r).some(d);m?(a="POST",c=r):n||s?(a=n?"HEAD":"GET",Object.entries(r).filter(([f,y])=>y!==void 0).map(([f,y])=>[f,Array.isArray(y)?`{${y.join(",")}}`:`${y}`]).forEach(([f,y])=>{l.searchParams.append(f,y)})):(a="POST",c=r);let _=new Headers(this.headers);return m?_.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&_.set("Prefer",`count=${i}`),new Xe({method:a,url:l,headers:_,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit})}};var Po=ze(mn(),1);var mt=class extends Error{constructor(t,e){super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&e.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Qu(t,e,r){let n=new URL(e,t);if(r)for(let[s,i]of Object.entries(r))i!==void 0&&n.searchParams.set(s,i);return n.toString()}async function Zu(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function el(t){let e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:o}){let a=Qu(t.baseUrl,n,s),l=await Zu(t.auth),c=await e(a,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),d=await c.text(),m=(c.headers.get("content-type")||"").includes("application/json"),_=m&&d?JSON.parse(d):d;if(!c.ok){let f=m?_:void 0,y=f?.error;throw new mt(y?.message??`Request failed with status ${c.status}`,{status:c.status,icebergType:y?.type,icebergCode:y?.code,details:f})}return{status:c.status,headers:c.headers,data:_}}}}function Zt(t){return t.join("")}var tl=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){let e=t?{parent:Zt(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){let r={namespace:t.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Zt(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Zt(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Zt(t.namespace)}`}),!0}catch(e){if(e instanceof mt&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof mt&&r.status===409)return;throw r}}};function Qe(t){return t.join("")}var rl=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){let r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){let r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(t){let e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){let e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof mt&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof mt&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},zi=class{constructor(t){let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);let r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=el({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new tl(this.client,e),this.tableOps=new rl(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};var tr=class extends Error{constructor(t,e="storage",r,n){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}};function rr(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var er=class extends tr{constructor(t,e,r,n="storage"){super(t,n,e,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Xi=class extends tr{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};var nl=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),sl=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},_n=t=>{if(Array.isArray(t))return t.map(r=>_n(r));if(typeof t=="function"||t!==Object(t))return t;let e={};return Object.entries(t).forEach(([r,n])=>{let s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=_n(n)}),e},il=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function gt(t){"@babel/helpers - typeof";return gt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gt(t)}function ol(t,e){if(gt(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(gt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function al(t){var e=ol(t,"string");return gt(e)=="symbol"?e:e+""}function ul(t,e,r){return(e=al(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Gi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function P(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Gi(Object(r),!0).forEach(function(n){ul(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Gi(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Ji=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},ll=async(t,e,r,n)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!r?.noResolveJson){let s=t,i=s.status||500;if(typeof s.json=="function")s.json().then(o=>{let a=o?.statusCode||o?.code||i+"";e(new er(Ji(o),i,a,n))}).catch(()=>{if(n==="vectors"){let o=i+"";e(new er(s.statusText||`HTTP ${i} error`,i,o,n))}else{let o=i+"";e(new er(s.statusText||`HTTP ${i} error`,i,o,n))}});else{let o=i+"";e(new er(s.statusText||`HTTP ${i} error`,i,o,n))}}else e(new Xi(Ji(t),t,n))},cl=(t,e,r,n)=>{let s={method:t,headers:e?.headers||{}};return t==="GET"||t==="HEAD"||!n?P(P({},s),r):(sl(n)?(s.headers=P({"Content-Type":"application/json"},e?.headers),s.body=JSON.stringify(n)):s.body=n,e?.duplex&&(s.duplex=e.duplex),P(P({},s),r))};async function _t(t,e,r,n,s,i,o){return new Promise((a,l)=>{t(r,cl(e,n,s,i)).then(c=>{if(!c.ok)throw c;if(n?.noResolveJson)return c;if(o==="vectors"){let d=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!d||!d.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>ll(c,l,n,o))})}function Qi(t="storage"){return{get:async(e,r,n,s)=>_t(e,"GET",r,n,s,void 0,t),post:async(e,r,n,s,i)=>_t(e,"POST",r,s,i,n,t),put:async(e,r,n,s,i)=>_t(e,"PUT",r,s,i,n,t),head:async(e,r,n,s)=>_t(e,"HEAD",r,P(P({},n),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,r,n,s,i)=>_t(e,"DELETE",r,s,i,n,t)}}var hl=Qi("storage"),{get:yt,post:Ae,put:gn,head:dl,remove:yn}=hl,me=Qi("vectors"),Ze=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.fetch=nl(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=P(P({},this.headers),{},{[t]:e}),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(rr(r))return{data:null,error:r};throw r}}},fl=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(rr(e))return{data:null,error:e};throw e}}},Zi;Zi=Symbol.toStringTag;var pl=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Zi]="BlobDownloadBuilder",this.promise=null}asStream(){return new fl(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(rr(e))return{data:null,error:e};throw e}}},ml={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Yi={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},_l=class extends Ze{constructor(t,e={},r,n){super(t,e,n,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,n){var s=this;return s.handleOperation(async()=>{let i,o=P(P({},Yi),n),a=P(P({},s.headers),t==="POST"&&{"x-upsert":String(o.upsert)}),l=o.metadata;typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=s.toBase64(s.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),n?.headers&&(a=P(P({},a),n.headers));let c=s._removeEmptyFolders(e),d=s._getFinalPath(c),m=await(t=="PUT"?gn:Ae)(s.fetch,`${s.url}/object/${d}`,i,P({headers:a},o?.duplex?{duplex:o.duplex}:{}));return{path:c,id:m.Id,fullPath:m.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,n){var s=this;let i=s._removeEmptyFolders(t),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),s.handleOperation(async()=>{let l,c=P({upsert:Yi.upsert},n),d=P(P({},s.headers),{"x-upsert":String(c.upsert)});return typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.append("cacheControl",c.cacheControl)):(l=r,d["cache-control"]=`max-age=${c.cacheControl}`,d["content-type"]=c.contentType),{path:i,fullPath:(await gn(s.fetch,a.toString(),l,{headers:d})).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t),s=P({},r.headers);e?.upsert&&(s["x-upsert"]="true");let i=await Ae(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(r.url+i.url),a=o.searchParams.get("token");if(!a)throw new tr("No token returned by API");return{signedUrl:o.toString(),path:t,token:a}})}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;return n.handleOperation(async()=>await Ae(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r?.destinationBucket},{headers:n.headers}))}async copy(t,e,r){var n=this;return n.handleOperation(async()=>({path:(await Ae(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r?.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(t,e,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(t),i=await Ae(n.fetch,`${n.url}/object/sign/${s}`,P({expiresIn:e},r?.transform?{transform:r.transform}:{}),{headers:n.headers}),o=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{signedUrl:encodeURI(`${n.url}${i.signedURL}${o}`)}})}async createSignedUrls(t,e,r){var n=this;return n.handleOperation(async()=>{let s=await Ae(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),i=r?.download?`&download=${r.download===!0?"":r.download}`:"";return s.map(o=>P(P({},o),{},{signedUrl:o.signedURL?encodeURI(`${n.url}${o.signedURL}${i}`):null}))})}download(t,e,r){let n=typeof e?.transform<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString(e?.transform||{}),i=s?`?${s}`:"",o=this._getFinalPath(t),a=()=>yt(this.fetch,`${this.url}/${n}/${o}${i}`,{headers:this.headers,noResolveJson:!0},r);return new pl(a,this.shouldThrowOnError)}async info(t){var e=this;let r=e._getFinalPath(t);return e.handleOperation(async()=>_n(await yt(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;let r=e._getFinalPath(t);try{return await dl(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(rr(n)&&n instanceof Xi){let s=n.originalError;if([400,404].includes(s?.status))return{data:!1,error:n}}throw n}}getPublicUrl(t,e){let r=this._getFinalPath(t),n=[],s=e?.download?`download=${e.download===!0?"":e.download}`:"";s!==""&&n.push(s);let i=typeof e?.transform<"u"?"render/image":"object",o=this.transformOptsToQueryString(e?.transform||{});o!==""&&n.push(o);let a=n.join("&");return a!==""&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}${a}`)}}}async remove(t){var e=this;return e.handleOperation(async()=>await yn(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,r){var n=this;return n.handleOperation(async()=>{let s=P(P(P({},ml),e),{},{prefix:t||""});return await Ae(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{let n=P({},t);return await Ae(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){let e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}},gl="2.97.0",vt={"X-Client-Info":`storage-js/${gl}`},yl=class extends Ze{constructor(t,e={},r,n){let s=new URL(t);n?.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));let i=s.href.replace(/\/$/,""),o=P(P({},vt),e);super(i,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{let r=e.listBucketOptionsToQueryString(t);return await yt(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await yt(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await Ae(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async updateBucket(t,e){var r=this;return r.handleOperation(async()=>await gn(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await Ae(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await yn(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){let e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},vl=class extends Ze{constructor(t,e={},r){let n=t.replace(/\/$/,""),s=P(P({},vt),e);super(n,s,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Ae(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{let r=new URLSearchParams;t?.limit!==void 0&&r.set("limit",t.limit.toString()),t?.offset!==void 0&&r.set("offset",t.offset.toString()),t?.sortColumn&&r.set("sortColumn",t.sortColumn),t?.sortOrder&&r.set("sortOrder",t.sortOrder),t?.search&&r.set("search",t.search);let n=r.toString(),s=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await yt(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await yn(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!il(t))throw new tr("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");let r=new zi({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,i){let o=s[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(s,a),error:null}}catch(l){if(n)throw l;return{data:null,error:l}}}}})}},wl=class extends Ze{constructor(t,e={},r){let n=t.replace(/\/$/,""),s=P(P({},vt),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await me.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await me.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},bl=class extends Ze{constructor(t,e={},r){let n=t.replace(/\/$/,""),s=P(P({},vt),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},El=class extends Ze{constructor(t,e={},r){let n=t.replace(/\/$/,""),s=P(P({},vt),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},Sl=class extends El{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Tl(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},Tl=class extends wl{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new Al(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},Al=class extends bl{constructor(t,e,r,n,s){super(t,e,s),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},eo=class extends yl{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new _l(this.url,this.headers,t,this.fetch)}get vectors(){return new Sl(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new vl(this.url+"/iceberg",this.headers,this.fetch)}};var Io=ze(Xn(),1);k(R,ze(mn(),1));k(R,ze(Xn(),1));var eh="2.97.0",Tt="";typeof Deno<"u"?Tt="deno":typeof document<"u"?Tt="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Tt="react-native":Tt="node";var th={"X-Client-Info":`supabase-js-${Tt}/${eh}`},rh={headers:th},nh={schema:"public"},sh={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},ih={};function At(t){"@babel/helpers - typeof";return At=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},At(t)}function oh(t,e){if(At(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(At(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ah(t){var e=oh(t,"string");return At(e)=="symbol"?e:e+""}function uh(t,e,r){return(e=ah(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Co(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function se(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Co(Object(r),!0).forEach(function(n){uh(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Co(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var lh=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),ch=()=>Headers,hh=(t,e,r)=>{let n=lh(r),s=ch();return async(i,o)=>{var a;let l=(a=await e())!==null&&a!==void 0?a:t,c=new s(o?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),n(i,se(se({},o),{},{headers:c}))}};function dh(t){return t.endsWith("/")?t:t+"/"}function fh(t,e){var r,n;let{db:s,auth:i,realtime:o,global:a}=t,{db:l,auth:c,realtime:d,global:m}=e,_={db:se(se({},l),s),auth:se(se({},c),i),realtime:se(se({},d),o),storage:{},global:se(se(se({},m),a),{},{headers:se(se({},(r=m?.headers)!==null&&r!==void 0?r:{}),(n=a?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?_.accessToken=t.accessToken:delete _.accessToken,_}function ph(t){let e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(dh(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var mh=class extends Io.AuthClient{constructor(t){super(t)}},xo=class{constructor(t,e,r){var n,s;this.supabaseUrl=t,this.supabaseKey=e;let i=ph(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);let o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:nh,realtime:ih,auth:se(se({},sh),{},{storageKey:o}),global:rh},l=fh(r??{},a);if(this.storageKey=(n=l.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(d,m)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(m)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=hh(e,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(se({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new Ii(new URL("rest/v1",i).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new eo(this.storageUrl.href,this.headers,this.fetch,r?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new be.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();let{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c},d,m){let _={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new mh({url:this.authUrl.href,headers:se(se({},_),d),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,flowType:o,lock:a,debug:l,throwOnError:c,fetch:m,hasCustomAuthorizationHeader:Object.keys(this.headers).some(f=>f.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new Po.RealtimeClient(this.realtimeUrl.href,se(se({},t),{},{params:se(se({},{apikey:this.supabaseKey}),t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e?.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}},Qn=(t,e,r)=>new xo(t,e,r);function _h(){if(typeof window<"u")return!1;let t=globalThis.process;if(!t)return!1;let e=t.version;if(e==null)return!1;let r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}_h()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");var Rt=typeof window<"u"&&!!window.__CONFORM_ENGINE__,No=Rt?"http://127.0.0.1:9":import.meta.env.VITE_SUPABASE_URL,jo=Rt?"offline":import.meta.env.VITE_SUPABASE_ANON_KEY;if(!No)throw console.error("Missing VITE_SUPABASE_URL environment variable"),new Error("Missing Supabase URL environment variable");if(!jo)throw console.error("Missing VITE_SUPABASE_ANON_KEY environment variable"),new Error("Missing Supabase anon key environment variable");var Uo=Qn(No,jo,{auth:{autoRefreshToken:!Rt,persistSession:!Rt,detectSessionInUrl:!Rt}});var gh=`${import.meta.env.VITE_SUPABASE_URL}/functions/v1`;async function Lo(t){let{data:{session:e}}=await Uo.auth.getSession(),r=e?.access_token??import.meta.env.VITE_SUPABASE_ANON_KEY,n=JSON.stringify({format:t.format,source_filename:t.sourceFilename,persist:t.persist,session_id:t.sessionId,selected_sequence_names:t.selectedSequenceNames,previously_selected_names:t.previouslySelectedNames}),s=typeof t.extract=="string"?t.extract:JSON.stringify(t.extract),i=n+`
68
- `+s,o=new Set([502,503,504,529,546]),a=null;for(let l=0;;l++){try{a=await fetch(`${gh}/v1-timeline-canonicalize/v1/timeline-canonicalize`,{method:"POST",headers:{"Content-Type":"application/x-ct-canonicalize-v1",Authorization:`Bearer ${r}`},body:i})}catch(c){if(l>=2)throw c;a=null}if(a&&(a.ok||!o.has(a.status)))break;if(l>=2)throw a?.status===546?new Error("Our conversion server stopped this timeline three times in a row. That is a limit on our side, not a problem with your file. Please try again later; if it keeps failing, converting fewer sequences at a time gets it through, and we'd like to hear about it."):new Error(`The processing server timed out (${a?.status??"network error"}) \u2014 a server hiccup, not a problem with your file. Please try again in a minute.`);await new Promise(c=>setTimeout(c,1500*(l+1)))}if(!a.ok){let l=await a.json().catch(()=>({}));throw new Error(l?.error?.message??`canonicalize failed (${a.status})`)}return await a.json()}var yh=[{ext:"mov",name:"QuickTime",container:"mov",codec:"prores",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0},{ext:"mp4",name:"MPEG-4",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0},{ext:"m4v",name:"MPEG-4 Video",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0},{ext:"m4a",name:"MPEG-4 Audio",container:"mov",codec:"aac",frameType:"intra",sparseStrategy:"full-file",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"mxf",name:"MXF",container:"mxf",codec:"varies",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0,notes:"Verified Resolve playback for XAVC-I NDF/DF. Coordinated 45-patch metadata rewrite (index entries + Duration fields). DNxHD foundation works; mid-clip trim works structurally; awaiting more corpus."},{ext:"r3d",name:"RED RAW",container:"r3d",codec:"r3d",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0,notes:"Verified Resolve playback (V-Raptor 6K). Trim/prepare/inspect run client-side as opaque WASM (mediaOp) \u2014 browser sees no algorithm; WS bridge retired. DRAGON era + Komodo + 8K need corpus expansion. Run oracle/i2o/cli/r3d-corpus.ts on new fixtures."},{ext:"braw",name:"Blackmagic RAW",container:"mov",codec:"braw",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0,notes:'Verified Resolve playback. Standard MP4 container with BRAW codec; reuses structure-preserving MOV walker. The "secret sauce" was knowing BRAW = MP4.'},{ext:"crm",name:"Canon Cinema RAW Light",container:"crm",codec:"crm",frameType:"intra",sparseStrategy:"byte-range",support:"planned",needsStructuralBytes:!1,trimSupported:!1,notes:"Frame-indexed single file. Canon SDK available."},{ext:"rmf",name:"Canon RAW (legacy)",container:"crm",codec:"crm",frameType:"intra",sparseStrategy:"byte-range",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"ari",name:"ARRIRAW",container:"frame-seq",codec:"arriraw",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1,notes:"8KB header + raw Bayer per frame. Sparse = select which .ari files to include."},{ext:"arx",name:"ARRIRAW HDE",container:"frame-seq",codec:"arriraw",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"dpx",name:"DPX",container:"frame-seq",codec:"dpx",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1,notes:"SMPTE 268M. Image data offset at byte 4. ~25MB per 4K frame."},{ext:"exr",name:"OpenEXR",container:"frame-seq",codec:"exr",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"tif",name:"TIFF",container:"frame-seq",codec:"tiff",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"tiff",name:"TIFF",container:"frame-seq",codec:"tiff",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"png",name:"PNG",container:"frame-seq",codec:"png",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"jpg",name:"JPEG",container:"frame-seq",codec:"jpeg",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"jpeg",name:"JPEG",container:"frame-seq",codec:"jpeg",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"psd",name:"Photoshop",container:"still",codec:"psd",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"tga",name:"Targa",container:"still",codec:"tga",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"bmp",name:"Bitmap",container:"still",codec:"bmp",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"gif",name:"GIF",container:"still",codec:"gif",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"webp",name:"WebP",container:"still",codec:"webp",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"avif",name:"AVIF",container:"still",codec:"avif",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"wav",name:"WAV",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!0,notes:"RIFF/WAV trim decoder ships. Poly WAV (8-24ch) could benefit from time-axis chunking."},{ext:"bwf",name:"Broadcast WAV",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!0,notes:"WAV + bext chunk (~602+ bytes) with timecode reference. Same trim decoder as WAV."},{ext:"aif",name:"AIFF",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"aiff",name:"AIFF",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"mp3",name:"MP3",container:"audio",codec:"mp3",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"aac",name:"AAC",container:"audio",codec:"aac",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"avi",name:"AVI",container:"avi",codec:"varies",frameType:"intra",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"mkv",name:"Matroska",container:"mkv",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"mts",name:"AVCHD",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"m2ts",name:"AVCHD",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"webm",name:"WebM",container:"mkv",codec:"vp9",frameType:"inter",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1}],$o=new Map;for(let t of yh)$o.set(t.ext,t);function vh(t){let e=t.split(".").pop()?.toLowerCase();return e?$o.get(e)??null:null}function Do(t){return vh(t)!==null}var Lh=ze(Qo());var Uh=typeof __BUILD_SHA__<"u"?__BUILD_SHA__:"dev",br=class extends Error{constructor(e,r){super(r??"A new version of Conform was released while this page was open, so part of the app could no longer be loaded. Reload the page to continue \u2014 nothing has been sent yet."),this.name="StaleBuildError",this.chunk=e,this.buildSha=Uh}};var Zo=typeof __BUILD_SHA__<"u"?__BUILD_SHA__:"dev",Af=900*1e3;async function $h(t=fetch,e=Zo){if(!e||e==="dev"||e==="unknown")return!1;try{let r=await t(`/build-info.json?t=${Date.now()}`,{cache:"no-store"});if(!r.ok)return!1;let n=await r.json();return typeof n.sha=="string"&&n.sha!==""&&n.sha!=="unknown"&&n.sha!==e}catch{return!1}}async function ea(t=fetch,e=Zo){if(await $h(t,e))throw new br("timeline-read","A new version of Conform was released while this page was open. Reload the page and drop the file again \u2014 nothing has been read or sent yet.")}function ta(){return typeof window<"u"&&!!window.__CONFORM_ENGINE__}async function Uf(t){if(Do(t.name))return await Dh(t);let e=await qr(t);if(e.format!=="unknown"&&Br(e.format)){let{names:r}=await zs(t,e.format);return{kind:"timeline",format:e.format,name:t.name,observed_bytes:t.size,total_size:t.size,session:{id:null,inline:{timelines:r.map(n=>({name:n}))}},warnings:[],inspector:{layer:"timeline-core/wasm-inspect",version:"1",duration_ms:0}}}return{kind:"unknown",format:"unknown",name:t.name,observed_bytes:0,total_size:t.size,session:null,warnings:[{code:"container_corruption",message:`Unrecognized file: ${t.name}`}],inspector:{layer:"inspect/unknown",version:"1",duration_ms:0}}}async function Dh(t){let e=Date.now(),r=await Js(t);if(!r)return{kind:"unknown",format:"unknown",name:t.name,observed_bytes:0,total_size:t.size,session:null,warnings:[{code:"container_corruption",message:"No browser-side probe available (proprietary format or unsupported extension)"}],inspector:{layer:"probe-media/local",version:"1",duration_ms:Date.now()-e}};let n=r.container??"media",s={metadata:{id:t.name,user_id:"",source_format:n,source_filename:t.name,source_file_sha256:null,source_file_bytes:t.size,parser_name:`media:${n}`,parser_version:"1",status:"ready",error_message:null,metadata:{},created_at:new Date().toISOString()},timelines:[],media_references:[r]};return{kind:"media",format:n,name:t.name,observed_bytes:0,total_size:t.size,session:{id:null,inline:s},warnings:[],inspector:{layer:"probe-media/local",version:"1",duration_ms:Date.now()-e}}}var ra=new Map,Fh=t=>t.replace(/^[a-z]\d+:/,""),Lf=t=>ra.get(Fh(t));async function $f(t,e={}){if(ta()){let{engine:o}=await import("./engine-HXZCA42S.js"),a=await o.canonicalize(t,e.selectedSequenceNames,e.previouslySelectedNames);for(let l of a.session.timelines??[])ra.set(l.id,a.session_id);return{session:a.session,sessionId:a.session_id,persistError:null}}let{format:r}=await qr(t);if(!Br(r))throw new Error(`No Rust timeline engine for format '${r}' (${t.name})`);await ea();let{fmt:n,extract:s}=await Gs(t,r,e.selectedSequenceNames),i=await Lo({format:n,extract:s,sourceFilename:t.name,persist:e.persist,sessionId:e.sessionId,selectedSequenceNames:e.selectedSequenceNames,previouslySelectedNames:e.previouslySelectedNames});return{session:i.session,sessionId:i.session_id??i.session?.id??null,persistError:i.persist_error??null}}export{$f as canonicalizeTimelineFile,Lf as engineSessionFor,Fh as engineTimelineId,Uf as inspectFile};
68
+ `+s,o=new Set([502,503,504,529,546]),a=null;for(let l=0;;l++){try{a=await fetch(`${gh}/v1-timeline-canonicalize/v1/timeline-canonicalize`,{method:"POST",headers:{"Content-Type":"application/x-ct-canonicalize-v1",Authorization:`Bearer ${r}`},body:i})}catch(c){if(l>=2)throw c;a=null}if(a&&(a.ok||!o.has(a.status)))break;if(l>=2)throw a?.status===546?new Error("Our conversion server stopped this timeline three times in a row. That is a limit on our side, not a problem with your file. Please try again later; if it keeps failing, converting fewer sequences at a time gets it through, and we'd like to hear about it."):new Error(`The processing server timed out (${a?.status??"network error"}) \u2014 a server hiccup, not a problem with your file. Please try again in a minute.`);await new Promise(c=>setTimeout(c,1500*(l+1)))}if(!a.ok){let l=await a.json().catch(()=>({}));throw new Error(l?.error?.message??`canonicalize failed (${a.status})`)}return await a.json()}var yh=[{ext:"mov",name:"QuickTime",container:"mov",codec:"prores",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0},{ext:"mp4",name:"MPEG-4",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0},{ext:"m4v",name:"MPEG-4 Video",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0},{ext:"m4a",name:"MPEG-4 Audio",container:"mov",codec:"aac",frameType:"intra",sparseStrategy:"full-file",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"mxf",name:"MXF",container:"mxf",codec:"varies",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0,notes:"Verified Resolve playback for XAVC-I NDF/DF. Coordinated 45-patch metadata rewrite (index entries + Duration fields). DNxHD foundation works; mid-clip trim works structurally; awaiting more corpus."},{ext:"r3d",name:"RED RAW",container:"r3d",codec:"r3d",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0,notes:"Verified Resolve playback (V-Raptor 6K). Trim/prepare/inspect run client-side as opaque WASM (mediaOp) \u2014 browser sees no algorithm; WS bridge retired. DRAGON era + Komodo + 8K need corpus expansion. Run oracle/i2o/cli/r3d-corpus.ts on new fixtures."},{ext:"braw",name:"Blackmagic RAW",container:"mov",codec:"braw",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0,notes:'Verified Resolve playback. Standard MP4 container with BRAW codec; reuses structure-preserving MOV walker. The "secret sauce" was knowing BRAW = MP4.'},{ext:"crm",name:"Canon Cinema RAW Light",container:"crm",codec:"crm",frameType:"intra",sparseStrategy:"byte-range",support:"planned",needsStructuralBytes:!1,trimSupported:!1,notes:"Frame-indexed single file. Canon SDK available."},{ext:"rmf",name:"Canon RAW (legacy)",container:"crm",codec:"crm",frameType:"intra",sparseStrategy:"byte-range",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"ari",name:"ARRIRAW",container:"frame-seq",codec:"arriraw",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1,notes:"8KB header + raw Bayer per frame. Sparse = select which .ari files to include."},{ext:"arx",name:"ARRIRAW HDE",container:"frame-seq",codec:"arriraw",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"dpx",name:"DPX",container:"frame-seq",codec:"dpx",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1,notes:"SMPTE 268M. Image data offset at byte 4. ~25MB per 4K frame."},{ext:"exr",name:"OpenEXR",container:"frame-seq",codec:"exr",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"tif",name:"TIFF",container:"frame-seq",codec:"tiff",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"tiff",name:"TIFF",container:"frame-seq",codec:"tiff",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"png",name:"PNG",container:"frame-seq",codec:"png",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"jpg",name:"JPEG",container:"frame-seq",codec:"jpeg",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"jpeg",name:"JPEG",container:"frame-seq",codec:"jpeg",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"psd",name:"Photoshop",container:"still",codec:"psd",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"tga",name:"Targa",container:"still",codec:"tga",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"bmp",name:"Bitmap",container:"still",codec:"bmp",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"gif",name:"GIF",container:"still",codec:"gif",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"webp",name:"WebP",container:"still",codec:"webp",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"avif",name:"AVIF",container:"still",codec:"avif",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"wav",name:"WAV",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!0,notes:"RIFF/WAV trim decoder ships. Poly WAV (8-24ch) could benefit from time-axis chunking."},{ext:"bwf",name:"Broadcast WAV",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!0,notes:"WAV + bext chunk (~602+ bytes) with timecode reference. Same trim decoder as WAV."},{ext:"aif",name:"AIFF",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"aiff",name:"AIFF",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"mp3",name:"MP3",container:"audio",codec:"mp3",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"aac",name:"AAC",container:"audio",codec:"aac",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"avi",name:"AVI",container:"avi",codec:"varies",frameType:"intra",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"mkv",name:"Matroska",container:"mkv",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"mts",name:"AVCHD",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"m2ts",name:"AVCHD",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"webm",name:"WebM",container:"mkv",codec:"vp9",frameType:"inter",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1}],$o=new Map;for(let t of yh)$o.set(t.ext,t);function vh(t){let e=t.split(".").pop()?.toLowerCase();return e?$o.get(e)??null:null}function Do(t){return vh(t)!==null}var Lh=ze(Qo());var Uh=typeof __BUILD_SHA__<"u"?__BUILD_SHA__:"dev",br=class extends Error{constructor(e,r){super(r??"A new version of Conform was released while this page was open, so part of the app could no longer be loaded. Reload the page to continue \u2014 nothing has been sent yet."),this.name="StaleBuildError",this.chunk=e,this.buildSha=Uh}};var Zo=typeof __BUILD_SHA__<"u"?__BUILD_SHA__:"dev",Af=900*1e3;async function $h(t=fetch,e=Zo){if(!e||e==="dev"||e==="unknown")return!1;try{let r=await t(`/build-info.json?t=${Date.now()}`,{cache:"no-store"});if(!r.ok)return!1;let n=await r.json();return typeof n.sha=="string"&&n.sha!==""&&n.sha!=="unknown"&&n.sha!==e}catch{return!1}}async function ea(t=fetch,e=Zo){if(await $h(t,e))throw new br("timeline-read","A new version of Conform was released while this page was open. Reload the page and drop the file again \u2014 nothing has been read or sent yet.")}function ta(){return typeof window<"u"&&!!window.__CONFORM_ENGINE__}async function Uf(t){if(Do(t.name))return await Dh(t);let e=await qr(t);if(e.format!=="unknown"&&Br(e.format)){let{names:r}=await zs(t,e.format);return{kind:"timeline",format:e.format,name:t.name,observed_bytes:t.size,total_size:t.size,session:{id:null,inline:{timelines:r.map(n=>({name:n}))}},warnings:[],inspector:{layer:"timeline-core/wasm-inspect",version:"1",duration_ms:0}}}return{kind:"unknown",format:"unknown",name:t.name,observed_bytes:0,total_size:t.size,session:null,warnings:[{code:"container_corruption",message:`Unrecognized file: ${t.name}`}],inspector:{layer:"inspect/unknown",version:"1",duration_ms:0}}}async function Dh(t){let e=Date.now(),r=await Js(t);if(!r)return{kind:"unknown",format:"unknown",name:t.name,observed_bytes:0,total_size:t.size,session:null,warnings:[{code:"container_corruption",message:"No browser-side probe available (proprietary format or unsupported extension)"}],inspector:{layer:"probe-media/local",version:"1",duration_ms:Date.now()-e}};let n=r.container??"media",s={metadata:{id:t.name,user_id:"",source_format:n,source_filename:t.name,source_file_sha256:null,source_file_bytes:t.size,parser_name:`media:${n}`,parser_version:"1",status:"ready",error_message:null,metadata:{},created_at:new Date().toISOString()},timelines:[],media_references:[r]};return{kind:"media",format:n,name:t.name,observed_bytes:0,total_size:t.size,session:{id:null,inline:s},warnings:[],inspector:{layer:"probe-media/local",version:"1",duration_ms:Date.now()-e}}}var ra=new Map,Fh=t=>t.replace(/^[a-z]\d+:/,""),Lf=t=>ra.get(Fh(t));async function $f(t,e={}){if(ta()){let{engine:o}=await import("./engine-6YYXTF2Q.js"),a=await o.canonicalize(t,e.selectedSequenceNames,e.previouslySelectedNames);for(let l of a.session.timelines??[])ra.set(l.id,a.session_id);return{session:a.session,sessionId:a.session_id,persistError:null}}let{format:r}=await qr(t);if(!Br(r))throw new Error(`No Rust timeline engine for format '${r}' (${t.name})`);await ea();let{fmt:n,extract:s}=await Gs(t,r,e.selectedSequenceNames),i=await Lo({format:n,extract:s,sourceFilename:t.name,persist:e.persist,sessionId:e.sessionId,selectedSequenceNames:e.selectedSequenceNames,previouslySelectedNames:e.previouslySelectedNames});return{session:i.session,sessionId:i.session_id??i.session?.id??null,persistError:i.persist_error??null}}export{$f as canonicalizeTimelineFile,Lf as engineSessionFor,Fh as engineTimelineId,Uf as inspectFile};
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 la}from"./chunk-B2KCENY6.js";import{h as na,i as sa,j as ia,l as aa,m as ca,n as tn}from"./chunk-HTRW5GX4.js";import"./chunk-IDJIOKXA.js";import"./chunk-G7CVRPVA.js";import"./chunk-6KEFHHS6.js";import"./chunk-IBIAW6IW.js";import"./chunk-QH5DTYSE.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{A as S,Ac as Dt,B as Li,Bc as Xi,C as K,Cc as Qi,D as Fi,Dc as Yi,E as en,Ec as ea,F as Hi,G as dt,H as Ui,Kc as ta,Lc as ra,Tc as oa,a as qi,b as Go,c as Ni,d as ji,e as Oi,f as Bo,g as Jo,h as Wo,i as Ot,j as At,k as Ai,l as Di,m as Xo,n as f,o as D,p as W,q as Zi,r as G,s as q,t as v,u as se,v as V,w as Qo,x as Yo,y as F,z as pe,zc as Wi}from"./chunk-63WQRYTJ.js";import"./chunk-IN6XVTUS.js";import"./chunk-DLF5AKXT.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-7NGS2BN7.js";import{a as zr,b as Ii,c as Ci,d as Mi}from"./chunk-TBU2XWFD.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-UKXSKFL3.js";import"./chunk-4RA57LTJ.js";import{a as Gi,e as Bi,k as Ji}from"./chunk-FLLB6UZJ.js";import"./chunk-UAURERD3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-XVZ7KJRI.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-VERTA23P.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import{e as Vi,f as Ki}from"./chunk-ROGMKTND.js";import"./chunk-X527E5VI.js";import{c as $,f as Ri}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 ye=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=ye;A.nil=new ye("");function Ca(t,...e){let r=[t[0]],o=0;for(;o<e.length;)En(r,e[o]),r.push(t[++o]);return new ye(r)}A._=Ca;var xn=new ye("+");function Ma(t,...e){let r=[Xt(t[0])],o=0;for(;o<e.length;)r.push(xn),En(r,e[o]),r.push(xn,Xt(t[++o]));return Tf(r),new ye(r)}A.str=Ma;function En(t,e){e instanceof ye?t.push(...e._items):e instanceof Ye?t.push(e):t.push(Cf(e))}A.addCodeArg=En;function Tf(t){let e=1;for(;e<t.length-1;){if(t[e]===xn){let r=Rf(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Rf(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 If(t,e){return e.emptyStr()?t:t.emptyStr()?e:Ma`${t}${e}`}A.strConcat=If;function Cf(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xt(Array.isArray(t)?t.join(","):t)}function Mf(t){return new ye(Xt(t))}A.stringify=Mf;function Xt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Xt;function qf(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new ye(`.${t}`):Ca`[${t}]`}A.getProperty=qf;function Nf(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new ye(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=Nf;function jf(t){return new ye(t.toString())}A.regexpCode=jf});var Pn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Qt(),kn=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 Of=(0,ce._)`\n`,zn=class extends Yr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Of: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 kn(u);c.set(u,Qr.Completed)})}return s}};le.ValueScope=zn});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(),we=Pn(),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=Pn();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}},Tn=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?we.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)}},Rn=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}},In=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Cn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Mn=class extends Ne{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},qn=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)||(Af(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}},Nn=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(qa(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 jn=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)}},On=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?we.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 An=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 Dn=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ import{b as la}from"./chunk-QRZO5GOI.js";import{h as na,i as sa,j as ia,l as aa,m as ca,n as tn}from"./chunk-JM5LHKTU.js";import"./chunk-IDJIOKXA.js";import"./chunk-RJD44NQU.js";import"./chunk-5W57ITT2.js";import"./chunk-MGMDNGNX.js";import"./chunk-QH5DTYSE.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{A as S,Ac as Dt,B as Li,Bc as Xi,C as K,Cc as Qi,D as Fi,Dc as Yi,E as en,Ec as ea,F as Hi,G as dt,H as Ui,Kc as ta,Lc as ra,Tc as oa,a as qi,b as Go,c as Ni,d as ji,e as Oi,f as Bo,g as Jo,h as Wo,i as Ot,j as At,k as Ai,l as Di,m as Xo,n as f,o as D,p as W,q as Zi,r as G,s as q,t as v,u as se,v as V,w as Qo,x as Yo,y as F,z as pe,zc as Wi}from"./chunk-VWFEMXYZ.js";import"./chunk-IN6XVTUS.js";import"./chunk-DLF5AKXT.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-HOACOBAY.js";import{a as zr,b as Ii,c as Ci,d as Mi}from"./chunk-RVZQ3Y6N.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-UKXSKFL3.js";import"./chunk-4RA57LTJ.js";import{a as Gi,e as Bi,k as Ji}from"./chunk-FLLB6UZJ.js";import"./chunk-UAURERD3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-XVZ7KJRI.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-JL454FFL.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import{e as Vi,f as Ki}from"./chunk-ROGMKTND.js";import"./chunk-X527E5VI.js";import{c as $,f as Ri}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 ye=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=ye;A.nil=new ye("");function Ca(t,...e){let r=[t[0]],o=0;for(;o<e.length;)En(r,e[o]),r.push(t[++o]);return new ye(r)}A._=Ca;var xn=new ye("+");function Ma(t,...e){let r=[Xt(t[0])],o=0;for(;o<e.length;)r.push(xn),En(r,e[o]),r.push(xn,Xt(t[++o]));return Tf(r),new ye(r)}A.str=Ma;function En(t,e){e instanceof ye?t.push(...e._items):e instanceof Ye?t.push(e):t.push(Cf(e))}A.addCodeArg=En;function Tf(t){let e=1;for(;e<t.length-1;){if(t[e]===xn){let r=Rf(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Rf(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 If(t,e){return e.emptyStr()?t:t.emptyStr()?e:Ma`${t}${e}`}A.strConcat=If;function Cf(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xt(Array.isArray(t)?t.join(","):t)}function Mf(t){return new ye(Xt(t))}A.stringify=Mf;function Xt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Xt;function qf(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new ye(`.${t}`):Ca`[${t}]`}A.getProperty=qf;function Nf(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new ye(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=Nf;function jf(t){return new ye(t.toString())}A.regexpCode=jf});var Pn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Qt(),kn=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 Of=(0,ce._)`\n`,zn=class extends Yr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Of: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 kn(u);c.set(u,Qr.Completed)})}return s}};le.ValueScope=zn});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(),we=Pn(),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=Pn();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}},Tn=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?we.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)}},Rn=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}},In=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Cn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Mn=class extends Ne{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},qn=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)||(Af(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}},Nn=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(qa(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 jn=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)}},On=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?we.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 An=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 Dn=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
4
4
  `:""},this._extScope=e,this._scope=new we.Scope({parent:e}),this._nodes=[new Nn]}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 Tn(e,s,o)),s}const(e,r,o){return this._def(we.varKinds.const,e,r,o)}let(e,r,o){return this._def(we.varKinds.let,e,r,o)}var(e,r,o){return this._def(we.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new to(e,r,o))}add(e,r){return this._leafNode(new Rn(e,I.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==M.nil&&this._leafNode(new qn(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 jn(e),r)}forRange(e,r,o,n,s=this.opts.es5?we.varKinds.var:we.varKinds.let){let i=this._scope.toName(e);return this._for(new On(s,i,r,o),()=>n(i))}forOf(e,r,o,n=we.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?we.varKinds.var:we.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 In(e))}break(e){return this._leafNode(new Cn(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 An;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 Mn(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=Dn;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 Af(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function qa(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,M._)`!${Zn(t)}`}I.not=qa;var Df=Na(I.operators.AND);function Zf(...t){return t.reduce(Df)}I.and=Zf;var Lf=Na(I.operators.OR);function Ff(...t){return t.reduce(Lf)}I.or=Ff;function Na(t){return(e,r)=>e===M.nil?r:r===M.nil?e:(0,M._)`${Zn(e)} ${t} ${Zn(r)}`}function Zn(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(),Hf=Qt();function Uf(t){let e={};for(let r of t)e[r]=!0;return e}C.toHash=Uf;function Vf(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Aa(t,e),!Da(e,t.self.RULES.all))}C.alwaysValidSchema=Vf;function Aa(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]||Fa(t,`unknown keyword: "${s}"`)}C.checkUnknownRules=Aa;function Da(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}C.schemaHasRules=Da;function Kf(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=Kf;function Gf({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=Gf;function Bf(t){return Za(decodeURIComponent(t))}C.unescapeFragment=Bf;function Jf(t){return encodeURIComponent(Fn(t))}C.escapeFragment=Jf;function Fn(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}C.escapeJsonPointer=Fn;function Za(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}C.unescapeJsonPointer=Za;function Wf(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}C.eachItem=Wf;function ja({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:ja({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} || {}`),Hn(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:La}),items:ja({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 La(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,L._)`{}`);return e!==void 0&&Hn(t,r,e),r}C.evaluatedPropsToName=La;function Hn(t,e,r){Object.keys(r).forEach(o=>t.assign((0,L._)`${e}${(0,L.getProperty)(o)}`,!0))}C.setEvaluated=Hn;var Oa={};function Xf(t,e){return t.scopeValue("func",{ref:e,code:Oa[e.code]||(Oa[e.code]=new Hf._Code(e.code))})}C.useFunc=Xf;var Ln;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Ln||(C.Type=Ln={}));function Qf(t,e,r){if(t instanceof L.Name){let o=e===Ln.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():"/"+Fn(t)}C.getErrorPath=Qf;function Fa(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=Fa});var Oe=$(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});var te=R(),Yf={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")};Un.default=Yf});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 ep(t,e=re.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=Va(t,e,r);o??(i||a)?Ha(s,c):Ua(n,(0,j._)`[${c}]`)}re.reportError=ep;function tp(t,e=re.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=Va(t,e,r);Ha(n,a),s||i||Ua(o,ie.default.vErrors)}re.reportExtraError=tp;function rp(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=rp;function op({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=op;function Ha(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 Ua(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 Va(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,j._)`{}`:np(t,e,r)}function np(t,e,r={}){let{gen:o,it:n}=t,s=[sp(n,r),ip(t,r)];return ap(t,e,s),o.object(...s)}function sp({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 ip({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 ap(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 Ga=$(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.boolOrEmptySchema=wt.topBoolOrEmptySchema=void 0;var cp=nr(),lp=R(),up=Oe(),dp={message:"boolean schema is false"};function fp(t){let{gen:e,schema:r,validateName:o}=t;r===!1?Ka(t,!1):typeof r=="object"&&r.$async===!0?e.return(up.default.data):(e.assign((0,lp._)`${o}.errors`,null),e.return(!0))}wt.topBoolOrEmptySchema=fp;function pp(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),Ka(t)):r.var(e,!0)}wt.boolOrEmptySchema=pp;function Ka(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,cp.reportError)(n,dp,void 0,e)}});var Vn=$(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.getRules=bt.isJSONType=void 0;var mp=["string","number","integer","boolean","null","object","array"],hp=new Set(mp);function gp(t){return typeof t=="string"&&hp.has(t)}bt.isJSONType=gp;function yp(){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=yp});var Kn=$(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.shouldUseRule=Ue.shouldUseGroup=Ue.schemaHasRulesForType=void 0;function _p({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&Ba(t,o)}Ue.schemaHasRulesForType=_p;function Ba(t,e){return e.rules.some(r=>Ja(t,r))}Ue.shouldUseGroup=Ba;function Ja(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=Ja});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 $p=Vn(),vp=Kn(),wp=nr(),T=R(),Wa=N(),St;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(St||(oe.DataType=St={}));function bp(t){let e=Xa(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=bp;function Xa(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every($p.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}oe.getJSONTypes=Xa;function Sp(t,e){let{gen:r,data:o,opts:n}=t,s=xp(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,vp.schemaHasRulesForType)(t,e[0]));if(i){let a=Bn(e,o,n.strictNumbers,St.Wrong);r.if(a,()=>{s.length?Ep(t,e,s):Jn(t)})}return i}oe.coerceAndCheckDataType=Sp;var Qa=new Set(["string","number","integer","boolean","null"]);function xp(t,e){return e?t.filter(r=>Qa.has(r)||e==="array"&&r==="array"):[]}function Ep(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(Bn(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,T._)`${a} !== undefined`);for(let u of r)(Qa.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Jn(t),o.endIf(),o.if((0,T._)`${a} !== undefined`,()=>{o.assign(n,a),kp(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{A as a,B as b,C as c,D as d,E as e,F as f,G as g}from"./chunk-VERTA23P.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import"./chunk-ROGMKTND.js";import"./chunk-X527E5VI.js";import"./chunk-PSANHDZM.js";export{a as createSession,g as getExtra,c as getSession,b as lastSessionId,e as listSessions,f as saveExtra,d as updateSession};
3
+ import{A as a,B as b,C as c,D as d,E as e,F as f,G as g}from"./chunk-JL454FFL.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import"./chunk-ROGMKTND.js";import"./chunk-X527E5VI.js";import"./chunk-PSANHDZM.js";export{a as createSession,g as getExtra,c as getSession,b as lastSessionId,e as listSessions,f as saveExtra,d as updateSession};
@@ -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 l,Qb as a,Rb as b,Sb as c,Tb as d,Ub as e,Vb as f,Wb as g,Xb as h,Yb as i,Zb as j,_b as k,ac as m,bc as n,cc as o,dc as p,ec as q,fc as r,gc as s,hc as t,ic as u}from"./chunk-63WQRYTJ.js";import"./chunk-IN6XVTUS.js";import"./chunk-DLF5AKXT.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-TBU2XWFD.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-UKXSKFL3.js";import"./chunk-4RA57LTJ.js";import"./chunk-FLLB6UZJ.js";import"./chunk-UAURERD3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-VERTA23P.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import"./chunk-ROGMKTND.js";import"./chunk-X527E5VI.js";import"./chunk-PSANHDZM.js";export{k as OPERATION_KINDS,a as READ_FORMATS,l as applyOperation,n as applyOperationWithSources,t as consolidate,i as countFlags,b as detectFormat,d as detectTimelineFormat,u as judge,s as linkText,g as listClips,j as listFlags,h as listMedia,e as readTimeline,o as resolveTarget,r as routesText,c as sniffFormat,f as summarize,m as trackIndex,q as writeDestination,p as writeTimeline};
3
+ import{$b as l,Qb as a,Rb as b,Sb as c,Tb as d,Ub as e,Vb as f,Wb as g,Xb as h,Yb as i,Zb as j,_b as k,ac as m,bc as n,cc as o,dc as p,ec as q,fc as r,gc as s,hc as t,ic as u}from"./chunk-VWFEMXYZ.js";import"./chunk-IN6XVTUS.js";import"./chunk-DLF5AKXT.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RVZQ3Y6N.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-UKXSKFL3.js";import"./chunk-4RA57LTJ.js";import"./chunk-FLLB6UZJ.js";import"./chunk-UAURERD3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-JL454FFL.js";import"./chunk-OWWXUNJF.js";import"./chunk-VETHR2O7.js";import"./chunk-ROGMKTND.js";import"./chunk-X527E5VI.js";import"./chunk-PSANHDZM.js";export{k as OPERATION_KINDS,a as READ_FORMATS,l as applyOperation,n as applyOperationWithSources,t as consolidate,i as countFlags,b as detectFormat,d as detectTimelineFormat,u as judge,s as linkText,g as listClips,j as listFlags,h as listMedia,e as readTimeline,o as resolveTarget,r as routesText,c as sniffFormat,f as summarize,m as trackIndex,q as writeDestination,p as writeTimeline};
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conformtools",
3
- "version": "0.6.15",
3
+ "version": "0.6.16",
4
4
  "description": "conform.tools on your machine: timeline exchange, relink, media trim, delivery and auto conform, as MCP tools for Claude and other AI apps, a CLI and a local HTTP API",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -44,9 +44,9 @@
44
44
  "access": "public"
45
45
  },
46
46
  "optionalDependencies": {
47
- "conformtools-darwin-arm64": "0.6.15",
48
- "conformtools-darwin-x64": "0.6.15",
49
- "conformtools-linux-x64": "0.6.15",
50
- "conformtools-windows-x64": "0.6.15"
47
+ "conformtools-darwin-arm64": "0.6.16",
48
+ "conformtools-darwin-x64": "0.6.16",
49
+ "conformtools-linux-x64": "0.6.16",
50
+ "conformtools-windows-x64": "0.6.16"
51
51
  }
52
52
  }