cueframe 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # cueframe
2
+
3
+ Agent-native CLI for **CueFrame** — turn media into rendered video from the
4
+ terminal. Every command speaks `--json` (an NDJSON event stream) and the binary
5
+ self-describes via `cueframe describe --json`, so agents can drive it without
6
+ guesswork.
7
+
8
+ > **Preview release.** Early-access build for invited testers, connected to the
9
+ > hosted CueFrame service.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npx cueframe@latest --help # zero-install
15
+ # or
16
+ npm i -g cueframe # global `cueframe`
17
+ ```
18
+
19
+ ## Authenticate
20
+
21
+ ```bash
22
+ cueframe auth <cf_test_… key> # static API key (CI / headless)
23
+ # or
24
+ cueframe login # OAuth device flow (browser)
25
+ ```
26
+
27
+ The key can also be supplied via the `CUEFRAME_API_KEY` environment variable.
28
+
29
+ ## Quick start — upload → author → render
30
+
31
+ ```bash
32
+ # 1. Register media (video / image / audio)
33
+ cueframe upload ./source.mp4 --json # → mediaItemId
34
+
35
+ # 2. Create a project (sets aspect / format)
36
+ cueframe project create -n promo -a 9:16 --json # → projectId
37
+
38
+ # 3. Author the composition — tracks of clips, per-clip reframe/trim,
39
+ # optional captions. The composition is the source of truth.
40
+ cueframe composition put <projectId> -b @composition.json
41
+
42
+ # 4. Render the saved composition to MP4 (queues, SSE-watches, downloads)
43
+ cueframe render <projectId> -o out.mp4 --json
44
+ ```
45
+
46
+ `render` takes only a project id and renders whatever composition is saved on
47
+ it — no clip suggestion required. Run `cueframe describe --json` for the full
48
+ composition schema and every command + flag.
49
+
50
+ ## Let CueFrame pick the clip (podcast → short)
51
+
52
+ ```bash
53
+ cueframe upload ./long.mp4 --analyze --json # media + AI clip suggestions
54
+ cueframe clips <mediaItemId> --json # list suggestions (sug_…)
55
+ cueframe project create -n short -a 9:16 --from-suggestion <sug_…> --json
56
+ cueframe render <projectId> -o short.mp4 --json
57
+ ```
58
+
59
+ Both paths converge on `render`; the suggestion on-ramp just authors the
60
+ composition for you instead of you hand-writing it.
61
+
62
+ ## Install the agent skill
63
+
64
+ Drop the usage skill into your agent so Claude Code / Cursor / Codex know how to
65
+ drive the CLI:
66
+
67
+ ```bash
68
+ cueframe install # → ~/.claude/skills/cueframe-cli
69
+ ```
70
+
71
+ ## For agents
72
+
73
+ - **`--json` everywhere** — NDJSON lifecycle: `<verb>_prepare → <verb>_progress* → <verb>_complete | error`, plus a non-zero exit on failure.
74
+ - **`cueframe describe --json`** — the full command tree as structured JSON.
75
+ - **`cueframe api <METHOD> <path>`** — raw escape hatch over the v1 API.
76
+
77
+ ## Common commands
78
+
79
+ | Need to… | Command |
80
+ |---|---|
81
+ | List projects | `cueframe list` |
82
+ | Read a composition + ETag | `cueframe composition get <projectId> --json` |
83
+ | Write a composition | `cueframe composition put <projectId> -b @comp.json` |
84
+ | Export to Final Cut / Premiere | `cueframe export fcpxml \| premiere <projectId> -s <sug_…> --wait -o cut.zip` |
85
+ | Validate without mutating | append `--dry-run` |
86
+
87
+ ---
88
+
89
+ © CueFrame — preview release.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{A as a}from"./chunk-KEYFXLX4.js";export{a as analyzeCommand};
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ var Ho=Object.defineProperty;var ze=(n,e)=>{for(var s in e)Ho(n,s,{get:e[s],enumerable:!0})};var q=class extends Error{status;code;details;requestId;constructor(e,s,i){super(s.message),this.name="ApiError",this.status=e,this.code=s.code,this.details=s.details,this.requestId=i}},K={baseUrl:""};function Fe(n){return K={timeoutMs:3e4,...n},K}function qe(){return K}function Qo(n,e){return/^https?:\/\//.test(e)?e:n.replace(/\/$/,"")+(e.startsWith("/")?e:`/${e}`)}async function He(n,e={}){if(!K.baseUrl)throw new Error("@cueframe/sdk: createClient({baseUrl}) must be called before issuing requests.");let s=K.fetch??fetch,i=Qo(K.baseUrl,n),a=new Headers({accept:"application/json"});for(let[_,$]of Object.entries(K.headers??{}))a.set(_,$);e.headers&&new Headers(e.headers).forEach((_,$)=>a.set($,_)),K.apiKey&&!a.has("authorization")&&a.set("authorization",`Bearer ${K.apiKey}`);let d=new AbortController,c=setTimeout(()=>d.abort(),K.timeoutMs??3e4),l=e.signal??d.signal,g;try{g=await s(i,{...e,headers:a,signal:l})}finally{clearTimeout(c)}let z={};g.headers.forEach((_,$)=>{z[$.toLowerCase()]=_});let O=null;if(g.status!==204)if((g.headers.get("content-type")??"").includes("application/json"))try{O=await g.json()}catch{O=null}else O=await g.text();return{status:g.status,statusText:g.statusText,headers:z,body:O,requestId:z["x-request-id"]}}async function v(n,e={}){let s=await He(n,e);if(s.status>=400){let i;throw s.body&&typeof s.body=="object"&&"error"in s.body?i=s.body.error??{code:"unknown",message:s.statusText}:i={code:"unknown",message:s.statusText},new q(s.status,i,s.requestId)}if(s.status!==204)return s.body}var et={media_not_ready:"Media is still processing. Wait for the `media.transcribed` webhook or retry after ~30s.",suggestions_already_complete:"Suggestions already exist for this media item. To re-run, call DELETE /v1/media/:id/suggestions first to reset state.",precondition_required:"Fetch the resource with GET first to obtain its ETag, then resend the write with `If-Match: <etag>`. `cueframe composition get` returns one for you.",stale_etag:"Resource was modified since your last GET \u2014 `details.currentEtag` is the value to thread next. Re-GET (or run `cueframe composition get`) and rebase your edits before retrying.",conflict:"ETag mismatch \u2014 the resource was modified since your last GET. Re-fetch and merge before retrying.",media_in_use:"Media is referenced by other resources. See `details.projectIds` and `details.sessionIds` \u2014 remove those references before deleting.",session_in_use:"Session is referenced by a composition. See `details.projectIds` \u2014 remove those references before deleting.",render_not_cancellable:"Render is already in a terminal state (complete / error / cancelled) and cannot be cancelled.",rate_limited:"Rate limit exceeded. Back off using the `retry-after` response header.",invalid_composition:"Composition violates an invariant (see `details`). Common ones: clip_source_track_kind_mismatch, track_clips_overlap, transition_no_predecessor.",clip_not_found:"The clip suggestion publicId doesn't exist in this org. Run `cueframe clips <mediaItemId>` to enumerate valid sug_* ids.",service_unavailable:"Upstream pipeline is unavailable. Retry shortly; if persistent, the worker is down \u2014 check status / ops dashboards.",payment_required:"The request exceeds a billing limit. For generation, the estimated cost is over the per-call ceiling (see `details.estimateUsd` / `details.ceilingUsd`) \u2014 lower the requested duration or raise the ceiling."};function Ue(n){return n instanceof q?et[n.code]??null:null}async function*ot(n,e,s){let i=qe();if(!i?.baseUrl)throw new Error(`@cueframe/sdk: createClient({baseUrl}) must be called before ${e}.`);let a=i.baseUrl.replace(/\/$/,"")+n,d=new Headers({accept:"text/event-stream",...i.headers??{}});i.apiKey&&!d.has("authorization")&&d.set("authorization",`Bearer ${i.apiKey}`);let l=await(i.fetch??fetch)(a,{method:"GET",headers:d,signal:s.signal});if(!l.ok){let _;try{_=(await l.json()).error??{code:"unknown",message:l.statusText}}catch{_={code:"unknown",message:l.statusText}}throw new q(l.status,_,l.headers.get("x-request-id")??void 0)}if(!l.body)throw new Error("SSE response has no body");let g=l.body.getReader(),z=new TextDecoder("utf-8"),O="";try{for(;;){let{value:_,done:$}=await g.read();if($)break;O+=z.decode(_,{stream:!0});let Y=O.indexOf(`
3
+
4
+ `);for(;Y!==-1;){let Xo=O.slice(0,Y);O=O.slice(Y+2);let Xe=tt(Xo);Xe&&(yield Xe),Y=O.indexOf(`
5
+
6
+ `)}}}finally{try{g.releaseLock()}catch{}}}function tt(n){if(!n.trim())return null;let e=null,s=[];for(let i of n.split(`
7
+ `)){if(!i||i.startsWith(":"))continue;let a=i.indexOf(":");if(a===-1)continue;let d=i.slice(0,a),c=i.slice(a+1).replace(/^ /,"");d==="event"?e=c:d==="data"&&s.push(c)}return!e||s.length===0?null:{event:e,data:s.join(`
8
+ `)}}async function*nt(n,e,s={}){let i=`/v1/projects/${encodeURIComponent(n)}/renders/${encodeURIComponent(e)}/stream`;for await(let a of ot(i,"iterRenderEvents",s)){let d=rt(a);d&&(yield d)}}function rt(n){let{event:e,data:s}=n;if(s===null||e!=="progress"&&e!=="complete"&&e!=="error")return null;let i;try{i=JSON.parse(s)}catch{return null}return{event:e,data:i}}var be={};ze(be,{createMediaUpload:()=>it,deleteMedia:()=>mt,generateMedia:()=>dt,getCreateMediaUploadUrl:()=>Qe,getDeleteMediaUrl:()=>no,getGenerateMediaUrl:()=>oo,getGetMediaContextUrl:()=>io,getGetMediaPerformanceUrl:()=>co,getGetMediaTranscriptUrl:()=>so,getGetMediaUrl:()=>ro,getImportMediaUrl:()=>to,getListMediaSuggestionsUrl:()=>ao,getListMediaUrl:()=>eo,getMedia:()=>ct,getMediaContext:()=>ut,getMediaPerformance:()=>yt,getMediaTranscript:()=>lt,getResetMediaSuggestionsUrl:()=>mo,getTriggerMediaSuggestionsUrl:()=>po,importMedia:()=>pt,listMedia:()=>at,listMediaSuggestions:()=>ft,resetMediaSuggestions:()=>xt,triggerMediaSuggestions:()=>gt});var Qe=()=>"/v1/media",it=async(n,e)=>v(Qe(),{...e,method:"POST",headers:{"Content-Type":"application/json",...e?.headers},body:JSON.stringify(n)}),eo=()=>"/v1/media",at=async n=>v(eo(),{...n,method:"GET"}),oo=()=>"/v1/media/generate",dt=async(n,e)=>v(oo(),{...e,method:"POST",headers:{"Content-Type":"application/json",...e?.headers},body:JSON.stringify(n)}),to=()=>"/v1/media/import",pt=async(n,e)=>v(to(),{...e,method:"POST",headers:{"Content-Type":"application/json",...e?.headers},body:JSON.stringify(n)}),no=n=>`/v1/media/${n}`,mt=async(n,e)=>v(no(n),{...e,method:"DELETE"}),ro=n=>`/v1/media/${n}`,ct=async(n,e)=>v(ro(n),{...e,method:"GET"}),so=n=>`/v1/media/${n}/transcript`,lt=async(n,e)=>v(so(n),{...e,method:"GET"}),io=n=>`/v1/media/${n}/context`,ut=async(n,e)=>v(io(n),{...e,method:"GET"}),ao=n=>`/v1/media/${n}/suggestions`,ft=async(n,e)=>v(ao(n),{...e,method:"GET"}),po=n=>`/v1/media/${n}/suggestions`,gt=async(n,e)=>v(po(n),{...e,method:"POST"}),mo=n=>`/v1/media/${n}/suggestions`,xt=async(n,e)=>v(mo(n),{...e,method:"DELETE"}),co=n=>`/v1/media/${n}/performance`,yt=async(n,e)=>v(co(n),{...e,method:"GET"});var yo={};ze(yo,{createProject:()=>bt,deleteProject:()=>St,getCreateProjectUrl:()=>uo,getDeleteProjectUrl:()=>xo,getGetProjectUrl:()=>fo,getListProjectsUrl:()=>lo,getPatchProjectUrl:()=>go,getProject:()=>ht,listProjects:()=>zt,patchProject:()=>Ct});var lo=()=>"/v1/projects",zt=async n=>v(lo(),{...n,method:"GET"}),uo=()=>"/v1/projects",bt=async(n,e)=>v(uo(),{...e,method:"POST",headers:{"Content-Type":"application/json",...e?.headers},body:JSON.stringify(n)}),fo=n=>`/v1/projects/${n}`,ht=async(n,e)=>v(fo(n),{...e,method:"GET"}),go=n=>`/v1/projects/${n}`,Ct=async(n,e,s)=>v(go(n),{...s,method:"PATCH",headers:{"Content-Type":"application/json",...s?.headers},body:JSON.stringify(e)}),xo=n=>`/v1/projects/${n}`,St=async(n,e)=>v(xo(n),{...e,method:"DELETE"});var Oo={};ze(Oo,{cancelRender:()=>Rt,createRender:()=>It,getCancelRenderUrl:()=>Co,getCreateRenderUrl:()=>zo,getGetRenderUrl:()=>ho,getListProjectRendersUrl:()=>bo,getRefreshRenderUrlUrl:()=>Io,getRender:()=>Ot,getRetryRenderUrl:()=>So,getStreamRenderUrl:()=>vo,listProjectRenders:()=>vt,refreshRenderUrl:()=>jt,retryRender:()=>kt,streamRender:()=>Mt});var zo=n=>`/v1/projects/${n}/renders`,It=async(n,e,s)=>v(zo(n),{...s,method:"POST",headers:{"Content-Type":"application/json",...s?.headers},body:JSON.stringify(e)}),bo=n=>`/v1/projects/${n}/renders`,vt=async(n,e)=>v(bo(n),{...e,method:"GET"}),ho=(n,e)=>`/v1/projects/${n}/renders/${e}`,Ot=async(n,e,s)=>v(ho(n,e),{...s,method:"GET"}),Co=(n,e)=>`/v1/projects/${n}/renders/${e}/cancel`,Rt=async(n,e,s)=>v(Co(n,e),{...s,method:"POST"}),So=(n,e)=>`/v1/projects/${n}/renders/${e}/retry`,kt=async(n,e,s)=>v(So(n,e),{...s,method:"POST"}),Io=(n,e)=>`/v1/projects/${n}/renders/${e}/refresh-url`,jt=async(n,e,s)=>v(Io(n,e),{...s,method:"POST"}),vo=(n,e)=>`/v1/projects/${n}/renders/${e}/stream`,Mt=async(n,e,s)=>v(vo(n,e),{...s,method:"GET"});var Mo={};ze(Mo,{createFcpxmlExport:()=>Tt,createPremiereExport:()=>_t,getCreateFcpxmlExportUrl:()=>Ro,getCreatePremiereExportUrl:()=>ko,getExport:()=>wt,getGetExportUrl:()=>jo});var Ro=n=>`/v1/projects/${n}/exports/fcpxml`,Tt=async(n,e,s)=>v(Ro(n),{...s,method:"POST",headers:{"Content-Type":"application/json",...s?.headers},body:JSON.stringify(e)}),ko=n=>`/v1/projects/${n}/exports/premiere`,_t=async(n,e,s)=>v(ko(n),{...s,method:"POST",headers:{"Content-Type":"application/json",...s?.headers},body:JSON.stringify(e)}),jo=(n,e)=>`/v1/projects/${n}/exports/${e}`,wt=async(n,e,s)=>v(jo(n,e),{...s,method:"GET"});var Ao={};ze(Ao,{createSession:()=>At,deleteSession:()=>qt,getCreateSessionUrl:()=>_o,getDeleteSessionUrl:()=>Po,getGetMuxJobUrl:()=>Eo,getGetSessionUrl:()=>wo,getListSessionsUrl:()=>To,getMuxJob:()=>$t,getSession:()=>Ft,getTriggerMuxJobUrl:()=>Bo,listSessions:()=>Et,triggerMuxJob:()=>Ut});var To=()=>"/v1/sessions",Et=async n=>v(To(),{...n,method:"GET"}),_o=()=>"/v1/sessions",At=async(n,e)=>v(_o(),{...e,method:"POST",headers:{"Content-Type":"application/json",...e?.headers},body:JSON.stringify(n)}),wo=n=>`/v1/sessions/${n}`,Ft=async(n,e)=>v(wo(n),{...e,method:"GET"}),Po=n=>`/v1/sessions/${n}`,qt=async(n,e)=>v(Po(n),{...e,method:"DELETE"}),Bo=n=>`/v1/sessions/${n}/mux-job`,Ut=async(n,e)=>v(Bo(n),{...e,method:"POST"}),Eo=n=>`/v1/sessions/${n}/mux-job`,$t=async(n,e)=>v(Eo(n),{...e,method:"GET"});var T;(function(n){n.assertEqual=a=>{};function e(a){}n.assertIs=e;function s(a){throw new Error}n.assertNever=s,n.arrayToEnum=a=>{let d={};for(let c of a)d[c]=c;return d},n.getValidEnumValues=a=>{let d=n.objectKeys(a).filter(l=>typeof a[a[l]]!="number"),c={};for(let l of d)c[l]=a[l];return n.objectValues(c)},n.objectValues=a=>n.objectKeys(a).map(function(d){return a[d]}),n.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let d=[];for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&d.push(c);return d},n.find=(a,d)=>{for(let c of a)if(d(c))return c},n.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function i(a,d=" | "){return a.map(c=>typeof c=="string"?`'${c}'`:c).join(d)}n.joinValues=i,n.jsonStringifyReplacer=(a,d)=>typeof d=="bigint"?d.toString():d})(T||(T={}));var Fo;(function(n){n.mergeShapes=(e,s)=>({...e,...s})})(Fo||(Fo={}));var C=T.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),D=n=>{switch(typeof n){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(n)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(n)?C.array:n===null?C.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?C.promise:typeof Map<"u"&&n instanceof Map?C.map:typeof Set<"u"&&n instanceof Set?C.set:typeof Date<"u"&&n instanceof Date?C.date:C.object;default:return C.unknown}};var f=T.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var A=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}format(e){let s=e||function(d){return d.message},i={_errors:[]},a=d=>{for(let c of d.issues)if(c.code==="invalid_union")c.unionErrors.map(a);else if(c.code==="invalid_return_type")a(c.returnTypeError);else if(c.code==="invalid_arguments")a(c.argumentsError);else if(c.path.length===0)i._errors.push(s(c));else{let l=i,g=0;for(;g<c.path.length;){let z=c.path[g];g===c.path.length-1?(l[z]=l[z]||{_errors:[]},l[z]._errors.push(s(c))):l[z]=l[z]||{_errors:[]},l=l[z],g++}}};return a(this),i}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,T.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){let s={},i=[];for(let a of this.issues)if(a.path.length>0){let d=a.path[0];s[d]=s[d]||[],s[d].push(e(a))}else i.push(e(a));return{formErrors:i,fieldErrors:s}}get formErrors(){return this.flatten()}};A.create=n=>new A(n);var Xt=(n,e)=>{let s;switch(n.code){case f.invalid_type:n.received===C.undefined?s="Required":s=`Expected ${n.expected}, received ${n.received}`;break;case f.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(n.expected,T.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:s=`Unrecognized key(s) in object: ${T.joinValues(n.keys,", ")}`;break;case f.invalid_union:s="Invalid input";break;case f.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${T.joinValues(n.options)}`;break;case f.invalid_enum_value:s=`Invalid enum value. Expected ${T.joinValues(n.options)}, received '${n.received}'`;break;case f.invalid_arguments:s="Invalid function arguments";break;case f.invalid_return_type:s="Invalid function return type";break;case f.invalid_date:s="Invalid date";break;case f.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(s=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?s=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?s=`Invalid input: must end with "${n.validation.endsWith}"`:T.assertNever(n.validation):n.validation!=="regex"?s=`Invalid ${n.validation}`:s="Invalid";break;case f.too_small:n.type==="array"?s=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?s=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?s=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?s=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?s=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:s="Invalid input";break;case f.too_big:n.type==="array"?s=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?s=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?s=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?s=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?s=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:s="Invalid input";break;case f.custom:s="Invalid input";break;case f.invalid_intersection_types:s="Intersection results could not be merged";break;case f.not_multiple_of:s=`Number must be a multiple of ${n.multipleOf}`;break;case f.not_finite:s="Number must be finite";break;default:s=e.defaultError,T.assertNever(n)}return{message:s}},X=Xt;var Ht=X;function he(){return Ht}var Be=n=>{let{data:e,path:s,errorMaps:i,issueData:a}=n,d=[...s,...a.path||[]],c={...a,path:d};if(a.message!==void 0)return{...a,path:d,message:a.message};let l="",g=i.filter(z=>!!z).slice().reverse();for(let z of g)l=z(c,{data:e,defaultError:l}).message;return{...a,path:d,message:l}};function b(n,e){let s=he(),i=Be({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,s,s===X?void 0:X].filter(a=>!!a)});n.common.issues.push(i)}var w=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){let i=[];for(let a of s){if(a.status==="aborted")return R;a.status==="dirty"&&e.dirty(),i.push(a.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,s){let i=[];for(let a of s){let d=await a.key,c=await a.value;i.push({key:d,value:c})}return n.mergeObjectSync(e,i)}static mergeObjectSync(e,s){let i={};for(let a of s){let{key:d,value:c}=a;if(d.status==="aborted"||c.status==="aborted")return R;d.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),d.value!=="__proto__"&&(typeof c.value<"u"||a.alwaysSet)&&(i[d.value]=c.value)}return{status:e.value,value:i}}},R=Object.freeze({status:"aborted"}),te=n=>({status:"dirty",value:n}),B=n=>({status:"valid",value:n}),$e=n=>n.status==="aborted",Ne=n=>n.status==="dirty",ee=n=>n.status==="valid",Ce=n=>typeof Promise<"u"&&n instanceof Promise;var S;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(S||(S={}));var U=class{constructor(e,s,i,a){this._cachedPath=[],this.parent=e,this.data=s,this._path=i,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},qo=(n,e)=>{if(ee(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let s=new A(n.common.issues);return this._error=s,this._error}}};function j(n){if(!n)return{};let{errorMap:e,invalid_type_error:s,required_error:i,description:a}=n;if(e&&(s||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(c,l)=>{let{message:g}=n;return c.code==="invalid_enum_value"?{message:g??l.defaultError}:typeof l.data>"u"?{message:g??i??l.defaultError}:c.code!=="invalid_type"?{message:l.defaultError}:{message:g??s??l.defaultError}},description:a}}var M=class{get description(){return this._def.description}_getType(e){return D(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:D(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new w,ctx:{common:e.parent.common,data:e.data,parsedType:D(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let s=this._parse(e);if(Ce(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){let s=this._parse(e);return Promise.resolve(s)}parse(e,s){let i=this.safeParse(e,s);if(i.success)return i.data;throw i.error}safeParse(e,s){let i={common:{issues:[],async:s?.async??!1,contextualErrorMap:s?.errorMap},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)},a=this._parseSync({data:e,path:i.path,parent:i});return qo(i,a)}"~validate"(e){let s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:s});return ee(i)?{value:i.value}:{issues:s.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(i=>ee(i)?{value:i.value}:{issues:s.common.issues})}async parseAsync(e,s){let i=await this.safeParseAsync(e,s);if(i.success)return i.data;throw i.error}async safeParseAsync(e,s){let i={common:{issues:[],contextualErrorMap:s?.errorMap,async:!0},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)},a=this._parse({data:e,path:i.path,parent:i}),d=await(Ce(a)?a:Promise.resolve(a));return qo(i,d)}refine(e,s){let i=a=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(a):s;return this._refinement((a,d)=>{let c=e(a),l=()=>d.addIssue({code:f.custom,...i(a)});return typeof Promise<"u"&&c instanceof Promise?c.then(g=>g?!0:(l(),!1)):c?!0:(l(),!1)})}refinement(e,s){return this._refinement((i,a)=>e(i)?!0:(a.addIssue(typeof s=="function"?s(i,a):s),!1))}_refinement(e){return new W({schema:this,typeName:k.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return N.create(this,this._def)}nullable(){return J.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Q.create(this)}promise(){return oe.create(this,this._def)}or(e){return ae.create([this,e],this._def)}and(e){return de.create(this,e,this._def)}transform(e){return new W({...j(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let s=typeof e=="function"?e:()=>e;return new ue({...j(this._def),innerType:this,defaultValue:s,typeName:k.ZodDefault})}brand(){return new Ee({typeName:k.ZodBranded,type:this,...j(this._def)})}catch(e){let s=typeof e=="function"?e:()=>e;return new fe({...j(this._def),innerType:this,catchValue:s,typeName:k.ZodCatch})}describe(e){let s=this.constructor;return new s({...this._def,description:e})}pipe(e){return Ae.create(this,e)}readonly(){return ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Qt=/^c[^\s-]{8,}$/i,en=/^[0-9a-z]+$/,on=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nn=/^[a-z0-9_-]{21}$/i,rn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,an=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",We,pn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,mn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ln=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,un=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Uo="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",gn=new RegExp(`^${Uo}$`);function $o(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let s=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${s}`}function xn(n){return new RegExp(`^${$o(n)}$`)}function yn(n){let e=`${Uo}T${$o(n)}`,s=[];return s.push(n.local?"Z?":"Z"),n.offset&&s.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${s.join("|")})`,new RegExp(`^${e}$`)}function zn(n,e){return!!((e==="v4"||!e)&&pn.test(n)||(e==="v6"||!e)&&cn.test(n))}function bn(n,e){if(!rn.test(n))return!1;try{let[s]=n.split(".");if(!s)return!1;let i=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),a=JSON.parse(atob(i));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function hn(n,e){return!!((e==="v4"||!e)&&mn.test(n)||(e==="v6"||!e)&&ln.test(n))}var re=class n extends M{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let d=this._getOrReturnCtx(e);return b(d,{code:f.invalid_type,expected:C.string,received:d.parsedType}),R}let i=new w,a;for(let d of this._def.checks)if(d.kind==="min")e.data.length<d.value&&(a=this._getOrReturnCtx(e,a),b(a,{code:f.too_small,minimum:d.value,type:"string",inclusive:!0,exact:!1,message:d.message}),i.dirty());else if(d.kind==="max")e.data.length>d.value&&(a=this._getOrReturnCtx(e,a),b(a,{code:f.too_big,maximum:d.value,type:"string",inclusive:!0,exact:!1,message:d.message}),i.dirty());else if(d.kind==="length"){let c=e.data.length>d.value,l=e.data.length<d.value;(c||l)&&(a=this._getOrReturnCtx(e,a),c?b(a,{code:f.too_big,maximum:d.value,type:"string",inclusive:!0,exact:!0,message:d.message}):l&&b(a,{code:f.too_small,minimum:d.value,type:"string",inclusive:!0,exact:!0,message:d.message}),i.dirty())}else if(d.kind==="email")an.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"email",code:f.invalid_string,message:d.message}),i.dirty());else if(d.kind==="emoji")We||(We=new RegExp(dn,"u")),We.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"emoji",code:f.invalid_string,message:d.message}),i.dirty());else if(d.kind==="uuid")tn.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"uuid",code:f.invalid_string,message:d.message}),i.dirty());else if(d.kind==="nanoid")nn.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"nanoid",code:f.invalid_string,message:d.message}),i.dirty());else if(d.kind==="cuid")Qt.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"cuid",code:f.invalid_string,message:d.message}),i.dirty());else if(d.kind==="cuid2")en.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"cuid2",code:f.invalid_string,message:d.message}),i.dirty());else if(d.kind==="ulid")on.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"ulid",code:f.invalid_string,message:d.message}),i.dirty());else if(d.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),b(a,{validation:"url",code:f.invalid_string,message:d.message}),i.dirty()}else d.kind==="regex"?(d.regex.lastIndex=0,d.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"regex",code:f.invalid_string,message:d.message}),i.dirty())):d.kind==="trim"?e.data=e.data.trim():d.kind==="includes"?e.data.includes(d.value,d.position)||(a=this._getOrReturnCtx(e,a),b(a,{code:f.invalid_string,validation:{includes:d.value,position:d.position},message:d.message}),i.dirty()):d.kind==="toLowerCase"?e.data=e.data.toLowerCase():d.kind==="toUpperCase"?e.data=e.data.toUpperCase():d.kind==="startsWith"?e.data.startsWith(d.value)||(a=this._getOrReturnCtx(e,a),b(a,{code:f.invalid_string,validation:{startsWith:d.value},message:d.message}),i.dirty()):d.kind==="endsWith"?e.data.endsWith(d.value)||(a=this._getOrReturnCtx(e,a),b(a,{code:f.invalid_string,validation:{endsWith:d.value},message:d.message}),i.dirty()):d.kind==="datetime"?yn(d).test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{code:f.invalid_string,validation:"datetime",message:d.message}),i.dirty()):d.kind==="date"?gn.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{code:f.invalid_string,validation:"date",message:d.message}),i.dirty()):d.kind==="time"?xn(d).test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{code:f.invalid_string,validation:"time",message:d.message}),i.dirty()):d.kind==="duration"?sn.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"duration",code:f.invalid_string,message:d.message}),i.dirty()):d.kind==="ip"?zn(e.data,d.version)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"ip",code:f.invalid_string,message:d.message}),i.dirty()):d.kind==="jwt"?bn(e.data,d.alg)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"jwt",code:f.invalid_string,message:d.message}),i.dirty()):d.kind==="cidr"?hn(e.data,d.version)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"cidr",code:f.invalid_string,message:d.message}),i.dirty()):d.kind==="base64"?un.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"base64",code:f.invalid_string,message:d.message}),i.dirty()):d.kind==="base64url"?fn.test(e.data)||(a=this._getOrReturnCtx(e,a),b(a,{validation:"base64url",code:f.invalid_string,message:d.message}),i.dirty()):T.assertNever(d);return{status:i.value,value:e.data}}_regex(e,s,i){return this.refinement(a=>e.test(a),{validation:s,code:f.invalid_string,...S.errToObj(i)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...S.errToObj(e)})}url(e){return this._addCheck({kind:"url",...S.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...S.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...S.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...S.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...S.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...S.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...S.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...S.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...S.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...S.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...S.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...S.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...S.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...S.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...S.errToObj(e)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...S.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s?.position,...S.errToObj(s?.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...S.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...S.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...S.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...S.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...S.errToObj(s)})}nonempty(e){return this.min(1,S.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}};re.create=n=>new re({checks:[],typeName:k.ZodString,coerce:n?.coerce??!1,...j(n)});function Cn(n,e){let s=(n.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,a=s>i?s:i,d=Number.parseInt(n.toFixed(a).replace(".","")),c=Number.parseInt(e.toFixed(a).replace(".",""));return d%c/10**a}var Se=class n extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){let d=this._getOrReturnCtx(e);return b(d,{code:f.invalid_type,expected:C.number,received:d.parsedType}),R}let i,a=new w;for(let d of this._def.checks)d.kind==="int"?T.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),b(i,{code:f.invalid_type,expected:"integer",received:"float",message:d.message}),a.dirty()):d.kind==="min"?(d.inclusive?e.data<d.value:e.data<=d.value)&&(i=this._getOrReturnCtx(e,i),b(i,{code:f.too_small,minimum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),a.dirty()):d.kind==="max"?(d.inclusive?e.data>d.value:e.data>=d.value)&&(i=this._getOrReturnCtx(e,i),b(i,{code:f.too_big,maximum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),a.dirty()):d.kind==="multipleOf"?Cn(e.data,d.value)!==0&&(i=this._getOrReturnCtx(e,i),b(i,{code:f.not_multiple_of,multipleOf:d.value,message:d.message}),a.dirty()):d.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),b(i,{code:f.not_finite,message:d.message}),a.dirty()):T.assertNever(d);return{status:a.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,S.toString(s))}gt(e,s){return this.setLimit("min",e,!1,S.toString(s))}lte(e,s){return this.setLimit("max",e,!0,S.toString(s))}lt(e,s){return this.setLimit("max",e,!1,S.toString(s))}setLimit(e,s,i,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:i,message:S.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:S.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:S.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.toString(e)})}get minValue(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&T.isInteger(e.value))}get isFinite(){let e=null,s=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(s===null||i.value>s)&&(s=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(s)&&Number.isFinite(e)}};Se.create=n=>new Se({checks:[],typeName:k.ZodNumber,coerce:n?.coerce||!1,...j(n)});var Ie=class n extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==C.bigint)return this._getInvalidInput(e);let i,a=new w;for(let d of this._def.checks)d.kind==="min"?(d.inclusive?e.data<d.value:e.data<=d.value)&&(i=this._getOrReturnCtx(e,i),b(i,{code:f.too_small,type:"bigint",minimum:d.value,inclusive:d.inclusive,message:d.message}),a.dirty()):d.kind==="max"?(d.inclusive?e.data>d.value:e.data>=d.value)&&(i=this._getOrReturnCtx(e,i),b(i,{code:f.too_big,type:"bigint",maximum:d.value,inclusive:d.inclusive,message:d.message}),a.dirty()):d.kind==="multipleOf"?e.data%d.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),b(i,{code:f.not_multiple_of,multipleOf:d.value,message:d.message}),a.dirty()):T.assertNever(d);return{status:a.value,value:e.data}}_getInvalidInput(e){let s=this._getOrReturnCtx(e);return b(s,{code:f.invalid_type,expected:C.bigint,received:s.parsedType}),R}gte(e,s){return this.setLimit("min",e,!0,S.toString(s))}gt(e,s){return this.setLimit("min",e,!1,S.toString(s))}lte(e,s){return this.setLimit("max",e,!0,S.toString(s))}lt(e,s){return this.setLimit("max",e,!1,S.toString(s))}setLimit(e,s,i,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:i,message:S.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(s)})}get minValue(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}};Ie.create=n=>new Ie({checks:[],typeName:k.ZodBigInt,coerce:n?.coerce??!1,...j(n)});var ve=class extends M{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){let i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:C.boolean,received:i.parsedType}),R}return B(e.data)}};ve.create=n=>new ve({typeName:k.ZodBoolean,coerce:n?.coerce||!1,...j(n)});var Oe=class n extends M{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let d=this._getOrReturnCtx(e);return b(d,{code:f.invalid_type,expected:C.date,received:d.parsedType}),R}if(Number.isNaN(e.data.getTime())){let d=this._getOrReturnCtx(e);return b(d,{code:f.invalid_date}),R}let i=new w,a;for(let d of this._def.checks)d.kind==="min"?e.data.getTime()<d.value&&(a=this._getOrReturnCtx(e,a),b(a,{code:f.too_small,message:d.message,inclusive:!0,exact:!1,minimum:d.value,type:"date"}),i.dirty()):d.kind==="max"?e.data.getTime()>d.value&&(a=this._getOrReturnCtx(e,a),b(a,{code:f.too_big,message:d.message,inclusive:!0,exact:!1,maximum:d.value,type:"date"}),i.dirty()):T.assertNever(d);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:S.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:S.toString(s)})}get minDate(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}};Oe.create=n=>new Oe({checks:[],coerce:n?.coerce||!1,typeName:k.ZodDate,...j(n)});var Re=class extends M{_parse(e){if(this._getType(e)!==C.symbol){let i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:C.symbol,received:i.parsedType}),R}return B(e.data)}};Re.create=n=>new Re({typeName:k.ZodSymbol,...j(n)});var se=class extends M{_parse(e){if(this._getType(e)!==C.undefined){let i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:C.undefined,received:i.parsedType}),R}return B(e.data)}};se.create=n=>new se({typeName:k.ZodUndefined,...j(n)});var ie=class extends M{_parse(e){if(this._getType(e)!==C.null){let i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:C.null,received:i.parsedType}),R}return B(e.data)}};ie.create=n=>new ie({typeName:k.ZodNull,...j(n)});var ke=class extends M{constructor(){super(...arguments),this._any=!0}_parse(e){return B(e.data)}};ke.create=n=>new ke({typeName:k.ZodAny,...j(n)});var H=class extends M{constructor(){super(...arguments),this._unknown=!0}_parse(e){return B(e.data)}};H.create=n=>new H({typeName:k.ZodUnknown,...j(n)});var L=class extends M{_parse(e){let s=this._getOrReturnCtx(e);return b(s,{code:f.invalid_type,expected:C.never,received:s.parsedType}),R}};L.create=n=>new L({typeName:k.ZodNever,...j(n)});var je=class extends M{_parse(e){if(this._getType(e)!==C.undefined){let i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:C.void,received:i.parsedType}),R}return B(e.data)}};je.create=n=>new je({typeName:k.ZodVoid,...j(n)});var Q=class n extends M{_parse(e){let{ctx:s,status:i}=this._processInputParams(e),a=this._def;if(s.parsedType!==C.array)return b(s,{code:f.invalid_type,expected:C.array,received:s.parsedType}),R;if(a.exactLength!==null){let c=s.data.length>a.exactLength.value,l=s.data.length<a.exactLength.value;(c||l)&&(b(s,{code:c?f.too_big:f.too_small,minimum:l?a.exactLength.value:void 0,maximum:c?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),i.dirty())}if(a.minLength!==null&&s.data.length<a.minLength.value&&(b(s,{code:f.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),i.dirty()),a.maxLength!==null&&s.data.length>a.maxLength.value&&(b(s,{code:f.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),i.dirty()),s.common.async)return Promise.all([...s.data].map((c,l)=>a.type._parseAsync(new U(s,c,s.path,l)))).then(c=>w.mergeArray(i,c));let d=[...s.data].map((c,l)=>a.type._parseSync(new U(s,c,s.path,l)));return w.mergeArray(i,d)}get element(){return this._def.type}min(e,s){return new n({...this._def,minLength:{value:e,message:S.toString(s)}})}max(e,s){return new n({...this._def,maxLength:{value:e,message:S.toString(s)}})}length(e,s){return new n({...this._def,exactLength:{value:e,message:S.toString(s)}})}nonempty(e){return this.min(1,e)}};Q.create=(n,e)=>new Q({type:n,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...j(e)});function ne(n){if(n instanceof F){let e={};for(let s in n.shape){let i=n.shape[s];e[s]=N.create(ne(i))}return new F({...n._def,shape:()=>e})}else return n instanceof Q?new Q({...n._def,type:ne(n.element)}):n instanceof N?N.create(ne(n.unwrap())):n instanceof J?J.create(ne(n.unwrap())):n instanceof G?G.create(n.items.map(e=>ne(e))):n}var F=class n extends M{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),s=T.objectKeys(e);return this._cached={shape:e,keys:s},this._cached}_parse(e){if(this._getType(e)!==C.object){let z=this._getOrReturnCtx(e);return b(z,{code:f.invalid_type,expected:C.object,received:z.parsedType}),R}let{status:i,ctx:a}=this._processInputParams(e),{shape:d,keys:c}=this._getCached(),l=[];if(!(this._def.catchall instanceof L&&this._def.unknownKeys==="strip"))for(let z in a.data)c.includes(z)||l.push(z);let g=[];for(let z of c){let O=d[z],_=a.data[z];g.push({key:{status:"valid",value:z},value:O._parse(new U(a,_,a.path,z)),alwaysSet:z in a.data})}if(this._def.catchall instanceof L){let z=this._def.unknownKeys;if(z==="passthrough")for(let O of l)g.push({key:{status:"valid",value:O},value:{status:"valid",value:a.data[O]}});else if(z==="strict")l.length>0&&(b(a,{code:f.unrecognized_keys,keys:l}),i.dirty());else if(z!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let z=this._def.catchall;for(let O of l){let _=a.data[O];g.push({key:{status:"valid",value:O},value:z._parse(new U(a,_,a.path,O)),alwaysSet:O in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let z=[];for(let O of g){let _=await O.key,$=await O.value;z.push({key:_,value:$,alwaysSet:O.alwaysSet})}return z}).then(z=>w.mergeObjectSync(i,z)):w.mergeObjectSync(i,g)}get shape(){return this._def.shape()}strict(e){return S.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,i)=>{let a=this._def.errorMap?.(s,i).message??i.defaultError;return s.code==="unrecognized_keys"?{message:S.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:k.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let s={};for(let i of T.objectKeys(e))e[i]&&this.shape[i]&&(s[i]=this.shape[i]);return new n({...this._def,shape:()=>s})}omit(e){let s={};for(let i of T.objectKeys(this.shape))e[i]||(s[i]=this.shape[i]);return new n({...this._def,shape:()=>s})}deepPartial(){return ne(this)}partial(e){let s={};for(let i of T.objectKeys(this.shape)){let a=this.shape[i];e&&!e[i]?s[i]=a:s[i]=a.optional()}return new n({...this._def,shape:()=>s})}required(e){let s={};for(let i of T.objectKeys(this.shape))if(e&&!e[i])s[i]=this.shape[i];else{let d=this.shape[i];for(;d instanceof N;)d=d._def.innerType;s[i]=d}return new n({...this._def,shape:()=>s})}keyof(){return No(T.objectKeys(this.shape))}};F.create=(n,e)=>new F({shape:()=>n,unknownKeys:"strip",catchall:L.create(),typeName:k.ZodObject,...j(e)});F.strictCreate=(n,e)=>new F({shape:()=>n,unknownKeys:"strict",catchall:L.create(),typeName:k.ZodObject,...j(e)});F.lazycreate=(n,e)=>new F({shape:n,unknownKeys:"strip",catchall:L.create(),typeName:k.ZodObject,...j(e)});var ae=class extends M{_parse(e){let{ctx:s}=this._processInputParams(e),i=this._def.options;function a(d){for(let l of d)if(l.result.status==="valid")return l.result;for(let l of d)if(l.result.status==="dirty")return s.common.issues.push(...l.ctx.common.issues),l.result;let c=d.map(l=>new A(l.ctx.common.issues));return b(s,{code:f.invalid_union,unionErrors:c}),R}if(s.common.async)return Promise.all(i.map(async d=>{let c={...s,common:{...s.common,issues:[]},parent:null};return{result:await d._parseAsync({data:s.data,path:s.path,parent:c}),ctx:c}})).then(a);{let d,c=[];for(let g of i){let z={...s,common:{...s.common,issues:[]},parent:null},O=g._parseSync({data:s.data,path:s.path,parent:z});if(O.status==="valid")return O;O.status==="dirty"&&!d&&(d={result:O,ctx:z}),z.common.issues.length&&c.push(z.common.issues)}if(d)return s.common.issues.push(...d.ctx.common.issues),d.result;let l=c.map(g=>new A(g));return b(s,{code:f.invalid_union,unionErrors:l}),R}}get options(){return this._def.options}};ae.create=(n,e)=>new ae({options:n,typeName:k.ZodUnion,...j(e)});var V=n=>n instanceof pe?V(n.schema):n instanceof W?V(n.innerType()):n instanceof me?[n.value]:n instanceof ce?n.options:n instanceof le?T.objectValues(n.enum):n instanceof ue?V(n._def.innerType):n instanceof se?[void 0]:n instanceof ie?[null]:n instanceof N?[void 0,...V(n.unwrap())]:n instanceof J?[null,...V(n.unwrap())]:n instanceof Ee||n instanceof ge?V(n.unwrap()):n instanceof fe?V(n._def.innerType):[],Ke=class n extends M{_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==C.object)return b(s,{code:f.invalid_type,expected:C.object,received:s.parsedType}),R;let i=this.discriminator,a=s.data[i],d=this.optionsMap.get(a);return d?s.common.async?d._parseAsync({data:s.data,path:s.path,parent:s}):d._parseSync({data:s.data,path:s.path,parent:s}):(b(s,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),R)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,i){let a=new Map;for(let d of s){let c=V(d.shape[e]);if(!c.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let l of c){if(a.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);a.set(l,d)}}return new n({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:a,...j(i)})}};function Le(n,e){let s=D(n),i=D(e);if(n===e)return{valid:!0,data:n};if(s===C.object&&i===C.object){let a=T.objectKeys(e),d=T.objectKeys(n).filter(l=>a.indexOf(l)!==-1),c={...n,...e};for(let l of d){let g=Le(n[l],e[l]);if(!g.valid)return{valid:!1};c[l]=g.data}return{valid:!0,data:c}}else if(s===C.array&&i===C.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let d=0;d<n.length;d++){let c=n[d],l=e[d],g=Le(c,l);if(!g.valid)return{valid:!1};a.push(g.data)}return{valid:!0,data:a}}else return s===C.date&&i===C.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var de=class extends M{_parse(e){let{status:s,ctx:i}=this._processInputParams(e),a=(d,c)=>{if($e(d)||$e(c))return R;let l=Le(d.value,c.value);return l.valid?((Ne(d)||Ne(c))&&s.dirty(),{status:s.value,value:l.data}):(b(i,{code:f.invalid_intersection_types}),R)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([d,c])=>a(d,c)):a(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};de.create=(n,e,s)=>new de({left:n,right:e,typeName:k.ZodIntersection,...j(s)});var G=class n extends M{_parse(e){let{status:s,ctx:i}=this._processInputParams(e);if(i.parsedType!==C.array)return b(i,{code:f.invalid_type,expected:C.array,received:i.parsedType}),R;if(i.data.length<this._def.items.length)return b(i,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;!this._def.rest&&i.data.length>this._def.items.length&&(b(i,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());let d=[...i.data].map((c,l)=>{let g=this._def.items[l]||this._def.rest;return g?g._parse(new U(i,c,i.path,l)):null}).filter(c=>!!c);return i.common.async?Promise.all(d).then(c=>w.mergeArray(s,c)):w.mergeArray(s,d)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};G.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new G({items:n,typeName:k.ZodTuple,rest:null,...j(e)})};var Ze=class n extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:s,ctx:i}=this._processInputParams(e);if(i.parsedType!==C.object)return b(i,{code:f.invalid_type,expected:C.object,received:i.parsedType}),R;let a=[],d=this._def.keyType,c=this._def.valueType;for(let l in i.data)a.push({key:d._parse(new U(i,l,i.path,l)),value:c._parse(new U(i,i.data[l],i.path,l)),alwaysSet:l in i.data});return i.common.async?w.mergeObjectAsync(s,a):w.mergeObjectSync(s,a)}get element(){return this._def.valueType}static create(e,s,i){return s instanceof M?new n({keyType:e,valueType:s,typeName:k.ZodRecord,...j(i)}):new n({keyType:re.create(),valueType:e,typeName:k.ZodRecord,...j(s)})}},Me=class extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:s,ctx:i}=this._processInputParams(e);if(i.parsedType!==C.map)return b(i,{code:f.invalid_type,expected:C.map,received:i.parsedType}),R;let a=this._def.keyType,d=this._def.valueType,c=[...i.data.entries()].map(([l,g],z)=>({key:a._parse(new U(i,l,i.path,[z,"key"])),value:d._parse(new U(i,g,i.path,[z,"value"]))}));if(i.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let g of c){let z=await g.key,O=await g.value;if(z.status==="aborted"||O.status==="aborted")return R;(z.status==="dirty"||O.status==="dirty")&&s.dirty(),l.set(z.value,O.value)}return{status:s.value,value:l}})}else{let l=new Map;for(let g of c){let z=g.key,O=g.value;if(z.status==="aborted"||O.status==="aborted")return R;(z.status==="dirty"||O.status==="dirty")&&s.dirty(),l.set(z.value,O.value)}return{status:s.value,value:l}}}};Me.create=(n,e,s)=>new Me({valueType:e,keyType:n,typeName:k.ZodMap,...j(s)});var Te=class n extends M{_parse(e){let{status:s,ctx:i}=this._processInputParams(e);if(i.parsedType!==C.set)return b(i,{code:f.invalid_type,expected:C.set,received:i.parsedType}),R;let a=this._def;a.minSize!==null&&i.data.size<a.minSize.value&&(b(i,{code:f.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),s.dirty()),a.maxSize!==null&&i.data.size>a.maxSize.value&&(b(i,{code:f.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),s.dirty());let d=this._def.valueType;function c(g){let z=new Set;for(let O of g){if(O.status==="aborted")return R;O.status==="dirty"&&s.dirty(),z.add(O.value)}return{status:s.value,value:z}}let l=[...i.data.values()].map((g,z)=>d._parse(new U(i,g,i.path,z)));return i.common.async?Promise.all(l).then(g=>c(g)):c(l)}min(e,s){return new n({...this._def,minSize:{value:e,message:S.toString(s)}})}max(e,s){return new n({...this._def,maxSize:{value:e,message:S.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}};Te.create=(n,e)=>new Te({valueType:n,minSize:null,maxSize:null,typeName:k.ZodSet,...j(e)});var De=class n extends M{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==C.function)return b(s,{code:f.invalid_type,expected:C.function,received:s.parsedType}),R;function i(l,g){return Be({data:l,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,he(),X].filter(z=>!!z),issueData:{code:f.invalid_arguments,argumentsError:g}})}function a(l,g){return Be({data:l,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,he(),X].filter(z=>!!z),issueData:{code:f.invalid_return_type,returnTypeError:g}})}let d={errorMap:s.common.contextualErrorMap},c=s.data;if(this._def.returns instanceof oe){let l=this;return B(async function(...g){let z=new A([]),O=await l._def.args.parseAsync(g,d).catch(Y=>{throw z.addIssue(i(g,Y)),z}),_=await Reflect.apply(c,this,O);return await l._def.returns._def.type.parseAsync(_,d).catch(Y=>{throw z.addIssue(a(_,Y)),z})})}else{let l=this;return B(function(...g){let z=l._def.args.safeParse(g,d);if(!z.success)throw new A([i(g,z.error)]);let O=Reflect.apply(c,this,z.data),_=l._def.returns.safeParse(O,d);if(!_.success)throw new A([a(O,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:G.create(e).rest(H.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,i){return new n({args:e||G.create([]).rest(H.create()),returns:s||H.create(),typeName:k.ZodFunction,...j(i)})}},pe=class extends M{get schema(){return this._def.getter()}_parse(e){let{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}};pe.create=(n,e)=>new pe({getter:n,typeName:k.ZodLazy,...j(e)});var me=class extends M{_parse(e){if(e.data!==this._def.value){let s=this._getOrReturnCtx(e);return b(s,{received:s.data,code:f.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:e.data}}get value(){return this._def.value}};me.create=(n,e)=>new me({value:n,typeName:k.ZodLiteral,...j(e)});function No(n,e){return new ce({values:n,typeName:k.ZodEnum,...j(e)})}var ce=class n extends M{_parse(e){if(typeof e.data!="string"){let s=this._getOrReturnCtx(e),i=this._def.values;return b(s,{expected:T.joinValues(i),received:s.parsedType,code:f.invalid_type}),R}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let s=this._getOrReturnCtx(e),i=this._def.values;return b(s,{received:s.data,code:f.invalid_enum_value,options:i}),R}return B(e.data)}get options(){return this._def.values}get enum(){let e={};for(let s of this._def.values)e[s]=s;return e}get Values(){let e={};for(let s of this._def.values)e[s]=s;return e}get Enum(){let e={};for(let s of this._def.values)e[s]=s;return e}extract(e,s=this._def){return n.create(e,{...this._def,...s})}exclude(e,s=this._def){return n.create(this.options.filter(i=>!e.includes(i)),{...this._def,...s})}};ce.create=No;var le=class extends M{_parse(e){let s=T.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==C.string&&i.parsedType!==C.number){let a=T.objectValues(s);return b(i,{expected:T.joinValues(a),received:i.parsedType,code:f.invalid_type}),R}if(this._cache||(this._cache=new Set(T.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=T.objectValues(s);return b(i,{received:i.data,code:f.invalid_enum_value,options:a}),R}return B(e.data)}get enum(){return this._def.values}};le.create=(n,e)=>new le({values:n,typeName:k.ZodNativeEnum,...j(e)});var oe=class extends M{unwrap(){return this._def.type}_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==C.promise&&s.common.async===!1)return b(s,{code:f.invalid_type,expected:C.promise,received:s.parsedType}),R;let i=s.parsedType===C.promise?s.data:Promise.resolve(s.data);return B(i.then(a=>this._def.type.parseAsync(a,{path:s.path,errorMap:s.common.contextualErrorMap})))}};oe.create=(n,e)=>new oe({type:n,typeName:k.ZodPromise,...j(e)});var W=class extends M{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:s,ctx:i}=this._processInputParams(e),a=this._def.effect||null,d={addIssue:c=>{b(i,c),c.fatal?s.abort():s.dirty()},get path(){return i.path}};if(d.addIssue=d.addIssue.bind(d),a.type==="preprocess"){let c=a.transform(i.data,d);if(i.common.async)return Promise.resolve(c).then(async l=>{if(s.value==="aborted")return R;let g=await this._def.schema._parseAsync({data:l,path:i.path,parent:i});return g.status==="aborted"?R:g.status==="dirty"?te(g.value):s.value==="dirty"?te(g.value):g});{if(s.value==="aborted")return R;let l=this._def.schema._parseSync({data:c,path:i.path,parent:i});return l.status==="aborted"?R:l.status==="dirty"?te(l.value):s.value==="dirty"?te(l.value):l}}if(a.type==="refinement"){let c=l=>{let g=a.refinement(l,d);if(i.common.async)return Promise.resolve(g);if(g instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(i.common.async===!1){let l=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return l.status==="aborted"?R:(l.status==="dirty"&&s.dirty(),c(l.value),{status:s.value,value:l.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(l=>l.status==="aborted"?R:(l.status==="dirty"&&s.dirty(),c(l.value).then(()=>({status:s.value,value:l.value}))))}if(a.type==="transform")if(i.common.async===!1){let c=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!ee(c))return R;let l=a.transform(c.value,d);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:l}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(c=>ee(c)?Promise.resolve(a.transform(c.value,d)).then(l=>({status:s.value,value:l})):R);T.assertNever(a)}};W.create=(n,e,s)=>new W({schema:n,typeName:k.ZodEffects,effect:e,...j(s)});W.createWithPreprocess=(n,e,s)=>new W({schema:e,effect:{type:"preprocess",transform:n},typeName:k.ZodEffects,...j(s)});var N=class extends M{_parse(e){return this._getType(e)===C.undefined?B(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};N.create=(n,e)=>new N({innerType:n,typeName:k.ZodOptional,...j(e)});var J=class extends M{_parse(e){return this._getType(e)===C.null?B(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};J.create=(n,e)=>new J({innerType:n,typeName:k.ZodNullable,...j(e)});var ue=class extends M{_parse(e){let{ctx:s}=this._processInputParams(e),i=s.data;return s.parsedType===C.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:s.path,parent:s})}removeDefault(){return this._def.innerType}};ue.create=(n,e)=>new ue({innerType:n,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...j(e)});var fe=class extends M{_parse(e){let{ctx:s}=this._processInputParams(e),i={...s,common:{...s.common,issues:[]}},a=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Ce(a)?a.then(d=>({status:"valid",value:d.status==="valid"?d.value:this._def.catchValue({get error(){return new A(i.common.issues)},input:i.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new A(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};fe.create=(n,e)=>new fe({innerType:n,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...j(e)});var _e=class extends M{_parse(e){if(this._getType(e)!==C.nan){let i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:C.nan,received:i.parsedType}),R}return{status:"valid",value:e.data}}};_e.create=n=>new _e({typeName:k.ZodNaN,...j(n)});var Ee=class extends M{_parse(e){let{ctx:s}=this._processInputParams(e),i=s.data;return this._def.type._parse({data:i,path:s.path,parent:s})}unwrap(){return this._def.type}},Ae=class n extends M{_parse(e){let{status:s,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{let d=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return d.status==="aborted"?R:d.status==="dirty"?(s.dirty(),te(d.value)):this._def.out._parseAsync({data:d.value,path:i.path,parent:i})})();{let a=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?R:a.status==="dirty"?(s.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:i.path,parent:i})}}static create(e,s){return new n({in:e,out:s,typeName:k.ZodPipeline})}},ge=class extends M{_parse(e){let s=this._def.innerType._parse(e),i=a=>(ee(a)&&(a.value=Object.freeze(a.value)),a);return Ce(s)?s.then(a=>i(a)):i(s)}unwrap(){return this._def.innerType}};ge.create=(n,e)=>new ge({innerType:n,typeName:k.ZodReadonly,...j(e)});var du={object:F.lazycreate},k;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(k||(k={}));var o=re.create,t=Se.create,pu=_e.create,mu=Ie.create,y=ve.create,cu=Oe.create,lu=Re.create,uu=se.create,Z=ie.create,fu=ke.create,h=H.create,gu=L.create,xu=je.create,u=Q.create,r=F.create,yu=F.strictCreate,I=ae.create,zu=Ke.create,bu=de.create,hu=G.create,x=Ze.create,Cu=Me.create,Su=Te.create,Iu=De.create,vu=pe.create,m=me.create,p=ce.create,Ou=le.create,Ru=oe.create,ku=W.create,ju=N.create,Mu=J.create,Tu=W.createWithPreprocess,_u=Ae.create;var Pu=r({name:o().min(1),permissions:r({media:u(p(["read","write"])).min(1).optional(),sessions:u(p(["read","write"])).min(1).optional(),projects:u(p(["read","write"])).min(1).optional(),renders:u(p(["read","write"])).min(1).optional(),webhooks:u(p(["read","write"])).min(1).optional()}).describe("Resource \u2192 actions grant. Resources: media, sessions, projects, renders, webhooks. Actions: read, write. Least-privilege \u2014 grant only what's needed."),expiresIn:t().optional().describe("Lifetime in seconds; omit for no expiry.")});var Eu=r({data:u(r({id:o(),name:o(),description:o().nullable(),tagline:o().nullable(),colors:x(o(),o()),extraColors:u(r({name:o(),value:o()})).optional(),fonts:r({heading:r({family:o(),weight:I([t(),o()]).optional()}).nullable(),body:r({family:o(),weight:I([t(),o()]).optional()}).nullable()}),voiceGuidelines:o().nullable(),captions:r({sync:y(),profile:x(o(),h()).nullable()}),createdAt:o(),updatedAt:o()}).describe("Brand kit response per \xA7Brand Kits.")),pagination:r({hasMore:y(),nextCursor:o().nullable(),prevCursor:o().nullable()}).describe("Cursor pagination metadata.")}),Sn=200,In=200,vn=2e3,On=500,Rn=500,kn=5e3,Au=r({kitId:o().min(1).max(Sn),name:o().min(1).max(In),description:o().max(vn).optional(),tagline:o().max(On).optional(),secondaryTagline:o().max(Rn).optional(),colors:r({primary:o().min(1),secondary:o().min(1),accent:o().min(1),background:o().min(1),text:o().min(1)}),extraColors:u(r({hex:o().min(1),label:o().min(1),usage:o().optional()})).optional(),headingFont:r({fontFamily:o().min(1),fontWeight:t()}),bodyFont:r({fontFamily:o().min(1),fontWeight:t()}),voiceGuidelines:o().max(kn).optional(),syncCaptions:y().optional(),captionProfile:r({fontFamily:o().optional(),fontSize:t().optional(),fontWeight:t().optional(),color:o().optional(),highlightColor:o().optional(),backgroundColor:o().optional(),position:p(["top","center","bottom"]).optional(),textTransform:p(["none","uppercase"]).optional(),emphasisColor:o().optional(),emphasisScale:t().optional(),emphasisFontFamily:o().optional(),emphasisFontWeight:t().optional(),emphasisTextTransform:p(["none","uppercase"]).optional(),emphasisLetterSpacing:t().optional()}).optional()}).describe("POST /brand-kits body. Org/user are server-resolved; never accepted from the body."),Fu=r({id:o()}),qu=r({id:o(),name:o(),description:o().nullable(),tagline:o().nullable(),colors:x(o(),o()),extraColors:u(r({name:o(),value:o()})).optional(),fonts:r({heading:r({family:o(),weight:I([t(),o()]).optional()}).nullable(),body:r({family:o(),weight:I([t(),o()]).optional()}).nullable()}),voiceGuidelines:o().nullable(),captions:r({sync:y(),profile:x(o(),h()).nullable()}),createdAt:o(),updatedAt:o()}).describe("Brand kit response per \xA7Brand Kits.");var $u=r({clipId:o()}),Nu=r({clipId:o(),data:u(r({suggestionIndex:t().describe("0-based index into the clip's b-roll brief array."),moment:o().describe("The on-camera moment this b-roll covers."),rationale:o().describe("LLM's editorial reason for choosing this moment."),searchTerms:u(o()),startTime:t().describe("Seconds from clip start."),duration:t().describe("Suggested b-roll overlay duration in seconds."),fetchStatus:I([m("ok"),m("no_results"),m("failed"),m(null)]).nullable().describe("Stock-provider lookup result: ok / no_results / failed."),candidates:u(r({id:o().describe("Convex `brollCandidates` row id \u2014 pass to `cueframe broll pick --candidate`."),provider:p(["pexels","pixabay"]),externalId:o(),query:o().describe("Search term that produced this candidate."),thumbnail:o().url(),previewUrl:o().url(),downloadUrl:o().url(),duration:t().describe("Clip duration in seconds."),width:t(),height:t(),rank:t().describe("0-based position within this suggestion's candidate list."),photographer:o(),photographerUrl:o().url().nullish(),assetUrl:o().url().nullish().describe("Per-asset provider page URL (Pexels `url`, Pixabay `pageURL`). Required by Pexels ToS for attribution but optional on older cached rows captured before this field existed.")}))}))}).describe("B-roll candidates grouped by suggestion index. Each group carries the moment / rationale / search terms from the clip's brief alongside the ranked candidate list.");var Ku=r({data:u(r({id:o(),name:o(),description:o(),source:p(["default","installed"]),propSchema:x(o(),h())}).describe("Component catalog entry per \xA7Components.")),pagination:r({hasMore:y(),nextCursor:o().nullable(),prevCursor:o().nullable()}).describe("Cursor pagination metadata.")}),jn=200,Mn=200,Tn=2e3,Lu=r({componentId:o().min(1).max(jn),tsxSource:o().min(1),name:o().min(1).max(Mn),description:o().max(Tn),category:p(["effects","transitions","text","layouts"]),propSchema:x(o(),h()).optional()}).describe("POST /components body. Org/user are server-resolved; never accepted from the body."),Zu=r({id:o()}),_n=200,wn=2e3,Du=r({tsxSource:o().min(1).optional(),name:o().min(1).max(_n).optional(),description:o().max(wn).optional(),category:p(["effects","transitions","text","layouts"]).optional(),propSchema:x(o(),h()).optional()}).describe("PUT /components/:id body. Org/user are server-resolved; never accepted from the body."),Vu=r({id:o(),name:o(),description:o(),source:p(["default","installed"]),propSchema:x(o(),h())}).describe("Component catalog entry per \xA7Components."),Gu=r({id:o()}),Ju=r({id:o(),name:o(),description:o(),source:p(["default","installed"]),propSchema:x(o(),h())}).describe("Component catalog entry per \xA7Components.");var Xu=r({id:o()}),Pn=2e3,Bn=5,En=0,An=10,Fn=64,Hu=r({suggestionId:o().min(1).optional(),fromComposition:y().optional().describe("Reuse the project's current composition as the compose starting point (critique-retry path). Set when iterating on an existing composition."),format:r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional()}).optional().describe("Output-format spec per \xA7Format."),scope:h().optional().describe("RequestScope discriminated union (per compose-api-contract.md). Editor-only scopes (captions/overlay-track/broll/overlay-instance/segment) require an editor-session token; API tokens get 403 on those."),critique:o().max(Pn).optional().describe("Structured critique block (per compose-api-contract.md decision #11). Capped at 2KB total; per-criterion blocks capped at 500 chars."),parentJobId:o().optional().describe("Pointer to the prior compose job this run iterates on. Surfaced on the resulting composeJobs row as baselineComposeJobId."),maxCandidates:t().min(1).max(Bn).optional().describe("Ensemble size. Server default per contract; clamp [1, 5]."),budgetUsd:t().optional().describe("Per-job budget cap (USD). Clamped at the route against the org's composeMaxBudgetUsdPerJob setting."),qualityThreshold:t().min(En).max(An).optional().describe("Composite-score accept threshold. Server default per contract."),seed:t().optional().describe("Deterministic seed for replay. Threaded into the workflow id."),clientNonce:o().max(Fn).optional().describe("Opaque caller token that disambiguates intentional same-critique retries. Without it, identical (project, sug, seed, critique) tuples deduplicate at Temporal; with it, retries fire fresh workflows.")}).describe("POST /projects/:id/compose body."),Qu=r({id:o(),composeJobId:o()}),ef=r({id:o(),composeJobId:o()}),qn=0,of=r({candidateIndex:t().min(qn),selectStrategy:p(["agent-authoritative","editor-merge","editor-replace"]),ifMatch:o().optional()}).describe("POST /projects/:id/compose/jobs/:jobId/select body."),Un=0,tf=r({newCompositionEtag:o(),mergeResult:r({replayedEdits:t().min(Un),droppedEdits:u(r({trackId:o(),clipId:o().optional(),wordStartMs:t().optional(),reason:p(["target_removed","conflict"])}))}).optional()}).describe("POST /projects/:id/compose/jobs/:jobId/select response."),nf=r({id:o()}),rf=r({jobs:u(r({composeJobId:o(),projectId:o(),status:p(["queued","running","complete","failed","cancelled"]),suggestionId:o().optional(),createdAt:t(),completedAt:t().nullable()}))}),sf=r({id:o(),composeJobId:o()}),$n=0,Nn=0,Wn=0,Kn=0,Ln=0,af=r({composeJobId:o(),projectId:o(),status:p(["queued","running","complete","failed","cancelled"]),request:r({suggestionId:o().optional(),fromComposition:y().optional(),scope:h().optional(),critique:o().optional(),parentJobId:o().optional(),maxCandidates:t().optional(),budgetUsd:t().optional(),qualityThreshold:t().optional()}),candidates:u(h()),winner:r({candidateIndex:t().min($n),compositionRunId:o()}).nullable(),cost:r({llmUsd:t().min(Nn),visionUsd:t().min(Wn),modalUsd:t().min(Kn),totalUsd:t().min(Ln)}).nullable(),startedAt:t(),completedAt:t().nullable()});var pf=r({id:o()}),mf=r({sessionId:o()}),cf=r({id:o(),sessionId:o()}),lf=r({composition:h().optional(),timestamps:u(t()).min(1)}),uf=h(),ff=r({id:o(),sessionId:o()}),gf=r({composition:h().optional(),editorialIntent:o().optional(),brandContext:o().optional()}),xf=r({perCriterion:r({editorial:r({score:t(),critique:o().optional()}),spatial:r({score:t(),critique:o().optional()}),brand:r({score:t(),critique:o().optional()}),caption:r({score:t(),critique:o().optional()})}),composite:t(),critique:o(),beats:u(t())}),yf=r({id:o(),sessionId:o()}),zf=r({componentId:o().min(1),params:x(o(),h()).optional(),width:t().optional(),height:t().optional()}),bf=r({url:o()}),hf=r({id:o(),sessionId:o()}),Cf=r({ok:y()});var If=r({id:o()}),Zn=0,Dn=0,Vn=0,Gn=0,Jn=0,Yn=0,Xn=4,Hn=0,Qn=0,er=0,or=0,tr=1,nr=0,rr=1;var sr=.1,ir=1,ar=0,dr=0,pr=-.3,mr=.3,cr=-.3,lr=.3,ur=0,fr=1,gr=0,xr=1,yr=-.3,zr=.3,br=0,hr=1,Cr=0,Sr=1,Ir=0,vr=1,Or=1,Rr=1,kr=0,jr=0,Mr=0,Tr=0,_r=0,wr=100,Pr=900,Br=100,Er=900,Ar=0,Fr=0,qr=0,Ur=0,vf=r({v:t(),format:r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional(),platform:o().optional()}),tracks:u(r({id:o().min(1),kind:p(["video","audio","image","overlay","effect"]),name:o().optional(),enabled:y().optional(),contents:u(I([r({id:o().min(1),startTime:t().min(Zn),duration:t(),source:I([r({kind:m("media"),mediaId:o().min(1),trim:r({start:t().min(Dn),end:t().min(Vn)}).optional(),excludedRanges:u(r({start:t().min(Gn),end:t().min(Jn),reason:o().optional()})).optional(),volume:t().min(Yn).max(Xn).optional(),muted:y().optional(),playbackRate:t().optional(),sync:p(["video","independent"]).optional(),kenBurns:p(["in","out","pan-l","pan-r","none"]).optional(),volumeDb:t().optional(),fadeInMs:t().min(Hn).optional(),fadeOutMs:t().min(Qn).optional(),loop:y().optional(),reframe:r({segments:u(r({startSec:t().min(er),endSec:t(),focus:I([r({mode:m("frame-center")}),r({mode:m("point"),x:t().min(or).max(tr),y:t().min(nr).max(rr)}),r({mode:m("face"),faceId:o().min(1),shotScale:p(["close","standard","wide"]).optional()}),r({mode:m("all-faces")}),r({mode:m("active-speaker")})]),intent:o().optional(),zoom:t().min(sr).max(ir),ease:r({in:t().min(ar),out:t().min(dr)}).optional(),bias:r({x:t().min(pr).max(mr),y:t().min(cr).max(lr)}).optional()})).min(1)}).optional()}),r({kind:m("component"),componentId:o().min(1),props:x(o(),h())}),r({kind:m("overlay"),primitiveId:o().min(1),params:x(o(),h()),zPlane:p(["front","behind-subject"]).optional(),anchor:r({space:m("scene"),x:t().min(ur).max(fr),y:t().min(gr).max(xr)}).optional(),parallax:t().min(yr).max(zr).optional()}),r({kind:m("effect"),primitiveId:o().min(1),params:x(o(),h()).optional()})]),kind:p(["video","audio","image","overlay","effect"]).optional(),opacity:t().min(br).max(hr).optional(),scale:t().optional(),rotation:t().optional(),position:r({x:t(),y:t()}).optional(),region:r({x:t().min(Cr).max(Sr),y:t().min(Ir).max(vr),w:t().max(Or),h:t().max(Rr)}).optional(),fit:p(["cover","contain"]).optional(),effects:u(r({primitiveId:o().min(1),params:x(o(),h()).optional()})).optional(),transitionIn:r({type:o().min(1),duration:t()}).optional()}),r({id:o().min(1),startTime:t().min(kr),duration:t()})]))})),markers:u(r({id:o().min(1),startTime:t().min(jr),endTime:t().min(Mr).optional(),kind:o().min(1),name:o().optional(),metadata:x(o(),h()).optional()})).optional(),captions:r({segments:u(r({words:u(r({text:o().min(1),startMs:t().min(Tr),endMs:t().min(_r),emphasis:y().optional(),annotate:p(["circle","underline"]).optional()}))})),style:r({fontFamily:o().min(1).optional(),fontSize:t().optional(),fontWeight:t().min(wr).max(Pr).optional(),color:o().min(1).optional(),highlightColor:o().min(1).optional(),backgroundColor:o().optional(),position:p(["top","center","bottom"]).optional(),textTransform:p(["none","uppercase","capitalize"]).optional(),emphasisColor:o().optional(),emphasisGradient:o().optional(),emphasisScale:t().optional(),emphasisFontFamily:o().optional(),emphasisFontWeight:t().min(Br).max(Er).optional(),emphasisTextTransform:p(["none","uppercase","capitalize"]).optional(),emphasisLetterSpacing:t().optional(),emphasisFontStyle:p(["normal","italic"]).optional(),entrance:p(["none","word-pop"]).optional(),entranceMs:t().min(Ar).optional(),entranceStaggerMs:t().min(Fr).optional(),exitMs:t().min(qr).optional(),emphasisPlate:y().optional(),emphasisPlateColor:o().optional(),emphasisPlateTextColor:o().optional(),emphasisPlateAltColor:o().optional(),emphasisPlateAltTextColor:o().optional(),emphasisPlateRadius:t().min(Ur).optional(),emphasisPlatePadX:t().optional(),emphasisPlatePadY:t().optional(),annotationColor:o().optional(),maxWidthPercent:t().optional()}).optional()}).optional(),brandKitId:o().optional(),license:r({type:o().min(1),source:o().optional(),notes:o().optional()}).optional(),accessibility:r({audioDescriptionTrackId:o().optional(),captionsTrackId:o().optional(),signLanguageTrackId:o().optional(),notes:o().optional()}).optional()}).describe("Canonical composition wire shape (multi-track; carries reframe, captions, markers)."),Of=r({id:o()}),$r=0,Nr=0,Wr=0,Kr=0,Lr=0,Zr=0,Dr=4,Vr=0,Gr=0,Jr=0,Yr=0,Xr=1,Hr=0,Qr=1;var es=.1,os=1,ts=0,ns=0,rs=-.3,ss=.3,is=-.3,as=.3,ds=0,ps=1,ms=0,cs=1,ls=-.3,us=.3,fs=0,gs=1,xs=0,ys=1,zs=0,bs=1,hs=1,Cs=1,Ss=0,Is=0,vs=0,Os=0,Rs=0,ks=100,js=900,Ms=100,Ts=900,_s=0,ws=0,Ps=0,Bs=0,Rf=r({v:t(),format:r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional(),platform:o().optional()}),tracks:u(r({id:o().min(1),kind:p(["video","audio","image","overlay","effect"]),name:o().optional(),enabled:y().optional(),contents:u(I([r({id:o().min(1),startTime:t().min($r),duration:t(),source:I([r({kind:m("media"),mediaId:o().min(1),trim:r({start:t().min(Nr),end:t().min(Wr)}).optional(),excludedRanges:u(r({start:t().min(Kr),end:t().min(Lr),reason:o().optional()})).optional(),volume:t().min(Zr).max(Dr).optional(),muted:y().optional(),playbackRate:t().optional(),sync:p(["video","independent"]).optional(),kenBurns:p(["in","out","pan-l","pan-r","none"]).optional(),volumeDb:t().optional(),fadeInMs:t().min(Vr).optional(),fadeOutMs:t().min(Gr).optional(),loop:y().optional(),reframe:r({segments:u(r({startSec:t().min(Jr),endSec:t(),focus:I([r({mode:m("frame-center")}),r({mode:m("point"),x:t().min(Yr).max(Xr),y:t().min(Hr).max(Qr)}),r({mode:m("face"),faceId:o().min(1),shotScale:p(["close","standard","wide"]).optional()}),r({mode:m("all-faces")}),r({mode:m("active-speaker")})]),intent:o().optional(),zoom:t().min(es).max(os),ease:r({in:t().min(ts),out:t().min(ns)}).optional(),bias:r({x:t().min(rs).max(ss),y:t().min(is).max(as)}).optional()})).min(1)}).optional()}),r({kind:m("component"),componentId:o().min(1),props:x(o(),h())}),r({kind:m("overlay"),primitiveId:o().min(1),params:x(o(),h()),zPlane:p(["front","behind-subject"]).optional(),anchor:r({space:m("scene"),x:t().min(ds).max(ps),y:t().min(ms).max(cs)}).optional(),parallax:t().min(ls).max(us).optional()}),r({kind:m("effect"),primitiveId:o().min(1),params:x(o(),h()).optional()})]),kind:p(["video","audio","image","overlay","effect"]).optional(),opacity:t().min(fs).max(gs).optional(),scale:t().optional(),rotation:t().optional(),position:r({x:t(),y:t()}).optional(),region:r({x:t().min(xs).max(ys),y:t().min(zs).max(bs),w:t().max(hs),h:t().max(Cs)}).optional(),fit:p(["cover","contain"]).optional(),effects:u(r({primitiveId:o().min(1),params:x(o(),h()).optional()})).optional(),transitionIn:r({type:o().min(1),duration:t()}).optional()}),r({id:o().min(1),startTime:t().min(Ss),duration:t()})]))})),markers:u(r({id:o().min(1),startTime:t().min(Is),endTime:t().min(vs).optional(),kind:o().min(1),name:o().optional(),metadata:x(o(),h()).optional()})).optional(),captions:r({segments:u(r({words:u(r({text:o().min(1),startMs:t().min(Os),endMs:t().min(Rs),emphasis:y().optional(),annotate:p(["circle","underline"]).optional()}))})),style:r({fontFamily:o().min(1).optional(),fontSize:t().optional(),fontWeight:t().min(ks).max(js).optional(),color:o().min(1).optional(),highlightColor:o().min(1).optional(),backgroundColor:o().optional(),position:p(["top","center","bottom"]).optional(),textTransform:p(["none","uppercase","capitalize"]).optional(),emphasisColor:o().optional(),emphasisGradient:o().optional(),emphasisScale:t().optional(),emphasisFontFamily:o().optional(),emphasisFontWeight:t().min(Ms).max(Ts).optional(),emphasisTextTransform:p(["none","uppercase","capitalize"]).optional(),emphasisLetterSpacing:t().optional(),emphasisFontStyle:p(["normal","italic"]).optional(),entrance:p(["none","word-pop"]).optional(),entranceMs:t().min(_s).optional(),entranceStaggerMs:t().min(ws).optional(),exitMs:t().min(Ps).optional(),emphasisPlate:y().optional(),emphasisPlateColor:o().optional(),emphasisPlateTextColor:o().optional(),emphasisPlateAltColor:o().optional(),emphasisPlateAltTextColor:o().optional(),emphasisPlateRadius:t().min(Bs).optional(),emphasisPlatePadX:t().optional(),emphasisPlatePadY:t().optional(),annotationColor:o().optional(),maxWidthPercent:t().optional()}).optional()}).optional(),brandKitId:o().optional(),license:r({type:o().min(1),source:o().optional(),notes:o().optional()}).optional(),accessibility:r({audioDescriptionTrackId:o().optional(),captionsTrackId:o().optional(),signLanguageTrackId:o().optional(),notes:o().optional()}).optional()}).describe("Canonical composition wire shape (multi-track; carries reframe, captions, markers)."),kf=r({id:o()}),Es=0,As=0,Fs=0,qs=0,Us=0,$s=0,Ns=4,Ws=0,Ks=0,Ls=0,Zs=0,Ds=1,Vs=0,Gs=1;var Js=.1,Ys=1,Xs=0,Hs=0,Qs=-.3,ei=.3,oi=-.3,ti=.3,ni=0,ri=1,si=0,ii=1,ai=-.3,di=.3,pi=0,mi=1,ci=0,li=1,ui=0,fi=1,gi=1,xi=1,yi=0,zi=0,bi=0,hi=0,Ci=0,Si=0,Ii=4,vi=0,Oi=0,Ri=0,ki=0,ji=1,Mi=0,Ti=1;var _i=.1,wi=1,Pi=0,Bi=0,Ei=-.3,Ai=.3,Fi=-.3,qi=.3,Ui=0,$i=1,Ni=0,Wi=1,Ki=-.3,Li=.3,Zi=0,Di=1,Vi=0,Gi=1,Ji=0,Yi=1,Xi=1,Hi=1,Qi=0,ea=0,oa=0,ta=0,na=0,ra=0,sa=4,ia=0,aa=0,da=0,pa=0,ma=1,ca=0,la=1;var ua=.1,fa=1,ga=0,xa=0,ya=-.3,za=.3,ba=-.3,ha=.3,Ca=0,Sa=1,Ia=0,va=1,Oa=-.3,Ra=.3,ka=0,ja=1,Ma=0,Ta=1,_a=0,wa=1,Pa=1,Ba=1,Ea=0,Aa=0,Fa=0,qa=0,Ua=0,$a=0,Na=1,Wa=0,Ka=1;var La=.1,Za=1,Da=0,Va=0,Ga=-.3,Ja=.3,Ya=-.3,Xa=.3,Ha=100,Qa=900,ed=100,od=900,td=0,nd=0,rd=0,sd=0,jf=I([r({type:m("clip.add"),clip:r({id:o().min(1),startTime:t().min(Es),duration:t(),source:I([r({kind:m("media"),mediaId:o().min(1),trim:r({start:t().min(As),end:t().min(Fs)}).optional(),excludedRanges:u(r({start:t().min(qs),end:t().min(Us),reason:o().optional()})).optional(),volume:t().min($s).max(Ns).optional(),muted:y().optional(),playbackRate:t().optional(),sync:p(["video","independent"]).optional(),kenBurns:p(["in","out","pan-l","pan-r","none"]).optional(),volumeDb:t().optional(),fadeInMs:t().min(Ws).optional(),fadeOutMs:t().min(Ks).optional(),loop:y().optional(),reframe:r({segments:u(r({startSec:t().min(Ls),endSec:t(),focus:I([r({mode:m("frame-center")}),r({mode:m("point"),x:t().min(Zs).max(Ds),y:t().min(Vs).max(Gs)}),r({mode:m("face"),faceId:o().min(1),shotScale:p(["close","standard","wide"]).optional()}),r({mode:m("all-faces")}),r({mode:m("active-speaker")})]),intent:o().optional(),zoom:t().min(Js).max(Ys),ease:r({in:t().min(Xs),out:t().min(Hs)}).optional(),bias:r({x:t().min(Qs).max(ei),y:t().min(oi).max(ti)}).optional()})).min(1)}).optional()}),r({kind:m("component"),componentId:o().min(1),props:x(o(),h())}),r({kind:m("overlay"),primitiveId:o().min(1),params:x(o(),h()),zPlane:p(["front","behind-subject"]).optional(),anchor:r({space:m("scene"),x:t().min(ni).max(ri),y:t().min(si).max(ii)}).optional(),parallax:t().min(ai).max(di).optional()}),r({kind:m("effect"),primitiveId:o().min(1),params:x(o(),h()).optional()})]),kind:p(["video","audio","image","overlay","effect"]).optional(),opacity:t().min(pi).max(mi).optional(),scale:t().optional(),rotation:t().optional(),position:r({x:t(),y:t()}).optional(),region:r({x:t().min(ci).max(li),y:t().min(ui).max(fi),w:t().max(gi),h:t().max(xi)}).optional(),fit:p(["cover","contain"]).optional(),effects:u(r({primitiveId:o().min(1),params:x(o(),h()).optional()})).optional(),transitionIn:r({type:o().min(1),duration:t()}).optional()}),trackId:o().optional(),newTrack:y().optional(),newTrackId:o().optional()}),r({type:m("clip.remove"),clipId:o()}),r({type:m("clip.update"),clipId:o(),patch:r({id:o().min(1).optional(),startTime:t().min(yi).optional(),duration:t().optional(),source:I([r({kind:m("media"),mediaId:o().min(1),trim:r({start:t().min(zi),end:t().min(bi)}).optional(),excludedRanges:u(r({start:t().min(hi),end:t().min(Ci),reason:o().optional()})).optional(),volume:t().min(Si).max(Ii).optional(),muted:y().optional(),playbackRate:t().optional(),sync:p(["video","independent"]).optional(),kenBurns:p(["in","out","pan-l","pan-r","none"]).optional(),volumeDb:t().optional(),fadeInMs:t().min(vi).optional(),fadeOutMs:t().min(Oi).optional(),loop:y().optional(),reframe:r({segments:u(r({startSec:t().min(Ri),endSec:t(),focus:I([r({mode:m("frame-center")}),r({mode:m("point"),x:t().min(ki).max(ji),y:t().min(Mi).max(Ti)}),r({mode:m("face"),faceId:o().min(1),shotScale:p(["close","standard","wide"]).optional()}),r({mode:m("all-faces")}),r({mode:m("active-speaker")})]),intent:o().optional(),zoom:t().min(_i).max(wi),ease:r({in:t().min(Pi),out:t().min(Bi)}).optional(),bias:r({x:t().min(Ei).max(Ai),y:t().min(Fi).max(qi)}).optional()})).min(1)}).optional()}),r({kind:m("component"),componentId:o().min(1),props:x(o(),h())}),r({kind:m("overlay"),primitiveId:o().min(1),params:x(o(),h()),zPlane:p(["front","behind-subject"]).optional(),anchor:r({space:m("scene"),x:t().min(Ui).max($i),y:t().min(Ni).max(Wi)}).optional(),parallax:t().min(Ki).max(Li).optional()}),r({kind:m("effect"),primitiveId:o().min(1),params:x(o(),h()).optional()})]).optional(),kind:p(["video","audio","image","overlay","effect"]).optional(),opacity:t().min(Zi).max(Di).optional(),scale:t().optional(),rotation:t().optional(),position:r({x:t(),y:t()}).optional(),region:r({x:t().min(Vi).max(Gi),y:t().min(Ji).max(Yi),w:t().max(Xi),h:t().max(Hi)}).optional(),fit:p(["cover","contain"]).optional(),effects:u(r({primitiveId:o().min(1),params:x(o(),h()).optional()})).optional(),transitionIn:r({type:o().min(1),duration:t()}).optional()})}).describe("Patch an existing clip by id (cross-family). The patch is a partial TimelineClip. NOTE: `source` is REPLACED wholesale \u2014 the patch merges at the top level only, so a partial `source` WIPES the source fields you omit. Patch the whole source object when changing it."),r({type:m("removeClipsByMediaId"),mediaId:o()}),r({type:m("loadOverlays"),clips:u(r({id:o().min(1),startTime:t().min(Qi),duration:t(),source:I([r({kind:m("media"),mediaId:o().min(1),trim:r({start:t().min(ea),end:t().min(oa)}).optional(),excludedRanges:u(r({start:t().min(ta),end:t().min(na),reason:o().optional()})).optional(),volume:t().min(ra).max(sa).optional(),muted:y().optional(),playbackRate:t().optional(),sync:p(["video","independent"]).optional(),kenBurns:p(["in","out","pan-l","pan-r","none"]).optional(),volumeDb:t().optional(),fadeInMs:t().min(ia).optional(),fadeOutMs:t().min(aa).optional(),loop:y().optional(),reframe:r({segments:u(r({startSec:t().min(da),endSec:t(),focus:I([r({mode:m("frame-center")}),r({mode:m("point"),x:t().min(pa).max(ma),y:t().min(ca).max(la)}),r({mode:m("face"),faceId:o().min(1),shotScale:p(["close","standard","wide"]).optional()}),r({mode:m("all-faces")}),r({mode:m("active-speaker")})]),intent:o().optional(),zoom:t().min(ua).max(fa),ease:r({in:t().min(ga),out:t().min(xa)}).optional(),bias:r({x:t().min(ya).max(za),y:t().min(ba).max(ha)}).optional()})).min(1)}).optional()}),r({kind:m("component"),componentId:o().min(1),props:x(o(),h())}),r({kind:m("overlay"),primitiveId:o().min(1),params:x(o(),h()),zPlane:p(["front","behind-subject"]).optional(),anchor:r({space:m("scene"),x:t().min(Ca).max(Sa),y:t().min(Ia).max(va)}).optional(),parallax:t().min(Oa).max(Ra).optional()}),r({kind:m("effect"),primitiveId:o().min(1),params:x(o(),h()).optional()})]),kind:p(["video","audio","image","overlay","effect"]).optional(),opacity:t().min(ka).max(ja).optional(),scale:t().optional(),rotation:t().optional(),position:r({x:t(),y:t()}).optional(),region:r({x:t().min(Ma).max(Ta),y:t().min(_a).max(wa),w:t().max(Pa),h:t().max(Ba)}).optional(),fit:p(["cover","contain"]).optional(),effects:u(r({primitiveId:o().min(1),params:x(o(),h()).optional()})).optional(),transitionIn:r({type:o().min(1),duration:t()}).optional()}))}),r({type:m("addMarker"),marker:r({id:o().min(1),startTime:t().min(Ea),endTime:t().min(Aa).optional(),kind:o().min(1),name:o().optional(),metadata:x(o(),h()).optional()})}),r({type:m("removeMarker"),markerId:o()}),r({type:m("updateMarker"),markerId:o(),updates:r({id:o().min(1).optional(),startTime:t().min(Fa).optional(),endTime:t().min(qa).optional(),kind:o().min(1).optional(),name:o().optional(),metadata:x(o(),h()).optional()})}),r({type:m("setCropIntents"),clipId:o(),segments:u(r({startSec:t().min(Ua),endSec:t(),focus:I([r({mode:m("frame-center")}),r({mode:m("point"),x:t().min($a).max(Na),y:t().min(Wa).max(Ka)}),r({mode:m("face"),faceId:o().min(1),shotScale:p(["close","standard","wide"]).optional()}),r({mode:m("all-faces")}),r({mode:m("active-speaker")})]),intent:o().optional(),zoom:t().min(La).max(Za),ease:r({in:t().min(Da),out:t().min(Va)}).optional(),bias:r({x:t().min(Ga).max(Ja),y:t().min(Ya).max(Xa)}).optional()})).nullable()}),r({type:m("setCaptionStyle"),style:r({fontFamily:o().min(1).optional(),fontSize:t().optional(),fontWeight:t().min(Ha).max(Qa).optional(),color:o().min(1).optional(),highlightColor:o().min(1).optional(),backgroundColor:o().optional(),position:p(["top","center","bottom"]).optional(),textTransform:p(["none","uppercase","capitalize"]).optional(),emphasisColor:o().optional(),emphasisGradient:o().optional(),emphasisScale:t().optional(),emphasisFontFamily:o().optional(),emphasisFontWeight:t().min(ed).max(od).optional(),emphasisTextTransform:p(["none","uppercase","capitalize"]).optional(),emphasisLetterSpacing:t().optional(),emphasisFontStyle:p(["normal","italic"]).optional(),entrance:p(["none","word-pop"]).optional(),entranceMs:t().min(td).optional(),entranceStaggerMs:t().min(nd).optional(),exitMs:t().min(rd).optional(),emphasisPlate:y().optional(),emphasisPlateColor:o().optional(),emphasisPlateTextColor:o().optional(),emphasisPlateAltColor:o().optional(),emphasisPlateAltTextColor:o().optional(),emphasisPlateRadius:t().min(sd).optional(),emphasisPlatePadX:t().optional(),emphasisPlatePadY:t().optional(),annotationColor:o().optional(),maxWidthPercent:t().optional()})}),r({type:m("setFormat"),format:r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional()})}),r({type:m("addTrack"),kind:p(["video","audio","image","overlay","effect"]),name:o().optional(),id:o().optional()}),r({type:m("removeTrack"),trackId:o()}),r({type:m("updateTrack"),trackId:o(),updates:r({name:o().optional(),enabled:y().optional()})}),r({type:m("reorderTracks"),fromIndex:t(),toIndex:t()}),r({type:m("moveClipToTrack"),clipId:o(),targetTrackId:o(),newStartTime:t().optional()}),r({type:m("duplicateClip"),clipId:o(),newClipId:o().optional()}),r({type:m("cutAndRipple"),start:t(),end:t()}),r({type:m("ripple"),time:t(),amount:t()}),r({type:m("addExcludedRange"),clipId:o(),sourceStart:t(),sourceEnd:t(),reason:o().optional()}),r({type:m("removeExcludedRange"),clipId:o(),rangeIdx:t()})]).describe("One scoped composition operation. Discriminated by `type` \u2014 `clip.add` / `clip.remove` / `clip.update` patch clips across any family; the rest cover markers, reframe, captions, format, tracks, and the server-authoritative ripple recomputes. Validated strictly server-side against the runtime CompositionOp vocabulary."),Mf=r({id:o()}),id=0,ad=0,dd=0,pd=0,md=0,cd=0,ld=4,ud=0,fd=0,gd=0,xd=0,yd=1,zd=0,bd=1;var hd=.1,Cd=1,Sd=0,Id=0,vd=-.3,Od=.3,Rd=-.3,kd=.3,jd=0,Md=1,Td=0,_d=1,wd=-.3,Pd=.3,Bd=0,Ed=1,Ad=0,Fd=1,qd=0,Ud=1,$d=1,Nd=1,Wd=0,Kd=0,Ld=0,Zd=0,Dd=0,Vd=0,Gd=4,Jd=0,Yd=0,Xd=0,Hd=0,Qd=1,ep=0,op=1;var tp=.1,np=1,rp=0,sp=0,ip=-.3,ap=.3,dp=-.3,pp=.3,mp=0,cp=1,lp=0,up=1,fp=-.3,gp=.3,xp=0,yp=1,zp=0,bp=1,hp=0,Cp=1,Sp=1,Ip=1,vp=0,Op=0,Rp=0,kp=0,jp=0,Mp=0,Tp=4,_p=0,wp=0,Pp=0,Bp=0,Ep=1,Ap=0,Fp=1;var qp=.1,Up=1,$p=0,Np=0,Wp=-.3,Kp=.3,Lp=-.3,Zp=.3,Dp=0,Vp=1,Gp=0,Jp=1,Yp=-.3,Xp=.3,Hp=0,Qp=1,em=0,om=1,tm=0,nm=1,rm=1,sm=1,im=0,am=0,dm=0,pm=0,mm=0,cm=0,lm=1,um=0,fm=1;var gm=.1,xm=1,ym=0,zm=0,bm=-.3,hm=.3,Cm=-.3,Sm=.3,Im=100,vm=900,Om=100,Rm=900,km=0,jm=0,Mm=0,Tm=0,Tf=r({ops:u(I([r({type:m("clip.add"),clip:r({id:o().min(1),startTime:t().min(id),duration:t(),source:I([r({kind:m("media"),mediaId:o().min(1),trim:r({start:t().min(ad),end:t().min(dd)}).optional(),excludedRanges:u(r({start:t().min(pd),end:t().min(md),reason:o().optional()})).optional(),volume:t().min(cd).max(ld).optional(),muted:y().optional(),playbackRate:t().optional(),sync:p(["video","independent"]).optional(),kenBurns:p(["in","out","pan-l","pan-r","none"]).optional(),volumeDb:t().optional(),fadeInMs:t().min(ud).optional(),fadeOutMs:t().min(fd).optional(),loop:y().optional(),reframe:r({segments:u(r({startSec:t().min(gd),endSec:t(),focus:I([r({mode:m("frame-center")}),r({mode:m("point"),x:t().min(xd).max(yd),y:t().min(zd).max(bd)}),r({mode:m("face"),faceId:o().min(1),shotScale:p(["close","standard","wide"]).optional()}),r({mode:m("all-faces")}),r({mode:m("active-speaker")})]),intent:o().optional(),zoom:t().min(hd).max(Cd),ease:r({in:t().min(Sd),out:t().min(Id)}).optional(),bias:r({x:t().min(vd).max(Od),y:t().min(Rd).max(kd)}).optional()})).min(1)}).optional()}),r({kind:m("component"),componentId:o().min(1),props:x(o(),h())}),r({kind:m("overlay"),primitiveId:o().min(1),params:x(o(),h()),zPlane:p(["front","behind-subject"]).optional(),anchor:r({space:m("scene"),x:t().min(jd).max(Md),y:t().min(Td).max(_d)}).optional(),parallax:t().min(wd).max(Pd).optional()}),r({kind:m("effect"),primitiveId:o().min(1),params:x(o(),h()).optional()})]),kind:p(["video","audio","image","overlay","effect"]).optional(),opacity:t().min(Bd).max(Ed).optional(),scale:t().optional(),rotation:t().optional(),position:r({x:t(),y:t()}).optional(),region:r({x:t().min(Ad).max(Fd),y:t().min(qd).max(Ud),w:t().max($d),h:t().max(Nd)}).optional(),fit:p(["cover","contain"]).optional(),effects:u(r({primitiveId:o().min(1),params:x(o(),h()).optional()})).optional(),transitionIn:r({type:o().min(1),duration:t()}).optional()}),trackId:o().optional(),newTrack:y().optional(),newTrackId:o().optional()}),r({type:m("clip.remove"),clipId:o()}),r({type:m("clip.update"),clipId:o(),patch:r({id:o().min(1).optional(),startTime:t().min(Wd).optional(),duration:t().optional(),source:I([r({kind:m("media"),mediaId:o().min(1),trim:r({start:t().min(Kd),end:t().min(Ld)}).optional(),excludedRanges:u(r({start:t().min(Zd),end:t().min(Dd),reason:o().optional()})).optional(),volume:t().min(Vd).max(Gd).optional(),muted:y().optional(),playbackRate:t().optional(),sync:p(["video","independent"]).optional(),kenBurns:p(["in","out","pan-l","pan-r","none"]).optional(),volumeDb:t().optional(),fadeInMs:t().min(Jd).optional(),fadeOutMs:t().min(Yd).optional(),loop:y().optional(),reframe:r({segments:u(r({startSec:t().min(Xd),endSec:t(),focus:I([r({mode:m("frame-center")}),r({mode:m("point"),x:t().min(Hd).max(Qd),y:t().min(ep).max(op)}),r({mode:m("face"),faceId:o().min(1),shotScale:p(["close","standard","wide"]).optional()}),r({mode:m("all-faces")}),r({mode:m("active-speaker")})]),intent:o().optional(),zoom:t().min(tp).max(np),ease:r({in:t().min(rp),out:t().min(sp)}).optional(),bias:r({x:t().min(ip).max(ap),y:t().min(dp).max(pp)}).optional()})).min(1)}).optional()}),r({kind:m("component"),componentId:o().min(1),props:x(o(),h())}),r({kind:m("overlay"),primitiveId:o().min(1),params:x(o(),h()),zPlane:p(["front","behind-subject"]).optional(),anchor:r({space:m("scene"),x:t().min(mp).max(cp),y:t().min(lp).max(up)}).optional(),parallax:t().min(fp).max(gp).optional()}),r({kind:m("effect"),primitiveId:o().min(1),params:x(o(),h()).optional()})]).optional(),kind:p(["video","audio","image","overlay","effect"]).optional(),opacity:t().min(xp).max(yp).optional(),scale:t().optional(),rotation:t().optional(),position:r({x:t(),y:t()}).optional(),region:r({x:t().min(zp).max(bp),y:t().min(hp).max(Cp),w:t().max(Sp),h:t().max(Ip)}).optional(),fit:p(["cover","contain"]).optional(),effects:u(r({primitiveId:o().min(1),params:x(o(),h()).optional()})).optional(),transitionIn:r({type:o().min(1),duration:t()}).optional()})}).describe("Patch an existing clip by id (cross-family). The patch is a partial TimelineClip. NOTE: `source` is REPLACED wholesale \u2014 the patch merges at the top level only, so a partial `source` WIPES the source fields you omit. Patch the whole source object when changing it."),r({type:m("removeClipsByMediaId"),mediaId:o()}),r({type:m("loadOverlays"),clips:u(r({id:o().min(1),startTime:t().min(vp),duration:t(),source:I([r({kind:m("media"),mediaId:o().min(1),trim:r({start:t().min(Op),end:t().min(Rp)}).optional(),excludedRanges:u(r({start:t().min(kp),end:t().min(jp),reason:o().optional()})).optional(),volume:t().min(Mp).max(Tp).optional(),muted:y().optional(),playbackRate:t().optional(),sync:p(["video","independent"]).optional(),kenBurns:p(["in","out","pan-l","pan-r","none"]).optional(),volumeDb:t().optional(),fadeInMs:t().min(_p).optional(),fadeOutMs:t().min(wp).optional(),loop:y().optional(),reframe:r({segments:u(r({startSec:t().min(Pp),endSec:t(),focus:I([r({mode:m("frame-center")}),r({mode:m("point"),x:t().min(Bp).max(Ep),y:t().min(Ap).max(Fp)}),r({mode:m("face"),faceId:o().min(1),shotScale:p(["close","standard","wide"]).optional()}),r({mode:m("all-faces")}),r({mode:m("active-speaker")})]),intent:o().optional(),zoom:t().min(qp).max(Up),ease:r({in:t().min($p),out:t().min(Np)}).optional(),bias:r({x:t().min(Wp).max(Kp),y:t().min(Lp).max(Zp)}).optional()})).min(1)}).optional()}),r({kind:m("component"),componentId:o().min(1),props:x(o(),h())}),r({kind:m("overlay"),primitiveId:o().min(1),params:x(o(),h()),zPlane:p(["front","behind-subject"]).optional(),anchor:r({space:m("scene"),x:t().min(Dp).max(Vp),y:t().min(Gp).max(Jp)}).optional(),parallax:t().min(Yp).max(Xp).optional()}),r({kind:m("effect"),primitiveId:o().min(1),params:x(o(),h()).optional()})]),kind:p(["video","audio","image","overlay","effect"]).optional(),opacity:t().min(Hp).max(Qp).optional(),scale:t().optional(),rotation:t().optional(),position:r({x:t(),y:t()}).optional(),region:r({x:t().min(em).max(om),y:t().min(tm).max(nm),w:t().max(rm),h:t().max(sm)}).optional(),fit:p(["cover","contain"]).optional(),effects:u(r({primitiveId:o().min(1),params:x(o(),h()).optional()})).optional(),transitionIn:r({type:o().min(1),duration:t()}).optional()}))}),r({type:m("addMarker"),marker:r({id:o().min(1),startTime:t().min(im),endTime:t().min(am).optional(),kind:o().min(1),name:o().optional(),metadata:x(o(),h()).optional()})}),r({type:m("removeMarker"),markerId:o()}),r({type:m("updateMarker"),markerId:o(),updates:r({id:o().min(1).optional(),startTime:t().min(dm).optional(),endTime:t().min(pm).optional(),kind:o().min(1).optional(),name:o().optional(),metadata:x(o(),h()).optional()})}),r({type:m("setCropIntents"),clipId:o(),segments:u(r({startSec:t().min(mm),endSec:t(),focus:I([r({mode:m("frame-center")}),r({mode:m("point"),x:t().min(cm).max(lm),y:t().min(um).max(fm)}),r({mode:m("face"),faceId:o().min(1),shotScale:p(["close","standard","wide"]).optional()}),r({mode:m("all-faces")}),r({mode:m("active-speaker")})]),intent:o().optional(),zoom:t().min(gm).max(xm),ease:r({in:t().min(ym),out:t().min(zm)}).optional(),bias:r({x:t().min(bm).max(hm),y:t().min(Cm).max(Sm)}).optional()})).nullable()}),r({type:m("setCaptionStyle"),style:r({fontFamily:o().min(1).optional(),fontSize:t().optional(),fontWeight:t().min(Im).max(vm).optional(),color:o().min(1).optional(),highlightColor:o().min(1).optional(),backgroundColor:o().optional(),position:p(["top","center","bottom"]).optional(),textTransform:p(["none","uppercase","capitalize"]).optional(),emphasisColor:o().optional(),emphasisGradient:o().optional(),emphasisScale:t().optional(),emphasisFontFamily:o().optional(),emphasisFontWeight:t().min(Om).max(Rm).optional(),emphasisTextTransform:p(["none","uppercase","capitalize"]).optional(),emphasisLetterSpacing:t().optional(),emphasisFontStyle:p(["normal","italic"]).optional(),entrance:p(["none","word-pop"]).optional(),entranceMs:t().min(km).optional(),entranceStaggerMs:t().min(jm).optional(),exitMs:t().min(Mm).optional(),emphasisPlate:y().optional(),emphasisPlateColor:o().optional(),emphasisPlateTextColor:o().optional(),emphasisPlateAltColor:o().optional(),emphasisPlateAltTextColor:o().optional(),emphasisPlateRadius:t().min(Tm).optional(),emphasisPlatePadX:t().optional(),emphasisPlatePadY:t().optional(),annotationColor:o().optional(),maxWidthPercent:t().optional()})}),r({type:m("setFormat"),format:r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional()})}),r({type:m("addTrack"),kind:p(["video","audio","image","overlay","effect"]),name:o().optional(),id:o().optional()}),r({type:m("removeTrack"),trackId:o()}),r({type:m("updateTrack"),trackId:o(),updates:r({name:o().optional(),enabled:y().optional()})}),r({type:m("reorderTracks"),fromIndex:t(),toIndex:t()}),r({type:m("moveClipToTrack"),clipId:o(),targetTrackId:o(),newStartTime:t().optional()}),r({type:m("duplicateClip"),clipId:o(),newClipId:o().optional()}),r({type:m("cutAndRipple"),start:t(),end:t()}),r({type:m("ripple"),time:t(),amount:t()}),r({type:m("addExcludedRange"),clipId:o(),sourceStart:t(),sourceEnd:t(),reason:o().optional()}),r({type:m("removeExcludedRange"),clipId:o(),rangeIdx:t()})]).describe("One scoped composition operation. Discriminated by `type` \u2014 `clip.add` / `clip.remove` / `clip.update` patch clips across any family; the rest cover markers, reframe, captions, format, tracks, and the server-authoritative ripple recomputes. Validated strictly server-side against the runtime CompositionOp vocabulary.")).min(1),if_match:o().optional().describe('Optional OCC precondition \u2014 the strong etag (`"<hex>"`) the caller last saw. On mismatch the batch is rejected (409 stale_etag) before any op applies.'),dry_run:y().optional().describe("When true, validate the batch (apply + projection accept/reject guards) WITHOUT persisting. Returns `{ valid, errors }` instead of applying.")}).describe("POST /projects/:id/composition/apply body \u2014 a batch of CompositionOps."),_f=r({id:o()}),wf=r({suggestionId:o().min(1),format:r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional(),platform:o().optional()}).optional()}),_m=0,wm=0,Pm=0,Bm=0,Em=0,Am=0,Fm=4,qm=0,Um=0,$m=0,Nm=0,Wm=1,Km=0,Lm=1;var Zm=.1,Dm=1,Vm=0,Gm=0,Jm=-.3,Ym=.3,Xm=-.3,Hm=.3,Qm=0,ec=1,oc=0,tc=1,nc=-.3,rc=.3,sc=0,ic=1,ac=0,dc=1,pc=0,mc=1,cc=1,lc=1,uc=0,fc=0,gc=0,xc=0,yc=0,zc=100,bc=900,hc=100,Cc=900,Sc=0,Ic=0,vc=0,Oc=0,Pf=r({v:t(),format:r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional(),platform:o().optional()}),tracks:u(r({id:o().min(1),kind:p(["video","audio","image","overlay","effect"]),name:o().optional(),enabled:y().optional(),contents:u(I([r({id:o().min(1),startTime:t().min(_m),duration:t(),source:I([r({kind:m("media"),mediaId:o().min(1),trim:r({start:t().min(wm),end:t().min(Pm)}).optional(),excludedRanges:u(r({start:t().min(Bm),end:t().min(Em),reason:o().optional()})).optional(),volume:t().min(Am).max(Fm).optional(),muted:y().optional(),playbackRate:t().optional(),sync:p(["video","independent"]).optional(),kenBurns:p(["in","out","pan-l","pan-r","none"]).optional(),volumeDb:t().optional(),fadeInMs:t().min(qm).optional(),fadeOutMs:t().min(Um).optional(),loop:y().optional(),reframe:r({segments:u(r({startSec:t().min($m),endSec:t(),focus:I([r({mode:m("frame-center")}),r({mode:m("point"),x:t().min(Nm).max(Wm),y:t().min(Km).max(Lm)}),r({mode:m("face"),faceId:o().min(1),shotScale:p(["close","standard","wide"]).optional()}),r({mode:m("all-faces")}),r({mode:m("active-speaker")})]),intent:o().optional(),zoom:t().min(Zm).max(Dm),ease:r({in:t().min(Vm),out:t().min(Gm)}).optional(),bias:r({x:t().min(Jm).max(Ym),y:t().min(Xm).max(Hm)}).optional()})).min(1)}).optional()}),r({kind:m("component"),componentId:o().min(1),props:x(o(),h())}),r({kind:m("overlay"),primitiveId:o().min(1),params:x(o(),h()),zPlane:p(["front","behind-subject"]).optional(),anchor:r({space:m("scene"),x:t().min(Qm).max(ec),y:t().min(oc).max(tc)}).optional(),parallax:t().min(nc).max(rc).optional()}),r({kind:m("effect"),primitiveId:o().min(1),params:x(o(),h()).optional()})]),kind:p(["video","audio","image","overlay","effect"]).optional(),opacity:t().min(sc).max(ic).optional(),scale:t().optional(),rotation:t().optional(),position:r({x:t(),y:t()}).optional(),region:r({x:t().min(ac).max(dc),y:t().min(pc).max(mc),w:t().max(cc),h:t().max(lc)}).optional(),fit:p(["cover","contain"]).optional(),effects:u(r({primitiveId:o().min(1),params:x(o(),h()).optional()})).optional(),transitionIn:r({type:o().min(1),duration:t()}).optional()}),r({id:o().min(1),startTime:t().min(uc),duration:t()})]))})),markers:u(r({id:o().min(1),startTime:t().min(fc),endTime:t().min(gc).optional(),kind:o().min(1),name:o().optional(),metadata:x(o(),h()).optional()})).optional(),captions:r({segments:u(r({words:u(r({text:o().min(1),startMs:t().min(xc),endMs:t().min(yc),emphasis:y().optional(),annotate:p(["circle","underline"]).optional()}))})),style:r({fontFamily:o().min(1).optional(),fontSize:t().optional(),fontWeight:t().min(zc).max(bc).optional(),color:o().min(1).optional(),highlightColor:o().min(1).optional(),backgroundColor:o().optional(),position:p(["top","center","bottom"]).optional(),textTransform:p(["none","uppercase","capitalize"]).optional(),emphasisColor:o().optional(),emphasisGradient:o().optional(),emphasisScale:t().optional(),emphasisFontFamily:o().optional(),emphasisFontWeight:t().min(hc).max(Cc).optional(),emphasisTextTransform:p(["none","uppercase","capitalize"]).optional(),emphasisLetterSpacing:t().optional(),emphasisFontStyle:p(["normal","italic"]).optional(),entrance:p(["none","word-pop"]).optional(),entranceMs:t().min(Sc).optional(),entranceStaggerMs:t().min(Ic).optional(),exitMs:t().min(vc).optional(),emphasisPlate:y().optional(),emphasisPlateColor:o().optional(),emphasisPlateTextColor:o().optional(),emphasisPlateAltColor:o().optional(),emphasisPlateAltTextColor:o().optional(),emphasisPlateRadius:t().min(Oc).optional(),emphasisPlatePadX:t().optional(),emphasisPlatePadY:t().optional(),annotationColor:o().optional(),maxWidthPercent:t().optional()}).optional()}).optional(),brandKitId:o().optional(),license:r({type:o().min(1),source:o().optional(),notes:o().optional()}).optional(),accessibility:r({audioDescriptionTrackId:o().optional(),captionsTrackId:o().optional(),signLanguageTrackId:o().optional(),notes:o().optional()}).optional()}).describe("Canonical composition wire shape (multi-track; carries reframe, captions, markers)."),Bf=r({valid:y(),errors:u(r({code:o(),stage:o(),category:o(),retryable:y(),message:o(),fix:x(o(),h()).optional()}))});var Af=r({clipId:o()}),Ff=r({clipId:o(),data:u(r({suggestionIndex:t().describe("0-based index into the clip's enrichmentSuggestions array."),kind:p(["video","photo","sfx","gif"]),moment:o(),rationale:o(),searchTerms:u(o()),startTime:t(),duration:t(),fetchStatus:I([m("ok"),m("no_results"),m("failed"),m(null)]).nullable(),candidates:u(r({id:o().describe("Convex `enrichmentCandidates` row id \u2014 pass to `cueframe enrich pick --candidate`."),provider:p(["pexels","pixabay","freesound","klipy"]),kind:p(["video","photo","sfx","gif"]),externalId:o(),query:o().describe("Search term that produced this candidate."),thumbnail:o().url(),previewUrl:o().url(),downloadUrl:o().url(),duration:t().describe("Asset duration in seconds (where applicable)."),width:t(),height:t(),rank:t().describe("0-based position within this suggestion's candidate list."),photographer:o(),photographerUrl:o().url().nullish(),assetUrl:o().url().nullish().describe("Per-asset provider page URL for attribution (Pexels `url`, Pixabay `pageURL`, Freesound `url`, Klipy clip URL).")}))}))}).describe("Enrichment candidates grouped by (suggestionIndex, kind). Each group carries the brief's moment + rationale + search terms alongside the ranked candidate list.");var Uf=r({id:o()}),$f=r({clipSuggestionId:o().min(1)}).describe("POST /projects/:id/exports/{fcpxml,premiere} body."),Nf=r({id:o()}),Wf=r({clipSuggestionId:o().min(1)}).describe("POST /projects/:id/exports/{fcpxml,premiere} body."),Kf=r({id:o(),exportId:o()}),Rc=0,kc=1,Lf=r({id:o(),format:p(["fcpxml","premiere"]),status:p(["queued","trimming","building","uploading","complete","error","cancelled"]),progress:t().min(Rc).max(kc).describe("Fractional progress 0..1 across the trim/build/upload pipeline. Reaches 1 only on `complete`."),outputUrl:o().nullable(),outputExpiresAt:o().nullable(),outputSizeBytes:t().nullable(),outputDurationSec:t().nullable(),error:I([r({phase:p(["trim","build","upload","trigger"]),message:o(),detail:o().optional(),retryable:y()}),Z()]).describe("Set when status is `error`; null otherwise. The phase field localizes the failure to trim / build / upload / trigger."),trimCacheHit:y().nullable(),clipSuggestionId:o().nullable(),createdAt:o(),updatedAt:o()}).describe("NLE export job response.");var Df=r({status:p(["ok","degraded"]),version:o(),checks:x(o(),r({ok:y(),detail:o().optional()})).optional()}).describe("Health probe response."),Vf=r({orgId:o(),permissions:x(o(),u(o())),keyId:o(),keyName:o()}).describe("Whoami response."),Gf=r({});var jc=500,Mc=10737418240,Yf=r({filename:o().min(1).max(jc),contentType:p(["video/mp4","video/quicktime","video/x-matroska","video/webm","audio/mpeg","audio/wav","audio/x-wav","audio/mp4","audio/aac","image/png","image/jpeg","image/webp","image/gif","image/svg+xml","application/json","font/ttf","font/otf","font/woff","font/woff2"]),size:t().max(Mc)}).describe("POST /media upload initiation body."),Xf=r({data:u(r({id:o(),status:o(),source:p(["upload","generated"]),name:o(),mimeType:o(),fileSize:t(),duration:t().nullable(),width:t().nullable(),height:t().nullable(),frameRate:t().nullable(),progress:r({phase:o(),percent:t().nullable()}).nullable(),analysis:x(o(),h()).nullable(),thumbnailUrl:o().nullable(),previewUrl:o().nullable(),kind:o().nullable(),tags:u(o()).nullable(),processingStatus:I([r({phase:p(["idle","pending_import","pending_upload","uploading","extracting","loading_model","transcribing","proxy","embedding","analyzing","indexing","generating","rendering","processing","complete","error","cancelled"]),percent:t().nullish(),message:o().nullish(),error:o().nullish()}),Z()]),createdAt:o(),updatedAt:o()}).describe("Media item response per \xA7Media.")),pagination:r({hasMore:y(),nextCursor:o().nullable(),prevCursor:o().nullable()}).describe("Cursor pagination metadata.")}),Tc=1e4,Hf=r({generator:p(["manim","text-to-video","text-to-image","image-to-video","auto"]),prompt:o().min(1).max(Tc),style:x(o(),h()).optional(),refs:r({firstFrameMediaId:o().optional(),lastFrameMediaId:o().optional(),imageMediaIds:u(o()).optional()}).optional()}).describe("POST /media/generate body."),_c=2048,wc=500,Pc=10737418240,Qf=r({url:o().url().max(_c),filename:o().min(1).max(wc),contentType:p(["video/mp4","video/quicktime","video/x-matroska","video/webm","audio/mpeg","audio/wav","audio/x-wav","audio/mp4","audio/aac","image/png","image/jpeg","image/webp","image/gif","image/svg+xml","application/json","font/ttf","font/otf","font/woff","font/woff2"]),size:t().max(Pc).optional()}).describe("POST /media/import body."),eg=r({id:o()}),og=r({id:o()}),tg=r({id:o(),status:o(),source:p(["upload","generated"]),name:o(),mimeType:o(),fileSize:t(),duration:t().nullable(),width:t().nullable(),height:t().nullable(),frameRate:t().nullable(),progress:r({phase:o(),percent:t().nullable()}).nullable(),analysis:x(o(),h()).nullable(),thumbnailUrl:o().nullable(),previewUrl:o().nullable(),kind:o().nullable(),tags:u(o()).nullable(),processingStatus:I([r({phase:p(["idle","pending_import","pending_upload","uploading","extracting","loading_model","transcribing","proxy","embedding","analyzing","indexing","generating","rendering","processing","complete","error","cancelled"]),percent:t().nullish(),message:o().nullish(),error:o().nullish()}),Z()]),createdAt:o(),updatedAt:o()}).describe("Media item response per \xA7Media."),ng=r({id:o()}),rg=r({mediaItemId:o(),language:o().nullable(),model:o().nullable(),fullText:o(),utterances:u(x(o(),h())),data:u(x(o(),h())).optional(),pagination:r({hasMore:y(),nextCursor:o().nullable(),prevCursor:o().nullable()}).optional().describe("Cursor pagination metadata.")}).describe("Transcript response."),sg=r({id:o()}),ig=r({mediaId:o(),durationSec:t().nullable(),width:t().nullable(),height:t().nullable(),faces:r({status:p(["ready","not_detected"]),windows:u(r({window:r({startSec:t(),endSec:t()}),faces:u(r({faceId:o(),bbox:r({x:t(),y:t(),width:t(),height:t()}),speakingShare:t().optional()}))}))}),transcript:r({status:p(["ready","not_transcribed","unavailable"]),data:I([r({mediaItemId:o(),language:o().nullable(),model:o().nullable(),fullText:o(),utterances:u(x(o(),h())),data:u(x(o(),h())).optional(),pagination:r({hasMore:y(),nextCursor:o().nullable(),prevCursor:o().nullable()}).optional().describe("Cursor pagination metadata.")}).describe("Transcript response."),Z()])})}).describe("Read-only authoring context for a source media item: detected face roster + transcript."),ag=r({id:o()}),dg=r({status:p(["idle","generating","completed","failed"]),createdAt:o().nullable(),analyzedAt:o().nullable(),jobId:o().nullable(),topics:u(o()),suggestions:u(r({id:o(),rank:t(),trim:r({start:t(),end:t()}),score:t(),title:o(),reason:o(),topic:o(),hook:o(),platforms:u(o()),format:o(),caption:o(),hashtags:u(o()),textOverlays:u(o()),editingNotes:o(),motionStyle:r({textAnimation:o(),transitions:o(),colorMood:o(),captionStyle:o()}),visualTreatment:u(r({time:I([t(),o()]),visual:o()})),brollSuggestions:u(r({moment:o(),searchTerms:u(o()),rationale:o()})),thumbnailConcept:o()}).describe("Single ranked clip suggestion.")),pagination:r({hasMore:y(),nextCursor:o().nullable(),prevCursor:o().nullable()}).describe("Cursor pagination metadata.")}).describe("GET /media/:id/suggestions envelope."),pg=r({id:o()}),mg=r({id:o()}),cg=r({id:o()}),lg=r({media:r({id:o(),name:o(),createdAt:o(),fileSize:t(),duration:t().nullable(),status:o()}),window:r({startIso:o(),endIso:o()}),workflowCount:t(),workflows:u(r({name:o(),startedAt:o(),durationMs:t(),activities:u(r({name:o(),startedAt:o(),durationMs:t(),service:o()}))}))}).describe("Per-media performance breakdown: every Temporal workflow + activity span (plus Modal sub-spans) that ran for the requested media item, grouped under its owning workflow by time-range containment. Backed by Axiom proxy \u2014 see the `cueframe stats` CLI subcommand.");var Bc=0,fg=r({data:u(r({id:o(),name:o(),description:o().nullable(),format:I([r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional()}).describe("Output-format spec per \xA7Format."),Z()]),brandKitId:o().nullable(),composition:r({hasComposition:y(),sceneCount:t().min(Bc),duration:t().nullable(),updatedAt:o().nullable()}).describe("Summary of a project's stored composition."),lastRender:r({id:o(),status:o(),createdAt:o(),outputUrl:o().nullable(),outputExpiresAt:o().nullable()}).nullable().describe("Most recent render for a project, if any."),createdAt:o()}).describe("Project response per \xA7Projects.")),pagination:r({hasMore:y(),nextCursor:o().nullable(),prevCursor:o().nullable()}).describe("Cursor pagination metadata.")}),Ec=200,gg=r({name:o().min(1).max(Ec),description:o().optional(),format:r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional()}).optional().describe("Output-format spec per \xA7Format."),brandKitId:o().min(1).optional(),width:t().optional(),height:t().optional()}).describe("POST /projects body."),xg=r({id:o()}),Ac=0,yg=r({id:o(),name:o(),description:o().nullable(),format:I([r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional()}).describe("Output-format spec per \xA7Format."),Z()]),brandKitId:o().nullable(),composition:r({hasComposition:y(),sceneCount:t().min(Ac),duration:t().nullable(),updatedAt:o().nullable()}).describe("Summary of a project's stored composition."),lastRender:r({id:o(),status:o(),createdAt:o(),outputUrl:o().nullable(),outputExpiresAt:o().nullable()}).nullable().describe("Most recent render for a project, if any."),createdAt:o()}).describe("Project response per \xA7Projects."),zg=r({id:o()}),Fc=200,bg=r({name:o().min(1).max(Fc).optional(),description:o().optional(),format:r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional()}).optional().describe("Output-format spec per \xA7Format."),brandKitId:o().min(1).optional()}).describe("PATCH /projects/:id body."),qc=0,hg=r({id:o(),name:o(),description:o().nullable(),format:I([r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional()}).describe("Output-format spec per \xA7Format."),Z()]),brandKitId:o().nullable(),composition:r({hasComposition:y(),sceneCount:t().min(qc),duration:t().nullable(),updatedAt:o().nullable()}).describe("Summary of a project's stored composition."),lastRender:r({id:o(),status:o(),createdAt:o(),outputUrl:o().nullable(),outputExpiresAt:o().nullable()}).nullable().describe("Most recent render for a project, if any."),createdAt:o()}).describe("Project response per \xA7Projects."),Cg=r({id:o()});var Ig=r({id:o()}),vg=r({clipSuggestionId:o().min(1).optional(),format:r({aspectRatio:p(["16:9","9:16","1:1","4:5"]),fps:I([t(),t(),t()]).optional(),resolution:p(["hd","fhd","4k"]).optional()}).optional().describe("Output-format spec per \xA7Format."),priority:p(["interactive","standard","background"]).optional(),intent:p(["preview","final"]).optional()}).describe("POST /projects/:id/renders body."),Og=r({id:o()}),Uc=0,$c=0,Rg=r({data:u(r({id:o(),status:p(["queued","pending","rendering","complete","error","cancelled"]),progress:r({phase:p(["queued","validating","presigning","collecting-artifacts","resolving","detecting","baking-matte","translating","spawning","encoding","uploading"]),percent:t(),scenesCompleted:t().min(Uc).optional(),scenesTotal:t().min($c).optional()}).optional().describe("Non-terminal render progress; phase is one of the worker's emitted stages."),outputUrl:o().nullable(),outputExpiresAt:o().nullable(),error:o().nullable().describe("Human-readable failure message. Pair with `errorCode` for a stable, machine-readable code an agent runner can branch on."),errorCode:o().nullable().describe("Stable error code per docs/api-design-2026-04-14.md \xA7Error Model (e.g. `render_pipeline_unavailable`, `render_route_missing`, `render_pipeline_failed`). Null when status is not `error`, or for legacy rows that predate this field."),errorDetails:x(o(),h()).nullable().describe("Structured failure context \u2014 `{ targetUrl?, upstreamStatus?, upstreamCode?, attemptedAt? }`. Surfaced so agent runners can distinguish operator-config issues from upstream-down vs route-missing without parsing `error`."),createdAt:o()}).describe("Render job response per \xA7Renders.")),pagination:r({hasMore:y(),nextCursor:o().nullable(),prevCursor:o().nullable()}).describe("Cursor pagination metadata.")}),kg=r({id:o(),renderId:o()}),Nc=0,Wc=0,jg=r({id:o(),status:p(["queued","pending","rendering","complete","error","cancelled"]),progress:r({phase:p(["queued","validating","presigning","collecting-artifacts","resolving","detecting","baking-matte","translating","spawning","encoding","uploading"]),percent:t(),scenesCompleted:t().min(Nc).optional(),scenesTotal:t().min(Wc).optional()}).optional().describe("Non-terminal render progress; phase is one of the worker's emitted stages."),outputUrl:o().nullable(),outputExpiresAt:o().nullable(),error:o().nullable().describe("Human-readable failure message. Pair with `errorCode` for a stable, machine-readable code an agent runner can branch on."),errorCode:o().nullable().describe("Stable error code per docs/api-design-2026-04-14.md \xA7Error Model (e.g. `render_pipeline_unavailable`, `render_route_missing`, `render_pipeline_failed`). Null when status is not `error`, or for legacy rows that predate this field."),errorDetails:x(o(),h()).nullable().describe("Structured failure context \u2014 `{ targetUrl?, upstreamStatus?, upstreamCode?, attemptedAt? }`. Surfaced so agent runners can distinguish operator-config issues from upstream-down vs route-missing without parsing `error`."),createdAt:o()}).describe("Render job response per \xA7Renders."),Mg=r({id:o(),renderId:o()}),Kc=0,Lc=0,Tg=r({id:o(),status:p(["queued","pending","rendering","complete","error","cancelled"]),progress:r({phase:p(["queued","validating","presigning","collecting-artifacts","resolving","detecting","baking-matte","translating","spawning","encoding","uploading"]),percent:t(),scenesCompleted:t().min(Kc).optional(),scenesTotal:t().min(Lc).optional()}).optional().describe("Non-terminal render progress; phase is one of the worker's emitted stages."),outputUrl:o().nullable(),outputExpiresAt:o().nullable(),error:o().nullable().describe("Human-readable failure message. Pair with `errorCode` for a stable, machine-readable code an agent runner can branch on."),errorCode:o().nullable().describe("Stable error code per docs/api-design-2026-04-14.md \xA7Error Model (e.g. `render_pipeline_unavailable`, `render_route_missing`, `render_pipeline_failed`). Null when status is not `error`, or for legacy rows that predate this field."),errorDetails:x(o(),h()).nullable().describe("Structured failure context \u2014 `{ targetUrl?, upstreamStatus?, upstreamCode?, attemptedAt? }`. Surfaced so agent runners can distinguish operator-config issues from upstream-down vs route-missing without parsing `error`."),createdAt:o()}).describe("Render job response per \xA7Renders."),_g=r({id:o(),renderId:o()}),wg=r({id:o(),renderId:o()}),Pg=r({outputUrl:o(),outputExpiresAt:o()}).describe("POST /refresh-url response."),Bg=r({id:o(),renderId:o()});var Ag=r({id:o()}),Fg=r({projectId:o(),groupId:o(),selectorVersion:o(),signalVersions:x(o(),o()),moments:u(r({startSec:t().describe("Span start (output seconds)."),endSec:t().describe("Span end (output seconds)."),chosen:o().describe('The recommended candidateId, or "__hold__" (abstain).'),pacingNote:o().nullish().describe("Which mechanism produced the pick (argmax / hysteresis / override / hold \u2026)."),candidates:u(r({candidateId:o().describe("Stable angle/source id. An unknown id is rejected, never remapped."),role:o().nullish().describe('Agent-declared semantic tag (e.g. "wide", "webcam").'),score:t().describe("The weighted prominence score (\u03A3 weights\xB7signal)."),contributions:x(o(),t()).describe("signalKey \u2192 weighted contribution (the agent reweights from this)."),reasons:u(o())}))})),recommendation:r({cutSchedule:u(r({startSec:t(),endSec:t(),candidateId:o(),sourceInSec:t().describe("Chosen source window start (declared-offset resolved)."),sourceOutSec:t(),reasons:u(o())})),audioBed:u(r({startSec:t(),endSec:t(),candidateId:o().describe("The chosen audio source (the clearest mic) for this span \u2192 programAudioSourceId."),reasons:u(o())})).describe("Best-audio bed (instance #3): the clearest mic per span."),suppressedSwitches:u(r({atSec:t(),wouldHaveBeenCandidateId:o(),byScore:t(),blockedBy:o(),releaseAtSec:t().nullable()})).describe("Switches the stabilizer suppressed (the anti-ping-pong audit).")}),divergesFromComposition:y().optional()}).describe("Selector (switch) candidates + recommendation for a synced-angle group. Every candidate carries score + contributions + reasons so the agent reweights from evidence; the recommendation is the lowered cut schedule + best-audio bed."),qg=r({id:o()}),Zc=0,Dc=0,Vc=0,Ug=r({groupId:o().min(1),weights:x(o(),t()).optional().describe("Sparse prominence weights (the taste knob, non-negative). Default = DOMINANCE_WEIGHTS."),minHoldSec:t().optional(),enterSec:t().min(Zc).optional(),switchMargin:t().min(Dc).optional(),cooldownSec:t().min(Vc).optional(),maxHoldSec:t().optional(),lockSourceId:o().optional().describe("Pin a camera/angle for the whole timeline."),overrides:u(r({startSec:t(),endSec:t(),candidateId:o()})).optional()}),$g=r({projectId:o(),groupId:o(),selectorVersion:o(),signalVersions:x(o(),o()),moments:u(r({startSec:t().describe("Span start (output seconds)."),endSec:t().describe("Span end (output seconds)."),chosen:o().describe('The recommended candidateId, or "__hold__" (abstain).'),pacingNote:o().nullish().describe("Which mechanism produced the pick (argmax / hysteresis / override / hold \u2026)."),candidates:u(r({candidateId:o().describe("Stable angle/source id. An unknown id is rejected, never remapped."),role:o().nullish().describe('Agent-declared semantic tag (e.g. "wide", "webcam").'),score:t().describe("The weighted prominence score (\u03A3 weights\xB7signal)."),contributions:x(o(),t()).describe("signalKey \u2192 weighted contribution (the agent reweights from this)."),reasons:u(o())}))})),recommendation:r({cutSchedule:u(r({startSec:t(),endSec:t(),candidateId:o(),sourceInSec:t().describe("Chosen source window start (declared-offset resolved)."),sourceOutSec:t(),reasons:u(o())})),audioBed:u(r({startSec:t(),endSec:t(),candidateId:o().describe("The chosen audio source (the clearest mic) for this span \u2192 programAudioSourceId."),reasons:u(o())})).describe("Best-audio bed (instance #3): the clearest mic per span."),suppressedSwitches:u(r({atSec:t(),wouldHaveBeenCandidateId:o(),byScore:t(),blockedBy:o(),releaseAtSec:t().nullable()})).describe("Switches the stabilizer suppressed (the anti-ping-pong audit).")}),divergesFromComposition:y().optional()}).describe("Selector (switch) candidates + recommendation for a synced-angle group. Every candidate carries score + contributions + reasons so the agent reweights from evidence; the recommendation is the lowered cut schedule + best-audio bed.");var Gc=0,Wg=r({data:u(r({id:o(),name:o(),fileCount:t().min(Gc),muxStatus:o().nullable(),createdAt:o()}).describe("Session list summary (per list endpoint).")),pagination:r({hasMore:y(),nextCursor:o().nullable(),prevCursor:o().nullable()}).describe("Cursor pagination metadata.")}),Jc=200,Yc=50,Xc=20,Kg=r({name:o().min(1).max(Jc),files:u(r({mediaId:o().min(1),role:o().min(1).max(Yc)})).min(1).max(Xc)}).describe("POST /sessions body."),Lg=r({id:o()}),Zg=r({id:o(),name:o(),files:u(r({mediaId:o(),role:o(),status:o().nullable()}).describe("One file member of a session, with optional role + status.")),mux:r({status:o().nullable(),jobId:o().nullable(),muxedItems:x(o(),o()).nullable(),error:o().nullable(),startedAt:o().nullable(),completedAt:o().nullable()}),createdAt:o()}).describe("Session response per \xA7Sessions."),Dg=r({id:o()}),Vg=r({id:o()}),Gg=r({id:o()}),Jg=r({jobId:o(),status:o(),workflowId:o().optional(),muxedItems:x(o(),o()).nullish(),error:o().nullish(),startedAt:o().nullish(),completedAt:o().nullish()}).describe("Mux job response.");var Xg=r({skills:u(r({name:o(),title:o(),description:o()}).describe("A CueFrame agent skill (metadata)."))}).describe("GET /skills response \u2014 the available agent skills."),Hg=r({name:o()});var Hc=0,Qc=0,ex=r({data:u(r({id:o(),url:o().url(),events:u(p(["media.transcribed","media.ready","media.failed","media.suggestions_ready","media.suggestions_failed","session.mux.complete","session.mux.failed","render.complete","render.failed","render.cancelled","compose.complete","compose.failed","compose.cancelled","project.updated","composition.updated","webhook.test"])),settleMs:t().min(Hc),enabled:y(),createdAt:o(),lastDeliveredAt:o().nullable(),lastFailedAt:o().nullable(),consecutiveFailures:t().min(Qc)}).describe("Webhook endpoint record (secret omitted after create).")),pagination:r({hasMore:y(),nextCursor:o().nullable(),prevCursor:o().nullable()}).describe("Cursor pagination metadata.")}),el=0,ol=6e4,ox=r({url:o().min(1),events:u(p(["media.transcribed","media.ready","media.failed","media.suggestions_ready","media.suggestions_failed","session.mux.complete","session.mux.failed","render.complete","render.failed","render.cancelled","compose.complete","compose.failed","compose.cancelled","project.updated","composition.updated","webhook.test"])).min(1),settleMs:t().min(el).max(ol).optional()}).describe("POST /webhooks body."),tx=r({id:o()}),tl=0,nl=0,nx=r({id:o(),url:o().url(),events:u(p(["media.transcribed","media.ready","media.failed","media.suggestions_ready","media.suggestions_failed","session.mux.complete","session.mux.failed","render.complete","render.failed","render.cancelled","compose.complete","compose.failed","compose.cancelled","project.updated","composition.updated","webhook.test"])),settleMs:t().min(tl),enabled:y(),createdAt:o(),lastDeliveredAt:o().nullable(),lastFailedAt:o().nullable(),consecutiveFailures:t().min(nl)}).describe("Webhook endpoint record (secret omitted after create)."),rx=r({id:o()}),rl=0,sl=6e4,sx=r({url:o().min(1).optional(),events:u(p(["media.transcribed","media.ready","media.failed","media.suggestions_ready","media.suggestions_failed","session.mux.complete","session.mux.failed","render.complete","render.failed","render.cancelled","compose.complete","compose.failed","compose.cancelled","project.updated","composition.updated","webhook.test"])).min(1).optional(),settleMs:t().min(rl).max(sl).optional(),enabled:y().optional()}).describe("PATCH /webhooks/:id body."),il=0,al=0,ix=r({id:o(),url:o().url(),events:u(p(["media.transcribed","media.ready","media.failed","media.suggestions_ready","media.suggestions_failed","session.mux.complete","session.mux.failed","render.complete","render.failed","render.cancelled","compose.complete","compose.failed","compose.cancelled","project.updated","composition.updated","webhook.test"])),settleMs:t().min(il),enabled:y(),createdAt:o(),lastDeliveredAt:o().nullable(),lastFailedAt:o().nullable(),consecutiveFailures:t().min(al)}).describe("Webhook endpoint record (secret omitted after create)."),ax=r({id:o()}),dx=r({id:o()});import{readFileSync as pl,writeFileSync as ml,mkdirSync as cl,existsSync as ll}from"fs";import{join as Wo}from"path";import{homedir as ul}from"os";var Ko=Wo(ul(),".cueframe"),Ve=Wo(Ko,"auth.json"),xe={local:"http://127.0.0.1:3211",dev:"https://api-dev.cueframe.ai",prod:"https://api.cueframe.ai"},fl="prod";function Wk(n=fl){return process.env.CUEFRAME_API_URL??xe[n]??xe.prod}function Lo(){return ll(Ve)?JSON.parse(pl(Ve,"utf-8")):{targets:{}}}function gl(n){cl(Ko,{recursive:!0}),ml(Ve,JSON.stringify(n,null,2))}function Kk(n,e="prod",s){let i=Lo(),a=xe[e]??xe.prod;i.targets[e]={apiKey:n,apiUrl:s??a},gl(i)}function Zo(n="prod"){let e=process.env.CUEFRAME_API_KEY,s=process.env.CUEFRAME_API_URL;if(e)return{apiKey:e,apiUrl:s??xe[n]??xe.prod};let a=Lo().targets[n];return a||(console.error(`No auth configured for target "${n}". Run: cueframe auth <api-key> --target ${n}`),process.exit(1)),a}function Do(n){let{apiKey:e,apiUrl:s}=Zo(n);Fe({baseUrl:s,apiKey:e})}function Vo(n){let e=n instanceof q?`${n.message} (${n.code}${n.status?`, ${n.status}`:""})`:n instanceof Error?n.message:String(n),s=Ue(n);return s?`${e}
9
+ \u2192 ${s}`:e}var E={Success:0,UserError:2,ApiClientError:3,ApiServerError:4,NetworkError:5,PaymentRequired:6};function Ge(n){if(n instanceof q){if(n.status===402)return E.PaymentRequired;if(n.status>=500)return E.ApiServerError;if(n.status>=400)return E.ApiClientError}return E.NetworkError}function Jk(n){return n===402?E.PaymentRequired:n>=500?E.ApiServerError:n>=400?E.ApiClientError:E.Success}function we(n){process.exit(n)}import xl from"ora";import yl from"pino";var zl="v1",Go=yl({level:"trace",base:{schemaVersion:zl},messageKey:"event",timestamp:()=>`,"ts":${Date.now()}`,formatters:{level:()=>({_:0})}});function Je(n,e){return xl({text:n,isSilent:!!e}).start()}function ye(n,e,s={}){n.json&&Go.info(s,e)}function Qk(n,e,s){if(n.json){console.log(JSON.stringify(e,null,2));return}s()}function Pe(n,e,s,i){let a=s instanceof Error?s.message:String(s),d=typeof s?.code=="string"?s.code:void 0,c=s?.status;n.json?Go.info({phase:e,message:a,...d?{code:d}:{},...typeof c=="number"?{status:c}:{},exitCode:i},"error"):process.stderr.write(`\u2716 ${e}: ${a}
10
+ `)}function ej(n,e){e.json||console.log(n)}function bl(n){for(let e=0;e<n.length;e++){let s=n.charCodeAt(e);if(s<=31||s===127)return!0}return!1}function Yo(n,e,s){n.length===0&&Jo(`${e} is empty.`,s),bl(n)&&Jo(`${e} contains a control character (newline, tab, or null byte). Identifiers must be plain text \u2014 check for a stray copy-paste artifact.`,s)}function Jo(n,e){Pe(e,"preflight",new Error(n),E.UserError),we(E.UserError)}var hl=5e3,Ye=300*1e3;async function mj(n,e){if(Yo(n,"mediaItemId",e),e.dryRun){ye(e,"analyze_dry_run",{mediaItemId:n,target:e.target,wait:!!e.wait,wouldCall:"POST /v1/media/:id/suggestions"}),e.json||console.log(`[dry-run] Would trigger clip analysis for ${n} on ${e.target}.`);return}Do(e.target),ye(e,"analyze_prepare",{mediaItemId:n,target:e.target,wait:!!e.wait});let s=Je("Triggering clip analysis\u2026",e.json),i;try{i=await be.triggerMediaSuggestions(n),s.succeed(i.workflowId?`Analysis started (workflow: ${i.workflowId})`:`Analysis ${i.alreadyRunning?"already running":"started"}`)}catch(c){s.fail(`Failed to start analysis: ${Vo(c)}`),Pe(e,"analyze_prepare",c,Ge(c)),we(Ge(c))}if(ye(e,"analyze_ready",{mediaItemId:n,workflowId:i.workflowId,alreadyRunning:!!i.alreadyRunning}),!e.wait){e.json||console.log(`
11
+ Run \`cueframe clips ${n}\` to check results.`);return}let a=Je("Waiting for analysis to complete\u2026",e.json),d=Date.now();for(;;){await new Promise(c=>setTimeout(c,hl)),Date.now()-d>Ye&&(a.fail(`Timed out after ${Math.round(Ye/1e3)}s. Run \`cueframe clips ${n}\` to check later.`),Pe(e,"analyze_progress",new Error(`Analysis did not complete within ${Math.round(Ye/1e3)}s`),E.UserError),we(E.UserError));try{let c=await be.listMediaSuggestions(n);if(c.suggestions.length>0){a.succeed(`Analysis complete \u2014 ${c.suggestions.length} clips found`),ye(e,"analyze_complete",{mediaItemId:n,durationMs:Date.now()-d,suggestionCount:c.suggestions.length,suggestions:c.suggestions}),e.json||c.suggestions.forEach((g,z)=>{let O=(g.trim.end-g.trim.start).toFixed(1);console.log(`
12
+ ${z+1}. ${g.title} (${g.id})`),console.log(` ${g.trim.start.toFixed(1)}s \u2013 ${g.trim.end.toFixed(1)}s (${O}s) score: ${g.score}`),console.log(` ${g.reason}`)});return}let l=Math.round((Date.now()-d)/1e3);a.text=`Waiting for analysis\u2026 (${l}s)`,ye(e,"analyze_progress",{mediaItemId:n,elapsedSec:l})}catch{}}}export{Je as a,ye as b,Qk as c,Pe as d,ej as e,q as f,Fe as g,qe as h,He as i,v as j,Ue as k,nt as l,be as m,yo as n,Oo as o,Mo as p,Ao as q,E as r,Ge as s,Jk as t,we as u,Wk as v,Kk as w,Do as x,Vo as y,Yo as z,mj as A};