conformtools 0.6.18 → 0.6.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +3 -2
  2. package/dist/{account-O3J732QJ.js → account-VD3EE5UT.js} +1 -1
  3. package/dist/{agent-hook-setup-HBT2LTVR.js → agent-hook-setup-D2QNHA3V.js} +1 -1
  4. package/dist/{analysis-engine-BZUEBW55.js → analysis-engine-VNGF3DE4.js} +1 -1
  5. package/dist/{bridge-25FGN67G.js → bridge-MLBUD6XW.js} +1 -1
  6. package/dist/browser/timeline_core_bg.wasm +0 -0
  7. package/dist/{chunk-ND2YUUUH.js → chunk-2S2ZPQQD.js} +1 -1
  8. package/dist/{chunk-S5AOIOTT.js → chunk-2WNNDPVR.js} +1 -1
  9. package/dist/chunk-2XQ42O7E.js +7 -0
  10. package/dist/{chunk-34JO3JNC.js → chunk-3WJSWOCS.js} +1 -1
  11. package/dist/{chunk-AYUKWSCR.js → chunk-4UT55WZA.js} +1 -1
  12. package/dist/{chunk-TD3ZHREE.js → chunk-4V3KLFCJ.js} +1 -1
  13. package/dist/chunk-6IL7M3VP.js +162 -0
  14. package/dist/chunk-A7AYMSY7.js +9 -0
  15. package/dist/chunk-COALWMI7.js +4 -0
  16. package/dist/chunk-GBNPOZ32.js +10 -0
  17. package/dist/{chunk-PIM3PV5N.js → chunk-GHP6HDLM.js} +1 -1
  18. package/dist/{chunk-3DYCTUSQ.js → chunk-HCT34NDA.js} +1 -1
  19. package/dist/{chunk-DIW5X4GI.js → chunk-HROU7LLU.js} +1 -1
  20. package/dist/{chunk-ANQZKVDD.js → chunk-IPQLKAF2.js} +1 -1
  21. package/dist/chunk-JVJUJKUP.js +5 -0
  22. package/dist/chunk-M545OKDZ.js +6 -0
  23. package/dist/chunk-MU5AGXSH.js +3 -0
  24. package/dist/chunk-OSPDH2RK.js +6 -0
  25. package/dist/{chunk-MHBNMYZP.js → chunk-V2FVIZT7.js} +1 -1
  26. package/dist/chunk-WYI4LL4P.js +535 -0
  27. package/dist/chunk-Y7PFSVRX.js +3 -0
  28. package/dist/chunk-ZAL7Y5VZ.js +7 -0
  29. package/dist/{claude-setup-W27DLJIO.js → claude-setup-AI4WXN2V.js} +1 -1
  30. package/dist/cli.js +2 -2
  31. package/dist/demo-engine-MOHHYVGV.js +3 -0
  32. package/dist/engine-WMOJ3HRU.js +5 -0
  33. package/dist/framing-U46POZQG.js +3 -0
  34. package/dist/gfx-worker.js +1 -1
  35. package/dist/{h264-YX5KP63E.js → h264-4ETGWMKR.js} +1 -1
  36. package/dist/{h264-mxf-VAHIJCA7.js → h264-mxf-EFHHQL7X.js} +1 -1
  37. package/dist/hook.js +3 -2
  38. package/dist/host-relink-MVHI3YQI.js +10 -0
  39. package/dist/hosted-6BLHLZXM.js +3 -0
  40. package/dist/hosts-7UO4QETB.js +3 -0
  41. package/dist/http.js +4 -3
  42. package/dist/{inspect-7XEE32P5.js → inspect-5TMUYGAL.js} +17 -17
  43. package/dist/{isobmff-RHP3N5K2.js → isobmff-55TPOVCK.js} +1 -1
  44. package/dist/{mc-video-CHBOYPI5.js → mc-video-GKWEWCEQ.js} +1 -1
  45. package/dist/mcp.js +8 -8
  46. package/dist/media-HCKSVARE.js +3 -0
  47. package/dist/{mxf-R2ONKSYU.js → mxf-AJTCMKTX.js} +1 -1
  48. package/dist/{ops-MKDFWWPG.js → ops-UGZODMYE.js} +1 -1
  49. package/dist/{probe-YDOFGCGD.js → probe-YOYK7HR5.js} +1 -1
  50. package/dist/{r3d-F4OWLQE2.js → r3d-XHSJUARW.js} +1 -1
  51. package/dist/resolve-bridge.py +173 -27
  52. package/dist/{sequence-patch-2S7IPE52.js → sequence-patch-5MFTY52Q.js} +1 -1
  53. package/dist/{store-A5AKWOSX.js → store-6XN5Q6UG.js} +1 -1
  54. package/dist/{timeline-ZHDJXDZJ.js → timeline-TFF3L7JP.js} +1 -1
  55. package/dist/timeline_core-6BRZG4LP.js +3 -0
  56. package/package.json +5 -5
  57. package/dist/chunk-2V5PY4P5.js +0 -5
  58. package/dist/chunk-6B3IELRW.js +0 -6
  59. package/dist/chunk-AAJRTGEP.js +0 -10
  60. package/dist/chunk-GTPTZRO6.js +0 -3
  61. package/dist/chunk-IDEKLW7C.js +0 -3
  62. package/dist/chunk-LP2MR4ZH.js +0 -516
  63. package/dist/chunk-NN444GPH.js +0 -6
  64. package/dist/chunk-QBQJDV2F.js +0 -161
  65. package/dist/chunk-ROGMKTND.js +0 -4
  66. package/dist/chunk-RXRBRR3E.js +0 -10
  67. package/dist/chunk-T7S2UBNN.js +0 -7
  68. package/dist/chunk-UIX3TT72.js +0 -7
  69. package/dist/demo-engine-JAQPM4EV.js +0 -3
  70. package/dist/engine-ZGBF3SQN.js +0 -5
  71. package/dist/framing-PGFJZIBU.js +0 -3
  72. package/dist/host-relink-M2VWUZW5.js +0 -10
  73. package/dist/hosted-4CNQYNX5.js +0 -3
  74. package/dist/hosts-R4BHIZJS.js +0 -3
  75. package/dist/media-4VUWQJLQ.js +0 -3
  76. package/dist/timeline_core-ZKQQHUA2.js +0 -3
package/README.md CHANGED
@@ -142,8 +142,9 @@ When a tool fails, or you tell the AI a result was wrong, nothing needs filing:
142
142
  telemetry below records it with the run (the error, with every name replaced, and which system
143
143
  it ran on), so we see every failure, not only the ones someone reported.
144
144
 
145
- When you or the AI want to tell us a lesson or a suggestion (nothing broke), the `report` tool
146
- sends it and gives you a report id. A note contains the words the AI wrote, the conformtools
145
+ When you want to tell us something, ask the AI to send feedback: the `feedback` tool sends your
146
+ words and gives you a feedback id. The AI also files its own notes this way (a lesson, a missing
147
+ tool). Each contains the words written, the conformtools
147
148
  version, whether timelines were read on this machine or on conform.tools, your OS and Node.js
148
149
  version, and the signed-in account. Folder paths are cut to the file name:
149
150
  `/Volumes/CLIENT/secret/A001.mov` is sent as `A001.mov`.
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m,p as n,q as o,r as p}from"./chunk-UIX3TT72.js";import"./chunk-NN444GPH.js";import"./chunk-ROGMKTND.js";import"./chunk-GTPTZRO6.js";import"./chunk-PSANHDZM.js";export{c as NET_TIMEOUT_MS,d as _forgetOffline,f as accessToken,g as accountStatus,a as config,i as includesOf,b as legacyKvStorePath,o as login,p as logout,e as modelKey,m as requireApp,k as requireEntitled,l as requireMcp,n as requireStudioTool,j as setAccountGate,h as statusText};
3
+ import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i,m as j,n as k,o as l,p as m,q as n,r as o,s as p}from"./chunk-2XQ42O7E.js";import"./chunk-M545OKDZ.js";import"./chunk-COALWMI7.js";import"./chunk-MU5AGXSH.js";import"./chunk-PSANHDZM.js";export{c as NET_TIMEOUT_MS,d as _forgetOffline,f as accessToken,g as accountStatus,a as config,i as includesOf,b as legacyKvStorePath,o as login,p as logout,e as modelKey,m as requireApp,k as requireEntitled,l as requireMcp,n as requireStudioTool,j as setAccountGate,h as statusText};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m}from"./chunk-T7S2UBNN.js";import"./chunk-GTPTZRO6.js";import"./chunk-PSANHDZM.js";export{a as CLIENTS,j as WHAT_IT_RECORDS,f as clientsHere,b as hookFiles,i as hookInstalled,l as hooksRemovedText,m as hooksStatusText,k as hooksText,d as installAgentHook,g as installAllAgentHooks,c as installHookScript,e as removeAgentHook,h as removeAllAgentHooks};
3
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m}from"./chunk-ZAL7Y5VZ.js";import"./chunk-MU5AGXSH.js";import"./chunk-PSANHDZM.js";export{a as CLIENTS,j as WHAT_IT_RECORDS,f as clientsHere,b as hookFiles,i as hookInstalled,l as hooksRemovedText,m as hooksStatusText,k as hooksText,d as installAgentHook,g as installAllAgentHooks,c as installHookScript,e as removeAgentHook,h as removeAllAgentHooks};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a,b,c,d}from"./chunk-NN444GPH.js";import"./chunk-ROGMKTND.js";import"./chunk-GTPTZRO6.js";import"./chunk-PSANHDZM.js";export{a as analysisEnginePath,c as analysisOp,d as startAnalysisEngine,b as startAnalysisJob};
3
+ import{a,b,c,d}from"./chunk-M545OKDZ.js";import"./chunk-COALWMI7.js";import"./chunk-MU5AGXSH.js";import"./chunk-PSANHDZM.js";export{a as analysisEnginePath,c as analysisOp,d as startAnalysisEngine,b as startAnalysisJob};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h}from"./chunk-MHBNMYZP.js";import"./chunk-PIM3PV5N.js";import"./chunk-GTPTZRO6.js";import"./chunk-PSANHDZM.js";export{c as BridgeError,g as HostBridge,e as PANEL_PREFIX,b as PORTS,a as PROTOCOL,h as hostBridge,d as pairingPath,f as panelOrigins};
3
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h}from"./chunk-V2FVIZT7.js";import"./chunk-GHP6HDLM.js";import"./chunk-MU5AGXSH.js";import"./chunk-PSANHDZM.js";export{c as BridgeError,g as HostBridge,e as PANEL_PREFIX,b as PORTS,a as PROTOCOL,h as hostBridge,d as pairingPath,f as panelOrigins};
Binary file
@@ -1,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
- var s={scrub:{output:"rgba8",detail:"coarse"},thumbnail:{output:"rgba8",detail:"coarse"},park:{output:"rgba8",detail:"exact"},render:{output:"rgba8",detail:"exact"},transcode:{output:"rgb16",detail:"exact"}};function p(e){let t=new DataView(e.buffer,e.byteOffset,8),r=t.getUint32(0,!0),n=t.getUint32(4,!0),o=e.slice(8);return{width:r,height:n,rgb16:new Uint16Array(o.buffer,o.byteOffset,r*n*3)}}var a=class extends Error{constructor(r,n){super(`COVERAGE_MISS: frame ${r} not in linked media (${n} frames)`);this.index=r;this.frameCount=n;this.name="CoverageMissError"}},m=/(?:[A-Z0-9]+_)?COVERAGE_MISS\s+(\{[\s\S]*\})/;function d(e){let r=(e instanceof Error?e.message:String(e??"")).match(m);if(!r)return null;try{return JSON.parse(r[1])}catch{return{reason:"coverage_miss"}}}var i=class extends Error{constructor(r){super(`DELIVERY_COVERAGE_MISS: ${r.reason}`+(r.cut_in!=null?` cut [${r.cut_in}..${r.cut_out}] file_frames ${r.file_frames}`:""));this.detail=r;this.name="DeliveryCoverageMissError"}};function l(e){return e instanceof i?e.detail:d(e)}var u={mov:()=>import("./isobmff-RHP3N5K2.js").then(e=>e.isobmffFormat),crm:()=>import("./isobmff-RHP3N5K2.js").then(e=>e.isobmffFormat),braw:()=>import("./isobmff-RHP3N5K2.js").then(e=>e.isobmffFormat),wav:()=>import("./wav-OLA3QYFJ.js").then(e=>e.wavFormat),mxf:()=>import("./mxf-R2ONKSYU.js").then(e=>e.mxfFormat),r3d:()=>import("./r3d-F4OWLQE2.js").then(e=>e.r3dFormat),still:()=>import("./still-IDLCMQRD.js").then(e=>e.stillFormat),avc1:()=>import("./h264-YX5KP63E.js").then(e=>e.h264Format),avc3:()=>import("./h264-YX5KP63E.js").then(e=>e.h264Format),h264:()=>import("./h264-YX5KP63E.js").then(e=>e.h264Format),hvc1:()=>import("./h264-YX5KP63E.js").then(e=>e.h264Format),hev1:()=>import("./h264-YX5KP63E.js").then(e=>e.h264Format),hevc:()=>import("./h264-YX5KP63E.js").then(e=>e.h264Format),h264_mxf:()=>import("./h264-mxf-VAHIJCA7.js").then(e=>e.h264MxfFormat),mcvideo:()=>import("./mc-video-CHBOYPI5.js").then(e=>e.mcVideoFormat)};async function c(e){let t=u[e];return t?await t():null}async function f(e){let t=await c(e.format);if(!t)throw new Error(`extract: no handler for format '${e.format}'`);return t.extract(e)}async function b(e,t){let r=await c(e.format);if(!r){if(t.verb==="inspect")return null;throw new Error(`mediaOp: no handler for format '${e.format}' (verb ${t.verb})`)}switch(t.verb){case"inspect":{let n=await r.inspect(e);return n&&(n.source_facts_origin="probed"),n}case"sparsify":return r.sparsify(e,t.selection);case"trim":return r.trim(e,t.selection);case"decode":{let{output:n,detail:o}=s[t.intent];if(n==="rgb16"){if(!r.decode16)throw new Error(`mediaOp: format '${e.format}' has no 16-bit decoder (intent '${t.intent}')`);return r.decode16(e,t.index)}if(!r.decode)throw new Error(`mediaOp: format '${e.format}' has no decoder (no viewer)`);return r.decode(e,t.index,{detail:o})}}}export{s as a,p as b,a as c,d,i as e,l as f,c as g,f as h,b as i};
3
+ var s={scrub:{output:"rgba8",detail:"coarse"},thumbnail:{output:"rgba8",detail:"coarse"},park:{output:"rgba8",detail:"exact"},render:{output:"rgba8",detail:"exact"},transcode:{output:"rgb16",detail:"exact"}};function p(e){let t=new DataView(e.buffer,e.byteOffset,8),r=t.getUint32(0,!0),n=t.getUint32(4,!0),o=e.slice(8);return{width:r,height:n,rgb16:new Uint16Array(o.buffer,o.byteOffset,r*n*3)}}var a=class extends Error{constructor(r,n){super(`COVERAGE_MISS: frame ${r} not in linked media (${n} frames)`);this.index=r;this.frameCount=n;this.name="CoverageMissError"}},m=/(?:[A-Z0-9]+_)?COVERAGE_MISS\s+(\{[\s\S]*\})/;function d(e){let r=(e instanceof Error?e.message:String(e??"")).match(m);if(!r)return null;try{return JSON.parse(r[1])}catch{return{reason:"coverage_miss"}}}var i=class extends Error{constructor(r){super(`DELIVERY_COVERAGE_MISS: ${r.reason}`+(r.cut_in!=null?` cut [${r.cut_in}..${r.cut_out}] file_frames ${r.file_frames}`:""));this.detail=r;this.name="DeliveryCoverageMissError"}};function l(e){return e instanceof i?e.detail:d(e)}var u={mov:()=>import("./isobmff-55TPOVCK.js").then(e=>e.isobmffFormat),crm:()=>import("./isobmff-55TPOVCK.js").then(e=>e.isobmffFormat),braw:()=>import("./isobmff-55TPOVCK.js").then(e=>e.isobmffFormat),wav:()=>import("./wav-OLA3QYFJ.js").then(e=>e.wavFormat),mxf:()=>import("./mxf-AJTCMKTX.js").then(e=>e.mxfFormat),r3d:()=>import("./r3d-XHSJUARW.js").then(e=>e.r3dFormat),still:()=>import("./still-IDLCMQRD.js").then(e=>e.stillFormat),avc1:()=>import("./h264-4ETGWMKR.js").then(e=>e.h264Format),avc3:()=>import("./h264-4ETGWMKR.js").then(e=>e.h264Format),h264:()=>import("./h264-4ETGWMKR.js").then(e=>e.h264Format),hvc1:()=>import("./h264-4ETGWMKR.js").then(e=>e.h264Format),hev1:()=>import("./h264-4ETGWMKR.js").then(e=>e.h264Format),hevc:()=>import("./h264-4ETGWMKR.js").then(e=>e.h264Format),h264_mxf:()=>import("./h264-mxf-EFHHQL7X.js").then(e=>e.h264MxfFormat),mcvideo:()=>import("./mc-video-GKWEWCEQ.js").then(e=>e.mcVideoFormat)};async function c(e){let t=u[e];return t?await t():null}async function f(e){let t=await c(e.format);if(!t)throw new Error(`extract: no handler for format '${e.format}'`);return t.extract(e)}async function b(e,t){let r=await c(e.format);if(!r){if(t.verb==="inspect")return null;throw new Error(`mediaOp: no handler for format '${e.format}' (verb ${t.verb})`)}switch(t.verb){case"inspect":{let n=await r.inspect(e);return n&&(n.source_facts_origin="probed"),n}case"sparsify":return r.sparsify(e,t.selection);case"trim":return r.trim(e,t.selection);case"decode":{let{output:n,detail:o}=s[t.intent];if(n==="rgb16"){if(!r.decode16)throw new Error(`mediaOp: format '${e.format}' has no 16-bit decoder (intent '${t.intent}')`);return r.decode16(e,t.index)}if(!r.decode)throw new Error(`mediaOp: format '${e.format}' has no decoder (no viewer)`);return r.decode(e,t.index,{detail:o})}}}export{s as a,p as b,a as c,d,i as e,l as f,c as g,f as h,b as i};
@@ -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 F}from"./chunk-ROGMKTND.js";import{A as S,B as m,D as v,F as x,G as g,H as D,M as $,ba as a,n as _,t as b,u as p}from"./chunk-GTPTZRO6.js";var R="_originalframes",y="zAPPLIED_PATCHES",u=t=>t.replace(/[\\/][^\\/]+[\\/]?$/,""),k=()=>a(_(),"move-undo");async function P(t){let n=[];for await(let o of $(t))o.isFile&&!o.name.startsWith(".")&&n.push(o.name);return n.sort()}async function T(t){let n=[];for await(let o of $(u(t)))o.isDirectory&&/patch/i.test(o.name)&&o.name!==y&&n.push(o.name);return n.sort()}async function A(t,n){let o=new Set(await P(t)),e=[];for(let r of n){let s=a(u(t),r);if(await p(s))for(let w of await P(s))e.push({file:w,folder:r,replaces:o.has(w)})}return e}async function j(t,n,o){if(!await p(t)||!(await b(t)).isDirectory)throw new F("invalid_args",`not a folder: ${t}`);let e=u(t),r=[],s=[];for(let i of await A(t,n)){if(o&&!o.has(`${i.folder}/${i.file}`))continue;if(!i.replaces){r.push(`${i.file}: not in the sequence`);continue}let f=a(t,i.file),c=a(e,i.folder,i.file),l=`${t}${R}`,h=a(l,i.file);for(let d=1;await p(h);d++)h=a(`${t}${R}${String(d).padStart(2,"0")}`,i.file);await m(u(h));try{await g(f,h)}catch(d){r.push(`${i.file}: ${d.message}`);continue}try{await x(c,f)}catch(d){await g(h,f).catch(()=>{}),r.push(`${i.file}: ${d.message}`);continue}s.push({file:i.file,backup:h,patch_src:c,applied:c,folder:i.folder}),l=""}let w=[];if(s.length){let i=a(e,y);await m(i);for(let f of new Set(s.map(c=>c.folder))){let c=a(i,f);for(let l=1;await p(c);l++)c=a(i,`${f}_${l}`);try{await g(a(e,f),c),w.push({from:a(e,f),to:c});for(let l of s)l.folder===f&&(l.applied=a(c,l.file))}catch(l){r.push(`${f}: not filed under ${y} (${l.message})`)}}}if(!s.length)return{patched:0,errors:r};let E=`files-${Date.now().toString(36)}`;return await m(k()),await S(a(k(),`${E}.json`),JSON.stringify({patch:!0,sequence:t,entries:s.map(({folder:i,...f})=>f),folders:w})),{patched:s.length,errors:r,undo_id:E}}async function L(t){let n=[];for(let e of t.folders)await p(e.to)&&!await p(e.from)&&await g(e.to,e.from).catch(r=>n.push({path:e.to,error:r.message}));let o=0;for(let e of t.entries){let r=a(t.sequence,e.file);if(await p(e.backup))try{await p(r)&&await v(r),await g(e.backup,r),o++}catch(s){n.push({path:r,error:s.message})}}for(let e of new Set([...t.entries.map(r=>u(r.backup)),...t.folders.map(r=>u(r.to))]))if(await p(e)&&!(await P(e)).length){let r=!0;for await(let s of $(e)){r=!1;break}r&&await D(e).catch(()=>{})}return{restored:o,failed:n}}export{R as a,y as b,T as c,A as d,j as e,L as f};
3
+ import{a as F}from"./chunk-COALWMI7.js";import{B as S,C as m,E as v,G as x,H as g,I as D,O as $,da as a,o as _,u as b,v as p}from"./chunk-MU5AGXSH.js";var R="_originalframes",y="zAPPLIED_PATCHES",u=t=>t.replace(/[\\/][^\\/]+[\\/]?$/,""),k=()=>a(_(),"move-undo");async function P(t){let n=[];for await(let o of $(t))o.isFile&&!o.name.startsWith(".")&&n.push(o.name);return n.sort()}async function T(t){let n=[];for await(let o of $(u(t)))o.isDirectory&&/patch/i.test(o.name)&&o.name!==y&&n.push(o.name);return n.sort()}async function A(t,n){let o=new Set(await P(t)),e=[];for(let r of n){let s=a(u(t),r);if(await p(s))for(let w of await P(s))e.push({file:w,folder:r,replaces:o.has(w)})}return e}async function j(t,n,o){if(!await p(t)||!(await b(t)).isDirectory)throw new F("invalid_args",`not a folder: ${t}`);let e=u(t),r=[],s=[];for(let i of await A(t,n)){if(o&&!o.has(`${i.folder}/${i.file}`))continue;if(!i.replaces){r.push(`${i.file}: not in the sequence`);continue}let f=a(t,i.file),c=a(e,i.folder,i.file),l=`${t}${R}`,h=a(l,i.file);for(let d=1;await p(h);d++)h=a(`${t}${R}${String(d).padStart(2,"0")}`,i.file);await m(u(h));try{await g(f,h)}catch(d){r.push(`${i.file}: ${d.message}`);continue}try{await x(c,f)}catch(d){await g(h,f).catch(()=>{}),r.push(`${i.file}: ${d.message}`);continue}s.push({file:i.file,backup:h,patch_src:c,applied:c,folder:i.folder}),l=""}let w=[];if(s.length){let i=a(e,y);await m(i);for(let f of new Set(s.map(c=>c.folder))){let c=a(i,f);for(let l=1;await p(c);l++)c=a(i,`${f}_${l}`);try{await g(a(e,f),c),w.push({from:a(e,f),to:c});for(let l of s)l.folder===f&&(l.applied=a(c,l.file))}catch(l){r.push(`${f}: not filed under ${y} (${l.message})`)}}}if(!s.length)return{patched:0,errors:r};let E=`files-${Date.now().toString(36)}`;return await m(k()),await S(a(k(),`${E}.json`),JSON.stringify({patch:!0,sequence:t,entries:s.map(({folder:i,...f})=>f),folders:w})),{patched:s.length,errors:r,undo_id:E}}async function L(t){let n=[];for(let e of t.folders)await p(e.to)&&!await p(e.from)&&await g(e.to,e.from).catch(r=>n.push({path:e.to,error:r.message}));let o=0;for(let e of t.entries){let r=a(t.sequence,e.file);if(await p(e.backup))try{await p(r)&&await v(r),await g(e.backup,r),o++}catch(s){n.push({path:r,error:s.message})}}for(let e of new Set([...t.entries.map(r=>u(r.backup)),...t.folders.map(r=>u(r.to))]))if(await p(e)&&!(await P(e)).length){let r=!0;for await(let s of $(e)){r=!1;break}r&&await D(e).catch(()=>{})}return{restored:o,failed:n}}export{R as a,y as b,T as c,A as d,j as e,L as f};
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
+ import{a as ee}from"./chunk-M545OKDZ.js";import{a as d}from"./chunk-COALWMI7.js";import{B as I,C as M,D as q,E as S,F as V,O as X,R as Z,V as W,W as Q,b as c,da as s,h as g,i as Y,o as p,p as _,v as H,z as f}from"./chunk-MU5AGXSH.js";var _e=["pro","studio","enterprise"],Be=e=>_e.includes((e??"").toLowerCase()),te=["align","reconform","conform-reference"],he={transferGB:2e3},l={payg:{id:"payg",name:"Pay As You Go",includes:{web:!0,mcp:!1,app:!1,studio_tools:!1}},web:{id:"web",name:"Indie",unlisted:!0,includes:{web:!0,mcp:!1,app:!1,studio_tools:!1},allowance:{transferGB:50}},indie:{id:"indie",name:"Pro",popular:!0,includes:{web:!0,mcp:!0,app:!0,studio_tools:!1},allowance:{transferGB:250}},pro:{id:"pro",name:"Studio",includes:{web:!0,mcp:!0,app:!0,studio_tools:!0},allowance:{transferGB:1e3}},studio:{id:"studio",name:"Enterprise",includes:{web:!0,mcp:!0,app:!0,studio_tools:!0},allowance:he}},ne={web:!0,mcp:!0,app:!0,studio_tools:!0};import{createPrivateKey as Je,createPublicKey as we,sign as Ke,verify as ye}from"node:crypto";import{Buffer as h}from"node:buffer";var be="CONFORMTOOLS_LICENSE_V1",ae=/^[0-9A-F]{8}(-[0-9A-F]{8}){3}$/,re=e=>JSON.stringify({dev_mode:e.dev_mode??!1,email:e.email,expires_at:e.expires_at,features:e.features,issued_at:e.issued_at,machine_fingerprint:e.machine_fingerprint,tier:e.tier});function ie(e){let t=e.split(/\r?\n/).map(a=>a.trim()).filter(a=>a&&!a.startsWith("#")&&!a.startsWith("-----")).join(""),n=JSON.parse(h.from(t,"base64").toString("utf8"));if(n?.magic!==be||!n.payload?.data)throw new Error("not a conform.tools licence");return n.payload}function oe(e,t){let n=h.from(e.signature,"base64"),a=h.from(re(e.data));return n.length!==64?!1:t.some(r=>ye(null,a,we({key:h.concat([h.from("302a300506032b6570032100","hex"),h.from(r)]),format:"der",type:"spki"}),n))}var xe=["cMwVBrEYKMzlG6pC7FF2lNKIoEqGz2xB5yph6clNnTg=","qnheqkkDU09l1oI6h2CFh4uQ97bY/hkTA5niGKH0+X8="],ve=xe.map(e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)));function E(){let e=c("CONFORM_RECORDS_DIR");if(e)return e;let t=_(),n=g()==="darwin"?s(t,"Library/Application Support"):g()==="win32"?c("LOCALAPPDATA")??s(t,"AppData/Local"):c("XDG_DATA_HOME")??s(t,".local/share");return s(n,"conform.tools")}var Se=()=>c("CONFORM_LICENSE_PATH")??s(E(),"license.lic"),N=()=>s(E(),"grant.lic"),ke=null;function $(){return ke??=(async()=>{let e=await ee();if(!e)return[];let t=await Z(e,["machine"],{timeoutMs:15e3}).catch(()=>null);try{return JSON.parse(t?.stdout??"").machines.filter(n=>ae.test(n))}catch{return[]}})()}function Oe(e,t,n=Date.now()){if(!oe(e,ve))return{ok:!1,reason:"invalid licence signature"};let a=Date.parse(e.data.expires_at);return!Number.isFinite(a)||a<n?{ok:!1,reason:`licence expired ${e.data.expires_at}`}:[t??[]].flat().includes(e.data.machine_fingerprint)?{ok:!0,data:e.data}:{ok:!1,reason:"licence is for another machine"}}async function se(){let e;try{e=await f(Se())}catch{return null}try{return Oe(ie(e),await $())}catch(t){return{ok:!1,reason:t.message}}}var Ae={production:{supabaseUrl:"https://sttpwvjbpsetzbhrkohl.supabase.co",anonKey:"sb_publishable_cyuIPsrQa5Ye7lqFxjnknQ_ozDuwwzp",appBase:"https://conform.tools"},staging:{supabaseUrl:"https://slxggvbvgzkiwojcgykx.supabase.co",anonKey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNseGdndmJ2Z3praXdvamNneWt4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzEyODUzMTksImV4cCI6MjA4Njg2MTMxOX0.b18iDsWftny0k9VmOCcbN6kLlyZsZ7GULn_jRH9CE9I",appBase:"https://beta.conform.tools"}};function i(){let e=c("CONFORM_ENV")==="staging"?"staging":"production",t=Ae[e];return{env:e,supabaseUrl:c("CONFORM_SUPABASE_URL")??t.supabaseUrl,anonKey:c("CONFORM_SUPABASE_ANON_KEY")??t.anonKey,appBase:c("CONFORM_APP_BASE")??t.appBase}}var Pe=600*1e3,ce=72*3600*1e3,Le=300*1e3,y=()=>s(p(),i().env==="production"?"auth.json":`auth-${i().env}.json`);async function b(){for(let e of new Set([y(),s(p(),"auth.json")]))try{let t=JSON.parse(await f(e));if(t.env===i().env&&t.access_token)return t}catch{}return await Ee()}var Ie=()=>{let e=g()==="win32"?c("APPDATA")??s(_(),"AppData","Roaming"):g()==="darwin"?s(_(),"Library","Application Support"):c("XDG_CONFIG_HOME")??s(_(),".config");return s(e,"conform-tools","kv-store.json")};async function Ee(){let e=Ie();try{let t=JSON.parse(await f(e)),n=JSON.parse(t["ct-supabase-auth"]??"null");if(!n?.access_token||!n.refresh_token)return null;let a=n.access_token.split(".")[1].replace(/-/g,"+").replace(/_/g,"/");if(JSON.parse(atob(a+"=".repeat(-a.length&3))).iss!==`${i().supabaseUrl}/auth/v1`)return null;let o={env:i().env,access_token:n.access_token,refresh_token:n.refresh_token,expires_at:n.expires_at??0};return await D(o),delete t["ct-supabase-auth"],await I(e,JSON.stringify(t)),o}catch{return null}}async function Ne(){try{for await(let e of X(p())){if(!/^auth(?:-(\w+))?\.json$/.exec(e.name))continue;let n=JSON.parse(await f(s(p(),e.name)));if(n.access_token&&n.env&&n.env!==i().env)return{other_env:n.env}}}catch{}return{}}async function D(e){await M(p()),await I(y(),JSON.stringify(e)),await V(y(),384)}var j=6e3,A=0,B=()=>Date.now()<A,ue=()=>{A=Date.now()+6e4};function nt(){A=0}var pe=e=>e.expires_at-60>Date.now()/1e3;async function R(e){let t=await b();return t&&t.refresh_token!==e.refresh_token&&Object.assign(e,t),pe(e)}async function G(e){if(pe(e))return e.access_token;if(B())return null;if(await R(e))return e.access_token;let t=await q(`${y()}.lock`);try{if(await R(e))return e.access_token;let n=i(),a=await fetch(`${n.supabaseUrl}/auth/v1/token?grant_type=refresh_token`,{method:"POST",headers:{apikey:n.anonKey,"content-type":"application/json"},body:JSON.stringify({refresh_token:e.refresh_token}),signal:AbortSignal.timeout(j)}).catch(o=>{throw ue(),o});if(!a.ok)return a.status!==400&&a.status!==401?null:await R(e)?e.access_token:"";let r=await a.json();return e.access_token=r.access_token,r.refresh_token&&(e.refresh_token=r.refresh_token),e.expires_at=r.expires_at??Math.floor(Date.now()/1e3)+(r.expires_in??3600),await D(e),e.access_token}catch{return null}finally{await t()}}async function at(){return(await b().catch(()=>null))?.last_entitlement?.model_key??null}async function rt(){let e=await b();return e&&await G(e)||null}var w=null;function le(e,t){return{signed_in:!0,entitled:e.entitled,env:i().env,email:e.email,access:e.access,tier:e.tier,trial_days_remaining:e.trial_days_remaining,source:t,...e.entitled?{}:{reason:"not_entitled"},...e.invite_only?{invite_only:!0}:{}}}async function fe(e={}){let t=await se();if(t?.ok)return{signed_in:!!await b().catch(()=>null),entitled:!0,env:i().env,email:t.data.email,access:"licence",tier:t.data.tier,source:"licence"};let n=await $e(e);return t&&!n.entitled?{...n,licence_error:t.reason}:n}async function $e(e){if(!e.force&&w&&Date.now()-w.at<Pe)return{...w.status,source:"cache"};let t=i(),n=await b();if(!n)return{signed_in:!1,entitled:!1,env:t.env,reason:"not_signed_in",...await Ne()};let a=await G(n);if(a==="")return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(a&&!B())try{let r=(await $())[0],o=await fetch(`${t.supabaseUrl}/functions/v1/v1-billing/v1/billing/entitlement${r?`?machine=${r}`:""}`,{headers:{authorization:`Bearer ${a}`,apikey:t.anonKey},signal:AbortSignal.timeout(j)}).catch(u=>{throw ue(),u});if(o.status===401||o.status===403)return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(o.ok){let{grant:u,...P}=(await o.json()).data;r&&await De(u),n.last_entitlement=P,n.last_entitlement_at=Date.now(),await D(n);let L=le(P,"live");return w={at:Date.now(),status:L},L}}catch{}if(n.last_entitlement&&n.last_entitlement_at&&Date.now()-n.last_entitlement_at<ce){let r=ce-(Date.now()-n.last_entitlement_at);return{...le(n.last_entitlement,"grace"),grace_remaining_h:Math.round(r/36e4)/10}}return{signed_in:!0,entitled:!1,env:t.env,reason:"offline_grace_expired"}}async function De(e){try{if(!e)return await S(N());await M(E()),await I(N(),e)}catch{}}function Te(e){return e.source==="licence"?`${e.email} \xB7 machine licence (${e.tier}) \u2014 runs offline, no account check`:Ce(e)+(e.licence_error?`
4
+ (the machine licence was not used: ${e.licence_error})`:"")}function Ce(e){let t=i();if(!e.signed_in)return`not signed in (${t.env})${e.other_env?`; you are signed in to ${e.other_env} only (each server keeps its own sign-in)`:""}. Run the account_login tool, or \`npx -y conformtools@latest login\` in a terminal.`;if(e.reason==="auth_rejected")return"signed-in session was rejected (expired or revoked) \u2014 sign in again with account_login.";if(e.reason==="offline_grace_expired")return"offline for more than 72 h since the last account check \u2014 reconnect and run account_status.";let n=`${e.email??"(unknown email)"} \xB7 ${t.env}`;if(!e.entitled&&e.invite_only)return`${n}
5
+ the conform.tools engine (the MCP and the app) is invite-only for now, and ${e.email??"this account"} is not on the list. If that is the wrong Google account, run account_logout, then account_login with the invited one.`;if(!e.entitled)return`${n}
6
+ no active plan on ${e.email??"this account"}: the MCP is in the ${l.indie.name} plan and up. If that is the wrong Google account, run account_logout, then account_login and pick the account with the plan; otherwise choose a plan at ${t.appBase}/pricing, then run account_status.`;let a=e.access==="trial"?`trial, ${e.trial_days_remaining??"?"} day(s) left`:e.access==="allowlist"?"invited (early access)":`subscribed${e.tier?` (${F(e.tier)})`:""}`,r=T(e),o=r?` \xB7 includes ${[r.web&&"the web tools",r.mcp&&"the MCP",r.app&&"the app"].filter(Boolean).join(", ")||"the web tools"}`:"";return`${n}
7
+ ${a}${o}${e.source==="grace"?` \u2014 offline, using the last check (${e.grace_remaining_h} h of grace left)`:""}`}function F(e){return l[e.toLowerCase()]?.name??e}function T(e){if(e.access==="trial")return ne;let t=(e.tier??"").toLowerCase();return(t==="enterprise"?l.studio:l[t])?.includes??null}var de=()=>fe();function it(e){de=e}async function me(){let e=await de();if(e.entitled)return e;let t=e.signed_in&&e.reason==="not_entitled"?"not_entitled":"not_signed_in";throw new d(t,Te(e),{account:e})}async function ot(){let e=await me();if(e.source==="licence"||T(e)?.mcp!==!1)return e;throw new d("not_entitled",`The conform.tools MCP is in the ${l.indie.name} plan and up. ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${F(e.tier)})`:""}`} includes Timeline Exchange and Conform Connect on ${i().appBase}, but not the engine on this machine. Upgrade at ${i().appBase}/pricing, then run account_status.`,{account:e,needs:"mcp"})}async function Ue(){let e=await me();if(e.source==="licence")return e;if(!T(e)?.app)throw new d("not_entitled",`The conform.tools app is in the ${l.indie.name} plan and up. ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${F(e.tier)})`:""}`} does not include the app. Upgrade at ${i().appBase}/pricing, then reopen the app.`,{account:e,needs:"app"});let t=await Re();if(t)throw new d("seat_in_use",`This seat is in use on ${t}. Each seat runs the app on one computer at a time: quit the app there (or sign out), or wait 15 minutes after it last ran, then reopen it here.`,{account:e,needs:"seat",in_use_by:t});return e}async function st(e){if(!te.includes(e))return;let t=await Ue();if(!(t.source==="licence"||T(t)?.studio_tools!==!1))throw new d("not_entitled",`This tool is in the ${l.pro.name} plan. Upgrade at ${i().appBase}/pricing.`,{account:t,needs:"studio_tools"})}var Me=240*1e3,O=null;async function Re(){if(O&&Date.now()-O.at<Me)return O.busy;let e=await ge("POST").catch(()=>null);return O={at:Date.now(),busy:e},e}async function ge(e){let t=i(),n=await b(),a=(await $())[0],r=n&&await G(n);if(!r||!a||B())return null;let o=await fetch(`${t.supabaseUrl}/functions/v1/v1-billing/v1/billing/seat`,{method:e,headers:{authorization:`Bearer ${r}`,apikey:t.anonKey,"content-type":"application/json"},body:JSON.stringify({machine:a,name:Y()}),signal:AbortSignal.timeout(j)});return o.status===409?(await o.json()).in_use_by??"another computer":null}var k=null;function ct(e={}){if(k)return k;let t=i(),n=crypto.randomUUID().replaceAll("-","");return k=new Promise((a,r)=>{let o=!1,u=x=>{o||(o=!0,clearTimeout(L),setTimeout(()=>P.close(),250),k=null,x())},P=Q({hostname:"127.0.0.1",port:0,onListen:async x=>{let v=`${t.appBase}/plugin-auth?client=engine&port=${x}&state=${n}`,m=await W(v);e.onUrl?.(v,m)}},async x=>{let v=new URL(x.url);if(v.pathname!=="/callback")return new Response("not found",{status:404});let m=v.searchParams,J=m.get("access_token")??"",K=m.get("refresh_token")??"",C=!!J&&!!K&&m.get("state")===n;if(C){let z=Number(m.get("expires_at"));await D({env:t.env,access_token:J,refresh_token:K,expires_at:z>0?z:Math.floor(Date.now()/1e3)+3600}),w=null,A=0,fe({force:!0}).then(U=>u(()=>a(U)),U=>u(()=>r(U)))}return new Response(je(C),{status:C?200:400,headers:{"content-type":"text/html; charset=utf-8"}})}),L=setTimeout(()=>u(()=>r(new d("not_signed_in","sign-in was not completed within 5 minutes"))),e.timeoutMs??Le)}),k}async function lt(){await ge("DELETE").catch(()=>{}),O=null,w=null,A=0,await H(y())&&await S(y()),await S(N()).catch(()=>{});let e=s(p(),"auth.json");try{JSON.parse(await f(e)).env===i().env&&await S(e)}catch{}}function je(e){let[t,n]=e?["Connected","You're signed in \u2014 you can close this tab."]:["Sign-in failed","Please try again."];return`<!doctype html><meta charset=utf-8><title>conform.tools</title><body style='font:16px -apple-system,Helvetica,Arial,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#f5f5f7;color:#1d1d1f'><div style='text-align:center'><div style='font-size:22px;font-weight:700'>conform<span style='color:#ff3c00'>.tools</span></div><div style='margin-top:14px;font-size:20px;font-weight:600'>${t}</div><div style='margin-top:6px;color:#6e6e73'>${n}</div></div></body>`}export{Be as a,l as b,$ as c,i as d,Ie as e,j as f,nt as g,at as h,rt as i,fe as j,Te as k,T as l,it as m,me as n,ot as o,Ue as p,st as q,ct as r,lt as s};
@@ -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{c as Q,h as mt}from"./chunk-UIX3TT72.js";import{a as j}from"./chunk-ROGMKTND.js";import{A as P,B as T,M as pt,ba as y,n as R,y as S}from"./chunk-GTPTZRO6.js";import{createHash as qt}from"node:crypto";import{open as Zt}from"node:fs/promises";var Mt=new Uint16Array(256);for(let e=0;e<256;e++){let t=0,n=e<<8;for(let r=0;r<8;r++)(t^n)&32768?t=t<<1^4129:t=t<<1,n=n<<1;Mt[e]=t&65535}var tt=0,wt=2;var ne=Date.UTC(2020,0,1,0,0,0);function ht(e,t,n,r,o,s,a,i,g,c,u,_,p,w,d,b){let F=z(o,l.__wbindgen_export3,l.__wbindgen_export4),A=x,v=rt(a,l.__wbindgen_export3),W=x,Dt=l.udf_add_file_stream(f(e),f(t),f(n),f(r),F,A,s,v,W,i,g,c,u,_,p,w,d,b);return M(Dt)}function oe(e,t,n,r){let o,s;try{let p=l.__wbindgen_add_to_stack_pointer(-16),w=z(e,l.__wbindgen_export3,l.__wbindgen_export4),d=x,b=z(t,l.__wbindgen_export3,l.__wbindgen_export4),F=x,A=z(n,l.__wbindgen_export3,l.__wbindgen_export4),v=x;l.udf_build_layout(p,w,d,b,F,A,v,r);var a=h().getInt32(p+0,!0),i=h().getInt32(p+4,!0),g=h().getInt32(p+8,!0),c=h().getInt32(p+12,!0),u=a,_=i;if(c)throw u=0,_=0,M(g);return o=u,s=_,C(u,_)}finally{l.__wbindgen_add_to_stack_pointer(16),l.__wbindgen_export5(o,s,1)}}function xt(e,t,n,r,o,s,a){let i=z(o,l.__wbindgen_export3,l.__wbindgen_export4),g=x,c=rt(a,l.__wbindgen_export3),u=x,_=l.udf_fill_sparse_stream(f(e),f(t),f(n),f(r),i,g,s,c,u);return M(_)}function ae(){let e,t;try{let o=l.__wbindgen_add_to_stack_pointer(-16);l.udf_last_panic(o);var n=h().getInt32(o+0,!0),r=h().getInt32(o+4,!0);return e=n,t=r,C(n,r)}finally{l.__wbindgen_add_to_stack_pointer(16),l.__wbindgen_export5(e,t,1)}}function St(e,t){let n=l.udf_parse_stream(f(e),f(t));return M(n)}function se(e){let t,n;try{let s=l.__wbindgen_add_to_stack_pointer(-16),a=rt(e,l.__wbindgen_export3),i=x;l.udf_read_conform_iuvd(s,a,i);var r=h().getInt32(s+0,!0),o=h().getInt32(s+4,!0);return t=r,n=o,C(r,o)}finally{l.__wbindgen_add_to_stack_pointer(16),l.__wbindgen_export5(t,n,1)}}function Lt(){return{__proto__:null,"./udf_bg.js":{__proto__:null,__wbg___wbindgen_is_function_acc5528be2b923f2:function(t){return typeof m(t)=="function"},__wbg___wbindgen_is_undefined_721f8decd50c87a3:function(t){return m(t)===void 0},__wbg___wbindgen_number_get_1cc01dd708740256:function(t,n){let r=m(n),o=typeof r=="number"?r:void 0;h().setFloat64(t+8,O(o)?0:o,!0),h().setInt32(t+0,!O(o),!0)},__wbg___wbindgen_throw_ea4887a5f8f9a9db:function(t,n){throw new Error(C(t,n))},__wbg__wbg_cb_unref_33c39e13d73b25f6:function(t){m(t)._wbg_cb_unref()},__wbg_call_0e855b388e315e17:function(){return et(function(t,n,r,o){let s=m(t).call(m(n),m(r),m(o));return f(s)},arguments)},__wbg_call_5575218572ead796:function(){return et(function(t,n,r){let o=m(t).call(m(n),m(r));return f(o)},arguments)},__wbg_call_8e98ed2f3c86c4b5:function(){return et(function(t,n){let r=m(t).call(m(n));return f(r)},arguments)},__wbg_error_2b5d73c4c4804cfd:function(t,n){console.error(C(t,n))},__wbg_length_589238bdcf171f0e:function(t){return m(t).length},__wbg_new_81880fb5002cb255:function(t){let n=new Uint8Array(m(t));return f(n)},__wbg_new_from_slice_543b875b27789a8f:function(t,n){let r=new Uint8Array(yt(t,n));return f(r)},__wbg_new_no_args_2d7333de60de5ac7:function(t,n){let r=new Function(C(t,n));return f(r)},__wbg_new_typed_00a409eb4ec4f2d9:function(t,n){try{var r={a:t,b:n},o=(a,i)=>{let g=r.a;r.a=0;try{return $t(g,r.b,a,i)}finally{r.a=g}};let s=new Promise(o);return f(s)}finally{r.a=0}},__wbg_prototypesetcall_d721637c7ca66eb8:function(t,n,r){Uint8Array.prototype.set.call(yt(t,n),m(r))},__wbg_queueMicrotask_1c9b3800e321a967:function(t){let n=m(t).queueMicrotask;return f(n)},__wbg_queueMicrotask_311744e534a929a3:function(t){queueMicrotask(m(t))},__wbg_resolve_d82363d90af6928a:function(t){let n=Promise.resolve(m(t));return f(n)},__wbg_static_accessor_GLOBAL_THIS_2fee5048bcca5938:function(){let t=typeof globalThis>"u"?null:globalThis;return O(t)?0:f(t)},__wbg_static_accessor_GLOBAL_ce44e66a4935da8c:function(){let t=typeof global>"u"?null:global;return O(t)?0:f(t)},__wbg_static_accessor_SELF_44f6e0cb5e67cdad:function(){let t=typeof self>"u"?null:self;return O(t)?0:f(t)},__wbg_static_accessor_WINDOW_168f178805d978fe:function(){let t=typeof window>"u"?null:window;return O(t)?0:f(t)},__wbg_then_05edfc8a4fea5106:function(t,n,r){let o=m(t).then(m(n),m(r));return f(o)},__wbg_then_591b6b3a75ee817a:function(t,n){let r=m(t).then(m(n));return f(r)},__wbindgen_cast_0000000000000001:function(t,n){let r=zt(t,n,jt);return f(r)},__wbindgen_cast_0000000000000002:function(t){return f(t)},__wbindgen_cast_0000000000000003:function(t,n){let r=C(t,n);return f(r)},__wbindgen_object_clone_ref:function(t){let n=m(t);return f(n)},__wbindgen_object_drop_ref:function(t){M(t)}}}}function jt(e,t,n){try{let s=l.__wbindgen_add_to_stack_pointer(-16);l.__wasm_bindgen_func_elem_268(s,e,t,f(n));var r=h().getInt32(s+0,!0),o=h().getInt32(s+4,!0);if(o)throw M(r)}finally{l.__wbindgen_add_to_stack_pointer(16)}}function $t(e,t,n,r){l.__wasm_bindgen_func_elem_282(e,t,f(n),f(r))}function f(e){N===E.length&&E.push(E.length+1);let t=N;return N=E[t],E[t]=e,t}var bt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>l.__wbindgen_export2(e.a,e.b));function Nt(e){e<1028||(E[e]=N,N=e)}function yt(e,t){return e=e>>>0,D().subarray(e/1,e/1+t)}var U=null;function h(){return(U===null||U.buffer.detached===!0||U.buffer.detached===void 0&&U.buffer!==l.memory.buffer)&&(U=new DataView(l.memory.buffer)),U}function C(e,t){return Wt(e>>>0,t)}var $=null;function D(){return($===null||$.byteLength===0)&&($=new Uint8Array(l.memory.buffer)),$}function m(e){return E[e]}function et(e,t){try{return e.apply(this,t)}catch(n){l.__wbindgen_export(f(n))}}var E=new Array(1024).fill(void 0);E.push(void 0,null,!0,!1);var N=E.length;function O(e){return e==null}function zt(e,t,n){let r={a:e,b:t,cnt:1},o=(...s)=>{r.cnt++;let a=r.a;r.a=0;try{return n(a,r.b,...s)}finally{r.a=a,o._wbg_cb_unref()}};return o._wbg_cb_unref=()=>{--r.cnt===0&&(l.__wbindgen_export2(r.a,r.b),r.a=0,bt.unregister(r))},bt.register(o,r,r),o}function rt(e,t){let n=t(e.length*1,1)>>>0;return D().set(e,n/1),x=e.length,n}function z(e,t,n){if(n===void 0){let i=B.encode(e),g=t(i.length,1)>>>0;return D().subarray(g,g+i.length).set(i),x=i.length,g}let r=e.length,o=t(r,1)>>>0,s=D(),a=0;for(;a<r;a++){let i=e.charCodeAt(a);if(i>127)break;s[o+a]=i}if(a!==r){a!==0&&(e=e.slice(a)),o=n(o,r,r=a+e.length*3,1)>>>0;let i=D().subarray(o+a,o+r),g=B.encodeInto(e,i);a+=g.written,o=n(o,r,a,1)>>>0}return x=a,o}function M(e){let t=m(e);return Nt(e),t}var H=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});H.decode();var Bt=2146435072,nt=0;function Wt(e,t){return nt+=t,nt>=Bt&&(H=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),H.decode(),nt=t),H.decode(D().subarray(e,e+t))}var B=new TextEncoder;"encodeInto"in B||(B.encodeInto=function(e,t){let n=B.encode(e);return t.set(n),{read:e.length,written:n.length}});var x=0,Ht,Gt,l;function Jt(e,t){return Gt=e,l=e.exports,Ht=t,U=null,$=null,l.__wbindgen_start(),l}async function Vt(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(o){if(e.ok&&n(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}async function G(e){if(l!==void 0)return l;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0&&(e=new URL("udf_bg.wasm",import.meta.url));let t=Lt();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Vt(await e,t);return Jt(n,r)}var ot=null;function Xt(e){return ot||(ot=(async()=>{if(e!==void 0)return G(e);if(typeof process<"u"&&process.versions?.node){let n="node:fs/promises",{readFile:r}=await import(n),o=await r(new URL("./wasm/udf_bg.wasm",import.meta.url));return G({module_or_path:o})}let{default:t}=await import("./udf_bg-HOHEKAVF.js");return G({module_or_path:t})})()),ot}function J(){return Xt()}function V(e){return(t,n)=>e.read(t,n)}function at(e){return(t,n)=>e.write(t,n)}function X(e){return()=>e.getSize()}function st(e){return t=>e.setSize?e.setSize(t):Promise.resolve()}async function It(e){await J();let t=JSON.parse(await St(V(e),X(e)));if(t.error)throw new Error(t.error);let n=null;if(t.iuvdPayload)try{n=JSON.parse(t.iuvdPayload)}catch{}let r=null,o=t.files.find(s=>s.name===".i2o-manifest.json");if(o&&o.extents.length>0&&o.extents[0].type===tt){let s=o.extents[0].position,a=await e.read((t.partitionStartSector+s)*2048,o.totalSize);try{r=JSON.parse(new TextDecoder().decode(a))}catch{}}return{totalSectors:t.totalSectors,partitionStartSector:t.partitionStartSector,partitionLength:t.partitionLength,volumeName:t.volumeName,files:t.files,manifest:r,iuvdPayload:n,rootIcbSector:t.rootIcbSector,rootDataSector:t.rootDataSector,rootDataLength:t.rootDataLength,rootDataSectors:t.rootDataSectors,vdsStartSector:t.vdsStartSector,partitionDescVdsSector:t.partitionDescVdsSector}}function me(e){let t=[],n=0;for(let r of e.extents)r.type===wt&&t.push({offset:n,length:r.length}),n+=r.length;return t}function At(e){let t=[],n=0;for(let r of e.extents)r.type===tt&&t.push({offset:n,length:r.length,imageSector:r.position}),n+=r.length;return t}async function we(e,t,n,r,o){return await J(),await xt(V(e),at(e),X(e),st(e),n,r,o),It(e)}async function be(e,t,n,r,o,s=0){await J();let a=new Date,i=!!(o&&o.length>0);return await ht(V(e),at(e),X(e),st(e),n,r,i?o:new Uint8Array(0),i,s,a.getFullYear(),a.getMonth()+1,a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),-a.getTimezoneOffset()),It(e)}var Y=1<<20,k=5*Y,Et=5*1024*Y,it=1e4,ct=8*Y,Kt=2048;function Ae(e,t,n=Math.max(16*Y,Math.ceil(e/(it-500)))){let r=[...t].filter(c=>c.len>0).sort((c,u)=>c.at-u.at),o=[];for(let c of r){let u=o[o.length-1];u&&c.at<u.at+u.len||(u&&u.at+u.len===c.at&&u.key===c.key&&u.offset+u.len===c.offset?u.len+=c.len:o.push({...c}))}let s=[],a=0;for(let c of o.filter(u=>u.len>=k))c.at>a&&s.push({at:a,len:c.at-a}),s.push({at:c.at,len:c.len,copy:c}),a=c.at+c.len;a<e&&s.push({at:a,len:e-a});let i=c=>c.reduce((u,_)=>{let p=u[u.length-1];return p&&!p.copy&&!_.copy?p.len+=_.len:u.push({..._}),u},[]);for(let c=!0;c;){c=!1,s=i(s);for(let u=0;u<s.length-1;u++){let _=s[u];if(_.len>=k)continue;let p=k-_.len,w=s[u+1],d=s[u-1];if(_.copy){delete _.copy,c=!0;break}w?.copy&&w.len-p>=k?(_.len+=p,w.at+=p,w.len-=p,w.copy={...w.copy,at:w.at,len:w.len,offset:w.copy.offset+p}):d?.copy&&d.len-p>=k?(d.len-=p,d.copy={...d.copy,len:d.len},_.at-=p,_.len+=p):w?.copy?delete w.copy:d?.copy&&delete d.copy,c=!0;break}}let g=[];for(let c of s){let u=c.copy?Math.min(Et,Math.max(n,k)):n;for(let _=c.at,p=c.at+c.len;_<p;){let w=Math.min(u,p-_);p-(_+w)>0&&p-(_+w)<k&&(w=p-_<=Et?p-_:w-k),g.push(c.copy?{kind:"copy",at:_,len:w,key:c.copy.key,offset:c.copy.offset+(_-c.at)}:{kind:"upload",at:_,len:w}),_+=w}}if(g.length>it)throw new Error(`the image needs ${g.length} pieces (S3 allows ${it})`);return g}function Ee(e,t,n,r){let o=[...r].sort((i,g)=>i.offset-g.offset),s=[],a=0;for(let i of o){let g=Math.min(i.offset,t);g>a&&s.push({at:a,len:g-a,key:e,offset:a}),a=Math.max(a,i.offset+i.length)}return a<Math.min(t,n)&&s.push({at:a,len:Math.min(t,n)-a,key:e,offset:a}),s}async function ve(e,t,n,r,o){let s=[];for(let a of t.files)for(let i of At(a)){let g=(t.partitionStartSector+i.imageSector)*Kt;for(let c=i.offset;c<i.offset+i.length;){let u=Math.min(i.offset+i.length,(Math.floor(c/ct)+1)*ct),_=g+(c-i.offset);s.push(o?.(_,u-c)??[qt("sha256").update(await e.read(_,u-c)).digest("hex"),_,u-c]),r?.(u-c),c=u}}return{v:1,block:ct,size:n,blocks:s}}function Pe(e,t){let n=new Map;for(let o of t)for(let[s,a,i]of o.index.blocks)n.set(`${s}:${i}`,{key:o.key,offset:a});let r=[];for(let[o,s,a]of e.blocks){let i=n.get(`${o}:${a}`);i&&r.push({at:s,len:a,key:i.key,offset:i.offset})}return r}var vt=(e,t)=>`${Q().supabaseUrl}/functions/v1/${e}${t}`;async function lt(e,t,n={}){let r=await mt();if(!r)throw new Error("not signed in to conform.tools \u2014 run account_login");let o=await fetch(vt(e,t),{method:n.method??(n.body?"POST":"GET"),headers:{authorization:`Bearer ${r}`,apikey:Q().anonKey,...n.body?{"content-type":"application/json"}:{}},...n.body?{body:JSON.stringify(n.body)}:{},signal:AbortSignal.timeout(2e4)}),s=await o.text();if(!o.ok){let a=s;try{let i=JSON.parse(s);a=i.error?.message??i.message??i.error??s}catch{}throw o.status===404&&/Requested function was not found/i.test(String(a))?new Error(`${e} isn't deployed on ${new URL(vt(e,t)).host}: this server doesn't have that feature yet (an older server, or a staging/production mismatch)`):new Error(`${n.method??"GET"} ${t}: ${o.status} ${a}`)}return s?JSON.parse(s):{}}function Te(e,t="org"){let n=`/v1/sessions/${e}/storage/multipart`,r=(o,s,a)=>lt("v1-sessions",o,{body:s,method:a});return{start:async o=>String((await r(`${n}/start`,{key:o,content_type:"application/x-iso9660-image"})).upload_id),partUrls:async(o,s,a,i)=>(await r(`${n}/${s}/part-urls`,{key:o,first_part:a,count:i})).parts,copyPart:async(o,s,a,i)=>String((await r(`${n}/${s}/copy-part`,{key:o,part_number:a,source_ref:{scheme:t,bucket:"i2o",key:i.key},byte_range:{offset:i.offset,length:i.length}})).etag),complete:async(o,s,a)=>{await r(`${n}/${s}/complete`,{key:o,parts:a})},abort:async(o,s)=>{await r(`${n}/${encodeURIComponent(s)}?key=${encodeURIComponent(o)}`,void 0,"DELETE")},readUrl:async o=>String((await r(`/v1/sessions/${e}/download-url`,{storage_path:o})).download_url)}}async function ut(e,t,n=4){for(let r=1;;r++)try{return await t()}catch(o){if(r>=n)throw new Error(`${e} failed after ${n} tries: ${o instanceof Error?o.message:o}`);await new Promise(s=>setTimeout(s,500*2**r))}}async function ke(e,t,n,r,o={}){let s=o.fetchFn??fetch,a=await e.start(t),i=n.reduce((d,b)=>d+b.len,0),g=new Array(n.length),c=0,u=0,_=new Map,p=async d=>(_.has(d)||(await e.partUrls(t,a,d+1,Math.min(100,n.length-d))).forEach((F,A)=>_.set(d+A,F)),_.get(d)),w=async d=>{let b=n[d];if(b.kind==="copy")g[d]=await ut(`copy piece ${d+1}`,()=>e.copyPart(t,a,d+1,{key:b.key,offset:b.offset,length:b.len}));else{let F=await r(b.at,b.len);g[d]=await ut(`upload piece ${d+1}`,async()=>{let A=await p(d),v=await s(A.upload_url,{method:A.method,headers:A.headers,body:F,signal:o.signal});if(!v.ok)throw _.delete(d),new Error(`${v.status} ${(await v.text()).slice(0,200)}`);let W=v.headers.get("etag");if(!W)throw new Error("the bucket returned no ETag (expose it in the bucket's CORS / response headers)");return W})}c+=b.len,o.onProgress?.(c,i)};try{await Promise.all(Array.from({length:Math.min(6,n.length)},async()=>{for(;u<n.length;)o.signal?.throwIfAborted(),await w(u++)})),await ut("complete",()=>e.complete(t,a,g.map((d,b)=>({part_number:b+1,etag:d}))))}catch(d){throw await e.abort(t,a).catch(()=>{}),d}return{uploaded:n.filter(d=>d.kind==="upload").reduce((d,b)=>d+b.len,0),copied:n.filter(d=>d.kind==="copy").reduce((d,b)=>d+b.len,0),pieces:n.length}}function Fe(e){let t=Zt(e,"r");return{read:async(n,r)=>{let o=new Uint8Array(r);return await(await t).read(o,0,r,n),o},close:async()=>{await(await t).close()}}}var gt="local",Tt=/^[A-Za-z0-9_-]{1,64}$/,I=e=>{if(!Tt.test(e))throw new j("invalid_args",`bad project_id '${e}'`);return y(R(),"projects",e)},dt=(e,t={})=>lt("v1-projects",e,t),kt=e=>Number(/: (\d{3}) /.exec(String(e?.message))?.[1]??0);async function Ft(e){let t="",n={base:null,by:null};try{t=await S(y(I(e),"CONTEXT.md"))}catch{}try{n=JSON.parse(await S(y(I(e),"context.json")))}catch{}return{text:t,meta:n}}async function _t(e,t,n){await T(I(e)),await P(y(I(e),"CONTEXT.md"),t),await P(y(I(e),"context.json"),JSON.stringify(n))}var ft=async(e,t)=>(await _t(e,t.context,{base:t.context_updated_at,by:t.context_updated_by_name??null}),{text:t.context,updated_at:t.context_updated_at,updated_by:t.context_updated_by_name??null});async function Me(e){I(e);let t=await Ft(e);if(e===gt)return{text:t.text,updated_at:null,updated_by:null};if(t.meta.pending)try{return await Pt(e,t.text,t.meta.base)}catch(n){if(!(n instanceof j&&n.code==="context_conflict"))return{text:t.text,updated_at:t.meta.base,updated_by:t.meta.by,offline:!0,pending:!0};let r=n.data?.current??{context:"",context_updated_at:null},o=`${r.context.trimEnd()}
3
+ import{d as Q,i as mt}from"./chunk-2XQ42O7E.js";import{a as j}from"./chunk-COALWMI7.js";import{B as P,C as T,O as pt,da as y,o as R,z as S}from"./chunk-MU5AGXSH.js";import{createHash as qt}from"node:crypto";import{open as Zt}from"node:fs/promises";var Mt=new Uint16Array(256);for(let e=0;e<256;e++){let t=0,n=e<<8;for(let r=0;r<8;r++)(t^n)&32768?t=t<<1^4129:t=t<<1,n=n<<1;Mt[e]=t&65535}var tt=0,wt=2;var ne=Date.UTC(2020,0,1,0,0,0);function ht(e,t,n,r,o,s,a,i,g,c,u,_,p,w,d,b){let F=z(o,l.__wbindgen_export3,l.__wbindgen_export4),A=x,v=rt(a,l.__wbindgen_export3),W=x,Dt=l.udf_add_file_stream(f(e),f(t),f(n),f(r),F,A,s,v,W,i,g,c,u,_,p,w,d,b);return M(Dt)}function oe(e,t,n,r){let o,s;try{let p=l.__wbindgen_add_to_stack_pointer(-16),w=z(e,l.__wbindgen_export3,l.__wbindgen_export4),d=x,b=z(t,l.__wbindgen_export3,l.__wbindgen_export4),F=x,A=z(n,l.__wbindgen_export3,l.__wbindgen_export4),v=x;l.udf_build_layout(p,w,d,b,F,A,v,r);var a=h().getInt32(p+0,!0),i=h().getInt32(p+4,!0),g=h().getInt32(p+8,!0),c=h().getInt32(p+12,!0),u=a,_=i;if(c)throw u=0,_=0,M(g);return o=u,s=_,C(u,_)}finally{l.__wbindgen_add_to_stack_pointer(16),l.__wbindgen_export5(o,s,1)}}function xt(e,t,n,r,o,s,a){let i=z(o,l.__wbindgen_export3,l.__wbindgen_export4),g=x,c=rt(a,l.__wbindgen_export3),u=x,_=l.udf_fill_sparse_stream(f(e),f(t),f(n),f(r),i,g,s,c,u);return M(_)}function ae(){let e,t;try{let o=l.__wbindgen_add_to_stack_pointer(-16);l.udf_last_panic(o);var n=h().getInt32(o+0,!0),r=h().getInt32(o+4,!0);return e=n,t=r,C(n,r)}finally{l.__wbindgen_add_to_stack_pointer(16),l.__wbindgen_export5(e,t,1)}}function St(e,t){let n=l.udf_parse_stream(f(e),f(t));return M(n)}function se(e){let t,n;try{let s=l.__wbindgen_add_to_stack_pointer(-16),a=rt(e,l.__wbindgen_export3),i=x;l.udf_read_conform_iuvd(s,a,i);var r=h().getInt32(s+0,!0),o=h().getInt32(s+4,!0);return t=r,n=o,C(r,o)}finally{l.__wbindgen_add_to_stack_pointer(16),l.__wbindgen_export5(t,n,1)}}function Lt(){return{__proto__:null,"./udf_bg.js":{__proto__:null,__wbg___wbindgen_is_function_acc5528be2b923f2:function(t){return typeof m(t)=="function"},__wbg___wbindgen_is_undefined_721f8decd50c87a3:function(t){return m(t)===void 0},__wbg___wbindgen_number_get_1cc01dd708740256:function(t,n){let r=m(n),o=typeof r=="number"?r:void 0;h().setFloat64(t+8,O(o)?0:o,!0),h().setInt32(t+0,!O(o),!0)},__wbg___wbindgen_throw_ea4887a5f8f9a9db:function(t,n){throw new Error(C(t,n))},__wbg__wbg_cb_unref_33c39e13d73b25f6:function(t){m(t)._wbg_cb_unref()},__wbg_call_0e855b388e315e17:function(){return et(function(t,n,r,o){let s=m(t).call(m(n),m(r),m(o));return f(s)},arguments)},__wbg_call_5575218572ead796:function(){return et(function(t,n,r){let o=m(t).call(m(n),m(r));return f(o)},arguments)},__wbg_call_8e98ed2f3c86c4b5:function(){return et(function(t,n){let r=m(t).call(m(n));return f(r)},arguments)},__wbg_error_2b5d73c4c4804cfd:function(t,n){console.error(C(t,n))},__wbg_length_589238bdcf171f0e:function(t){return m(t).length},__wbg_new_81880fb5002cb255:function(t){let n=new Uint8Array(m(t));return f(n)},__wbg_new_from_slice_543b875b27789a8f:function(t,n){let r=new Uint8Array(yt(t,n));return f(r)},__wbg_new_no_args_2d7333de60de5ac7:function(t,n){let r=new Function(C(t,n));return f(r)},__wbg_new_typed_00a409eb4ec4f2d9:function(t,n){try{var r={a:t,b:n},o=(a,i)=>{let g=r.a;r.a=0;try{return $t(g,r.b,a,i)}finally{r.a=g}};let s=new Promise(o);return f(s)}finally{r.a=0}},__wbg_prototypesetcall_d721637c7ca66eb8:function(t,n,r){Uint8Array.prototype.set.call(yt(t,n),m(r))},__wbg_queueMicrotask_1c9b3800e321a967:function(t){let n=m(t).queueMicrotask;return f(n)},__wbg_queueMicrotask_311744e534a929a3:function(t){queueMicrotask(m(t))},__wbg_resolve_d82363d90af6928a:function(t){let n=Promise.resolve(m(t));return f(n)},__wbg_static_accessor_GLOBAL_THIS_2fee5048bcca5938:function(){let t=typeof globalThis>"u"?null:globalThis;return O(t)?0:f(t)},__wbg_static_accessor_GLOBAL_ce44e66a4935da8c:function(){let t=typeof global>"u"?null:global;return O(t)?0:f(t)},__wbg_static_accessor_SELF_44f6e0cb5e67cdad:function(){let t=typeof self>"u"?null:self;return O(t)?0:f(t)},__wbg_static_accessor_WINDOW_168f178805d978fe:function(){let t=typeof window>"u"?null:window;return O(t)?0:f(t)},__wbg_then_05edfc8a4fea5106:function(t,n,r){let o=m(t).then(m(n),m(r));return f(o)},__wbg_then_591b6b3a75ee817a:function(t,n){let r=m(t).then(m(n));return f(r)},__wbindgen_cast_0000000000000001:function(t,n){let r=zt(t,n,jt);return f(r)},__wbindgen_cast_0000000000000002:function(t){return f(t)},__wbindgen_cast_0000000000000003:function(t,n){let r=C(t,n);return f(r)},__wbindgen_object_clone_ref:function(t){let n=m(t);return f(n)},__wbindgen_object_drop_ref:function(t){M(t)}}}}function jt(e,t,n){try{let s=l.__wbindgen_add_to_stack_pointer(-16);l.__wasm_bindgen_func_elem_268(s,e,t,f(n));var r=h().getInt32(s+0,!0),o=h().getInt32(s+4,!0);if(o)throw M(r)}finally{l.__wbindgen_add_to_stack_pointer(16)}}function $t(e,t,n,r){l.__wasm_bindgen_func_elem_282(e,t,f(n),f(r))}function f(e){N===E.length&&E.push(E.length+1);let t=N;return N=E[t],E[t]=e,t}var bt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>l.__wbindgen_export2(e.a,e.b));function Nt(e){e<1028||(E[e]=N,N=e)}function yt(e,t){return e=e>>>0,D().subarray(e/1,e/1+t)}var U=null;function h(){return(U===null||U.buffer.detached===!0||U.buffer.detached===void 0&&U.buffer!==l.memory.buffer)&&(U=new DataView(l.memory.buffer)),U}function C(e,t){return Wt(e>>>0,t)}var $=null;function D(){return($===null||$.byteLength===0)&&($=new Uint8Array(l.memory.buffer)),$}function m(e){return E[e]}function et(e,t){try{return e.apply(this,t)}catch(n){l.__wbindgen_export(f(n))}}var E=new Array(1024).fill(void 0);E.push(void 0,null,!0,!1);var N=E.length;function O(e){return e==null}function zt(e,t,n){let r={a:e,b:t,cnt:1},o=(...s)=>{r.cnt++;let a=r.a;r.a=0;try{return n(a,r.b,...s)}finally{r.a=a,o._wbg_cb_unref()}};return o._wbg_cb_unref=()=>{--r.cnt===0&&(l.__wbindgen_export2(r.a,r.b),r.a=0,bt.unregister(r))},bt.register(o,r,r),o}function rt(e,t){let n=t(e.length*1,1)>>>0;return D().set(e,n/1),x=e.length,n}function z(e,t,n){if(n===void 0){let i=B.encode(e),g=t(i.length,1)>>>0;return D().subarray(g,g+i.length).set(i),x=i.length,g}let r=e.length,o=t(r,1)>>>0,s=D(),a=0;for(;a<r;a++){let i=e.charCodeAt(a);if(i>127)break;s[o+a]=i}if(a!==r){a!==0&&(e=e.slice(a)),o=n(o,r,r=a+e.length*3,1)>>>0;let i=D().subarray(o+a,o+r),g=B.encodeInto(e,i);a+=g.written,o=n(o,r,a,1)>>>0}return x=a,o}function M(e){let t=m(e);return Nt(e),t}var H=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});H.decode();var Bt=2146435072,nt=0;function Wt(e,t){return nt+=t,nt>=Bt&&(H=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),H.decode(),nt=t),H.decode(D().subarray(e,e+t))}var B=new TextEncoder;"encodeInto"in B||(B.encodeInto=function(e,t){let n=B.encode(e);return t.set(n),{read:e.length,written:n.length}});var x=0,Ht,Gt,l;function Jt(e,t){return Gt=e,l=e.exports,Ht=t,U=null,$=null,l.__wbindgen_start(),l}async function Vt(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(o){if(e.ok&&n(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}async function G(e){if(l!==void 0)return l;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0&&(e=new URL("udf_bg.wasm",import.meta.url));let t=Lt();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Vt(await e,t);return Jt(n,r)}var ot=null;function Xt(e){return ot||(ot=(async()=>{if(e!==void 0)return G(e);if(typeof process<"u"&&process.versions?.node){let n="node:fs/promises",{readFile:r}=await import(n),o=await r(new URL("./wasm/udf_bg.wasm",import.meta.url));return G({module_or_path:o})}let{default:t}=await import("./udf_bg-HOHEKAVF.js");return G({module_or_path:t})})()),ot}function J(){return Xt()}function V(e){return(t,n)=>e.read(t,n)}function at(e){return(t,n)=>e.write(t,n)}function X(e){return()=>e.getSize()}function st(e){return t=>e.setSize?e.setSize(t):Promise.resolve()}async function It(e){await J();let t=JSON.parse(await St(V(e),X(e)));if(t.error)throw new Error(t.error);let n=null;if(t.iuvdPayload)try{n=JSON.parse(t.iuvdPayload)}catch{}let r=null,o=t.files.find(s=>s.name===".i2o-manifest.json");if(o&&o.extents.length>0&&o.extents[0].type===tt){let s=o.extents[0].position,a=await e.read((t.partitionStartSector+s)*2048,o.totalSize);try{r=JSON.parse(new TextDecoder().decode(a))}catch{}}return{totalSectors:t.totalSectors,partitionStartSector:t.partitionStartSector,partitionLength:t.partitionLength,volumeName:t.volumeName,files:t.files,manifest:r,iuvdPayload:n,rootIcbSector:t.rootIcbSector,rootDataSector:t.rootDataSector,rootDataLength:t.rootDataLength,rootDataSectors:t.rootDataSectors,vdsStartSector:t.vdsStartSector,partitionDescVdsSector:t.partitionDescVdsSector}}function me(e){let t=[],n=0;for(let r of e.extents)r.type===wt&&t.push({offset:n,length:r.length}),n+=r.length;return t}function At(e){let t=[],n=0;for(let r of e.extents)r.type===tt&&t.push({offset:n,length:r.length,imageSector:r.position}),n+=r.length;return t}async function we(e,t,n,r,o){return await J(),await xt(V(e),at(e),X(e),st(e),n,r,o),It(e)}async function be(e,t,n,r,o,s=0){await J();let a=new Date,i=!!(o&&o.length>0);return await ht(V(e),at(e),X(e),st(e),n,r,i?o:new Uint8Array(0),i,s,a.getFullYear(),a.getMonth()+1,a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),-a.getTimezoneOffset()),It(e)}var Y=1<<20,k=5*Y,Et=5*1024*Y,it=1e4,ct=8*Y,Kt=2048;function Ae(e,t,n=Math.max(16*Y,Math.ceil(e/(it-500)))){let r=[...t].filter(c=>c.len>0).sort((c,u)=>c.at-u.at),o=[];for(let c of r){let u=o[o.length-1];u&&c.at<u.at+u.len||(u&&u.at+u.len===c.at&&u.key===c.key&&u.offset+u.len===c.offset?u.len+=c.len:o.push({...c}))}let s=[],a=0;for(let c of o.filter(u=>u.len>=k))c.at>a&&s.push({at:a,len:c.at-a}),s.push({at:c.at,len:c.len,copy:c}),a=c.at+c.len;a<e&&s.push({at:a,len:e-a});let i=c=>c.reduce((u,_)=>{let p=u[u.length-1];return p&&!p.copy&&!_.copy?p.len+=_.len:u.push({..._}),u},[]);for(let c=!0;c;){c=!1,s=i(s);for(let u=0;u<s.length-1;u++){let _=s[u];if(_.len>=k)continue;let p=k-_.len,w=s[u+1],d=s[u-1];if(_.copy){delete _.copy,c=!0;break}w?.copy&&w.len-p>=k?(_.len+=p,w.at+=p,w.len-=p,w.copy={...w.copy,at:w.at,len:w.len,offset:w.copy.offset+p}):d?.copy&&d.len-p>=k?(d.len-=p,d.copy={...d.copy,len:d.len},_.at-=p,_.len+=p):w?.copy?delete w.copy:d?.copy&&delete d.copy,c=!0;break}}let g=[];for(let c of s){let u=c.copy?Math.min(Et,Math.max(n,k)):n;for(let _=c.at,p=c.at+c.len;_<p;){let w=Math.min(u,p-_);p-(_+w)>0&&p-(_+w)<k&&(w=p-_<=Et?p-_:w-k),g.push(c.copy?{kind:"copy",at:_,len:w,key:c.copy.key,offset:c.copy.offset+(_-c.at)}:{kind:"upload",at:_,len:w}),_+=w}}if(g.length>it)throw new Error(`the image needs ${g.length} pieces (S3 allows ${it})`);return g}function Ee(e,t,n,r){let o=[...r].sort((i,g)=>i.offset-g.offset),s=[],a=0;for(let i of o){let g=Math.min(i.offset,t);g>a&&s.push({at:a,len:g-a,key:e,offset:a}),a=Math.max(a,i.offset+i.length)}return a<Math.min(t,n)&&s.push({at:a,len:Math.min(t,n)-a,key:e,offset:a}),s}async function ve(e,t,n,r,o){let s=[];for(let a of t.files)for(let i of At(a)){let g=(t.partitionStartSector+i.imageSector)*Kt;for(let c=i.offset;c<i.offset+i.length;){let u=Math.min(i.offset+i.length,(Math.floor(c/ct)+1)*ct),_=g+(c-i.offset);s.push(o?.(_,u-c)??[qt("sha256").update(await e.read(_,u-c)).digest("hex"),_,u-c]),r?.(u-c),c=u}}return{v:1,block:ct,size:n,blocks:s}}function Pe(e,t){let n=new Map;for(let o of t)for(let[s,a,i]of o.index.blocks)n.set(`${s}:${i}`,{key:o.key,offset:a});let r=[];for(let[o,s,a]of e.blocks){let i=n.get(`${o}:${a}`);i&&r.push({at:s,len:a,key:i.key,offset:i.offset})}return r}var vt=(e,t)=>`${Q().supabaseUrl}/functions/v1/${e}${t}`;async function lt(e,t,n={}){let r=await mt();if(!r)throw new Error("not signed in to conform.tools \u2014 run account_login");let o=await fetch(vt(e,t),{method:n.method??(n.body?"POST":"GET"),headers:{authorization:`Bearer ${r}`,apikey:Q().anonKey,...n.body?{"content-type":"application/json"}:{}},...n.body?{body:JSON.stringify(n.body)}:{},signal:AbortSignal.timeout(2e4)}),s=await o.text();if(!o.ok){let a=s;try{let i=JSON.parse(s);a=i.error?.message??i.message??i.error??s}catch{}throw o.status===404&&/Requested function was not found/i.test(String(a))?new Error(`${e} isn't deployed on ${new URL(vt(e,t)).host}: this server doesn't have that feature yet (an older server, or a staging/production mismatch)`):new Error(`${n.method??"GET"} ${t}: ${o.status} ${a}`)}return s?JSON.parse(s):{}}function Te(e,t="org"){let n=`/v1/sessions/${e}/storage/multipart`,r=(o,s,a)=>lt("v1-sessions",o,{body:s,method:a});return{start:async o=>String((await r(`${n}/start`,{key:o,content_type:"application/x-iso9660-image"})).upload_id),partUrls:async(o,s,a,i)=>(await r(`${n}/${s}/part-urls`,{key:o,first_part:a,count:i})).parts,copyPart:async(o,s,a,i)=>String((await r(`${n}/${s}/copy-part`,{key:o,part_number:a,source_ref:{scheme:t,bucket:"i2o",key:i.key},byte_range:{offset:i.offset,length:i.length}})).etag),complete:async(o,s,a)=>{await r(`${n}/${s}/complete`,{key:o,parts:a})},abort:async(o,s)=>{await r(`${n}/${encodeURIComponent(s)}?key=${encodeURIComponent(o)}`,void 0,"DELETE")},readUrl:async o=>String((await r(`/v1/sessions/${e}/download-url`,{storage_path:o})).download_url)}}async function ut(e,t,n=4){for(let r=1;;r++)try{return await t()}catch(o){if(r>=n)throw new Error(`${e} failed after ${n} tries: ${o instanceof Error?o.message:o}`);await new Promise(s=>setTimeout(s,500*2**r))}}async function ke(e,t,n,r,o={}){let s=o.fetchFn??fetch,a=await e.start(t),i=n.reduce((d,b)=>d+b.len,0),g=new Array(n.length),c=0,u=0,_=new Map,p=async d=>(_.has(d)||(await e.partUrls(t,a,d+1,Math.min(100,n.length-d))).forEach((F,A)=>_.set(d+A,F)),_.get(d)),w=async d=>{let b=n[d];if(b.kind==="copy")g[d]=await ut(`copy piece ${d+1}`,()=>e.copyPart(t,a,d+1,{key:b.key,offset:b.offset,length:b.len}));else{let F=await r(b.at,b.len);g[d]=await ut(`upload piece ${d+1}`,async()=>{let A=await p(d),v=await s(A.upload_url,{method:A.method,headers:A.headers,body:F,signal:o.signal});if(!v.ok)throw _.delete(d),new Error(`${v.status} ${(await v.text()).slice(0,200)}`);let W=v.headers.get("etag");if(!W)throw new Error("the bucket returned no ETag (expose it in the bucket's CORS / response headers)");return W})}c+=b.len,o.onProgress?.(c,i)};try{await Promise.all(Array.from({length:Math.min(6,n.length)},async()=>{for(;u<n.length;)o.signal?.throwIfAborted(),await w(u++)})),await ut("complete",()=>e.complete(t,a,g.map((d,b)=>({part_number:b+1,etag:d}))))}catch(d){throw await e.abort(t,a).catch(()=>{}),d}return{uploaded:n.filter(d=>d.kind==="upload").reduce((d,b)=>d+b.len,0),copied:n.filter(d=>d.kind==="copy").reduce((d,b)=>d+b.len,0),pieces:n.length}}function Fe(e){let t=Zt(e,"r");return{read:async(n,r)=>{let o=new Uint8Array(r);return await(await t).read(o,0,r,n),o},close:async()=>{await(await t).close()}}}var gt="local",Tt=/^[A-Za-z0-9_-]{1,64}$/,I=e=>{if(!Tt.test(e))throw new j("invalid_args",`bad project_id '${e}'`);return y(R(),"projects",e)},dt=(e,t={})=>lt("v1-projects",e,t),kt=e=>Number(/: (\d{3}) /.exec(String(e?.message))?.[1]??0);async function Ft(e){let t="",n={base:null,by:null};try{t=await S(y(I(e),"CONTEXT.md"))}catch{}try{n=JSON.parse(await S(y(I(e),"context.json")))}catch{}return{text:t,meta:n}}async function _t(e,t,n){await T(I(e)),await P(y(I(e),"CONTEXT.md"),t),await P(y(I(e),"context.json"),JSON.stringify(n))}var ft=async(e,t)=>(await _t(e,t.context,{base:t.context_updated_at,by:t.context_updated_by_name??null}),{text:t.context,updated_at:t.context_updated_at,updated_by:t.context_updated_by_name??null});async function Me(e){I(e);let t=await Ft(e);if(e===gt)return{text:t.text,updated_at:null,updated_by:null};if(t.meta.pending)try{return await Pt(e,t.text,t.meta.base)}catch(n){if(!(n instanceof j&&n.code==="context_conflict"))return{text:t.text,updated_at:t.meta.base,updated_by:t.meta.by,offline:!0,pending:!0};let r=n.data?.current??{context:"",context_updated_at:null},o=`${r.context.trimEnd()}
4
4
 
5
5
  ## Saved offline on this machine (merge into the notes above)
6
6
 
@@ -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{Uc as d}from"./chunk-QBQJDV2F.js";import{A as l,B as p,E as m,ba as f,n as c,y as u}from"./chunk-GTPTZRO6.js";import o from"node:process";import{readFileSync as g,rmSync as h}from"node:fs";import{createConnection as w}from"node:net";var x=new Set(["tool_run","app","tool"]),s=()=>f(c(),"engine.json");async function I(e,r){await p(c()),await l(s(),JSON.stringify({port:e,token:r||void 0,pid:o.pid})),await m(s(),384);for(let t of["SIGINT","SIGTERM"])o.on(t,()=>o.exit(0));o.on("exit",()=>{try{JSON.parse(g(s(),"utf8")).pid===o.pid&&h(s())}catch{}})}function S(e,r=1500){return new Promise(t=>{let n=w({host:"127.0.0.1",port:e}),i=y=>{clearTimeout(a),n.destroy(),t(y)},a=setTimeout(()=>i(!1),r);n.once("connect",()=>i(!0)).once("error",()=>i(!1))})}async function O(e,r){if(!x.has(e))return null;let t;try{t=JSON.parse(await u(s()))}catch{return null}if(t.pid===o.pid||!await S(t.port))return null;let n;try{n=await fetch(`http://127.0.0.1:${t.port}/verbs/${e}`,{method:"POST",body:JSON.stringify(r),headers:{"content-type":"application/json","x-conform-client":d()??"mcp",...t.token?{authorization:`Bearer ${t.token}`}:{}}})}catch{return null}if(n.status===401||n.status===404)return null;let{text:i,...a}=await n.json();return{content:[{type:"text",text:i??""}],structuredContent:a,isError:!n.ok}}export{I as a,O as b};
3
+ import{Vc as d}from"./chunk-6IL7M3VP.js";import{B as l,C as p,F as m,da as f,o as c,z as u}from"./chunk-MU5AGXSH.js";import o from"node:process";import{readFileSync as g,rmSync as h}from"node:fs";import{createConnection as w}from"node:net";var x=new Set(["tool_run","app","tool"]),s=()=>f(c(),"engine.json");async function I(e,r){await p(c()),await l(s(),JSON.stringify({port:e,token:r||void 0,pid:o.pid})),await m(s(),384);for(let t of["SIGINT","SIGTERM"])o.on(t,()=>o.exit(0));o.on("exit",()=>{try{JSON.parse(g(s(),"utf8")).pid===o.pid&&h(s())}catch{}})}function S(e,r=1500){return new Promise(t=>{let n=w({host:"127.0.0.1",port:e}),i=y=>{clearTimeout(a),n.destroy(),t(y)},a=setTimeout(()=>i(!1),r);n.once("connect",()=>i(!0)).once("error",()=>i(!1))})}async function O(e,r){if(!x.has(e))return null;let t;try{t=JSON.parse(await u(s()))}catch{return null}if(t.pid===o.pid||!await S(t.port))return null;let n;try{n=await fetch(`http://127.0.0.1:${t.port}/verbs/${e}`,{method:"POST",body:JSON.stringify(r),headers:{"content-type":"application/json","x-conform-client":d()??"mcp",...t.token?{authorization:`Bearer ${t.token}`}:{}}})}catch{return null}if(n.status===401||n.status===404)return null;let{text:i,...a}=await n.json();return{content:[{type:"text",text:i??""}],structuredContent:a,isError:!n.ok}}export{I as a,O as b};
@@ -1,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{d as _}from"./chunk-ND2YUUUH.js";function l(f){let m=[...f].sort((s,t)=>s.first_frame-t.first_frame),e=[];for(let s of m){let t=e[e.length-1];t&&s.first_frame<=t.last_frame+1?t.last_frame=Math.max(t.last_frame,s.last_frame):e.push({...s})}return e}async function g(f,m,e){let s=l(f),t=l(f.map(r=>({first_frame:Math.max(0,r.first_frame-m),last_frame:r.last_frame+m}))),n=[];for(let r of t)try{n.push(await e(r.first_frame,r.last_frame+1))}catch(o){let i=_(o)?.file_frames,u=s.filter(a=>a.last_frame>=r.first_frame&&a.first_frame<=r.last_frame);if(i==null||r.last_frame+1<=i||u.some(a=>a.first_frame<0||a.last_frame+1>i))throw o;n.push(await e(r.first_frame,i))}return n}export{l as a,g as b};
3
+ import{d as _}from"./chunk-2S2ZPQQD.js";function l(f){let m=[...f].sort((s,t)=>s.first_frame-t.first_frame),e=[];for(let s of m){let t=e[e.length-1];t&&s.first_frame<=t.last_frame+1?t.last_frame=Math.max(t.last_frame,s.last_frame):e.push({...s})}return e}async function g(f,m,e){let s=l(f),t=l(f.map(r=>({first_frame:Math.max(0,r.first_frame-m),last_frame:r.last_frame+m}))),n=[];for(let r of t)try{n.push(await e(r.first_frame,r.last_frame+1))}catch(o){let i=_(o)?.file_frames,u=s.filter(a=>a.last_frame>=r.first_frame&&a.first_frame<=r.last_frame);if(i==null||r.last_frame+1<=i||u.some(a=>a.first_frame<0||a.last_frame+1>i))throw o;n.push(await e(r.first_frame,i))}return n}export{l as a,g as b};