conformtools 0.6.21 → 0.6.22

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 (80) hide show
  1. package/dist/account-ZGDVLMZA.js +3 -0
  2. package/dist/{agent-hook-setup-D2QNHA3V.js → agent-hook-setup-ZY4UBZIG.js} +1 -1
  3. package/dist/{analysis-engine-VNGF3DE4.js → analysis-engine-BBOSGAB2.js} +1 -1
  4. package/dist/{bridge-GW2VQP2I.js → bridge-56MINHUF.js} +1 -1
  5. package/dist/browser/timeline_core_bg.wasm +0 -0
  6. package/dist/{chunk-2WNNDPVR.js → chunk-3KS3547B.js} +1 -1
  7. package/dist/{chunk-LKX3HCRN.js → chunk-4I4MV3DE.js} +1 -1
  8. package/dist/{chunk-X7C4YS2J.js → chunk-64AMZWOI.js} +1 -1
  9. package/dist/{chunk-AY72AUHE.js → chunk-65SLDY2M.js} +87 -87
  10. package/dist/{chunk-3WJSWOCS.js → chunk-67VLJJ75.js} +2 -2
  11. package/dist/{chunk-OR6IMPAS.js → chunk-6C3EEZH3.js} +1 -1
  12. package/dist/{chunk-SQCGMF6W.js → chunk-BFN565RJ.js} +1 -1
  13. package/dist/{chunk-5WL2ZPPB.js → chunk-CHEQJC4U.js} +190 -190
  14. package/dist/{chunk-XAUMTGJZ.js → chunk-DHDSDH6R.js} +2 -2
  15. package/dist/chunk-E75BCWXY.js +4 -0
  16. package/dist/{chunk-P6MSAFNR.js → chunk-FSXF4K3J.js} +1 -1
  17. package/dist/{chunk-M545OKDZ.js → chunk-HNEKQMQG.js} +1 -1
  18. package/dist/chunk-IW5M45CL.js +3 -0
  19. package/dist/{chunk-2WD3MDPB.js → chunk-JGI5YEGH.js} +1 -1
  20. package/dist/chunk-JUJESM4P.js +3 -0
  21. package/dist/{chunk-JCNKPRYY.js → chunk-M3DXHHD7.js} +1 -1
  22. package/dist/chunk-NHWWMLZW.js +5 -0
  23. package/dist/{chunk-26ZNWQLT.js → chunk-O5HYVCFL.js} +1 -1
  24. package/dist/chunk-OCNKVM26.js +7 -0
  25. package/dist/{chunk-M56WEBZY.js → chunk-OVBFJOO2.js} +1 -1
  26. package/dist/{chunk-PENDVYIL.js → chunk-PKKUIGZ5.js} +1 -1
  27. package/dist/{chunk-5XJVAA6N.js → chunk-QNVFSA7C.js} +1 -1
  28. package/dist/{chunk-ZAL7Y5VZ.js → chunk-QPSQQEO6.js} +1 -1
  29. package/dist/{chunk-I6WBZBGN.js → chunk-REBF4U5B.js} +1 -1
  30. package/dist/{chunk-CXOK4SF6.js → chunk-REGL3GQB.js} +1 -1
  31. package/dist/{chunk-WW6XAQKM.js → chunk-TFKKODSA.js} +1 -1
  32. package/dist/{chunk-5YCUHHZO.js → chunk-Z3LQ56WS.js} +1 -1
  33. package/dist/{chunk-Z42CP7YT.js → chunk-ZCQTIYXB.js} +1 -1
  34. package/dist/chunk-ZPIY5DOU.js +3 -0
  35. package/dist/{claude-setup-AI4WXN2V.js → claude-setup-6RMV3QZM.js} +1 -1
  36. package/dist/cli.js +2 -2
  37. package/dist/{cr3-wasm-CVZ2A7HA.js → cr3-wasm-HWPQ3QAN.js} +1 -1
  38. package/dist/{dng-wasm-TN64FKIN.js → dng-wasm-D7HO2OUE.js} +1 -1
  39. package/dist/{dpx-wasm-BO2NDGTA.js → dpx-wasm-ASRFRLRT.js} +1 -1
  40. package/dist/{exr-wasm-W4K6W6JZ.js → exr-wasm-Y53DGEKJ.js} +1 -1
  41. package/dist/framing-JYGNU6TH.js +3 -0
  42. package/dist/gfx-worker.js +1 -1
  43. package/dist/{h264-LC27KFZT.js → h264-ZJCLCYYY.js} +1 -1
  44. package/dist/{h264-mxf-GQCFBTTP.js → h264-mxf-BI4ACQUH.js} +1 -1
  45. package/dist/{host-relink-BYLBYTPH.js → host-relink-XMVOQYKN.js} +1 -1
  46. package/dist/hosted-7KVSASRJ.js +3 -0
  47. package/dist/hosts-ZPBLYFYP.js +3 -0
  48. package/dist/http.js +4 -4
  49. package/dist/{inspect-63MCOFOQ.js → inspect-4RF2SDJR.js} +16 -17
  50. package/dist/{isobmff-IMEN2G3B.js → isobmff-FZBZCEYH.js} +1 -1
  51. package/dist/{mc-video-G4KNAHGG.js → mc-video-IUPFHPIS.js} +1 -1
  52. package/dist/mcp.js +1 -1
  53. package/dist/{media-Z23SL7RZ.js → media-R677IADY.js} +1 -1
  54. package/dist/mxf-IUCZVILV.js +3 -0
  55. package/dist/{ops-T6ZV7RAM.js → ops-L5X3Q6SQ.js} +1 -1
  56. package/dist/{probe-YOYK7HR5.js → probe-VB6JH6ZJ.js} +1 -1
  57. package/dist/{r3d-6P6K47AH.js → r3d-EIQEVYGC.js} +1 -1
  58. package/dist/{r3d-ISLQ6I3S.js → r3d-VBXKIIRY.js} +1 -1
  59. package/dist/resolve-bridge.py +208 -13
  60. package/dist/{sequence-patch-5MFTY52Q.js → sequence-patch-OHYBBKKZ.js} +1 -1
  61. package/dist/{still-DMZJUM7M.js → still-XAFHXXC3.js} +1 -1
  62. package/dist/{still-wasm-ZLP224QL.js → still-wasm-ZG6PA67L.js} +1 -1
  63. package/dist/{store-6XN5Q6UG.js → store-ZXNF2RXS.js} +1 -1
  64. package/dist/{tiff-wasm-TAEKNO4Q.js → tiff-wasm-AHQJJAK2.js} +1 -1
  65. package/dist/timeline-LJYGRP3R.js +3 -0
  66. package/dist/wasm/media_core_bg.wasm +0 -0
  67. package/dist/{wav-BNOX5U7S.js → wav-4COVRAK3.js} +1 -1
  68. package/package.json +5 -5
  69. package/dist/account-VD3EE5UT.js +0 -3
  70. package/dist/chunk-2XQ42O7E.js +0 -7
  71. package/dist/chunk-BUOYYO22.js +0 -3
  72. package/dist/chunk-COALWMI7.js +0 -4
  73. package/dist/chunk-MU5AGXSH.js +0 -3
  74. package/dist/chunk-QJPOC4SW.js +0 -3
  75. package/dist/chunk-VG73BE6N.js +0 -4
  76. package/dist/framing-GOLRVBBJ.js +0 -3
  77. package/dist/hosted-ASNIPMSH.js +0 -3
  78. package/dist/hosts-EYVK23A3.js +0 -3
  79. package/dist/mxf-ZEM6EEZU.js +0 -3
  80. package/dist/timeline-P4GJT36O.js +0 -3
@@ -452,25 +452,208 @@ def pool_ids(folder):
452
452
  return ids
453
453
 
454
454
 
455
- def _append_piece(mp, t, clip, pc, track, t0):
455
+ def _append_piece(mp, t, clip, pc, track, t0, media_type=1, rescale=True):
456
456
  """One piece (pc: src_in / src_out source frames, start / end record frames from the head) of `clip` onto `track`
457
457
  of the CURRENT timeline. AppendToTimeline takes endFrame EXCLUSIVE and lands within a frame or two on a source at
458
- another rate (0.9.5, measured 2026-09-08): read back, and when the length is off re-appended with the window
459
- scaled (3 tries). Returns (item or None, exact)."""
458
+ another rate (0.9.5, measured 2026-09-08; EXCLUSIVE re-measured live on Resolve 21 2026-11-11: src 0-3 laid 3 frames,
459
+ source read back 0-2): read back, and when the length is off re-appended with the window's END
460
+ scaled (3 tries; src_in is never moved). rescale=False appends once, as asked, for a caller that reads back what
461
+ Resolve laid instead (timeline_new's cross-rate pieces). media_type 1 = video, 2 = audio, None = both (linked; the
462
+ first item is read back, all are taken out on a retry). Returns (item or None, exact)."""
460
463
  want = int(pc["end"]) - int(pc["start"])
461
464
  src = max(1, int(pc["src_out"]) - int(pc["src_in"]))
462
465
  got, item = None, None
463
466
  for attempt in range(3):
464
- res = mp.AppendToTimeline([{"mediaPoolItem": clip, "startFrame": int(pc["src_in"]), "endFrame": int(pc["src_in"]) + src,
465
- "recordFrame": t0 + int(pc["start"]), "trackIndex": track, "mediaType": 1}]) or []
467
+ info = {"mediaPoolItem": clip, "startFrame": int(pc["src_in"]), "endFrame": int(pc["src_in"]) + src,
468
+ "recordFrame": t0 + int(pc["start"]), "trackIndex": track}
469
+ if media_type is not None:
470
+ info["mediaType"] = media_type
471
+ res = mp.AppendToTimeline([info]) or []
466
472
  item = res[0] if res else None
467
473
  got = int(item.GetEnd()) - int(item.GetStart()) if item else None
468
- if got is None or got == want or got <= 0 or attempt == 2 or not t.DeleteClips([item]):
474
+ if not rescale or got is None or got == want or got <= 0 or attempt == 2 or not t.DeleteClips(list(res)):
469
475
  break
470
476
  src = max(1, int(round(src * want / got)))
471
477
  return item, item is not None and got == want and int(item.GetStart()) == t0 + int(pc["start"])
472
478
 
473
479
 
480
+ MEDIA_TYPE = {"video": 1, "audio": 2, "both": None}
481
+
482
+
483
+ def _fps(v):
484
+ """A frame rate exactly as Resolve gave it as text ("23.976", "25.000"): a Fraction, None when it gave none."""
485
+ from fractions import Fraction
486
+ try:
487
+ f = Fraction(str(v).strip())
488
+ return f if f > 0 else None
489
+ except (TypeError, ValueError, ZeroDivisionError):
490
+ return None
491
+
492
+
493
+ def _src_frame(item, fn):
494
+ """An item's source frame as Resolve reads it back, None when this Resolve has no such call."""
495
+ try:
496
+ return int(getattr(item, fn)()) if has(item, fn) else None
497
+ except Exception:
498
+ return None
499
+
500
+
501
+ def _timeline_new(p, op):
502
+ """A NATIVE Resolve timeline (MediaPool.CreateEmptyTimeline), never an imported file: `name` (made unique), in the
503
+ pool `folder` (default the conform.tools one; made if missing). Settings before any clip, because Resolve takes a
504
+ timeline's own frame rate only while it is EMPTY and only with useCustomSettings on: `settings_from` (a timeline
505
+ whose settings it carries, inherit_settings) and/or `fps`, `width`, `height` (custom settings switched on first),
506
+ each read back; one Resolve did not keep deletes the timeline and refuses, naming it. Then `pieces` [{clip: pool
507
+ unique id | path (imported into the folder when not in the pool), src_in?, src_out? (source frames from the clip's
508
+ first, default the whole clip), start (record frame from the timeline head; default right after the track's last),
509
+ track? (1), kind? video|audio|both}] laid with _append_piece and read back; the pieces that did not land exact are
510
+ listed (off), and `landed` gives each piece's read-back record and source frames and, for audio, the audio tracks
511
+ Resolve laid it on. Each piece is laid once as asked; a video piece from a clip at another rate is held to Resolve's
512
+ measured real-time length (floor law, below) and its source frames are listed under not_checked. The artist's
513
+ timeline and bin are put back unless `stay`. Undo: the new timeline, then the pool clips this
514
+ imported. No other timeline is touched."""
515
+ mp = p.GetMediaPool()
516
+ prev, prev_folder = p.GetCurrentTimeline(), mp.GetCurrentFolder()
517
+ if op.get("folder"):
518
+ folder, missing = pool_folder(mp, op["folder"], create=True)
519
+ if folder is None:
520
+ return {"ok": False, "undo": [], "detail": "could not make the pool folder %s" % missing}
521
+ else:
522
+ folder = our_folder(mp)
523
+ name = unique_name(p, str(op.get("name") or "Timeline").strip() or "Timeline")
524
+ tl, made, keep = None, [], False
525
+
526
+ def restore():
527
+ if not keep and prev is not None:
528
+ p.SetCurrentTimeline(prev)
529
+ mp.SetCurrentFolder(prev_folder)
530
+
531
+ def refuse(why, **extra):
532
+ if tl is not None:
533
+ mp.DeleteTimelines([tl])
534
+ if made:
535
+ mp.DeleteClips(made)
536
+ restore()
537
+ return dict({"ok": False, "undo": [], "detail": why + "; nothing was made"}, **extra)
538
+
539
+ try:
540
+ mp.SetCurrentFolder(folder)
541
+ tl = mp.CreateEmptyTimeline(name)
542
+ if not tl:
543
+ return refuse("Resolve would not create a timeline named %r" % name)
544
+ uid = tl.GetUniqueId()
545
+ settings = None
546
+ if op.get("settings_from"):
547
+ names = [x.GetName() for x in timelines(p)]
548
+ if op["settings_from"] not in names:
549
+ return refuse("no timeline named %r to take settings from" % op["settings_from"])
550
+ try:
551
+ settings = inherit_settings(p, find_timeline(p, op["settings_from"]), tl)
552
+ except BridgeFail as e:
553
+ return refuse(e.message, failed=e.extra.get("failed", []))
554
+ want = [(k, op[a]) for k, a in (("timelineFrameRate", "fps"), ("timelineResolutionWidth", "width"), ("timelineResolutionHeight", "height")) if op.get(a) not in (None, "")]
555
+ if want:
556
+ # custom first: a timeline following the project refuses its own rate and raster (Resolve's rule)
557
+ tl.SetSetting("useCustomSettings", "1")
558
+ if _set_norm(tl.GetSetting("useCustomSettings")) != "1":
559
+ return refuse("Resolve would not switch the new timeline to custom settings, so it cannot have its own %s" % ", ".join(k for k, _ in want), failed=["useCustomSettings"])
560
+ for k, v in want:
561
+ tl.SetSetting(k, _set_value(v))
562
+ off = [k for k, v in want if _set_norm(tl.GetSetting(k)) != _set_norm(_set_value(v))]
563
+ if off:
564
+ pf = p.GetSetting("timelineFrameRate")
565
+ return refuse("Resolve kept %s (asked %s%s)" % (
566
+ ", ".join("%s %s" % (k, tl.GetSetting(k)) for k in off), ", ".join("%s %s" % (k, v) for k, v in want if k in off),
567
+ "; the project is at %s fps" % pf if pf else ""), failed=off)
568
+ # the pieces' clips: pool ids found anywhere in the pool, files imported once each into the folder
569
+ pieces = list(op.get("pieces") or [])
570
+ pool = pool_by_uid(mp.GetRootFolder(), {str(pc["clip"]) for pc in pieces if pc.get("clip")})
571
+ paths = list(dict.fromkeys(pc["path"] for pc in pieces if pc.get("path") and not pc.get("clip")))
572
+ by_path = {}
573
+ if paths:
574
+ before = pool_ids(mp.GetRootFolder())
575
+ for c in mp.ImportMedia(paths) or []:
576
+ by_path[same_file_key(c.GetClipProperty("File Path") or "")] = c
577
+ if c.GetMediaId() not in before:
578
+ made.append(c)
579
+ p.SetCurrentTimeline(tl) # AppendToTimeline lays clips on the current timeline only
580
+ t0 = int(tl.GetStartFrame())
581
+ ends, placed, off, unchecked, landed = {}, 0, [], [], []
582
+ tfps = _fps(tl.GetSetting("timelineFrameRate"))
583
+ for i, pc in enumerate(pieces):
584
+ label = pc.get("name") or (os.path.basename(pc["path"]) if pc.get("path") else str(pc.get("clip")))
585
+ clip = pool.get(str(pc["clip"])) if pc.get("clip") else by_path.get(same_file_key(pc.get("path") or ""))
586
+ if clip is None:
587
+ off.append({"piece": i, "clip": label, "why": "not in the media pool" if pc.get("clip") else "Resolve did not import it"})
588
+ continue
589
+ kind = pc.get("kind") or "video"
590
+ if kind not in MEDIA_TYPE:
591
+ off.append({"piece": i, "clip": label, "why": "kind is video, audio or both"})
592
+ continue
593
+ track = int(pc.get("track") or 1)
594
+ for k in (("video", "audio") if kind == "both" else (kind,)):
595
+ while int(tl.GetTrackCount(k) or 0) < track:
596
+ if not tl.AddTrack(k):
597
+ break
598
+ src_in = int(pc.get("src_in") or 0)
599
+ src_out = int(pc["src_out"]) if pc.get("src_out") is not None else int(clip.GetClipProperty("Frames") or 0)
600
+ if src_out <= src_in:
601
+ off.append({"piece": i, "clip": label, "why": "no frames between src_in %d and src_out %d" % (src_in, src_out)})
602
+ continue
603
+ key = (kind, track)
604
+ start = int(pc["start"]) if pc.get("start") is not None else ends.get(key, 0)
605
+ # Laid ONCE, exactly as asked (src_in, src_out; endFrame exclusive), never re-windowed. A clip at another rate
606
+ # plays in real time: Resolve lays floor((src_out - src_in) x timeline fps / clip fps) record frames at the
607
+ # asked start (MEASURED live on Resolve 21 AppendToTimeline 2026-11-11, 10 rows of a 23.976 clip on a 25 fps
608
+ # timeline, e.g. 0-24 -> 25, 0-12 -> 12, 60-72 -> 12, 1-2 -> 1; not binary-decoded). Same rate: n frames.
609
+ cfps = _fps(clip.GetClipProperty("FPS"))
610
+ cross = kind != "audio" and cfps is not None and tfps is not None and cfps != tfps
611
+ n = src_out - src_in
612
+ rec = int(n * tfps / cfps) if cross else n # Fractions >= 0: int() is floor
613
+ item, exact = _append_piece(mp, tl, clip, {"src_in": src_in, "src_out": src_out, "start": start, "end": start + rec},
614
+ track, t0, MEDIA_TYPE[kind], rescale=False)
615
+ if item is None:
616
+ off.append({"piece": i, "clip": label, "why": "Resolve refused it at %d" % start})
617
+ continue
618
+ placed += 1
619
+ ends[key] = int(item.GetEnd()) - t0
620
+ got_rec = [int(item.GetStart()) - t0, int(item.GetEnd()) - t0]
621
+ land = {"piece": i, "clip": label, "record": got_rec, "source_asked": [src_in, src_out],
622
+ "source": [_src_frame(item, "GetSourceStartFrame"), _src_frame(item, "GetSourceEndFrame")]}
623
+ if kind != "video":
624
+ # one append, linked or audio only: Resolve lays a clip's audio channels on as many tracks as its audio
625
+ # format has (live 2026-11-11: a stereo cam.mov "both" on A1 AND A2), read back here by clip and start
626
+ land["audio_tracks"] = [n for n in range(1, int(tl.GetTrackCount("audio") or 0) + 1)
627
+ if any(int(x.GetStart()) == int(item.GetStart()) and x.GetMediaPoolItem() is not None
628
+ and x.GetMediaPoolItem().GetUniqueId() == clip.GetUniqueId()
629
+ for x in tl.GetItemListInTrack("audio", n) or [])]
630
+ if cross:
631
+ land["cross_rate"] = {"clip_fps": str(float(cfps)), "timeline_fps": str(float(tfps)), "record_frames": rec}
632
+ # its record frames are checked (the floor law); its source frames are not: Resolve's
633
+ # GetSourceStartFrame/End on a cross-rate item are not in source frames (live 2026-11-11: [86, 95] for 0-12)
634
+ unchecked.append({"piece": i, "clip": label, "why": "%s fps clip on a %s fps timeline: source frames not checked, "
635
+ "Resolve does not read them back in source frames for a clip at another rate" % (float(cfps), float(tfps))})
636
+ if not exact:
637
+ off.append({"piece": i, "clip": label, "why": "landed at %d-%d, asked %d-%d" % (got_rec[0], got_rec[1], start, start + rec)})
638
+ landed.append(land)
639
+ keep = bool(op.get("stay"))
640
+ got = {"fps": tl.GetSetting("timelineFrameRate") or "", "width": tl.GetSetting("timelineResolutionWidth") or "",
641
+ "height": tl.GetSetting("timelineResolutionHeight") or "", "custom": _set_norm(tl.GetSetting("useCustomSettings") or "0") == "1"}
642
+ undo = [{"op": "timeline_discard", "timeline": tl.GetName(), "guid": uid}] + ([{"op": "pool_delete", "clips": [c.GetUniqueId() for c in made]}] if made else [])
643
+ out = {"ok": not off, "name": tl.GetName(), "settings": got, "placed": placed, "pieces": len(pieces),
644
+ "imported": len(made), "off": off, "not_checked": unchecked, "landed": landed, "stayed": keep, "undo": undo,
645
+ **({"inheritance": settings["inheritance"], "notes": settings["notes"]} if settings else {})}
646
+ notes = ["%d of %d piece(s) not exact: %s" % (len(off), len(pieces), "; ".join("#%d %s: %s" % (o["piece"] + 1, o["clip"], o["why"]) for o in off[:10]))] if off else []
647
+ notes += ["not checked: " + "; ".join("#%d %s: %s" % (o["piece"] + 1, o["clip"], o["why"]) for o in unchecked[:10])] if unchecked else []
648
+ if notes:
649
+ out["detail"] = " | ".join(notes)
650
+ restore()
651
+ return out
652
+ except Exception:
653
+ refuse("failed")
654
+ raise
655
+
656
+
474
657
  def pool_by_uid(folder, uids, out=None):
475
658
  """{unique id: media pool item} for the clips named, anywhere under `folder`."""
476
659
  out = {} if out is None else out
@@ -1502,19 +1685,25 @@ def _op(p, t, op, find):
1502
1685
  walk(sub)
1503
1686
  walk(p.GetMediaPool().GetRootFolder())
1504
1687
  return {"ok": not missed, "refreshed": n, "undo": [], **({"detail": "Resolve did not re-read: " + ", ".join(os.path.basename(x) for x in missed)} if missed else {})}
1688
+ if kind == "timeline_new":
1689
+ return _timeline_new(p, op)
1505
1690
  if kind == "timeline_discard":
1506
1691
  # 0.9.5 Reconformer's Discard: a built copy deleted by name — only one whose name ends _RECONFORMED, so this never
1507
1692
  # deletes a real timeline; when it is open, B (its name without the suffix) is opened first. No undo (said).
1693
+ # With `guid` (timeline_new's undo): exactly the timeline that op made, by its unique id, whatever it is called now.
1508
1694
  name = str(op.get("timeline") or "")
1509
1695
  # a second build of the same B is "..._RECONFORMED (2)" (unique_name): a build too
1510
1696
  m = re.match(r"^(.*)_RECONFORMED(?: \(\d+\))?$", name)
1511
- if not m:
1697
+ if op.get("guid"):
1698
+ tl = next((x for x in timelines(p) if x.GetUniqueId() == op["guid"]), None)
1699
+ elif not m:
1512
1700
  return {"ok": False, "undo": [], "detail": "only a ..._RECONFORMED timeline (a Reconform build) can be discarded"}
1513
- tl = find_timeline(p, name) if name in [x.GetName() for x in timelines(p)] else None
1701
+ else:
1702
+ tl = find_timeline(p, name) if name in [x.GetName() for x in timelines(p)] else None
1514
1703
  if tl is None:
1515
1704
  return {"ok": True, "undo": [], "detail": "already gone"}
1516
1705
  cur = p.GetCurrentTimeline()
1517
- if cur is not None and cur.GetUniqueId() == tl.GetUniqueId():
1706
+ if m and cur is not None and cur.GetUniqueId() == tl.GetUniqueId():
1518
1707
  base = m.group(1)
1519
1708
  if base in [x.GetName() for x in timelines(p)]:
1520
1709
  p.SetCurrentTimeline(find_timeline(p, base))
@@ -1582,7 +1771,7 @@ def _op(p, t, op, find):
1582
1771
  t.AddTrack("video")
1583
1772
  k = int(t.GetTrackCount("video"))
1584
1773
  t0 = int(t.GetStartFrame())
1585
- got = mp.AppendToTimeline([{"mediaPoolItem": c, "startFrame": 0, "endFrame": int(c.GetClipProperty("Frames") or 1) - 1,
1774
+ got = mp.AppendToTimeline([{"mediaPoolItem": c, "startFrame": 0, "endFrame": int(c.GetClipProperty("Frames") or 1), # exclusive (live 2026-11-11)
1586
1775
  "trackIndex": k, "recordFrame": t0 + int(f), "mediaType": 1} for c, f in zip(clips, op["at"])]) or []
1587
1776
  placed = len(got)
1588
1777
  undo = [{"op": "track_delete", "kind": "video", "index": k}] + undo
@@ -2479,10 +2668,16 @@ def a_apply(resolve, args):
2479
2668
  return _in_scratch(resolve, args, lambda p: _apply(p, args))
2480
2669
 
2481
2670
 
2671
+ # ops that need no timeline open: a native timeline made in an empty project, and its undo
2672
+ NO_TIMELINE_OPS = ("timeline_new", "timeline_discard", "pool_delete")
2673
+
2674
+
2482
2675
  def _apply(p, args):
2483
- t = find_timeline(p, args.get("timeline"))
2484
- tname = t.GetName() # said at the end even when an op deleted it (Discard)
2485
- index = [_item_index(t)]
2676
+ ops = args.get("ops") or []
2677
+ loose = not args.get("timeline") and p.GetCurrentTimeline() is None and ops and all(o.get("op") in NO_TIMELINE_OPS for o in ops)
2678
+ t = None if loose else find_timeline(p, args.get("timeline"))
2679
+ tname = t.GetName() if t else "" # said at the end even when an op deleted it (Discard)
2680
+ index = [_item_index(t) if t else ({}, {})]
2486
2681
 
2487
2682
  def find(a):
2488
2683
  for fresh in (False, True):
@@ -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,e,f}from"./chunk-2WNNDPVR.js";import"./chunk-COALWMI7.js";import"./chunk-MU5AGXSH.js";import"./chunk-PSANHDZM.js";export{b as APPLIED,a as BACKUP_SUFFIX,e as applyPatch,c as patchFolders,d as planPatch,f as undoPatch};
3
+ import{a,b,c,d,e,f}from"./chunk-3KS3547B.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-PSANHDZM.js";export{b as APPLIED,a as BACKUP_SUFFIX,e as applyPatch,c as patchFolders,d as planPatch,f as undoPatch};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as l,f as o,g as m}from"./chunk-JV7TZDKJ.js";import{a as s}from"./chunk-BBCQMZQN.js";import"./chunk-PSANHDZM.js";var h=e=>{let t=e.split(/[/\\]/).pop()??"",i=t.lastIndexOf(".");return i>0?t.slice(i+1).toLowerCase():""};async function f(e,t){try{if(e==="dpx"){let r=await(await import("./dpx-wasm-BO2NDGTA.js")).inspectDpxWasm(t);return r?{width:r.width,height:r.height}:null}if(e==="exr"){let r=await(await import("./exr-wasm-W4K6W6JZ.js")).inspectExrWasm(t);return r?{width:r.width,height:r.height}:null}if(e==="dng"){let r=await(await import("./dng-wasm-TN64FKIN.js")).inspectDngWasm(t);return r?{width:r.width,height:r.height}:null}if(e==="cr3"){let r=await(await import("./cr3-wasm-CVZ2A7HA.js")).inspectCr3Wasm(t);return r?{width:r.width,height:r.height}:null}if(e==="tif"||e==="tiff"){let r=await(await import("./tiff-wasm-TAEKNO4Q.js")).inspectTiffWasm(t);return r?{width:r.width,height:r.height}:null}let i=await import("./still-wasm-ZLP224QL.js"),n=await i.inspectPhotoRawWasm(e,t);if(n)return{width:n.width,height:n.height};let a=await i.decodeStillWasm(e,t);return a?{width:a.width,height:a.height}:null}catch{}return null}async function p(e){if(typeof createImageBitmap!="function"||typeof Blob>"u")return null;try{let t=await createImageBitmap(new Blob([e])),i={width:t.width,height:t.height};return t.close?.(),i.width>0&&i.height>0?i:null}catch{return null}}async function c(e){let t=h(e.filename),i=await m(t,o(e));if(i)return i;let n=s(t);if(n===null||n==="none")return null;let a;try{a=await e.read(0,e.fileSize)}catch{return null}return n==="wasm-decoder"?await f(t,a):await p(a)}function u(e){let t=l(e);return t==="jpg"?"jpeg":t==="tif"?"tiff":t||"still"}var R={async inspect(e){let t=e.parts[0],i=await c(t);return{id:t.filename,kind:"external",content_kind:"still",target_url:t.filename,available_range:null,reel_name:null,source_timecode:null,container:l(t.filename)||"still",codec:u(t.filename),size_bytes:t.fileSize,bitrate_bps:null,source_resolution_w:i?.width??null,source_resolution_h:i?.height??null,source_pixel_aspect:i?1:null,streams:[],vendor_metadata:{},binding_state:"unbound",raw_extraction:{},metadata:{}}},async extract(e){let t=e.parts.map((i,n)=>({kind:"frame",part:n,offset:0,length:i.fileSize,frame_in:n,frame_out:n}));return t.length===0?null:{v:1,container:l(e.parts[0].filename)||"still",codec:u(e.parts[0].filename),frame_count:t.length,granularity:"frame",segments:t,...e.parts.length>1?{part_names:e.parts.map(i=>i.filename)}:{}}},async sparsify(){throw new Error("stillFormat.sparsify: stills ship whole \u2014 no sparse plan exists")},async trim(){throw new Error("stillFormat.trim: stills ship whole \u2014 no trim plan exists")}};export{R as stillFormat};
3
+ import{a as l,f as o,g as m}from"./chunk-JV7TZDKJ.js";import{a as s}from"./chunk-BBCQMZQN.js";import"./chunk-PSANHDZM.js";var h=e=>{let t=e.split(/[/\\]/).pop()??"",i=t.lastIndexOf(".");return i>0?t.slice(i+1).toLowerCase():""};async function f(e,t){try{if(e==="dpx"){let r=await(await import("./dpx-wasm-ASRFRLRT.js")).inspectDpxWasm(t);return r?{width:r.width,height:r.height}:null}if(e==="exr"){let r=await(await import("./exr-wasm-Y53DGEKJ.js")).inspectExrWasm(t);return r?{width:r.width,height:r.height}:null}if(e==="dng"){let r=await(await import("./dng-wasm-D7HO2OUE.js")).inspectDngWasm(t);return r?{width:r.width,height:r.height}:null}if(e==="cr3"){let r=await(await import("./cr3-wasm-HWPQ3QAN.js")).inspectCr3Wasm(t);return r?{width:r.width,height:r.height}:null}if(e==="tif"||e==="tiff"){let r=await(await import("./tiff-wasm-AHQJJAK2.js")).inspectTiffWasm(t);return r?{width:r.width,height:r.height}:null}let i=await import("./still-wasm-ZG6PA67L.js"),n=await i.inspectPhotoRawWasm(e,t);if(n)return{width:n.width,height:n.height};let a=await i.decodeStillWasm(e,t);return a?{width:a.width,height:a.height}:null}catch{}return null}async function p(e){if(typeof createImageBitmap!="function"||typeof Blob>"u")return null;try{let t=await createImageBitmap(new Blob([e])),i={width:t.width,height:t.height};return t.close?.(),i.width>0&&i.height>0?i:null}catch{return null}}async function c(e){let t=h(e.filename),i=await m(t,o(e));if(i)return i;let n=s(t);if(n===null||n==="none")return null;let a;try{a=await e.read(0,e.fileSize)}catch{return null}return n==="wasm-decoder"?await f(t,a):await p(a)}function u(e){let t=l(e);return t==="jpg"?"jpeg":t==="tif"?"tiff":t||"still"}var R={async inspect(e){let t=e.parts[0],i=await c(t);return{id:t.filename,kind:"external",content_kind:"still",target_url:t.filename,available_range:null,reel_name:null,source_timecode:null,container:l(t.filename)||"still",codec:u(t.filename),size_bytes:t.fileSize,bitrate_bps:null,source_resolution_w:i?.width??null,source_resolution_h:i?.height??null,source_pixel_aspect:i?1:null,streams:[],vendor_metadata:{},binding_state:"unbound",raw_extraction:{},metadata:{}}},async extract(e){let t=e.parts.map((i,n)=>({kind:"frame",part:n,offset:0,length:i.fileSize,frame_in:n,frame_out:n}));return t.length===0?null:{v:1,container:l(e.parts[0].filename)||"still",codec:u(e.parts[0].filename),frame_count:t.length,granularity:"frame",segments:t,...e.parts.length>1?{part_names:e.parts.map(i=>i.filename)}:{}}},async sparsify(){throw new Error("stillFormat.sparsify: stills ship whole \u2014 no sparse plan exists")},async trim(){throw new Error("stillFormat.trim: stills ship whole \u2014 no trim plan exists")}};export{R as stillFormat};
@@ -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 s}from"./chunk-OSUIS4JU.js";import{Ga as i,Ha as a}from"./chunk-LKX3HCRN.js";import"./chunk-PSANHDZM.js";var u={dpx:"dpx",tif:"tiff",tiff:"tiff",exr:"exr",j2c:"j2k",j2k:"j2k",jp2:"j2k",jph:"j2k",dng:"dng",cr3:"cr3",cr2:"cr2",arw:"arw",psd:"psd",tga:"tga",heic:"heic",heif:"heic",png:"png",jpg:"jpeg",jpeg:"jpeg",gif:"gif",bmp:"bmp",webp:"webp"};function l(e){return Object.prototype.hasOwnProperty.call(u,(e??"").toLowerCase())}var d=e=>{let n=i[e];return typeof n=="function"?n:void 0};async function g(e,n){let r=e.toLowerCase();if(r!=="arw"&&r!=="cr2")return null;await a();let t=i[`inspect_${r}`];if(typeof t!="function")return null;let o=t(n);return o==="null"?null:JSON.parse(o)}async function m(e,n,r=1){let t=u[e.toLowerCase()];if(!t)return null;await a();try{let o=r>1?d(`decode_${t}_preview`):void 0;if(o)return s(o(n,r));let c=d(`decode_${t}_rgba`);return c?s(c(n)):null}catch{return null}}export{u as STILL_WASM_BASE,m as decodeStillWasm,l as hasStillWasm,g as inspectPhotoRawWasm};
3
+ import{a as s}from"./chunk-OSUIS4JU.js";import{Ga as i,Ha as a}from"./chunk-4I4MV3DE.js";import"./chunk-PSANHDZM.js";var u={dpx:"dpx",tif:"tiff",tiff:"tiff",exr:"exr",j2c:"j2k",j2k:"j2k",jp2:"j2k",jph:"j2k",dng:"dng",cr3:"cr3",cr2:"cr2",arw:"arw",psd:"psd",tga:"tga",heic:"heic",heif:"heic",png:"png",jpg:"jpeg",jpeg:"jpeg",gif:"gif",bmp:"bmp",webp:"webp"};function l(e){return Object.prototype.hasOwnProperty.call(u,(e??"").toLowerCase())}var d=e=>{let n=i[e];return typeof n=="function"?n:void 0};async function g(e,n){let r=e.toLowerCase();if(r!=="arw"&&r!=="cr2")return null;await a();let t=i[`inspect_${r}`];if(typeof t!="function")return null;let o=t(n);return o==="null"?null:JSON.parse(o)}async function m(e,n,r=1){let t=u[e.toLowerCase()];if(!t)return null;await a();try{let o=r>1?d(`decode_${t}_preview`):void 0;if(o)return s(o(n,r));let c=d(`decode_${t}_rgba`);return c?s(c(n)):null}catch{return null}}export{u as STILL_WASM_BASE,m as decodeStillWasm,l as hasStillWasm,g as inspectPhotoRawWasm};
@@ -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-3WJSWOCS.js";import"./chunk-2XQ42O7E.js";import"./chunk-M545OKDZ.js";import"./chunk-COALWMI7.js";import"./chunk-MU5AGXSH.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-67VLJJ75.js";import"./chunk-OCNKVM26.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.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{a,b}from"./chunk-JCNKPRYY.js";import"./chunk-LKX3HCRN.js";import"./chunk-PSANHDZM.js";export{b as decodeTiffWasm,a as inspectTiffWasm};
3
+ import{a,b}from"./chunk-M3DXHHD7.js";import"./chunk-4I4MV3DE.js";import"./chunk-PSANHDZM.js";export{b as decodeTiffWasm,a as inspectTiffWasm};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
+ import{$b as k,Rb as a,Sb as b,Tb as c,Ub as d,Vb as e,Wb as f,Xb as g,Yb as h,Zb as i,_b as j,ac as l,bc as m,cc as n,dc as o,ec as p,fc as q,gc as r,hc as s,ic as t}from"./chunk-65SLDY2M.js";import"./chunk-IN6XVTUS.js";import"./chunk-QNVFSA7C.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-JUJESM4P.js";import"./chunk-ZCQTIYXB.js";import"./chunk-PKKUIGZ5.js";import"./chunk-JGI5YEGH.js";import"./chunk-6C3EEZH3.js";import"./chunk-M3DXHHD7.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-REBF4U5B.js";import"./chunk-TFKKODSA.js";import"./chunk-REGL3GQB.js";import"./chunk-QPSQQEO6.js";import"./chunk-IW5M45CL.js";import"./chunk-NHWWMLZW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-4I4MV3DE.js";import"./chunk-67VLJJ75.js";import"./chunk-OCNKVM26.js";import"./chunk-HNEKQMQG.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-PSANHDZM.js";export{j as OPERATION_KINDS,a as READ_FORMATS,k as applyOperation,m as applyOperationWithSources,s as consolidate,b as detectFormat,d as detectTimelineFormat,t as judge,r as linkText,g as listClips,i as listFlags,h as listMedia,e as readTimeline,n as resolveTarget,q as routesText,c as sniffFormat,f as summarize,l as trackIndex,p as writeDestination,o as writeTimeline};
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
- import{a as b}from"./chunk-AACY2V3L.js";import{Ha as u,ba as _,la as f,sa as d,va as g}from"./chunk-LKX3HCRN.js";import"./chunk-PSANHDZM.js";function p(s){return(r,t)=>s.read(r,t)}function S(s){let r=[];for(let t of s)t.kind!=="clip"||!t.source_range||r.push({start_frame:t.source_range.start.value,dur_frames:t.source_range.duration.value,fps:t.source_range.start.rate??1});return r}var w={async inspect(s){await u();let r=s.parts[0],t=await _(p(r),r.fileSize),e=JSON.parse(t);if(!e||!e.sample_rate)return null;let a=e.byte_rate>0?e.data_length/e.byte_rate:null,m=a?Math.round(a*e.sample_rate):0,n=[{kind:"audio",codec:"pcm",rate:e.sample_rate,channels:e.channels,bit_depth:e.bits_per_sample,codec_specific:{bits_per_sample:e.bits_per_sample}}];return{id:r.filename,kind:"external",content_kind:"audio",target_url:r.filename,available_range:a?{start:{value:0,rate:e.sample_rate},duration:{value:m,rate:e.sample_rate}}:null,reel_name:null,source_timecode:e.source_timecode??null,container:"wav",codec:"pcm",size_bytes:r.fileSize,bitrate_bps:e.byte_rate*8,streams:n,vendor_metadata:e.bext?{bext:e.bext}:{},binding_state:"unbound",raw_extraction:{wav_meta:e},metadata:{}}},async extract(s){await u();let r=s.parts[0],t=JSON.parse(await f(p(r),r.fileSize));return t.length===0?null:{v:1,container:"wav",codec:"pcm",frame_count:b(t),granularity:"second",segments:t}},async sparsify(s,r){await u();let t=s.parts[0],e=await g(p(t),t.fileSize,JSON.stringify(S(r.items)),r.handles),a=JSON.parse(e);return[{filename:t.filename,fileSize:a.fileSize,structuralRanges:a.structuralRanges,essenceRanges:a.essenceRanges,trimInputs:a.trimInputs}]},async trim(s,r){await u();let t=s.parts[0],e=[];for(let n of r.items){if(n.kind!=="clip"||!n.source_range)continue;let i=n.source_range.start.rate??1,o=Math.max(0,(n.source_range.start.value-r.handles)/i),c=(n.source_range.start.value+n.source_range.duration.value+r.handles)/i;c>o&&e.push([o,c])}if(e.length===0)throw new Error("wav trim: no usable trim ranges in items");e.sort((n,i)=>n[0]-i[0]);let a=[];for(let[n,i]of e){let o=a[a.length-1];o&&n<=o[1]?o[1]=Math.max(o[1],i):a.push([n,i])}let m=[];for(let[n,[i,o]]of a.entries()){let c=await d(p(t),t.fileSize,i,o,1),l=JSON.parse(c);a.length>1&&(l.output_clip_number=n+1,l.output_clip_count=a.length,l.output_part_number=1),m.push(l)}return m}};export{w as wavFormat};
3
+ import{a as b}from"./chunk-AACY2V3L.js";import{Ha as u,ba as _,la as f,sa as d,va as g}from"./chunk-4I4MV3DE.js";import"./chunk-PSANHDZM.js";function p(s){return(r,t)=>s.read(r,t)}function S(s){let r=[];for(let t of s)t.kind!=="clip"||!t.source_range||r.push({start_frame:t.source_range.start.value,dur_frames:t.source_range.duration.value,fps:t.source_range.start.rate??1});return r}var w={async inspect(s){await u();let r=s.parts[0],t=await _(p(r),r.fileSize),e=JSON.parse(t);if(!e||!e.sample_rate)return null;let a=e.byte_rate>0?e.data_length/e.byte_rate:null,m=a?Math.round(a*e.sample_rate):0,n=[{kind:"audio",codec:"pcm",rate:e.sample_rate,channels:e.channels,bit_depth:e.bits_per_sample,codec_specific:{bits_per_sample:e.bits_per_sample}}];return{id:r.filename,kind:"external",content_kind:"audio",target_url:r.filename,available_range:a?{start:{value:0,rate:e.sample_rate},duration:{value:m,rate:e.sample_rate}}:null,reel_name:null,source_timecode:e.source_timecode??null,container:"wav",codec:"pcm",size_bytes:r.fileSize,bitrate_bps:e.byte_rate*8,streams:n,vendor_metadata:e.bext?{bext:e.bext}:{},binding_state:"unbound",raw_extraction:{wav_meta:e},metadata:{}}},async extract(s){await u();let r=s.parts[0],t=JSON.parse(await f(p(r),r.fileSize));return t.length===0?null:{v:1,container:"wav",codec:"pcm",frame_count:b(t),granularity:"second",segments:t}},async sparsify(s,r){await u();let t=s.parts[0],e=await g(p(t),t.fileSize,JSON.stringify(S(r.items)),r.handles),a=JSON.parse(e);return[{filename:t.filename,fileSize:a.fileSize,structuralRanges:a.structuralRanges,essenceRanges:a.essenceRanges,trimInputs:a.trimInputs}]},async trim(s,r){await u();let t=s.parts[0],e=[];for(let n of r.items){if(n.kind!=="clip"||!n.source_range)continue;let i=n.source_range.start.rate??1,o=Math.max(0,(n.source_range.start.value-r.handles)/i),c=(n.source_range.start.value+n.source_range.duration.value+r.handles)/i;c>o&&e.push([o,c])}if(e.length===0)throw new Error("wav trim: no usable trim ranges in items");e.sort((n,i)=>n[0]-i[0]);let a=[];for(let[n,i]of e){let o=a[a.length-1];o&&n<=o[1]?o[1]=Math.max(o[1],i):a.push([n,i])}let m=[];for(let[n,[i,o]]of a.entries()){let c=await d(p(t),t.fileSize,i,o,1),l=JSON.parse(c);a.length>1&&(l.output_clip_number=n+1,l.output_clip_count=a.length,l.output_part_number=1),m.push(l)}return m}};export{w as wavFormat};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conformtools",
3
- "version": "0.6.21",
3
+ "version": "0.6.22",
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.21",
48
- "conformtools-darwin-x64": "0.6.21",
49
- "conformtools-linux-x64": "0.6.21",
50
- "conformtools-windows-x64": "0.6.21"
47
+ "conformtools-darwin-arm64": "0.6.22",
48
+ "conformtools-darwin-x64": "0.6.22",
49
+ "conformtools-linux-x64": "0.6.22",
50
+ "conformtools-windows-x64": "0.6.22"
51
51
  }
52
52
  }
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
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,7 +0,0 @@
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,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{G as f,S as l}from"./chunk-C2ESM27Z.js";var g={prproj:"prproj","resolve-drt":"drt",aaf:"aaf",avb:"avb",otio:"otio",capcut:"capcut","flame-archive":"flame","resolve-fcpxml":"fcpxml","finalcut-fcpxml":"fcpxml","fcp-xml":"xmeml","premiere-xml":"xmeml","resolve-xml":"xmeml","baselight-blscene":"blscene"};function R(e){return e in g}var m=null;function c(){return m||(m=b()),m}async function b(){let e=await import("./timeline_core-6BRZG4LP.js"),t=(await import("./timeline_core_bg-5COJCLPG.js")).default;return await e.default({module_or_path:t}),e}async function A(e,t){let i=g[t];if(!i)throw new Error(`timelineInspect: no Rust engine for format '${t}'`);let n=await c(),r=e.name.replace(/\.[^.]+$/,""),s=(_,...y)=>n[_](...y),o;switch(i){case"prproj":o=s("inspect_prproj_json",await a(e));break;case"aaf":o=s("inspect_aaf_json",await a(e));break;case"avb":o=s("inspect_avb_json",await a(e));break;case"flame":o=s("inspect_flame_json",await a(e),r);break;case"drt":o=s("inspect_drt_json",await w(e));break;case"otio":o=s("inspect_otio_json",await e.text(),r);break;case"capcut":o=s("inspect_capcut_json",await e.text(),r);break;case"fcpxml":o=s("inspect_fcpxml_json",await e.text(),r);break;case"xmeml":o=s("inspect_xmeml_json",await e.text(),r);break;case"blscene":o=s("inspect_blscene_json",await a(e),r);break}return S(o)}var x=12*1024*1024,p=!1;function W(e){p=e}var d=null,h=8e3;async function I(){!d||p||await Promise.race([d,new Promise(e=>setTimeout(e,h))])}function u(e,t,i){if(p||e.length<=x)return e;let n=(e.length/1048576).toFixed(0),r=i?.length??0;throw r===1?new Error(`This ${t.toUpperCase()} timeline extracts to ${n} MB, past what our conversion server can hold in one pass (the ceiling is ours, not your file \u2014 a single long timeline can exceed it on its own). Get in touch and we will convert it for you while we lift the limit.`):new Error(`This ${t.toUpperCase()} selection${r?` (${r} sequences)`:""} extracts to ${n} MB, past what our conversion server can hold in one pass. Convert a few sequences at a time \u2014 one long timeline is usually about ${(x/1048576).toFixed(0)} MB. If a single timeline still will not go through, get in touch and we will convert it for you.`)}async function T(e,t,i){let n=g[t];if(!n)throw new Error(`timelineExtract: no Rust engine for format '${t}'`);switch(await I(),n){case"otio":case"capcut":case"fcpxml":case"xmeml":return{fmt:n,extract:await e.text()};case"blscene":{let s=(await c()).extract_blscene_json(await a(e));return{fmt:n,extract:u(s,n,i)}}case"drt":{let s=(await c()).extract_drt_json(await w(e));return{fmt:n,extract:u(s,n,i)}}case"prproj":{let r=await c(),s=JSON.stringify(i??[]),o=r.extract_prproj_json(await a(e),s);return{fmt:n,extract:u(o,n,i)}}case"avb":{let r=await c(),s=JSON.stringify(i??[]),o=r.extract_avb_json(await a(e),s);return{fmt:n,extract:u(o,n,i)}}case"flame":return{fmt:n,extract:u(JSON.stringify({flame_header_b64:E(v(await a(e)))}),n,i)};case"aaf":{let s=(await c())[`extract_${n}_json`](await a(e));return{fmt:n,extract:u(s,n,i)}}}}async function a(e){return new Uint8Array(await e.arrayBuffer())}function v(e){if(e[0]!==80||e[1]!==75)return e;let t=r=>r.length>=4&&r[0]===128&&r[1]===130&&r[2]===167&&r[3]===214,i=l(e,{filter:r=>!/_\d+\.seg$/.test(r.name)}),n=Object.values(i).find(t);if(!n)throw new Error("This zip holds no Flame archive header (the extension-less file next to the _1.seg).");return n}function E(e){let t="";for(let i=0;i<e.length;i+=32768)t+=String.fromCharCode(...e.subarray(i,i+32768));return btoa(t)}async function w(e){let t=l(await a(e)),i={};for(let[n,r]of Object.entries(t))n.toLowerCase().endsWith(".xml")&&(i[n]=f(r));return JSON.stringify(i)}function S(e){let t=JSON.parse(e),i=Array.isArray(t)?t:t?.timelines??t?.sequences??[],n=i.filter(s=>typeof s=="object"&&s!==null),r=i.map(s=>{if(typeof s=="string")return s;let o=s;return o?.name??o?.title??o?.id??""}).filter(s=>!!s);return{names:Array.from(new Set(r)),timelines:n}}async function k(e){let t=await c();return JSON.parse(t.drt_project_colour(e))}async function C(e){let t=await c();return JSON.parse(t.drx_grade_tree(e))}var P="X-Write-Issues";var O=8*1024;function F(e){if(!e)return[];try{let t=JSON.parse(decodeURIComponent(e));return Array.isArray(t)?t:[]}catch{return[]}}export{R as a,A as b,W as c,T as d,k as e,C as f,P as g,F as h};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- var n=class extends Error{constructor(o,r,s){super(r);this.code=o;this.data=s;this.name="ConformError"}};function u(e,t){return{content:[{type:"text",text:e}],...t?{structuredContent:{ok:!0,...t}}:{}}}var l=e=>u(e);function f(e){let t=e instanceof n?e:d(e);return{content:[{type:"text",text:`error [${t.code}]: ${t.message}`}],structuredContent:{ok:!1,code:t.code,message:t.message,...t.data?{data:t.data}:{}},isError:!0}}function d(e){let t=e instanceof Error?e.message:String(e);return/Cannot find module ['"]?[^'"\s]*\/(dist|conformtools)\/[^'"\s]+\.js['"]? imported from/.test(t)||/Cannot find module ['"]?\.\//.test(t)&&/imported from/.test(t)?new n("internal","conformtools was updated on this machine while this session was running, and the running copy can't load its own files any more. Reconnect it (Claude Code: /mcp \u2192 conformtools \u2192 Reconnect; or restart the agent app), then try again."):/unknown session_id|not found on this machine|No such file|NotFound/i.test(t)?new n("not_found",t):/unsupported|not supported|no local decoder|cannot detect/i.test(t)?new n("unsupported",t):/before the file start|past the last frame|is before|required|unknown (operation|target|verb)/i.test(t)?new n("invalid_args",t):/could not read|failed to parse|engine read failed/i.test(t)?new n("unreadable",t):/refused|coverage|never shipped/i.test(t)?new n("refused",t):/abort|cancel/i.test(t)?new n("cancelled",t):new n("engine",t)}function g(e,t){let[o,...r]=t.content,s=`[conformtools ${e}]`,a=o?[{...o,text:`${s} ${o.text}`},...r]:[{type:"text",text:s}],i=t.structuredContent;return{...t,content:a,...i&&!("text"in i)?{structuredContent:{...i,text:a.map(c=>c.text).join(`
4
- `)}}:{}}}function p(e){let{images:t,...o}=e;return t?.length?{...o,content:[...e.content,...t.map(r=>({type:"image",...r}))]}:o}export{n as a,u as b,l as c,f as d,g as e,p as f};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{readFile as S,writeFile as H,appendFile as q,stat as W,readdir as G,mkdir as _,open as U,copyFile as Y,mkdtemp as K,rm as P,chmod as V,rename as B,cp as X,statfs as Z,realpath as Q}from"node:fs/promises";import{execFile as ee,spawn as j}from"node:child_process";import{createHash as te}from"node:crypto";import{createReadStream as re,chmodSync as ne,cpSync as oe,existsSync as E,statSync as M}from"node:fs";import{homedir as se,hostname as ie,tmpdir as ae,platform as ce,release as le,arch as ue,totalmem as de,availableParallelism as me}from"node:os";import{fileURLToPath as O}from"node:url";import fe from"node:http";import pe from"node:http2";import f from"node:process";import{setTimeout as ge}from"node:timers";import{Buffer as $}from"node:buffer";import{basename as ye,dirname as we,join as h,resolve as C,sep as v}from"node:path";import{createRequire as be}from"node:module";import{basename as Tt,dirname as Dt,extname as Et,join as Mt,relative as Ct,resolve as Nt}from"node:path";{let e=globalThis.fetch,t=typeof globalThis.Deno<"u";e&&!t&&(globalThis.fetch=(async(r,o)=>{let n=typeof r=="string"?r:r instanceof URL?r.href:r.url;if(n.startsWith("file:")){let s=await S(O(n)),i=n.endsWith(".wasm")?"application/wasm":"application/octet-stream";return new Response(s,{status:200,headers:{"content-type":i}})}return e(r,o)}))}var w=e=>f.env[e];function Ie(e,t){ge(e,t).unref()}var He=()=>Number(w("CONFORM_MEMORY_GB")??0)*2**30||de(),We=()=>me(),_e=()=>f.argv.slice(2),Be=e=>f.exit(e),he=()=>f.platform,je=()=>ie(),ze=()=>w("CONFORM_PYTHON")??(he()==="win32"?"python":"python3"),Le=()=>f.arch,z=()=>`${f.platform}-${f.arch}`;function Je(e){try{return h(we(be(import.meta.url).resolve(`${xe(z())}/package.json`)),e)}catch{return null}}var xe=e=>`conformtools-${e==="win32-x64"?"windows-x64":e}`,qe=e=>`${e} is not in this package for ${z()} (conform.tools builds it for darwin-arm64, darwin-x64, linux-x64 and win32-x64)`;function Ge(){let e=f.versions.deno,t=w("CONFORM_APP_VERSION"),r=e?`deno ${e}`:`node ${f.version}`;return{platform:`${ce()} ${le()} ${ue()}`,runtime:t&&/^[0-9A-Za-z.-]{1,32}$/.test(t)?`${r} app ${t}`:r}}var ve=()=>w("CONFORM_MCP_HOME")??h(A(),".conform-mcp"),A=()=>w("HOME")??se();function Ye(e){let t=e.trim();if(t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1)),/^file:\/\//i.test(t))try{t=O(t)}catch{}return t==="~"?t=A():(t.startsWith("~/")||t.startsWith("~\\"))&&(t=h(A(),t.slice(2))),t&&C(t)+(/[\\/]$/.test(t)&&!/[\\/]$/.test(C(t))?v:"")}async function Ke(e,t){let r=await import("node:sqlite").catch(()=>null);if(r?.DatabaseSync){let n=new r.DatabaseSync(e,{readOnly:!0});try{let s=n.prepare(t);return s.setReadBigInts(!0),s.all().map(i=>Object.fromEntries(Object.entries(i).map(([c,l])=>[c,typeof l=="bigint"?Number(l):l])))}finally{n.close()}}let o=await F("sqlite3",["-readonly","-json",e,t]);if(!o.success)throw new Error(`sqlite3 ${ye(e)}: ${o.stderr.trim()||o.stdout.trim()}`);return o.stdout.trim()?JSON.parse(o.stdout):[]}var Ve=(e,t)=>e?`${e.replace(/[\\/]+$/,"")}${e.includes("\\")&&!e.includes("/")?"\\":"/"}${t}`:t;function Xe(e){let t=O(e),r=t.indexOf(`${v}deno-compile-`);if(r<0||!E(t))return t;let o=t.slice(r+1).split(v).slice(1).join(v),n=h(ve(),"bin",o);try{let s=M(t),i=E(n)?M(n):null;return(!i||s.isFile()&&(i.size!==s.size||i.mtimeMs<s.mtimeMs))&&(oe(t,n,{recursive:!0,force:!0}),s.isFile()&&ne(n,493)),n}catch{return t}}var N=null;var x=e=>N?.owns(e)?N:null;async function I(e){let t=await W(e);return{isFile:t.isFile(),isDirectory:t.isDirectory(),size:t.size,mtimeMs:t.mtimeMs}}function R(e){return x(e)?.stat(e,()=>I(e))??I(e)}async function Ze(e){try{return await R(e),!0}catch{return!1}}async function Qe(e){try{return(await R(e)).isFile}catch{return!1}}async function et(e){try{return(await R(e)).isDirectory}catch{return!1}}async function tt(e){x(e)?.guard(e,"read whole file");let t=await S(e);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}var rt=e=>S(e,"utf8"),nt=(e,t)=>H(e,t),ot=(e,t,r)=>r?.append?q(e,t):H(e,t);async function st(e){await _(e,{recursive:!0})}async function it(e,t={}){let r=Date.now()+(t.timeoutMs??5e3),o=t.staleMs??15e3;for(;;)try{await _(e);break}catch(n){if(n.code!=="EEXIST")throw n;try{if(Date.now()-(await R(e)).mtimeMs>o){await P(e,{recursive:!0,force:!0});continue}}catch{}if(Date.now()>r)break;await new Promise(s=>setTimeout(s,25))}return()=>P(e,{recursive:!0,force:!0}).catch(()=>{})}var at=e=>P(e,{force:!0}),ct=(e,t)=>V(e,t).catch(()=>{}),lt=(e,t)=>Y(e,t),ut=(e,t)=>B(e,t),dt=e=>P(e,{recursive:!0,force:!0}),mt=(e,t)=>X(e,t,{recursive:!0,verbatimSymlinks:!0});async function ft(e){try{let t=await Z(e);return Number(t.bavail)*Number(t.bsize)}catch{return null}}async function pt(e){try{return await Q(e)}catch{return null}}var gt=()=>f.ppid,yt=(e="conform-")=>K(h(ae(),e));async function*wt(e){let t=async()=>(await G(e,{withFileTypes:!0})).map(r=>({name:r.name,isFile:r.isFile(),isDirectory:r.isDirectory()}));yield*await(x(e)?.readDir(e,t)??t())}async function bt(e){x(e)?.guard(e,"read bytes");let t=await U(e,"r"),r=(await t.stat()).size;return{path:e,size:r,async readAt(o,n){let s=new Uint8Array(n),i=0;for(;i<n;){let{bytesRead:c}=await t.read(s,i,n-i,o+i);if(!c)break;i+=c}return i===n?s:s.subarray(0,i)},close:()=>t.close()}}async function ht(e){let t=await U(e,"w");return{async writeAt(r,o){let n=0;for(;n<o.length;){let{bytesWritten:s}=await t.write(o,n,o.length-n,r+n);n+=s}},truncate:r=>t.truncate(r),close:()=>t.close()}}var L=(e,t)=>{for(let r of t)x(r)?.guard(r,`${e.split(/[\\/]/).pop()} ${t[0]}`)};function F(e,t,r={}){return L(e,t),new Promise(o=>{ee(e,t,{maxBuffer:1<<30,env:r.env?{...f.env,...r.env}:void 0,timeout:r.timeoutMs},(n,s,i)=>{let c=n?.code??0;o({success:!n,code:c,stdout:String(s),stderr:String(i)})})})}var Pe="[Console]::OutputEncoding=[Text.Encoding]::UTF8;$t=@{};Get-Process|?{$_.MainWindowTitle}|%{$t[$_.Id]=$_.MainWindowTitle};ConvertTo-Json -Compress -InputObject @(Get-CimInstance Win32_Process|%{[pscustomobject]@{pid=[int]$_.ProcessId;exe=$_.ExecutablePath;cmd=$_.CommandLine;title=$t[[int]$_.ProcessId]}})";async function xt(){let e=await F("powershell.exe",["-NoProfile","-NonInteractive","-Command",Pe],{timeoutMs:3e4});return $e(e.stdout)}function $e(e){let t;try{t=JSON.parse(e.replace(/^/,"").trim()||"[]")}catch{return[]}return(Array.isArray(t)?t:[t]).flatMap(r=>{let o=r??{},n=Number(o.pid);return!Number.isInteger(n)||n<=0?[]:[{pid:n,args:String(o.cmd||o.exe||""),title:typeof o.title=="string"?o.title:""}]})}function vt(e,t,r,o={}){return L(e,t),new Promise((n,s)=>{let i=j(e,t,{env:o.env?{...f.env,...o.env}:void 0,stdio:["ignore","pipe","pipe"]}),c="";i.stdout.on("data",l=>r(l)),i.stderr.on("data",l=>{c+=new TextDecoder().decode(l)}),i.on("error",s),i.on("close",l=>n({code:l,stderr:c})),o.signal?.addEventListener("abort",()=>i.kill(),{once:!0})})}function Pt(e,t,r,o,n={}){let s=j(e,t,{stdio:["pipe","pipe","pipe"],env:n.env?{...f.env,...n.env}:void 0});s.stdin.on("error",()=>{}),s.stdout.on("data",a=>r(a)),s.stderr.on("data",a=>o?.(new TextDecoder().decode(a)));let i=new Promise(a=>{s.on("close",u=>a(u)),s.on("error",()=>a(null))}),c=[s,s.stdout,s.stderr,s.stdin],l=a=>{for(let u of c)(a?u.ref:u.unref)?.call(u)};return l(!1),{write:a=>new Promise((u,p)=>{s.stdin.write(a,m=>m?p(m):u())}),hold:l,close:()=>{try{s.stdin.end(),s.kill()}catch{}},exited:i}}async function $t(e){if(w("CONFORM_NO_BROWSER"))return!1;let[t,r]=f.platform==="darwin"?["open",[e]]:f.platform==="win32"?["cmd",["/c","start","",e.replace(/&/g,"^&")]]:["xdg-open",[e]];return(await F(t,r)).success}function Rt(e,t){let r=fe.createServer(async(o,n)=>{try{let s=[];if(o.method!=="GET"&&o.method!=="HEAD")for await(let p of o)s.push(p);let i=s.length>0,c=new Headers;for(let[p,m]of Object.entries(o.headers))m!=null&&c.set(p,Array.isArray(m)?m.join(", "):m);let l=`http://${o.headers.host??`${e.hostname}:${e.port}`}${o.url??"/"}`,a=new AbortController;n.on("close",()=>{n.writableEnded||a.abort()});let u=await t(new Request(l,{method:o.method,headers:c,body:i?$.concat(s):void 0,signal:a.signal}));if(n.statusCode=u.status,u.headers.forEach((p,m)=>n.setHeader(m,p)),u.body&&u.headers.get("content-type")?.startsWith("text/event-stream")){n.flushHeaders();let p=u.body.getReader();for(a.signal.addEventListener("abort",()=>void p.cancel(),{once:!0});;){let{value:m,done:g}=await p.read();if(g)break;n.write(m)}n.end();return}n.end($.from(await u.arrayBuffer()))}catch(s){n.statusCode=500,n.end(JSON.stringify({ok:!1,code:"internal",message:s instanceof Error?s.message:String(s)}))}});return r.listen(e.port,e.hostname,()=>{let o=r.address();e.onListen?.(typeof o=="object"&&o?o.port:e.port)}),{close:()=>r.close()}}var y=class extends Error{constructor(r,o,n){super(o);this.code=r;this.grpcStatus=n}};function kt(e,t,r,o,n){return new Promise((s,i)=>{let c=pe.connect(`http://${e}:${t}`),l=!1,a=(d,J)=>{l||(l=!0,clearTimeout(p),c.destroy(),d?i(d):s(J))},u=!1;c.on("connect",()=>{u=!0});let p=setTimeout(()=>a(u?new y("deadline",`no answer from ${e}:${t} in ${n} ms`):new y("unavailable",`${e}:${t}: no connection in ${n} ms`)),n);c.on("error",d=>a(new y("unavailable",`${e}:${t}: ${d.message}`)));let m=$.alloc(5+o.length);m.writeUInt32BE(o.length,1),m.set(o,5);let g=c.request({":method":"POST",":path":r,"content-type":"application/grpc",te:"trailers"}),T=[],b,k="",D=d=>{d["grpc-status"]!=null&&(b=String(d["grpc-status"]),k=decodeURIComponent(String(d["grpc-message"]??"")))};g.on("response",D),g.on("trailers",D),g.on("data",d=>T.push(d)),g.on("error",d=>a(new y("unavailable",`${e}:${t}: ${d.message}`))),g.on("end",()=>{if(b!=="0")return a(new y("grpc",`grpc-status ${b??"missing"}${k?`: ${k}`:""}`,b==null?void 0:Number(b)));let d=$.concat(T);if(d.length<5||d[0]!==0)return a(new y("grpc","reply is not one uncompressed gRPC message"));a(null,new Uint8Array(d.subarray(5,5+d.readUInt32BE(1))))}),g.end(m)})}async function At(e){let t=te("sha256");for await(let r of re(e))t.update(r);return t.digest("hex")}async function St(e,t,r){let o=`${t}.part`;for(let n=0;;n++){let s=0;try{s=(await W(o)).size}catch{}try{let i=await fetch(e,{headers:s?{Range:`bytes=${s}-`}:{}});if(i.status===416)break;if(!i.ok||!i.body)throw new Error(`${e} answered ${i.status}`);s&&i.status!==206&&(s=0);let c=s+Number(i.headers.get("content-length")??0),l=await U(o,s?"a":"w");try{let a=s;for await(let u of i.body)await l.write(u),a+=u.length,r?.(a,c)}finally{await l.close()}break}catch(i){if(n>=4)throw i;await new Promise(c=>setTimeout(c,2e3*(n+1)))}}await B(o,t)}function Ut(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}export{O as a,w as b,Ie as c,He as d,We as e,_e as f,Be as g,he as h,je as i,ze as j,Le as k,Je as l,qe as m,Ge as n,ve as o,A as p,Ye as q,Ke as r,Ve as s,Xe as t,R as u,Ze as v,Qe as w,et as x,tt as y,rt as z,nt as A,ot as B,st as C,it as D,at as E,ct as F,lt as G,ut as H,dt as I,mt as J,ft as K,pt as L,gt as M,yt as N,wt as O,bt as P,ht as Q,F as R,xt as S,vt as T,Pt as U,$t as V,Rt as W,y as X,kt as Y,At as Z,St as _,Ut as $,Tt as aa,Dt as ba,Et as ca,Mt as da,Ct as ea,Nt as fa};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{b as o}from"./chunk-MU5AGXSH.js";var i="0.6.21";function a(t,n){let r=t.split("-")[0].split(".").map(Number),s=n.split("-")[0].split(".").map(Number);for(let e=0;e<Math.max(r.length,s.length);e++){let l=(r[e]||0)-(s[e]||0);if(l)return l>0}return!1}var p=null;function u(){return o("CONFORM_UPDATE_CHECK")==="off"?Promise.resolve(null):p??=fetch("https://registry.npmjs.org/conformtools/latest",{signal:AbortSignal.timeout(2e3)}).then(t=>t.ok?t.json():null).then(t=>typeof t?.version=="string"?t.version:null).catch(()=>null)}var c="run npx -y conformtools@latest setup claude (or setup codex) once: it registers the server so every new session runs the newest version (npx --prefer-online), then restart the MCP client; if an old global install is shadowing it: npm rm -g conformtools";async function m(){let t=o("CONFORM_APP_VERSION");if(t)return`conform.tools app ${t}`;let n=await u();return`conformtools ${i}`+(n&&a(n,i)?` \u2014 update available: ${n} \u2192 ${c}`:"")}export{i as a,a as b,u as c,c as d,m as e};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{c as u,d as y,g as w,h}from"./chunk-BUOYYO22.js";import{d as f,i as p}from"./chunk-2XQ42O7E.js";import{a}from"./chunk-COALWMI7.js";import{b as g}from"./chunk-MU5AGXSH.js";u(!0);var b={aaf:"aaf",avb:"avb",prproj:"prproj",drt:"resolve-drt",otio:"otio",capcut:"capcut",flame:"flame-archive",fcpxml:"resolve-fcpxml",xmeml:"fcp-xml",blscene:"baselight-blscene"},R=Object.keys(b),v=new Set([502,503,504,529,546]),d=(e,o)=>`${f().supabaseUrl}/functions/v1/${e}${o}`;async function m(){let e=await p();if(!e&&g("CONFORM_ANONYMOUS_READ")==="1")return f().anonKey;if(!e)throw new a("not_signed_in","reading and writing timelines runs on conform.tools \u2014 sign in first (account_login)");return e}async function S(e,o){let t;for(let n=0;n<3;n++){try{let i=await fetch(e,o);if(!v.has(i.status)||n===2)return i;t=new Error(`status ${i.status}`)}catch(i){if(t=i,n===2)break}await new Promise(i=>setTimeout(i,1500*(n+1)))}throw new a("offline",`conform.tools is unreachable (${t instanceof Error?t.message:String(t)}) \u2014 reading and writing timelines need the network`)}async function _(e,o){let n=(await e.json().catch(()=>({})))?.error?.message??`${o} failed (${e.status})`;throw e.status===401?new a("not_signed_in",`${n} \u2014 sign in again (account_login)`):e.status===402||e.status===403?new a("not_entitled",n):new a(e.status>=500?"engine":"refused",n)}async function P(e,o){let t=b[e];if(!t)throw new a("unsupported",`'${e}' timelines are not read by conform.tools yet`);let{fmt:n,extract:i}=await y(o,t),c=JSON.stringify({format:n,source_filename:o.name,persist:!1})+`
4
- `+(typeof i=="string"?i:JSON.stringify(i)),s=await S(d("v1-timeline-canonicalize","/v1/timeline-canonicalize"),{method:"POST",headers:{"content-type":"application/x-ct-canonicalize-v1",authorization:`Bearer ${await m()}`,apikey:f().anonKey},body:c});s.ok||await _(s,"read");let l=await s.json();return JSON.stringify(l.session)}async function N(e,o){let t=await S(d("v1-write","/v1/write"),{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${await m()}`,apikey:f().anonKey,"x-engine-accept-delivery":"cdn"},body:JSON.stringify({target_format:e,session:o})});t.ok||await _(t,"write");let n=h(t.headers.get(w))??[];if(t.headers.get("x-engine-delivery")==="cdn"){let r=await t.json(),c=await fetch(r.download_url);if(!c.ok)throw new a("engine",`download failed (${c.status})`);let s=new Uint8Array(await c.arrayBuffer());if(s.byteLength!==r.size)throw new a("engine",`download incomplete: ${s.byteLength} of ${r.size} bytes`);return{body:s,contentType:r.content_type,filenameSuggestion:r.filename,issues:n,serverSession:r.session_id??void 0}}let i=t.headers.get("content-disposition")?.match(/filename="([^"]+)"/)?.[1];return{body:new Uint8Array(await t.arrayBuffer()),contentType:t.headers.get("content-type")??"application/octet-stream",filenameSuggestion:i??`timeline.${e}`,issues:n,serverSession:t.headers.get("x-session-id")??void 0}}async function j(e,o,t){try{let n={"content-type":"application/json",authorization:`Bearer ${await m()}`,apikey:f().anonKey},i=k=>d("v1-sessions",`/v1/sessions/${encodeURIComponent(e)}/original${k}`),r=await fetch(i(""),{method:"POST",headers:n,body:JSON.stringify({filename:o,content_type:"application/octet-stream"})});if(!r.ok)return!1;let{key:c,upload:s}=await r.json();return(await fetch(s.url,{method:s.method??"PUT",headers:s.headers??{"content-type":"application/octet-stream"},body:t})).ok?(await fetch(i("/complete"),{method:"POST",headers:n,body:JSON.stringify({key:c})})).ok:!1}catch{return!1}}export{R as a,P as b,N as c,j as d};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
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,xc as o}from"./chunk-AY72AUHE.js";import"./chunk-IN6XVTUS.js";import"./chunk-5XJVAA6N.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-QJPOC4SW.js";import"./chunk-Z42CP7YT.js";import"./chunk-PENDVYIL.js";import"./chunk-2WD3MDPB.js";import"./chunk-OR6IMPAS.js";import"./chunk-JCNKPRYY.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-I6WBZBGN.js";import"./chunk-WW6XAQKM.js";import"./chunk-CXOK4SF6.js";import"./chunk-ZAL7Y5VZ.js";import"./chunk-VG73BE6N.js";import"./chunk-BUOYYO22.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-LKX3HCRN.js";import"./chunk-3WJSWOCS.js";import"./chunk-2XQ42O7E.js";import"./chunk-M545OKDZ.js";import"./chunk-COALWMI7.js";import"./chunk-MU5AGXSH.js";import"./chunk-PSANHDZM.js";export{k as ASPECTS,a as INPUT_SCALING,g as SIZING_TARGETS,j as alignText,i as alignTimeline,l as aspectOf,m as blankingForAspect,n as blankingQc,o as blankingText,f as cropUnderRef,c as inputFitRatio,h as offlineLane,d as resolveProps,b as scalingOf,e as underRef};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a,b,c,d}from"./chunk-VG73BE6N.js";import"./chunk-BUOYYO22.js";import"./chunk-C2ESM27Z.js";import"./chunk-2XQ42O7E.js";import"./chunk-M545OKDZ.js";import"./chunk-COALWMI7.js";import"./chunk-MU5AGXSH.js";import"./chunk-PSANHDZM.js";export{a as HOSTED_READ_KEYS,b as readHosted,d as shareOriginal,c as writeHosted};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
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-XAUMTGJZ.js";import"./chunk-X7C4YS2J.js";import"./chunk-AY72AUHE.js";import"./chunk-IN6XVTUS.js";import"./chunk-5XJVAA6N.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-P6MSAFNR.js";import"./chunk-QJPOC4SW.js";import"./chunk-Z42CP7YT.js";import"./chunk-PENDVYIL.js";import"./chunk-2WD3MDPB.js";import"./chunk-OR6IMPAS.js";import"./chunk-JCNKPRYY.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-I6WBZBGN.js";import"./chunk-WW6XAQKM.js";import"./chunk-CXOK4SF6.js";import"./chunk-ZAL7Y5VZ.js";import"./chunk-VG73BE6N.js";import"./chunk-BUOYYO22.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-LKX3HCRN.js";import"./chunk-3WJSWOCS.js";import"./chunk-2XQ42O7E.js";import"./chunk-M545OKDZ.js";import"./chunk-COALWMI7.js";import"./chunk-MU5AGXSH.js";import"./chunk-PSANHDZM.js";export{a as AVID_SETUP,b as FLAME_SETUP,d as adapter,c as setAdapter};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as N}from"./chunk-AACY2V3L.js";import{b as $}from"./chunk-WW6XAQKM.js";import{b as J}from"./chunk-CXOK4SF6.js";import{Ha as l,M,R as P,b as U,ca as D,da as T,e as B,ea as C,fa as E,g as S,ga as L,ia as O,ra as V,ua as W,w as k,wa as G}from"./chunk-LKX3HCRN.js";import"./chunk-PSANHDZM.js";var z=new Uint8Array([6,14,43,52,2,5,1,1,13,1,2,1,1,17,1,0]);function oe(t){e:for(let r=t.length-z.length;r>=0;r--){for(let e=0;e<z.length;e++)if(t[r+e]!==z[e])continue e;return r}return-1}function j(t,r){if(r>=t.byteLength)return[null,0];let e=t.getUint8(r);if(e<128)return[e,1];let n=e&127;if(n===0||n>8||r+1+n>t.byteLength)return[null,1];let a=0;for(let i=0;i<n;i++)a=a*256+t.getUint8(r+1+i);return[a,1+n]}function b(t,r){let e=t.getUint32(r,!1),n=t.getUint32(r+4,!1);return e*4294967296+n}async function Z(t){let r=t.fileSize,e=[];if(r<1024)return e;let a=Math.max(0,r-65536),i=r-a,o=await t.read(a,i);e.push({offset:a,length:i});let s=oe(o);if(s<0)return e;let c=new DataView(o.buffer,o.byteOffset,o.byteLength),[f,re]=j(c,s+16);if(f===null||f<16||f>65536)return e;let F=s+16+re;if(F+f>o.length)return e;let A=[],te=new DataView(o.buffer,o.byteOffset+F,f),g=Math.floor((f-4)/12);if(g<1||g>4096)return e;for(let u=0;u<g;u++){let d=b(te,u*12+4);d>=0&&d<r&&A.push(d)}for(let u of A){let d=Math.min(256,r-u),p=await t.read(u,d);if(p.length<80)continue;let _=new DataView(p.buffer,p.byteOffset,p.byteLength),[R,v]=j(_,16);if(R===null)continue;let m=16+v,y,x;if(p.length<m+64){let ie=Math.min(m+64,r-u),h=await t.read(u,ie);if(h.length<m+64)continue;let I=new DataView(h.buffer,h.byteOffset,h.byteLength);y=b(I,m+32),x=b(I,m+40)}else y=b(_,m+32),x=b(_,m+40);let ne=u+16+v+R+y+x,ae=Math.min(ne+65536,r)-u;e.push({offset:u,length:ae})}return e}function H(t,r){let e=[];for(let n of t){if(n.kind!=="clip"||!n.source_range)continue;let a=n.source_range.start.value,i=n.source_range.duration.value,o=Math.max(0,Math.floor(a)-r),s=Math.floor(a+i-1)+r;s>=o&&e.push({first_frame:o,last_frame:s})}return e}function se(t,r){let e=[...t].sort((i,o)=>i.offset-o.offset),n=[],a=0;for(let i of e)i.offset>a&&n.push({offset:a,length:i.offset-a}),a=Math.max(a,i.offset+i.length);return a<r&&n.push({offset:a,length:r-a}),n}async function q(t,r,e){let n=H(r,0);if(n.length===0)throw new Error("planMxfTrimsFromItems: no usable trim ranges in items");await l();let a=(o,s)=>t.read(o,s),i=await $(n,e,(o,s)=>V(a,t.fileSize,o,s));return i.map((o,s)=>{let c=JSON.parse(o);return i.length>1&&(c.output_clip_number=s+1,c.output_clip_count=i.length,c.output_part_number=1),c})}async function K(t,r,e){await l();let n=H(r,e),i=await W((s,c)=>t.read(s,c),t.fileSize,JSON.stringify(n));if(i!=="null")return JSON.parse(i);console.warn(`[mxf] no parseable index \u2014 shipping the WHOLE file (${t.fileSize} bytes). The cut's ${n.length} range(s) cannot be addressed; nothing is trimmed.`);let o=(await Z(t)).map(s=>({offset:s.offset,length:s.length}));return{fileSize:t.fileSize,structuralRanges:o,essenceRanges:se(o,t.fileSize),trimInputs:n,wholeFileFallback:!0}}async function Q(t){await l();let e=await G((n,a)=>t.read(n,a),t.fileSize);return JSON.parse(e)}function w(t){return(r,e)=>t.read(r,e)}var Me={async inspect(t){let r=t.parts[0],e=await Q(r);if(!e)return null;let n=e.timecode??null,a=n&&n.fps_denominator>0?n.fps_numerator/n.fps_denominator:null,i=e.width??null,o=e.height??null,s=e.inner_codec==="mpeg2"||e.inner_codec==="dv"?e.inner_codec:null;return{id:r.filename,kind:"external",target_url:r.filename,available_range:a&&e.frame_count?{start:{value:0,rate:a},duration:{value:e.frame_count,rate:a}}:null,reel_name:null,source_timecode:n?.display??null,source_fps:a,source_resolution_w:i,source_resolution_h:o,container:"mxf",codec:s,size_bytes:r.fileSize,streams:[...i||o||a?[{kind:"video",codec:s,width:i??void 0,height:o??void 0,rate:a??void 0,codec_specific:null}]:[],...e.audio?[{kind:"audio",codec:e.audio.codec_fourcc,channels:e.audio.channels??void 0,rate:e.audio.sample_rate??void 0,bit_depth:e.audio.bit_depth??void 0,codec_specific:{fourcc:e.audio.codec_fourcc}}]:[]],decode_provenance:e.decode_provenance??null,vendor_metadata:{frame_count:e.frame_count,...n?{drop_frame:n.drop_frame}:{},...e.inner_codec?{inner_codec:e.inner_codec}:{},...e.truncated?{truncated:!0}:{}},binding_state:"unbound",raw_extraction:{mxf_probe:e},metadata:{}}},async extract(t){await l();let r=t.parts[0],e=JSON.parse(await O(w(r),r.fileSize));return e.length===0?null:{v:1,container:"mxf",codec:"mxf",frame_count:N(e),granularity:"frame",segments:e}},async sparsify(t,r){let e=t.parts[0],n=await K(e,r.items,r.handles);return[{filename:e.filename,fileSize:n.fileSize,structuralRanges:n.structuralRanges,essenceRanges:n.essenceRanges,trimInputs:n.trimInputs,wholeFileFallback:n.wholeFileFallback}]},async trim(t,r){let e=t.parts[0];return q(e,r.items,r.handles)},async decode(t,r,e){await l();let n=t.parts[0],a=w(n),i=await ee(t),o=e.detail==="coarse",s;if(i==="arriraw")s=await S(a,n.fileSize,r,o?"preview:4":"full");else if(i==="arriraw-alev3")s=await B(a,n.fileSize,r,o?"preview:4":"full");else if(i==="dnxhr")s=await M(a,n.fileSize,r,o?"preview":"full");else if(i==="xocn")s=await P(a,n.fileSize,r,o?"preview":"full");else if(i==="prores")s=await k(a,n.fileSize,r,o?"preview":"full");else throw new Error(`mxf decode: no decoder for inner codec '${i}'`);let c=new DataView(s.buffer,s.byteOffset,8);return{width:c.getUint32(0,!0),height:c.getUint32(4,!0),rgba:s.slice(8)}},async decode16(t,r){await l();let e=t.parts[0],n=w(e),a=await ee(t),i;try{if(a==="arriraw"){let o=await ue(t,r);if(o)return o;i=await S(n,e.fileSize,r,"rgb16")}else if(a==="dnxhr")i=await M(n,e.fileSize,r,"rgb16");else if(a==="xocn")i=await P(n,e.fileSize,r,"rgb16");else throw new Error(`mxf decode16: no decoder for inner codec '${a}'`)}catch(o){throw fe(o,a)}return J(i)}};function fe(t,r){let e=typeof t=="string"?t:t instanceof Error?t.message:"";return/has no 16-bit decoder|no rgb16 tier/.test(e)?new Error(`mxf ${r}: has no 16-bit decoder \u2014 ${e}`):t}var X=new WeakMap;async function ue(t,r){if(!!0)return null;try{let e=await import("./arriraw-PS6V532Y.js");if(!await e.arrirawGpuAvailable())return null;let{parseArrirawGpuPayload:n,arrirawFrameToRgb16:a}=await import("./clip-state-B6JOX3JE.js"),i=t.parts[0],o=X.get(t)??null,s=await U(w(i),i.fileSize,r,o?.key),c=n(s,o);if(!c)return null;X.set(t,{key:c.key,state:c.state});let f=await e.decodeArrirawFrameGpu(c.essence,c.state);return f?{width:f.width,height:f.height,rgb16:a(f)}:null}catch{return null}}var Y=new WeakMap;async function ee(t){let r=Y.get(t);if(r)return r;await l();let e=t.parts[0],n=w(e),a="mxf";return await T(n,e.fileSize)?a="arriraw":await D(n,e.fileSize)?a="arriraw-alev3":await E(n,e.fileSize)?a="dnxhr":await L(n,e.fileSize)?a="xocn":await C(n,e.fileSize)&&(a="prores"),Y.set(t,a),a}export{Me as mxfFormat};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{$b as k,Rb as a,Sb as b,Tb as c,Ub as d,Vb as e,Wb as f,Xb as g,Yb as h,Zb as i,_b as j,ac as l,bc as m,cc as n,dc as o,ec as p,fc as q,gc as r,hc as s,ic as t}from"./chunk-AY72AUHE.js";import"./chunk-IN6XVTUS.js";import"./chunk-5XJVAA6N.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-QJPOC4SW.js";import"./chunk-Z42CP7YT.js";import"./chunk-PENDVYIL.js";import"./chunk-2WD3MDPB.js";import"./chunk-OR6IMPAS.js";import"./chunk-JCNKPRYY.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-I6WBZBGN.js";import"./chunk-WW6XAQKM.js";import"./chunk-CXOK4SF6.js";import"./chunk-ZAL7Y5VZ.js";import"./chunk-VG73BE6N.js";import"./chunk-BUOYYO22.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-LKX3HCRN.js";import"./chunk-3WJSWOCS.js";import"./chunk-2XQ42O7E.js";import"./chunk-M545OKDZ.js";import"./chunk-COALWMI7.js";import"./chunk-MU5AGXSH.js";import"./chunk-PSANHDZM.js";export{j as OPERATION_KINDS,a as READ_FORMATS,k as applyOperation,m as applyOperationWithSources,s as consolidate,b as detectFormat,d as detectTimelineFormat,t as judge,r as linkText,g as listClips,i as listFlags,h as listMedia,e as readTimeline,n as resolveTarget,q as routesText,c as sniffFormat,f as summarize,l as trackIndex,p as writeDestination,o as writeTimeline};